/* Orbitarium: the foundation stylesheet. A night-sky almanac: warm paper by day, deep navy
   by night, figures in neat columns.

   This file holds what every page shares: the fonts, the colour tokens and both themes, the type,
   space and motion scales, element defaults, the shell (header, navigation, search, footer, toasts,
   skip link) and the shared components (css classes, most with a builder in js/ui.js). Each page's
   own styles are in css/pages/: a page links only the sheets it needs (js/page-styles.js
   PAGE_STYLES), after this file and always in one order (STYLE_ORDER), whether the server wrote
   them into the page or the router added them on the way to it.

   Themes. Every colour is a token. Its two values are written once each, as --day-* and --night-*
   (section 2), and the token itself picks one with light-dark() (section 3), following the
   element's color-scheme: <html> has `light dark` (match my device), or `light` / `dark` when
   data-theme="day" / "night" is set (js/theme-boot.js sets it before the first paint; js/theme.js
   owns the control). Anything inside a .night-scope (the Live map, the Sky chart) is Night in
   either theme. A browser without light-dark() gets Day throughout. Canvas code reads tokens through
   cssVar() in js/util.js, which resolves them, and redraws on the `themechange` event.
   test/theme-contrast.test.js checks every pair below against WCAG 2.2: run it after changing one. */

/* ---- 1. Fonts ------------------------------------------------------------------------------ */
/* Self-hosted, SIL Open Font Licence (public/fonts/OFL-*.txt). Three faces: Newsreader's display cut
   (optical size pinned at 48) for headings, big figures and clocks; Atkinson Hyperlegible Next for
   everything read; and Atkinson Hyperlegible Mono, one weight and basic Latin only, for small exact
   labels. The two text faces are split by script, so a page in English loads only the Latin files
   (the Latin Newsreader and Atkinson files are preloaded in index.html). The addresses are relative
   to this file, so they stay inside whatever path the stylesheet was served from. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-next-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-next-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-display-latin.woff2") format("woff2");
  font-weight: 300 600; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-display-latin-ext.woff2") format("woff2");
  font-weight: 300 600; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("../fonts/atkinson-mono-basic.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
/* While the fonts load (font-display: swap), system fonts stand in, sized and placed to match them
   so the text barely moves when they arrive: widths measured in Chromium against each font; the
   vertical metrics are the font's own divided by size-adjust. */
