/* rohin.me - design system: base, the frame (top bar, pages, panels) and the reusable pieces (chips, stats,
   buttons, charts, tables). Scene-specific layout lives in scenes.css and scene-<id>.css.

   Two layers. The first part of this file is the structure every colour version shares, and it is also the
   "classic" version as it stands. The last part, "THE LOOK", restyles the frame and the shared pieces for every
   version but classic: square, ruled, three type families with fixed jobs (see tokens.css). css/look.css, loaded
   last, does the same for the pieces that belong to one page.

   THE FRAME. The document never scrolls. <main class="deck"> is exactly one screen (100dvh); every
   <section class="scene"> is a page laid over it, one shown at a time. core.js moves between pages (the dots and
   the index in the top bar, a sideways swipe on touch screens, the arrow and Page keys) and slides them.
   A page is a column: .scene-head (one row: the title, then tools on the right) and .scene-visual (the rest).
   Long content scrolls inside its own panel, never the page. See README.md, "The page model". */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--font); font-optical-sizing: auto; word-spacing: var(--word-gap, normal);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
/* nothing scrolls the document: not a finger, not a link to "#id", not focus */
html.js, html.js body { height: 100%; overflow: hidden; overflow: clip; overscroll-behavior: none; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img, canvas, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
b, strong { font-weight: 600; }
::selection { background: var(--accent-soft); color: var(--ink); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1:focus-visible, h2:focus-visible, h3:focus-visible { outline: none; }

.skip { position: fixed; left: var(--s-4); top: -4rem; z-index: 100; padding: var(--s-2) var(--s-4); background: var(--accent); color: var(--accent-ink); border-radius: var(--r-pill); font-weight: 600; transition: top var(--fast) var(--ease); }
.skip:focus { top: calc(var(--s-3) + var(--safe-t)); }
.num, .stat-num, .chart-tip, .table .num, time { font-variant-numeric: tabular-nums lining-nums; }
.ico { flex: none; }

/* the dust of the soft look: one bitmap, twice the screen tall (the same dots in both halves), slid up by one half for
   ever. Only a transform moves, so the compositor does it alone; core.js stops the drift (data-specks="still") while
   the page shown draws a map or a 3D picture, with reduced motion and in a hidden tab. */
#specks { position: fixed; left: 0; top: 0; width: 100%; height: 200%; max-width: none; z-index: 0; pointer-events: none; will-change: transform; animation: specks-drift 260s linear infinite; }
:root[data-specks="still"] #specks, :root[data-specks="off"] #specks { animation: none; will-change: auto; }
:root[data-specks="off"] #specks { visibility: hidden; }
@keyframes specks-drift { to { transform: translate3d(0, -50%, 0); } }

/* ------------------------------------------------------------ top bar: brand, page dots, index, appearance */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: calc(var(--bar-h) + var(--safe-t));
  padding: var(--safe-t) max(var(--gutter), var(--safe-r)) 0 max(var(--gutter), var(--safe-l));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 70%, color-mix(in srgb, var(--bg) 0%, transparent) 100%);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: var(--tap); font-weight: 600; justify-self: start; padding: 0 .2rem; }
.brand-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); transition: box-shadow var(--med) var(--ease); }
.brand:hover .brand-mark { box-shadow: 0 0 0 7px var(--accent-soft); }

/* The dots. With a mouse each dot is a link. Under a finger the whole strip is one control, 44px tall: touch it and
   slide, the name of the page under the finger shows below, and lifting the finger goes there. */
.rail { position: relative; display: flex; align-items: center; height: var(--tap); touch-action: none; -webkit-user-select: none; user-select: none; }
.rail-dot { position: relative; flex: 0 0 22px; height: var(--tap); display: grid; place-items: center; }
.rail-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-2); opacity: .7; transition: transform var(--med) var(--ease), background var(--med), opacity var(--med), width var(--med) var(--ease); }
.rail-dot[data-current]::before { width: 14px; border-radius: 3px; background: var(--accent); opacity: 1; }
.rail-dot[data-aim]::before { transform: scale(1.7); background: var(--ink); opacity: 1; }
.rail-dot:focus-visible { outline-offset: -8px; }
@media (hover: hover) {
  .rail-dot:hover::before { opacity: 1; transform: scale(1.5); background: var(--ink); }
  .rail-dot[data-current]:hover::before { transform: none; background: var(--accent); }
  .rail-dot::after { content: attr(data-tip); position: absolute; top: 100%; left: 50%; translate: -50% -4px; padding: .2rem .6rem; white-space: nowrap; font-size: var(--t-tiny); color: var(--ink); background: var(--bg-raise); border: 1px solid var(--line-strong); border-radius: var(--r-pill); opacity: 0; pointer-events: none; transition: opacity var(--fast), translate var(--fast) var(--ease); }
  .rail-dot:hover::after, .rail-dot:focus-visible::after { opacity: 1; translate: -50% 0; }
}
.rail-tip { position: absolute; top: calc(100% - 2px); left: 0; translate: -50% 0; padding: .3rem .75rem; white-space: nowrap; font-size: var(--t-small); font-weight: 500; color: var(--accent-ink); background: var(--accent); border-radius: var(--r-pill); pointer-events: none; z-index: 2; }

