/* Working on UC: shared styles.
   Layout: a narrow header and footer band around one centred column; calculators use a form + sticky results grid; guides use a 65ch reading column. */
:root {
  --bg: #f2f5f8;
  --surface: #ffffff;
  --ink: #17202b;
  --muted: #4b5665;
  --line: #d8dfe7;
  --accent: #2952a3;
  --accent-soft: #e5ecf8;
  --on-accent: #ffffff;
  --gain: #1f6b45;
  --gain-soft: #e1f1e8;
  --warn: #7d5300;
  --warn-soft: #fbf0d9;
  --stop: #a3302a;
  --stop-soft: #f9e3e1;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141b;
    --surface: #161f29;
    --ink: #e5eaf0;
    --muted: #9ba8b7;
    --line: #2a3542;
    --accent: #8db0f0;
    --accent-soft: #1b2940;
    --on-accent: #0e141b;
    --gain: #72d09f;
    --gain-soft: #143022;
    --warn: #ecbb5c;
    --warn-soft: #31270f;
    --stop: #f08a80;
    --stop-soft: #3a1a18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141b;
  --surface: #161f29;
  --ink: #e5eaf0;
  --muted: #9ba8b7;
  --line: #2a3542;
  --accent: #8db0f0;
  --accent-soft: #1b2940;
  --on-accent: #0e141b;
  --gain: #72d09f;
  --gain-soft: #143022;
  --warn: #ecbb5c;
  --warn-soft: #31270f;
  --stop: #f08a80;
  --stop-soft: #3a1a18;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* Text grows with the screen: 16px on phones, about 19px at 1920 wide, about 21px at 2560, never more than 22px.
   Everything else is in rem, so the layout grows with it and still respects the reader's own browser text size. */
html { -webkit-text-size-adjust: 100%; font-size: clamp(100%, 0.875rem + 0.26vw, 137.5%); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.inner {
  max-width: 67.5rem;
  margin: 0 auto;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

/* Skip link */
.skip {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--surface);
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  z-index: 20;
}
.skip:focus { left: 1rem; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem 1.5rem;
  padding-block: 0.875rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0.5625rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9375rem;
  letter-spacing: 0;
}
.brand b { color: var(--accent); font-weight: 700; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 0.375rem; }
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 62.4375rem;
  font-weight: 700;
  font-size: 0.9375rem;
}
.site-nav a:hover { background: var(--accent-soft); }
.site-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

/* Main column */
main { display: block; }
.page { display: grid; gap: 1.75rem; padding-block: 2rem 3.5rem; }
.page-head { display: grid; gap: 0.625rem; }
.eyebrow {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 4.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
  max-width: 22ch;
}
h2 { font-family: var(--display); font-weight: 600; text-wrap: balance; }
.lede { margin: 0; max-width: 62ch; font-size: 1.0625rem; color: var(--muted); }
.badge {
  justify-self: start;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 62.4375rem;
  background: var(--accent-soft);
  color: var(--accent);
}
.checked-line { font-size: 0.875rem; color: var(--muted); margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  padding: 1.375rem;
  min-width: 0;
}

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.125rem;
  border-radius: 0.625rem;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--accent);
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.05); }

