/* THEME — colours, fonts, sizes and spacing for the whole site.
   Change the look everywhere by editing these tokens only. */

:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f7f5f0;
  --card: #fffdf8;
  --ink: #1c2321;
  --ink-soft: #33403b;
  --muted: #4a524f;
  --faint: #5c625f;
  --line: #e3ded3;
  --line-strong: #b9b2a3;
  --field: #ffffff;

  --accent: #1f5f4a;
  --accent-hover: #154535;
  --accent-soft: #eef3ef;
  --on-accent: #ffffff;

  --series-pension: #1f5f4a;
  --series-savings: #2f7d95;
  --series-assets: #b5852a;
  --series-state: #8fb8a6;
  --series-guaranteed: #7a6fa6;
  --series-pots: var(--series-pension);
  --series-other: var(--series-assets);
  --target: #b8892e;
  --ghost: #1c2321;

  --warn-bg: #fbf4e6;
  --warn-line: #e8d3b0;
  --warn-ink: #6e4f12;
  --good-bg: #eaf4ee;
  --good-line: #bcd9c6;
  --good-ink: #1f5f4a;

  --footer-bg: #1c2321;
  --footer-ink: #d9ddd9;
  --ad-bg: #efebe3;
  --overlay: rgba(28, 35, 33, 0.45);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 16px;
  --shadow-panel: -12px 0 32px rgba(28, 35, 33, 0.14);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-base: 16px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  --touch: 44px;
  --page-max: 1184px;
  --inputs-width: 480px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131816;
    --card: #1a201e;
    --ink: #eef1ee;
    --ink-soft: #d3d9d5;
    --muted: #b3bbb6;
    --faint: #9aa39e;
    --line: #2d3532;
    --line-strong: #56605b;
    --field: #111513;
    --accent: #7cc4a6;
    --accent-hover: #9bd6bd;
    --accent-soft: #1f2d27;
    --on-accent: #0f1a15;
    --series-pension: #5fae8c;
    --series-savings: #74bcd6;
    --series-assets: #dcb765;
    --series-state: #a9d4c1;
    --series-guaranteed: #b6a9dd;
    --target: #e0b453;
    --ghost: #eef1ee;
    --warn-bg: #2b2418;
    --warn-line: #5a4826;
    --warn-ink: #f0cf8a;
    --good-bg: #1c2b24;
    --good-line: #34574a;
    --good-ink: #9bd6bd;
    --footer-bg: #0b0e0d;
    --footer-ink: #c3cac6;
    --ad-bg: #202624;
    --overlay: rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #131816;
  --card: #1a201e;
  --ink: #eef1ee;
  --ink-soft: #d3d9d5;
  --muted: #b3bbb6;
  --faint: #9aa39e;
  --line: #2d3532;
  --line-strong: #56605b;
  --field: #111513;
  --accent: #7cc4a6;
  --accent-hover: #9bd6bd;
  --accent-soft: #1f2d27;
  --on-accent: #0f1a15;
  --series-pension: #5fae8c;
  --series-savings: #74bcd6;
  --series-assets: #dcb765;
  --series-state: #a9d4c1;
  --series-guaranteed: #b6a9dd;
  --target: #e0b453;
  --ghost: #eef1ee;
  --warn-bg: #2b2418;
  --warn-line: #5a4826;
  --warn-ink: #f0cf8a;
  --good-bg: #1c2b24;
  --good-line: #34574a;
  --good-ink: #9bd6bd;
  --footer-bg: #0b0e0d;
  --footer-ink: #c3cac6;
  --ad-bg: #202624;
  --overlay: rgba(0, 0, 0, 0.6);
}

