/* Vertex Resolution — "Evergreen ledger."
   Deep pine + warm paper + a recurring ember accent; Fraunces for the voice,
   Public Sans for the forms. Calm, grounded, editorial — not SaaS blue.
   All motion is CSS-only and gated behind prefers-reduced-motion. */

/* ---------- Fonts (self-hosted latin subsets, ~62KB total) ---------- */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 100 900; /* variable file — full wght axis, so <strong> gets true 700 */
  font-display: swap;
  src: url('/fonts/public-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens (all text pairs computed ≥ 4.5:1 AA) ---------- */

:root {
  --paper: #f6f1e7;        /* warm paper page ground */
  --surface: #fffcf6;      /* raised card/input surface */
  --ink: #212b23;          /* 13.0:1 on paper */
  --ink-soft: #45564b;     /* 6.95:1 on paper */
  --ink-faint: #5b6b60;    /* 5.02:1 on paper, 5.52:1 on surface */
  --pine: #1c4f3c;         /* brand green — white on it: 9.4:1 */
  --pine-deep: #123528;    /* footer / hover ground */
  --pine-tint: #e2ebe1;
  --ember: #b25c2f;        /* the recurring accent — rules, halos, icons */
  --ember-text: #9c4a1f;   /* 5.47:1 on paper when ember must be text */
  --ember-tint: #f5e3d2;
  --cream: #fdf9ef;        /* text on pine: 8.94:1 */
  --border: #ded2b8;
  --border-strong: #c9bda2;
  --error: #a3271f;        /* 6.51:1 on paper */
  --error-tint: #f9e5e0;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-rest: 0 1px 2px rgba(33, 43, 35, 0.05), 0 2px 10px rgba(33, 43, 35, 0.05);
  --shadow-lift: 0 2px 4px rgba(33, 43, 35, 0.07), 0 10px 26px rgba(33, 43, 35, 0.10);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-text: 'Public Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 0.85, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--paper);
  /* pine wash at the top + fine paper grain (tiny inline SVG, tiled) */
  background-image:
    radial-gradient(1100px 420px at 50% -8%, rgba(28, 79, 60, 0.07), transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.032'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--ember-tint); color: var(--ink); }

/* ---------- Header / footer ---------- */

.site-header {
  background: transparent;
  border-bottom: 1px solid rgba(28, 79, 60, 0.16);
}

.header-inner {
  display: flex;
  /* Wraps only when the row truly can't fit shrunken content (~320px or heavy
     text zoom) — the tag's 120px flex-basis keeps it beside the brand on
     ordinary phones. */
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 8px; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.14rem;
  letter-spacing: 0.002em;
  /* no nowrap: at 200% text zoom on narrow screens the name must be able to
     wrap instead of forcing horizontal scroll; at normal sizes the flex line
     fits and it renders on one line anyway */
}

.header-tag {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: right;
  /* 120px basis: shrinks-and-wraps beside the brand on phones (right-aligned,
     as designed); drops to its own full-width row only when even that can't
     fit, where grow:1 keeps text-align:right meaningful */
  flex: 1 1 120px;
  min-width: 0;
}

.site-footer {
  margin-top: 56px;
  padding: 30px 0 44px;
  background: var(--pine-deep);
  color: var(--cream);
  border-top: 4px solid var(--ember);
}

.footer-links { margin: 0 0 12px; font-size: 0.9rem; }

.footer-links a {
  display: inline-block;
  padding: 11px 2px;
  color: var(--cream);
  text-decoration-color: rgba(253, 249, 239, 0.45);
  text-underline-offset: 3px;
}

.footer-links a:hover { text-decoration-color: var(--ember); }

/* Pine outline vanishes on the pine-deep footer (1.43:1) — use cream there. */
.site-footer a:focus-visible { outline-color: var(--cream); }

.footer-links span { margin: 0 8px; color: rgba(253, 249, 239, 0.45); }

.footer-legal {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #b7c9ba; /* 7.7:1 on pine-deep */
  max-width: 640px;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

main.container { padding-top: 28px; min-height: 62vh; }

.noscript-note {
  background: var(--error-tint);
  border: 1px solid rgba(163, 39, 31, 0.4);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--error);
}

.screen-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.65rem, 5.5vw, 2.15rem);
  line-height: 1.16;
  letter-spacing: -0.008em;
  margin: 0 0 10px;
  outline: none; /* focused programmatically for screen readers */
}

/* The ember rule — the accent that follows you through every screen. */
.screen-heading::after {
  content: '';
  display: block;
  width: 46px;
  height: 4px;
  border-radius: 2px;
  background: var(--ember);
  margin-top: 12px;
}

.screen-sub {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 46ch;
}

/* ---------- Progress ---------- */

.progress {
  list-style: none;
  display: flex;
  margin: 8px 0 30px;
  padding: 0;
}

.progress-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  position: relative;
}

