/* STUR mini-app shared styles. Version 2 (CC v4 look: saltbush paper, bush ink, eucalypt, wattle for "now",
   per-app colour, Atkinson Hyperlegible, light and dark). Any change to this file's content means a new file name (styles.v3.css). */
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/assets/fonts/atkinson-hyperlegible-400.v1.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/assets/fonts/atkinson-hyperlegible-700.v1.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F2F4EF;
  --paper-raised: #FFFFFF;
  --surface: #FFFFFF;
  --sunk: #E8ECE6;
  --ink: #1C2B26;
  --forest: #2F6B59;
  --forest-deep: #24564A;
  --brass: #8A5E10;
  --gold: #E3B23C;
  --brass-bg: #FBF0D2;
  --line: #D5DDD6;
  --line-strong: #7D8B84;
  --muted: #56645E;
  --flag-amber-bg: #FBEFD5;
  --flag-amber-ink: #6B4410;
  --flag-red: #A33A2A;
  --flag-red-bg: #F7E1DC;
  --flag-green-bg: #E1EEE8;
  --danger-tint: #FFF6F4;
  --visited: #4D3F7A;
  --on-accent: #FFFFFF;
  --bar-bg: #24463C;
  --bar-ink: #FFFFFF;
  --footer-bg: #1C2B26;
  --footer-ink: #E7EEE9;
  --footer-link-hover: #F2D58C;
  --mark-bg: #F7DF8E;
  --focus: #1C2B26;
  --focus-ring: #E3B23C;
  /* Per-app colour (set below by body[data-app]); --app for graphics, --app-ink behind white text. */
  --app: #3F7A68; --app-ink: #2C5C4D; --app-tint: #E1EEE8;

  --font-serif: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.3rem);
  --step-2: clamp(1.3rem, 1.18rem + 0.6vw, 1.55rem);
  --step-3: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-4: clamp(1.85rem, 1.5rem + 1.7vw, 2.6rem);

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --radius: 12px;
  --radius-sm: 7px;
  --maxw: 70rem;
  --measure: 70ch;
  --shadow: 0 1px 2px rgba(28, 43, 38, 0.06);
  --t: 200ms;
}
body[data-app="wt"] { --app: #34567A; --app-ink: #2A4663; --app-tint: #E3EBF4; }
body[data-app="ec"] { --app: #C98F1C; --app-ink: #7A5410; --app-tint: #FBF0D2; }
body[data-app="fn"] { --app: #3F7A68; --app-ink: #2C5C4D; --app-tint: #E1EEE8; }
body[data-app="ev"] { --app: #4C93B5; --app-ink: #2D6684; --app-tint: #E2F0F7; }
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #14201C; --paper-raised: #1B2925; --surface: #1F2E29; --sunk: #22322D;
    --ink: #E7EEE9; --forest: #7FC0A8; --forest-deep: #9ACBB8; --brass: #E2AE45; --gold: #E8BF57; --brass-bg: #3A3320;
    --line: #2F433C; --line-strong: #6A877C; --muted: #A6B5AD;
    --flag-amber-bg: #3A3320; --flag-amber-ink: #F0C878; --flag-red: #F09A88; --flag-red-bg: #3B2420; --flag-green-bg: #1F3A31;
    --danger-tint: #3B2420; --visited: #C3B4F0; --on-accent: #0F1916;
    --bar-bg: #0E1714; --bar-ink: #FFFFFF; --footer-bg: #0E1714; --footer-ink: #DCE6E0; --mark-bg: #6B5516;
    --focus: #E7EEE9; --focus-ring: #E8BF57; --shadow: none;
  }
  body[data-app="wt"] { --app: #8FB3D6; --app-ink: #8FB3D6; --app-tint: #22344A; }
  body[data-app="ec"] { --app: #E2AE45; --app-ink: #E2AE45; --app-tint: #3A3320; }
  body[data-app="fn"] { --app: #7FC0A8; --app-ink: #7FC0A8; --app-tint: #1F3A31; }
  body[data-app="ev"] { --app: #8CC7E2; --app-ink: #8CC7E2; --app-tint: #1E3442; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--forest-deep); line-height: 1.2; margin: 1.4em 0 0.5em; font-weight: 700; }
h1 { font-size: var(--step-4); margin-top: 0.6em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p, ul, ol, dl { margin: 0 0 1em; max-width: var(--measure); }
li { margin-bottom: 0.25em; }
a { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--forest-deep); text-decoration-thickness: 2px; }
a:visited { color: var(--visited); }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
small, .small { font-size: var(--step--1); }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }
abbr[title] { text-decoration: underline dotted; cursor: help; }

/* Focus: 3px, high contrast, never hidden */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-ring);
  border-radius: 3px;
}
main:focus-visible, [tabindex="-1"]:focus-visible { box-shadow: none; outline: 3px dashed var(--forest); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0.5rem; top: -100px; z-index: 100;
  background: var(--forest-deep); color: var(--on-accent); padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus, .skip-link:focus-visible { top: 0.5rem; color: var(--on-accent); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4); }

/* Disclaimer bar */
.disclaimer-bar {
  background: var(--bar-bg); color: var(--bar-ink); font-size: var(--step--1);
  padding: var(--s2) 0; text-align: center;
}
.disclaimer-bar p { margin: 0 auto; max-width: none; }
.disclaimer-bar strong { color: var(--bar-ink); }

/* Header */
.site-header { background: var(--paper-raised); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); padding-top: var(--s3); padding-bottom: var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--forest-deep); font-family: var(--font-serif); font-weight: 700; font-size: var(--step-1); }
.brand:visited { color: var(--forest-deep); }
.brand img { width: 2rem; height: 2rem; }
.brand .brand-sub { display: block; font-family: var(--font-sans); font-weight: 400; font-size: var(--step--1); color: var(--muted); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); list-style: none; margin: 0; padding: 0; max-width: none; }
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm); text-decoration: none; color: var(--forest-deep); font-weight: 600;
  transition: background-color var(--t);
}
.site-nav a:visited { color: var(--forest-deep); }
.site-nav a:hover { background: var(--flag-green-bg); }
.site-nav a[aria-current="page"] { background: var(--app-ink); color: var(--on-accent); }

