/* page-apply.css: apply.html (the qualifier) only. Replaces the page's old inline <style>.
   The original funnel script drives these classes, unchanged: .step.active / .step.exit (step swap, 250 ms),
   .option-card.selected, button[disabled], #step-counter display, #progress-fill width. Prefix ap-.
   Colour: semantic tokens only (kd.css section 2), so light and dark come from the same rules; no dark selector here.
   The original script writes one inline colour (an empty required field's border-color, rgba red): it is re-skinned
   below with --bad, never by editing the script. */

.ap { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

/* ── top bar: the wordmark home, one ink rule ─────────────────────────────── */
.ap-top { border-bottom: 1px solid var(--rule-strong); }
.ap-top__in { display: flex; align-items: center; min-height: var(--nav-h); }
/* the theme toggle: in the bar beside the wordmark, at the far edge, visible at every width (no menu here); its glyph
   lines up with the sheet's right edge */
.ap-top__in > .kd-theme { margin-left: auto; margin-right: -11px; }

/* ── the spread: words left, the sheet right ─────────────────────────────── */
.ap-grid {
  flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(40px, 6vw, 112px); align-items: start;
  padding-block: clamp(40px, 6vw, 96px) clamp(56px, 7vw, 112px);
}
.ap-intro { position: sticky; top: 40px; display: grid; gap: var(--s-5); align-content: start; }
.ap-status { display: inline-flex; align-items: center; gap: 10px; font-size: var(--t-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-status__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--marker); box-shadow: 0 0 0 1.5px var(--marker-edge); }
.ap-h { font-size: clamp(3.5rem, 7.4vw, 7.75rem); line-height: 0.9; }
/* marker: the light stroke as before (was --mk-bot 0.2em on a 0.12em-padded box). The dark chip covers descenders in kd.css. */
.ap-h .kd-mark { --mk-top: 0.5em; --mk-bot: 0.08em; }
.ap-lead { font-size: 1.25rem; line-height: 1.5; color: var(--ink-2); max-width: 30ch; text-wrap: pretty; }
/* "Step 2 of 4": a big readout under the words; the original script shows it from step 1 */
.ap-count { padding-top: var(--s-4); border-top: 1px solid var(--rule-strong); font-family: var(--font-display); font-size: clamp(2.5rem, 3.6vw, 3.5rem); line-height: 0.9; max-width: 30ch; }
.ap-count #step-num { color: var(--accent); }

/* ── the sheet: a raised sheet (lighter than the page at night), ink frame, heavy top rule = the progress bar ─── */
.ap-sheet { position: relative; background: var(--surface-raised); border: 1px solid var(--rule-strong); border-top: 0; max-width: 46rem; width: 100%; }
/* the progress slot: an ink edge over a dark groove that fills with marker. The groove is the system --track (dark in
   BOTH themes: the marker only reads on a dark ground; at night it is a slot darker than the sheet) */
.progress-bar-track { box-sizing: border-box; height: 6px; border: 1px solid var(--rule-strong); border-bottom: 0; background: var(--track); overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0; background: var(--marker); }
.ap-stage { padding: clamp(24px, 3.4vw, 44px) clamp(20px, 3.4vw, 44px) clamp(28px, 3.4vw, 40px); overflow: clip; } /* the step slide never widens the page */

/* steps: only the active one is in the flow; the leaving one fades out for the script's 250 ms */
.step { display: none; }
.step.active, .step.exit { display: block; }
.step.active { animation: ap-in 360ms var(--ease-out) both; }
.step.exit { animation: ap-out 230ms var(--ease-inout) both; pointer-events: none; }
@keyframes ap-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes ap-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-28px); } }
@media (prefers-reduced-motion: reduce) { .step.active, .step.exit { animation: none; } .step.exit { display: none; } }