@font-face { font-family: "Atkinson fallback"; src: local("Arial"), local("ArialMT"), local("Liberation Sans"); font-weight: 200 549; size-adjust: 99%; ascent-override: 99.4%; descent-override: 31.9%; line-gap-override: 0%; }
@font-face { font-family: "Atkinson fallback"; src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"); font-weight: 550 800; size-adjust: 98%; ascent-override: 100.4%; descent-override: 32.2%; line-gap-override: 0%; }
@font-face { font-family: "Newsreader fallback"; src: local("Georgia"); font-weight: 300 549; size-adjust: 97%; ascent-override: 75.8%; descent-override: 27.3%; line-gap-override: 0%; }
@font-face { font-family: "Newsreader fallback"; src: local("Georgia Bold"), local("Georgia-Bold"); font-weight: 550 600; size-adjust: 88%; ascent-override: 83.5%; descent-override: 30.1%; line-gap-override: 0%; }
@font-face { font-family: "Atkinson Mono fallback"; src: local("Menlo"), local("Menlo-Regular"), local("DejaVu Sans Mono"), local("Courier New"); size-adjust: 105%; ascent-override: 93.7%; descent-override: 30.1%; line-gap-override: 0%; }

/* ---- 2. Palette: every colour value, written once ------------------------------------------ */
/* Use the tokens of section 3 (--ink, --surface…), never these. Contrast is checked by
   test/theme-contrast.test.js; the comments say what each is for. */
:root {
  /* Day: warm paper, night-navy ink. */
  --day-page: #f6f3ec;          /* the page behind everything */
  --day-surface: #fffdf8;       /* cards, panels, the header */
  --day-surface-2: #eee9df;     /* sunken: notes, hover, table headers, pressed */
  --day-raised: #ffffff;        /* above the page: menus, popovers, toasts, the answer card */
  --day-ink: #14192b;           /* text */
  --day-ink-2: #454b5e;         /* secondary text */
  --day-muted: #5a5f70;         /* quiet text: 4.5:1 or more on every surface */
  --day-hairline: #ded8ca;      /* dividers and card edges (decoration only) */
  --day-border: #cdc5b4;        /* the edge of buttons and chips */
  --day-field-border: #7a7566;  /* the edge of form fields and switches: 3:1 or more */
  --day-accent: #2456c7;        /* links, primary buttons, current item, focus */
  --day-accent-ink: #1f4fbf;    /* links and accent text */
  --day-on-accent: #ffffff;     /* text on --accent */
  --day-accent-soft: #e5ecfb;   /* a tint of the accent behind text: selected, current */
  --day-focus: #2456c7;         /* the focus ring */
  --day-gold: #a5690f;          /* starlight gold: only for what you can go out and see (shapes) */
  --day-gold-ink: #875610;      /* gold as text */
  --day-gold-soft: #f6ebd3;     /* a tint of gold behind text */
  --day-good: #0ca30c;          /* status colours: always with a word or a shape beside them */
  --day-warning: #fab219;
  --day-serious: #ec835a;
  --day-critical: #d03b3b;
  --day-critical-ink: #b3261e;  /* error text */
  --day-on-warning: #14192b;    /* text on --warning (the storm badge) */
  --day-on-critical: #ffffff;   /* text on --critical */
  --day-series-1: #2a78d6;      /* data colours: chart lines, map categories (3:1 or more) */
  --day-series-2: #d2561f;
  --day-series-3: #13895f;
  --day-series-other: #7c7a73;
  --day-map-ocean: #e8edf2;     /* the flat map where it follows the theme (a profile's mini-map) */
  --day-map-land: #d9d6ca;
  --day-map-border: #bdb8a8;
  --day-map-graticule: rgb(20 25 43 / 0.07);
  --day-map-night: rgb(20 30 60 / 0.16);
  --day-map-track: #14192b;
  --day-shadow: rgb(20 25 43 / 0.08);

  /* Night: deep navy, never black, with warm text. */
  --night-page: #0b1020;
  --night-surface: #131a2e;
  --night-surface-2: #1a2238;
  --night-raised: #1f2945;
  --night-ink: #eef0f6;
  --night-ink-2: #b9bfd0;
  --night-muted: #99a0b4;
  --night-hairline: #263050;
  --night-border: #33406a;
  --night-field-border: #76819f;
  --night-accent: #8ab0ff;
  --night-accent-ink: #9dbcff;
  --night-on-accent: #0b1020;
  --night-accent-soft: #22305a;
  --night-focus: #8ab0ff;
  --night-gold: #f2b84b;
  --night-gold-ink: #f2b84b;
  --night-gold-soft: #33291a;
  --night-good: #0ca30c;
  --night-warning: #fab219;
  --night-serious: #ec835a;
  --night-critical: #d03b3b;
  --night-critical-ink: #ff9a90;
  --night-on-warning: #14192b;
  --night-on-critical: #ffffff;
  --night-series-1: #5ea4f5;
  --night-series-2: #f5915a;
  --night-series-3: #3ad19a;
  --night-series-other: #aeaca5;
  --night-map-ocean: #0d1a2e;
  --night-map-land: #28324c;
  --night-map-border: #46557a;
  --night-map-graticule: rgb(255 255 255 / 0.06);
  --night-map-night: rgb(0 0 0 / 0.45);
  --night-map-track: #eef0f6;
  --night-shadow: rgb(0 0 0 / 0.45);
}

/* ---- 3. Colour tokens: what to use --------------------------------------------------------- */
/* Day for every browser first; then, where light-dark() is understood, the theme's pick. */
:root {
  --page: var(--day-page);
  --surface: var(--day-surface);
  --surface-2: var(--day-surface-2);
  --raised: var(--day-raised);
  --ink: var(--day-ink);
  --ink-2: var(--day-ink-2);
  --muted: var(--day-muted);
  --hairline: var(--day-hairline);
  --border: var(--day-border);
  --field-border: var(--day-field-border);
  --accent: var(--day-accent);
  --accent-ink: var(--day-accent-ink);
  --on-accent: var(--day-on-accent);
  --accent-soft: var(--day-accent-soft);
  --focus: var(--day-focus);
  --gold: var(--day-gold);
  --gold-ink: var(--day-gold-ink);
  --gold-soft: var(--day-gold-soft);
  --good: var(--day-good);
  --warning: var(--day-warning);
  --serious: var(--day-serious);
  --critical: var(--day-critical);
  --critical-ink: var(--day-critical-ink);
  --on-warning: var(--day-on-warning);
  --on-critical: var(--day-on-critical);
  --series-1: var(--day-series-1);
  --series-2: var(--day-series-2);
  --series-3: var(--day-series-3);
  --series-other: var(--day-series-other);
  --map-ocean: var(--day-map-ocean);
  --map-land: var(--day-map-land);
  --map-border: var(--day-map-border);
  --map-graticule: var(--day-map-graticule);
  --map-night: var(--day-map-night);
  --map-track: var(--day-map-track);
  --shadow-ink: var(--day-shadow);
}
@supports (color: light-dark(#000, #fff)) {
  :root {
    --page: light-dark(var(--day-page), var(--night-page));
    --surface: light-dark(var(--day-surface), var(--night-surface));
    --surface-2: light-dark(var(--day-surface-2), var(--night-surface-2));
    --raised: light-dark(var(--day-raised), var(--night-raised));
    --ink: light-dark(var(--day-ink), var(--night-ink));
    --ink-2: light-dark(var(--day-ink-2), var(--night-ink-2));
    --muted: light-dark(var(--day-muted), var(--night-muted));
    --hairline: light-dark(var(--day-hairline), var(--night-hairline));
    --border: light-dark(var(--day-border), var(--night-border));
    --field-border: light-dark(var(--day-field-border), var(--night-field-border));
    --accent: light-dark(var(--day-accent), var(--night-accent));
    --accent-ink: light-dark(var(--day-accent-ink), var(--night-accent-ink));
    --on-accent: light-dark(var(--day-on-accent), var(--night-on-accent));
    --accent-soft: light-dark(var(--day-accent-soft), var(--night-accent-soft));
    --focus: light-dark(var(--day-focus), var(--night-focus));
    --gold: light-dark(var(--day-gold), var(--night-gold));
    --gold-ink: light-dark(var(--day-gold-ink), var(--night-gold-ink));
    --gold-soft: light-dark(var(--day-gold-soft), var(--night-gold-soft));
    --good: light-dark(var(--day-good), var(--night-good));
    --warning: light-dark(var(--day-warning), var(--night-warning));
    --serious: light-dark(var(--day-serious), var(--night-serious));
    --critical: light-dark(var(--day-critical), var(--night-critical));
    --critical-ink: light-dark(var(--day-critical-ink), var(--night-critical-ink));
    --on-warning: light-dark(var(--day-on-warning), var(--night-on-warning));
    --on-critical: light-dark(var(--day-on-critical), var(--night-on-critical));
    --series-1: light-dark(var(--day-series-1), var(--night-series-1));
    --series-2: light-dark(var(--day-series-2), var(--night-series-2));
    --series-3: light-dark(var(--day-series-3), var(--night-series-3));
    --series-other: light-dark(var(--day-series-other), var(--night-series-other));
    --map-ocean: light-dark(var(--day-map-ocean), var(--night-map-ocean));
    --map-land: light-dark(var(--day-map-land), var(--night-map-land));
    --map-border: light-dark(var(--day-map-border), var(--night-map-border));
    --map-graticule: light-dark(var(--day-map-graticule), var(--night-map-graticule));
    --map-night: light-dark(var(--day-map-night), var(--night-map-night));
    --map-track: light-dark(var(--day-map-track), var(--night-map-track));
    --shadow-ink: light-dark(var(--day-shadow), var(--night-shadow));
  }
}
/* Which theme: the device's (default), or the visitor's choice. */
:root { color-scheme: light dark; }
:root[data-theme="day"] { color-scheme: light; }
:root[data-theme="night"] { color-scheme: dark; }
/* Night in either theme: the Live map and the Sky chart, and anything else given the class. Its
   text colour is set again here, as text inherits the colour resolved outside. */
.night-scope { color-scheme: dark; color: var(--ink); }
/* Without light-dark() there is only Day: keep the browser's own controls light to match, and do
   not offer a choice that would do nothing. */
@supports not (color: light-dark(#000, #fff)) {
  :root, :root[data-theme], .night-scope { color-scheme: light; }
  .theme-control { display: none !important; }
}

/* ---- 4. Scales ----------------------------------------------------------------------------- */
:root {
  /* Type: a modular scale, ratio 1.2 on a 16 px base, rounded to whole pixels. */
  --font-text: "Atkinson Hyperlegible Next", "Atkinson fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Newsreader", "Newsreader fallback", Georgia, "Times New Roman", serif;
  --font-mono: "Atkinson Hyperlegible Mono", "Atkinson Mono fallback", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: var(--font-text);
  --step--2: 0.75rem;     /* 12 px: chips, column heads, fine print */
  --step--1: 0.875rem;    /* 14 px: secondary text, tables, buttons, labels */
  --step-0: 1rem;         /* 16 px: body */
  --step-1: 1.1875rem;    /* 19 px: lead text, card titles */
  --step-2: 1.4375rem;    /* 23 px: section titles */
  --step-3: 1.75rem;      /* 28 px: page titles on a phone, big figures */
  --step-4: 2.0625rem;    /* 33 px: stat figures */
  --step-5: 2.5rem;       /* 40 px: page titles on a wide screen */
  --leading-tight: 1.15;  /* display type */
  --leading-snug: 1.3;    /* headings, labels */
  --leading-body: 1.55;   /* running text */
  --measure: 68ch;        /* the longest line of running text */

  /* Space: a 4 px scale. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Shape and depth: a hairline and at most a whisper of shadow. */
  --radius-xs: 4px;       /* tags, small marks */
  --radius-sm: 8px;       /* buttons, fields, notes */
  --radius: 12px;         /* cards and panels */
  --radius-lg: 16px;
  --radius-pill: 999px;   /* chips, badges */
  --shadow-1: 0 1px 2px var(--shadow-ink);
  --shadow-2: 0 2px 6px var(--shadow-ink), 0 14px 36px var(--shadow-ink);
  --shadow: var(--shadow-2); /* floating things: menus, popovers, panels over the map, toasts */

  /* Motion: little and purposeful; all of it off with reduced motion (below). */
  --dur-fast: 120ms;      /* hover, press */
  --dur: 200ms;           /* a disclosure opening */
  --dur-slow: 320ms;      /* a page settling in */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.25, 1);

  /* Layout */
  --page-max: 1240px;     /* the widest a page grows */
  --page-narrow: 920px;   /* a page of reading (a profile, a launch) */
  --page-pad: var(--space-6);
  --topbar-h: 60px;
  --section-nav-h: 45px;  /* the "On this page" bar: 44 px links and a hairline */
  --z-sticky: 20;
  --z-header: 30;
  --z-popover: 40;
  --z-toast: 50;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}

/* ---- 5. Element defaults ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { height: 100%; }
/* A column, so the footer sits at the foot of the window on a short page. */
body {
  display: flex; flex-direction: column; min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: var(--step-0)/var(--leading-body) var(--font-text);
  font-kerning: normal;
}
h1, h2, h3, h4 { margin: 0; line-height: var(--leading-snug); text-wrap: balance; }
/* The display face (Newsreader): its figures are tabular by default, which counters, clocks and tiles
   keep; a heading holding a year or a time in a sentence sets them proportional. Its display cut is
   already tight, so no negative letter-spacing under 40 px (type.md, "Rules of use"). */
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0; font-variant-numeric: lining-nums proportional-nums; }
h1 { font-size: clamp(var(--step-3), 1.1rem + 1.6vw, var(--step-5)); line-height: var(--leading-tight); }
h2 { font-size: var(--step-2); }
.card h2 { font-size: var(--step-1); }
h3 { font-size: var(--step-0); font-weight: 650; }
h4 { font-size: var(--step--1); font-weight: 650; }
p { margin: 0 0 0.75em; max-width: var(--measure); }
small { font-size: var(--step--1); }
a { color: var(--accent-ink); text-decoration-thickness: from-font; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 700; }
figure { margin: 0; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 0.18em; cursor: help; }
::selection { background: var(--accent-soft); color: var(--ink); }
/* The focus ring: the same everywhere, 3:1 or more against every surface in both themes. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:where(a, summary, [tabindex]):focus-visible { border-radius: var(--radius-xs); }
/* A page's heading takes the focus as the page opens (focus.js), to be read out: no ring round it. */
#main h1[tabindex="-1"]:focus { outline: none; }
/* Every target at least 24 by 24 px (WCAG 2.2, 2.5.8), however small its text: folds and checkboxes
   (by their label, which clicks them). Rules that make a target larger (44 px for the primary ones)
   are more specific and still win. */
summary { min-height: 24px; cursor: pointer; }
body > main { flex: 1 0 auto; } /* below the Live map's own layout (map.css), which is more specific */
/* The page is at least the window's height under the header, so the footer is never in the first
   window while one page is swapped for another; and as the first page of a visit takes over from
   the page the server wrote, it is held at that page's height until the page drawn is as tall
   (js/takeover.js sets --pinned-height, and takes it away again). */
#main { min-height: calc(100vh - var(--topbar-h)); min-height: max(calc(100svh - var(--topbar-h)), var(--pinned-height, 0px)); }
/* Whatever is scrolled into view (a focused control, a section followed from the "On this page" bar,
   a deep link) stops clear of the sticky header, and of the sticky section bar on a page that has
   one (WCAG 2.2, 2.4.11): the page's scroll padding is their height, and a section with an id stops
   a little below that. */
html { scroll-padding-top: calc(var(--topbar-h) + var(--space-2)); }
html:has(.section-nav) { scroll-padding-top: calc(var(--topbar-h) + var(--section-nav-h) + var(--space-2)); }
main [id] { scroll-margin-top: var(--space-4); }

/* Utilities */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.muted { color: var(--muted); }
.secondary { color: var(--ink-2); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: 0; font-variant-numeric: lining-nums proportional-nums; }
.eyebrow { margin: 0; font-size: var(--step--2); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.icon { flex: none; vertical-align: -0.15em; }
/* A small label ("Group", "Launch") and a key on the keyboard. */
.tag {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-xs); background: var(--surface-2);
  color: var(--ink-2); font-size: var(--step--2); font-weight: 650; line-height: 1.5; letter-spacing: 0.02em; white-space: nowrap;
}
kbd, .kbd {
  display: inline-block; min-width: 1.7em; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: var(--radius-xs); background: var(--surface); color: var(--ink); font: 600 var(--step--2)/1.5 var(--font-mono); text-align: center;
}

/* ---- 6. Shell: skip link, top bar, navigation, search, theme, footer ------------------------ */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--raised); color: var(--ink); box-shadow: var(--shadow-2); font-weight: 650;
}
.skip-link:focus { left: 8px; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--space-4);
  height: var(--topbar-h); padding: 0 var(--space-5);
  background: var(--surface); border-bottom: 1px solid var(--hairline);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex: none; color: var(--ink); text-decoration: none; }
