/* Hades: an underground network for the useful internet.
   Each subject is a line with a lettered bullet; each section is a stop along it.
   Colour identifies lines and nothing else. Shape rule: identity marks are circles, selectable chips are pills,
   everything else uses the 10px radius (dialogs 16px). One family (Overpass) plus its mono for counts. */

@font-face { font-family: "Overpass"; src: url("/fonts/overpass-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Overpass Mono"; src: url("/fonts/overpass-mono-latin-wght.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: dark light;
  --ground: #FBFBFA; --panel: #FFFFFF; --hover: #F0F2EF; --press: #E6E9E5;
  --ink: #131619; --muted: #545C65; --rule: #E1E4E0; --rule-strong: #C9CDC8; --edge: #7C848C;
  --plate: #FFFFFF; --scrim: rgb(19 22 25 / .32);
  --shadow: 0 1px 2px rgb(19 22 25 / .06), 0 24px 48px -16px rgb(19 22 25 / .28);
  --line-learning: #1F5FBF; --line-design: #C42F66; --line-coding: #157A47; --line-audio: #6A45B5; --line-video: #C4461C;
  --line-productivity: #EDB111; --line-utilities: #5D6873; --line-careers: #8A5528; --line-life: #0D7F80; --line-explore: #8CBF2A;
  --on-light-line: #FFFFFF; --on-bright-line: #131619; --bright-edge: rgb(19 22 25 / .3);
  --brand-accent: #28658D;
  --sans: "Overpass", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Overpass Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --max: 1400px; --pad: 32px; --search-h: 76px;
}
:root[data-theme=light] { color-scheme: light; }
/* Dark is the default for every first visit, whatever the system theme; light applies only when chosen. */
:root:not([data-theme=light]) {
  color-scheme: dark;
  --ground: #0F1113; --panel: #171A1D; --hover: #1D2125; --press: #252A2F;
  --ink: #EEF0EC; --muted: #A3ABB3; --rule: #23282D; --rule-strong: #343A40; --edge: #7A838C;
  --plate: #F4F5F2; --scrim: rgb(0 0 0 / .55);
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 24px 48px -16px rgb(0 0 0 / .7);
  --line-learning: #5B93E8; --line-design: #EC6A97; --line-coding: #3FB77A; --line-audio: #9B7BE0; --line-video: #EE7A4E;
  --line-productivity: #EDB111; --line-utilities: #8F9BA6; --line-careers: #C28A57; --line-life: #35B5B2; --line-explore: #9ED13B;
  --on-light-line: #0F1113; --bright-edge: transparent;
  --brand-accent: #A6D2F5;
}

/* Line identity. Unknown subjects (added later in the Sheet) fall back to a neutral grey line. */
[data-line] { --line: var(--line-utilities); --on-line: var(--on-light-line); --line-edge: transparent; }
[data-line=learning] { --line: var(--line-learning); }
[data-line=design] { --line: var(--line-design); }
[data-line=coding] { --line: var(--line-coding); }
[data-line=audio] { --line: var(--line-audio); }
[data-line=video] { --line: var(--line-video); }
[data-line=productivity] { --line: var(--line-productivity); --on-line: var(--on-bright-line); --line-edge: var(--bright-edge); }
[data-line=utilities] { --line: var(--line-utilities); }
[data-line=careers] { --line: var(--line-careers); }
[data-line=life] { --line: var(--line-life); }
[data-line=explore] { --line: var(--line-explore); --on-line: var(--on-bright-line); --line-edge: var(--bright-edge); }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--search-h) + 64px); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: var(--ink); color: var(--ground); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 50; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--ground); font-weight: 700; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.count { font: 500 .8125rem/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }

/* Identity marks */
.bullet { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line); color: var(--on-line); box-shadow: inset 0 0 0 1px var(--line-edge); font: 800 .9375rem/1 var(--sans); padding-top: .12em; }
.bullet--lg { width: 40px; height: 40px; font-size: 1.25rem; }
.bullet--sm { width: 22px; height: 22px; font-size: .75rem; }
.bullet--brand { background: var(--ink); color: var(--ground); box-shadow: none; }
.bullet--all { background: var(--ink); color: var(--ground); box-shadow: none; }
/* Taxonomy pictograms (handoff taxonomy-icons.mjs): outline subject icons inside badges, section icons beside labels. */
.taxonomy-icon { display: inline-block; width: 1.25rem; height: 1.25rem; flex: none; vertical-align: middle; }
.taxonomy-icon--sub { width: 1.125rem; height: 1.125rem; }
.bullet:has(.taxonomy-icon) { padding: 0; }
.bullet .taxonomy-icon { width: 58%; height: 58%; stroke-width: 1.9; }
.bullet--lg .taxonomy-icon { stroke-width: 1.7; }
.stop { flex: none; display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--ground); border: 3px solid var(--line); box-shadow: 0 0 0 1px var(--line-edge); }