main { display: block; padding-bottom: var(--s7); }
.lede { font-size: var(--step-1); color: var(--ink); max-width: 62ch; }
.page-intro { margin-bottom: var(--s5); }

/* Notices and banners */
.notice {
  border: 1px solid var(--line-strong); border-left-width: 6px; border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4); margin: var(--s4) 0; background: var(--paper-raised);
}
.notice > :last-child { margin-bottom: 0; }
.notice--sample { background: var(--flag-red-bg); border-color: var(--flag-red); }
.notice--sample strong { color: var(--flag-red); }
.notice--warn { background: var(--flag-amber-bg); border-color: var(--brass); }
.notice--info { background: var(--flag-green-bg); border-color: var(--forest); }
.notice--error { background: var(--flag-red-bg); border-color: var(--flag-red); }
.notice h2, .notice h3 { margin-top: 0; font-size: var(--step-1); }

/* Cards and panels */
.grid { display: grid; gap: var(--s4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s4); box-shadow: var(--shadow); min-width: 0;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-top: 0; }
.card--link { position: relative; transition: border-color var(--t); }
.card--link:hover { border-color: var(--app); }
.card--accent { border-top: 4px solid var(--app); }

details.panel {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 0 var(--s3); box-shadow: var(--shadow);
}
details.panel > summary {
  list-style: none; cursor: pointer; padding: var(--s3) var(--s4); min-height: 2.75rem;
  display: flex; align-items: center; gap: var(--s2); font-family: var(--font-serif);
  font-weight: 700; font-size: var(--step-1); color: var(--forest-deep); border-radius: var(--radius);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ""; flex: none; width: 0.6rem; height: 0.6rem; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--t);
  margin-right: 0.25rem;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > summary:hover { background: var(--flag-green-bg); }
details.panel > .panel-body { padding: 0 var(--s4) var(--s4); }
details.panel[open] > .panel-body { animation: stur-fade var(--t) ease-out; }
.panel-count { margin-left: auto; font-family: var(--font-sans); font-size: var(--step--1); font-weight: 600; color: var(--muted); }
@keyframes stur-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes stur-flash { from { background-color: var(--brass-bg); } to { background-color: transparent; } }
.flash { animation: stur-flash 900ms ease-out; }