.brand-mark { flex: none; }
.brand-name { font: 600 var(--step-1)/1.05 var(--font-display); letter-spacing: 0; font-variant-numeric: lining-nums proportional-nums; white-space: nowrap; }
/* A square button with an icon and words only screen readers hear (search, alerts, colours). */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-2); }

/* The links sit in one row while they fit; app.js sets data-nav="menu" when they do not, and they
   move into a panel under the bar behind a Menu button. Nothing is ever clipped or scrolled away.
   The current page is marked by weight and a bar under it (in the menu: beside it), not colour alone. */
.nav-area, .nav-panel { display: contents; }
.nav { display: flex; align-items: stretch; align-self: stretch; flex: 1 1 auto; min-width: 0; overflow: hidden; gap: var(--space-2); }
.nav-links { display: flex; align-items: stretch; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-links > li { display: flex; }
.nav-secondary { margin-left: auto; }
/* Links offered only behind Menu (Guides, About): in the row there is no room for them at 1280 px,
   and the footer has them there. */
.nav-links > li.menu-only { display: none; }
.topbar[data-nav="menu"] .nav-links > li.menu-only { display: grid; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap; font-size: var(--step-0); font-weight: 500;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: transparent; transition: background-color var(--dur-fast) var(--ease-out);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { background: var(--border); }
.nav a:focus-visible { outline-offset: -4px; }
/* aria-current="page" on the link to the page shown, "true" on the link to the part of the app it
   belongs to (Catalogue on a satellite's page): drawn the same. */
.nav a[aria-current] { color: var(--ink); font-weight: 700; }
.nav a[aria-current]::after { background: var(--accent); }
.nav-secondary a { font-size: var(--step--1); font-weight: 600; }
.nav-secondary a[aria-current] { font-weight: 700; }
.nav-toggle {
  display: none; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink); font-size: var(--step--1); font-weight: 650; white-space: nowrap;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: var(--surface-2); }
/* The links' words in the row's type, never seen, read or reached (app.js): its size changes with the
   reader's text size and spacing whichever layout is on show, which asks again whether the links
   fit. No height, and anchored at the right so it reaches out only leftwards: it never makes the
   page scroll sideways. Nothing here depends on data-nav, so the answer cannot change its size. */
.nav-measure {
  position: absolute; top: 0; right: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none;
  display: flex; gap: 2px; white-space: nowrap; font-size: var(--step-0); font-weight: 500;
}
.nav-measure > span { padding: 0 12px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--critical); color: var(--on-critical); font-size: var(--step--2); font-weight: 700; line-height: 1;
}
/* The count on the Alerts link counts new passes, launches and storms only, never routine reports,
   and is the calm accent colour, not the alarm red. */