/* track */
.progress-step + .progress-step::before {
  content: '';
  position: absolute;
  top: 14px; /* centers the 2px line on the 30px dots' midline */
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  border-radius: 1px;
  background: var(--border-strong);
}

/* fill — sweeps across the track when the previous step completes */
.progress-step + .progress-step::after {
  content: '';
  position: absolute;
  top: 14px; /* centers the 2px line on the 30px dots' midline */
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  border-radius: 1px;
  background: var(--pine);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.progress-step.is-done + .progress-step::after { transform: scaleX(1); }

.progress-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--ink-faint);
  position: relative;
  z-index: 1;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    color 0.3s ease, box-shadow 0.3s ease;
}

.progress-step.is-active .progress-dot {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--cream);
  box-shadow: 0 0 0 4px var(--ember-tint); /* ember halo marks "you are here" */
}

.progress-step.is-done .progress-dot {
  background: var(--pine-tint);
  border-color: var(--pine);
  color: var(--pine);
}

.progress-label {
  font-size: 0.76rem;
  color: var(--ink-faint);
  transition: color 0.3s ease;
}

.progress-step.is-active .progress-label {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Service card ---------- */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 96px;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--pine);
  box-shadow: var(--shadow-lift);
}

.card-icon {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--ember-tint);
  color: var(--ember-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s ease;
}

.card:hover .card-icon { background: #f0d9c1; }

.card-icon svg { width: 26px; height: 26px; }

.card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere; /* survives 200% text zoom at 320px */
}

.card-blurb { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.5; }

.card-arrow {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 1.25rem;
  flex: none;
  transition: color 0.2s ease;
}

.card:hover .card-arrow { color: var(--ember-text); }

/* ---------- Forms ---------- */

.field { margin-bottom: 20px; }

.field label,
.consent-row label {
  display: block;
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 7px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
select {
  width: 100%;
  min-height: 54px;
  padding: 13px 15px;
  font: inherit;
  font-size: 1rem; /* ≥16px prevents iOS zoom-on-focus */
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid #94886d; /* 3.11:1 vs paper — field boundary stays visible */
  border-radius: var(--radius-sm);
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input::placeholder { color: var(--ink-faint); opacity: 1; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2345564b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 42px;
}

input:focus,
select:focus {
  /* transparent outline is invisible here but painted in forced-colors mode,
     where the box-shadow halo below gets stripped */
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--pine);
  box-shadow: 0 0 0 4px rgba(28, 79, 60, 0.16);
}

input.is-invalid,
select.is-invalid {
  border-color: var(--error);
}

input.is-invalid:focus,
select.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(163, 39, 31, 0.16);
}

.input-prefix { position: relative; }

/* em metrics so the $ scales with text zoom instead of overlapping digits */
.input-prefix .prefix {
  position: absolute;
  left: 0.9em;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 1rem;
  pointer-events: none;
}

.input-prefix input {
  padding-left: 1.95em;
  font-variant-numeric: tabular-nums;
}