.step-eyebrow { font-size: var(--t-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.step-title { margin-top: 10px; font-family: var(--font-display); font-weight: 400; font-size: clamp(2.5rem, 3.8vw, 3.5rem); line-height: 0.94; letter-spacing: -0.003em; text-wrap: balance; }
.step-title:focus { outline: none; }
.step-title:focus-visible { outline: none; } /* focus is moved here by script so screen readers hear the new question; a heading is not a control */
.step-sub { margin-top: var(--s-3); font-size: 1.0625rem; line-height: 1.55; color: var(--ink-2); max-width: 52ch; }

/* step 0: one big go button */
.ap-go {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 88px; padding: 0 28px;
  border: 0; border-radius: var(--radius-ctl); background: var(--accent-fill); color: var(--on-accent);
  font-family: var(--font-display); font-weight: 400; font-size: clamp(2.25rem, 3.4vw, 3rem); line-height: 1; letter-spacing: 0;
  transition: background-color var(--d-state) linear, transform 90ms linear;
}
.ap-go::after, .btn-next::after, .btn-book-call::after {
  content: ""; flex: none; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h16M13 5.5l6.5 6.5-6.5 6.5' fill='none' stroke='currentColor' stroke-width='2.6' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h16M13 5.5l6.5 6.5-6.5 6.5' fill='none' stroke='currentColor' stroke-width='2.6' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--d-state) var(--ease-out);
}
.ap-go::after { width: 34px; height: 34px; }
.ap-go:hover { background: var(--accent-fill-hover); }
.ap-go:hover::after, .btn-next:not(:disabled):hover::after, .btn-book-call:hover::after { transform: translateX(4px); }
.ap-go:active { transform: translateY(1px); }
.ap-go:focus-visible, .btn-next:focus-visible, .btn-back:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.cover-note { margin-top: var(--s-3); font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); }

/* ── choice tiles (the original .option-card divs, made radios by the a11y script) ── */
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: var(--s-6); }
.option-card {
  position: relative; display: grid; align-content: start; gap: 4px; min-height: 84px; padding: 16px 16px 16px 52px;
  border: 1px solid var(--line-input); border-radius: var(--radius-ctl); background: var(--field); cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent; user-select: none;
  transition: background-color var(--d-state) linear, border-color var(--d-state) linear, box-shadow var(--d-state) linear;
}
/* the radio: a ring, then an ink disc with the check CUT OUT of it (the chosen tile's tint shows through the tick), so
   the mark is two tokens in both themes and no colour is baked into an image (same drawing as the booking sheet) */
.option-card::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 22px; height: 22px; box-sizing: border-box;
  border: 1.5px solid var(--ink-2); border-radius: 999px; background: var(--field);
  transition: background-color var(--d-state) linear, border-color var(--d-state) linear;
}
.option-card:hover { border-color: var(--ink); background: var(--surface-3); }   /* surface-3: the sheet is raised; surface-2 is darker than it at night */
.option-card:focus { outline: none; }
.option-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.option-card.selected { background: var(--accent-tint); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.option-card.selected::before {
  border-color: var(--ink); background-color: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.3 12.3l3.6 3.5 7.8-8' fill='none' stroke='currentColor' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat, linear-gradient(currentColor, currentColor);
  -webkit-mask-composite: xor;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.3 12.3l3.6 3.5 7.8-8' fill='none' stroke='currentColor' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat exclude, linear-gradient(currentColor, currentColor);
  animation: ap-pop 220ms var(--ease-out);
}
@keyframes ap-pop { from { transform: scale(0.7); } to { transform: none; } }
.option-label { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; color: var(--ink); text-wrap: pretty; }
.option-sub { font-size: 0.9375rem; line-height: 1.4; color: var(--ink-2); }

/* ── next / back ─────────────────────────────────────────────────────────── */
.ap-actions { display: flex; flex-direction: row-reverse; align-items: center; gap: var(--s-4); margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--rule-strong); }
.btn-next {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60px; padding: 0 24px;
  border: 1.5px solid var(--accent-fill); border-radius: var(--radius-ctl); background: var(--accent-fill); color: var(--on-accent);
  font: 800 1.125rem/1.1 var(--font-text); letter-spacing: -0.01em;
  transition: background-color var(--d-state) linear, border-color var(--d-state) linear, color var(--d-state) linear, transform 90ms linear;
}
.btn-next:not(:disabled):hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn-next:not(:disabled):active { transform: translateY(1px); }
/* waiting for an answer: an ink outline, not a faded violet; the tap falls through to the row (see the a11y script) */
.btn-next:disabled { background: transparent; color: var(--ink-2); border-color: var(--rule-strong); border-style: dashed; cursor: not-allowed; pointer-events: none; }
.btn-next:disabled::after { opacity: 0.5; }
.btn-back {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 6px 0 0; border: 0; background: none;
  font-size: 1rem; font-weight: 700; color: var(--ink); border-radius: var(--radius-ctl);
}
.btn-back::before {
  content: ""; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 12H5M11 5.5L4.5 12l6.5 6.5' fill='none' stroke='currentColor' stroke-width='2.6' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 12H5M11 5.5L4.5 12l6.5 6.5' fill='none' stroke='currentColor' stroke-width='2.6' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--d-state) var(--ease-out);
}
.btn-back:hover { color: var(--accent); }
.btn-back:hover::before { transform: translateX(-3px); }