/* Controls */
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ink); transition: background-color .15s; }
.text-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: .9375rem; transition: background-color .15s; }
.icon-button:hover, .text-button:hover { background: var(--hover); }
.icon-button:active, .text-button:active { background: var(--press); }
.text-link { font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.text-link:hover { text-decoration-thickness: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; background: var(--ink); color: var(--ground); font-weight: 700; transition: transform .12s var(--ease-out); }
.button:active { transform: scale(.98); }
.button--quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule-strong); }
.button--quiet:hover { background: var(--hover); }
.theme-icon--moon { display: none; }
:root[data-theme=light] .theme-icon--moon { display: block; }
:root[data-theme=light] .theme-icon--sun { display: none; }

/* Masthead */
.topbar { max-width: var(--max); margin: 0 auto; padding: 16px var(--pad) 0; display: flex; align-items: center; gap: 16px; min-height: 72px; }
/* Identity lockup (lib/brand.mjs, built by scripts/build-brand.mjs): fixed dimensions, so no layout shift. */
.brand { display: inline-flex; align-items: center; min-height: 44px; margin-left: -6px; padding: 4px 6px; border-radius: 12px; color: var(--ink); }
.brand-lockup { display: block; width: 133px; height: 36px; }   /* 235:64, Version 01 Original Italic */
.brand-word { fill: currentColor; }
.brand-dot { fill: var(--brand-accent); }
.brand-wordmark { display: inline-block; height: 1.3em; width: auto; vertical-align: -0.1em; margin-right: 10px; color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; margin-right: -8px; }
.topbar-actions .text-button { white-space: nowrap; }
@media (max-width: 360px) { .topbar { gap: 8px; } .topbar-actions { gap: 0; } .topbar-actions .text-button { padding: 0 8px; font-size: .875rem; } }
.masthead { max-width: var(--max); margin: 0 auto; padding: 36px var(--pad) 40px; }
.masthead h1 { margin: 0; max-width: 1120px; font-size: clamp(2.25rem, 1.1rem + 3.7vw, 4.25rem); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; }
.tagline { margin: 18px 0 0; font-size: clamp(1.125rem, 1rem + .4vw, 1.375rem); line-height: 1.35; color: var(--muted); }
.credit { margin: 4px 0 0; font-size: .9375rem; color: var(--muted); }
/* Curator credit: "Curated by Sora" then understated profile links; wraps as whole units on narrow screens. */
.credit-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.credit-line strong { color: var(--ink); font-weight: 700; }
.socials { display: inline-flex; flex-wrap: wrap; gap: 0 4px; margin-left: -8px; }
.social { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; transition: color .15s, background-color .15s; }
.social:hover { color: var(--ink); background: var(--hover); }
.social .social-icon { width: 16px; height: 16px; }

/* Layout */
.layout { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: grid; grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; }
main:focus { outline: none; }
.rail { display: none; }
.subject-strip { display: flex; gap: 8px; overflow-x: auto; padding: 0 var(--pad) 8px; scroll-padding-inline: var(--pad); scrollbar-width: none; overscroll-behavior-x: contain; }
.subject-strip::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.subject-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--rule-strong); font-size: .9375rem; font-weight: 600; white-space: nowrap; }
.subject-chip .bullet { width: 28px; height: 28px; }
.subject-chip[aria-current=page] { background: var(--ink); color: var(--ground); box-shadow: none; }
.subject-chip[aria-current=page] .bullet--all { background: var(--ground); color: var(--ink); }