#alert-badge, #nav-toggle-badge { background: var(--accent); color: var(--on-accent); }
/* The storm badge on the Space weather link: dark text on the warning colour. Its words ("G2")
   carry the meaning; the colour only echoes them. */
.badge.storm { background: var(--warning); color: var(--on-warning); }

/* The bell beside the Menu button: shown whenever the links are behind it; it carries the count. */
.alerts-shortcut { display: none; }
.alerts-shortcut .badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; box-shadow: 0 0 0 2px var(--surface); }
.alerts-shortcut.has-unread { color: var(--ink); } /* class set by app.js setUnread, not :has() */

/* Quick search. In the header its suggestions line up with the box's right edge, wider than it. */
.quick-search { position: relative; display: flex; align-items: center; flex: 0 1 260px; min-width: 150px; margin-left: auto; }
.quick-search input[type="search"] { height: 40px; padding-left: 36px; border-radius: var(--radius-pill); background-color: var(--page); }
.quick-search::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 11px; height: 11px; margin-top: -7px; pointer-events: none;
  border: 2px solid var(--muted); border-radius: 50%;
}
.quick-search::after {
  content: ""; position: absolute; left: 24px; top: 50%; width: 6px; height: 2px; margin-top: 4px; pointer-events: none;
  background: var(--muted); transform: rotate(45deg); border-radius: 1px;
}
.quick-search .suggest { position: static; }
.quick-search .suggest-list { left: auto; right: 0; top: calc(100% + 8px); width: max(100%, min(440px, calc(100vw - 20px))); }
.search-toggle, .search-close { display: none; }

/* The colour theme (theme.js): a button with a small panel of three choices on a wide screen. */
.theme-control { position: relative; flex: none; }
.theme-icon { display: none; }
.theme-control[data-choice="auto"] .theme-icon.auto,
.theme-control[data-choice="day"] .theme-icon.day,
.theme-control[data-choice="night"] .theme-icon.night { display: block; }
.theme-options { display: none; min-width: 0; margin: 0; padding: 0; border: 0; }
.theme-control.open .theme-options {
  display: block; position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-popover); width: 240px;
  padding: var(--space-2); border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--raised); box-shadow: var(--shadow-2);
}
.theme-options legend { float: left; width: 100%; padding: var(--space-2) var(--space-3) var(--space-1); font-size: var(--step--2); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.theme-choices { clear: both; display: grid; gap: 2px; }
.theme-choices label {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  cursor: pointer; font-size: var(--step--1); font-weight: 600; color: var(--ink);
}
.theme-choices label:hover { background: var(--surface-2); }
.theme-choices label:has(:checked) { background: var(--accent-soft); font-weight: 700; }
.theme-choices input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }

/* Menu mode: the links, the secondary link and the colours in a panel under the bar. */
.topbar[data-nav="menu"] .nav-toggle { display: inline-flex; }
.topbar[data-nav="menu"] .alerts-shortcut { display: inline-grid; margin-left: auto; }
.topbar[data-nav="menu"] .quick-search { margin-left: 0; }
.topbar[data-nav="menu"] .nav-panel {
  display: none; position: absolute; top: 100%; right: var(--space-4); z-index: var(--z-popover); width: min(380px, calc(100vw - 2 * var(--space-4)));
  max-height: calc(100dvh - var(--topbar-h) - var(--space-4)); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-2); background: var(--raised); border: 1px solid var(--hairline); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-2);
}
.topbar[data-nav="menu"] .nav-area.open .nav-panel { display: block; }
.topbar[data-nav="menu"] .nav { display: block; overflow: visible; }
.topbar[data-nav="menu"] .nav-links { display: grid; gap: 2px; }
.topbar[data-nav="menu"] .nav-links > li { display: grid; }
.topbar[data-nav="menu"] .nav a { min-height: 48px; padding: 0 var(--space-4); border-radius: var(--radius-sm); white-space: normal; font-size: var(--step-0); }
.topbar[data-nav="menu"] .nav a:hover { background: var(--surface-2); }
.topbar[data-nav="menu"] .nav a::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 4px; height: auto; border-radius: 0 3px 3px 0; }
.topbar[data-nav="menu"] .nav a[aria-current] { background: var(--accent-soft); }
.topbar[data-nav="menu"] .nav-secondary { margin: var(--space-2) 0 0; padding-top: var(--space-2); border-top: 1px solid var(--hairline); }
.topbar[data-nav="menu"] .nav-secondary a { font-size: var(--step--1); color: var(--ink-2); }
.topbar[data-nav="menu"] .theme-control { margin-top: var(--space-2); padding: var(--space-2) 0 0; border-top: 1px solid var(--hairline); }
.topbar[data-nav="menu"] .theme-button { display: none; }
.topbar[data-nav="menu"] .theme-options { display: block; }
.topbar[data-nav="menu"] .theme-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); padding: 0 var(--space-1) var(--space-1); }
.topbar[data-nav="menu"] .theme-choices label { justify-content: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); text-align: center; line-height: 1.2; }

