/* ============================================================
   Lloyd's Register Foundation: Global Safety Evidence Centre
   The site's one stylesheet for everything pages share.

   What is here, in order:
     1. Tokens       colours by role (light and dark), type, space, sizes
     2. Base         reset, text, links, focus, helpers
     3. Site header  the one header, its menus, the strip and the trail
     4. Footer       the same on every page
     5. Finder       the search box that "/" opens
     6. Page shapes  landing page, tool page, reading page
     7. Controls     buttons, switches, tabs, chips, form fields
     8. Pieces       panels, notices, tables, stat tiles
     9. Modes        page-to-page fade, print, high contrast

   Every page loads this file after fonts/fonts.css, then its own stylesheet
   for what is particular to it. The header and footer markup comes from
   server/site-chrome.js. The Knowledge Repository and Grant Sharing apps
   load a copy of this file, made each time they are built
   (access/export-chrome.mjs), under their own stylesheets.

   Wrapped does not load this file. It keeps lrf-theme.css, the stylesheet
   this one replaced, so that nothing shifts under it.

   COLOUR. Name the role, never the colour: a page stylesheet writes
   var(--surface), not #fff, so that it works in both themes. The dark
   values are the night look of Wrapped and the respondent globe.

   The accent, Foundation fuchsia #e5006e, is for fills, icons and large
   type. Small pink text uses --accent-text, which passes 4.5:1 on every
   background in both themes.

   TYPE. Eight sizes, --t-1 to --t-8. Nothing under 12px.

   WIDTHS. Three switch points: 640px (phone), 900px (tablet), 1200px
   (wide). Panels that sit in a narrow column should use a container query
   on their own width instead.
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #fafaf7;            /* the page */
  --surface: #ffffff;       /* panels, cards, fields */
  --surface-2: #f4f1e8;     /* the cream band: strips, table heads, callouts */
  --surface-3: #ebe7db;     /* hover on cream */
  --surface-hover: #fcf7fa; /* a row or an option under the pointer */
  --scrim: rgba(10, 10, 20, 0.45);

  /* Text */
  --ink: #0a0a14;
  --ink-2: #2a2a35;
  --muted: #6c6c78;
  --on-ink: #ffffff;        /* text on an ink fill (a pressed switch) */

  /* Lines */
  --line: #e4e4ea;          /* dividers, panel edges */
  --edge: #0a0a14;          /* the border of a field or a button */

  /* Accent */
  --accent: #e5006e;
  --accent-strong: #b00055; /* hover on an accent fill */
  --accent-text: #bc005b;   /* small pink text and links */
  --accent-text-strong: #8f0045; /* a link under the pointer */
  --accent-soft: #fce6f0;   /* focus glow, quiet highlight */
  --on-accent: #ffffff;

  /* State. Always with a word or an icon, never colour alone. */
  --good: #1d6b3a;
  --good-soft: #e2f0e6;
  --warn: #8a5a00;
  --warn-soft: #fbf0d4;
  --bad: #c1272d;
  --bad-soft: #fbe9e9;
  --bad-strong: #7a1418;    /* the text of an error notice */
  --disabled: #d4d4d4;
  /* Fills that stay the same in both themes, under white text. */
  --good-fill: #1d6b3a;
  --bad-fill: #c1272d;
  --bad-fill-strong: #9e1f24;

  /* Charts (chart-kit.js): the furniture of a figure. Data colours come
     from the kit's own set; these follow the theme without a redraw. */
  --ck-ink: #2a2a35;        /* labels, figures */
  --ck-muted: #6c6c78;      /* axis text, notes */
  --ck-grid: #e4e4ea;       /* grid lines */
  --ck-track: #f4f4f6;      /* the empty length of a bar */
  --ck-strong: #0d2240;     /* a baseline, a reference line, a plain mark */
  --ck-surface: #ffffff;    /* the gap between two marks */
  /* Data colours (chart-kit.js holds the same values, and a test keeps the
     two in step): eight categories in a fixed order, a quiet step of the
     first two, and the grey for "Not set" and the like. */
  --ck-c1: #e3076e; --ck-c2: #0779ca; --ck-c3: #e6740d; --ck-c4: #12a4ae;
  --ck-c5: #c0173e; --ck-c6: #83a000; --ck-c7: #7a50de; --ck-c8: #01785c;
  --ck-c1-soft: #f5a6c5; --ck-c2-soft: #9cc9ea; --ck-grey: #8e8e99;

  /* Elevation: for things that float (menus, tooltips, dialogs) only */
  --shadow-sm: 0 1px 2px rgba(10, 10, 20, 0.05);
  --shadow-md: 0 6px 24px rgba(10, 10, 20, 0.10);
  --shadow-lg: 0 12px 40px rgba(10, 10, 20, 0.18);

  /* Type: eight sizes */
  --t-1: 12px;                          /* labels, captions */
  --t-2: 13px;                          /* secondary text, dense tables */
  --t-3: 14px;                          /* controls, table text */
  --t-4: 16px;                          /* reading text, fields */
  --t-5: 19px;                          /* the lede */
  --t-6: 1.5rem;                        /* section heading */
  --t-7: 2rem;                          /* page title on a tool page */
  --t-8: clamp(2.5rem, 5vw, 4.5rem);    /* page title on a landing page */
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;

  /* Space: one scale of eight steps */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;

  /* Geometry */
  --r: 4px;
  --control-h: 44px;
  --control-h-sm: 36px;
  --tap: 24px;
  --max-w: 1400px;
  --read-w: 44rem;          /* a reading column */
  --pad: 2rem;              /* the page's side padding; 1.25rem on a phone */
  --gutter: max(var(--pad), calc((100% - var(--max-w)) / 2));
  --header-h: 64px;

  /* Movement: three speeds */
  --fast: 0.12s;
  --medium: 0.2s;
  --slow: 0.4s;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* The names the pages' own stylesheets were written with. */
  --lrf-pink: var(--accent);
  --lrf-pink-dark: var(--accent-strong);
  --lrf-pink-light: var(--accent-soft);
  --lrf-pink-text: var(--accent-text);
  --lrf-ink: var(--ink);
  --lrf-ink-soft: var(--ink-2);
  --lrf-muted: var(--muted);
  --lrf-line: var(--line);
  --lrf-bg: var(--bg);
  --lrf-cream: var(--surface-2);
  --lrf-white: var(--surface);
  --resolved: var(--good);
  --resolved-soft: var(--good-soft);
  --danger: var(--bad);
}