.bar-end { justify-self: end; display: flex; align-items: center; gap: var(--s-2); }
.index-btn, .look-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: var(--tap); min-width: var(--tap); padding: 0 .9rem 0 .75rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); font-size: var(--t-small); font-weight: 500; backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease); }
.index-btn:hover, .look-btn:hover { border-color: var(--line-strong); }
.index-btn:active, .look-btn:active { transform: scale(.97); }
.index-now { color: var(--ink-2); max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.look-btn { gap: .2rem; padding: 0 .55rem 0 .7rem; color: var(--ink-2); }
.look-dot { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--accent) 0 50%, var(--ink) 50% 100%); box-shadow: 0 0 0 1px var(--line-strong); }
.theme { display: inline-flex; padding: 1px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.theme button { min-width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: var(--r-pill); color: var(--ink-2); font-size: var(--t-small); font-weight: 500; transition: color var(--fast), background var(--fast), transform var(--fast) var(--ease); }
.theme button:hover { color: var(--ink); }
.theme button:active { transform: scale(.94); }
.theme button[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 13%, transparent); }
.theme-menu { display: none; }
.theme-menu button { flex: 1 1 0; min-width: 0; height: var(--tap); padding: 0 .4rem; gap: .3rem; }   /* three equal parts of the colour menu: never wider than it (the menu showed a sideways scrollbar under 900px, 11-14) */

/* the two menus that drop from the bar: the index and the colours */
.bar-panel { position: absolute; top: calc(100% - .25rem); right: max(var(--gutter), var(--safe-r)); width: min(21rem, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - var(--bar-h) - var(--safe-t) - var(--safe-b) - .75rem); max-height: calc(100dvh - var(--bar-h) - var(--safe-t) - var(--safe-b) - .75rem); overflow-y: auto; overscroll-behavior: contain; padding: var(--s-2); border-radius: var(--r-3); border: 1px solid var(--line-strong); background: var(--bg-raise); box-shadow: var(--shadow); animation: drop var(--med) var(--ease); }
.index-panel a, .index-sources, .look-list button { display: flex; align-items: center; gap: .85rem; width: 100%; min-height: var(--tap); padding: 0 .8rem; border-radius: var(--r-2); color: var(--ink-2); text-align: left; font-size: var(--t-body); transition: background var(--fast), color var(--fast); }
.index-panel a:hover, .index-sources:hover, .look-list button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.index-panel a[data-current] { color: var(--ink); background: var(--accent-soft); }
.index-panel a[data-current] .num { color: var(--ink); }
.index-panel .num { font-size: var(--t-tiny); color: var(--ink-3); min-width: 1.4rem; }
/* the index is the table of contents: each page's name, and under it what it is in a word or two */
.index-panel a { min-height: 3.25rem; padding-block: .3rem; }
.ix-name { display: grid; gap: .05rem; min-width: 0; line-height: 1.25; }
.ix-what { font-size: var(--t-tiny); color: var(--ink-3); font-family: var(--font-body, inherit); text-transform: none; letter-spacing: 0; }
.index-panel a[data-current] .ix-what, .index-panel a:hover .ix-what { color: var(--ink-2); }
.index-caret { display: none; }
/* a short screen (a small phone, a phone on its side): the label sits beside the name, one row per page; the list scrolls if it must */
@media (max-height: 700px) { .index-panel a { min-height: var(--tap); padding-block: 0; } .ix-name { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: .55rem; } }
.index-sources { margin-top: var(--s-1); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-2) var(--r-2); font-size: var(--t-small); }
.index-sources .ico { color: var(--ink-3); }
.look-panel { width: min(15rem, calc(100vw - 2 * var(--gutter))); display: grid; gap: var(--s-2); }
.look-list { display: grid; }
.look-list button[aria-pressed="true"] { color: var(--ink); background: var(--accent-soft); }
.swatch { flex: none; width: 2.5rem; height: 1.5rem; border-radius: var(--r-pill); background: var(--bg); border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); display: flex; align-items: center; justify-content: center; gap: 4px; }
.swatch i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.swatch i + i { background: var(--accent); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scale(.985); } }