.field-hint {
  margin: 7px 0 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* Error elements are permanent live regions: rendered but zero-footprint while
   empty, so screen readers announce the text the moment it is inserted. */
.field-error {
  margin: 7px 0 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--error);
}

.field-error:empty { margin: 0; }

.form-status {
  margin: 0 0 18px;
  padding: 12px 15px;
  background: var(--error-tint);
  border: 1px solid rgba(163, 39, 31, 0.35);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.9rem;
}

.form-status:empty {
  margin: 0;
  padding: 0;
  border: none;
}

.form-status:focus { outline: none; }

/* ---------- Consent ---------- */

.consent-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 24px 0 12px;
  box-shadow: var(--shadow-rest);
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.consent-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  border: 2px solid var(--pine);
  border-radius: 7px;
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.consent-row input[type="checkbox"]::before {
  content: '';
  width: 11px;
  height: 6px;
  margin-top: -2px;
  border-left: 2.5px solid var(--cream);
  border-bottom: 2.5px solid var(--cream);
  transform: rotate(-45deg) scale(0);
  opacity: 0;
}

.consent-row input[type="checkbox"]:checked {
  background: var(--pine);
  border-color: var(--pine);
}

.consent-row input[type="checkbox"]:checked::before {
  transform: rotate(-45deg) scale(1);
  opacity: 1;
}

.consent-row input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 2px;
}

/* Wins the specificity contest against the pine border rule above, so the
   unchecked-consent error actually turns the box red. */
.consent-row input[type="checkbox"].is-invalid {
  border-color: var(--error);
}

.consent-row label {
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
  cursor: pointer;
}

.consent-box .field-error { margin-top: 10px; }
.consent-box .field-error:empty { margin: 0; }

.disclosure {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-faint);
  margin: 0 0 24px;
}

.disclosure a { color: var(--pine); }

/* ---------- Buttons & links ---------- */

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 15px 22px;
  font: inherit;
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, box-shadow 0.22s ease;
}

.btn-primary {
  background: var(--pine);
  color: var(--cream);
  box-shadow: 0 2px 6px rgba(18, 53, 40, 0.22);
}

.btn-primary:hover {
  background: var(--pine-deep);
  box-shadow: 0 4px 14px rgba(18, 53, 40, 0.28);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.75;
  cursor: default;
}

.back-link {
  display: inline-block;
  background: none;
  border: none;
  padding: 8px 0;
  margin: 0 0 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--pine);
  cursor: pointer;
}

.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.back-link:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: var(--pine); text-underline-offset: 3px; }

a:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Thanks ---------- */

.thanks-icon { margin: 10px 0 20px; }
.thanks-icon svg { width: 68px; height: 68px; }
.thanks-icon circle { fill: var(--pine-tint); }
.thanks-icon path { stroke: var(--pine); }

.next-steps {
  margin: 0 0 22px;
  padding: 0 0 0 22px;
  color: var(--ink-soft);
}

.next-steps li { margin-bottom: 11px; }

.next-steps li::marker { color: var(--ember-text); }

.fine-print {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ---------- Legal pages ---------- */

.legal { max-width: 760px; }

.legal h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  letter-spacing: -0.008em;
  line-height: 1.15;
  margin: 10px 0 6px;
}

.legal h1::after {
  content: '';
  display: block;
  width: 46px;
  height: 4px;
  border-radius: 2px;
  background: var(--ember);
  margin-top: 12px;
}

.legal .updated {
  color: var(--ink-faint);
  font-size: 0.88rem;
  margin: 14px 0 30px;
}

.legal h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.28rem;
  margin: 36px 0 10px;
}

.legal h3 { font-size: 1rem; margin: 24px 0 8px; }

.legal p, .legal li { color: var(--ink-soft); font-size: 0.95rem; }

.legal ul { padding-left: 22px; }

.legal li::marker { color: var(--ember-text); }

