/* The Front — BNCF form. Light warm surface, new-site tokens (tokens.css):
   Fraunces display + Inter body, OKLCH warm palette, fluid scale, 4-based spacing. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); line-height: var(--leading-normal); font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.topbar { background: var(--ink-strong); padding: var(--space-4) var(--space-5); display: flex; align-items: center; }
.logo-img { height: 26px; width: auto; display: block; }

/* Layout */
.form-wrap { max-width: var(--container); margin: 0 auto; padding: var(--space-7) var(--space-5) var(--space-8); }
.form-head { margin-bottom: var(--space-6); }
h1 { font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: 700; letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); margin: 0 0 var(--space-3); }
.lede { color: var(--muted); font-size: var(--text-md); margin: 0; max-width: 58ch; }
.intro-note { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-normal); margin: var(--space-3) 0 0; max-width: 58ch; }

/* Progress */
.step-caption { font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-3); font-weight: 600; }
.steps { display: flex; gap: 6px; margin-bottom: var(--space-6); }
.steps .step { flex: 1; height: 4px; border-radius: var(--radius-pill); background: var(--rule); font-size: 0; transition: background var(--dur-base) var(--ease-out); }
.steps .step.active { background: var(--ink); }
.steps .step.done { background: var(--muted); }

/* Error summary */
.error-summary { background: var(--error-bg); border: 1px solid var(--error); border-left-width: 4px; border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5); font-size: var(--text-sm); color: var(--error); }
.error-summary ul { margin: var(--space-2) 0 0; padding-left: 18px; }
.error-summary a { color: var(--error); }

/* Fields */
.field { margin-bottom: var(--space-5); }
.field > label { display: block; font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; color: var(--ink-strong); margin-bottom: 7px; }
.field .req { color: var(--error); }
.field input[type=text], .field input[type=email], .field input[type=tel] {
  width: 100%; padding: 13px 14px; border: 1px solid var(--rule); border-radius: var(--radius-md);
  background: var(--card); font: inherit; font-size: var(--text-base); color: var(--ink);
  transition: border-color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ink) 14%, transparent); }
.field .help { font-size: var(--text-sm); color: var(--muted); margin: -2px 0 7px; }
.field .err { color: var(--error); font-size: var(--text-sm); margin-top: 6px; }
.field.invalid input, .field.invalid .file-drop, .field.invalid .sig-wrap { border-color: var(--error); }

/* Checkbox + T&C */
.field.checkbox { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: var(--space-4); }
.field.checkbox input { margin-top: 3px; width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--ink); }
.field.checkbox label { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); font-weight: 400; color: var(--ink); margin: 0; line-height: var(--leading-snug); }
.tc-link { display: inline-block; margin-top: 5px; font-size: var(--text-sm); font-weight: 700; color: var(--ink); }

/* Clickwrap (scroll-to-accept) row */
.cw-ico { width: 20px; height: 20px; flex-shrink: 0; border: 1px solid var(--rule); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--success); margin-top: 1px; }
.cw-ico.on { border-color: var(--success); background: var(--success-bg); }
.cw-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ABN badge */
.abn-badge { display: inline-block; margin-top: var(--space-2); font-size: var(--text-sm); padding: 5px 11px; border: 1px solid var(--rule); border-radius: var(--radius-pill); }
.abn-badge.active { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.abn-badge.cancelled { color: var(--error); border-color: var(--error); background: var(--error-bg); }

/* File upload */
.file-drop {
  border: 1.5px dashed var(--rule); border-radius: var(--radius-md); padding: 22px 18px; text-align: center;
  cursor: pointer; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--muted); transition: border-color var(--dur-quick) var(--ease-out), background var(--dur-quick) var(--ease-out);
}
.file-drop:hover, .file-drop.dragging { border-color: var(--ink); background: color-mix(in oklch, var(--card) 80%, var(--paper)); }
.file-drop:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ink) 14%, transparent); }
.file-drop .file-ico { font-size: 22px; line-height: 1; }
.file-drop.has-file { border-style: solid; border-color: var(--success); color: var(--ink); background: var(--success-bg); }

