/* Solar System Simulator — DESIGN.md (2026-10-07).
 * Two surfaces: the instrument (html.instrument, the simulator home page) and
 * the notebook (html.notebook, every other page). No inline styles: the page
 * CSP allows stylesheets from 'self' only. */

@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --paper: oklch(96% 0.015 85);
  --paper-2: oklch(93% 0.018 85);
  --ink: oklch(24% 0.02 260);
  --ink-2: oklch(42% 0.02 260);
  --rule: oklch(84% 0.02 85);
  --amber: oklch(78% 0.13 75);
  --amber-ink: oklch(52% 0.12 65);
  --space: oklch(14% 0.01 260);
  --panel: oklch(19% 0.012 260);
  --line: oklch(32% 0.012 260);
  --text: oklch(92% 0.01 90);
  --text-2: oklch(72% 0.012 260);
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 65ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 1rem/1.6 var(--sans); }
html.notebook body { background: var(--paper); color: var(--ink); }
html.instrument body { background: var(--space); color: var(--text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 0.5rem; padding: 0.4rem 0.7rem; background: var(--amber); color: #000; z-index: 20; }
.skip-link:focus { left: 0.5rem; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
html.notebook a { color: var(--amber-ink); }
html.notebook a:hover { color: var(--ink); }
code, kbd, pre, samp { font-family: var(--mono); font-size: max(0.875em, 12px); }
kbd { padding: 0 0.3em; border: 1px solid currentColor; border-radius: 3px; font-size: max(0.8em, 12px); }
button, input, select { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Header: one line, same on both surfaces. */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 1.25rem; border-bottom: 1px solid var(--rule); }
html.instrument .site-header { border-color: var(--line); background: var(--space); }
.wordmark { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; text-decoration: none; letter-spacing: 0.01em; }
html.instrument .wordmark { font-family: var(--mono); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.site-header nav { display: flex; gap: 1.1rem; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.site-header nav a { color: inherit; text-decoration: none; padding: 0.35rem 0; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 0.45em; }

/* Notebook pages. */
html.notebook main { max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.page { max-width: var(--measure); }
.page.wide { max-width: none; }
html.notebook h1, html.notebook h2, html.notebook h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); }
html.notebook h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin: 0 0 0.5rem; }
html.notebook h2 { font-size: 1.6rem; margin: 2.25rem 0 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--rule); }
html.notebook h3 { font-size: 1.2rem; margin: 1.5rem 0 0.3rem; }
html.notebook p, html.notebook li { max-width: var(--measure); }
.lede { font-size: 1.1rem; color: var(--ink-2); margin-top: 0; }
.eyebrow { margin: 0 0 0.3rem; font: 600 0.75rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber-ink); }
.fine-print { font-size: 0.8125rem; color: var(--ink-2); }
.hero { margin-bottom: 1.5rem; }
.hero h1 { margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.panel { margin: 1.25rem 0; padding: 1rem 1.1rem; border: 1px solid var(--rule); background: var(--paper-2); }
.index { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.75rem 0 1.5rem; padding: 0; list-style: none; font: 0.8125rem var(--mono); }
.site-footer { max-width: 72rem; margin: 0 auto; padding: 1rem 1.25rem 2rem; border-top: 1px solid var(--rule); font-size: 0.8125rem; color: var(--ink-2); }
.site-footer p { margin: 0; max-width: none; }

/* Tables and data: mono, units in headers. */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
th { font: 600 0.75rem/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
html.notebook tr:target { background: oklch(90% 0.06 85); }

/* About (A129): a figure of the instrument, a glossary, a folded table. */
.figure { margin: 1.25rem 0 0.5rem; }
.figure img { display: block; width: 100%; height: auto; border: 1px solid var(--ink); background: var(--space); }
.figure figcaption { margin-top: 0.4rem; font-size: 0.875rem; color: var(--ink-2); }
.glossary { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.45rem 1rem; margin: 0.75rem 0; max-width: var(--measure); }
.glossary dt { font: 600 0.8125rem var(--mono); padding-top: 0.15rem; }
.glossary dd { margin: 0; }
.fold summary { cursor: pointer; font: 600 0.875rem var(--mono); color: var(--amber-ink); padding: 0.35rem 0; }
.controls td:first-child { white-space: nowrap; font-weight: 600; }
@media (max-width: 760px) { .glossary { grid-template-columns: 1fr; gap: 0.1rem; } .glossary dd { margin-bottom: 0.45rem; } }

/* Catalog (A129): one collapsible section per system. */
.catalog-section { border-top: 1px solid var(--rule); }
.catalog-section:last-of-type { border-bottom: 1px solid var(--rule); }
.catalog-section summary { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.7rem 0; cursor: pointer; list-style: none; }
.catalog-section summary::-webkit-details-marker { display: none; }
.catalog-section summary::before { content: "+"; flex: none; width: 1rem; font: 600 1rem var(--mono); color: var(--ink-2); }
.catalog-section[open] summary::before { content: "−"; }
.section-title { font: 600 1.25rem var(--serif); }
.section-count { font: 0.8125rem var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.catalog-section summary:hover .section-title { color: var(--amber-ink); }
.catalog-section .table-wrap { margin-bottom: 1rem; }
/* Phones: each section already names the parent ("Jupiter's moons"), and in
   a moon section every Kind reads Moon, so those columns go and the rest fit
   without clipping Group. */
@media (max-width: 480px) {
  .catalog-section th:nth-child(3), .catalog-section td:nth-child(3),
  .catalog-section[data-moon-section] th:nth-child(2), .catalog-section[data-moon-section] td:nth-child(2) { display: none; }
}
html.notebook .catalog-section tbody tr:hover { background: oklch(93% 0.02 85); }
@media (min-width: 761px) {
  /* Column headers stay in view through a long section (sticky needs the
   * wrapper not to clip, which wide screens never need). */
  .catalog-section .table-wrap { overflow: visible; }
  .catalog-section thead th { position: sticky; top: 0; background: var(--paper); z-index: 1; }
}

/* Forms and buttons. */
html.notebook input, html.notebook select { padding: 0.35rem 0.5rem; border: 1px solid var(--rule); background: #fff; color: var(--ink); min-height: 2.25rem; }
.button, html.notebook button { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.25rem; padding: 0.3rem 0.85rem; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font: 600 0.8125rem var(--mono); text-decoration: none; }
.button.primary, html.notebook button.primary { background: var(--ink); color: var(--paper); }
html.notebook button:disabled { opacity: 0.5; cursor: not-allowed; }
label { display: inline-flex; flex-direction: column; gap: 0.2rem; font-size: 0.875rem; }

/* Lessons list (Learn). */
.lessons { margin: 1rem 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.lessons li { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 0.25rem 1rem; align-items: center; max-width: none; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
/* A129: a still of the lesson running, the instrument's dark against paper. */
.lesson-preview { grid-column: 1; grid-row: 1 / span 2; display: block; line-height: 0; }
.lesson-preview img { width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; background: var(--space); border: 1px solid var(--ink); }
.lessons strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.lessons strong { grid-column: 2; }
.lessons p { grid-column: 2; margin: 0; font-size: 0.9375rem; color: var(--ink-2); }
.lessons .button { grid-column: 3; grid-row: 1 / span 2; }

/* Instrument: the canvas fills the viewport below the header. */
html.instrument, html.instrument body { height: 100%; overflow: hidden; }
html.instrument body { display: flex; flex-direction: column; }
html.instrument main { position: relative; flex: 1; min-height: 0; }
.instrument { position: absolute; inset: 0; }
.side-panels { display: contents; }
.canvas-wrap { position: absolute; inset: 0; background: #000; }
/* Drags turn the view and two fingers zoom (A112): the browser must not pan or zoom the page instead. */
.canvas-wrap canvas { display: block; width: 100%; height: 100%; outline-offset: -2px; touch-action: none; cursor: grab; }
.canvas-wrap canvas:active { cursor: grabbing; }
.canvas-wrap canvas[data-hover] { cursor: pointer; }
.hud { position: absolute; left: 0.75rem; top: 0.6rem; right: 24rem; display: flex; flex-direction: column; gap: 0.15rem; pointer-events: none; font: 0.75rem/1.5 var(--mono); color: var(--text-2); text-shadow: 0 1px 3px #000; }
.hud p { margin: 0; }
.clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.75rem; }
.clock-time { font: 500 1.375rem/1.2 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.clock-note { color: var(--amber); font-variant-numeric: tabular-nums; }
/* Today (A133) is the HUD's one control: it takes the pointer the rest of the
   HUD passes through to the canvas. */
.clock-today { pointer-events: auto; align-self: center; min-height: 1.75rem; padding: 0.1rem 0.6rem; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 0.75rem var(--mono); cursor: pointer; text-shadow: none; }
.clock-today:hover { border-color: var(--amber); }
.clock-today[data-running="true"] { border-color: var(--amber); color: var(--amber); }
.hud-line [data-runtime-status] { color: var(--text); }
.instrument-panel, .dock, .lesson-strip { background: var(--panel); border: 1px solid var(--line); color: var(--text); font: 0.8125rem/1.4 var(--mono); }
.instrument button, .instrument select, .instrument input, .sheet button, .sheet select, .sheet input { min-height: 2rem; padding: 0.2rem 0.6rem; border: 1px solid var(--line); background: var(--space); color: var(--text); font: 0.8125rem var(--mono); cursor: pointer; }
.instrument button:hover, .sheet button:hover { border-color: var(--amber); }
.instrument button[aria-pressed="true"], .instrument button.active { border-color: var(--amber); color: var(--amber); }
.instrument button:disabled, .sheet button:disabled { opacity: 0.5; cursor: not-allowed; }
.instrument label, .sheet label { font: 0.75rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.instrument fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.dock { position: absolute; left: 0; right: 0; bottom: 0.75rem; width: max-content; margin-inline: auto; display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; padding: 0.5rem; max-width: calc(100% - 1.5rem); }
.dock fieldset { display: contents; }
.dock input[type="search"] { width: 11rem; }
/* Speed slider over C's five presets (A120); the readout keeps its width as labels change. */
.dock .speed-row { display: flex; align-items: center; gap: 0.4rem; min-height: 2rem; }
.instrument .dock input[type="range"] { width: 7rem; padding: 0; border: 0; background: transparent; accent-color: var(--amber); min-height: 2rem; }
.dock output[data-speed-label] { min-width: 6ch; font-variant-numeric: tabular-nums; text-transform: none; color: var(--text); font-size: 0.8125rem; }
/* Portrait tablets (768-820 px iPads): a shorter slider and tighter gaps keep
   the dock on one row instead of wrapping Data under it. */
@media (min-width: 761px) and (max-width: 900px) {
  .dock { gap: 0.35rem; }
  .instrument .dock input[type="range"] { width: 4.5rem; }
  .instrument .dock button, .instrument .dock select { padding-inline: 0.45rem; }
  .instrument .dock select { max-width: 11rem; }
}
.inspector { position: absolute; right: 0.75rem; top: 2.5rem; width: min(22rem, calc(100% - 1.5rem)); max-height: calc(100% - 11rem); overflow: auto; padding: 0.75rem; }
.inspector h2 { margin: 0 0 0.2rem; font: 600 1rem var(--mono); color: var(--amber); }
.inspector dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.75rem; margin: 0.5rem 0; }
.inspector dt { color: var(--text-2); }
.inspector dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inspector .row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.lesson-strip { position: absolute; left: 0.75rem; top: 5rem; max-width: calc(100% - 24.5rem); display: flex; flex-wrap: wrap; align-items: end; gap: 0.5rem; padding: 0.5rem; }
.lesson-strip fieldset { display: contents; }
.lesson-strip input[type="number"] { width: 6.5rem; }
.lesson-strip p { margin: 0; align-self: center; color: var(--text); }
.lesson-strip [data-lesson-status] { flex-basis: 100%; min-width: 0; color: var(--text-2); }

/* Sheets: native dialogs opened from the dock (view, keys, data). */
.sheet { width: min(34rem, calc(100% - 1.5rem)); max-height: min(80dvh, 44rem); padding: 0; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 0.8125rem/1.5 var(--mono); }
.sheet::backdrop { background: oklch(10% 0.01 260 / 0.55); }
.sheet header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
.sheet h2 { margin: 0; font: 600 0.875rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.sheet .body { padding: 0.75rem 0.8rem; }
.sheet .body > * + * { margin-top: 0.75rem; }
.sheet p { margin: 0; color: var(--text-2); }
.sheet a { color: var(--amber); }
.sheet dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.75rem; margin: 0; }
.sheet dt { color: var(--text-2); }
.sheet dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.sheet .row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.sheet table { font-size: 0.75rem; }
.sheet th, .sheet td { border-color: var(--line); color: var(--text); }
.sheet th { color: var(--text-2); }
/* Find (A130): live matches as one-click rows. */
.find-results { display: grid; gap: 0.15rem; }
.sheet .find-results button { display: flex; justify-content: space-between; gap: 1rem; width: 100%; text-align: left; border-color: transparent; background: transparent; }
.sheet .find-results button:hover, .sheet .find-results button:focus-visible { border-color: var(--amber); }
.sheet .find-results button:first-child { border-color: var(--line); }
.find-group { color: var(--text-2); font-size: 0.75rem; }

/* View panel (A128): non-modal, docked above the dock's right end. */
.sheet.popover { position: fixed; inset: auto 0.75rem 5.5rem auto; margin: 0; width: min(21rem, calc(100% - 1.5rem)); z-index: 5; }
/* Go to date (A134) opens under the sky clock, beside the button that opened it. */
.sheet.popover.date-popover { inset: 7.75rem auto auto 0.75rem; width: min(17rem, calc(100% - 1.5rem)); }
.date-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; align-items: end; }
.date-form label { display: grid; gap: 0.25rem; font: 0.6875rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.date-form input { width: 100%; color-scheme: dark; }
.date-form .date-note { grid-column: 1 / -1; margin: 0; color: var(--amber); font-size: 0.75rem; min-height: 1.1em; }
.date-form button[type="submit"] { grid-column: 1; }
.date-form button[data-date-copy] { grid-column: 2; }
.view-groups { display: grid; gap: 0.6rem; }
.view-groups > * + * { margin-top: 0 !important; }
.view-group { display: grid; gap: 0.3rem; }
.camera-row { display: grid; grid-template-columns: 1fr 1fr 5.5rem; gap: 0.35rem 0.75rem; align-items: center; }
.camera-row [data-command="sky"] { grid-column: 1 / 3; }
.group-label { font: 0.6875rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.segmented { display: flex; }
.segmented button { flex: 1; }
.segmented button + button { margin-left: -1px; }
.instrument .segmented button[aria-pressed="true"], .sheet .segmented button[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); position: relative; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem 0.75rem; }
/* A switch: its name on the left, a solid track (::after) and a round knob
 * (::before) on the right; amber when on. No gradients (DESIGN.md). */
.sheet button[role="switch"] { position: relative; display: block; border-color: transparent; background: transparent; padding: 0.2rem 2.7rem 0.2rem 0.25rem; text-align: left; }
.sheet button[role="switch"]::after { content: ""; position: absolute; right: 0.25rem; top: 50%; width: 1.9rem; height: 1.05rem; margin-top: -0.525rem; box-sizing: border-box; border-radius: 1rem; border: 1px solid var(--line); background: var(--space); }
.sheet button[role="switch"]::before { content: ""; position: absolute; z-index: 1; right: 1.2rem; top: 50%; width: 0.65rem; height: 0.65rem; margin-top: -0.325rem; border-radius: 50%; background: var(--text-2); transition: right 120ms; }
.sheet button[role="switch"][aria-checked="true"]::after { border-color: var(--amber); background: var(--amber); }
.sheet button[role="switch"][aria-checked="true"]::before { right: 0.45rem; background: var(--space); }
.sheet button[role="switch"]:hover { border-color: var(--line); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin: 0; }
.keys dt { text-align: right; }
.keys dd { text-align: left; }

@media (max-width: 760px) {
  .site-header { padding: 0.5rem 0.75rem; }
  .site-header nav { gap: 0.7rem; }
  html.notebook main { padding: 1.25rem 1rem 2rem; }
  .lessons li { grid-template-columns: 6.5rem minmax(0, 1fr); align-items: start; }
  .lessons .lesson-preview { grid-column: 1; grid-row: 1 / span 3; }
  .lessons strong, .lessons p { grid-column: 2; grid-row: auto; }
  .lessons .button { grid-column: 2; grid-row: auto; justify-self: start; }
  .sheet { width: 100%; max-width: none; margin: auto 0 0; max-height: 75dvh; }
  .sheet.popover, .sheet.popover.date-popover { inset: auto 0 0 0; width: 100%; }
}

@media (max-width: 760px), (max-height: 520px) {
  /* Short landscape screens stack the instrument too: the View panel is a
   * bottom sheet there as well, never a floating box over the stack. */
  .sheet.popover, .sheet.popover.date-popover { inset: auto 0 0 0; width: 100%; max-width: none; max-height: 75dvh; overflow-y: auto; }
  /* Phones and short landscape screens: the panels stop floating over the
   * view and stack around it, so none can cover another. The canvas takes the
   * height left over but never less than 12rem; if the panels still do not
   * fit, the instrument scrolls rather than clipping the dock. The C runtime
   * follows the canvas's CSS size every frame. */
  .instrument { display: flex; flex-direction: column; overflow-y: auto; }
  .instrument > *, .side-panels > * { flex-shrink: 0; }
  .canvas-wrap { position: relative; inset: auto; flex: 1 1 0; min-height: 12rem; order: 3; }
  .hud { position: static; order: 1; padding: 0.4rem 0.5rem; gap: 0; }
  .clock-time { font-size: 1.125rem; }
  .lesson-strip { position: static; order: 2; max-width: none; border-width: 1px 0; padding: 0.4rem 0.5rem; gap: 0.35rem; }
  .lesson-strip input[type="number"] { width: 5rem; }
  .inspector { position: static; order: 4; width: auto; max-height: none; overflow: visible; border-width: 1px 0 0; padding: 0.4rem 0.5rem; font-size: 0.75rem; }
  .inspector dl { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.1rem 0.5rem; margin: 0.2rem 0 0.4rem; }
  /* From Earth (A136) is the last, longest reading: its own row. Its label
   * spans into the flexible column so it never widens the label column. */
  .inspector dt[data-from-earth] { grid-column: 1 / 3; }
  .inspector dd[data-from-earth] { grid-column: 3 / -1; }
  .dock { position: static; order: 5; width: auto; max-width: none; margin: 0; border-width: 1px 0 0; padding: 0.4rem 0.5rem; gap: 0.35rem; align-items: center; }
  .dock label { flex-direction: row; align-items: center; gap: 0.35rem; }
  .dock [data-open-panel="keys-panel"] { display: none; }
  .instrument button, .instrument select, .instrument input { min-height: 2.25rem; padding: 0.2rem 0.45rem; }
}

@media (max-width: 440px) {
  /* Phone-width four-column readings wrap Distance and Period over two
   * lines, and below 360 px split no-break readings ("9.7161 km/s")
   * mid-token: one label/value pair per row reads cleanly instead. */
  .inspector dl { grid-template-columns: auto minmax(0, 1fr); }
  .inspector dt[data-from-earth] { grid-column: 1; }
  .inspector dd[data-from-earth] { grid-column: 2; }
}

@media (max-width: 360px) {
  /* The clock's buttons sit beside the date and the note takes the next
   * line, so Today and Date never split across two rows. */
  .clock { gap: 0 0.5rem; }
  .clock-time { font-size: 0.9375rem; }
  .clock-note { order: 1; }
}

@media (max-width: 400px) {
  .site-header { gap: 0.6rem; }
  .site-header nav { gap: 0.55rem; letter-spacing: 0.02em; }
  .wordmark { font-size: 1.05rem; }
}

/* Landscape phones (A138): stacking left the view 12rem tall and pushed the
   dock below the fold. On a wide, short screen the view keeps the full height
   on the left with the clock over it, as on desktop; the inspector, dock and
   lesson strip form a right column that scrolls on its own. Placed last so it
   overrides the stack; section.instrument because <html> has the class too. */
@media (max-height: 520px) and (min-width: 600px) {
  section.instrument { display: grid; grid-template-columns: minmax(0, 1fr) min(19rem, 42vw); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
  .canvas-wrap { grid-column: 1; grid-row: 1; height: 100%; min-height: 0; }
  .hud { grid-column: 1; grid-row: 1; align-self: start; z-index: 1; padding: 0.4rem 0.6rem; }
  .side-panels { display: flex; flex-direction: column; grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); }
  .clock { gap: 0 0.5rem; }
  .clock-note { order: 1; }
  /* Playback first: Pause and speed are the controls reached for most. */
  .dock { order: 1; border-width: 0 0 1px; }
  .inspector { order: 2; border-width: 0; }
  .inspector dl { grid-template-columns: auto minmax(0, 1fr); }
  .inspector dt[data-from-earth] { grid-column: 1; }
  .inspector dd[data-from-earth] { grid-column: 2; }
  .lesson-strip { order: 3; border-width: 1px 0 0; }
}