/* tablets upright and phones: the dots take the middle, the index is its icon, light / dark moves into the colour menu */
@media (max-width: 900px) {
  .bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-2); }
  .rail { justify-content: center; min-width: 0; }
  .rail-dot { flex: 1 1 0; min-width: 0; max-width: 22px; }
  /* phones: the index is a small round ≡ again (Rohin 11-16, "this is pretty bulky"): the page's name is already the
     title under it; its aria-label still says "Index, <page>" */
  .index-word, .index-now, .index-caret { display: none; }
  .index-ico { display: inline-flex; }
  .index-btn { width: var(--tap); min-width: var(--tap); padding: 0; justify-content: center; gap: 0; }
  .theme-bar { display: none; }
  .theme-menu { display: flex; }
  .bar-end { gap: .375rem; }
}
@media (max-width: 420px) { .brand { gap: .45rem; } .look-btn { padding: 0 .3rem 0 .45rem; } }
/* phones: the page's name takes the room the ≡ had; the colour button is its mark alone and the current dot is a little
   shorter, so twelve dots still sit apart */
@media (max-width: 520px) {
  .bar { gap: .375rem; }
  .look-btn { width: var(--tap); padding: 0; }
  .look-btn .ico { display: none; }
  .rail-dot[data-current]::before { width: 10px; }
}
/* the narrowest phones: the brand is its mark (still "Rohin, first page" to a screen reader), so the dots keep their room */
@media (max-width: 380px) { .brand > span { display: none; } .brand { min-width: var(--tap); justify-content: center; } }
/* 320px (the first iPhone SE): everything in the bar a little tighter, the title row's own buttons too */
@media (max-width: 340px) {
  .bar { gap: .25rem; }
  .bar-end { gap: .25rem; }
  .rail-dot[data-current]::before { width: 8px; }
  .scene-head { gap: var(--s-1, .25rem); }
  .scene-head h1, .scene-head h2 { font-size: calc(var(--t-display) * .78); }
  .scene-tools { gap: .25rem; }
  .data-btn { padding: 0 .8rem; }
  .data-btn .ico { display: none; }
  .scene-tools .btn { padding-inline: .6rem; }
  .scene-tools .seg button { padding-inline: .45rem; white-space: nowrap; }
}

/* ------------------------------------------------------------ the deck and its pages */
.deck { position: relative; z-index: 1; }
.js .deck { position: fixed; inset: 0 0 auto 0; height: 100vh; height: 100dvh; overflow: hidden; overflow: clip; touch-action: pan-y pinch-zoom; }
/* A panel that scrolls up and down inside a page hands sideways drags to the frame, like the rest of the page. Without this the
   browser keeps every drag that starts in it (a scroll container answers for its own touch-action), and the page cannot be swiped from a list. */
.ow-list, .ow-detail, .sc-list, .sc-card, .sf-list, .sf-card-body, .machine-side, .bird-rows, .cty-list, .cty-card, .hike-pane, .hk-data-body, .sig-side, .sig.is-flat .sig-bands { touch-action: pan-y pinch-zoom; }
.scene { position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: calc(var(--bar-h) + var(--safe-t) + var(--s-1)) max(var(--gutter), var(--safe-r)) max(var(--s-3), var(--safe-b)) max(var(--gutter), var(--safe-l)); }
.js .scene { position: absolute; inset: 0; overflow: hidden; overflow: clip; visibility: hidden; }
.js .scene[data-current], .js .scene[data-show] { visibility: visible; }
.js .scene[data-show] { will-change: transform; }
.js .scene:not([data-current]) *, .js .scene:not([data-current]) *::before, .js .scene:not([data-current]) *::after { animation-play-state: paused !important; }
.scene-inner { position: relative; flex: 1; min-height: 0; width: 100%; max-width: var(--wide); margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-2); }
.scene-head { flex: none; display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); min-width: 0; }
h1, h2 { font-family: var(--font-head); font-size: var(--t-display); font-weight: var(--title-weight); letter-spacing: var(--title-track); line-height: var(--title-lh); text-transform: var(--title-case); color: var(--title-ink); white-space: nowrap; }
h3 { font-size: var(--sub-size); font-weight: 600; line-height: 1.3; }
.scene-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.scene-visual { position: relative; flex: 1; min-height: 0; min-width: 0; }
/* a screen too short for a page (a phone on its side): the page's own area scrolls, the document still does not */
@media (max-height: 520px) { .js .scene-visual { overflow-y: auto; overscroll-behavior: contain; } }
/* a feed that is not live: one short label in the page's tools */
.feed-note { flex: none; display: inline-flex; align-items: center; gap: .45rem; min-height: 2rem; padding: 0 .8rem; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--glass); font-size: var(--t-small); color: var(--ink-2); white-space: nowrap; }
.feed-note::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c-warn); }
.feed-note[data-state="demo"]::before { background: var(--c-quiet); }      /* a sample is calm: it is not a fault */
/* the shared empty word */
.none { font-size: var(--t-small); color: var(--ink-2); }
/* one way back: "‹ Where-you-go" at the left of the row under the title (core.js backButton) */
.back-btn { flex: none; gap: .2rem; min-height: var(--tap); padding: 0 1rem 0 .6rem; white-space: nowrap; }
.back-btn .ico { color: var(--accent); }
.back-btn[hidden] { display: none; }
/* loading: a soft, still shape where the picture will be, never a blank picture with its buttons. Until a page's code has
   drawn it (data-ready), its picture's box holds a quiet wash; a real map holds one over itself until its first full
   frame (data-map="on"), and its zoom buttons wait with it. No spinner, no motion. */