/* The footer: where positions come from and how fresh that data is, and the pages not in the bar. */
.site-footer { border-top: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2); font-size: var(--step--1); }
.footer-inner {
  max-width: var(--page-max); margin: 0 auto; padding: var(--space-4) var(--page-pad);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-6);
}
.footer-fresh { margin: 0; max-width: none; }
.footer-links ul { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); margin: 0; padding: 0; list-style: none; }
.site-footer a { display: inline-block; padding: 4px 0; color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }
/* The page on show (aria-current, set by app.js as in the header): bold ink, not colour alone. */
.footer-links a[aria-current] { color: var(--ink); font-weight: 700; }
.footer-fresh a { color: var(--accent-ink); }
.noscript { max-width: 70ch; margin: 24px auto; padding: 0 20px; }

/* ---- 7. Page scaffolding: the page, its head, sections ------------------------------------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-8) var(--page-pad) var(--space-16); }
/* The page head (ui.js pageHead, and the older markup .page-head > div > h1 + p): the title, one
   short lead, the actions at the end. */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-8);
  margin-bottom: var(--space-8);
}
.page-head > div:first-child, .page-head-text { flex: 1 1 30rem; min-width: 0; }
.page-head h1 ~ p, .page-head .lead { margin: var(--space-3) 0 0; max-width: var(--measure); color: var(--ink-2); font-size: var(--step-1); line-height: 1.45; }
.page-head .page-back { flex: 0 0 100%; max-width: none; margin: 0 0 calc(-1 * var(--space-2)); }
.page-title { display: flex; flex-direction: column; margin: 0; }
/* The eyebrow follows the h1 in the document, so the lead's rule above would otherwise size it as a lead. */
.page-head .page-title .eyebrow { order: -1; margin: 0 0 var(--space-2); font-size: var(--step--2); color: var(--ink-2); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
/* The way back to the page above ("← Catalogue"). */
.back, .page-back { margin: 0 0 var(--space-3); font-size: var(--step--1); }
.back a, .page-back a { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--ink-2); font-weight: 650; text-decoration: none; }
.back a:hover, .page-back a:hover { color: var(--ink); text-decoration: underline; }
/* The head of an object's or a launch's page: title, chips and identifiers. */
.profile-head { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-5); }
.profile-head .ids { color: var(--ink-2); margin-top: var(--space-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: var(--step--1); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; }
/* A sentence under a section's title saying what the section holds (Launches, Alerts, Sources). */
.section-intro { margin: 0 0 var(--space-4); font-size: var(--step--1); }
.section-head + .section-intro { margin-top: calc(-1 * var(--space-1)); } /* the head's own margin is wider */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.stack > * + * { margin-top: var(--space-5); }
.lede { font-size: var(--step-1); line-height: 1.45; margin-bottom: var(--space-3); }
.prose p { color: var(--ink-2); max-width: var(--measure); }
.small-print { font-size: var(--step--2); line-height: 1.5; margin: var(--space-3) 0 0; }

/* The page's own words as the server sends them inside <main> (.server-page): what a reader without
   JavaScript, and a search engine, reads. Plain HTML (one h1, sections, paragraphs, lists, terms,
   tables); the app replaces all of it in one step as it draws the page. Kept readable: the measure,
   terms beside what they mean, and tables that wrap their words and scroll inside themselves rather
   than pushing the page sideways. */
.server-page > h1 { margin: 0; }
.server-page > h1 + .lead { margin: var(--space-3) 0 var(--space-5); max-width: var(--measure); color: var(--ink-2); font-size: var(--step-1); line-height: 1.45; }
.server-page section { margin-top: var(--space-8); }
.server-page h2 { margin: 0 0 var(--space-3); }
.server-page p, .server-page li { max-width: var(--measure); }
.server-page dl { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 0 var(--space-5); margin: var(--space-4) 0; max-width: 56rem; }
.server-page dt { grid-column: 1; color: var(--ink-2); font-weight: 600; }
.server-page dd { grid-column: 2; margin: 0; }
.server-page dt, .server-page dd { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
/* A table scrolls inside its own box (the server wraps each in .table-wrap, as the app does). */
.server-page .table-wrap { margin: var(--space-4) 0; }
.server-page :not(.table-wrap) > table { display: block; max-width: 100%; overflow-x: auto; margin: var(--space-4) 0; }
.server-page th, .server-page td { white-space: normal; }
@media (max-width: 640px) {
  .server-page dl { grid-template-columns: minmax(0, 1fr); }
  .server-page dt, .server-page dd { grid-column: 1; }
  .server-page dt { border-bottom: 0; padding-bottom: 0; }
}

/* "On this page" (ui.js sectionNav): sticky under the header, scrolling sideways on a phone, where a
   shade at either edge shows there are more links that way (as on a scrolling table: the covers
   scroll with the links, the shades stay put). Its height is --section-nav-h, which the page's scroll
   padding allows for (section 5). */
.section-nav {
  position: sticky; top: var(--topbar-h); z-index: var(--z-sticky);
  margin: 0 calc(-1 * var(--page-pad)) var(--space-6); padding: 0 var(--page-pad);
  background: var(--page); border-bottom: 1px solid var(--hairline);
}
.section-nav ul {
  display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none;
  background:
    linear-gradient(to right, var(--page) 30%, transparent) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--page) 30%, transparent) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 30%, transparent), transparent) left center / 16px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 30%, transparent), transparent) right center / 16px 100% no-repeat scroll,
    var(--page);
}
.section-nav ul::-webkit-scrollbar { display: none; }
.section-nav a {
  display: inline-flex; align-items: center; min-height: calc(var(--section-nav-h) - 1px); padding: 0 var(--space-3); white-space: nowrap;
  color: var(--ink-2); text-decoration: none; font-size: var(--step--1); font-weight: 600; border-bottom: 3px solid transparent;
}
.section-nav a:hover { color: var(--ink); border-bottom-color: var(--border); }
.section-nav a[aria-current="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.section-nav a:focus-visible { outline-offset: -3px; }

/* "Launches | In space now": links between two pages, the current one bold and underlined. */
.page-tabs { margin: 0 0 var(--space-5); border-bottom: 1px solid var(--hairline); }
.page-tabs ul { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.page-tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); margin-bottom: -1px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent;
}
.page-tabs a:hover { color: var(--ink); border-bottom-color: var(--border); }
.page-tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
/* Tabs in a page (a tablist: Alerts). */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--hairline); margin-bottom: var(--space-5); }
.tabs button {
  all: unset; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); margin-bottom: -1px;
  cursor: pointer; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent;
}
.tabs button:hover { color: var(--ink); border-bottom-color: var(--border); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--radius-xs); }

