/* UK State Pension Explorer.
   One stylesheet, mobile first. No web fonts and no framework.
   Order: tokens, global, composition, utilities, blocks.
   Every colour is a token so the dark scheme changes all of them. */

:root {
  --ink: #1a1c1e;
  --ink-soft: #4a4f54;
  --paper: #fdfdfc;
  --panel: #f3f4f2;
  --rule: #d4d7d3;
  --rule-strong: #80858a;      /* 3.7:1 on --paper: control borders, SC 1.4.11 */
  --accent: #17505d;           /* 8.6:1 on --paper */
  /* Visited links, worked by hand: axe cannot see them. 6.0:1 on --paper, 5.2:1 on --accent-soft,
     the lowest. Only about 1.5:1 (1.46:1) lighter than
     --accent: a stronger purple with the same lightness would be lost on a reader who cannot tell
     the hues apart, and lighter ones close on 4.5:1 on the panel colours (decision 109). */
  --visited: #7a4ea0;
  --accent-soft: #e4eef0;
  --note: #fbf5e0;
  --note-rule: #8a6d00;        /* 4.6:1 on --note */
  --error: #a1261a;            /* 7.1:1 on --paper */
  --series-1: #17505d;
  --series-2: #8a4b12;
  --series-3: #4b3f8f;
  --series-4: #3d5c1f;
  --series-5: #8a1c4b;         /* 8.8:1 on --paper, 7.6:1 on --accent-soft */
  --measure: 40rem;
  --space-s: 0.5rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2.5rem;
  --radius: 6px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceae6;
    --ink-soft: #b5b8b3;
    --paper: #15181a;
    --panel: #1e2326;
    --rule: #3a4044;
    --rule-strong: #7d8489;    /* 4.6:1 on --paper */
    --accent: #8ecbd8;         /* 9.9:1 on --paper */
    --visited: #ab92d0;        /* 6.6:1 on --paper, 4.9:1 on --accent-soft; 1.5:1 darker than --accent */
    --accent-soft: #1d3339;
    --note: #2a2618;
    --note-rule: #d3b24a;
    --error: #ff9d8f;
    --series-1: #8ecbd8;
    --series-2: #f0b07a;
    --series-3: #b9b0f5;
    --series-4: #a9d080;
    --series-5: #f2a0c0;       /* 9.0:1 on --paper, 6.7:1 on --accent-soft */
  }
}

/* Global */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--space-m); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Each level is set apart by its size and by the space above it. A page section's heading (main > h2)
   has a rule above it as well. In running text an h4 is body size, never smaller; notes and cards set
   their own heading sizes below. R6 of the readability review of 8 October 2026. */
h1, h2, h3, h4, h5 { line-height: 1.2; text-wrap: balance; margin: var(--space-xl) 0 var(--space-s); }
h1 { font-size: 1.875rem; margin-top: var(--space-l); }
/* "Reform options: page 1 of 5" above a reform page's heading (decision 121). */
.series-label { margin: var(--space-l) 0 0; color: var(--ink-soft); font-weight: 600; }
.series-label + h1 { margin-top: var(--space-s); }
h2 { font-size: 1.6rem; }
main > h2 { border-top: 1px solid var(--rule); padding-top: var(--space-m); }
h3 { font-size: 1.3rem; margin-top: 2rem; }
h4 { font-size: 1em; margin-top: var(--space-l); }
/* Straight quotation marks, as in the quoted passages elsewhere. */
q { quotes: '"' '"'; }
p, ul, ol, dl, table, figure { margin: 0 0 var(--space-m); }
p, li, dd { text-wrap: pretty; }
li + li { margin-top: 0.25rem; }
/* Items in the content are often sentences or paragraphs; at 0.25rem they ran together. */
main li + li { margin-top: var(--space-s); }
dt { font-weight: 600; }
dd { margin: 0 0 var(--space-s); }
/* A term sits tight to its own text and about a line clear of the item before. Not in a
   figure's details or a tool's result, which set their own spacing, and a result's is a grid. */
dl:not(details.source dl, .result dl) > dd + dt { margin-top: var(--space-l); }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
/* Visited and pressed colours for every link but the menus, the footer lists, the cards and the pager,
   and the skip and "Back to top" links, which a reader uses again and again (decision 109). The links
   left out are listed once, and the two states nest inside: :where() keeps each at the weight of
   a:hover, so the contents list's current entry and the current page, which set --ink, win. A browser
   without CSS nesting (before Safari 16.5, Chrome 112 or Firefox 117) drops the block and shows the
   link colour throughout. A hover colour, if one is ever wanted, goes in this block between :visited
   and :active. */