/* Dark values, for browsers that understand light-dark(). Others stay light.
   The theme follows the device unless the person chooses one in the header
   (site-theme.js sets data-theme on <html>). */
@supports (color: light-dark(#000, #fff)) {
  :root { color-scheme: light dark; }
  :root[data-theme=light] { color-scheme: light; }
  :root[data-theme=dark] { color-scheme: dark; }
  :root {
    --bg: light-dark(#fafaf7, #0c0f1d);
    --surface: light-dark(#ffffff, #151a2b);
    --surface-2: light-dark(#f4f1e8, #1c2236);
    --surface-3: light-dark(#ebe7db, #252c44);
    --surface-hover: light-dark(#fcf7fa, #1d2338);
    --scrim: light-dark(rgba(10, 10, 20, 0.45), rgba(0, 0, 0, 0.6));
    --ink: light-dark(#0a0a14, #f4f1e8);
    --ink-2: light-dark(#2a2a35, #d9d8de);
    --muted: light-dark(#6c6c78, #a4a8ba);
    --on-ink: light-dark(#ffffff, #0c0f1d);
    --line: light-dark(#e4e4ea, #2a3048);
    --edge: light-dark(#0a0a14, #8f94ab);
    --accent-text: light-dark(#bc005b, #ff6fb1);
    --accent-text-strong: light-dark(#8f0045, #ffa3cd);
    --accent-soft: light-dark(#fce6f0, #3b1230);
    --good: light-dark(#1d6b3a, #6fd39a);
    --good-soft: light-dark(#e2f0e6, #12301f);
    --warn: light-dark(#8a5a00, #f0c05a);
    --warn-soft: light-dark(#fbf0d4, #33280c);
    --bad: light-dark(#c1272d, #ff8a8a);
    --bad-soft: light-dark(#fbe9e9, #3a1517);
    --bad-strong: light-dark(#7a1418, #ffb3b3);
    --disabled: light-dark(#d4d4d4, #3a4057);
    --ck-ink: light-dark(#2a2a35, #e6e3da);
    --ck-muted: light-dark(#6c6c78, #a4a8ba);
    --ck-grid: light-dark(#e4e4ea, #2a3048);
    --ck-track: light-dark(#f4f4f6, #1c2236);
    --ck-strong: light-dark(#0d2240, #c9d3ea);
    --ck-surface: light-dark(#ffffff, #151a2b);
    --ck-c1: light-dark(#e3076e, #ea1973); --ck-c2: light-dark(#0779ca, #107ed0);
    --ck-c3: light-dark(#e6740d, #de6f08); --ck-c4: light-dark(#12a4ae, #16a5b0);
    --ck-c5: light-dark(#c0173e, #c51f42); --ck-c6: light-dark(#83a000, #83a000);
    --ck-c7: light-dark(#7a50de, #875fee); --ck-c8: light-dark(#01785c, #23896c);
    --ck-c1-soft: light-dark(#f5a6c5, #8f0243); --ck-c2-soft: light-dark(#9cc9ea, #14507f);
    --ck-grey: light-dark(#8e8e99, #7a8098);
    --shadow-sm: 0 1px 2px light-dark(rgba(10, 10, 20, 0.05), rgba(0, 0, 0, 0.4));
    --shadow-md: 0 6px 24px light-dark(rgba(10, 10, 20, 0.10), rgba(0, 0, 0, 0.5));
    --shadow-lg: 0 12px 40px light-dark(rgba(10, 10, 20, 0.18), rgba(0, 0, 0, 0.6));
  }
}

@media (max-width: 900px) {
  :root { --pad: 1.25rem; --header-h: 56px; }
}

/* ---------- 2. Base ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--sh-h, var(--header-h)) + var(--dock-h, 0px) + 1rem); }
body { font-size: var(--t-4); }

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-text-strong); }
@supports (color: light-dark(#000, #fff)) {
  a:hover { color: light-dark(#b00055, #ff9dca); }
}
/* Links in running text are underlined, so colour is not the only cue.
   Links styled as buttons or cards set their own look. */
p a:not(.btn), li a:not(.btn), td a:not(.btn), dd a:not(.btn), .sub a, .hint a, .notice a, .footer-inner a {
  text-decoration: underline; text-underline-offset: 2px;
}

/* Keyboard focus: a clear ring on anything you can tab to. Text fields keep
   their own border-and-glow focus style (form fields, below). */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible,
[role=button]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent-text); outline-offset: 2px;
}

/* Read by screen readers, not shown on screen. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* First thing a keyboard user tabs to: jumps past the header to <main id="main">. */
.skip-link {
  position: absolute; left: 1rem; top: -200px; z-index: 200;
  padding: 0.6rem 1rem; background: var(--ink); color: var(--on-ink);
  font-weight: 700; font-size: var(--t-3); border-radius: var(--r); text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--on-ink); outline-color: var(--accent); }

/* Figures that line up in a column. */
.num, td.num, th.num { font-variant-numeric: tabular-nums; }

/* Anyone who has asked their system for less motion gets none of ours. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- 3. Site header ----------
   One header on every page (server/site-chrome.js writes it from
   access/site-nav.json and access/staff-pages.json). The menus are <details>
   elements, so they open without any script; site.js adds closing on Escape
   and on a click elsewhere, the phone sheet, the search box and the theme
   choice. */

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  view-transition-name: site-header;
}
.sh-bar {
  display: flex; align-items: center; gap: 0.5rem 1rem;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
}
.sh-brand {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--ink); text-decoration: none; min-width: 0; margin-right: auto;
  padding: 0.5rem 0;
}
.sh-brand:hover { color: var(--ink); }
.sh-logo { height: 40px; width: auto; display: block; flex-shrink: 0; }
.sh-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sh-name { font-weight: 800; font-size: var(--t-3); letter-spacing: -0.01em; white-space: nowrap; }
.sh-unit { font-size: var(--t-1); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.site-header [hidden] { display: none !important; }
.sh-nav { display: flex; align-items: center; }
.sh-list { list-style: none; display: flex; align-items: center; gap: 0.125rem; }
.sh-list > li { position: static; }
/* Links in the header and footer are not underlined (the rule for links in
   running text would underline them). */
.site-header li a, .site-header .sh-tools a, .sf-col li a { text-decoration: none; }
/* Written twice, shown once: .sh-wide in the bar on a wide screen, .sh-narrow
   and the sheet's own parts in the phone's sheet. */
.sh-narrow, .sh-nav .sh-find-sheet, .sh-sheet-foot { display: none; }

/* A top-level entry: a menu's summary, or a plain link. */
.sh-menu > summary, .sh-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: var(--control-h); padding: 0 0.75rem;
  font-size: var(--t-3); font-weight: 700; color: var(--ink);
  border-radius: var(--r); cursor: pointer; white-space: nowrap;
  text-decoration: none; list-style: none; user-select: none;
}
.sh-menu > summary::-webkit-details-marker { display: none; }
.sh-menu > summary:hover, .sh-link:hover, .sh-menu[open] > summary { background: var(--surface-2); color: var(--ink); }
.sh-chev { width: 12px; height: 12px; flex-shrink: 0; transition: transform var(--fast) var(--ease); }
.sh-menu[open] > summary .sh-chev { transform: rotate(180deg); }
/* The entry for the part of the site you are in. */
.sh-here { box-shadow: inset 0 -3px 0 var(--accent); border-radius: var(--r) var(--r) 0 0; }

.sh-signin { border: 1.5px solid var(--edge); padding: 0 0.9rem; min-height: var(--control-h-sm); }
.sh-signin svg { width: 14px; height: 14px; }
.sh-wide .sh-signin:hover { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* A menu's panel drops from the bar, its right edge on the content column's.
   The small panels (theme, account) hang from their own button. */
.sh-bar { position: relative; }
.sh-tools .sh-menu { position: relative; }
.sh-nav .sh-panel { right: var(--gutter); top: calc(100% - 4px); }
.sh-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 70;
  width: max-content; max-width: min(46rem, calc(100vw - 2 * var(--pad)));
  padding: 1rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.sh-panel-about {
  font-size: var(--t-1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 0 0.5rem 0.6rem;
}
.sh-items { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(15rem, 1fr)); gap: 0.25rem; }
.sh-items a {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 0.1rem 0.75rem;
  padding: 0.6rem 0.5rem; border-radius: var(--r); color: var(--ink); text-decoration: none;
}
.sh-items a:hover, .sh-items a[aria-current=page] { background: var(--surface-2); color: var(--ink); }
.sh-icon {
  grid-row: span 2; width: 36px; height: 36px; border-radius: var(--r);
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text);
}
.sh-icon svg { width: 18px; height: 18px; }
.sh-item-label { font-size: var(--t-3); font-weight: 700; line-height: 1.3; }
.sh-item-about { font-size: var(--t-2); color: var(--muted); line-height: 1.35; grid-column: 2; }
.sh-gate {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-left: 0.4rem;
  font-size: var(--t-1); font-weight: 600; color: var(--muted); white-space: nowrap; vertical-align: 1px;
}
.sh-gate svg { width: 11px; height: 11px; }

/* The Staff menu: its pages in groups, side by side. */
.sh-groups { display: flex; gap: 1.5rem; }
.sh-group { min-width: 11rem; }
.sh-group-title {
  font-size: var(--t-1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 0 0.5rem 0.4rem;
}
.sh-group ul { list-style: none; }
.sh-group a {
  display: flex; align-items: center; min-height: var(--control-h-sm); padding: 0.25rem 0.5rem;
  font-size: var(--t-3); font-weight: 600; color: var(--ink); border-radius: var(--r); text-decoration: none;
}
.sh-group a:hover, .sh-group a[aria-current=page] { background: var(--surface-2); color: var(--ink); }
.sh-group a[aria-current=page] { font-weight: 800; }
.sh-panel-foot { margin-top: 0.75rem; padding: 0.75rem 0.5rem 0; border-top: 1px solid var(--line); font-size: var(--t-2); }
.sh-panel-foot a { font-weight: 700; text-decoration: none; }

/* Search, theme and account, at the right of the bar. */
.sh-tools { display: flex; align-items: center; gap: 0.5rem; }
.sh-find {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: var(--control-h-sm); min-width: 15rem; padding: 0 0.6rem 0 0.75rem;
  font: inherit; font-size: var(--t-3); font-weight: 500; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
}
.sh-find:hover { border-color: var(--edge); color: var(--ink); }
.sh-find svg { width: 15px; height: 15px; flex-shrink: 0; }
.sh-find span { flex: 1; text-align: left; }
.sh-find kbd, .finder kbd {
  font: inherit; font-size: var(--t-1); font-weight: 700; line-height: 1; color: var(--muted);
  padding: 0.2rem 0.4rem; border: 1px solid var(--line); border-radius: 3px; background: var(--surface);
}
.sh-icon-btn > summary { padding: 0; width: var(--control-h-sm); min-height: var(--control-h-sm); justify-content: center; border: 1px solid var(--line); }
.sh-icon-btn > summary svg { width: 16px; height: 16px; }
.sh-account > summary { padding: 0 0.5rem 0 0.3rem; min-height: var(--control-h-sm); border: 1.5px solid var(--edge); gap: 0.3rem; }
.sh-initials {
  display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 0.2rem; border-radius: 3px;
  background: var(--ink); color: var(--on-ink); font-size: var(--t-1); font-weight: 800; letter-spacing: 0.02em;
}
.sh-panel-small { width: 19rem; max-width: calc(100vw - 2 * var(--pad)); }
.sh-panel-small p { font-size: var(--t-3); line-height: 1.45; }
.sh-panel-small strong { overflow-wrap: anywhere; }
.sh-panel-small .sh-note { font-size: var(--t-2); color: var(--muted); margin: 0.5rem 0 0.9rem; }
.sh-choices { display: grid; gap: 0.25rem; }
.sh-choices button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  min-height: var(--control-h-sm); padding: 0.25rem 0.6rem;
  font: inherit; font-size: var(--t-3); font-weight: 600; color: var(--ink); text-align: left;
  background: none; border: 0; border-radius: var(--r); cursor: pointer;
}
.sh-choices button:hover { background: var(--surface-2); }
.sh-choices button[aria-pressed=true] { background: var(--ink); color: var(--on-ink); }
.sh-choices svg { width: 16px; height: 16px; flex-shrink: 0; }

/* The phone's Menu button. site.js shows it; without script the menus sit
   under the brand instead. */
.sh-burger {
  display: none; align-items: center; gap: 0.5rem;
  min-height: var(--control-h-sm); padding: 0 0.75rem;
  font: inherit; font-size: var(--t-3); font-weight: 700; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--edge); border-radius: var(--r); cursor: pointer;
}
.sh-burger svg { width: 16px; height: 16px; }
.sh-burger .sh-burger-close, .sh-open .sh-burger .sh-burger-open { display: none; }
.sh-open .sh-burger .sh-burger-close { display: inline; }
/* While the sheet is open the page behind does not scroll. */
.sh-lock, .sh-lock body { overflow: hidden; }

/* The strip: the other pages in the group you are in. */
.sh-strip {
  display: flex; align-items: center; gap: 0 0.5rem;
  background: var(--surface-2); border-top: 1px solid var(--line);
  padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: thin;
}
.sh-strip-label {
  font-size: var(--t-1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); white-space: nowrap; margin-right: 0.5rem;
}
.sh-strip ul { list-style: none; display: flex; gap: 0 0.25rem; }
.sh-strip a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 0.75rem;
  font-size: var(--t-2); font-weight: 600; color: var(--ink); text-decoration: none;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.sh-strip a:hover { color: var(--accent-text); }
.sh-strip a[aria-current=page] { border-bottom-color: var(--accent); font-weight: 800; }
.sh-strip a:focus-visible { outline-offset: -3px; }

/* The trail: where you are, when a page sits two or more levels down. On a
   phone it shortens to the page above, with an arrow back. A page that has
   progress to show (a course) puts it at the trail's far end: words, and a
   mark for each part, filled once done, the open one taller. */
.trail { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1.5rem; padding: 0.75rem var(--gutter) 0; font-size: var(--t-2); }
.trail ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.5rem; min-width: 0; }
.trail li { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); min-height: var(--tap); }
.trail li + li::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: rotate(45deg); }
.trail a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.trail [aria-current=page] { color: var(--ink); font-weight: 700; }
.trail .trail-progress { display: inline-flex; align-items: center; gap: 0.6rem; min-height: var(--tap); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.trail-marks { display: inline-flex; align-items: center; gap: 3px; }
.trail-marks i { width: 10px; height: 4px; border-radius: 1px; background: color-mix(in srgb, var(--muted) 40%, transparent); }
.trail-marks i.is-done { background: var(--accent); }
.trail-marks i.is-here { height: 10px; background: var(--ink); }
.trail-marks i.is-here.is-done { background: var(--accent); }
@media (max-width: 640px) {
  .trail li { display: none; }
  .trail li:nth-last-child(2) { display: inline-flex; }
  .trail li:nth-last-child(2)::before { content: ''; width: 6px; height: 6px; border: 0; border-left: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); margin-left: 2px; }
  .trail li:nth-last-child(2) a { text-decoration: none; font-weight: 700; color: var(--ink); }
  .trail-marks { display: none; }
}

@media (max-width: 1200px) {
  .sh-tools .sh-find { min-width: 0; width: var(--control-h-sm); padding: 0; justify-content: center; }
  .sh-tools .sh-find span, .sh-tools .sh-find kbd { display: none; }
}

@media (max-width: 900px) {
  .sh-logo { height: 34px; }
  .sh-unit { display: none; }
  .sh-bar { flex-wrap: wrap; }
  .sh-wide { display: none; }
  .sh-narrow { display: list-item; }
  .sh-sheet-foot { display: block; }
  /* Without script: the menus wrap under the brand, each opening in place. */
  .sh-nav { order: 5; flex-basis: 100%; flex-wrap: wrap; }
  .sh-list { flex-wrap: wrap; padding-bottom: 0.5rem; }
  .sh-panel { position: fixed; left: var(--pad); right: var(--pad); top: auto; width: auto; max-width: none; }
  .sh-items { grid-template-columns: minmax(0, 1fr); }
  .sh-groups { flex-direction: column; gap: 1rem; }
  .sh-sheet-foot { flex-basis: 100%; }
  .sh-sheet-account { padding: 0.75rem 0; border-top: 1px solid var(--line); font-size: var(--t-3); }
  .sh-sheet-account .sh-note { font-size: var(--t-2); color: var(--muted); margin: 0.35rem 0 0.75rem; }
  .sh-sheet-account strong { overflow-wrap: anywhere; }

  /* With script: a Menu button, and the menus as one sheet under the bar. */
  .sh-js .sh-burger { display: inline-flex; }
  .sh-js .sh-nav { display: none; }
  .sh-js.sh-open { position: fixed; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
  .sh-js.sh-open .sh-strip { display: none; }
  .sh-js.sh-open .sh-nav { display: block; padding: 0.75rem 0 1.5rem; }
  .sh-js .sh-nav .sh-find-sheet {
    display: flex; width: 100%; min-height: var(--control-h); margin-bottom: 0.75rem;
    background: var(--surface); border: 1.5px solid var(--edge); font-size: var(--t-4);
  }
  .sh-js .sh-list { display: block; padding: 0; }
  .sh-js .sh-list > li { border-top: 1px solid var(--line); }
  .sh-js .sh-list > li:last-child { border-bottom: 1px solid var(--line); }
  .sh-js .sh-nav .sh-menu > summary, .sh-js .sh-nav .sh-link {
    display: flex; justify-content: space-between; width: 100%;
    min-height: 56px; padding: 0 0.25rem; font-size: 1.125rem; font-weight: 800; border-radius: 0;
  }
  .sh-js .sh-nav .sh-menu > summary:hover, .sh-js .sh-nav .sh-link:hover, .sh-js .sh-nav .sh-menu[open] > summary { background: none; }
  .sh-js .sh-nav .sh-here { box-shadow: none; }
  .sh-js .sh-nav .sh-chev { width: 16px; height: 16px; }
  .sh-js .sh-nav .sh-signin { border: 0; margin: 0; justify-content: flex-start; gap: 0.6rem; }
  .sh-js .sh-nav .sh-panel { position: static; border: 0; box-shadow: none; padding: 0 0 1rem; background: none; }
  .sh-js .sh-panel-about, .sh-js .sh-nav .sh-group-title { padding-left: 0.25rem; }
  .sh-js .sh-items a, .sh-js .sh-group a { padding-left: 0.25rem; min-height: var(--control-h); }
  .sh-js .sh-sheet-theme { padding: 1rem 0 0.5rem; }
  .sh-js .sh-sheet-account { border-top: 0; padding: 1rem 0.25rem 0; }
  .sh-choices-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1.5px solid var(--edge); border-radius: var(--r); overflow: hidden; }
  .sh-choices-row button { justify-content: center; min-height: var(--control-h); border-radius: 0; border-right: 1px solid var(--line); padding: 0.25rem 0.4rem; font-size: var(--t-2); }
  .sh-choices-row button:last-child { border-right: 0; }
}

@media (max-width: 640px) {
  .sh-name { white-space: normal; font-size: var(--t-2); max-width: 9.5rem; }
  .sh-tools { gap: 0.35rem; }
}

/* ---------- 4. Footer ---------- */

.site-footer {
  margin-top: var(--s-7);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: var(--s-6) var(--gutter) var(--s-6);
  font-size: var(--t-2); color: var(--muted); line-height: 1.55;
}
.sf-note { max-width: 62rem; }
.sf-note a, .sf-base a { text-decoration: underline; text-underline-offset: 2px; }
.sf-note + .sf-cols { margin-top: var(--s-5); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.sf-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5) var(--s-6); }
.sf-col h2 {
  font-size: var(--t-1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink); margin-bottom: 0.5rem;
}
.sf-col ul { list-style: none; }
.sf-col a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0.15rem 0;
  color: var(--ink-2); font-weight: 500; text-decoration: none;
}
.sf-col a:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.sf-col-note { font-size: var(--t-1); max-width: 18rem; margin-top: 0.15rem; }
.sf-base {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem;
  margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line);
}
.sf-base a { font-weight: 600; }
@media (max-width: 900px) { .sf-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .site-footer { margin-top: var(--s-6); } }

/* The old footer, on pages built before this file. */
footer:not(.site-footer) { border-top: 1px solid var(--line); background: var(--surface); padding: 2rem var(--pad); margin-top: 2rem; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; font-size: var(--t-2); color: var(--muted); line-height: 1.55; }

/* ---------- 5. Finder ----------
   The search box "/" opens: every tool and page, and the World Risk Poll's
   questions. A <dialog>, so focus is held inside it and Escape closes it. */

.finder {
  width: min(40rem, calc(100vw - 2rem)); max-height: min(34rem, calc(100vh - 6rem));
  margin: 4.5rem auto auto; padding: 0; overflow: hidden;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.finder[open] { display: flex; flex-direction: column; }
.finder::backdrop { background: var(--scrim); }
.finder-top { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; border-bottom: 1px solid var(--line); }
.finder-top svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; margin-left: 0.25rem; }
.finder-top input {
  flex: 1; min-height: var(--control-h); border: 0; background: none; padding: 0 0.25rem; font-size: var(--t-4);
}
.finder-top input:focus { outline: none; border: 0; box-shadow: none; }
.finder-close {
  font: inherit; font-size: var(--t-2); font-weight: 700; color: var(--ink);
  min-height: var(--control-h-sm); padding: 0 0.7rem; background: none; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
}
.finder-close:hover { border-color: var(--edge); }
.finder-list { list-style: none; overflow-y: auto; padding: 0.5rem; flex: 1; }
.finder-group {
  font-size: var(--t-1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 0.6rem 0.5rem 0.3rem;
}
.finder-list a {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem; border-radius: var(--r);
  color: var(--ink); text-decoration: none; min-height: var(--control-h); justify-content: center;
}
.finder-list a:hover, .finder-list a[aria-selected=true] { background: var(--surface-2); color: var(--ink); }
.finder-list a[aria-selected=true] { box-shadow: inset 3px 0 0 var(--accent); }
.finder-label { font-size: var(--t-3); font-weight: 700; line-height: 1.35; }
.finder-about { font-size: var(--t-2); color: var(--muted); line-height: 1.35; }
.finder-list mark { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
.finder-empty { padding: 1.25rem 1rem; font-size: var(--t-3); color: var(--muted); }
.finder-foot {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; padding: 0.6rem 1rem; border-top: 1px solid var(--line);
  font-size: var(--t-1); color: var(--muted);
}
@media (max-width: 640px) {
  .finder { margin-top: 0.75rem; max-height: calc(100vh - 1.5rem); }
  .finder-foot { display: none; }
}

/* ---------- 6. Page shapes ----------
   <main> is the landmark; .page is the centred column inside it. Its
   max-width includes the side padding, so its edge lines up with the header.

   Landing page  .hero                the big title, a serif lede, stat tiles
   Tool page     .hero.hero-tool      a one-line title, so the tool starts
                                      at the top of the screen
   Reading page  .page.page-read      one reading column; pictures and maps
                                      may run the full width with .full.
                                      main.read puts the trail and the title
                                      on the same column
   A page between a landing page and a tool (a guide, a staff page's front)
   takes .hero.hero-compact: the title and lede at a size that leaves the
   first screen to the page itself. */

.hero { padding: 3.5rem var(--pad) 2.5rem; }
.hero-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; align-items: end;
}
.eyebrow {
  font-size: var(--t-1); text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 700; color: var(--accent-text); margin-bottom: 0.6rem;
}
h1 {
  font-size: var(--t-8);
  font-weight: 800; line-height: 1.0; letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
h1 .accent, h1 .period { color: var(--accent); }
p.lede {
  font-family: var(--font-serif);
  font-size: var(--t-5); line-height: 1.55; color: var(--ink-2);
  margin-top: 1.5rem; max-width: 560px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.hero-note { font-size: var(--t-2); color: var(--muted); margin-top: 0.9rem; max-width: 560px; }
.hero-stats { display: flex; gap: 2rem; }
.stat { border-top: 1px solid var(--ink); padding-top: 0.75rem; flex: 1; }
.stat-num {
  font-size: 2.5rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.stat-lbl {
  font-size: var(--t-2); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-top: 0.4rem; font-weight: 500;
}

.hero-compact { padding-top: 2.5rem; padding-bottom: 1.5rem; }
.hero-compact .hero-inner { grid-template-columns: minmax(0, 1fr); }
.hero-compact h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); }
.trail + .hero-compact { padding-top: 1.5rem; }

/* Tool page: the title and one line about the tool, then the tool. */
.hero-tool { padding: 1.5rem var(--pad) 1rem; }
.hero-tool .hero-inner { display: block; }
.hero-tool .eyebrow { display: none; }
.hero-tool h1 { font-size: var(--t-7); line-height: 1.1; letter-spacing: -0.025em; }
.hero-tool p.lede {
  font-family: var(--font); font-size: var(--t-3); line-height: 1.5; color: var(--muted);
  margin-top: 0.35rem; max-width: 60rem;
}
.hero-tool .hero-stats { display: none; }

.page { max-width: calc(var(--max-w) + 2 * var(--pad)); margin: 0 auto; padding: 1rem var(--pad) 4rem; }

/* A studio (Chart, Map and Flow Studio): the controls beside the picture
   they make.
     wide    the picture stays in view while the controls scroll
     narrow  one column: the picture comes first and stays docked under the
             header, the export buttons dock at the foot of the screen, and
             the controls scroll between the two
   --sh-h is the header's height as site.js measures it (a staff page's
   header is taller by its strip). */
.workspace > .preview-panel { position: sticky; top: calc(var(--sh-h, var(--header-h)) + 1rem); }
@media (max-width: 1080px) {
  .workspace > .preview-panel { display: contents; }
  .workspace > .preview-panel > .preview-head {
    order: -3; padding: 0; border: 0; margin-bottom: -1rem;
  }
  .workspace > .preview-panel > .stage {
    order: -2; position: sticky; top: var(--sh-h, var(--header-h)); z-index: 5;
    min-height: 0; max-height: 42vh; padding: 0.75rem;
    border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-md);
  }
  .workspace > .preview-panel > .stage svg { max-height: calc(42vh - 1.5rem - 2px); width: auto; }
  .workspace > .preview-panel > .export-bar {
    order: 2; position: sticky; bottom: 0; z-index: 5;
    margin: 0 calc(-1 * var(--pad)); padding: 0.6rem var(--pad) calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(10, 10, 20, 0.08);
  }
}
/* A word a button drops on a phone to fit a row ("Download PNG" reads "PNG");
   a screen reader still hears the whole name. */
@media (max-width: 640px) {
  .btn-long { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
}
/* ---------- Charts (chart-kit.js) ---------- */
/* The one tooltip: a mouse, a tap or the arrow keys show it beside a mark. */
.ck-tip {
  position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; max-width: 280px;
  padding: 7px 10px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  font-size: var(--t-1); line-height: 1.4; opacity: 0; transition: opacity 0.08s;
}
.ck-tip b { font-weight: 700; }
.ck-tip .m { color: var(--muted); margin-top: 2px; }
/* A chart read with the arrow keys: the mark the keyboard is on. */
[data-ck-keys]:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 3px; }
.ck-at { stroke: var(--ck-strong); stroke-width: 2px; paint-order: stroke; outline: 2px solid var(--ck-strong); outline-offset: 1px; }
svg .ck-at { outline: none; }

.page-read { max-width: calc(var(--read-w) + 2 * var(--pad)); }
/* A reading page's trail and title sit on its column, not out at the page's edge. */
main.read > .trail { padding-left: max(var(--pad), calc((100% - var(--read-w)) / 2)); padding-right: max(var(--pad), calc((100% - var(--read-w)) / 2)); }
main.read > .hero .hero-inner { max-width: var(--read-w); }
.page-read .full { width: 100vw; max-width: var(--max-w); margin-left: 50%; transform: translateX(-50%); }
.prose { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.65; color: var(--ink-2); }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { font-family: var(--font); color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; margin-top: 1.75em; }
.prose h2 { font-size: var(--t-6); font-weight: 800; }
.prose h3 { font-size: 1.125rem; font-weight: 800; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }

.stage-head { margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 2px solid var(--ink); }
.stage-head h2 { font-size: var(--t-7); font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; overflow-wrap: anywhere; }
.stage-head .sub { margin-top: 0.4rem; font-size: var(--t-3); color: var(--muted); }

@media (max-width: 900px) {
  .hero { padding-top: 2.5rem; padding-bottom: 2rem; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .hero-tool { padding-top: 1.25rem; padding-bottom: 0.75rem; }
  .page { padding-bottom: 3rem; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 2.5rem; }
  .hero-tool h1 { font-size: 1.625rem; }
  .hero p.lede { font-size: var(--t-4); }
  .hero-tool p.lede { font-size: var(--t-3); }
  .hero-stats { gap: 1rem; flex-wrap: wrap; }
  .stat-num { font-size: 2rem; }
}

/* ---------- 7. Controls ---------- */

/* Buttons. .btn is 44px tall, the same as a field, so a button beside a
   filter lines up with it. .btn-small is 36px, for a row of text. */
.btn {
  font-family: inherit; font-weight: 700; font-size: 15px; line-height: 1.2;
  min-height: var(--control-h); padding: 0.5rem 1.25rem; border-radius: var(--r);
  border: 1.5px solid var(--edge); cursor: pointer;
  /* Only the colours animate: the focus ring must appear at once. */
  transition: background-color var(--fast), color var(--fast), border-color var(--fast);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; white-space: nowrap;
  background: var(--surface); color: var(--ink);
}
.btn:hover:not(:disabled):not([aria-disabled=true]) { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-secondary { background: var(--surface); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--ink); color: var(--on-ink); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled):not([aria-disabled=true]) { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn:disabled, .btn[aria-disabled=true] { background: var(--disabled); border-color: var(--disabled); color: var(--surface); cursor: not-allowed; }
.btn-small { font-size: var(--t-2); min-height: var(--control-h-sm); padding: 0.3rem 0.8rem; }
/* Pressed state for toggle buttons (aria-pressed), the same on every page. */
.btn[aria-pressed=true] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
@media (max-width: 640px) { .btn { padding-left: 1rem; padding-right: 1rem; } }

/* A button that reads as a link, inside running text. Still a 24px target. */
.link-btn {
  background: none; border: none; color: var(--accent-text); cursor: pointer;
  font: inherit; font-size: var(--t-2); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
  padding: 0; display: inline-flex; align-items: center; min-height: var(--tap);
}
.link-btn:hover { color: var(--accent-text-strong); }
.link-btn:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
/* (display above outranks the browser's own rule for the hidden attribute,
   so a link button a page hides, such as the Explorer's Clear filters while
   no filter is on, stayed on show without this) */
.link-btn[hidden] { display: none; }

/* The switch (segmented control): how the same thing is shown. One of its
   buttons is pressed (aria-pressed). To move between the sections of a page
   use .tabs; to choose data use a select. */
.seg { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--edge); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg > button, .seg > a {
  font: inherit; font-size: var(--t-3); font-weight: 600; line-height: 1.2; color: var(--ink);
  min-height: calc(var(--control-h) - 3px); padding: 0.4rem 0.95rem; border: 0; border-right: 1px solid var(--line);
  background: none; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; text-decoration: none;
}
.seg > :last-child { border-right: 0; }
.seg > button:hover, .seg > a:hover { background: var(--surface-2); color: var(--ink); }
.seg > [aria-pressed=true], .seg > [aria-current],
.seg > [aria-pressed=true]:hover, .seg > [aria-current]:hover { background: var(--ink); color: var(--on-ink); }
.seg > button:focus-visible, .seg > a:focus-visible { outline-offset: -3px; }
.seg-small > button, .seg-small > a { font-size: var(--t-2); min-height: calc(var(--control-h-sm) - 3px); padding: 0.25rem 0.7rem; }

/* Tabs: the sections of one page. A row that stays under the header as the
   page scrolls and slides sideways on a phone. Each tab is a link or a
   button with aria-selected (role=tab) or aria-current. */
.tabs {
  position: sticky; top: var(--sh-h, var(--header-h)); z-index: 30;
  display: flex; gap: 0 0.25rem; overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 0 var(--gutter);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs > a, .tabs > button {
  font: inherit; font-size: var(--t-3); font-weight: 700; color: var(--muted);
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 48px; padding: 0 0.9rem;
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
  white-space: nowrap; text-decoration: none; flex-shrink: 0;
}
.tabs > a:hover, .tabs > button:hover { color: var(--ink); }
.tabs > [aria-selected=true], .tabs > [aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs > a:focus-visible, .tabs > button:focus-visible { outline-offset: -3px; }
.tabs svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Inside a panel instead of across the page. */
.tabs-inline { position: static; padding: 0; background: none; }

/* A chip: one choice made, with a way to take it off. */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 28px; padding: 0 0.3rem 0 0.6rem;
  font-size: var(--t-2); font-weight: 600; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.chip button {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: var(--t-4); line-height: 1;
}
.chip button:hover { background: var(--ink); color: var(--on-ink); }

/* Form fields. Every text-like field, textarea and select: 16px type (so
   phones do not zoom in on focus), 44px tall. Checkboxes, radios, ranges
   and file pickers keep the browser's control and the shared focus ring. */
input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color], [type=submit], [type=button], [type=reset], [type=image], [type=hidden]),
textarea, select {
  width: 100%; font-family: inherit; font-weight: 500; font-size: var(--t-4); line-height: 1.3;
  min-height: var(--control-h); padding: 0.5rem 1rem;
  background: var(--surface); border: 1.5px solid var(--edge);
  border-radius: var(--r); color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
select {
  padding-right: 2.5rem; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230a0a14' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f4f1e8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  }
}
:root[data-theme=dark] select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f4f1e8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
select[multiple], select[size] { background-image: none !important; padding-right: 1rem; min-height: 0; }
input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color]):focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:disabled, textarea:disabled, select:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
input[type=range] { accent-color: var(--accent); width: 100%; cursor: pointer; }
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); border-width: 2px; }
label { cursor: pointer; }

/* A label above its control; a row of these makes a filter bar. */
.field-label {
  display: block; font-size: var(--t-1); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.35rem;
}

/* ---------- 8. Pieces ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-5); }

/* A notice: a line that tells you something happened or needs doing. */
.note-line {
  border-left: 3px solid var(--ink); background: var(--surface); padding: 0.6rem 0.9rem;
  font-size: var(--t-2); color: var(--ink-2);
}
.note-line a { font-weight: 700; }

/* A table that can scroll sideways inside its own box on a narrow screen,
   never the page. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 9. Modes ---------- */

/* Page to page: the header holds still and the page cross-fades, in
   browsers that support it. Nothing moves for people who ask for less
   motion. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
  ::view-transition-group(site-header) { animation-duration: 0s; }
}

/* Print: the page's content, without the site's furniture. */
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #111; --muted: #444; --line: #bbb; --edge: #000; }
  html, body { background: #fff; }
  .site-header, .site-footer, .skip-link, .sh-strip, .tabs, .no-print { display: none !important; }
  .trail { padding-left: 0; padding-right: 0; }
  .hero, .hero-tool, .page { padding-left: 0; padding-right: 0; }
  a { color: inherit; text-decoration: underline; }
  .panel { break-inside: avoid; }
}

/* Windows high contrast and similar: keep edges and states visible when the
   system replaces our colours. */
@media (forced-colors: active) {
  .site-header, .sh-panel, .finder, .panel, .btn, .seg, .chip { border: 1px solid CanvasText; }
  .sh-here, .sh-strip a[aria-current=page], .tabs > [aria-selected=true], .tabs > [aria-current] { border-bottom: 3px solid Highlight; box-shadow: none; }
  .seg > [aria-pressed=true], .seg > [aria-current], .btn[aria-pressed=true], .sh-choices button[aria-pressed=true] {
    background: Highlight; color: HighlightText; forced-color-adjust: none;
  }
  .finder-list a[aria-selected=true] { outline: 2px solid Highlight; outline-offset: -2px; }
}