/* Buttons and controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; min-width: 2.5rem; padding: 0.45rem 0.95rem; border-radius: var(--radius-sm);
  border: 2px solid var(--forest); background: var(--forest); color: var(--on-accent); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background-color var(--t), transform 120ms;
}
.btn:visited { color: var(--on-accent); }
.btn:hover { background: var(--forest-deep); border-color: var(--forest-deep); color: var(--on-accent); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--forest-deep); }
.btn--ghost:visited { color: var(--forest-deep); }
.btn--ghost:hover { background: var(--flag-green-bg); color: var(--forest-deep); }
.btn--small { min-height: 2rem; padding: 0.25rem 0.6rem; font-size: var(--step--1); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s3) 0; }

label, .label { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.hint { font-size: var(--step--1); color: var(--muted); margin: 0.15rem 0 0.4rem; }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; min-height: 2.5rem; width: 100%; max-width: 28rem;
}
input[type="number"] { max-width: 12rem; }
input:hover, select:hover { border-color: var(--forest); }
input[aria-invalid="true"] { border-color: var(--flag-red); background: var(--danger-tint); }
.field { margin-bottom: var(--s4); }
.field-error { color: var(--flag-red); font-weight: 600; font-size: var(--step--1); margin: 0.25rem 0 0; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--forest); margin: 0; flex: none; }
input[type="range"] { width: 100%; max-width: 40rem; accent-color: var(--forest); min-height: 2rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; margin: 0.35rem 0; min-height: 1.5rem; cursor: pointer; }
.check input { margin-top: 0.2rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4) var(--s4); margin: 0 0 var(--s4); min-width: 0; }
legend { font-weight: 700; padding: 0 0.35rem; color: var(--forest-deep); }

/* Segmented radio group (native radios keep arrow-key support) */
.segmented { display: flex; flex-wrap: wrap; gap: 0.35rem; border: 0; padding: 0; margin: 0 0 var(--s4); }
.segmented legend { padding: 0; margin-bottom: 0.35rem; }
.segmented label {
  position: relative; display: inline-flex; align-items: center; margin: 0; font-weight: 600;
  min-height: 2.5rem; padding: 0.35rem 0.8rem; border: 2px solid var(--forest); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--forest-deep); cursor: pointer; transition: background-color var(--t);
}
.segmented input { position: absolute; opacity: 0; width: 100%; height: 100%; left: 0; top: 0; margin: 0; cursor: pointer; }
.segmented label:hover { background: var(--flag-green-bg); }
.segmented label.is-checked { background: var(--forest); color: var(--on-accent); }
.segmented label:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-ring); }
.segmented .seg-note { font-weight: 400; font-size: 0.8em; margin-left: 0.3rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0 0 var(--s4); max-width: none; }
.chips li { margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.25rem; padding: 0.25rem 0.75rem;
  border-radius: 999px; border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--step--1); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color var(--t), border-color var(--t);
}
.chip:visited { color: var(--ink); }
.chip:hover { border-color: var(--forest); background: var(--flag-green-bg); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--forest); border-color: var(--forest); color: var(--on-accent); }
.chip .count { font-weight: 700; }