.js .scene:not([data-ready]) [data-visual]:not(:has(> .feed-note))::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: var(--r-3); pointer-events: none;
  background: radial-gradient(70% 55% at 38% 42%, color-mix(in srgb, var(--ink) 5%, transparent), transparent 70%), color-mix(in srgb, var(--ink) 3%, transparent); }
.js .scene-opening:not([data-ready]) [data-visual]::before { border-radius: 0; background: radial-gradient(60% 45% at 45% 40%, color-mix(in srgb, var(--map-water) 70%, transparent), transparent 72%), var(--map-land); }
.rmap::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity var(--med) var(--ease); background: radial-gradient(60% 45% at 45% 40%, color-mix(in srgb, var(--map-water) 70%, transparent), transparent 72%), var(--map-land); }
.rmap:not([data-map="on"])::after { opacity: 1; transition: none; }
:has(> .rmap:not([data-map="on"])) > .rmap-zoom { visibility: hidden; }
/* the narrowest phones: the note gives way (it is cut short) so the title and the page's own buttons stay on the page */
@media (max-width: 400px) {
  .scene-head { gap: var(--s-2); }
  .feed-note:not([hidden]) { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 0 .65rem; line-height: calc(2rem - 2px); }
  .feed-note::before { display: inline-block; margin-right: .4rem; vertical-align: .08em; }
}
.side-title { font-size: var(--t-small); font-weight: 500; color: var(--ink-2); }

/* "Data": a button in the page's tools; the panel lies over the page and scrolls inside itself */
.data-btn { flex: none; min-height: var(--tap); padding: 0 1.1rem 0 .85rem; }
.data-btn .ico, .data-close .ico, .sheet-close .ico { color: var(--accent); }
.data-panel { position: absolute; inset: 0; z-index: 6; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-3); border: 1px solid var(--line-strong); background: var(--bg-raise); box-shadow: var(--shadow); animation: drop var(--med) var(--ease); }
.data-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.data-panel-head h3 { font-family: var(--font-title); font-size: 1.125rem; }
.data-close { min-height: var(--tap); padding: 0 1.1rem 0 .85rem; }
.data-panel-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); align-content: start; padding: 1px .3rem 1px 1px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.data-block { min-width: 0; padding: var(--s-4); border-radius: var(--r-2); border: 1px solid var(--line); background: var(--glass); display: grid; gap: var(--s-3); align-content: start; }
.data-block.span-2 { grid-column: span 2; }
.data-block.span-all { grid-column: 1 / -1; }
.data-block > h3 { color: var(--ink); }
.data-block p { color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; max-width: 40rem; }
@media (max-width: 720px) { .data-block.span-2 { grid-column: auto; } .data-panel { padding: var(--s-3); border-radius: var(--r-2); } .data-block { padding: var(--s-3); } }

/* a sheet (<dialog class="sheet">): centred on wide screens, up from the bottom edge on phones */
.sheet { width: min(34rem, calc(100vw - 2 * var(--gutter))); max-height: min(44rem, 88vh); max-height: min(44rem, 88dvh); padding: var(--s-4) var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--r-3); background: var(--bg-raise); color: var(--ink); box-shadow: var(--shadow); overflow-y: auto; overscroll-behavior: contain; }
.sheet[open] { display: grid; gap: var(--s-3); align-content: start; animation: drop var(--med) var(--ease); }
.sheet::backdrop { background: var(--shade); }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.sheet-top h3 { font-family: var(--font-title); font-size: 1.125rem; }
.sheet-close { min-height: var(--tap); padding: 0 1.1rem 0 .85rem; }
.sources div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--s-3); padding: .6rem 0; border-top: 1px solid var(--line); font-size: var(--t-small); }
.sources dt { color: var(--ink-2); }
.sources dd { color: var(--ink); }
.sources a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .2em; }
@media (max-width: 720px) {
  .sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: none; margin: 0; padding: var(--s-4) max(var(--gutter), var(--safe-r)) calc(var(--s-4) + var(--safe-b)) max(var(--gutter), var(--safe-l)); border: 0; border-top: 1px solid var(--line-strong); border-radius: var(--r-3) var(--r-3) 0 0; }
  .sheet[open] { animation: sheet-up var(--med) var(--ease); }
  .sources div { grid-template-columns: 7rem minmax(0, 1fr); }
}
@keyframes sheet-up { from { transform: translateY(18%); opacity: 0; } }