/* SITE STYLES — layout and components. Colours, fonts and sizes come from theme.css tokens. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; 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: 16px; top: -60px; background: var(--card); padding: 10px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tabular, .tile__value, .chart, .year-table, .money input, .static-value { font-variant-numeric: tabular-nums; }

/* ---------- Header & footer ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header__inner, .site-footer__inner {
  max-width: var(--page-max); margin: 0 auto; padding-inline: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.site-header__inner { min-height: 60px; }
.brand { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.site-nav { display: flex; gap: var(--space-5); font-size: var(--text-md); }
.site-nav a { text-decoration: none; color: var(--muted); padding-block: 10px; }
.site-nav a:hover { color: var(--accent); }
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: var(--space-7); font-size: var(--text-sm); }
.site-footer__inner { padding-block: var(--space-6) 96px; flex-wrap: wrap; }
.site-footer__links { display: flex; gap: var(--space-5); }
.site-footer a { color: var(--footer-ink); }

/* ---------- Page ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding-inline: 16px; }
.page-intro { padding-block: var(--space-5) var(--space-4); display: grid; gap: var(--space-2); }
.page-intro h1 { font-size: var(--text-2xl); letter-spacing: -0.015em; }
.page-intro > p { color: var(--muted); }
.example-note { font-size: var(--text-sm); color: var(--warn-ink) !important; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); padding: 8px 12px; justify-self: start; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; }

.calc { display: flex; flex-direction: column; gap: var(--space-4); }
.results-col { order: -1; }
.inputs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* ---------- Input sections ---------- */
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.section[open] { border-color: var(--line-strong); }
.section > summary {
  list-style: none; cursor: pointer; min-height: 56px; padding: 12px 16px;
  display: flex; align-items: center; gap: var(--space-3);
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after {
  content: ""; width: 9px; height: 9px; flex-shrink: 0; margin-left: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s ease;
}
.section[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.section__title { font-weight: 700; font-size: var(--text-lg); }
.section__summary { margin-left: auto; color: var(--muted); font-size: var(--text-sm); text-align: right; font-variant-numeric: tabular-nums; }
.section--quiet { background: transparent; }
.section__body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 14px; }

/* Fields sit on a shared two-row grid (label row, input row) so boxes line up
   even when one label wraps onto two lines. */
.grid-2, .grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
@supports (grid-template-rows: subgrid) {
  .grid-2, .grid-3 { grid-auto-rows: auto auto; }
  .grid-2 > .field, .grid-3 > .field {
    grid-row: span 2; display: grid; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr);
    justify-content: stretch; align-content: stretch;
  }
  .grid-2 > .field > *, .grid-3 > .field > * { width: 100%; }
}
.field { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink); min-width: 0; }
.static-value { font-weight: 600; font-size: var(--text-md); color: var(--ink-soft); align-self: start; padding-top: 8px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .pot input {
  width: 100%; height: var(--touch); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; font-weight: 400;
}
.field input:focus { border-color: var(--accent); }
.money, .suffix { position: relative; display: block; }
.money::before { content: "£"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money input { padding-left: 26px !important; }
.suffix::after { content: "%"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.suffix input { padding-right: 30px !important; }
.hint { font-size: var(--text-sm); color: var(--faint); }
.optional { font-weight: 400; color: var(--faint); font-size: var(--text-sm); }
.subgroup { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.subgroup__title { font-weight: 600; font-size: var(--text-md); }

.pots { display: flex; flex-direction: column; gap: 12px; }
.pot { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.pot + .pot { margin-top: 2px; }
.pot__note { font-size: var(--text-sm); color: var(--faint); line-height: 1.45; }
.pot__contrib { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.pot__payin { display: flex; flex-direction: column; gap: 6px; }
.pot__payin .explain-link { min-height: 32px; font-size: var(--text-sm); }
.pot__contrib-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; }
.pot__projection { font-size: var(--text-sm); color: var(--good-ink); background: var(--good-bg); border: 1px solid var(--good-line); border-radius: var(--radius-sm); padding: 8px 10px; line-height: 1.45; }
.pot__projection:empty { display: none; }
.check--small { font-size: var(--text-sm); min-height: 36px; padding-top: 2px; }
.check--small input { width: 18px; height: 18px; }
.pot__remove { align-self: flex-start; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0; font-size: var(--text-sm); }
.select {
  width: 100%; height: var(--touch); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0 34px 0 10px; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; font-weight: 400;
  appearance: none; background-image: linear-gradient(45deg, transparent 49%, var(--muted) 50%), linear-gradient(-45deg, transparent 49%, var(--muted) 50%);
  background-size: 7px 7px, 7px 7px; background-position: right 18px center, right 13px center; background-repeat: no-repeat;
}
.select:focus { border-color: var(--accent); }
.add-button { height: var(--touch); border: 2px dashed var(--line-strong); border-radius: 10px; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; }
.add-button:hover { border-color: var(--accent); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--text-md); cursor: pointer; min-height: var(--touch); padding-top: 10px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }

.explain-link {
  align-self: flex-start; background: none; border: 0; padding: 0; min-height: var(--touch);
  color: var(--accent); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.explain-link::after { content: " ›"; }

.money-table { display: grid; gap: 8px; }
.money-table__head, .money-table__row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.money-table__head { font-size: var(--text-xs); color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.money-table__row > span:first-child { font-size: 14px; font-weight: 500; }
.money-table input { width: 100%; height: var(--touch); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 10px; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; }

/* Choice cards (target) */
.choice-cards { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-cards__list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice-card {
  position: relative; display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: var(--field);
}
.choice-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice-card:has(input:checked) { border: 2px solid var(--accent); padding: 11px 13px; background: var(--accent-soft); }
.choice-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice-card__name { font-weight: 700; }
.choice-card__amount { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.choice-card__blurb { font-size: var(--text-xs); color: var(--muted); }

/* Segmented controls */
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; padding: 0; margin: 0; align-self: flex-start; background: var(--field); }
.segmented label, .segmented__btn { position: relative; display: flex; align-items: center; }
.segmented label + label, .segmented__btn + .segmented__btn { border-left: 1px solid var(--line-strong); }
.segmented label input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label span, .segmented__btn { min-height: var(--touch); padding: 0 14px; display: flex; align-items: center; font-size: 14px; cursor: pointer; background: transparent; border: 0; }
.segmented label:has(input:checked) span, .segmented__btn[aria-checked="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: -3px; }
.segmented--compact .segmented__btn { padding: 0 11px; font-size: var(--text-sm); }
/* Three or more choices: an even grid that wraps tidily instead of a ragged row. */
.segmented--wrap { align-self: stretch; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line-strong); }
.segmented--wrap label + label { border-left: 0; }
.segmented--wrap label span { width: 100%; height: 100%; justify-content: center; text-align: center; background: var(--field); padding: 8px 12px; }
/* When the row wraps to two columns, a lone last choice fills the width instead of leaving a gap. */
@media (max-width: 560px) {
  .segmented--wrap label:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
}

.privacy-note { font-size: var(--text-sm); color: var(--faint); padding-inline: 4px; }

/* ---------- Results column ---------- */
.results-sticky { display: flex; flex-direction: column; gap: 12px; }
.controls { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.slider { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.slider__label { font-weight: 700; font-size: var(--text-md); }
.slider__label output { font-family: var(--font-display); font-size: 20px; }
.slider input { width: 100%; height: var(--touch); accent-color: var(--accent); margin: 0; }

.results { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.results__header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.results__title { font-size: var(--text-xl); }
.results__basis { font-size: var(--text-sm); color: var(--faint); }
.results__summary { font-size: var(--text-lg); color: var(--ink-soft); line-height: 1.45; }
.results__warnings { display: grid; gap: 8px; }
.results__warnings:empty { display: none; }
.warning { font-size: 14px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: var(--radius-sm); padding: 8px 12px; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); min-width: 0; }
.tile__label { font-size: var(--text-sm); color: var(--muted); }
.tile__value { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tile--warn { background: var(--warn-bg); border-color: var(--warn-line); }
.tile--warn .tile__label, .tile--warn .tile__value { color: var(--warn-ink); }
.tile--good { background: var(--good-bg); border-color: var(--good-line); }
.tile--good .tile__label, .tile--good .tile__value { color: var(--good-ink); }

.chart-block { display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 0 10px; min-height: var(--touch); font-weight: 600; font-size: var(--text-md); color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.chart { --axis: 46px; display: flex; flex-direction: column; gap: 6px; }
.chart__plot { position: relative; height: 200px; margin-left: var(--axis); margin-top: 8px; }
.chart__grid { position: absolute; inset: 0; }
.chart__gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.chart__gridline span { position: absolute; right: calc(100% + 8px); transform: translateY(-50%); font-size: 11px; color: var(--faint); white-space: nowrap; }
.chart__bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.chart__col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; background: none; border: 0; padding: 0; cursor: default; }
.chart__seg { display: block; width: 100%; height: 0; transition: height .38s cubic-bezier(.2,.7,.2,1); opacity: .92; }
.chart__col.is-selected .chart__seg { opacity: 1; }
.chart__col.is-selected::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ink); }
.chart__ghost { position: absolute; left: -1px; right: -1px; height: 2px; background: var(--ghost); opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.chart__ghost.is-visible { opacity: .38; transition: opacity .1s ease; }
.chart__target { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--target); transition: bottom .38s cubic-bezier(.2,.7,.2,1); pointer-events: none; }
.chart__target-label { position: absolute; right: 0; bottom: 4px; font-size: 11px; font-weight: 700; color: var(--warn-ink); background: var(--card); padding: 0 4px; border-radius: 4px; }
.chart__axis { margin-left: var(--axis); display: flex; gap: 2px; height: 16px; margin-top: 6px; }
.chart__tick { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--faint); white-space: nowrap; overflow: visible; display: flex; justify-content: center; }
.chart__readout { font-size: var(--text-sm); color: var(--ink-soft); min-height: 2.9em; }
.chart__note { font-size: var(--text-xs); color: var(--faint); line-height: 1.5; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--text-sm); color: var(--muted); }
.chart__key { display: inline-flex; align-items: center; gap: 6px; }
.chart__swatch { width: 12px; height: 12px; border-radius: 2px; }
.chart.no-anim .chart__seg, .chart.no-anim .chart__target { transition: none; }

.gap-box { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.gap-box--good { background: var(--good-bg); }
.gap-box__title { font-weight: 700; color: var(--accent); }
.gap-box__text { font-size: var(--text-md); color: var(--ink-soft); }
.gap-box__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--text-md); color: var(--ink-soft); }
.gap-box__or { color: var(--faint); }

.year-table > summary { cursor: pointer; font-weight: 600; min-height: var(--touch); display: flex; align-items: center; color: var(--accent); }
.table-scroll { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.year-table table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
.year-table th, .year-table td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.year-table thead th { position: sticky; top: 0; background: var(--card); font-weight: 600; color: var(--muted); }
.year-table tbody th { text-align: left; font-weight: 600; }
.year-table tr.is-retire { background: var(--accent-soft); }
.results__note { font-size: var(--text-sm); color: var(--faint); }

/* ---------- Guide & ads ---------- */
.ad-row { padding-block: var(--space-6) 0; }
.ad { display: flex; justify-content: center; }
.ad__box { border: 2px dashed var(--line-strong); border-radius: 6px; background: var(--ad-bg); display: flex; align-items: center; justify-content: center; max-width: 100%; flex-shrink: 0; }
.ad__box span { font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.ad__box--desktop { display: none; }
.ad--desktop-only { display: none; }
.ad--sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line-strong);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)); align-items: center; gap: 4px;
}
.ad--sticky.is-suppressed { display: none; }
.ad__close { width: var(--touch); height: var(--touch); border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; }
.ad-inline { padding-block: 8px; }

.content-row { display: grid; gap: var(--space-6); padding-top: var(--space-6); }
.guide { display: flex; flex-direction: column; gap: 16px; max-width: 70ch; min-width: 0; }
.guide h2 { font-size: 26px; }
.guide h3 { font-size: 21px; margin-top: 8px; }
.guide p { color: var(--ink-soft); line-height: 1.7; font-size: var(--text-lg); }
.faq { border-top: 1px solid var(--line); }
.faq:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; min-height: 52px; display: flex; align-items: center; font-size: var(--text-lg); }
.faq p { padding-bottom: 14px; }
.guide-aside { display: flex; flex-direction: column; gap: var(--space-4); }
.more-tools { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.more-tools h2 { font-family: var(--font-body); font-size: var(--text-base); font-weight: 700; }
.more-tools a { min-height: 36px; display: flex; align-items: center; }

.privacy-banner {
  max-width: var(--page-max); margin: var(--space-6) auto 0; padding: 14px 18px;
  background: var(--accent-soft); border: 1px solid var(--good-line); border-radius: var(--radius);
  font-size: var(--text-sm); color: var(--ink-soft); line-height: 1.6;
}
@media (min-width: 900px) { .privacy-banner { margin-inline: 32px; } }
@media (max-width: 899px) { .privacy-banner { margin-inline: 16px; } }

/* ---------- Mobile mini results bar ---------- */
.mini-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 25; background: var(--card); border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 6px 18px rgba(0,0,0,.08); display: flex; align-items: center; gap: 14px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 6px;
}
.mini-bar__item { display: flex; flex-direction: column; line-height: 1.2; }
.mini-bar__label { font-size: 11px; color: var(--faint); }
.mini-bar__item strong { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; }
.mini-bar__button { margin-left: auto; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--field); font-size: var(--text-sm); font-weight: 600; cursor: pointer; }

/* ---------- Explainer panel / sheet ---------- */
.explainer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; opacity: 0; transition: opacity .2s ease; }
.explainer-overlay.is-open { opacity: 1; }
.explainer {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto;
  background: var(--card); color: var(--ink); border-radius: 18px 18px 0 0; border: 1px solid var(--line-strong);
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .22s ease;
}
.explainer.is-open { transform: none; }
.explainer__grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 8px; }
.explainer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.explainer__title { font-size: var(--text-xl); padding-top: 6px; }
.explainer__close { width: var(--touch); height: var(--touch); flex-shrink: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--field); font-size: 20px; cursor: pointer; }
.explainer__body { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; }
.explainer__body > p { font-size: var(--text-md); line-height: 1.6; color: var(--ink-soft); }
.explainer__subhead { font-family: var(--font-body); font-size: var(--text-base); font-weight: 700; margin-top: 4px; }
.explainer__guide { font-size: var(--text-xs) !important; color: var(--muted) !important; }
.explainer__table { width: 100%; border-collapse: collapse; font-size: 14px; border: 1px solid var(--line); }
.explainer__table th, .explainer__table td { padding: 10px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.explainer__table th { font-weight: 400; color: var(--muted); width: 48%; }
.explainer__table td { font-weight: 500; background: var(--accent-soft); }
.explainer__source { font-size: var(--text-xs) !important; color: var(--faint) !important; }
.explainer__rowlink { display: inline-block; margin-top: 6px; font-size: var(--text-xs); font-weight: 400; }
.explainer__table td { line-height: 1.5; }
.explainer__more { font-weight: 600; font-size: 14px; }
.explainer__more::after { content: " ›"; }

/* ---------- Wider screens ---------- */
@media (min-width: 900px) {
  .page, .site-header__inner, .site-footer__inner { padding-inline: 32px; }
  .site-footer__inner { padding-block: var(--space-6); }
  .page-intro { padding-block: var(--space-6) var(--space-5); }
  .page-intro h1 { font-size: var(--text-3xl); }
  .calc { display: grid; grid-template-columns: minmax(0, var(--inputs-width)) minmax(0, 1fr); gap: 28px; align-items: start; }
  .results-col { order: 0; align-self: stretch; }
  .section > summary { padding: 14px 22px; }
  .section__body { padding: 4px 22px 20px; }
  .results { padding: 22px 24px; }
  .tile__value { font-size: 28px; }
  .chart__plot { height: 230px; }
  .ad--sticky { display: none; }
  .mini-bar { display: none; }
  .explainer {
    left: auto; top: 0; right: 0; bottom: 0; width: min(470px, 100%); max-height: none; border-radius: 0;
    border-width: 0 0 0 1px; box-shadow: var(--shadow-panel); padding: 24px 26px 32px; transform: translateX(100%);
  }
  .explainer__grab { display: none; }
}
@media (min-width: 900px) and (min-height: 820px) {
  .results-sticky { position: sticky; top: 16px; }
}
@media (min-width: 1040px) {
  .ad__box--desktop { display: flex; }
  .ad__box--mobile { display: none; }
  .ad--desktop-only { display: flex; }
  .ad--mobile-only { display: none; }
  .content-row { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-7); }
  .guide-aside { padding-top: 6px; }
}
@media (max-width: 899px) {
  .site-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 899px) {
  .controls .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .controls .segmented__btn { justify-content: center; padding: 0 4px; }
  .controls .segmented__btn + .segmented__btn { border-left: 1px solid var(--line-strong); }
}

