/* =========================================================================
   Form E Prep Assistant — Niggly Stuff
   Niggly Stuff "Design A", Legal & Estate (blue) category. Deep navy ink,
   confident blue accent, white surfaces on a faint blue-tinted page. Display
   font Bricolage Grotesque, body Inter, mono IBM Plex Mono for Form E section
   numbers (echoing the official form). All fonts self-hosted: zero external
   requests, which is what makes "nothing leaves the device" verifiable.
   Mobile-first. No em dashes in any content.
   ========================================================================= */

/* --- Self-hosted fonts --------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('../assets/fonts/bricolage-600.woff2') format('woff2');
  font-weight: 600 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../assets/fonts/plex-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  --paper:      #F4F7FA;   /* faint blue-tinted page (Legal & Estate) */
  --surface:    #FFFFFF;
  --ink:        #132A45;   /* deep navy: headings, primary text */
  --body:       #3B4A5A;   /* readable slate body */
  --muted:      #6A7787;
  --blue:       #1D5C96;   /* confident blue accent + CTAs */
  --blue-deep:  #164A7A;
  --blue-tint:  #E8F0F8;   /* category tint */
  --blue-line:  #CFE0F0;
  --amber:      #B7791F;   /* deadline / priority accents (text-safe) */
  --amber-tint: #FBF1DE;
  --amber-line: #EAD6AC;
  --line:       #E3E8EF;
  --danger:     #B23B3B;
  --shadow:     0 1px 2px rgba(19,42,69,.05), 0 8px 24px rgba(19,42,69,.07);
  --shadow-sm:  0 1px 2px rgba(19,42,69,.06);

  --display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --wrap: 760px;
}

/* --- Reset-ish ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--body);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--ink); line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--blue-deep); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img, svg { max-width: 100%; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }

/* --- Accessibility helpers ---------------------------------------------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 12px; }
:where(a, button, input, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Site header --------------------------------------------------------- */
.site-head { padding: 16px 0; }
.site-head__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: -.01em;
}
.brand__mark { display: inline-flex; line-height: 0; }
.brand__mark svg { display: block; }
.brand__name { font-size: .98rem; }
.scope-tag {
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  color: var(--blue-deep); background: var(--blue-tint);
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}

/* --- Shared bits --------------------------------------------------------- */
.eyebrow {
  font-family: var(--mono);
  text-transform: uppercase; letter-spacing: .08em; font-size: .7rem;
  font-weight: 600; color: var(--blue-deep); margin-bottom: 10px;
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
}
.card--soft { box-shadow: none; background: var(--blue-tint); border-color: var(--blue-line); }

/* --- Intake -------------------------------------------------------------- */
.intake { padding-top: 8px; padding-bottom: 48px; }
.intake__intro { text-align: center; max-width: 620px; margin: 8px auto 22px; }
.intake__title {
  font-family: var(--display); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(2rem, 6vw, 2.9rem); margin-bottom: 12px;
}
.intake__lead { color: var(--body); font-size: 1.05rem; }
.scope-note, .support-note { max-width: 620px; margin: 0 auto 26px; }
.scope-note p, .support-note p { font-size: .95rem; color: var(--body); }
/* Warmer tint so the support note reads as care, not another rules box. */
.support-note { background: var(--amber-tint); border-color: var(--amber-line); }

.intake__form { max-width: 600px; margin-inline: auto; }

/* triage groups */
.triage-group { margin-bottom: 6px; padding-bottom: 20px; }
.triage-group + .triage-group { border-top: 1px solid var(--line); padding-top: 22px; }
.triage-group__title {
  font-family: var(--display); font-weight: 600; font-size: 1.12rem; margin-bottom: 4px;
}
.triage-group__intro { color: var(--muted); font-size: .9rem; margin-bottom: 14px; max-width: 56ch; }