/* ---- 8. Shared components ------------------------------------------------------------------ */
/* Buttons: .btn is the secondary button; .primary the one main action; .quiet (or .ghost) a
   borderless one; .small a compact one. Pressed (aria-pressed="true") is tinted, edged and bold;
   disabled is faded. On a touch screen every button is 44 px tall. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink); text-decoration: none;
  font-family: var(--font-text); font-size: var(--step--1); font-weight: 650; line-height: 1.2;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--surface-2); border-color: var(--field-border); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 84%, var(--ink)); border-color: color-mix(in srgb, var(--accent) 84%, var(--ink)); }
.btn.quiet, .btn.ghost { background: transparent; border-color: transparent; }
.btn.quiet:hover, .btn.ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn.small { height: 32px; padding: 0 var(--space-3); font-size: var(--step--1); }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[disabled]:hover, .btn[aria-disabled="true"]:hover { background: var(--surface); border-color: var(--border); }
.btn.primary[disabled]:hover { background: var(--accent); border-color: var(--accent); }

/* Segmented control (ui.js segmented): the chosen one raised, bold and underlined. */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--surface-2); }
.segmented button {
  height: 32px; padding: 0 var(--space-3); border: 0; border-radius: 5px; background: transparent; cursor: pointer;
  font-size: var(--step--1); font-weight: 600; color: var(--ink-2);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-1), inset 0 -2px 0 var(--accent); }
.segmented button:disabled { opacity: 0.5; cursor: not-allowed; }
.segmented.wide { display: flex; }
.segmented.wide button { flex: 1; }

/* Form fields: a label above, the field, help beneath (.field-help), and an error in words
   (.field-error) with aria-invalid="true" on the field. */
input, select, button, textarea { font: inherit; color: inherit; }
input[type="search"], input[type="text"], input[type="number"], input[type="url"], input[type="password"], input[type="email"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%; height: 40px; padding: 0 var(--space-3);
  background: var(--surface); color: var(--ink); border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  font-size: var(--step-0); font-weight: 400; letter-spacing: normal;
}
textarea { height: auto; min-height: 6rem; padding: var(--space-2) var(--space-3); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
[aria-invalid="true"] { border-color: var(--critical) !important; box-shadow: inset 0 0 0 1px var(--critical); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
label.field { display: grid; gap: 6px; font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
label.check { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 24px; font-size: var(--step--1); cursor: pointer; }
.field-wrap { display: grid; gap: 6px; }
.field-help { font-size: var(--step--1); font-weight: 400; line-height: 1.4; color: var(--muted); }
.field-error { font-size: var(--step--1); font-weight: 650; line-height: 1.4; color: var(--critical-ink); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3) var(--space-4); align-items: end; }
.form-actions { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-4); flex-wrap: wrap; }
.form-msg { font-size: var(--step--1); color: var(--ink-2); }
/* A switch: a checkbox drawn as a track and a knob (alerts' rules). */
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; width: 100%; height: 100%; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--field-border); transition: background-color var(--dur-fast) var(--ease-out); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--on-accent); transition: transform var(--dur-fast) var(--ease-out); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Cards: .card plain (a hairline and a whisper of shadow), .raised above the page, .answer for
   the lead answer on a page. */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--space-6); box-shadow: var(--shadow-1); }
.card > h2 { margin-bottom: var(--space-3); }
.card + .card { margin-top: var(--space-5); }
.card.raised { background: var(--raised); box-shadow: var(--shadow-2); }
.card.answer { background: var(--raised); box-shadow: var(--shadow-2); padding: var(--space-8); border-color: color-mix(in srgb, var(--accent) 25%, var(--hairline)); }
.card.answer > h2 { font-size: var(--step-3); }
.grid-2 > .card { margin-top: 0; } /* after .card + .card, which it overrides */
/* A callout: a tinted box for a caveat or a warning; its words carry the meaning, the edge (.warning,
   .error, .info) only draws the eye. */
.callout { max-width: var(--measure); margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font-size: var(--step--1); }
.callout.warning { border-left: 4px solid var(--warning); }
.callout.error { border-left: 4px solid var(--critical); }
.callout.info { border-left: 4px solid var(--accent); }
.callout > :last-child { margin-bottom: 0; }

/* Stat tiles (ui.js statTile): the figure in the display face. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-1); }
.tile .label { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.tile .value { margin: 2px 0 4px; font: 600 var(--step-4)/1.1 var(--font-display); letter-spacing: 0; }
.tile .note { font-size: var(--step--1); line-height: 1.4; color: var(--muted); }
/* A headline tile whose number has a list of exactly those objects links to it by its label. */
.tile .label a.tile-link { display: inline-block; padding: 3px 0; }

/* Facts: a definition list of short answers. */
.facts { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; }
.facts dt, .facts dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: var(--step--1); }
.facts dt { color: var(--ink-2); font-weight: 600; padding-right: var(--space-3); }
.facts dd small { display: block; color: var(--muted); font-size: var(--step--2); line-height: 1.4; margin-top: 2px; }
.facts > :nth-last-child(-n + 2) { border-bottom: 0; }
/* A readout: figures in a two-column grid (Live map details, the profile's position, Sky selection). */
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); margin-top: var(--space-3); }
.readout .k { font-size: var(--step--2); font-weight: 600; color: var(--ink-2); }
.readout .v { font-size: var(--step-0); font-weight: 650; font-variant-numeric: tabular-nums; }
.readout .full { grid-column: 1 / -1; }
/* The "live" pulse: the one thing that loops. */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
/* A countdown to a launch (util.js countdown). */
.countdown { display: block; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Tables: column heads on a sunken band; numbers right-aligned in tabular figures (td.r).
   A table wider than its box scrolls sideways inside it (.table-wrap), and a shade at either edge
   shows there is more that way (the covers scroll with the table; the shades stay put). Positioned,
   so visually hidden text inside scrolls and clips with the table instead of widening the page. */
.table-wrap {
  position: relative; overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 30%, transparent), transparent) left center / 16px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 30%, transparent), transparent) right center / 16px 100% no-repeat scroll,
    var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