.coming-list { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 6px; font-size: var(--text-md); }

/* WEBSITE PAGES — home page and text pages (About, Privacy, Terms). Colours and sizes come from theme.css. */

.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.site-footer__links { flex-wrap: wrap; row-gap: var(--space-2); }
/* No sticky ad strip on the live site yet, so the footer doesn't need the extra room below it. */
.site-footer__inner { padding-block: var(--space-6); }

/* Home */
.hero { padding-block: var(--space-6) var(--space-5); display: grid; gap: var(--space-3); max-width: 44rem; }
.hero h1 { font-size: var(--text-2xl); letter-spacing: -0.015em; }
.hero p { font-size: var(--text-lg); color: var(--muted); line-height: 1.6; }
.tool-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tool-card { padding: 20px 22px; display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: var(--ink); }
a.tool-card { border-color: var(--line-strong); transition: border-color .15s ease, transform .15s ease; }
a.tool-card:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }
.tool-card h2 { font-size: var(--text-xl); }
.tool-card p { color: var(--muted); font-size: var(--text-md); line-height: 1.55; }
.tool-card__cta { margin-top: auto; padding-top: var(--space-2); color: var(--accent); font-weight: 600; font-size: var(--text-md); }
.tool-card--soon { background: transparent; border-style: dashed; }
.tool-card--soon ul { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; font-size: var(--text-md); }
.label { align-self: flex-start; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }

.trust { padding-top: var(--space-7); display: grid; gap: var(--space-4); }
.trust h2 { font-size: var(--text-xl); }
.trust__grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.trust__item { display: grid; gap: 6px; align-content: start; }
.trust__item h3 { font-family: var(--font-body); font-size: var(--text-base); font-weight: 700; }
.trust__item p { color: var(--muted); font-size: var(--text-md); line-height: 1.6; }

/* Text pages */
.prose { max-width: 70ch; padding-block: var(--space-6) 0; display: grid; gap: var(--space-4); }
.prose h1 { font-size: var(--text-2xl); letter-spacing: -0.015em; }
.prose h2 { font-size: var(--text-xl); margin-top: var(--space-3); }
.prose p, .prose li { color: var(--ink-soft); font-size: var(--text-lg); line-height: 1.7; }
.prose ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.prose .updated { font-size: var(--text-sm); color: var(--faint); }
.prose .callout { background: var(--accent-soft); border: 1px solid var(--good-line); border-radius: var(--radius); padding: 14px 18px; }

@media (min-width: 900px) {
  .hero h1, .prose h1 { font-size: var(--text-3xl); }
  .hero { padding-block: var(--space-7) var(--space-6); }
}

/* One-time "no tracking cookies" notice */
.cookie-notice {
  position: fixed; z-index: 35; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 620px; margin-inline: auto; padding: 14px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: var(--card); color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14); font-size: var(--text-sm); line-height: 1.5;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice p { flex: 1 1 280px; margin: 0; }
.cookie-notice strong { color: var(--ink); }
.cookie-notice__ok {
  min-height: var(--touch); padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: var(--text-md);
}
.cookie-notice__ok:hover { background: var(--accent-hover); }