/* without scripts: the pages are a plain list of titles, one under the other */
html:not(.js) .scene { min-height: 0; padding-top: var(--s-5); padding-bottom: var(--s-5); }
html:not(.js) .scene:first-of-type { padding-top: calc(var(--bar-h) + var(--s-5)); }
html:not(.js) .rail, html:not(.js) .bar-end { display: none; }
.noscript { position: relative; z-index: 2; padding: var(--s-4) var(--gutter); color: var(--ink-2); }

/* ------------------------------------------------------------ glass, chips, buttons, segmented control */
.glass { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--glass); backdrop-filter: blur(var(--blur)) saturate(1.2); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2); box-shadow: var(--shadow); }
.lift { transition: transform var(--med) var(--ease), border-color var(--med), background var(--med); }
@media (hover: hover) { .lift:hover { transform: translateY(-2px); border-color: var(--line-strong); } }
.lift:active { transform: scale(.985); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.25rem; padding: .4rem .85rem .4rem .7rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); font-size: var(--t-small); color: var(--ink-2); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.chip b { color: var(--ink); font-weight: 600; }
.chip .ico { color: var(--ink-3); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: 0 1.2rem; border-radius: var(--r-pill); font-weight: 600; font-size: var(--t-small); background: var(--ink); color: var(--ink-inverse); transition: transform var(--fast) var(--ease), opacity var(--fast), box-shadow var(--med); }
.btn:hover { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ink) 10%, transparent); }
.btn:active { transform: scale(.96); }
.btn-quiet { background: var(--glass); color: var(--ink); border: 1px solid var(--line); font-weight: 500; backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.btn-quiet:hover { border-color: var(--line-strong); box-shadow: none; }
.link { color: var(--ink); border-bottom: 1px solid var(--line-strong); transition: border-color var(--fast), color var(--fast); }
.link:hover { border-color: var(--accent); color: var(--accent); }

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--glass); }
.seg button { min-height: var(--tap); padding: 0 .95rem; border-radius: var(--r-pill); font-size: var(--t-small); font-weight: 500; color: var(--ink-2); transition: color var(--fast), background var(--med) var(--ease), transform var(--fast) var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 12%, transparent); }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-good) 60%, transparent); animation: live 2.6s var(--ease-in-out) infinite; flex: none; }
.live-dot[data-state="stale"], .live-dot[data-state="demo"], .live-dot[data-state="down"] { background: var(--ink-3); animation: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

/* ------------------------------------------------------------ stats: big confident numbers */
.stats { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.stat { display: grid; gap: .15rem; align-content: start; padding: var(--s-4) var(--s-4) var(--s-4); border-radius: var(--r-2); border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); min-width: 0; }
.stat-num { font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.125rem); font-weight: 600; line-height: 1.15; color: var(--ink); }
.stat-big .stat-num { font-size: var(--t-big); }
.stat-label { font-size: var(--t-small); color: var(--ink-2); line-height: 1.35; }
.stat-sub { font-size: var(--t-tiny); color: var(--ink-3); line-height: 1.4; margin-top: .15rem; }