caption { caption-side: top; text-align: left; padding: var(--space-3) var(--space-3) var(--space-2); font-size: var(--step--1); color: var(--ink-2); }
th, td { padding: 10px var(--space-3); text-align: left; border-bottom: 1px solid var(--hairline); vertical-align: top; white-space: nowrap; }
th { font-weight: 650; color: var(--ink-2); font-size: var(--step--2); white-space: nowrap; background: var(--surface); }
thead th { background: var(--surface-2); border-bottom-color: var(--border); letter-spacing: 0.02em; }
td.wrap { white-space: normal; min-width: 180px; }
table.compact { font-size: var(--step--1); }
table.compact th, table.compact td { padding: 7px 10px; }
table.compact td.wrap { min-width: 110px; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; min-height: 24px; }
th button:hover { color: var(--ink); }
th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--surface-2); }
td .sub { display: block; font-size: var(--step--2); color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-4); font-size: var(--step--1); color: var(--ink-2); }
.pager .btns { display: flex; gap: var(--space-2); }
.pager-position { margin: 0; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
/* A table in a narrow container (launches, re-entries, in space now, a profile's technical details)
   becomes one labelled block per row; keepTableSemantics in util.js keeps it a table to screen readers. */
@container (max-width: 900px) {
  table.stackable, table.stackable > tbody, table.stackable tr, table.stackable td, table.stackable th { display: block; }
  table.stackable > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stackable tr { padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--hairline); }
  table.stackable > tbody:last-child > tr:last-child { border-bottom: 0; }
  table.stackable td, table.stackable th { min-width: 0; padding: 1px 0; border: 0; white-space: normal; }
  table.stackable th[scope="row"] { padding: 4px 0; font-weight: 650; }
  table.stackable td[data-label]::before { content: attr(data-label) ": "; content: attr(data-label) ": " / ""; color: var(--ink-2); font-size: var(--step--2); font-weight: 600; }
  table.stackable td.when::before { content: none; }
  table.stackable tr.day { padding: 0; }
  table.stackable tr.day th { padding: 6px 12px; }
}

/* Chips (util.js chip and friends): every chip carries its meaning as text; the dot's colour and
   shape only echo it. */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); font-size: var(--step--2); font-weight: 600; line-height: 1.5; color: var(--ink-2); white-space: nowrap; background: var(--surface);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series-other); flex: none; }
.chip.good .dot { background: var(--good); }
.chip.off .dot { background: var(--muted); }
.chip.gone .dot { background: transparent; border: 1.5px solid var(--muted); }
.chip.bad .dot { background: var(--critical); border-radius: 1px; }
.chip.warn .dot { background: var(--warning); border-radius: 1px; transform: rotate(45deg); }
.chip.info .dot { background: var(--accent); }
.chip.pending .dot { background: transparent; border: 1.5px dashed var(--ink-2); }
/* Tracked from the operator's own orbit data, not catalogued yet: a ring (tracked, not yet listed). */
.chip.operator .dot { background: transparent; border: 2px solid var(--accent); }
/* How firm a launch date is: filled and hollow dots show the step; the label says it in words. */
.chip.firmness .steps { font-size: 0.62rem; letter-spacing: 0.05em; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
a.chip { text-decoration: none; min-height: 24px; }
a.chip:hover { border-color: var(--field-border); color: var(--ink); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* Brightness as stars (ui.js stars): beside the category's words, gold when it can be seen. */
.stars { display: inline-block; flex: none; vertical-align: -0.2em; color: var(--ink-2); }
.stars.gold { color: var(--gold); }

/* A disclosure (ui.js disclosure): a summary with a turning chevron, the content beneath. */
details.disclosure { border-top: 1px solid var(--hairline); }
details.disclosure > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: var(--space-2) 0;
  list-style: none; font-weight: 650; color: var(--ink);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 6px 0 4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease-out);
}
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--accent-ink); }
.disclosure-body { padding: 0 0 var(--space-4); }