/* Badges */
.badges { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; position: relative; vertical-align: middle; }
.badges[tabindex] { border-radius: var(--radius-sm); cursor: help; }
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; font-weight: 700;
  line-height: 1.2; padding: 0.2rem 0.5rem; border-radius: 999px; border: 1px solid currentColor;
  white-space: nowrap; background: var(--surface); color: var(--ink);
}
.badge::before { content: attr(data-icon); font-weight: 700; }
.badge--law { background: var(--flag-green-bg); color: var(--forest-deep); }
.badge--announced { background: var(--brass-bg); color: var(--flag-amber-ink); }
.badge--proposed { background: var(--surface); color: var(--flag-amber-ink); border-style: dashed; }
.badge--superseded { background: var(--sunk); color: var(--muted); text-decoration: line-through; }
.badge--reference { background: var(--surface); color: var(--forest-deep); border-style: solid; }
.badge--check { background: var(--flag-amber-bg); color: var(--flag-amber-ink); }
.badge--old { background: var(--flag-red-bg); color: var(--flag-red); }
.badge--stale { background: var(--flag-red-bg); color: var(--flag-red); border-style: dashed; }
.badge--verified { background: var(--surface); color: var(--muted); border-color: var(--line-strong); font-weight: 600; }
.badge--act { background: var(--forest); color: var(--on-accent); border-color: var(--forest); }
.badge--state { background: var(--surface); color: var(--forest-deep); border-style: dotted; }
.badge--illustrative { background: var(--surface); color: var(--brass); }
.badge--sample { background: var(--flag-red); color: var(--on-accent); border-color: var(--flag-red); }
.badge--descriptive { background: var(--sunk); color: var(--muted); }
.badge--local { background: var(--surface); color: var(--forest); border-style: dashed; }
.badges[data-tip]:hover::after, .badges[data-tip]:focus::after, .badges[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 30; left: 0; top: calc(100% + 6px);
  width: max-content; max-width: min(22rem, 80vw); white-space: pre-line; background: var(--ink); color: var(--paper);
  font-size: 0.85rem; font-weight: 400; line-height: 1.45; padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* Source lines and item meta */
.source { font-size: var(--step--1); color: var(--muted); margin: 0.35rem 0 0; }
.source a { font-weight: 600; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; margin: 0.35rem 0; }
.value { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--forest-deep); }
.value--big { font-size: var(--step-2); }
.not-captured { font-style: italic; color: var(--flag-amber-ink); font-weight: 600; }
.prompts { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); margin-top: var(--s3); }
.prompts h4, .prompts h5 { margin: 0 0 0.3rem; font-size: var(--step-0); font-family: var(--font-sans); color: var(--forest-deep); }
.prompts ul { margin: 0; padding-left: 1.2rem; font-size: var(--step--1); }
.illustrative-note { border: 2px dashed var(--brass); background: var(--brass-bg); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin: var(--s3) 0; }
.illustrative-note > :last-child { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: var(--s3) 0 var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-raised); }
.table-wrap:focus-visible { box-shadow: 0 0 0 6px var(--focus-ring); }
.scroll-hint { font-size: var(--step--1); color: var(--muted); margin: 0.2rem 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: var(--step--1); }
caption { text-align: left; font-weight: 700; padding: var(--s3) var(--s3) var(--s2); color: var(--forest-deep); font-family: var(--font-serif); font-size: var(--step-1); }
caption .small { display: block; font-family: var(--font-sans); font-weight: 400; color: var(--muted); }
th, td { padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
thead th { background: var(--flag-green-bg); color: var(--forest-deep); border-top: 0; white-space: nowrap; }
tbody th { font-weight: 600; }
td.num, th.num { text-align: right; }
tr.is-highlight > * { background: var(--brass-bg); }
tr.is-highlight > :first-child { box-shadow: inset 4px 0 0 var(--brass); }
@media (max-width: 40rem) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack, table.stack tbody, table.stack tr, table.stack th, table.stack td { display: block; width: 100%; }
  table.stack tr { border-top: 2px solid var(--line); padding: var(--s2) 0; }
  table.stack th, table.stack td { border-top: 0; padding: 0.3rem 0.75rem; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--forest-deep); }
  table.stack td.num { text-align: left; }
}

/* States */
.state {
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: var(--s4); margin: var(--s3) 0;
  background: var(--paper-raised);
}
.state h2, .state h3 { margin-top: 0; font-size: var(--step-1); }
.state > :last-child { margin-bottom: 0; }
.state--error { border-style: solid; border-color: var(--flag-red); background: var(--flag-red-bg); }
.state--partial { border-color: var(--brass); background: var(--flag-amber-bg); }
.state--empty { border-color: var(--line-strong); }
.skeleton { display: none; }
.js .skeleton { display: block; }
.skeleton .bar { height: 1rem; border-radius: 4px; background: linear-gradient(90deg, var(--sunk), var(--paper-raised), var(--sunk)); background-size: 200% 100%; margin: 0.7rem 0; animation: stur-shimmer 1.2s infinite linear; }
.skeleton .bar:nth-child(2) { width: 85%; } .skeleton .bar:nth-child(3) { width: 65%; }
@keyframes stur-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.noscript-box { border: 2px solid var(--brass); background: var(--flag-amber-bg); padding: var(--s4); border-radius: var(--radius); margin: var(--s4) 0; }

