/* ============================================================
   Sanomatic — form components
   Reusable, token-driven. Depends on theme.css for all values.
   Blocks: layout · field · input/textarea · actions · alert · success
   ============================================================ */

/* ---- Page shell for the form ---- */
.form-page main { min-height: calc(100vh - 160px); }
.form-shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 64px 28px 96px;
}
@media (max-width: 640px) { .form-shell { padding: 40px 22px 72px; } }
.form-shell .eyebrow { margin-bottom: 16px; }
.form-shell h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 0 0 14px;
  color: var(--ink);
  text-wrap: balance;
}
.form-shell .lede {
  font-size: 17.5px; line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 36px;
  max-width: 52ch;
}

/* ---- Field ---- */
.field { margin: 0 0 20px; border: 0; padding: 0; min-width: 0; }
.field-label {
  display: block;
  font-size: 14px; font-weight: 500; color: var(--ink);
  margin-bottom: 7px;
}
.field-label .req { color: var(--accent); margin-left: 2px; }
.field-label .opt { color: var(--faint); font-weight: 400; font-size: 12.5px; margin-left: 5px; }
.field-hint { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

.input, .textarea {
  width: 100%;
  font-family: var(--sans); font-size: 16px; color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover { border-color: var(--field-border-strong); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Invalid state (set via aria-invalid) */
.input[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-wash);
}
.field-error {
  font-size: 13px; color: var(--danger);
  margin: 7px 0 0; min-height: 0;
}
.field-error:empty { display: none; }

/* ---- Actions ---- */
.form-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 28px;
}
.form-actions .spacer { flex: 1; }
.btn-form {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: 0.05em;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease), opacity var(--ease);
}
.btn-form:hover { background: var(--accent-wash); color: var(--accent-deep); }
.btn-form.solid {
  background: var(--accent); color: var(--paper-2);
  box-shadow: var(--shadow-sm);
}
.btn-form.solid:hover {
  background: var(--accent-deep); color: #fff;
  box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.btn-form.ghost { border-color: transparent; color: var(--muted); }
.btn-form.ghost:hover { background: transparent; color: var(--ink); }
.btn-form:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-form[disabled] { opacity: 0.55; cursor: default; pointer-events: none; }

/* ---- Alert (submit error) ---- */
.alert {
  margin-top: 20px;
  font-size: 14.5px; line-height: 1.55;
  color: var(--danger);
  background: var(--danger-wash);
  border: 1px solid rgba(180, 68, 59, 0.28);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.alert[hidden] { display: none; }

/* ---- Success state ----
   Replaces the intro + form entirely once a lead is sent, so the page reads
   as a confirmation rather than a form with a banner stuck on top. */
.form-success[hidden] { display: none; }
.form-success { padding-top: 8px; }
.form-success:focus { outline: none; }
.form-success .tick {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--accent);
  font-size: 26px; margin-bottom: 24px;
  box-shadow: 0 0 0 6px var(--accent-wash);
  animation: tick-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes tick-in { from { opacity: 0; transform: scale(0.72); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .form-success .tick { animation: none; } }
.form-success h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1.12; letter-spacing: -0.012em;
  color: var(--ink); margin: 0 0 14px;
  text-wrap: balance;
}
.form-success .lede {
  font-size: 17.5px; line-height: 1.6;
  color: var(--ink-soft); margin: 0 0 32px; max-width: 52ch;
}

.success-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px 20px;
}
.success-note { font-size: 14.5px; color: var(--muted); }
.success-note a { color: var(--accent); }

/* Honeypot — visually and a11y hidden, still submitted if a bot fills it */
.hp {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