/* Info / explanatory callout (non-field copy: risk, insurance) */
.field-info { background: color-mix(in oklch, var(--paper) 70%, var(--ink) 4%); border: 1px solid var(--rule); border-left: 3px solid var(--ink); border-radius: var(--radius-md); padding: var(--space-4); }
.field-info .info-title { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--ink-strong); margin-bottom: var(--space-2); }
.field-info .info-body { font-size: var(--text-sm); line-height: var(--leading-loose); color: var(--muted); }
.field-info .info-body ul { margin: var(--space-2) 0; padding-left: 18px; }
.field-info .info-body li { margin: 3px 0; }
.field-info .info-body strong { color: var(--ink); }

/* Defensibility hardening item 3 (onerous-terms notice) — only ever present
   when DEFENSIBILITY=1 splices `onerous_notice` into the schema (worker.js).
   Targeted via the data-key the generic 'info' renderer already sets on every
   field — no app.js change needed. Warm --warn accent distinguishes it from
   the neutral .field-info used for info_risk/info_insurance. */
.field[data-key="onerous_notice"] { border-left-color: var(--warn); background: var(--warn-bg); }
.field[data-key="onerous_notice"] .info-title { color: color-mix(in oklch, var(--warn) 65%, var(--ink)); }

/* Sensitive-docs encapsulation (perceived-security cue, Baymard) */
.docs-secure { border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-5); background: color-mix(in oklch, var(--card) 60%, var(--paper)); }
.docs-secure .secure-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: var(--space-4); }

/* Signature */
.sig-wrap { border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--card); padding: 4px; }
canvas.sigpad { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; border-radius: var(--radius-sm); }
.sig-actions { margin-top: var(--space-2); }

/* Review */
.review-intro { margin: 0 0 var(--space-4); }
.review-list { margin: 0 0 var(--space-6); border-top: 1px solid var(--rule-soft); }
.review-list dt { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: var(--space-4); }
.review-list dd { margin: 3px 0 var(--space-3); font-size: var(--text-base); padding-bottom: var(--space-3); border-bottom: 1px solid var(--rule-soft); }

/* Buttons */
.nav-row { display: flex; gap: var(--space-3); margin-top: var(--space-6); align-items: center; }
.btn { background: var(--ink); color: var(--paper); border: none; border-radius: var(--radius-md); padding: 14px 28px; font: inherit; font-size: var(--text-base); font-weight: 600; letter-spacing: 0.01em; cursor: pointer; transition: opacity var(--dur-quick) var(--ease-out), transform 60ms var(--ease-out); }
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.sm { padding: 9px 18px; font-size: var(--text-sm); }
.btn:disabled { opacity: 0.45; cursor: default; }
#next, #submit { margin-left: auto; }

/* Status */
.status { margin-top: var(--space-5); padding: 15px 16px; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--card); font-size: var(--text-sm); }
.status.error { border-color: var(--error); border-left-width: 4px; color: var(--error); background: var(--error-bg); }
.status.ok { border-color: var(--success); border-left-width: 4px; color: var(--success); background: var(--success-bg); }