a:where(:not(.nav-menu a, .footer-links a, .explainers a, .journeys a, .pager a, .skip-link, .skip-contents, .back-to-top a)) {
  &:visited { color: var(--visited); }
  &:active { color: var(--ink); }
}

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

main:focus, .site-header:focus { outline: none; }

/* Composition */

.wrap { width: 100%; max-width: 66rem; margin: 0 auto; padding: 0 1rem; }
main > * { max-width: var(--measure); }
main > .tool, main > figure, main > .cards, main > .scroll-x, main > .rate-block { max-width: none; }

.cards { display: grid; gap: var(--space-m); padding: 0; list-style: none; }
.cards > li { margin: 0; }

/* Utilities */

/* Also "Skip to the text", the first item of a long contents list, until a keyboard reader reaches
   it, when it shows in place at the top of the list (decision 109). */
.visually-hidden, .skip-contents:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.num { font-variant-numeric: tabular-nums; }
.lede { font-size: 1.15rem; color: var(--ink-soft); }
/* Positioned so that text hidden for screen readers inside a table stays inside the scrolling region. */
.scroll-x { overflow-x: auto; position: relative; }
/* A scroll cue, shown by scroll-cue.js on a region whose table or chart is wider than it (W20). It stays at the
   left edge as the region scrolls. Screen readers skip it: the region is named and scrolls by keyboard. */
.scroll-x.can-scroll::before {
  content: "Scroll sideways for more \2192";
  content: "Scroll sideways for more \2192" / "";
  display: block; position: sticky; left: 0; width: max-content;
  margin-bottom: var(--space-s); font-size: 0.9rem; color: var(--ink-soft);
}

/* Blocks */

.skip-link {
  position: absolute; left: var(--space-s); top: -10rem;
  padding: var(--space-s) var(--space-m);
  background: var(--paper); color: var(--accent); z-index: 10;
}
.skip-link:focus { top: var(--space-s); }
.skip-contents:focus { margin-bottom: var(--space-s); }

.preview-banner { background: var(--note); border-bottom: 2px solid var(--note-rule); font-size: 0.95rem; }
.preview-banner p { margin: 0; padding: var(--space-s) 0; }
.preview-banner a { color: var(--ink); }

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { padding-top: var(--space-s); padding-bottom: var(--space-s); display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0 var(--space-m); }
.site-header nav { flex: 1 1 auto; }
.nav-menu { text-align: right; }
.nav-menu ul { text-align: left; }
.brand { margin: 0; font-weight: 700; font-size: 1.1rem; }
.brand a { color: var(--ink); text-decoration: none; display: inline-block; padding: 0.6rem 0; }
.brand a:hover { text-decoration: underline; }

.nav-menu summary {
  display: inline-block; min-height: 2.75rem; padding: 0.55rem 0.9rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  cursor: pointer; font-weight: 600; list-style: none;
}
.nav-menu summary::-webkit-details-marker { display: none; }
/* The arrow is decoration. The empty alternative keeps it out of the name "Menu". */
.nav-menu summary::after { content: " \25BE"; content: " \25BE" / ""; }
.nav-menu[open] summary::after { content: " \25B4"; content: " \25B4" / ""; }
.nav-menu ul { list-style: none; padding: 0; margin: var(--space-s) 0 0; }
.nav-menu li { margin: 0; }
.nav-menu a { display: block; padding: 0.6rem 0; min-height: 2.75rem; }
/* "page" marks the page itself, "true" the section it belongs to. */
.nav-menu a[aria-current], .contents a[aria-current="page"], .footer-links a[aria-current] { color: var(--ink); font-weight: 700; text-decoration: none; }
/* A bar marks the current page, or its section, so the entry that no longer looks like a link reads
   as "you are here": on the left in the list, under the link where the menu is a row (decision 109). */
.nav-menu a[aria-current] { border-left: 3px solid var(--accent); padding-left: var(--space-s); }

.site-footer { margin-top: var(--space-xl); border-top: 1px solid var(--rule); background: var(--panel); font-size: 0.95rem; }
.site-footer .wrap { padding-top: var(--space-l); padding-bottom: var(--space-l); }
.site-footer h2 { font-size: 1.1rem; margin-top: 0; }
.explainers, .footer-links { list-style: none; padding: 0; }
.explainers a, .footer-links a { display: inline-block; padding: 0.55rem 0; font-weight: 600; }
.explainers span { display: block; color: var(--ink-soft); }