.field { margin-bottom: 20px; border: 0; padding: 0; margin-inline: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field legend {
  display: block; font-weight: 600; color: var(--ink); margin-bottom: 7px; font-size: 1rem;
}
.field legend { padding: 0; }
.field__opt, .field__req { font-weight: 400; color: var(--muted); font-size: .85em; }
.field__help { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.field__error { font-size: .88rem; color: var(--danger); margin-top: 6px; font-weight: 500; }
.field--group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; margin-top: 8px; }
.field__group-legend { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }

input[type="text"], input[type="date"], input[type="number"], textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); outline: none;
}
input[aria-invalid="true"] { border-color: #C86B6B; }

/* yes/no toggle + choice options share the pill-row look */
.opt-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.opt-row--stack { flex-direction: column; }
.opt {
  flex: 1 1 120px; display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; background: #fff; transition: border-color .15s, background .15s;
  font-weight: 500; color: var(--ink);
}
.opt-row--stack .opt { flex: 1 1 auto; }
.opt:hover { border-color: var(--blue); }
.opt:has(input:checked) { border-color: var(--blue); background: var(--blue-tint); }
.opt input { accent-color: var(--blue-deep); width: 18px; height: 18px; flex: 0 0 auto; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 13px 22px; border-radius: 999px; border: 1.5px solid transparent;
  text-decoration: none; transition: transform .06s ease, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; margin-top: 10px; }
.btn--primary { background: var(--blue-deep); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--ink); color: #fff; }
.btn--ghost { background: transparent; color: var(--blue-deep); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-deep); }

.intake__privacy {
  margin-top: 18px; font-size: .84rem; color: var(--muted); text-align: center; line-height: 1.5;
}

/* --- Results ------------------------------------------------------------- */
.results { padding-bottom: 56px; }
.result-head { text-align: center; max-width: 640px; margin: 8px auto 26px; }
.result-title {
  font-family: var(--display); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(1.9rem, 6vw, 2.5rem); margin-bottom: 10px; outline: none;
}
.result-sub { color: var(--muted); font-size: .95rem; }

/* --- Deadline panel ------------------------------------------------------ */
.deadline {
  border: 1px solid var(--amber-line); background: var(--amber-tint);
  border-radius: var(--radius); padding: clamp(18px, 4vw, 26px); margin-bottom: 34px;
}
.deadline__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.deadline__label {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em;
  font-size: .72rem; font-weight: 600; color: var(--amber);
}
.deadline__date {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--ink); line-height: 1.1;
}
.deadline__count { font-size: .9rem; font-weight: 600; color: var(--amber); }
.deadline__note { font-size: .92rem; color: var(--body); margin-top: 10px; }
.deadline__missing { font-size: .95rem; color: var(--body); }
.deadline__missing strong { color: var(--ink); }

/* milestone timeline */
.timeline { list-style: none; margin: 20px 0 0; padding: 0; }
.timeline__item {
  position: relative; padding: 0 0 16px 26px; border-left: 2px solid var(--amber-line);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--amber);
}
.timeline__item.is-now::before { background: var(--amber); }
.timeline__date { font-family: var(--mono); font-size: .82rem; font-weight: 600; color: var(--amber); }
.timeline__date.is-now { color: var(--danger); }
.timeline__label { font-weight: 600; color: var(--ink); font-size: .98rem; margin-top: 2px; }
.timeline__why { font-size: .88rem; color: var(--muted); margin-top: 3px; }

/* --- Section blocks ------------------------------------------------------ */
.intro-line { color: var(--body); font-size: .98rem; margin-bottom: 26px; max-width: 64ch; }
.intro-line strong { color: var(--ink); }

.section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: clamp(18px, 4vw, 26px); margin-bottom: 18px;
}
.section__head { display: flex; align-items: flex-start; gap: 12px; }
.section__num {
  font-family: var(--mono); font-weight: 600; font-size: .82rem;
  color: var(--blue-deep); background: var(--blue-tint);
  padding: 4px 9px; border-radius: 7px; white-space: nowrap; margin-top: 3px; flex: 0 0 auto;
}
.section__titles { min-width: 0; }
.section__title { font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; }
.section__summary { color: var(--body); font-size: .93rem; margin-top: 5px; }

.subhead {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em;
  font-size: .68rem; font-weight: 600; color: var(--muted);
  margin: 20px 0 10px;
}