/* Notices + footer */
.notice { margin-top: var(--space-6); padding: var(--space-4); background: color-mix(in oklch, var(--paper) 78%, var(--ink) 4%); border-radius: var(--radius-md); line-height: var(--leading-loose); }
.muted { color: var(--muted); } .small { font-size: var(--text-sm); }
.notice a, .page-foot a { color: var(--ink); }
.page-foot { margin-top: var(--space-7); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.page-foot p { font-size: var(--text-xs); color: var(--muted); line-height: var(--leading-loose); margin: 0; }

/* T&C modal (scroll-to-accept clickwrap) */
.modal-overlay { position: fixed; inset: 0; background: color-mix(in oklch, var(--ink) 55%, transparent); display: none; align-items: center; justify-content: center; padding: var(--space-4); z-index: 200; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: var(--radius-lg); max-width: 720px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px color-mix(in oklch, var(--ink) 30%, transparent); }
.modal-head { padding: var(--space-5) var(--space-5) var(--space-3); border-bottom: 1px solid var(--rule); }
.modal-head h2 { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 700; margin: 0; }
.modal-head p { margin: 6px 0 0; font-size: var(--text-sm); color: var(--muted); }
.modal-body { overflow-y: auto; padding: var(--space-5); font-size: var(--text-sm); line-height: var(--leading-loose); color: var(--ink); }
.modal-body h3 { font-size: var(--text-base); margin: var(--space-4) 0 var(--space-2); }
.modal-body p { margin: 0 0 var(--space-3); }
.modal-foot { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--rule); display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.modal-foot .hint { font-size: var(--text-sm); color: var(--muted); }
.modal-foot .hint.done { color: var(--success); }

@media (max-width: 600px) {
  .form-wrap { padding: var(--space-6) var(--space-4) var(--space-7); }
  .btn { padding: 13px 20px; }
  .nav-row { gap: var(--space-2); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ── WP7 inline card step (spec §15) — only present when INLINE_CARD renders the block ── */
/* Full-width FatZebra HPP iframe. The `> div` child rule is the SATF booking-page 30 Jun
   fix — without it the iframe renders as a cramped ~304×154 box inside the form column. */
#fz-payment-container { min-height: 360px; border-radius: var(--radius-md); background: transparent; }
#fz-payment-container > div,
#fz-payment-container iframe { width: 100% !important; max-width: 100% !important; }
#fz-payment-container iframe { border: none !important; min-height: 360px !important; border-radius: var(--radius-md) !important; display: block; }
.inline-card .card-status { margin-top: var(--space-3); padding: 12px 14px; border: 1px solid var(--success); border-left-width: 4px; border-radius: var(--radius-md); background: var(--success-bg); color: var(--success); font-size: var(--text-sm); font-weight: 600; }

/* In-form success screen shown after an inline-card submit (spec §15.4). */
.success-panel { text-align: center; padding: var(--space-7) var(--space-4); max-width: 48ch; margin: 0 auto; }
.success-panel .success-badge { width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 50%; background: var(--success-bg); color: var(--success); border: 1px solid var(--success); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; }
.success-panel h2 { font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 700; margin: 0 0 var(--space-3); }
.success-panel p { color: var(--muted); font-size: var(--text-md); line-height: var(--leading-normal); margin: 0 0 var(--space-3); }
.success-panel .next-step { margin-top: var(--space-6); text-align: left; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-5); }
.success-panel .next-step-label { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: var(--space-2); }
.success-panel .next-step-btn { display: block; text-align: center; text-decoration: none; margin-top: var(--space-3); }
.success-panel .next-step-countdown { font-size: var(--text-xs); color: var(--faint); text-align: center; margin: var(--space-3) 0 0; }

/* ── NET Terms (FORMS.netterms) — additive only, no BNCF selector touched ──── */
/* Selects + textareas match the text-input treatment. */
.field select, .field textarea {
  width: 100%; font: inherit; font-size: var(--text-base); color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-md);
  padding: 12px 14px;
}
.field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ink) 14%, transparent); }
.field textarea { resize: vertical; min-height: 120px; line-height: var(--leading-normal); }

/* Repeatable group cards (directors/guarantors, referees). */
.field-group > label { margin-bottom: var(--space-2); }
.group-item { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: var(--space-4); margin-bottom: var(--space-4); }
.group-item .field { margin-bottom: var(--space-4); }
.group-item .field:last-child { margin-bottom: 0; }
.group-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--rule-soft); }
.group-item-title { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--ink-strong); }
.group-actions { margin-bottom: var(--space-4); }

/* Consent cards: checkbox treatment + explainer + prescribed warning block. */
.field.consent .explainer { font-size: var(--text-sm); line-height: var(--leading-loose); color: var(--muted); margin-top: var(--space-2); }
.field.consent .explainer a { color: inherit; }
.consent-warning { background: color-mix(in oklch, var(--paper) 80%, #b45309 10%); border-left: 3px solid #b45309; border-radius: var(--radius-sm, 4px); padding: var(--space-3); }
.consent-warning strong { color: var(--ink-strong); }

/* Review-step group summaries. */
.review-group-title { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--ink-strong); margin: var(--space-5) 0 var(--space-2); }
.review-list.group-review dt:first-child, .review-list.group-review dd:first-of-type { font-weight: 700; color: var(--ink-strong); }

/* DRAFT banner inside the terms fragment/modal. */
.draft-banner { background: #fef3c7; border: 1px solid #b45309; color: #7c2d12; border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-weight: 700; font-size: var(--text-sm); margin-bottom: var(--space-4); }