/* Freshness summary */
.freshness { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); margin: var(--s3) 0; padding: 0; list-style: none; max-width: none; }
.freshness li { margin: 0; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); }
.freshness .num { display: block; font-family: var(--font-sans); font-size: var(--step-3); font-weight: 700; color: var(--forest-deep); line-height: 1.1; }
.freshness .lbl { font-size: var(--step--1); color: var(--muted); font-weight: 600; }

/* Tabs (ARIA tab pattern) */
.tablist { display: flex; flex-wrap: wrap; gap: 0.3rem; border-bottom: 2px solid var(--line); margin: var(--s4) 0 0; padding: 0; }
.tab {
  font: inherit; font-weight: 600; min-height: 2.5rem; padding: 0.4rem 0.9rem; border: 2px solid transparent;
  border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: transparent; color: var(--forest-deep); cursor: pointer;
}
.tab:hover { background: var(--flag-green-bg); }
.tab[aria-selected="true"] { background: var(--paper-raised); border-color: var(--line); margin-bottom: -2px; border-bottom: 2px solid var(--paper-raised); }
.tabpanel { padding: var(--s4) 0; }

/* Search */
.search-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; margin: var(--s3) 0; }
.search-row .field { margin: 0; flex: 1 1 16rem; }
mark { background: var(--mark-bg); color: var(--ink); padding: 0 0.1em; border-radius: 2px; }
.result-count { font-weight: 600; color: var(--forest-deep); }

/* Definition lists / glossary */
dl.glossary dt { font-weight: 700; color: var(--forest-deep); margin-top: var(--s3); }
dl.glossary dd { margin: 0.2rem 0 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
dl.kv dt { font-weight: 600; color: var(--muted); }
dl.kv dd { margin: 0; }
@media (max-width: 30rem) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 0.4rem; } }
:target { scroll-margin-top: 1rem; }
dt:target, li:target, .card:target, tr:target > * { background: var(--brass-bg); }

/* Charts */
.chart { margin: var(--s3) 0; }
.chart svg { display: block; width: 100%; height: auto; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); }
.chart text { font-family: var(--font-sans); fill: var(--ink); }
.chart .axis line, .chart .axis path { stroke: var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; list-style: none; padding: 0; margin: var(--s2) 0; font-size: var(--step--1); max-width: none; }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.swatch { display: inline-block; width: 1rem; height: 1rem; border-radius: 3px; border: 1px solid var(--ink); }