/* document checklist */
.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc { display: flex; gap: 11px; align-items: flex-start; }
.doc__check { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue-deep); cursor: pointer; }
.doc__main { min-width: 0; flex: 1 1 auto; }
.doc__label { font-weight: 600; color: var(--ink); font-size: .96rem; cursor: pointer; }
.doc.is-done .doc__label { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.doc__note { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.doc__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  font-family: var(--mono); font-size: .68rem; font-weight: 500; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 6px; background: var(--blue-tint); color: var(--blue-deep);
}
.tag--window { background: var(--line); color: var(--body); }
.tag--priority { background: var(--amber-tint); color: var(--amber); border: 1px solid var(--amber-line); }

/* answer fields */
.answers { display: grid; gap: 16px; }
.answer__label { display: block; font-weight: 600; color: var(--ink); font-size: .93rem; margin-bottom: 6px; }
.answer__ref { font-family: var(--mono); font-size: .78em; color: var(--blue-deep); font-weight: 600; margin-right: 6px; }
.answer__hint { font-size: .82rem; color: var(--muted); margin-top: 5px; }
.answer__money { position: relative; }
.answer__money input { padding-left: 26px; }
.answer__money::before {
  content: "£"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600;
}

/* inline referral (soft, one line) */
.referral {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--blue-tint); border: 1px solid var(--blue-line);
}
.referral__icon { flex: 0 0 auto; margin-top: 1px; }
.referral p { font-size: .88rem; color: var(--body); }
.referral a { font-weight: 600; white-space: nowrap; }
.referral--info { background: var(--paper); border-color: var(--line); }
.referral--info .referral__icon {
  font-family: var(--mono); font-weight: 700; font-size: .78rem; font-style: italic;
  color: var(--blue-deep); width: 18px; height: 18px; border: 1.5px solid var(--blue-line);
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}

/* escalation (Fane) aside */
.fane {
  margin-top: 18px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--blue-tint); border: 1px solid var(--blue-line);
}
.fane__lead { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.fane p { font-size: .92rem; color: var(--body); }
.fane__link {
  display: inline-block; margin-top: 12px; font-weight: 600;
  background: var(--blue-deep); color: #fff; text-decoration: none;
  padding: 9px 18px; border-radius: 999px; font-size: .92rem;
}
.fane__link:hover { background: var(--ink); color: #fff; }
.fane__reg { margin-top: 12px; font-size: .74rem; color: var(--muted); line-height: 1.45; }
.fane--general { margin: 30px 0 0; }

/* --- 2.20 summary table -------------------------------------------------- */
.summary-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .95rem; }
.summary-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.summary-table td:last-child { text-align: right; font-family: var(--mono); font-weight: 500; color: var(--ink); white-space: nowrap; }
.summary-table .is-sub td { color: var(--muted); }
.summary-table .is-total td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--ink); border-bottom: none; }
.summary-table .is-total td:last-child { font-weight: 700; }
.summary-table .is-neg td:last-child { color: var(--danger); }
.summary-caption { font-size: .86rem; color: var(--muted); margin-top: 12px; }

/* --- 3.1 income needs budget --------------------------------------------- */
.budget__intro { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.budget-group { border: 0; padding: 0; margin: 0 0 16px; }
.budget-group__title {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em;
  font-size: .7rem; font-weight: 600; color: var(--blue-deep); padding: 0; margin-bottom: 8px;
}
.budget-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.budget-row:last-child { border-bottom: 0; }
.budget-row__label { flex: 1 1 auto; font-size: .93rem; color: var(--ink); font-weight: 500; }
.budget-row__money { flex: 0 0 128px; margin: 0; }
.budget-row__money input { padding-top: 8px; padding-bottom: 8px; text-align: right; }
#budget-holder { margin-top: 18px; padding-top: 4px; }
#budget-holder .summary-table td:first-child { font-weight: 500; }

/* --- Actions ------------------------------------------------------------- */
.actions {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line);
}
.pdf-fallback { text-align: center; font-size: .86rem; color: var(--muted); margin-top: 14px; }
.pdf-fallback a { font-weight: 600; }

/* --- Footer -------------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--line); padding: 28px 0 46px; margin-top: 10px; background: var(--surface); }
.disclaimer { font-size: .85rem; color: var(--muted); max-width: 66ch; }
.disclaimer strong { color: var(--body); }
.foot-links {
  margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: .88rem;
}
.foot-links a { font-weight: 600; }
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--blue-deep); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--ink); }
.foot-fane { margin-top: 16px; font-size: .74rem; color: var(--muted); max-width: 66ch; line-height: 1.5; }

/* --- Collapse intake once results are shown ------------------------------ */
.intake.is-collapsed { display: none; }

/* --- Larger screens ------------------------------------------------------ */
@media (min-width: 640px) {
  body { font-size: 18px; }
}

/* --- Motion & print ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .site-head, .site-foot, .intake, .actions { display: none !important; }
  .section, .deadline, .card { break-inside: avoid; box-shadow: none; }
}