/* ── contact step ───────────────────────────────────────────────────────── */
.ap-fields { margin-top: var(--s-6); row-gap: var(--s-5); }
.ap-fields .kd-input { min-height: 52px; }
.ap-fields .kd-input:hover { border-color: var(--ink); }
.ap-fields .kd-field__err:empty { display: none; }
.ap-fields .kd-field.is-bad .kd-field__err { display: flex; align-items: center; gap: 8px; }
.ap-fields .kd-field.is-bad .kd-field__err::before {
  content: "!"; content: "!" / ""; display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 999px;
  background: var(--bad); color: var(--surface); font-size: 0.8125rem; font-weight: 800; line-height: 1;
}
/* the original script paints an empty required field's border with an inline rgba red (only reachable if the disabled
   submit is ever bypassed): the same meaning, from the token */
.ap-fields .kd-input[style*="border-color"] { border-color: var(--bad) !important; border-width: 2px; }
.ap-submit { min-height: 68px; font-size: 1.25rem; }

/* ── result sheets ──────────────────────────────────────────────────────── */
.ap-result .step-title { font-size: clamp(3rem, 5vw, 4.75rem); line-height: 0.9; margin-top: 12px; }
.ap-result .step-sub { font-size: 1.125rem; margin-top: var(--s-4); }
.result-icon { display: none; }
/* "you're in": a marker check on a dark disc: the system --track (dark in both themes; at night a well darker than the
   sheet), because the marker is only ever drawn on a dark ground; the tick is a mask filled with the token */
.result-icon.good {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: var(--s-5); border-radius: 999px;
  background: var(--track); outline: 1px solid var(--photo-edge); outline-offset: -1px;
}
.result-icon.good::after {
  content: ""; width: 34px; height: 34px; background: var(--marker);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.6l5.2 5L20 6.6' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.6l5.2 5L20 6.6' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ap-result--no .step-eyebrow { color: var(--ink-2); }
.btn-book-call { display: flex; width: 100%; justify-content: space-between; margin-top: var(--s-6); min-height: 68px; font-size: 1.1875rem; font-weight: 800; }
.btn-book-call.kd-btn--secondary { justify-content: space-between; }
.result-note { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--rule); font-size: 0.9375rem; line-height: 1.55; color: var(--ink-2); }

/* ── consent: the foot of the sheet, on every step ──────────────────────── */
.ap-consent { padding: 14px clamp(20px, 3.4vw, 44px) 16px; border-top: 1px solid var(--rule-strong); background: var(--surface-2); font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); }
.ap-consent a { padding-block: 12px; font-weight: 700; color: var(--ink); } /* inline padding: a 44px tap box, no change to the line */

/* ── no JS ──────────────────────────────────────────────────────────────── */
/* without JavaScript the funnel cannot run: the go button is shown (same copy) but reads as unavailable */
html:not(.kd-js) .ap-go { opacity: 0.45; cursor: not-allowed; }
.ap-noscript { margin: clamp(24px, 3.4vw, 44px) clamp(20px, 3.4vw, 44px) 0; padding: 16px 18px; border: 1px solid var(--rule-strong); background: var(--accent-tint); font-size: 1.0625rem; font-weight: 600; line-height: 1.5; }
.ap-noscript a { color: var(--accent); font-weight: 700; }

/* ── tablet / phone: one column, the form right after a short headline ─── */
@media (max-width: 959px) {
  .ap-grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-6); }
  .ap-intro { display: contents; }
  .ap-status { order: 1; }
  .ap-h { order: 2; font-size: clamp(3.5rem, 15vw, 6rem); margin-top: -8px; }
  .ap-count { order: 3; font-size: 2rem; padding-top: var(--s-3); }
  .ap-sheet { order: 4; max-width: none; }
  .ap-lead { order: 5; max-width: 40ch; font-size: 1.0625rem; }
}
@media (max-width: 719px) {
  .ap-grid { padding-top: var(--s-6); row-gap: var(--s-5); }
  .ap-sheet { margin-inline: calc(-1 * var(--gutter)); width: auto; border-inline: 0; }
  .ap-stage { padding: 24px var(--gutter) 28px; }
  .ap-consent { padding-inline: var(--gutter); }
  .ap-noscript { margin: 24px var(--gutter) 0; }
  .option-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: var(--s-5); }
  .option-card { min-height: 64px; padding: 14px 14px 14px 50px; }
  .option-card::before { left: 14px; top: 50%; margin-top: -11px; }
  .step-title { font-size: 2.5rem; }
  .ap-result .step-title { font-size: 3.25rem; }
  .ap-actions { flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .btn-back { align-self: flex-start; }
  .ap-go { min-height: 76px; font-size: 2.5rem; }
}