.page-dates { margin-top: var(--space-xl); color: var(--ink-soft); font-size: 0.95rem; }

/* The opening rate block */
.rate-block {
  margin: var(--space-m) 0 var(--space-l); padding: var(--space-l) var(--space-m);
  background: var(--panel); border: 1px solid var(--rule); border-left: 6px solid var(--accent);
  border-radius: var(--radius);
}
.rate-block h1 { margin-top: 0; font-size: 1.4rem; }
.rate-block .rate { font-size: 2.5rem; font-weight: 700; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.rate-block .rate-label { font-size: 1.15rem; font-weight: 600; margin-bottom: var(--space-m); }
.rate-block .rate-second { font-size: 1.2rem; font-weight: 700; }
.rate-block > * { max-width: var(--measure); }

/* A source after a sentence sits on a line of its own under it, smaller and muted, so it reads
   apart from the sentence and stays next to the one it supports: decision 77. A link onward from
   a short entry gets a line of its own too, so it does not run into the source. */
.ref { display: block; font-size: 0.85em; color: var(--ink-soft); margin-block: 0.45rem 0.4rem; }
/* In a definition a source hugs its claim and leaves a gap before the next. The gap after the
   last source collapses into the next term's margin, so an item ending in one is spaced the same. */
dd .ref { margin-block: 0.125rem var(--space-m); }
dd .ref:has(+ .onward) { margin-block-end: 0; }
.onward { display: block; margin-block-start: 0.25rem; }
/* On a line of their own these links are not in a sentence, so they are padded to at least 24px
   tall (SC 2.5.8): lowest measured 24.8px, at 320, 390 and 1280px, on 2 October 2026. */
.ref a, .onward a { padding-block: 0.4em; }

/* The tools: decisions 62, 78 and 79. The summary stays in view while the figures change, as on
   the budget simulator of UK Public Finances. On a narrow screen tall enough to spare the room it
   is pinned to the foot, one rule to a row, and the page is padded so it covers nothing and a
   focused field scrolls clear of it. On a short screen, or zoomed in, it follows the form, and so
   does a summary that would take more than half the screen: pinSummary in common.js marks it
   unpinned. At 1024 px and wider it sits beside the form and stays in view. It holds nothing that
   takes focus. */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-l); align-items: start; }
.tool-summary { padding: var(--space-s) var(--space-m); background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--radius); font-size: 0.9rem; }
.tool-summary h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.tool-summary p { margin: 0 0 0.25rem; font-size: 0.85rem; }
.tool-summary .headline { font-size: 0.95rem; font-weight: 700; }
.tool-summary .tool-updated { margin: var(--space-s) 0 0; }
.tool-stale { margin: 0 0 var(--space-s); }
/* A label and its value. The rule comparison has three columns: rule, amount, and how far it is
   from the triple lock. */
.tool-summary dl { display: grid; grid-template-columns: auto auto; gap: 0 var(--space-m); margin: 0; }
#compare-summary dl { grid-template-columns: auto auto auto; }
.tool-summary dl div { display: contents; }
.tool-summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
@media (min-height: 32rem) {
  .js .tool-summary:not(.unpinned) { position: fixed; inset: auto 0 0 0; z-index: 20; border-width: 2px 0 0; border-radius: 0; }
  .js body:has(.tool-summary:not(.unpinned)) { padding-bottom: var(--summary-size, 16rem); }
  .js:has(.tool-summary:not(.unpinned)) { scroll-padding-bottom: var(--summary-size, 16rem); }
  /* The link sits above a pinned summary, never on it. */
  .js body:has(.tool-summary:not(.unpinned)) .back-to-top.is-fixed { bottom: calc(var(--summary-size, 16rem) + var(--space-m)); }
}
@media (min-width: 64rem) {
  .tool-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .js .tool-summary:not(.unpinned) { position: sticky; inset: auto; top: var(--space-m); padding: var(--space-m); border-width: 1px; border-radius: var(--radius); font-size: 1rem; }
  .tool-summary h3 { font-size: 1rem; margin-bottom: var(--space-s); }
  .tool-summary p { font-size: 0.9rem; margin-bottom: var(--space-s); }
  .js body:has(.tool-summary:not(.unpinned)) { padding-bottom: 0; }
  .js:has(.tool-summary:not(.unpinned)) { scroll-padding-bottom: 0; }
  .js body:has(.tool-summary:not(.unpinned)) .back-to-top.is-fixed { bottom: var(--space-m); }
}