/* ------------------------------------------------------------ charts */
.chart { display: grid; gap: .45rem; min-width: 0; }
.chart-title { font-size: var(--t-small); color: var(--ink-2) !important; }
.chart-plot { position: relative; border-radius: var(--r-1); touch-action: pan-y; /* a finger runs along the chart; the page does not swipe from here (core.js) */ cursor: crosshair; border-bottom: 1px solid var(--line-strong); }
.chart-plot:focus-visible { outline-offset: 6px; }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-svg .bar { opacity: .8; transition: opacity var(--fast); }
.chart-plot:hover .bar, .chart-plot:focus .bar { opacity: .45; }
.chart-svg .bar.is-on { opacity: 1 !important; }
.chart-svg .bar.is-mark { opacity: 1; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { opacity: .13; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-max { position: absolute; top: -.2rem; right: 0; font-size: .6875rem; color: var(--ink-3); pointer-events: none; }
.chart-hair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-strong); pointer-events: none; }
.chart-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-raise); pointer-events: none; }
.chart-tip { position: absolute; bottom: calc(100% + 6px); translate: -50% 0; z-index: 3; display: grid; gap: .1rem; min-width: 7rem; padding: .45rem .7rem; border-radius: var(--r-2); border: 1px solid var(--line-strong); background: var(--glass-strong); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); font-size: var(--t-tiny); color: var(--ink-2); pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.tip-head { color: var(--ink-3); }
.tip-row { display: flex; align-items: center; gap: .4rem; }
.tip-row b { color: var(--ink); font-size: var(--t-small); }
.tip-key { width: 10px; height: 2px; border-radius: 2px; flex: none; }
.chart-ticks { position: relative; height: 1.1rem; font-size: .6875rem; color: var(--ink-3); }
.chart-ticks span { position: absolute; translate: -50% 0; white-space: nowrap; }
.chart-ticks span:first-child { translate: 0 0; left: 0 !important; }
.chart-ticks span:last-child { translate: -100% 0; left: 100% !important; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: var(--t-tiny); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.key-line { width: 14px; height: 2px; border-radius: 2px; }
.key-dot { width: 8px; height: 8px; border-radius: 50%; }

.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--s-2)); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.table caption { text-align: left; color: var(--ink-3); font-size: var(--t-tiny); padding: 0 var(--s-2) var(--s-2); }
.table th, .table td { padding: .5rem var(--s-2); text-align: left; border-bottom: 1px solid var(--line); font-weight: 400; color: var(--ink-2); overflow-wrap: anywhere; }
.table .num, .table td:has(> time) { white-space: nowrap; overflow-wrap: normal; }
.table tbody th { overflow-wrap: break-word; }   /* a row name (a time, a word) keeps its words whole */
.table thead th { overflow-wrap: normal; hyphens: auto; }   /* words wrap inside their cell, so a table is never wider than its panel (11-14: no sideways scrollbars) */
@media (max-width: 520px) { .table th, .table td { padding-left: .3rem; padding-right: .3rem; } .table thead th { overflow-wrap: anywhere; } }   /* many columns on a phone: tighter, and a long label may break */
.table thead th { color: var(--ink-3); font-size: var(--t-tiny); font-weight: 500; }
.table tbody th { color: var(--ink); }
.table .num { text-align: right; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }

/* =====================================================================================================
   THE LOOK: every colour version but "classic". No pills, no glass, no shadows, no boxed tiles. A block is set off
   by a rule over it and by space; a control is a word in small capitals in a plain rectangle; what is on is
   underlined or filled; numbers are in the monospace; names in --font-title. Sizes and faces come from the role
   tokens, which differ between light (almanac) and dark (instrument), so the two modes are not one design recoloured.
   Small capitals: classes below set --ls (letter-spacing) rather than letter-spacing; look.css applies it.
   ===================================================================================================== */
