/* Shared styles for every site: large type, high contrast, calm and modern.
   Each page sets --accent / --brand / --accent-soft / --accent-tint / --accent-line inline (build.py theme_style). */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #17191c;
  --ink-2: #3b3f45;
  --muted: #52575e;
  --line: #e6e3db;
  --line-strong: #d3cfc4;
  --accent: #1f4e8c;
  --accent-ink: #ffffff;
  --accent-soft: #f1f4f9;
  --accent-tint: #e4eaf3;
  --accent-line: #b3c3da;
  --good: #1e6b3a;
  --good-soft: #eaf5ee;
  --warn: #8a5a00;
  --warn-soft: #fcf4e2;
  --focus: #c25e00;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 24px rgba(20, 20, 20, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --base: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315;
    --surface: #1a1d20;
    --ink: #f2f0eb;
    --ink-2: #d4d1ca;
    --muted: #a6a39c;
    --line: #2b2f34;
    --line-strong: #3d4248;
    --accent: #8db8ef;
    --accent-ink: #111;
    --good: #7fd19b;
    --good-soft: #1b2b21;
    --warn: #f0c36a;
    --warn-soft: #2e2615;
    --focus: #ffab5c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.2; color: var(--ink); letter-spacing: -0.015em; }
h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); font-weight: 800; margin: 0.3rem 0 0.6rem; letter-spacing: -0.025em; }
h2 { font-size: 1.4rem; font-weight: 750; margin: 2.4rem 0 0.7rem; }
h3 { font-size: 1.12rem; font-weight: 700; margin: 1.6rem 0 0.4rem; }
p, li { max-width: 68ch; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 3px; }
.guide a:visited, .sources a:visited { color: color-mix(in srgb, var(--accent) 70%, #6b2d8c); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.muted { color: var(--muted); }
.lead { font-size: 1.12rem; color: var(--ink-2); margin: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
@supports (backdrop-filter: blur(1px)) and (background: color-mix(in srgb, red, blue)) {
  .site-header { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; flex-wrap: nowrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; line-height: 1.2; font-weight: 750; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--brand, var(--accent)); color: #fff; font-weight: 800; font-size: 1.05rem; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }
.text-size { flex: none; display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.text-size-label { font-size: 0.8rem; color: var(--muted); padding: 0 8px 0 10px; }
.text-size button { min-width: 46px; min-height: 40px; font-size: 0.95rem; padding: 2px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); }
.text-size button:hover { background: var(--surface); }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 8px; }
.eyebrow { display: inline-block; margin: 0 0 6px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.trust { display: flex; flex-wrap: wrap; gap: 8px 10px; list-style: none; padding: 0; margin: 18px 0 0; }
.trust li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 8px; }
.trust li::before { content: "\2713"; display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-size: 0.7rem; font-weight: 800; }

/* ---------- Cards & forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px); margin: 1.4rem 0; box-shadow: var(--shadow); }
.tool h2 { font-size: 1.15rem; margin: 1.8rem 0 0.9rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.tool h2:first-child, .tool form > h2:first-child, .card > h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
label { display: block; font-weight: 650; margin-bottom: 6px; }
.hint { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-top: 1px; line-height: 1.4; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; min-height: 54px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
select { appearance: none; -webkit-appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 20px; }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; accent-color: var(--accent); vertical-align: middle; flex: none; margin: 0; }
.check { display: flex; align-items: center; gap: 12px; font-weight: 400; margin: 2px 0; padding: 8px 0; cursor: pointer; }
.grid { display: grid; gap: 18px 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 18px 12px; margin: 0; background: var(--bg); }
legend { font-weight: 650; padding: 0 8px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; min-height: 54px; padding: 10px 22px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s, filter .15s;
}
button:hover, .button:hover { border-color: var(--muted); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1), inset 0 -2px 0 rgba(0, 0, 0, .12); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.button.affiliate { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------- Results ---------- */
.result { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: clamp(16px, 3vw, 28px); margin-top: 28px; }
.result[hidden] { display: none; }
.big-number { font-size: 2.4rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.note, .tip { border-radius: var(--radius-sm); padding: 14px 18px; margin: 16px 0; border: 1px solid var(--line); }
.note { background: var(--warn-soft); border-left: 4px solid var(--warn); }
.tip { background: var(--good-soft); border-left: 4px solid var(--good); }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; background: var(--surface); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 8px 0 16px; background: var(--surface); }
.result > table { border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
tr.highlight td { background: var(--accent-tint); font-weight: 700; }

/* ---------- Checklists ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { border-bottom: 1px solid var(--line); max-width: none; }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 14px; align-items: flex-start; font-weight: 400; cursor: pointer; padding: 12px 8px; margin: 0; border-radius: 10px; }
.checklist label:hover { background: var(--accent-soft); }
.checklist input { margin-top: 2px; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.progress { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }

/* ---------- Ads ---------- */
.ad-slot { margin: 2rem 0; min-height: 100px; text-align: center; }
.ad-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

/* ---------- Hub ---------- */
.tool-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); list-style: none; padding: 0; margin: 0; }
.tool-grid li { max-width: none; }
.tool-card { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tool-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.tool-card strong { display: block; font-size: 1.1rem; color: var(--ink); margin-bottom: 6px; }
.tool-card span { color: var(--ink-2); font-size: 0.95rem; }

/* ---------- Guide (article content) ---------- */
.guide { margin: 3.2rem 0 0; }
.guide > h2:first-child { margin-top: 0; }
.guide ul { padding-left: 1.3rem; }
.guide li { margin: 6px 0; }
.guide li::marker { color: var(--accent); }
.guide details { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 10px 0; background: var(--surface); }
.guide summary { font-weight: 650; cursor: pointer; padding: 16px 52px 16px 18px; list-style: none; position: relative; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; font-weight: 400; color: var(--accent); }
.guide details[open] summary::after { content: "\2212"; }
.guide details > :not(summary) { padding: 0 18px; }
.guide details[open] { padding-bottom: 4px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: 0.92rem; color: var(--ink-2); }
.other-tools strong { display: block; font-size: 0.76rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.other-tools ul { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.other-tools li { max-width: none; }
.other-tools a { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--ink-2); }
.other-tools a:hover { border-color: var(--accent-line); color: var(--accent); }
.footer-links a { margin-right: 18px; color: var(--ink-2); }

@media (max-width: 560px) {
  .hero { padding-top: 24px; }
  .text-size-label { display: none; }
  .brand { font-size: 0.98rem; }
}

/* ---------- Errors (GOV.UK pattern) ---------- */
.error-summary { border: 3px solid #b3261e; border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 22px; background: var(--surface); }
.error-summary h2 { font-size: 1.1rem; margin: 0 0 6px; padding: 0; border: 0; color: #b3261e; }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.error-summary a { color: #b3261e; font-weight: 650; }
.field-error { color: #b3261e; font-weight: 650; margin: 0 0 6px; font-size: 0.95rem; }
.field-error::before { content: "\26A0\FE0E  "; }
.has-error input, .has-error select { border-color: #b3261e; border-width: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .error-summary, :root:not([data-theme="light"]) .error-summary h2, :root:not([data-theme="light"]) .error-summary a, :root:not([data-theme="light"]) .field-error { color: #ffb4ab; border-color: #ffb4ab; } :root:not([data-theme="light"]) .has-error input { border-color: #ffb4ab; } }

/* ---------- Answer: the one sentence that says what it means ---------- */
.answer { font-size: 1.25rem; line-height: 1.45; font-weight: 600; margin: 0 0 18px; padding: 16px 18px; background: var(--surface); border-radius: 14px; border-left: 5px solid var(--accent); }
.answer:focus { outline: none; }
.answer strong { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .answer strong { color: var(--ink); } }

/* Birthday: month / day / year on one row */
.date-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr); align-items: end; max-width: 520px; }
.date-row select { padding-left: 12px; padding-right: 34px; background-position: right 10px center; }
.date-row input { padding-left: 12px; padding-right: 8px; }

/* Result actions + share panel */
[data-result-actions] { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--accent-line); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.share-panel { flex-basis: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 18px; }
.share-panel p { margin: 0 0 4px; }
.share-panel .actions { margin-top: 8px; }
.share-note { font-size: 0.85rem; margin-top: 10px !important; }

.reminder { margin-top: 20px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px dashed var(--accent-line); }
.reminder p { margin: 0 0 10px; }

/* Trust line under the hero, sources + next steps after the guide */
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 0.85rem; color: var(--ink-2); }
.meta li { max-width: none; }
.meta a { color: var(--ink-2); }
.sources { margin-top: 2.4rem; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 0.95rem; }
.sources h2 { font-size: 1.05rem; margin: 0 0 6px; }
.sources ul { margin: 0; padding-left: 1.2rem; }
.next-steps { margin-top: 2.4rem; }
.next-steps h2 { margin: 0 0 12px; font-size: 1.2rem; }
.next-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.next-card:hover { border-color: var(--accent-line); }
.next-card strong { display: block; color: var(--ink); }
.next-card span { color: var(--ink-2); font-size: 0.92rem; }
.next-card::after { content: "\2192"; font-size: 1.4rem; color: var(--accent); flex: none; }

@media (max-width: 560px) {
  form .actions button.primary, [data-result-actions] button.primary, .card > .actions button.primary { width: 100%; min-height: 58px; }
  [data-result-actions] button { flex: 1 1 auto; }
  .date-row { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr) minmax(0, 1.35fr); gap: 8px; }
  .trust { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.only-print { display: none; }
@media print {
  :root { --base: 12pt; }
  body { background: #fff; color: #000; }
  .no-print, .site-header, .site-footer, .ad-slot, .guide, .hero, .actions { display: none !important; }
  .only-print { display: block !important; }
  .card, .result { border: none; padding: 0; background: #fff; box-shadow: none; }
  .table-scroll { border: none; }
  .print-area, .print-area * { color: #000 !important; }
  .answer { border: 1px solid #000; }
  .print-stamp { display: block !important; margin-top: 16px; font-size: 10pt; }
  [data-result-actions], .error-summary { display: none !important; }
  a { color: #000; text-decoration: none; }
}
