/* Fonts are vendored (SIL Open Font License), so the page makes no third-party requests. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('fonts/fraunces-latin-opsz-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
html, body { overflow-x: clip; }
body { background: hsl(38 33% 95%); }
.ps { min-height: 100vh; min-height: 100dvh; font-synthesis: none; }
[x-cloak] { display: none !important; }
.vh { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; }

/* Pension Simulator. Tokens follow the Paris & Suburbs Property Sales app: warm paper, navy ink, one burgundy signal.
   Colour and font literals live only in the two token blocks below. */
.ps {
  --color-paper: hsl(38 33% 95%);
  --color-card: hsl(40 40% 98%);
  --color-sunken: hsl(38 26% 92%);
  --color-ink: hsl(222 40% 14%);
  --color-muted: hsl(222 12% 40%);
  --color-rule: hsl(35 18% 84%);
  --color-control: hsl(35 7% 51%);
  --color-accent: #8f1d33;
  --color-accent-ink: hsl(40 40% 98%);
  --color-accent-wash: rgba(143, 29, 51, 0.12);
  --color-second: #1f3a68;
  --color-focus: hsl(218 54% 26%);
  --color-grid: #e6dfd2;
  --color-tick: #6b6558;
  --color-young: hsl(36 52% 70%);
  --color-working: #1f3a68;
  --color-retired: hsl(350 48% 52%);
  --shadow-pop: 0 8px 24px -6px rgb(21 30 50 / 0.16), 0 1px 3px rgb(21 30 50 / 0.08);
  --shadow-sheet: 0 -8px 32px rgb(21 30 50 / 0.22);
  --sheet-peek: 124px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;

  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-base: 15px;
  --text-prose: 16px;
  --text-title: 18px;
  --text-figure: 34px;
  --text-hero-figure: 46px;
  --text-display: 42px;

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

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  --line-scenario: 2.75px;
  --line-baseline: 1.5px;
  --dur-micro: 120ms;

  color-scheme: light;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.45;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
.ps[data-theme="dark"] {
  --color-paper: hsl(224 30% 8%);
  --color-card: hsl(224 28% 11%);
  --color-sunken: hsl(226 28% 15%);
  --color-ink: hsl(38 30% 92%);
  --color-muted: hsl(222 12% 66%);
  --color-rule: hsl(224 18% 22%);
  --color-control: hsl(223 11% 50%);
  --color-accent: #e8697f;
  --color-accent-ink: hsl(224 30% 8%);
  --color-accent-wash: rgba(232, 105, 127, 0.16);
  --color-second: #8fb0e6;
  --color-focus: hsl(214 62% 74%);
  --color-grid: rgba(255, 255, 255, 0.09);
  --color-tick: #a3a4a8;
  --color-young: hsl(36 42% 80%);
  --color-working: hsl(214 52% 46%);
  --color-retired: #e8697f;
  --shadow-pop: none;
  --shadow-sheet: 0 -1px 0 hsl(223 11% 50%);
  color-scheme: dark;
}
body { margin: 0; }
.ps *, .ps *::before, .ps *::after { box-sizing: border-box; }
.ps a { color: var(--color-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ps a:hover { color: var(--color-accent); }
.ps :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.ps ::selection { background: var(--color-accent); color: var(--color-accent-ink); }
.ps h1, .ps h2, .ps h3, .ps p, .ps figure, .ps fieldset { margin: 0; }
.ps fieldset { border: 0; padding: 0; min-width: 0; }
.ps legend { padding: 0; }

/* type roles */
.display { font-family: var(--font-display); font-weight: 600; font-size: var(--text-display); line-height: 1.05; letter-spacing: -0.015em; overflow-wrap: break-word; min-width: 0; text-wrap: balance; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: var(--text-title); letter-spacing: -0.01em; }
.prose { font-size: var(--text-prose); line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
.muted { color: var(--color-muted); }
.small { font-size: var(--text-sm); }
.byline { margin: 0; }
.byline a { color: inherit; }
/* the equations in "How this works": a grid of cards, each with the mathematics and a caption */
.eqs { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: var(--space-4); }
.eq { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); min-width: 0; }
.eq-m { overflow-x: auto; overflow-y: hidden; }
.eq-m math { font-size: 16px; white-space: nowrap; }
.eq > p { margin-top: auto; padding-top: var(--space-1); }
.eq i { font-family: 'STIX Two Text', Cambria, 'Times New Roman', Georgia, serif; font-style: italic; font-synthesis: style; font-size: 1.1em; }
.lab { font-size: var(--text-sm); font-weight: 600; }
.title { font-size: var(--text-title); font-weight: 600; line-height: 1.25; }

/* surfaces */
.card { background: var(--color-card); border: 1px solid var(--color-rule); border-radius: var(--radius-lg); }
.hr { height: 1px; background: var(--color-rule); border: 0; margin: 0; }

/* buttons */
.btn { font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); background: transparent; border: 1px solid var(--color-control); border-radius: var(--radius-md); min-height: 36px; padding: 0 var(--space-3); cursor: pointer; white-space: nowrap; transition: background-color var(--dur-micro), border-color var(--dur-micro); }
.btn:hover { background: var(--color-sunken); }
.btn:active { background: var(--color-rule); }
.btn-round { width: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.help { font: inherit; font-size: var(--text-xs); font-weight: 600; width: 20px; height: 20px; border-radius: var(--radius-pill); border: 1px solid var(--color-control); background: transparent; color: var(--color-muted); cursor: pointer; padding: 0; position: relative; flex: none; transition: background-color var(--dur-micro); }
.help::after { content: ""; position: absolute; inset: -12px; }
.help:hover { background: var(--color-sunken); color: var(--color-ink); }
.help[aria-expanded="true"] { background: var(--color-ink); color: var(--color-card); border-color: var(--color-ink); }

/* segmented choice: native radios */
.seg { background: var(--color-sunken); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.seg-i { position: relative; display: block; cursor: pointer; }
.seg-i input, .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg-i span { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-sm); border: 1px solid transparent; font-size: var(--text-sm); font-weight: 500; color: var(--color-muted); white-space: nowrap; transition: background-color var(--dur-micro), color var(--dur-micro); }
.seg-i:hover span { color: var(--color-ink); }
.seg-i input:checked + span { background: var(--color-card); border-color: var(--color-control); color: var(--color-ink); font-weight: 600; }
.seg-i input:focus-visible + span, .opt input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* option rows: who pays */
.opt { position: relative; display: block; cursor: pointer; }
.opt > span { display: flex; flex-direction: column; gap: 0; padding: 7px var(--space-3) 7px 36px; border: 1px solid var(--color-rule); border-radius: var(--radius-md); position: relative; transition: background-color var(--dur-micro), border-color var(--dur-micro); }
.opt > span::before { content: ""; position: absolute; left: 12px; top: 11px; width: 14px; height: 14px; border-radius: var(--radius-pill); border: 1.5px solid var(--color-control); background: var(--color-card); }
.opt:hover > span { background: var(--color-sunken); }
.opt input:checked + span { border-color: var(--color-ink); background: var(--color-card); }
.opt input:checked + span::before { border: 4.5px solid var(--color-accent); }

/* slider with default marker */
.rgw { position: relative; height: 30px; }
.rg { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer; position: relative; z-index: 1; }
.rg::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--color-control); }
.rg::-moz-range-track { height: 4px; border-radius: 2px; background: var(--color-control); }
.rg::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--color-card); border: 2px solid var(--color-ink); }
.rg::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--color-card); border: 2px solid var(--color-ink); }
.rg:hover::-webkit-slider-thumb { background: var(--color-sunken); }
.rg:active::-webkit-slider-thumb { background: var(--color-ink); }
.rg:focus-visible { outline: none; }
.rg:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.rg:focus-visible::-moz-range-thumb { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.rg-hero::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }
.rg-hero::-moz-range-track { height: 6px; border-radius: 3px; }
.rg-hero::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; background: var(--color-accent); border: 3px solid var(--color-card); box-shadow: 0 0 0 1.5px var(--color-accent); }
.rg-hero::-moz-range-thumb { width: 22px; height: 22px; background: var(--color-accent); border: 3px solid var(--color-card); box-shadow: 0 0 0 1.5px var(--color-accent); }
.rg-hero:hover::-webkit-slider-thumb, .rg-hero:active::-webkit-slider-thumb { background: var(--color-accent); }
.dtick { position: absolute; top: 20px; width: 2px; height: 9px; margin-left: -1px; background: var(--color-ink); pointer-events: none; }
.rgw-hero .dtick { top: 22px; height: 11px; }