:root:not([data-palette="classic"]) {
  & body { font-feature-settings: normal; font-synthesis: style; line-height: 1.5; }      /* no made-up bold: the weights are 400, 600 (and 500 in the monospace) */
  & #specks { display: none; }
  & :focus-visible { border-radius: 0; outline-offset: 2px; }
  & b, & strong { font-weight: 600; }
  .skip { border-radius: 0; }
  .num, .stat-num, .chart-tip b, .chart-max, .table .num, time { font-family: var(--font-num); word-spacing: var(--num-space); }

  /* ---- top bar: the name, a ruler of pages, two quiet buttons */
  .brand { gap: .55rem; font-family: var(--font-head); font-size: var(--brand-size); font-weight: var(--brand-weight); text-transform: var(--title-case); --ls: var(--title-track); }
  .brand-mark { width: 8px; height: 8px; border-radius: 0; box-shadow: none; transition: transform var(--med) var(--ease); }
  .brand:hover .brand-mark { box-shadow: none; transform: rotate(45deg); }
  .rail-dot::before { width: 1px; height: 9px; border-radius: 0; background: var(--ink-3); opacity: 1; transition: height var(--med) var(--ease), background var(--med); }
  .rail-dot[data-current]::before { width: 2px; height: 17px; border-radius: 0; background: var(--accent); }
  .rail-dot[data-aim]::before { transform: none; height: 17px; background: var(--ink); }
  @media (hover: hover) {
    .rail-dot:hover::before { transform: none; height: 17px; background: var(--ink); }
    .rail-dot[data-current]:hover::before { background: var(--accent); }
    .rail-dot::after { padding: .25rem .55rem; border-radius: 0; border: 1px solid var(--rule); background: var(--bg-raise); font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); }
  }
  .rail-tip { border-radius: 0; padding: .3rem .6rem; background: var(--on); color: var(--on-ink); font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); }
  .index-btn, .look-btn { border: 0; border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); }
  .index-btn:hover, .look-btn:hover { color: var(--accent); }
  .index-btn:active, .look-btn:active { transform: none; }
  .index-btn[aria-expanded="true"], .look-btn[aria-expanded="true"] { background: var(--on); color: var(--on-ink); }
  .index-btn[aria-expanded="true"] .index-now { color: inherit; }
  .index-now { font-family: var(--font-num); text-transform: none; --ls: 0em; font-weight: 400; }
  .look-dot { width: 13px; height: 13px; border-radius: 0; box-shadow: none; outline: 1px solid var(--line-strong); outline-offset: 1px; }
  .theme { padding: 0; border: 0; border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .theme button { border-radius: 0; border-bottom: 2px solid transparent; font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); }
  .theme button:active { transform: none; }
  .theme button[aria-pressed="true"] { background: none; border-bottom-color: var(--on); }
  .bar-panel { padding: 0 var(--s-4) var(--s-2); border-radius: 0; border: 1px solid var(--rule); background: var(--bg-raise); box-shadow: none; }
  .index-panel a, .index-sources, .look-list button { gap: .9rem; padding: 0; border-radius: 0; border-top: 1px solid var(--line); color: var(--ink); }
  .index-panel li:first-child a, .look-list button:first-child { border-top: 0; }
  .index-panel a { font-family: var(--font-title); font-size: calc(1.0625rem * var(--name-scale)); }
  .index-panel a:hover, .index-sources:hover, .look-list button:hover { background: none; color: var(--accent); }
  .index-panel a[data-current] { background: none; color: var(--accent); }
  .index-panel .num { font-size: var(--t-tiny); color: var(--ink-3); min-width: 1.5rem; }
  .index-panel a[data-current] .num { color: var(--accent); }
  .index-sources { margin-top: 0; border-top: 1px solid var(--rule); border-radius: 0; font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); }
  .look-panel { gap: 0; width: min(17rem, calc(100vw - 2 * var(--gutter))); }
  .theme-menu button { padding: 0 .2rem; gap: .35rem; }
  .look-list button { font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); }
  .look-list button[aria-pressed="true"] { background: none; color: var(--ink); }
  .look-list button[aria-pressed="true"]::after { content: ''; margin-left: auto; width: 8px; height: 8px; background: var(--accent); }
  .theme-menu { border-bottom: 1px solid var(--rule); }
  .swatch { width: 2.25rem; height: 1.375rem; border-radius: 0; border: 1px solid color-mix(in srgb, var(--ink) 45%, transparent); gap: 3px; }
  .swatch i { width: 7px; height: 7px; border-radius: 0; }

  /* ---- a page: the title stands on a rule, tools at its right end */
  .scene-head { align-items: flex-end; min-height: calc(max(var(--tap), var(--title-size) * var(--title-lh)) + var(--head-pad) + var(--rule-w)); padding-bottom: var(--head-pad); border-bottom: var(--rule-w) solid var(--rule); }
  & h1, & h2 { --ls: var(--title-track); letter-spacing: var(--title-track); }
  & h3 { font-family: var(--sub-font); font-size: var(--sub-size); font-weight: var(--sub-weight); text-transform: var(--sub-case); --ls: var(--sub-track); line-height: 1.25; }
  .scene-tools { align-items: center; }
  .feed-note { min-height: 2rem; padding: 0; border: 0; border-radius: 0; background: none; font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); }
  .feed-note::before { border-radius: 0; }
  @media (max-width: 420px) { .scene-head { gap: var(--s-2); } .feed-note { --ls: .03em; gap: .35rem; } }
  /* the narrowest phones, a long title in capitals and the Data button: the note gives way (it is cut with three dots) and the button stays on the page */
  @media (max-width: 380px) { .feed-note:not([hidden]) { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: 2rem; } .feed-note::before { display: inline-block; margin-right: .35rem; vertical-align: .05em; } }
  .side-title { font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); }
  .data-panel { padding: var(--s-3) 0 0; border: 0; border-radius: 0; background: var(--bg); box-shadow: none; }
  .data-panel-head h3, .sheet-top h3 { font-family: var(--font-title); font-size: calc(1.375rem * var(--name-scale)); font-weight: var(--name-weight); text-transform: none; --ls: 0em; }
  .data-panel-body { gap: var(--s-5) var(--s-6); padding: 0 .3rem 0 0; }
  .data-block { padding: var(--s-3) 0 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; }
  .sheet { border: 1px solid var(--rule); border-radius: 0; box-shadow: none; }
  .sources dt { font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); padding-top: .2em; }
  @media (max-width: 720px) {
    .data-panel { padding: var(--s-2) 0 0; border-radius: 0; }
    .data-block { padding: var(--s-3) 0 0; }
    .sheet { border: 0; border-top: var(--rule-w) solid var(--rule); border-radius: 0; }
  }

  /* ---- blocks, labels, buttons, tabs */
  .glass { border: 0; border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
  @media (hover: hover) { .lift:hover { transform: none; } }
  .lift:active { transform: none; }
  .chips { gap: .1rem var(--s-4); }
  .chip { min-height: 2rem; padding: 0 0 0 .6rem; border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .btn { border-radius: 0; background: var(--on); color: var(--on-ink); font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); transition: opacity var(--fast); }
  .btn:hover { box-shadow: none; opacity: .86; }
  .btn:active { transform: none; opacity: .7; }
  .btn-quiet { background: none; color: var(--ink); border: 1px solid var(--line-strong); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .btn-quiet:hover { border-color: var(--ink); opacity: 1; }
  .data-btn .ico, .data-close .ico, .sheet-close .ico { color: currentColor; }
  .link { border-bottom: 1px solid var(--line-strong); }
  .seg { padding: 0; gap: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
  .seg button { padding: 0 .8rem; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: var(--font-label); font-size: .75rem; font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); }
  .seg button:active { transform: none; }
  .seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: none; color: var(--ink); border-bottom-color: var(--on); }
  .live-dot { width: 6px; height: 6px; border-radius: 0; box-shadow: none; animation: none; }

  /* ---- numbers: a label in small capitals over a figure in the monospace, a rule over each */
  .stats { gap: var(--s-3) var(--s-5); }
  .stat { gap: 0; padding: .45rem 0 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .stat-num { font-weight: var(--num-weight); --ls: 0em; line-height: 1.3; }
  .stat-label { order: -1; font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); line-height: 1.4; }
  .stat-sub { margin-top: 0; }

  /* ---- charts and tables */
  .chart-title { font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); }
  .chart-plot { border-radius: 0; }
  .chart-svg .line { stroke-width: 1.5; stroke-linejoin: miter; stroke-linecap: butt; }
  .chart-dot { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 0; box-shadow: 0 0 0 1px var(--bg); }
  .chart-tip { padding: .4rem .6rem; border-radius: 0; border: 1px solid var(--rule); background: var(--bg-raise); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
  .tip-key, .key-line { border-radius: 0; }
  .key-dot { border-radius: 0; }
  .table thead th { font-family: var(--font-label); font-size: var(--label-size); font-weight: var(--label-weight); text-transform: var(--label-case); --ls: var(--label-track); color: var(--ink-2); border-bottom: 1px solid var(--rule); }
  .table tbody th { font-weight: 400; }
}