/* Figures with their source (W18). One muted line close under the paragraph, 8 px below it against
   the paragraph's 16 px margin, then "More about this figure" and at least 24 px before whatever
   follows. A line above a group of figures stays in the normal flow. In a card the line follows the
   value or its gloss, and the card's own padding gives the gap after. */
.source-line { font-size: 0.85em; color: var(--ink-soft); margin: var(--space-s) 0 0; }
:is(p, dl, ul, ol) + .source-line { margin-top: -0.5rem; }
.source-line.shared { margin: 0 0 var(--space-s); }
.source-line a { padding-block: 0.4em; }
/* Under a tool chart or table, the line is followed by another table or heading: room below it, so it does not run into the next table's scroll cue (W26). */
.result .source-line { margin-bottom: var(--space-m); }
details.source { font-size: 0.9rem; margin: 0 0 var(--space-l); }
.source summary { min-height: 2.75rem; padding: 0.6rem 0; cursor: pointer; color: var(--accent); font-weight: 600; }
details.source dl { margin: var(--space-s) 0 0; color: var(--ink-soft); }
details.source dt { font-weight: 600; color: var(--ink); }
details.source dd { margin: 0 0 var(--space-s); overflow-wrap: anywhere; }
.stat .what { margin-bottom: var(--space-s); }
.stat .source-line { margin-top: var(--space-s); }
.stat details.source { margin-bottom: 0; }
/* A typed note under a table keeps its rule. */
div.source { font-size: 0.9rem; color: var(--ink-soft); border-left: 3px solid var(--rule); padding-left: var(--space-s); }

.stat { padding: var(--space-m); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); height: 100%; }
.stat :is(h3, h4, h5) { margin-top: 0; font-size: 1rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.stat .what { color: var(--ink-soft); font-size: 0.95rem; }

.status {
  display: inline-block; padding: 0.1rem 0.6rem; border: 1px solid var(--rule-strong);
  border-radius: 1rem; font-size: 0.85rem; font-weight: 600; background: var(--paper); color: var(--ink);
}

.note {
  margin: var(--space-m) 0 var(--space-l);
  padding: var(--space-m); background: var(--note);
  border-left: 6px solid var(--note-rule); border-radius: var(--radius);
}
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.note h2, .note h3, .note h4 { font-size: 1.05rem; }

.unavailable { margin: var(--space-m) 0 var(--space-l); padding: var(--space-m); border: 2px dashed var(--rule-strong); border-radius: var(--radius); }
.unavailable > :first-child { margin-top: 0; }
.unavailable > :last-child { margin-bottom: 0; }

/* The link holds the card's name only. Its ::after covers the card, so the name and padding follow the
   link. The description is raised above it so it can be selected, after Heydon Pickering's cards
   pattern. Once cards.js runs and marks the list, a click on the description follows the link too.
   The card's ring is an outline, which forced colours keep. */
.journeys li { position: relative; padding: var(--space-m); border: 1px solid var(--rule-strong); border-radius: var(--radius); }
.journeys a { font-weight: 600; }
.journeys a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.journeys p { position: relative; }
.cards-scripted p { cursor: pointer; }
.journeys li:has(a:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.journeys p { margin: 0; color: var(--ink-soft); }

.contents { padding: var(--space-m); background: var(--panel); border-radius: var(--radius); }
.contents h2 { margin-top: 0; font-size: 1.05rem; }
.contents ul { margin: 0; padding-left: 1.2rem; }
/* A block link keeps the list marker on its first line when it wraps. The padding takes each link
   to 44 px tall, the house standard for a target. */
.contents a { display: block; padding: 0.65rem 0; }
.contents li + li { margin-top: 0; }
/* The current section gets a bar in the gutter, not bold: bold re-wraps long links and moves the list.
   The bar is a border because forced colours keep borders and remove backgrounds. The offset clears
   the list marker: the list's 1.2rem padding plus most of the panel's 1rem. */
.contents a[aria-current="location"] { position: relative; color: var(--ink); text-decoration: none; }
.contents a[aria-current="location"]::before { content: ""; position: absolute; left: -1.85rem; top: 0.45rem; bottom: 0.45rem; border-left: 3px solid var(--accent); }
/* Nested lists: the subsections of a long section, and this page's sections under its name in the
   reform options list. Nested links are a little smaller and still over 24 px tall. */
.contents li li a { font-size: 0.95rem; padding: 0.7rem 0; }

/* Next and Previous at the foot of a page in a sequence (W7). */
.pager { margin-top: var(--space-xl); border-top: 1px solid var(--rule); padding-top: var(--space-s); }
.pager ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--space-m); }
.pager li { margin: 0; flex: 1 1 12rem; }
.pager .next { text-align: right; margin-left: auto; }
.pager a { display: inline-block; padding: 0.55rem 0; font-weight: 600; }
.pager a span { display: block; font-weight: 400; font-size: 0.9rem; color: var(--ink-soft); }
/* A space after a hex escape ends the escape, so the gap is a no-break space. */
.pager .previous a span::before { content: "\2190\00a0"; content: "\2190\00a0" / ""; }
.pager .next a span::after { content: " \2192"; content: " \2192" / ""; }