/* Rail: the network on the left, with the active line's stops as a strip map */
@media (min-width: 1024px) {
  .layout { grid-template-columns: 288px minmax(0, 1fr); column-gap: 48px; }
  .subject-strip { display: none; }
  .rail { display: flex; flex-direction: column; position: sticky; top: 0; align-self: start; max-height: 100dvh; overflow: auto; padding: 14px 4px 32px 0; scrollbar-width: thin; }
}
.rail-lines { list-style: none; margin: 0; padding: 0; }
.rail-line--all { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.rail-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; border-radius: 10px; font-size: .9375rem; font-weight: 500; line-height: 1.25; transition: background-color .15s; }
.rail-item:hover { background: var(--hover); }
.rail-item .count, .rail-stop .count { margin-left: auto; padding-left: 8px; }
.rail-line.is-active > .rail-item, .rail-item[aria-current=page] { font-weight: 800; }
.rail-item[aria-current=page] { background: var(--hover); }
.rail-line.is-here > .rail-item .rail-name { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.rail-stops { list-style: none; position: relative; margin: 4px 0 12px 22px; padding: 0; }
.rail-stops::before { content: ""; position: absolute; left: 0; top: 50px; bottom: 18px; width: 4px; border-radius: 2px; background: var(--line); box-shadow: 0 0 0 1px var(--line-edge); }
.rail-stop { position: relative; display: flex; align-items: center; min-height: 36px; padding: 4px 10px 4px 22px; border-radius: 8px; font-size: .875rem; line-height: 1.25; color: var(--muted); transition: color .15s, background-color .15s; }
.rail-stop:hover { color: var(--ink); background: var(--hover); }
.rail-stop--all { padding-left: 22px; }
.rail-stop .stop { position: absolute; left: -5px; top: 50%; margin-top: -7px; }
.rail-stop .taxonomy-icon { width: 16px; height: 16px; margin-right: 8px; color: var(--muted); }
.rail-stop[aria-current=page] .taxonomy-icon, .rail-stop.is-here .taxonomy-icon, .rail-stop:hover .taxonomy-icon { color: var(--ink); }
.rail-stop[aria-current=page] { color: var(--ink); font-weight: 700; }
.rail-stop[aria-current=page] .stop, .rail-stop:hover .stop { background: var(--line); }
.rail-stop.is-here { color: var(--ink); font-weight: 700; }
.rail-stop.is-here .stop { background: var(--line); transform: scale(1.25); }
.rail-stop .stop { transition: transform .25s var(--ease-out), background-color .15s; }
/* Find something unexpected: above the search, with its own category choice (independent of browsing filters).
   Needs JavaScript, so it is hidden without it. "in" and the dropdown wrap together onto a second line when narrow. */
html:not(.js) .discover { display: none; }
.discover { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 6px -12px; }
.discover-button { color: var(--muted); }
.discover-button:hover { color: var(--ink); }
.discover-button:disabled { opacity: .5; cursor: not-allowed; background: none; }
.discover-scope { display: inline-flex; align-items: center; gap: 8px; margin-left: 0; }
.discover-in { font-size: .9375rem; font-weight: 600; color: var(--muted); }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.discover-select { appearance: none; -webkit-appearance: none; min-height: 44px; max-width: 100%; padding: 2px 38px 0 14px; border: 0; border-radius: 10px; background: var(--panel); color: var(--ink); font: 600 .9375rem/1.2 var(--sans); box-shadow: inset 0 0 0 1.5px var(--rule-strong); cursor: pointer; transition: box-shadow .15s; }
.discover-select:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.discover-select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.discover-select option { background: var(--panel); color: var(--ink); }
.surprise-note { font-size: .8125rem; color: var(--muted); padding-left: 12px; }
.surprise-note:empty { display: none; }
@media (max-width: 700px) { .discover-scope { padding-left: 12px; } }

/* Search: stays reachable while a long subject scrolls */
.search { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; height: var(--search-h); background: var(--ground); }
.search-field { position: relative; flex: 1; display: flex; align-items: center; height: 52px; background: var(--panel); border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--edge); transition: box-shadow .15s; }
.search-field:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.search-field:focus-within { box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 4px var(--hover); }
.search-label { display: grid; place-items: center; width: 48px; height: 100%; cursor: text; color: var(--muted); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 1.0625rem; padding: 3px 0 0; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field input::-webkit-search-cancel-button, .search-field input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear { margin-right: 4px; }
.search-key { margin-right: 14px; display: grid; place-items: center; min-width: 24px; height: 24px; padding-top: 2px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--rule-strong); font: 600 .8125rem/1 var(--mono); color: var(--muted); }
.search-field:focus-within .search-key, .search-clear:not([hidden]) + .search-key { display: none; }
@media (pointer: coarse), (max-width: 700px) { .search-key { display: none; } }