/* ------------------------------------------------------------ less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
/* ?motion=0 (and the tests): the same as the system "reduce motion" setting */
.still *, .still *::before, .still *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
@media (forced-colors: active) { .glass, .stat, .chip, .data-block { border: 1px solid CanvasText; } }

/* ---------------------------------------------------------------- the shared map (js/map.js) */
.rmap { position: relative; overflow: hidden; touch-action: none; background: var(--map-water); -webkit-tap-highlight-color: transparent; }
.rmap-stage { position: absolute; inset: 0; background-size: cover; background-position: center; }
.rmap .maplibregl-canvas-container { position: absolute; inset: 0; cursor: grab; user-select: none; -webkit-user-select: none; }
.rmap .maplibregl-canvas-container:active { cursor: grabbing; }
.rmap .maplibregl-canvas { position: absolute; left: 0; top: 0; touch-action: none; outline: none; }
.rmap .maplibregl-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.rmap .maplibregl-marker { position: absolute; top: 0; left: 0; will-change: transform; }
.rmap .maplibregl-control-container { display: none; }
/* the one control stack of every map and 3D view (js/hands.js, js/map.js buttons()): + - tilt home, top right. The Tilt button
   is also a handle: dragged, it turns and tilts the view. Home shows only once the view has moved */
.v3-turn { touch-action: none; cursor: grab; }
.v3-turn.is-drag { cursor: grabbing; color: var(--accent); }
.v3-home[hidden] { display: none; }
/* the compass of the stack (round 27): the needle points where north is on the screen; north half in the accent, the
   south half quiet; a drag turns and tilts, a click: north and flat (js/hands.js compassButton) */
.v3-compass .v3-ring { fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .35; }
.v3-compass .v3-north { fill: var(--accent); }
.v3-compass .v3-south { fill: currentColor; opacity: .45; }
.v3-compass .v3-needle-g { transition: transform var(--fast) linear; }
/* the hint, once per visitor with a mouse: low in the middle of the map (clear of the title shade, the stack and the panel), soft, gone after 4 s or at the first turn */
.v3-hint { position: absolute; z-index: 4; left: 50%; top: 58%; transform: translateX(-50%); padding: .35rem .8rem; border-radius: var(--r-pill);
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font-size: var(--t-small); white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); transition: opacity var(--med) var(--ease); }
.v3-hint.is-out { opacity: 0; }
.v3-stack { position: absolute; z-index: 3; right: var(--s-2); top: var(--s-2); }
.rmap-credit { position: absolute; right: var(--s-2); bottom: var(--s-1); z-index: 1; font-size: var(--t-tiny); color: var(--ink-3); padding: 0 .4rem; border-radius: var(--r-1); background: color-mix(in srgb, var(--map-land) 70%, transparent); pointer-events: none; }