.legal .callout {
  background: var(--pine-tint);
  border-left: 3px solid var(--ember);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
}

/* ---------- Wider screens ---------- */

@media (min-width: 560px) {
  .card { padding: 26px 24px; }
  .btn { width: auto; min-width: 230px; }
  main.container { padding-top: 36px; }
}

/* ---------- Motion (all gated on reduced-motion preference) ---------- */

@media (prefers-reduced-motion: no-preference) {

  /* Screens rise in as one continuous flow — the header and progress bar stay
     fixed, so each step reads as the next stretch of the same page. */
  @keyframes screen-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes child-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }

  .screen:not([hidden]) {
    animation: screen-in 0.4s var(--ease-out) both;
  }

  .screen:not([hidden]) > * {
    animation: child-rise 0.45s var(--ease-out) backwards;
  }

  .screen:not([hidden]) > :nth-child(2) { animation-delay: 0.05s; }
  .screen:not([hidden]) > :nth-child(3) { animation-delay: 0.1s; }
  .screen:not([hidden]) > :nth-child(4) { animation-delay: 0.15s; }
  .screen:not([hidden]) > :nth-child(5) { animation-delay: 0.2s; }
  .screen:not([hidden]) > :nth-child(6) { animation-delay: 0.25s; }

  /* Progress: the track fill sweeps forward; the arriving dot pops. */
  .progress-step + .progress-step::after {
    transition: transform 0.5s var(--ease-out) 0.08s;
  }

  @keyframes dot-pop {
    0% { transform: scale(0.82); }
    60% { transform: scale(1.14); }
    100% { transform: scale(1); }
  }

  .progress-step.is-active .progress-dot {
    animation: dot-pop 0.4s var(--ease-spring);
  }

  /* Cards lift; the arrow leans into the click. */
  .card { transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.22s var(--ease-out); }
  .card:hover { transform: translateY(-2px); }
  .card:active { transform: translateY(0) scale(0.99); }
  .card-arrow { transition: color 0.2s ease, transform 0.22s var(--ease-out); }
  .card:hover .card-arrow { transform: translateX(4px); }
  .card-icon { transition: background-color 0.25s ease, transform 0.25s var(--ease-spring); }
  .card:hover .card-icon { transform: rotate(-3deg) scale(1.05); }

  /* Consent check springs in. */
  .consent-row input[type="checkbox"]::before {
    transition: transform 0.22s var(--ease-spring), opacity 0.12s ease;
  }

  /* Buttons lift on hover, press on click, shimmer while saving. */
  .btn { transition: background-color 0.18s ease, box-shadow 0.22s ease, transform 0.18s var(--ease-out); }
  .btn-primary:hover { transform: translateY(-1px); }
  .btn-primary:active { transform: translateY(0) scale(0.99); }

  @keyframes btn-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
  }

  .btn[aria-busy="true"] {
    background-image: linear-gradient(
      110deg,
      transparent 35%,
      rgba(253, 249, 239, 0.16) 50%,
      transparent 65%
    );
    background-size: 200% 100%;
    animation: btn-shimmer 1.2s linear infinite;
  }

  /* Thank-you check draws itself (path has pathLength="1"). */
  @keyframes check-draw {
    to { stroke-dashoffset: 0; }
  }

  #screen-thanks:not([hidden]) .thanks-icon path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: check-draw 0.55s ease-out 0.35s forwards;
  }

  @keyframes icon-pop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.06); }
    100% { transform: scale(1); opacity: 1; }
  }

  #screen-thanks:not([hidden]) .thanks-icon svg {
    animation: icon-pop 0.45s var(--ease-spring) 0.15s both;
  }
}

/* ---------- Forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  /* The custom data-URI chevron can vanish on dark system themes — hand the
     dropdown affordance back to the OS. */
  select {
    appearance: auto;
    background-image: none;
    padding-right: 15px;
  }
}

/* ---------- Misc ---------- */

.screen[hidden] { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