/* Toolbar under the search: Suggest a tool */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 16px; min-height: 44px; padding-top: 2px; font-size: .875rem; color: var(--muted); }
@media (max-width: 700px) { .toolbar { font-size: .8125rem; } }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; margin-left: auto; margin-right: -12px; }
@media (max-width: 1023px) { .toolbar-actions { margin-left: -12px; margin-right: -12px; width: calc(100% + 24px); } }
.suggest-link { color: var(--muted); }
.suggest-link:hover { color: var(--ink); }
.icon-trailing { width: 14px; height: 14px; margin-left: -2px; }
.suggest-footer { display: inline-flex; align-items: center; gap: 4px; }

/* View heading */
.view-head { padding: 12px 0 4px; }
.view-title-row { display: flex; align-items: center; gap: 14px; }
.view-title { margin: 0; font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.375rem); font-weight: 800; line-height: 1.1; letter-spacing: -.028em; overflow-wrap: anywhere; }
.view-title:focus { outline: none; }
.view-section-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--hover); color: var(--line, var(--ink)); flex: none; }
.view-section-icon .taxonomy-icon { width: 24px; height: 24px; color: var(--ink); }
.view-meta { margin: 8px 0 0; font-size: .9375rem; color: var(--muted); }
.view-meta .text-link { margin-left: 8px; color: var(--ink); }
.view-crumb { margin: 0 0 4px; }
.view-crumb a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; }
.view-crumb a:hover { text-decoration: underline; text-underline-offset: 3px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 16px calc(var(--pad) * -1) 0; padding: 2px var(--pad) 6px; scroll-padding-inline: var(--pad); scrollbar-width: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--rule-strong); font-size: .9375rem; font-weight: 600; white-space: nowrap; }
.chip .taxonomy-icon { width: 18px; height: 18px; }
.chip .count { margin-left: 2px; }
.chip[aria-current=page] { background: var(--ink); color: var(--ground); box-shadow: none; }
.chip[aria-current=page] .count { color: inherit; opacity: 1; }
@media (min-width: 1024px) { .chips { display: none; } }