/* Loading, empty and error states (ui.js skeleton, emptyState, errorState). */
.state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-6); text-align: center; color: var(--ink-2); }
.state-icon { color: var(--muted); margin-bottom: var(--space-1); }
.state-error .state-icon { color: var(--critical); }
.state-title { margin: 0; font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: var(--leading-snug); letter-spacing: 0; font-variant-numeric: lining-nums proportional-nums; color: var(--ink); }
.state-body { margin: 0; max-width: 52ch; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.empty { padding: var(--space-8) var(--space-4); margin-inline: auto; text-align: center; color: var(--ink-2); }
.error-box {
  max-width: var(--measure); padding: var(--space-3) var(--space-4); border: 1px solid var(--hairline); border-left: 4px solid var(--critical);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.skeleton { padding: var(--space-1) 0; }
.skeleton-shapes { display: grid; gap: var(--space-3); animation: skeleton-in var(--dur-slow) var(--ease-out) backwards; }
.skeleton-bar { display: block; height: 0.9em; border-radius: var(--radius-xs); background: var(--surface-2); }
.skeleton-bar.title { height: 1.4em; margin-bottom: var(--space-1); }
.skeleton-bar.strong { height: 1.1em; }
.skeleton-bar.figure { height: 2em; }
.skeleton-row { display: grid; gap: 6px; padding: var(--space-3) 0; border-bottom: 1px solid var(--hairline); }
.skeleton-row.head .skeleton-bar { height: 1.6em; }
.skeleton-card, .skeleton-tile { display: grid; gap: var(--space-3); padding: var(--space-6); border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
.skeleton-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.skeleton-tile { padding: var(--space-4); gap: var(--space-2); }
@keyframes skeleton-in { from { opacity: 0; } }

/* What you can really see, and how old a position is. The mark for objects whose orbit data is too
   old to trust: a ring on the Live view (as drawn there), a cross on the Sky view. The shape carries
   the meaning, and the words beside it say it. */
.stale-key { display: flex; gap: var(--space-2); align-items: flex-start; margin: var(--space-2) 0 0; font-size: var(--step--2); color: var(--ink-2); }
.stale-mark { display: inline-block; width: 10px; height: 10px; flex: none; margin-top: 3px; color: var(--ink-2); }
.stale-mark.ring { border: 1.5px solid currentColor; border-radius: 50%; }
.stale-mark.cross {
  background: linear-gradient(45deg, transparent 42%, currentColor 42% 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, currentColor 42% 58%, transparent 58%);
}
/* How old a position's orbit data is (profile card, map popup, Sky selection). */
.orbit-age .v { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.orbit-age-note { font-size: var(--step--2); margin: 6px 0 0; }
.stale-warning { margin: var(--space-3) 0 0; padding: var(--space-2) var(--space-3); border-left: 4px solid var(--critical); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--ink); font-size: var(--step--1); }

/* Search suggestions (search-box.js): a listbox under its search box, each option 44 px or taller. */
.suggest { position: relative; }
.suggest-list {
  position: absolute; z-index: var(--z-popover); left: 0; right: 0; top: 4px; margin: 0; padding: var(--space-1); list-style: none;
  background: var(--raised); color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-2);
  max-height: min(420px, 70dvh); overflow-y: auto;
}
.suggest-option { display: grid; align-content: center; gap: 2px; min-height: 44px; padding: 6px var(--space-3); border-radius: var(--radius-sm); cursor: pointer; }
.suggest-option:hover { background: var(--surface-2); }
.suggest-option.active { background: var(--accent-soft); outline: 2px solid var(--focus); outline-offset: -2px; }
.suggest-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-weight: 650; font-size: var(--step--1); overflow-wrap: anywhere; }
.suggest-tag { font-size: var(--step--2); font-weight: 650; color: var(--ink-2); background: var(--surface-2); border-radius: var(--radius-xs); padding: 0 6px; }
.suggest-desc {
  font-size: var(--step--2); line-height: 1.4; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.suggest-note { margin: 6px 0 0; font-size: var(--step--1); color: var(--ink-2); }

/* Toasts: a note in the corner (util.js toast), the words and a button that puts it away. */
.toasts { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: var(--z-toast); display: grid; gap: var(--space-2); width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 6px; padding: var(--space-3) 6px var(--space-3) var(--space-4);
  background: var(--raised); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-2); font-size: var(--step--1);
}
.toast a { color: inherit; text-decoration: none; display: block; }
.toast .t { font-weight: 700; }
.toast .b { color: var(--ink-2); }
/* Only a note that links to its whole text (an alert) is cut to two lines; any other note is all
   there is of its message (a refusal saying from when to try again, say), so it is shown whole. */
.toast > a .b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast > a, .toast > div { flex: 1 1 auto; min-width: 0; }
.toast-close {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -4px 0; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 0.9rem;
}
.toast-close:hover { background: var(--surface-2); color: var(--ink); }
@media (pointer: coarse) { .toast-close { width: 44px; height: 44px; margin: -10px -4px -10px 0; } }

/* The watch button (the Live map's selected satellite, a profile): it keeps its words; pressed
   (aria-pressed), its star is filled. */
.watch-star { font-size: 1.05em; line-height: 1; }
.watch-button[aria-pressed="true"] .watch-star { color: var(--gold); }

/* ---- 9. Page not found (views/not-found.js) ------------------------------------------------ */
.not-found .page-head { margin-bottom: var(--space-6); }
.not-found-search { display: grid; gap: 6px; max-width: 560px; margin: 0 0 var(--space-6); font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.not-found-row { display: flex; gap: var(--space-2); }
.not-found-row input { height: 44px; }
.not-found-row .btn { height: 44px; padding: 0 var(--space-5); }
.not-found-links { margin: 0; padding-left: 20px; display: grid; gap: var(--space-1); }
.not-found-links a { display: inline-block; padding: 4px 0; vertical-align: top; } /* the bullet stays by the first line of a link that wraps */

/* ---- 10. Page changes ---------------------------------------------------------------------- */
/* The new page settles in: a short fade and rise (app.js settleIn), never with reduced motion. With
   the View Transitions API the old page fades as the new one rises and the header stays still;
   without it, the stylesheet animates the page's parts as they are added. */
@media (prefers-reduced-motion: no-preference) {
  #main { view-transition-name: page; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  ::view-transition-group(page) { animation-duration: 0s; }
  ::view-transition-old(page) { animation: page-leave var(--dur-fast) var(--ease-in-out) both; }
  ::view-transition-new(page) { animation: page-settle var(--dur-slow) var(--ease-out) both; }
  @supports not (view-transition-name: none) {
    #main > * { animation: page-settle var(--dur-slow) var(--ease-out) backwards; }
  }
}
@keyframes page-settle { from { opacity: 0; transform: translateY(8px); } }
@keyframes page-leave { to { opacity: 0; } }

/* While the next page is on its way, after a moment (js/app.js pageComing): a thin bar along the
   foot of the header, light moving through it, and the pointer saying so. The bar is the header's
   full width (the light moves inside it), so nothing overflows; with reduced motion it stands still. */
html.page-loading { cursor: progress; }
html.page-loading .topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat 0 0 / 40% 100%;
  animation: page-loading 1.2s var(--ease-in-out) infinite;
}
@keyframes page-loading { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) {
  html.page-loading .topbar::after { animation: none; background: var(--accent); opacity: 0.55; }
}

/* ---- 11. Narrow screens and touch ---------------------------------------------------------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: var(--space-2); padding: 0 var(--space-3); }
}
@media (max-width: 640px) {
  :root { --page-pad: var(--space-4); --topbar-h: 56px; }
  .page { padding: var(--space-5) var(--page-pad) var(--space-12); }
  .page-head { margin-bottom: var(--space-6); }
  .page-head h1 ~ p, .page-head .lead { font-size: var(--step-0); }
  .card { padding: var(--space-4); }
  .card.answer { padding: var(--space-5); }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
  .tile { padding: var(--space-3) var(--space-4); }
  .tile .value { font-size: var(--step-3); }
  /* One row: the name, a search button, the alerts bell and Menu. The search opens over the bar. */
  .topbar { gap: var(--space-1); padding: 0 var(--space-2) 0 var(--space-3); }
  .brand { margin-right: auto; min-width: 0; }
  .topbar[data-nav="menu"] .alerts-shortcut { margin-left: 0; }
  .search-toggle { display: inline-grid; }
  .quick-search { display: none; }
  .topbar.search-open .quick-search {
    display: flex; position: absolute; inset: 0; z-index: 2; gap: var(--space-1); margin: 0; min-width: 0;
    padding: 0 var(--space-2) 0 var(--space-3); background: var(--surface);
  }
  .topbar.search-open .quick-search::before { left: 25px; }
  .topbar.search-open .quick-search::after { left: 36px; }
  .topbar.search-open .quick-search input[type="search"] { height: 44px; flex: 1 1 auto; }
  .topbar.search-open .search-close { display: inline-grid; }
  .topbar.search-open .quick-search input::-webkit-search-cancel-button { display: none; } /* the close button is beside it */
  .topbar.search-open > :not(.quick-search) { visibility: hidden; }
  .topbar.search-open .quick-search .suggest-list { left: var(--space-2); right: var(--space-2); width: auto; top: calc(100% + 4px); }
  .topbar[data-nav="menu"] .nav-panel { left: 0; right: 0; width: auto; border-radius: 0 0 var(--radius) var(--radius); border-left: 0; border-right: 0; }
  .footer-inner { padding: var(--space-4) var(--page-pad) var(--space-5); }
}
@media (max-width: 400px) {
  .brand { gap: 8px; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-name { font-size: var(--step-0); white-space: normal; width: min-content; line-height: 1.02; }
}
@media (max-width: 340px) {
  .nav-toggle { width: 44px; padding: 0; justify-content: center; }
  .nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (pointer: coarse) {
  .btn, .btn.small { height: 44px; }
  input[type="search"], input[type="text"], input[type="number"], input[type="url"], input[type="password"], input[type="email"],
  input[type="date"], input[type="time"], input[type="datetime-local"], select { height: 44px; }
  .segmented button { height: 38px; }
  .quick-search input[type="search"] { height: 44px; }
}