/* One "Back to top" link in place of a link at the end of every section: decision 88. It is static
   at the end of the page until back-to-top.js runs. Then it is fixed in the lower right, shown only
   once the reader scrolls up on a page over four screens, and hidden while a focused element would
   sit under it. Until it shows it is below the window but still in the tab order, and shows when it has
   focus, as the skip link does above it. Hidden with display, Tab never reached it (step 4). The link is 2.75 rem tall, the 44 px house standard. */
.back-to-top { margin: var(--space-l) 0 0; font-size: 0.95rem; }
.back-to-top a { display: inline-block; padding: 0.55rem 0; }
.back-to-top.is-fixed { position: fixed; right: var(--space-m); bottom: var(--space-m); z-index: 21; margin: 0; }
.back-to-top.is-fixed:not(.is-shown):not(:focus-within) { transform: translateY(100vh); }
.back-to-top.is-fixed.is-under { visibility: hidden; }
.back-to-top.is-fixed a { padding: 0.7rem var(--space-m); min-height: 2.75rem; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); font-weight: 600; text-decoration: none; }
.back-to-top.is-fixed a:hover { text-decoration: underline; }

/* On a wide screen a long page keeps its contents list in view, in a column of its own. Everything
   else stays in the first column, so the list never covers content or a focused control. Headings
   lose the space that grid items no longer share by collapsing margins. */
@media (min-width: 64em) {
  main:has(> .contents) { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; column-gap: var(--space-xl); align-content: start; }
  main:has(> .contents) > * { grid-column: 1; }
  main:has(> .contents) > h2 { margin-top: calc(var(--space-xl) - var(--space-m)); }
  main:has(> .contents) > h3 { margin-top: var(--space-m); }
  main:has(> .contents) > h4 { margin-top: var(--space-s); }
  main > .contents { grid-column: 2; grid-row: 1 / span 200; align-self: start; position: sticky; top: var(--space-m); max-height: calc(100vh - 2 * var(--space-m)); overflow-y: auto; margin-top: var(--space-l); }
  /* The list stays in view here, so the fixed link is not needed (decision 88). */
  body:has(main > .contents) .back-to-top.is-fixed { display: none; }
}

details.more { border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: var(--space-m); }
details.more > summary { padding: 0.7rem var(--space-m); min-height: 2.75rem; cursor: pointer; font-weight: 600; color: var(--accent); }
details.more > :not(summary) { margin-left: var(--space-m); margin-right: var(--space-m); }

/* Links that stand alone in a list or a table cell get room around them (SC 2.5.8). */
.link-list { list-style: none; padding: 0; }
.tool-list dt a { display: inline-block; padding-block: 0.55rem; }
/* Each item is wrapped in a div, so the definition-list spacing does not reach it. With the link's
   padding this puts each tool about a line clear of the one before, as elsewhere. */