/* headline figures */
.stats { background: var(--color-rule); gap: 1px; overflow: hidden; }
.stat { background: var(--color-card); padding: var(--space-4) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.figure { font-family: var(--font-display); font-weight: 600; font-size: var(--text-figure); line-height: 1.05; letter-spacing: -0.01em; white-space: nowrap; }
.chip { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 2px var(--space-2); border-radius: var(--radius-sm); background: var(--color-accent-wash); color: var(--color-ink); white-space: nowrap; }

/* chart frame */
.plot { position: relative; margin: var(--space-3) 52px 30px 44px; }
.sv { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gl { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--color-grid); }
.gl0 { border-top-color: var(--color-control); }
.ref { border-top-color: var(--color-ink); }
.yl { position: absolute; right: 100%; margin-right: var(--space-2); transform: translateY(-50%); font-size: var(--text-xs); color: var(--color-tick); white-space: nowrap; }
.xl { position: absolute; top: 100%; margin-top: var(--space-2); transform: translateX(-50%); font-size: var(--text-xs); color: var(--color-tick); white-space: nowrap; }
.el { position: absolute; left: 100%; margin-left: var(--space-2); transform: translateY(-50%); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.el-base { font-weight: 400; color: var(--color-tick); }
.note { position: absolute; left: var(--space-2); transform: translateY(-120%); font-size: var(--text-xs); color: var(--color-ink); white-space: nowrap; }
.ln { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ln-scen { stroke: var(--color-accent); stroke-width: var(--line-scenario); }
.ln-second { stroke: var(--color-second); stroke-width: var(--line-scenario); }
.ln-base { stroke: var(--color-tick); stroke-width: var(--line-baseline); stroke-dasharray: 5 4; stroke-linecap: butt; }
.ar { fill: var(--color-accent-wash); stroke: none; }
.vln { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--color-ink); }
.dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid var(--color-card); }
.dot-a { background: var(--color-accent); }
.dot-b { background: var(--color-second); }
.pg-young { fill: var(--color-young); }
.pg-working { fill: var(--color-working); }
.pg-retired { fill: var(--color-retired); }
.bound { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--color-ink); }
.bound span { position: absolute; right: 0; bottom: 3px; font-size: var(--text-xs); font-weight: 600; background: var(--color-card); padding: 0 var(--space-1); white-space: nowrap; }
.axis-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-left: 1px solid var(--color-card); }