/* Overview: every subject drawn as its own strip map */
.network { display: grid; gap: 56px; padding: 28px 0 24px; }
.line-block { container-type: inline-size; }
.line-head { display: flex; align-items: center; gap: 14px; }
.line-title { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.15; letter-spacing: -.022em; }
.line-title a, .track-title a { text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 3px; text-underline-offset: 6px; transition: text-decoration-color .15s; }
.line-title a:hover, .track-title a:hover { text-decoration-color: var(--line); }
.line-count { margin-left: auto; font: 500 .875rem/1 var(--mono); color: var(--muted); white-space: nowrap; }
.strip { list-style: none; margin: 18px 0 8px; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.strip-stop { position: relative; }
.strip-stop::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 6px; background: var(--line); box-shadow: 0 1px 0 var(--line-edge), 0 -1px 0 var(--line-edge); }
.strip-stop:first-child::before { left: 10px; border-radius: 3px 0 0 3px; }
.strip-stop:last-child::before { right: auto; width: 10px; }
.strip-stop:only-child::before { display: none; }
.strip-stop .stop { position: absolute; top: 0; left: 0; width: 20px; height: 20px; border-width: 4px; transition: background-color .15s, transform .2s var(--ease-out); }
.strip-stop a { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 44px; padding: 30px 16px 8px 0; border-radius: 8px; }
.strip-name { display: flex; align-items: flex-start; gap: 6px; font-size: .9375rem; font-weight: 650; line-height: 1.25; }
.strip-name .taxonomy-icon { width: 16px; height: 16px; margin-top: 1px; color: var(--muted); }
.strip-stop a:hover .strip-name { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.strip-stop a:hover .stop { background: var(--line); transform: scale(1.1); }
.strip-stop a:focus-visible { outline-offset: 2px; }
@container (max-width: 620px) {
  .strip { grid-auto-flow: row; margin-top: 12px; }
  .strip-stop::before { top: 0; bottom: 0; left: 7px; right: auto; width: 6px; height: auto; box-shadow: 1px 0 0 var(--line-edge), -1px 0 0 var(--line-edge); }
  .strip-stop:first-child::before { top: 22px; left: 7px; border-radius: 3px 3px 0 0; }
  .strip-stop:last-child::before { bottom: auto; height: 22px; width: 6px; }
  .strip-stop .stop { top: 12px; }
  .strip-stop a { flex-direction: row; align-items: center; gap: 12px; padding: 6px 4px 6px 36px; }
  .strip-stop .count { margin-left: auto; }
}
.line-more { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 4px; font-weight: 700; font-size: .9375rem; }
.line-more .icon { width: 18px; height: 18px; transition: transform .2s var(--ease-out); }
.line-more:hover { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.line-more:hover .icon { transform: translateX(3px); }

/* Resource rows */
/* Expanded sections: two columns when two 20rem rows plus the 28px gap fit, otherwise one. Never three. */
.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(20rem, calc((100% - 28px) / 2))), 1fr)); gap: 2px 28px; }
.rows--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); gap: 0 20px; margin-top: 4px; }
.row { min-width: 0; display: flex; align-items: flex-start; }
.row-link { flex: 1; min-width: 0; }
.row-link { display: flex; align-items: flex-start; gap: 14px; min-height: 44px; margin: 0 -12px; padding: 12px; border-radius: 10px; transition: background-color .15s; }
.row-link:hover { background: var(--hover); }
.row-link:active { background: var(--press); }
.row--compact .row-link { align-items: center; gap: 12px; padding: 8px 12px; }
.tile { flex: none; position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; overflow: hidden; background: var(--line); color: var(--on-line); box-shadow: inset 0 0 0 1px var(--line-edge); font: 800 1rem/1 var(--sans); padding-top: .12em; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 6px; object-fit: contain; background: var(--plate); border-radius: inherit; box-shadow: inset 0 0 0 1px rgb(19 22 25 / .1); }
.tile img.is-small { padding: 10px; }
.tile--dark-plate img { background: #131619; }
/* While an icon loads (JavaScript only), the tile is a quiet neutral plate; a missing icon becomes the line-coloured letter. */
.tile:has(img) { background: var(--hover); color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule); }
.js .tile img { opacity: 0; transition: opacity .2s ease-out; }
.js .tile img.is-loaded { opacity: 1; }
.row--compact .tile { width: 28px; height: 28px; border-radius: 7px; font-size: .8125rem; }
.row--compact .tile img { padding: 4px; }
.row--compact .tile img.is-small { padding: 6px; }
.row-body { min-width: 0; display: grid; gap: 2px; }
.row-name { font-size: 1rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 3px; transition: text-decoration-color .15s; }
.row-link:hover .row-name { text-decoration-color: var(--line, var(--ink)); }
.row--compact .row-name { font-size: .9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-desc { font-size: .875rem; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview-actions { display: flex; gap: 10px; margin-top: 20px; }
.preview-actions .visit { flex: 1; margin-top: 0; min-width: 0; }

/* A subject view: one line, ridden stop by stop */
.track { position: relative; padding: 8px 0 44px 44px; margin-top: 12px; }
.track::before { content: ""; position: absolute; left: 12px; top: 32px; bottom: 28px; width: 6px; border-radius: 3px; background: var(--line); box-shadow: 0 0 0 1px var(--line-edge); transform-origin: top; }
.track + .track { margin-top: 20px; }
.track-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; min-height: 48px; margin: 0 0 4px -44px; padding-left: 1px; }
.track-head .bullet { width: 30px; height: 30px; }
.track-title { margin: 0; font-size: 1.375rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.track-head .count { margin-left: 2px; }
.station { margin-top: 20px; }
.track > .station:first-child, .track-head + .station { margin-top: 0; }
.station-head { position: sticky; top: var(--search-h); z-index: 3; display: flex; align-items: center; gap: 12px; margin: 0 0 4px -44px; padding: 12px 0 10px 44px; font-size: 1.25rem; font-weight: 800; line-height: 1.2; letter-spacing: -.016em;
  /* The line column stays transparent so the track shows through the sticky heading. */
  background: linear-gradient(to right, var(--ground) 0 12px, transparent 12px 18px, var(--ground) 18px); }
.station-head .stop { position: absolute; left: 5px; top: 50%; margin-top: -10px; width: 20px; height: 20px; border-width: 5px; }
.station-head .count { font-size: .875rem; }
.station-head .taxonomy-icon { width: 20px; height: 20px; color: var(--muted); align-self: center; margin-right: -4px; }
.terminus { position: absolute; left: 3px; bottom: 22px; width: 24px; height: 6px; border-radius: 3px; background: var(--line); box-shadow: 0 0 0 1px var(--line-edge); }
@media (prefers-reduced-motion: no-preference) {
  .track.is-entering::before { animation: draw-line .7s var(--ease-out) both; }
  .track.is-entering .station-head .stop { animation: stop-in .45s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
  @keyframes draw-line { from { transform: scaleY(0); } }
  @keyframes stop-in { from { transform: scale(.3); opacity: 0; } }
}

/* Empty results */
.empty { margin: 24px 0 8px; padding: 32px; border-radius: 16px; background: var(--hover); max-width: 640px; }
.empty-title { margin: 0; font-size: 1.375rem; font-weight: 800; letter-spacing: -.018em; line-height: 1.25; overflow-wrap: anywhere; }
.empty p:not(.empty-title) { color: var(--muted); }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }

/* Footer */
.footer { max-width: var(--max); margin: 48px auto 0; padding: 28px var(--pad) 40px; border-top: 1px solid var(--rule); display: grid; gap: 8px; color: var(--muted); font-size: .9375rem; }
.footer p { margin: 0; }
.footer-credit { display: flex; align-items: center; flex-wrap: wrap; gap: 0 16px; color: var(--ink); font-weight: 600; }
.footer-curator { margin: 0; font-weight: 500; color: var(--muted); }
.footer-credit .brand-wordmark { margin-right: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin-top: 8px !important; }
.footer-links .text-button { margin-left: -12px; }
.footer-links .text-link { color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }

/* Dialogs */
dialog { color: var(--ink); background: var(--panel); border: 1px solid var(--rule); padding: 0; }
dialog::backdrop { background: var(--scrim); }
.preview::backdrop { background: color-mix(in srgb, var(--scrim) 45%, transparent); }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.sheet-grip { display: none; }
.preview { position: fixed; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; overflow: hidden; padding: 0; border-radius: 16px; box-shadow: var(--shadow); }
/* The dialog box never exceeds the viewport; its content scrolls inside, under a close button that stays put. */
.preview[open] { display: flex; flex-direction: column; }
#preview-content { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px; }
.preview .dialog-close { z-index: 1; background: var(--panel); }
.preview .dialog-close:hover { background: color-mix(in srgb, var(--ink) 8%, var(--panel)); }
.preview[data-anchored] { margin: 0; }
.preview-id { display: flex; align-items: center; gap: 14px; padding-right: 44px; }
.tile--lg { width: 52px; height: 52px; border-radius: 12px; font-size: 1.375rem; }
.tile--lg img { padding: 8px; }
.tile--lg img.is-small { padding: 14px; }
.preview-title { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.15; letter-spacing: -.022em; overflow-wrap: anywhere; }
.preview-host { margin: 3px 0 0; font: 500 .875rem/1.3 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.preview-desc { margin: 18px 0 0; font-size: 1.0625rem; line-height: 1.55; }
.preview-useful { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--hover); }
.preview-useful h3 { margin: 0 0 2px; font-size: .875rem; font-weight: 700; color: var(--muted); }
.preview-useful p { margin: 0; line-height: 1.5; }
.preview-credit { margin: 14px 0 0; font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.trail { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); display: grid; gap: 12px; }
.trail > div { display: grid; gap: 4px; }
.trail dt { font-size: .8125rem; font-weight: 700; color: var(--muted); }
.trail dd { margin: 0; display: grid; gap: 2px; }
.trail-link { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 0 -8px; padding: 6px 8px; border-radius: 8px; line-height: 1.3; }
.trail-link:hover { background: var(--hover); }
.trail-link .bullet { margin-top: 1px; }
.trail-text { display: grid; gap: 1px; }
.trail-subject { font-size: .9375rem; font-weight: 700; }
.trail-stop { display: flex; align-items: center; gap: 6px; font-size: .9375rem; color: var(--muted); }
.trail-stop .taxonomy-icon { width: 16px; height: 16px; }
.trail-link:hover .trail-subject { text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.visit { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 2px 18px 0; border-radius: 12px; background: var(--ink); color: var(--ground); font-size: 1.0625rem; font-weight: 700; transition: transform .12s var(--ease-out), box-shadow .15s; }
.visit span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit:hover { box-shadow: 0 8px 20px -8px var(--scrim); }
.visit:active { transform: scale(.985); }
.visit:focus-visible { outline-offset: 3px; }
.about { width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; padding: 32px; border-radius: 16px; box-shadow: var(--shadow); }
.about h2 { margin: 0; padding-right: 44px; font-size: 1.75rem; font-weight: 800; line-height: 1.15; letter-spacing: -.024em; }
/* "About" in the UI face, then the same outlined wordmark as the logo, sized so its ascenders match
   Overpass ExtraBold's and its baseline sits on the heading baseline. */
.about-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 .28em; }
/* Wordmark ascenders sized to "About" (Overpass ExtraBold); the SVG's lower edge sits 7.5% below its baseline. */
.brand-wordmark.about-wordmark { height: .84em; margin: 0; vertical-align: baseline; align-self: baseline; transform: translateY(.063em); }
/* The approved story leads at full reading contrast; curation notes follow as quieter secondary content. */
.about-story { max-width: 62ch; }
.about-story p { margin: 16px 0 0; font-size: 1rem; line-height: 1.6; color: var(--ink); }
.about-notes { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); max-width: 62ch; }
.about-notes h3 { margin: 18px 0 0; font-size: .9375rem; font-weight: 800; letter-spacing: -.01em; }
.about-notes h3:first-child { margin-top: 0; }
.about-notes p { margin: 6px 0 0; font-size: .9375rem; line-height: 1.6; color: var(--muted); }
.about-notes .about-credit { margin-top: 2px; color: var(--muted); }
.about-notes strong { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .preview[open], .about[open] { animation: pop-in .2s var(--ease-out); }
  dialog[open]::backdrop { animation: fade-in .2s ease-out; }
  @keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
  @keyframes fade-in { from { opacity: 0; } }
}

.update-notice { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20; transform: translateX(-50%); min-height: 48px; padding: 2px 20px 0; border-radius: 999px; background: var(--ink); color: var(--ground); font-weight: 700; box-shadow: var(--shadow); }

/* Tablet and phone */
@media (max-width: 1023px) {
  .topbar { min-height: 64px; }
  .masthead { padding: 24px var(--pad) 28px; }
}
@media (max-width: 700px) {
  :root { --pad: 16px; --search-h: 68px; }
  .topbar { padding-top: 10px; }
  .masthead { padding: 16px var(--pad) 22px; }
  .masthead h1 { letter-spacing: -.03em; line-height: 1.04; }
  .tagline { margin-top: 12px; }
  .network { gap: 44px; padding-top: 20px; }
  .line-title { font-size: 1.3125rem; }
  .line-count { display: none; }
  .rows--compact .row:nth-child(n+7) { display: none; }
  .track { padding-left: 38px; }
  .track::before { left: 9px; }
  .track-head, .station-head { margin-left: -38px; }
  .station-head { padding-left: 38px; font-size: 1.125rem; background: linear-gradient(to right, var(--ground) 0 9px, transparent 9px 15px, var(--ground) 15px); }
  .station-head .stop { left: 2px; }
  .terminus { left: 0; }
  .row-link { gap: 12px; }
  .empty { padding: 24px 20px; }
  .preview { inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 88dvh; margin: 0; padding: 0; border-radius: 20px 20px 0 0; border-width: 1px 0 0; }
  #preview-content { padding: 28px 20px max(20px, env(safe-area-inset-bottom)); }
  .preview[data-anchored] { margin: 0; }
  .preview::backdrop { background: var(--scrim); }
  .sheet-grip { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--rule-strong); }
  .dialog-close { top: 14px; right: 10px; }
  .about { padding: 28px 20px max(24px, env(safe-area-inset-bottom)); }
  .brand-lockup { width: 118px; height: 32px; }
  @media (prefers-reduced-motion: no-preference) {
    .preview[open] { animation: sheet-up .3s var(--ease-out); }
    @keyframes sheet-up { from { transform: translateY(100%); } }
  }
}
@media (max-width: 380px) {
  .brand-name { font-size: 1.1875rem; }
  .row-desc { -webkit-line-clamp: 3; line-clamp: 3; }
}

@media (forced-colors: active) {
  .bullet, .tile, .stop { forced-color-adjust: none; }
  .track::before, .strip-stop::before, .rail-stops::before, .terminus { background: CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