.tool-list > div + div { margin-top: var(--space-m); }
.link-list a, th > a:only-child { display: inline-block; padding: 0.55rem 0; }
/* The site map's nested lists keep their markers: a block link holds the marker on its first line. */
.site-map li li a { display: block; }
.link-list li + li { margin-top: 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
/* A caption stays readable when its table is wider than the screen. */
caption { text-align: left; font-weight: 700; padding-bottom: var(--space-s); max-width: calc(100vw - 5rem); }
th, td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { border-bottom: 2px solid var(--rule-strong); }
td.num, th.num { text-align: right; white-space: nowrap; }
/* A heading over a group of rows says what the rows share, in running text: only its name is bold. */
th[scope="rowgroup"] { font-weight: 400; padding-top: var(--space-m); }
tr.calculated td, tr.calculated th { font-style: italic; }
/* A register's notes are its longest cells: a narrow column wrapped one search record to a row about 2,000px tall (decision 134). */
th.notes { min-width: 20rem; }

/* Charts */
.chart { margin: var(--space-l) 0; }
.chart figcaption :is(h3, h4) { margin-top: 0; }
.chart-svg { display: block; width: 100%; min-width: 30rem; height: auto; color: var(--ink); }
/* Drawn at the width it has, so it does not scroll. */
.chart-svg--narrow { min-width: 0; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { stroke: var(--rule-strong); stroke-width: 1.5; }
.chart-tick, .chart-label { fill: var(--ink-soft); font-size: 13px; font-family: inherit; }
.chart-series path { stroke-width: 2.5; }
/* The outline in the panel colour keeps a name readable where it crosses a line. */
.chart-svg .chart-end { font-size: 13px; font-weight: 600; stroke: var(--accent-soft); stroke-width: 4px; paint-order: stroke; }
.chart-mark { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-mark-dot { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 1; }
.chart-mark-number { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart-marks-key { font-size: 0.95rem; padding-left: 1.2rem; }
.chart-series--1 { stroke: var(--series-1); fill: var(--series-1); }
.chart-series--2 { stroke: var(--series-2); fill: var(--series-2); }
.chart-series--3 { stroke: var(--series-3); fill: var(--series-3); }
.chart-series--4 { stroke: var(--series-4); fill: var(--series-4); }
.chart-series--5 { stroke: var(--series-5); fill: var(--series-5); }
.chart-marks { stroke: var(--paper); stroke-width: 1; }
.chart-legend { list-style: none; padding: 0; margin: var(--space-s) 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.95rem; }
.chart-legend li { margin: 0; }
.chart-key { vertical-align: middle; }
/* A value axis that does not start at zero: a break on the axis, and the same in words (W21). */
.chart-break { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.chart-note { font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 var(--space-s); }

/* Tools */
/* The tool box and its fieldsets are padded less on a phone, so a menu has room for its longest
   choice at 320 px (W28). */
.tool {
  margin: var(--space-l) 0; padding: var(--space-s);
  border: 2px solid var(--rule-strong); border-radius: var(--radius);
}
.tool > h2, .tool > h3 { margin-top: 0; }
.tool-mode { font-weight: 700; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-m); margin-bottom: var(--space-m); }
.field label, .field legend { display: block; font-weight: 600; }
.field .hint { display: block; color: var(--ink-soft); font-size: 0.9rem; }
.error { display: block; color: var(--error); font-weight: 600; font-size: 0.95rem; }
.error::before { content: "Error: "; }
.error:empty { display: none; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--space-s); margin: 0 0 var(--space-m); min-width: 0; }
legend { font-weight: 700; padding: 0 var(--space-s); }
/* Form rhythm, by proximity: a label and its hint read as one unit and the control sits a clear
   step below them; each part of a fieldset is one larger step from the next; fields are further
   apart again, so each reads as a group. A hint that belongs to a button stays close to it. */
.field > .hint, .field > .error { margin-top: 0.2rem; }
.field > :is(input, select, .affix) { margin-top: var(--space-s); }
fieldset > * { margin-block: 0; }
fieldset > * + * { margin-top: var(--space-m); }
fieldset > legend + * { margin-top: 0; }
fieldset > :is(button, .choice) + .hint { margin-top: var(--space-s); }
/* A note of what a copy did is empty until then, and leaves no gap (step 4). */
p.hint:empty { display: none; }
fieldset > .fields { margin-bottom: 0; }
fieldset > .choice + .choice { margin-top: 0; }
fieldset > div:empty { display: none; }
fieldset .fields { row-gap: var(--space-l); }

input[type="text"], input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--paper);
  width: 100%; max-width: 14rem; min-height: 2.75rem; padding: 0.4rem 0.6rem;
  border: 2px solid var(--rule-strong); border-radius: var(--radius);
}
/* A select takes the width of its longest option, up to the width of its column. */
select { width: auto; max-width: 100%; }
input[aria-invalid="true"] { border-color: var(--error); border-width: 3px; }
.affix { display: flex; align-items: center; gap: 0.4rem; }

.choice { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 2.75rem; padding: 0.35rem 0; }
.choice input { width: 1.5rem; height: 1.5rem; margin: 0.15rem 0 0; flex: none; accent-color: var(--accent); }
.choice label { font-weight: 400; }

button {
  font: inherit; font-weight: 600; min-height: 2.75rem; padding: 0.5rem 1rem; cursor: pointer;
  color: var(--paper); background: var(--accent);
  border: 2px solid var(--accent); border-radius: var(--radius);
}
button.secondary { color: var(--accent); background: var(--paper); }
.buttons { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-bottom: var(--space-m); }

.reason dt, .option dt { font-weight: 600; }
.reason dd { margin: 0; }
.option dd { margin: 0 0 var(--space-s); }
.option dl { margin-bottom: 0; }
.result { padding: var(--space-m); background: var(--accent-soft); border-radius: var(--radius); margin-bottom: var(--space-m); }
.result > :first-child { margin-top: 0; }
.result > :last-child { margin-bottom: 0; }
.result dl { display: grid; gap: 0.25rem var(--space-m); margin: 0; }
.result dt { font-weight: 600; }
.result dd { margin: 0 0 var(--space-s); font-variant-numeric: tabular-nums; }
.result .headline { font-size: 1.5rem; font-weight: 700; }

/* A tool's form and summary, and a result only a script draws, show once the tool's module has run and
   marked the tool ready: a module that fails to load leaves the notice in place, and js-class.js adds a
   sentence to it at load (W32). While scripts run, the notice is hidden until then, so it does not
   flash its untrue message before a module that will load has run (the owner's answer of 14 October
   2026). */
.js-only { display: none; }
.tool.is-ready .js-only { display: revert; }
/* Keyed to .js, not is-ready, so the notice stays hidden while a module loads (decision 99). If js-class.js alone failed and a module ran, the notice would show beside the form: declined in W39, as it needs one same-site file to fail on its own. */
.js .tool:not(.load-failed) .no-js-only { display: none; }
.if-script-failed { display: none; }
.tool.load-failed .if-script-failed { display: inline; }

.option-grid { display: grid; gap: var(--space-m); }
.option { padding: var(--space-m); border: 1px solid var(--rule); border-radius: var(--radius); }
.option > :first-child { margin-top: 0; }
/* An option that stands alone above the grid: the rule the government has announced. */
.option + .option-grid { margin-top: var(--space-m); }
/* A link that stands alone in a table cell: a taller target than the line it sits on. */
.stand td a { display: inline-block; padding-block: 0.625rem; margin-block: -0.625rem; }

/* Wider screens */
@media (min-width: 40em) {
  body { font-size: 1.125rem; }
  h1 { font-size: 2.375rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.375rem; }
  .wrap { padding: 0 1.5rem; }
  .rate-block { padding: var(--space-xl) var(--space-l); }
  .rate-block .rate { font-size: 3.5rem; }
  .cards, .option-grid { grid-template-columns: repeat(2, 1fr); }
  /* Two columns only where each is wide enough for the longest choice in a list; in a tool's
     form column beside its summary that is one. */
  .fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
  .result dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .result dd { margin-bottom: 0; }
  .tool { padding: var(--space-l); }
  fieldset { padding: var(--space-m); }
}

@media (min-width: 60em) {
  .cards--three { grid-template-columns: repeat(3, 1fr); }
}

/* The menu opens out only where the browser can show the content of a closed details element.
   Elsewhere the Menu button stays. */
@supports selector(details::details-content) {
  @media (min-width: 60em) {
    .nav-menu summary { display: none; }
    .nav-menu ul { display: flex; flex-wrap: wrap; gap: 0 1rem; margin: 0; font-size: 0.9rem; }
    /* The negative margin keeps the row the same height on a page with no current entry. */
    .nav-menu a[aria-current] { border-left: 0; padding-left: 0; border-bottom: 3px solid var(--accent); margin-bottom: -3px; }
    .nav-menu::details-content { content-visibility: visible; display: block; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header nav, .skip-link, .buttons, .site-footer nav[aria-label="Footer"], .back-to-top, .pager { display: none; }
  details::details-content { content-visibility: visible; display: block; }
  .tool-summary { position: static; }
  a, a:visited, a:active { color: inherit; }
  body { font-size: 11pt; }
}