/* Home */
.home-hero { display: grid; gap: 0.875rem; padding-block: 0.5rem 0.25rem; }
.home-hero h1 { max-width: 20ch; font-size: clamp(2rem, 5.4vw, 3.375rem); }
.section { display: grid; gap: 1rem; }
.section-head { display: grid; gap: 0.25rem; }
.section-head h2 { margin: 0; font-size: clamp(1.375rem, 2.6vw, 1.75rem); }
.section-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.card-grid { display: grid; gap: 0.875rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.card {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  padding: 1.125rem;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.card:hover { border-color: var(--accent); }
.card .card-kind { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.card h3 { margin: 0; font-family: var(--display); font-size: 1.1875rem; font-weight: 600; line-height: 1.2; }
.card p { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.card .card-go { font-weight: 700; color: var(--accent); font-size: 0.9375rem; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); column-gap: 1.75rem; }
.link-list li { border-top: 1px solid var(--line); padding: 0.75rem 0; display: grid; gap: 2px; }
.link-list a { font-weight: 700; text-decoration: none; }
.link-list a:hover { text-decoration: underline; }
.link-list span { color: var(--muted); font-size: 0.9375rem; }

.figures-wrap { overflow-x: auto; }
table.figures { border-collapse: collapse; width: 100%; min-width: 20rem; font-variant-numeric: tabular-nums; }
table.figures th, table.figures td { text-align: left; padding: 0.625rem 0.75rem; border-top: 1px solid var(--line); vertical-align: top; }
table.figures thead th { border-top: 0; font-size: 0.875rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
table.figures td.num { text-align: right; font-weight: 700; white-space: nowrap; }
table.figures caption { text-align: left; color: var(--muted); font-size: 0.875rem; padding-bottom: 0.375rem; }

/* Sign-up */
.signup { display: grid; gap: 0.75rem; }
@media (min-width: 760px) { .signup { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.signup h2 { margin: 0 0 0.25rem; font-size: 1.375rem; }
.signup p { margin: 0; color: var(--muted); }
.signup form { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.signup input[type="email"] {
  flex: 1 1 13.75rem;
  min-width: 0;
  font: inherit;
  font-size: 1.0625rem;
  padding: 0.6875rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--ink);
}
.signup input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.signup .form-msg { flex-basis: 100%; margin: 0; font-size: 0.875rem; color: var(--muted); }

/* Guides */
.article-layout { display: grid; gap: 1.75rem; align-items: start; }
@media (min-width: 960px) { .article-layout { grid-template-columns: minmax(0, 1fr) 17.5rem; } }
.prose { max-width: 68ch; min-width: 0; }
.prose > * + * { margin-top: 0.9em; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; margin: 1.6em 0 0.2em; }
.prose h3 { font-size: 1.125rem; margin: 1.3em 0 0; font-family: var(--display); font-weight: 600; }
.prose p, .prose li { font-size: 1.0625rem; }
.prose ul, .prose ol { padding-left: 1.375rem; }
.prose li + li { margin-top: 0.375rem; }
.prose code { font-family: var(--mono); font-size: 0.92em; background: var(--accent-soft); padding: 1px 0.3125rem; border-radius: 0.25rem; }
.prose .sources-list { font-size: 0.9375rem; }
.prose .sources-list li { font-size: 0.9375rem; }
.aside { display: grid; gap: 0.875rem; position: static; }
@media (min-width: 960px) { .aside { position: sticky; top: 1rem; } }
.aside h2 { margin: 0; font-size: 1rem; font-family: var(--body); font-weight: 700; }
.aside ul { margin: 0; padding-left: 1.125rem; display: grid; gap: 0.375rem; font-size: 0.9375rem; }
.callout {
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--accent-soft);
  display: grid;
  gap: 0.375rem;
}
.callout p { margin: 0; }
.callout.good { background: var(--gain-soft); }
.callout.warn { background: var(--warn-soft); }
.callout .callout-title { font-weight: 700; }
.worked { font-variant-numeric: tabular-nums; }
.worked td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }

/* Templates */
.template {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  overflow: hidden;
}
.template-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.template-bar span { font-weight: 700; font-size: 0.9375rem; }
.copy-btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.template pre {
  margin: 0;
  padding: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  max-height: none;
}

/* Calculator layout */
.calc-grid { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 880px) {
  .calc-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .calc-grid .results { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 1rem); }
}
form.panel { display: grid; gap: 1.625rem; grid-template-columns: minmax(0, 1fr); }
.group { display: grid; gap: 1.125rem; grid-template-columns: minmax(0, 1fr); }
.group-title {
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 600;
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { display: grid; gap: 0.4375rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.label, legend { font-weight: 700; padding: 0; }
legend { margin-bottom: 0.4375rem; }
.hint { font-size: 0.875rem; color: var(--muted); margin: 0; }
.hint strong { color: var(--ink); }
/* "Find out more" drop-down under a form field */
.more { font-size: 0.9375rem; border-left: 3px solid var(--accent-soft); padding-left: 0.75rem; }
.more summary { cursor: pointer; font-weight: 700; color: var(--accent); width: fit-content; }
.more[open] summary { margin-bottom: 0.5rem; }
.more ul { margin: 0; padding-left: 1.125rem; display: grid; gap: 0.5rem; }
.more p { margin: 0.625rem 0 0; }
.check .hint { display: block; }

.seg { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg label {
  padding: 0.5625rem 1rem;
  border: 1px solid var(--line);
  border-radius: 62.4375rem;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
}
.seg input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.money {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: var(--bg);
  padding: 0 0.75rem;
  max-width: 17.5rem;
}
.money:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.money span { color: var(--muted); white-space: nowrap; }
.money input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  padding: 0.625rem 0;
  font-variant-numeric: tabular-nums;
}
.money input:focus { outline: none; }

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  overflow: hidden;
  background: var(--bg);
  justify-self: start;
}
.stepper button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.25rem;
  width: 2.75rem;
  cursor: pointer;
}
.stepper button:hover { background: var(--accent-soft); }
.stepper button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stepper input {
  width: 3.25rem;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.stepper input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.check { display: flex; gap: 0.625rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 0.25rem; width: 1.125rem; height: 1.125rem; accent-color: var(--accent); flex: none; }
.check strong { display: block; }
.radio-list { display: grid; gap: 0.625rem; }
.slider-row { display: grid; gap: 0.625rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.results { display: grid; gap: 1.125rem; min-width: 0; }
.headline {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5625rem, 3.2vw, 2rem);
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
.headline .num { white-space: nowrap; color: var(--gain); }
.state-warn .headline .num { color: var(--warn); }
.state-stop .headline .num { color: var(--stop); }
.sub { margin: -0.5rem 0 0; color: var(--muted); }

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.625rem;
}
.stat { background: var(--bg); border-radius: 0.625rem; padding: 0.75rem 0.875rem; min-width: 0; }
.stat .k { font-size: 0.875rem; color: var(--muted); }
.stat .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .e { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat.after { background: var(--gain-soft); }
.stat.after .v { color: var(--gain); }
.arrow { color: var(--muted); font-size: 1.25rem; }

dl.rows { margin: 0; display: grid; }
dl.rows div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5625rem 0;
  border-top: 1px solid var(--line);
}
dl.rows dt { color: var(--muted); }
dl.rows dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
dl.rows div.total dt { color: var(--ink); font-weight: 700; }
dl.rows .ignored dd { color: var(--muted); font-weight: 400; }

.ratio { background: var(--gain-soft); color: var(--ink); border-radius: 0.625rem; padding: 0.75rem 0.875rem; margin: 0; }
.ratio b { color: var(--gain); }
.plain-callout { border-radius: 0.625rem; padding: 0.75rem 0.875rem; background: var(--bg); margin: 0; }
.plain-callout b { font-variant-numeric: tabular-nums; }

.chart-fig { margin: 0; display: grid; gap: 0.375rem; }
.chart-fig figcaption { display: grid; gap: 2px; }
.cap-title { font-weight: 700; }
.cap-sub { font-size: 0.875rem; color: var(--muted); }
.chart-box { overflow-x: auto; }
.chart-box svg { display: block; width: 100%; height: auto; min-width: 18.75rem; }
.chart-box .gridline { stroke: var(--line); stroke-width: 1; }
.chart-box .tick { fill: var(--muted); font-family: var(--body); font-size: 0.875rem; }
.chart-box .axis-title { fill: var(--muted); font-family: var(--body); font-size: 0.875rem; }
.chart-box .ucarea { fill: var(--accent-soft); stroke: none; }
.chart-box .ucline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart-box .guide { stroke: var(--gain); stroke-width: 1.25; stroke-dasharray: 3 4; fill: none; }
.chart-box .marker { fill: var(--gain); stroke: var(--surface); stroke-width: 2.5; }

.notes { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.notes li { background: var(--warn-soft); border-radius: 0.625rem; padding: 0.625rem 0.875rem; font-size: 0.9375rem; }
.notes li.good { background: var(--gain-soft); }
.notes li .tag { display: block; font-size: 0.875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); }
.notes li.good .tag { color: var(--gain); }

/* Savings meter */
.meter { display: grid; gap: 0.5rem; }
.meter-title { font-weight: 700; }
.track-wrap { position: relative; padding-top: 2.125rem; }
.track { display: grid; grid-template-columns: 30fr 50fr 20fr; gap: 2px; height: 1.125rem; }
.track span { border-radius: 0.25rem; }
.track .z1 { background: var(--gain-soft); border: 1px solid var(--gain); }
.track .z2 { background: var(--warn-soft); border: 1px solid var(--warn); }
.track .z3 { background: var(--stop-soft); border: 1px solid var(--stop); }
.pin { position: absolute; top: 0; bottom: -0.375rem; width: 0; transform: translateX(-1px); }
.pin::after { content: ""; position: absolute; top: 1.625rem; bottom: 0; left: 0; border-left: 2px solid var(--ink); }
.pin-label {
  position: absolute;
  top: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--surface);
  border-radius: 0.375rem;
  padding: 2px 0.5rem;
  font-variant-numeric: tabular-nums;
}
.scale { display: grid; grid-template-columns: 30fr 50fr 20fr; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.scale div { display: grid; gap: 2px; min-width: 0; }
.scale b { color: var(--ink); font-weight: 700; }

/* Explanations under calculators */
.info { display: grid; gap: 1.5rem; }
@media (min-width: 880px) { .info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.info h2 { font-size: 1.3125rem; margin: 0 0 0.5rem; }
.info ol, .info ul { margin: 0; padding-left: 1.375rem; display: grid; gap: 0.5rem; max-width: 62ch; }
.sources { font-size: 0.875rem; color: var(--muted); display: grid; gap: 0.375rem; }
.sources ul { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.25rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .inner { display: grid; gap: 0.875rem; padding-block: 1.5rem 2rem; font-size: 0.875rem; color: var(--muted); }
@media (min-width: 760px) { .site-footer .inner { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.site-footer p { margin: 0; max-width: 62ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.125rem; align-content: start; }
.footer-links a { font-weight: 700; }

@media (max-width: 460px) {
  .panel { padding: 1.125rem 1rem; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .arrow { display: none; }
  .money { max-width: none; }
  .scale { font-size: 0.875rem; }
  .site-nav a { padding: 0.375rem 0.625rem; font-size: 0.875rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Flowcharts: real text in boxes, so they reflow on phones and read aloud in order.
   Three columns: the main step, an arrow to a side outcome, the side outcome. */
.flow { --flow-cols: minmax(0, 1.5fr) 3rem minmax(0, 1fr); --flow-ink: var(--muted); display: grid; margin: 1.4em 0; max-width: 40rem; }
.flow-step, .flow-link { display: grid; grid-template-columns: var(--flow-cols); align-items: center; }
.flow-box { grid-column: 1; border: 1.5px solid var(--line); border-radius: 0.75rem; background: var(--surface); padding: 0.75rem 0.875rem; text-align: center; font-size: 1rem; line-height: 1.35; }
.flow-box b { display: block; }
.flow-box small, .flow-side small { display: block; margin-top: 0.1875rem; color: var(--muted); font-size: 0.875rem; line-height: 1.3; }
.flow-box.start { background: var(--bg); }
.flow-box.ask { border-color: var(--accent); }
.flow-box.end { background: var(--gain-soft); border: 2px solid var(--gain); }
.flow-arrow { grid-column: 2; position: relative; height: 2px; margin: 0 0.5rem 0 0.25rem; background: var(--flow-ink); }
.flow-arrow::after { content: ""; position: absolute; right: -1px; top: 50%; transform: translateY(-50%); border-style: solid; border-width: 0.3125rem 0 0.3125rem 0.4375rem; border-color: transparent transparent transparent var(--flow-ink); }
.flow-arrow span { position: absolute; bottom: 0.375rem; left: 50%; transform: translateX(-50%); font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.flow-side { grid-column: 3; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--bg); padding: 0.625rem 0.75rem; text-align: center; font-size: 0.9375rem; line-height: 1.35; }
.flow-link { height: 2.5rem; }
.flow-line { grid-column: 1; justify-self: center; position: relative; width: 2px; height: 100%; background: var(--flow-ink); }
.flow-line::after { content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); border-style: solid; border-width: 0.4375rem 0.3125rem 0 0.3125rem; border-color: var(--flow-ink) transparent transparent transparent; }
.flow-line span { position: absolute; left: 0.625rem; top: 50%; transform: translateY(-60%); font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.flow .flow-note { margin: 0.75rem 0 0; font-size: 0.9375rem; color: var(--muted); }
.flow .flow-note.boxed { color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.75rem 0.875rem; }
@media (max-width: 520px) {
  .flow { --flow-cols: minmax(0, 1.3fr) 2.5rem minmax(0, 1fr); }
  .flow-box { font-size: 0.9375rem; padding: 0.625rem; }
  .flow-side { font-size: 0.875rem; padding: 0.5rem; }
  .flow-box small, .flow-side small { font-size: 0.875rem; }
}

/* Line icons inside flowchart boxes */
.ico { display: block; width: 1.75rem; height: 1.75rem; margin: 0 auto 0.375rem; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flow-box.end .ico { color: var(--gain); }
.flow-box.start .ico { color: var(--muted); }

/* Where each £100 comes from */
.money-bar { margin: 1.2em 0; display: grid; gap: 0.625rem; max-width: 40rem; }
.money-bar figcaption { font-weight: 700; font-size: 1.0625rem; }
.mb-track { display: flex; height: 3.25rem; border-radius: 0.75rem; overflow: hidden; font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.mb-track span { display: grid; place-items: center; min-width: 0; }
.mb-you { background: var(--accent); color: var(--on-accent); }
.mb-uc { background: var(--gain); color: var(--bg); }
.mb-tax { background: var(--warn); color: var(--bg); }
.mb-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.prose .mb-key li { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 0.625rem; }
.mb-key i { flex: none; width: 1rem; height: 1rem; border-radius: 0.25rem; }

/* Example documents */
.mock { margin: 1.2em 0; display: grid; gap: 0.875rem; }
.mock-docs { display: grid; gap: 0.875rem; grid-template-columns: minmax(0, 1fr); max-width: 35rem; }
.mock-doc { background: var(--surface); border: 1px solid var(--line); border-radius: 0.625rem; overflow: hidden; font-size: 0.875rem; box-shadow: 0 1px 0 var(--line); }
.mock-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.625rem; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--line); background: var(--bg); }
.mock-head b { font-size: 0.9375rem; }
.mock-head span { color: var(--muted); }
.mock-tag { margin-left: auto; font-style: normal; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stop); border: 1px solid var(--stop); border-radius: 62.4375rem; padding: 1px 0.5rem; }
.mock-rows { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mock-rows td { padding: 0.4375rem 0.75rem; border-top: 1px solid var(--line); vertical-align: top; }
.mock-rows tr:first-child td { border-top: 0; }
.mock-rows td:first-child { white-space: nowrap; color: var(--muted); width: 1%; }
.mock-rows td:last-child { text-align: right; white-space: nowrap; }
.mock-rows tr.dim td { color: var(--muted); }
.mock-rows tr.hl-in td { background: var(--gain-soft); font-weight: 700; }
.mock-rows tr.hl-out td { background: var(--warn-soft); font-weight: 700; }
.mock-rows tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.mock-notes { margin: 0; padding-left: 1.375rem; display: grid; gap: 0.25rem; }
.prose .mock-notes li { font-size: 1rem; margin: 0; }

/* Plain-words glossary */
.glossary { margin: 0; display: grid; gap: 0.625rem; }
.glossary div { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.75rem 0.875rem; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 2px 0 0; font-size: 1rem; color: var(--ink); }

/* Step-by-step answers inside a calculator form */
.step-status { margin: 0; border-radius: 0.625rem; padding: 0.75rem 0.875rem; font-weight: 700; line-height: 1.4; }
.step-status.good { background: var(--gain-soft); border-left: 0.25rem solid var(--gain); }
.step-status.warn { background: var(--warn-soft); border-left: 0.25rem solid var(--warn); }

/* Sources: kept, but folded away at the foot of the page */
.sources-box { font-size: 0.875rem; color: var(--muted); max-width: 68ch; }
.sources-box summary { cursor: pointer; font-weight: 700; width: fit-content; }
.sources-box summary:hover { color: var(--ink); }
.sources-box p { margin: 0.5rem 0 0; }
.sources-box ul { margin: 0.5rem 0 0; padding-left: 1.25rem; display: grid; gap: 0.25rem; }
.sources-box a { color: var(--muted); }
.info .sources-box { grid-column: 1 / -1; }

/* Leave a little room above a heading when the "On this page" links jump to it */
[id] { scroll-margin-top: 1rem; }
.page > .card { max-width: 47.5rem; }

/* Calculators shown on other websites */
body.embed { background: transparent; }
.embed-wrap { padding: 2px; }
.embed-credit { margin: 0.75rem 2px 0; font-size: 0.875rem; color: var(--muted); }
.embed .calc-grid .results { position: static; }
.embed-preview { width: 100%; height: 68.75rem; border: 1px dashed var(--line); border-radius: 0.75rem; background: var(--surface); }
.template pre.code { font-family: var(--mono); font-size: 0.875rem; line-height: 1.5; }

/* Common questions: tap to open */
.faq { display: grid; gap: 0.625rem; max-width: 47.5rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0 1rem; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.0625rem; padding: 0.875rem 0; list-style: none; display: flex; justify-content: space-between; gap: 0.75rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.375rem; line-height: 1; color: var(--accent); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 1rem; font-size: 1.0625rem; max-width: 68ch; }
table.figures thead th { white-space: nowrap; }

/* Save or share: header button with a drop-down, and a box at the end of each page */
.share { position: relative; order: 2; }
.site-nav { order: 3; flex-basis: 100%; }
@media (min-width: 900px) {
  .site-nav { order: 2; flex-basis: auto; margin-left: auto; }
  .share { order: 3; }
}

.share-btn { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; font-weight: 700; font-size: 0.9375rem; color: var(--accent); background: var(--surface); border: 1.5px solid var(--accent); border-radius: 62.4375rem; padding: 0.375rem 0.875rem 0.375rem 0.75rem; cursor: pointer; }
.share-btn:hover, .share-btn[aria-expanded="true"] { background: var(--accent-soft); }
.share-btn svg, .share-item svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.share-menu { position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 30; width: min(22rem, calc(100vw - 2rem)); display: grid; gap: 0.5rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 0.875rem; box-shadow: 0 0.75rem 2rem rgba(15, 25, 40, 0.18); }
.share-menu hr { width: 100%; margin: 0.25rem 0; border: 0; border-top: 1px solid var(--line); }
.share-head { margin: 0; font-weight: 700; }
.share-tip { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.share-tip b { color: var(--ink); }
.share-tip kbd { font-family: inherit; font-weight: 700; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 0.3rem; padding: 0 0.3rem; }
.share-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.share-item { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.5rem 0.75rem; font: inherit; font-weight: 700; font-size: 0.9375rem; text-align: left; color: var(--ink); text-decoration: none; background: var(--bg); border: 1px solid var(--line); border-radius: 0.625rem; cursor: pointer; }
.share-item svg { color: var(--accent); }
.share-links { display: grid; gap: 0.5rem; }
.share-brands { display: grid; gap: 0.5rem; }
/* Brand buttons: official Font Awesome Free icons (CC BY 4.0, fontawesome.com), unaltered, in each brand's own colours */
.share-brand { display: flex; align-items: center; justify-content: center; gap: 0.625rem; min-height: 3.125rem; padding: 0.625rem 1rem; border-radius: 0.75rem; font-weight: 700; font-size: 1rem; text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); transition: transform 0.1s ease, filter 0.1s ease; }
.share-brand:hover { filter: brightness(1.06); transform: translateY(-1px); }
.share-brand:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.share-brand.wa { background: #25d366; color: #052e16; }
.share-brand.fb { background: #0866ff; color: #ffffff; }
.brand-logo { width: 1.5rem; height: 1.5rem; flex: none; background: #ffffff; -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.share-brand.wa .brand-logo { --logo: url("https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.2/svgs/brands/whatsapp.svg"); }
.share-brand.fb .brand-logo { --logo: url("https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.2/svgs/brands/facebook.svg"); }
.share-panel .share-brands { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }

.share-item:hover { border-color: var(--accent); color: var(--accent); }
.share-wrap { padding-bottom: 3rem; }
.page + .share-wrap { margin-top: -1.5rem; }
.share-panel { display: grid; gap: 1rem; padding: 1.25rem; background: var(--accent-soft); border-radius: 1rem; }
@media (min-width: 760px) { .share-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; padding: 1.5rem 1.75rem; } }
.share-panel h2 { margin: 0 0 0.25rem; font-size: 1.375rem; }
.share-panel p { margin: 0 0 0.5rem; }
.share-panel .share-tip { margin: 0; }
.share-panel .share-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.share-panel .share-item { background: var(--surface); }
/* On phones and tablets the menu hangs from the right of the header, wherever the button sits */
@media (max-width: 899px) {
  .site-header .inner { position: relative; }
  .share { position: static; }
  .share-menu { right: 1rem; width: min(22rem, calc(100% - 2rem)); top: calc(100% - 0.25rem); }
}
@media (max-width: 480px) {
  .site-header .inner { gap: 0.625rem 0.75rem; }
  .brand { font-size: 1.0625rem; gap: 0.4375rem; }
  .brand-mark { width: 1.75rem; height: 1.75rem; font-size: 0.875rem; }
  .share-btn { font-size: 0.875rem; padding: 0.3125rem 0.6875rem 0.3125rem 0.5625rem; }
}

/* Brighter look: warm colour bands, icons, good-news boxes */
:root {
  --hero-bg: linear-gradient(120deg, #d5f0e3 0%, #e4eefb 50%, #fde1c4 100%);
  --art-glow: rgba(255, 255, 255, 0.7);
  --warm: #b4491a;
  --warm-soft: #fde8d7;
  --teal: #0b6f61;
  --teal-soft: #d9f1ea;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hero-bg: linear-gradient(120deg, #0f2922 0%, #131f36 52%, #2b2014 100%);
    --art-glow: rgba(255, 255, 255, 0.05);
    --warm: #f4a26f; --warm-soft: #3a2416; --teal: #5ccfbe; --teal-soft: #11302a;
  }
}
:root[data-theme="dark"] {
  --hero-bg: linear-gradient(120deg, #0f2922 0%, #131f36 52%, #2b2014 100%);
  --art-glow: rgba(255, 255, 255, 0.05);
  --warm: #f4a26f; --warm-soft: #3a2416; --teal: #5ccfbe; --teal-soft: #11302a;
}

/* A soft colour band behind every page heading, running edge to edge (border-image outset doesn't cause sideways scrolling) */
.page > .page-head, .page > .home-hero {
  padding-bottom: 1.75rem;
  border-image-source: var(--hero-bg);
  border-image-slice: 0 fill;
  border-image-outset: 2rem 100vmax 0;
}
.eyebrow { color: var(--teal); }

/* Home hero */
.home-hero { grid-template-columns: minmax(0, 1fr); align-items: center; }
.hero-text { display: grid; gap: 0.875rem; min-width: 0; }
.hero-art { display: none; width: 15rem; height: auto; }
@media (min-width: 900px) {
  .home-hero { grid-template-columns: minmax(0, 1fr) auto; column-gap: 2.5rem; }
  .hero-art { display: block; }
}
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.75rem 0.25rem 0.5rem; border-radius: 62.4375rem; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 0.875rem; }
.chips li::before { content: ""; width: 1rem; height: 1rem; flex: none; background: var(--gain); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%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='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat; }
.btn { border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(15, 30, 50, 0.08); }

/* Sam's example */
.story { position: relative; overflow: hidden; display: grid; gap: 1.125rem; padding: 1.5rem 1.25rem 1.25rem; border-radius: 1.25rem; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 0.5rem 1.5rem rgba(20, 40, 70, 0.06); }
.story::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 0.375rem; background: linear-gradient(90deg, #2fa36b, #f5b544, #e8713a); }
@media (min-width: 900px) {
  .story { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); column-gap: 2rem; align-items: center; padding: 2rem; }
  .story-end { grid-column: 1 / -1; }
}
.story h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.story-text { display: grid; gap: 0.5rem; }
.story-text p { margin: 0; }
.story-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.625rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
.story-steps li { display: grid; align-content: start; gap: 0.375rem; padding: 1rem; border-radius: 0.875rem; }
.story-steps b { font-family: var(--display); font-size: 2.125rem; line-height: 1; font-variant-numeric: tabular-nums; }
.story-steps li:nth-child(1) { background: var(--warn-soft); }
.story-steps li:nth-child(1) b { color: var(--warn); }
.story-steps li:nth-child(2) { background: var(--gain-soft); }
.story-steps li:nth-child(2) b { color: var(--gain); }
.story-steps li:nth-child(3) { background: var(--accent-soft); }
.story-steps li:nth-child(3) b { color: var(--accent); }
.story-end { margin: 0; }
@media (max-width: 519px) {
  .story-steps { grid-template-columns: minmax(0, 1fr); }
  .story-steps li { grid-template-columns: 6rem minmax(0, 1fr); align-items: center; column-gap: 0.75rem; }
}
.story-more { display: grid; gap: 0.375rem; padding: 1rem 1.125rem; border-radius: 0.875rem; background: var(--warm-soft); border-left: 4px solid var(--warm); }
.story-more p { margin: 0; }
.story-more-title { font-family: var(--display); font-weight: 600; font-size: 1.1875rem; color: var(--warm); }
@media (min-width: 900px) { .story-more { grid-column: 1 / -1; } }

/* Icons beside section headings and on cards */
.section-head h2 { display: flex; align-items: center; gap: 0.625rem; }
.sec-ico { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 0.75rem; background: var(--teal-soft); color: var(--teal); }
.sec-ico svg { width: 1.25rem; height: 1.25rem; }
.card { box-shadow: 0 1px 2px rgba(20, 40, 70, 0.05); transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 0.5rem 1.25rem rgba(20, 40, 70, 0.1); }
.card-ico { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 0.875rem; }
.card-ico svg { width: 1.5rem; height: 1.5rem; }
.tone-green { background: var(--gain-soft); color: var(--gain); }
.tone-amber { background: var(--warn-soft); color: var(--warn); }
.tone-blue { background: var(--accent-soft); color: var(--accent); }
.tone-coral { background: var(--warm-soft); color: var(--warm); }

/* Good-news and watch-out boxes get an icon */
.callout.good, .callout.warn { position: relative; padding-left: 3.125rem; }
.callout.good::before, .callout.warn::before { content: ""; position: absolute; left: 1rem; top: 0.9rem; width: 1.375rem; height: 1.375rem; -webkit-mask: var(--callout-ico) center / contain no-repeat; mask: var(--callout-ico) center / contain no-repeat; }
.callout.good::before { --callout-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.4-4.2-4.2 1.4-1.4 2.8 2.8 5.8-5.8 1.4 1.4z'/%3E%3C/svg%3E"); background: var(--gain); }
.callout.warn::before { --callout-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5 1.5 21h21L12 2.5zm1 15.5h-2v-2h2v2zm0-4h-2V9h2v5z'/%3E%3C/svg%3E"); background: var(--warn); }

/* The end-of-page box: warm and encouraging */
.share-panel { background: linear-gradient(120deg, var(--teal-soft), var(--accent-soft) 55%, var(--warm-soft)); }

/* Printing: just the content, in black on white */
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #ffffff; --surface: #ffffff; --ink: #000000; --muted: #333333; --line: #bbbbbb;
    --accent: #1d3f80; --accent-soft: #eef2fa; --on-accent: #ffffff;
    --gain: #1f6b45; --gain-soft: #e1f1e8; --warn: #7d5300; --warn-soft: #fbf0d9; --stop: #a3302a; --stop-soft: #f9e3e1;
    color-scheme: light;
  }
  .skip, .site-nav, .share, .share-wrap, .aside, .footer-links, .copy-btn, .hero-art, .chips { display: none !important; }
  .page > .page-head, .page > .home-hero { border-image: none; padding-bottom: 0; }
  .card, .story { box-shadow: none; }
  .page { padding-block: 0.5rem; }
  .article-layout { display: block; }
  a { color: inherit; }
}