/* Progress */
.progress { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) 0; }
progress { width: 100%; max-width: 20rem; height: 0.9rem; accent-color: var(--forest); }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); padding: var(--s6) 0 var(--s5); font-size: var(--step--1); }
.site-footer a, .site-footer a:visited { color: #FFFFFF; }
.site-footer a:hover { color: var(--footer-link-hover); }
.site-footer h2 { color: #fff; font-size: var(--step-1); margin-top: 0; }
.site-footer .footer-grid { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.35rem; }
.site-footer .disclaimer-line { font-weight: 700; color: #fff; font-size: var(--step-0); }
.site-footer .btn--ghost { color: #fff; border-color: #fff; }
.site-footer .btn--ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
.site-footer :focus-visible { outline-color: #fff; box-shadow: 0 0 0 6px var(--gold); }

/* Layout helpers */
.stack > * + * { margin-top: var(--s4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.split { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: flex-end; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); margin: var(--s3) 0 var(--s4); }
.toolbar .field { margin: 0; }
.toolbar select, .toolbar input { max-width: 16rem; }
.pill-list { list-style: none; padding: 0; margin: 0.3rem 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; max-width: none; }
.pill-list li { margin: 0; }
.crosslinks { font-size: var(--step--1); }
.crosslinks a { font-weight: 600; }
.item { border-top: 1px solid var(--line); padding: var(--s3) 0; }
.item:first-child { border-top: 0; }
.item h3, .item h4 { margin: 0 0 0.3rem; }
.kicker { font-size: var(--step--1); font-weight: 700; color: var(--brass); margin: 0 0 0.25rem; }

/* Reduced motion: no animation at all */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .card--link:hover { transform: none; }
}
@media (prefers-contrast: more) {
  :root { --line: #5E6B65; --muted: #2F3A35; --line-strong: #2F3A35; }
  .badge { border-width: 2px; }
}
@media (forced-colors: active) {
  .badge, .chip, .btn, .segmented label, .card, details.panel, .state, .notice { border: 1px solid CanvasText; forced-color-adjust: auto; }
  .segmented label.is-checked, .chip[aria-pressed="true"], .site-nav a[aria-current="page"] { outline: 3px solid Highlight; }
  :focus-visible { outline: 3px solid Highlight; }
  .swatch { forced-color-adjust: none; }
}

/* Print */
@media print {
  :root { --paper: #fff; --paper-raised: #fff; --surface: #fff; --ink: #000; }
  body { font-size: 11pt; background: #fff; color: #000; }
  .skip-link, .site-nav, .btn, .btn-row, .toolbar, .chips, .no-print, .tablist, .skeleton, .segmented, details.finder, .search-panel, #notices .btn { display: none !important; }
  .site-header, .card, details.panel { box-shadow: none; }
  details.panel > .panel-body { display: block !important; }
  .disclaimer-bar { background: #fff; color: #000; border: 1px solid #000; }
  .disclaimer-bar strong { color: #000; }
  .site-footer { background: #fff; color: #000; border-top: 2px solid #000; }
  .site-footer a, .site-footer h2, .site-footer .disclaimer-line { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; word-break: break-all; }
  .site-nav a::after, .brand::after { content: none !important; }
  .table-wrap { overflow: visible; border: 0; }
  .badges[data-tip]::after { display: none !important; }
  h2, h3 { break-after: avoid; }
  .card, tr, .item { break-inside: avoid; }
}

/* ===== v2 shared components ===== */
h1 { color: var(--app-ink); letter-spacing: -0.01em; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; }
.brand img { width: 2.5rem; height: 2.5rem; border-radius: 9px; }
.brand { gap: var(--s3); }
.site-header { border-bottom: 3px solid var(--app); }
.site-nav a:hover { background: var(--app-tint); }
/* Phones: the page menu is one row that scrolls sideways (current page kept in view by core.v2.js) */
@media (max-width: 47.99rem) {
  .site-header .wrap { gap: var(--s2); }
  .site-nav { width: 100%; }
  .site-nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; min-height: 2.75rem; }
  .brand .brand-sub { display: none; }
}
/* Home page: the app's mark beside the intro */
.page-intro--home { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5); align-items: start; }
.page-intro--home .hero-mark { width: clamp(5rem, 12vw, 8.5rem); height: auto; margin-top: 0.6em; border-radius: 22%; }
@media (max-width: 40rem) { .page-intro--home { grid-template-columns: 1fr; } .page-intro--home .hero-mark { display: none; } }
/* Freshness tiles: two per row on phones instead of one */
@media (max-width: 40rem) { .freshness { grid-template-columns: repeat(2, minmax(0, 1fr)); } .freshness li:first-child:nth-last-child(odd) { grid-column: 1 / -1; } }
.freshness li { border-left: 4px solid var(--app); }
/* Folded rule cards (core.v2.js triggerCard): closed row keeps labels and dates visible */
details.trigger-card--fold { padding: 0; }
details.trigger-card--fold > summary { list-style: none; cursor: pointer; padding: var(--s3) var(--s4); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem var(--s3); align-items: start; border-radius: var(--radius); }
details.trigger-card--fold > summary::-webkit-details-marker { display: none; }
details.trigger-card--fold > summary:hover { background: var(--app-tint); }
details.trigger-card--fold > summary .badges, details.trigger-card--fold > summary .tc-fresh { grid-column: 1 / -1; }
details.trigger-card--fold .tc-head .kicker { display: block; }
details.trigger-card--fold .tc-title { margin: 0; font-size: var(--step-1); }
details.trigger-card--fold .tc-chev { width: 1.4rem; height: 1.4rem; color: var(--muted); transition: transform var(--t); margin-top: 0.2rem; }
details.trigger-card--fold[open] .tc-chev { transform: rotate(180deg); }
details.trigger-card--fold .tc-fresh { display: flex; gap: 0.35rem; align-items: center; font-size: var(--step--1); color: var(--muted); }
details.trigger-card--fold .tc-body { padding: 0 var(--s4) var(--s4); border-top: 1px solid var(--line); }
details.trigger-card--fold .tc-body > :first-child { margin-top: var(--s3); }
details.trigger-card--fold.check, details.trigger-card--fold:has(.badge--check) { border-left: 4px solid var(--gold); }
.fold-btns { margin: 0 0 var(--s3); }
/* Panels that fold away on phones (core.v2.js foldOnSmall) */
details.fold-small { margin: var(--s3) 0 var(--s4); }
details.fold-small > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.4rem 0.9rem; border: 2px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 700; color: var(--forest-deep); }
details.fold-small > summary::-webkit-details-marker { display: none; }
details.fold-small[open] > summary .fold-icon { transform: rotate(180deg); }
.fold-small .fold-icon { transition: transform var(--t); }
.fold-small .fold-count { font-weight: 400; color: var(--muted); }
@media (min-width: 48rem) { details.fold-small > summary { display: none; } }
.fold-small .fold-body > .toolbar, .fold-small .fold-body > :first-child { margin-top: var(--s3); }
@media (min-width: 48rem) { .fold-small .fold-body > .toolbar, .fold-small .fold-body > :first-child { margin-top: 0; } }
/* Footer: app family switcher */
.app-switch { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.app-switch a { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.app-switch a:hover span { text-decoration: underline; }
.app-switch img { width: 1.9rem; height: 1.9rem; border-radius: 6px; flex: none; }
.site-footer h2 { display: flex; align-items: center; gap: 0.45rem; }
/* State boxes get an icon cue in addition to colour */
.state > h2:first-child, .state > h3:first-child { display: flex; gap: 0.45rem; align-items: center; }

/* ===== App-specific styles: fn ===== */
.hh-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.person { background: var(--surface); }
.person--child { background: var(--paper); }
.form-grid { display: grid; gap: 0 var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); align-items: end; }
.form-grid > p, .form-grid > .check { grid-column: 1 / -1; }
/* Lane timeline */
.tl { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-raised); padding: var(--s3) var(--s2); margin: var(--s3) 0; }
.tl-axis, .tl-lane { display: grid; grid-template-columns: 9.5rem 1fr; gap: var(--s2); align-items: start; }
.tl-lane { border-top: 1px solid var(--line); padding: var(--s2) 0; }
.tl-lane--couple { background: var(--flag-green-bg); }
.tl-lane--scenario { background: var(--paper); }
.tl-label { font-size: var(--step--1); padding-left: var(--s2); }
.tl-label .small { display: block; color: var(--muted); }
.tl-track { position: relative; margin: 0 2rem; min-height: calc(var(--rows, 1) * 2.5rem + 0.5rem); background-image: linear-gradient(var(--line), var(--line)); background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 1.3rem; }
.tl-axis .tl-track { min-height: 1.6rem; background: none; }
.tl-tick { position: absolute; left: calc(var(--x) * 1%); transform: translateX(-50%); font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-weight: 600; }
.tl-marker {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--row, 0) * 2.5rem + 0.25rem); transform: translateX(-50%);
  min-height: 2rem; min-width: 2rem; padding: 0.15rem 0.45rem; border-radius: 999px; border: 2px solid var(--forest);
  background: var(--surface); color: var(--forest-deep); font: inherit; font-size: 0.78rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background-color var(--t);
}
.tl-marker:hover { background: var(--flag-green-bg); }
.tl-marker.tl-law { background: var(--forest); color: var(--on-accent); }
.tl-marker.tl-law:hover { background: var(--forest-deep); }
.tl-marker.tl-other { border-style: dashed; border-color: var(--brass); color: var(--flag-amber-ink); }
.tl-marker.tl-couple, .tl-marker.tl-pension { background: var(--brass-bg); border-color: var(--brass); color: var(--flag-amber-ink); }
.tl-marker.tl-cgt, .tl-marker.tl-window, .tl-marker.tl-absence, .tl-marker.tl-downsizer { border-style: dashed; }
.tl-marker.tl-sell, .tl-marker.tl-buy { background: var(--forest); color: var(--on-accent); }
.tl-empty { position: absolute; left: 0; top: 0.3rem; }
.tl-detail { margin: var(--s3) 0; border-left: 4px solid var(--gold); }
.tl-detail-line { min-height: 1.6em; font-weight: 600; }
@media (max-width: 40rem) {
  .tl-axis, .tl-lane { grid-template-columns: 1fr; }
  .tl-axis .tl-label { display: none; }
  .tl-track { margin: 0 1.8rem; }
}
.outline section { border-top: 1px solid var(--line); padding: var(--s2) 0; }
.outline h4 { margin: 0.3rem 0; }
/* Results */
.sc-select label { font-size: var(--step--1); }
.sc-select input[type="checkbox"] { position: absolute; opacity: 0; width: 100%; height: 100%; left: 0; top: 0; margin: 0; cursor: pointer; }
.grid2x2 { display: grid; gap: var(--s2); margin: var(--s3) 0; }
.g-row { display: grid; grid-template-columns: 8rem 1fr 1fr; gap: var(--s2); }
.g-row > [role="columnheader"], .g-row > [role="rowheader"] { font-weight: 700; color: var(--forest-deep); align-self: center; font-size: var(--step--1); }
.cell { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); height: 100%; }
.cell h4 { margin: 0 0 0.3rem; font-size: var(--step-0); }
@media (max-width: 44rem) { .g-row { grid-template-columns: 1fr; } .g-corner { display: none; } }
.tree rect { fill: var(--surface); stroke: var(--forest); stroke-width: 2; }
.tree .dt-leaf rect { fill: var(--flag-green-bg); }
.tree a:focus-visible rect, .tree a:hover rect { stroke: var(--forest-deep); stroke-width: 4; fill: var(--brass-bg); }
.tree a:focus { outline: none; }
.tree .dt-line { stroke: var(--line-strong); stroke-width: 2; }
.tree .dt-label { fill: var(--muted); }
.tree-wrap { overflow-x: auto; }
.tree-wrap svg { min-width: 40rem; }
.tree-list { font-size: var(--step--1); }
.bar.s1, .swatch.s1 { fill: #2a78d6; background: #2a78d6; }
.bar.s2, .swatch.s2 { fill: #eb6834; background: #eb6834; }
.bar.s3, .swatch.s3 { fill: #1baf7a; background: #1baf7a; }
.bar.s4, .swatch.s4 { fill: #eda100; background: #eda100; }
.bar.s5, .swatch.s5 { fill: #e87ba4; background: #e87ba4; }
.bar.s6, .swatch.s6 { fill: #008300; background: #008300; }
.bar.s7, .swatch.s7 { fill: #6250d6; background: #6250d6; }
.bar:hover { opacity: 0.8; }
.zero-line { stroke: var(--ink); stroke-width: 1.5; }
.axis-muted { fill: var(--muted); }
.data-line { stroke: #2a78d6; stroke-width: 2; }
.data-dot { fill: #2a78d6; stroke: var(--paper-raised); stroke-width: 2; }
.ref-line { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 4; }
.ref-line--cut { stroke-dasharray: 2 4; }
.compare-table td, .compare-table th { white-space: nowrap; }
.flags { padding-left: 0; list-style: none; font-size: var(--step--1); }
.flags li { margin-bottom: 0.35rem; }
.flag-icon { color: var(--flag-amber-ink); }
.scenario-card { margin-bottom: var(--s3); }
.link-check { list-style: none; padding: 0; max-width: none; }
.link-check > li { border-top: 1px solid var(--line); padding: var(--s2) 0; margin: 0; }
.lc-url { word-break: break-all; }
.h-small { font-size: var(--step-1); }
@media (forced-colors: active) { .bar, .swatch { forced-color-adjust: none; } .tl-marker { border: 2px solid ButtonText; } }

/* v2 additions */
.hh-grid { align-items: start; }
details.site-group > summary { font-family: var(--font-sans); font-size: var(--step-0); display: flex; }
details.site-group > summary .panel-count { margin-left: auto; }
details.site-group { padding: 0; }
details.site-group > summary { flex-wrap: wrap; gap: 0.25rem var(--s3); }
details.site-group .sg-title { min-width: 0; overflow-wrap: anywhere; }
.term-link { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; min-height: 1.6rem; }
input[type="checkbox"], input[type="radio"] { width: 1.375rem; height: 1.375rem; }
@media (max-width: 40rem) { table.stack caption { display: block; width: 100%; } }