/* legend swatches */
.sw { display: inline-block; width: 22px; height: 0; flex: none; }
.sw-scen { border-top: var(--line-scenario) solid var(--color-accent); }
.sw-second { border-top: var(--line-scenario) solid var(--color-second); }
.sw-base { border-top: var(--line-baseline) dashed var(--color-tick); }
.sw-box { width: 12px; height: 12px; border-radius: 2px; flex: none; }

/* collapsible panel */
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; font-size: var(--text-sm); font-weight: 600; border-radius: var(--radius-sm); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--color-ink); border-bottom: 1.5px solid var(--color-ink); transform: rotate(45deg); margin-right: var(--space-1); flex: none; }
.fold[open] > summary::after { transform: rotate(-135deg); }


/* layout */
.wrap { max-width: 1400px; margin: 0 auto; padding-left: var(--space-6); padding-right: var(--space-6); }
.layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-5); }
.rail { flex: 1 1 320px; max-width: 400px; min-width: 0; padding: var(--space-4); display: flex; flex-direction: column; gap: 14px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.age-block { display: flex; flex-direction: column; gap: var(--space-2); }
.sheet-bar { display: none; }
.ps-screen { height: 100vh; overflow-y: auto; }
.axis-note { position: absolute; left: 0; top: 0; font-size: var(--text-xs); line-height: 1; color: var(--color-tick); white-space: nowrap; }
.status { padding: var(--space-2) var(--space-3); background: var(--color-sunken); border-radius: var(--radius-md); }

/* charts drawn by Observable Plot (production page) */
.chart { position: relative; margin-top: var(--space-3); }
.chart svg { display: block; overflow: visible; }

@media (min-width: 900px) {
  .rail { position: sticky; top: var(--space-4); max-height: calc(100vh - 2 * var(--space-4)); overflow-y: auto; }
}
/* phone and tablet: the controls become a sheet; the retirement age stays in reach */
@media (max-width: 899px) {
  .wrap { padding-left: var(--space-4); padding-right: var(--space-4); }
  .layout { display: block; }
  .main { padding-bottom: calc(var(--sheet-peek) + var(--space-5)); }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: none; max-height: 84vh; max-height: 84dvh; padding-top: 0; border-radius: 14px 14px 0 0; border-bottom: 0; box-shadow: var(--shadow-sheet); overflow: hidden; transform: translateY(calc(100% - var(--sheet-peek))); transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .rail.is-open { transform: none; overflow-y: auto; }
  .rail:not(.is-open) > :not(.sheet-bar):not(.age-block) { visibility: hidden; }
  .sheet-bar { display: flex; align-items: center; gap: var(--space-3); order: -2; position: sticky; top: 0; z-index: 2; background: var(--color-card); padding-top: var(--space-3); margin-bottom: calc(-1 * var(--space-3)); }
  .age-block { order: -1; }
  .age-head, .age-figure, .age-help { display: none !important; }
}
@media (max-width: 720px) {
  .ps { --text-display: 32px; --text-figure: 27px; --text-hero-figure: 44px; --text-title: 17px; }
  .plot { margin-right: 46px; margin-left: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .ps * { transition: none !important; }
}
