/* base: nest.css */
/* nest.css — the base theme: tokens, the elements, and the classes modules share (card, stack,
   row, field, notice, badge, tile...). Each module keeps its own look in its own stylesheet
   (its manifest's styles), built on these tokens; an application restyles both. */
:root {
  --bg: #f8f7f4; --surface: #ffffff; --text: #1d1c1a; --muted: #5f5b53;
  --border: #dedad0; --accent: #8a2b1f; --accent-text: #ffffff; --focus: #1f4f8a;
  --ok: #2d6a3e; --danger: #a32121;
  --radius: 8px; --gap: 1rem; --max: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413; --surface: #1e1d1b; --text: #ecebe6; --muted: #a6a196;
    --border: #34312c; --accent: #e0806f; --accent-text: #151413; --focus: #8db6ea;
    --ok: #7cc48e; --danger: #f08a8a;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.6 var(--font);
  display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; padding-block: 1.5rem 3rem; }
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 1rem; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem; min-height: 3.5rem; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: 0; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding-block: 1rem; }

h1, h2, h3 { line-height: 1.25; margin: 1.5rem 0 .75rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-top: .5rem; }
p { margin: .5rem 0 1rem; }
code, pre { font-family: var(--mono); font-size: .9em; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .75rem 1rem; overflow-x: auto; }
img, video { max-width: 100%; height: auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-block: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.muted { color: var(--muted); }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

button, .button { font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-text); border-radius: var(--radius); padding: .5rem 1rem; min-height: 2.5rem;
  text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { font: inherit; color: inherit; background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .75rem; min-height: 2.5rem; }
textarea { min-height: 6rem; resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

.notice { border-left: 4px solid var(--accent); background: var(--surface); padding: .75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0; }
.notice.ok { border-color: var(--ok); } .notice.danger { border-color: var(--danger); }

/* htmx: indicators without the inline styles htmx would inject. */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.narrow { max-width: 28rem; margin-inline: auto; }
button.link { background: none; border: none; color: var(--muted); padding: .25rem .4rem; min-height: auto; }
button.link:hover, button.link.current { color: var(--text); text-decoration: underline; }
.language { gap: 0; }
.field { margin-bottom: 1rem; }
.field .hint, .field .error { display: block; margin-top: .25rem; font-size: .875rem; }
.field .hint { color: var(--muted); }
.field .error { color: var(--danger); }
.field .req { color: var(--danger); }
.field.check { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.field.check input { width: auto; min-height: auto; }
.field.check label { margin: 0; font-weight: 400; }
[aria-invalid="true"] { border-color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.between { justify-content: space-between; }
form.search { display: flex; gap: .5rem; margin-block: 1rem; }
form.search input { flex: 1; }
.tile { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: var(--text); }
.tile:hover { border-color: var(--accent); }
.letters { display: flex; flex-wrap: wrap; gap: .25rem; margin-block: 1rem; }
.letters a { min-width: 2.25rem; text-align: center; padding: .35rem .5rem; border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.letters a[aria-current="page"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
ol.results { padding-left: 1.25rem; } ol.results li { margin-bottom: 1rem; } ol.results p { margin: .25rem 0; }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 2px; }
.pager { margin-top: 1.5rem; }
.danger-zone { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; } label.check { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; }
label.check input { width: auto; min-height: auto; }
.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: var(--border); color: var(--text); vertical-align: middle; }
form.inline { display: inline; }
/* numbers in tables, and a change for the better or the worse (the game's benchmark) */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.better { color: var(--ok); } .worse { color: var(--danger); }
progress { width: 100%; max-width: 32rem; }
/* the language switch: its choices apart, in any theme */
.language { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; }

/* the line every site carries: built with Nest */
.nest-credit { margin: .35rem 0 0; font-size: .78rem; opacity: .75; }
.nest-credit a { color: inherit; }

/* rail-signage: rail.css */
/* rail.css — the rail-signage theme, on the base theme: a station's signs. An enamel-blue
   header with the site's name in white condensed letters inside a thin white border, a rail
   line (two rails on their sleepers) under it, the departure board's amber for what is
   current, timetable tables with blue heads and striped rows, times in figures of one width.
   Fonts are the system's (no web font to download): a condensed sans for the signs. A
   theme's stylesheet comes before the modules' own, so a rule for a class a module styles
   too is written under main, to win. */

:root {
  --bg: #eef1f4; --surface: #ffffff; --text: #14202e; --muted: #5a6878;
  --border: #d5dce4; --accent: #12355b; --accent-text: #ffffff; --focus: #ffb400;
  --ok: #2e7d32; --danger: #c62828;
  --enamel: #12355b; --enamel-deep: #0c2742; --amber: #ffb400; --rail: #8a96a3; --sleeper: #6b5a48;
  --stripe: #f5f7fa; --link: #1659a3;
  --radius: 6px; --max: 76rem;
  --condensed: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue Condensed",
    "Liberation Sans Narrow", sans-serif-condensed, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1724; --surface: #142233; --text: #e6edf5; --muted: #9db0c4;
    --border: #24384f; --accent: #ffb400; --accent-text: #0d1724; --focus: #ffb400;
    --ok: #7cc48e; --danger: #ff7b72;
    --enamel: #0a2440; --enamel-deep: #061a30; --rail: #5c6b7b; --sleeper: #4a3f33;
    --stripe: #182a3e; --link: #8cc4ff;
  }
}

a { color: var(--link); text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip:focus { background: var(--amber); color: #14202e; font-weight: 700; }
h1, h2, h3 { font-family: var(--condensed); font-weight: 700; letter-spacing: .01em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
time, .time, td.num, .num, table { font-variant-numeric: tabular-nums; }

/* --- the header: an enamel sign ---------------------------------------------------------- */
.rail-header { background: var(--enamel); color: #fff; border: 0; }
.rail-header .bar { min-height: 4.5rem; gap: .75rem 1.5rem; padding-block: .6rem; flex-wrap: wrap; }
.rail-sign { display: inline-flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
  color: #fff; text-decoration: none; padding: .3rem .9rem; border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 4px; box-shadow: inset 0 0 0 3px var(--enamel), inset 0 0 0 4px rgba(255, 255, 255, .25); }
.rail-sign:hover { text-decoration: none; background: var(--enamel-deep); }
.rail-name { font-family: var(--condensed); font-weight: 800; font-size: 1.7rem; letter-spacing: .04em;
  text-transform: uppercase; line-height: 1.1; }
.rail-tagline { font-size: .85rem; color: #c8d6e6; letter-spacing: .02em; }
.rail-nav { flex: 1 1 auto; }
.rail-nav ul.menu { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; list-style: none; margin: 0; padding: 0; }
.rail-nav ul.menu a { color: #fff; font-family: var(--condensed); font-weight: 600; font-size: 1.08rem;
  letter-spacing: .03em; text-transform: uppercase; text-decoration: none; display: inline-block; padding: .3rem 0;
  border-bottom: 3px solid transparent; }
.rail-nav ul.menu a:hover { border-bottom-color: rgba(255, 180, 0, .6); }
.rail-nav ul.menu a[aria-current="page"] { border-bottom-color: var(--amber); }
.rail-nav ul.menu ul { background: var(--surface); }
.rail-nav ul.menu ul a { color: var(--text); text-transform: none; }
.rail-header .auth-status, .rail-header .auth-status a { color: #dbe6f2; }
.rail-tools { display: flex; align-items: center; gap: .75rem; color: #dbe6f2; }
.rail-tools a { color: #fff; }

/* the rail line: two rails on their sleepers */
.rail-line { height: 14px; background:
  linear-gradient(var(--rail), var(--rail)) 0 3px / 100% 2px no-repeat,
  linear-gradient(var(--rail), var(--rail)) 0 9px / 100% 2px no-repeat,
  repeating-linear-gradient(90deg, var(--sleeper) 0 6px, transparent 6px 22px) 0 1px / 100% 12px no-repeat,
  var(--enamel-deep); }

/* --- the page ---------------------------------------------------------------------------- */
main .card { border: 1px solid var(--border); border-top: 4px solid var(--enamel); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(10, 30, 60, .06); }
@media (prefers-color-scheme: dark) { main .card { border-top-color: var(--amber); } }
button, .button { border-radius: 4px; font-weight: 600; }
button:focus-visible, .button:focus-visible { outline-color: var(--amber); }
mark, .highlight { background: var(--amber); color: #14202e; padding: 0 .15em; border-radius: 2px; }
.badge { background: var(--enamel); color: #fff; }
@media (prefers-color-scheme: dark) { .badge { background: var(--amber); color: #0d1724; } }
.notice.danger { border-color: var(--danger); }

/* timetables: blue heads, striped rows */
main table { border-collapse: collapse; width: 100%; background: var(--surface); }
main table th { background: var(--enamel); color: #fff; font-family: var(--condensed); font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; font-size: .92rem; text-align: left; padding: .45rem .6rem; }
main table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
main table tbody tr:nth-child(even) td { background: var(--stripe); }
main table tbody tr:hover td { background: rgba(255, 180, 0, .12); }
main table th a { color: #fff; }

/* --- the notice and the footer ----------------------------------------------------------- */
.rail-notice { background: var(--surface); border-top: 3px solid var(--amber); color: var(--muted);
  font-size: .85rem; padding-block: .75rem; }
.rail-footer { background: var(--enamel); color: #c8d6e6; border: 0; font-size: .9rem; margin-top: 0; }
.rail-footer a { color: #fff; }
.rail-footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; padding-block: 1.25rem .5rem; }
.rail-footer-name { font-family: var(--condensed); font-weight: 800; font-size: 1.2rem; letter-spacing: .04em;
  text-transform: uppercase; color: #fff; margin: 0 0 .25rem; }
.rail-links { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; list-style: none; margin: 0; padding: 0; }
.rail-links a[aria-current="page"] { text-decoration-color: var(--amber); }
.rail-footer-end { padding-block: .5rem 1.25rem; font-size: .8rem; color: #9fb4ca; }

/* --- a page that is not there ------------------------------------------------------------ */
.rail-lost { text-align: center; padding-block: 2rem; }
.rail-lost-code { display: inline-block; font-family: var(--condensed); font-weight: 800; font-size: 4rem;
  letter-spacing: .12em; background: #111; color: var(--amber); padding: .1rem 1rem; border-radius: 4px; margin: 0; }

/* --- small screens ----------------------------------------------------------------------- */
@media (max-width: 40rem) {
  .rail-header .bar { align-items: flex-start; }
  .rail-name { font-size: 1.4rem; }
  .rail-nav ul.menu { gap: .1rem .9rem; }
  main table th, main table td { padding: .35rem .4rem; }
}
/* narrow screens: the sign and the menu shrink and wrap, never wider than the screen */
.rail-header .bar, .rail-nav, .rail-sign { min-width: 0; max-width: 100%; }
@media (max-width: 640px) {
  .rail-sign { gap: .2rem .6rem; }
  .rail-nav ul.menu a { font-size: .98rem; }
  .rail-tools { margin-left: auto; }
}

/* the line every site carries: built with Nest */
.nest-credit { margin: .35rem 0 0; font-size: .78rem; opacity: .75; }
.nest-credit a { color: inherit; }

/* geo: geo.css */
.geo-locate { margin: 1rem 0; }
.geo-by-hand form { gap: .5rem; flex-wrap: wrap; align-items: end; margin-top: .5rem; }
.geo-group { margin: 1rem 0; }
.geo-places { padding-left: 1.4rem; }

/* admin: preview.css */
/* preview.css — the bar an administrator previewing a theme sees, in any theme (site pages). */
.theme-preview-bar { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; max-width: calc(100% - 2rem);
  padding: .6rem 1rem; border-radius: 10px; font: .9rem/1.4 system-ui, sans-serif;
  background: #1d1c1a; color: #f4f2ec; box-shadow: 0 8px 28px rgb(0 0 0 / .3); }
.theme-preview-bar a { color: #ffd38a; }

/* comments: comments.css */
/* comments.css — the base look of comments: the thread, its replies and the spam trap.
   Built only on the theme's tokens (--surface, --border, --accent, --radius...), so an
   application restyles it by its own tokens, or by its own stylesheet loaded after this. */
.comments { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
ol.comment-list, ol.comment-replies { list-style: none; padding-left: 0; }
ol.comment-replies { padding-left: 1.25rem; border-left: 2px solid var(--border); }
.comment { margin-bottom: 1rem; } .comment-meta { margin: 0 0 .25rem; } .comment-body p { margin: .25rem 0; }
.comment-reply summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* maps: maps.css */
/* maps.css — the maps module's base look, on the theme's tokens. */
.map-figure { margin: 1rem 0; }
.map { position: relative; height: 24rem; max-height: 70vh; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); z-index: 0; }
.map-page .map { height: 34rem; }
.map-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.map-popup a, .map-popup strong { font-weight: 600; }
.map-popup p { margin: .25rem 0 0; }
.map-places { columns: 16rem; padding-left: 1.2rem; }
@media (max-width: 40rem) { .map { height: 18rem; } .map-page .map { height: 24rem; } }

/* notifications: toasts.css */
/* toasts.css — the notifications module's base look, on the theme's tokens. */
.toasts { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem;
  width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .75rem; padding: .7rem .8rem .7rem 1rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: var(--radius); box-shadow: 0 10px 28px rgba(0, 0, 0, .16); animation: toast-in .22s ease-out; }
.toast-success { border-left-color: var(--ok); }
.toast-info { border-left-color: var(--focus); }
.toast-warning { border-left-color: #b7791f; }
.toast-error { border-left-color: var(--danger); }
.toast-text { flex: 1; line-height: 1.4; }
.toast-text::before { font-weight: 700; margin-right: .4rem; }
.toast-success .toast-text::before { content: "✓"; color: var(--ok); }
.toast-warning .toast-text::before { content: "!"; color: #b7791f; }
.toast-error .toast-text::before { content: "✕"; color: var(--danger); }
.toast-close { border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1;
  padding: 0 .2rem; min-height: 0; cursor: pointer; }
.toast-close:hover { color: var(--text); }
.toast-leaving { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(1rem); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast-leaving { animation: none; } }
@media (max-width: 40rem) { .toasts { left: 1rem; right: 1rem; width: auto; bottom: .75rem; } }

/* content: content.css */
/* content.css — the base look of the CMS: its menus, entries, featured images and summaries.
   Built only on the theme's tokens (--surface, --border, --accent, --radius...), so an
   application restyles it by its own tokens, or by its own stylesheet loaded after this. */
ul.menu { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: 0; }
ul.menu li { position: relative; }
ul.menu ul { display: none; position: absolute; z-index: 5; min-width: 12rem; list-style: none; margin: 0; padding: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
ul.menu li:hover > ul, ul.menu li:focus-within > ul { display: block; }
@media (max-width: 40rem) { ul.menu ul { position: static; display: block; border: none; padding-left: 1rem; } }
.entry .body img { border-radius: var(--radius); }
.entry .body .aligncenter { display: block; margin-inline: auto; }
.entry .body .alignleft { float: left; margin: 0 1rem .5rem 0; } .entry .body .alignright { float: right; margin: 0 0 .5rem 1rem; }
@media (max-width: 40rem) { .entry .body .alignleft, .entry .body .alignright { float: none; margin: 0 0 .5rem; } }
.featured img { width: 100%; max-height: 28rem; object-fit: cover; border-radius: var(--radius); }
.summary h2 { margin-top: 0; }
textarea.code { font-family: var(--mono); font-size: .9rem; }
/* a video: a play link until it is played, then YouTube's player in its place */
.video { position: relative; aspect-ratio: 16 / 9; margin: 1rem 0; background: #111; border-radius: var(--radius); overflow: hidden; }
.video a.video-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .6rem;
  color: #fff; text-decoration: none; font-weight: 600; background: radial-gradient(circle, #333 0, #111 70%); }
.video a.video-play::before { content: ""; width: 0; height: 0; border-style: solid; border-width: .9rem 0 .9rem 1.5rem;
  border-color: transparent transparent transparent currentColor; }
.video a.video-play:hover, .video a.video-play:focus-visible { color: var(--accent); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* the editor's versions: what changed, and how it looked */
.versions { margin-top: 2rem; }
.version-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.version-actions form { margin: 0; }
.version-actions .hint { flex-basis: 100%; margin: 0; }
.version-nav { margin: .5rem 0 1rem; }
.diff { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; background: var(--surface); }
.diff p { margin: .4rem 0; }
.diff .diff-same { color: var(--muted); }
.diff del, .version-fields del { background: color-mix(in srgb, var(--danger) 16%, transparent); color: inherit; text-decoration: line-through; }
.diff ins, .version-fields ins { background: color-mix(in srgb, var(--ok) 18%, transparent); color: inherit; text-decoration: underline; }
.version-preview { max-width: 48rem; }
.version-copy { border-left: 4px solid var(--focus); }
.diff .diff-fold { color: var(--muted); font-style: italic; text-align: center; border-block: 1px dashed var(--border); padding: .2rem 0; }
/* the editor's content, a category at a time */
.content-browse { display: grid; grid-template-columns: 15rem 1fr; gap: 1.5rem; align-items: start; }
.term-nav { position: sticky; top: 1rem; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; background: var(--surface); }
.term-nav-head { font-weight: 600; margin: 0 0 .4rem; }
.term-nav ul, .term-counts { list-style: none; padding: 0; margin: 0; }
.term-nav li a { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem .4rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.term-nav li a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.term-nav li a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.term-nav .count, .term-counts .count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.depth-1 { padding-left: 1rem; } .depth-2 { padding-left: 2rem; } .depth-3 { padding-left: 3rem; } .depth-4 { padding-left: 4rem; }
.content-types { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.content-type h2 { margin: 0; font-size: 1.25rem; }
.term-counts { margin-top: .5rem; columns: 2; column-gap: 1.5rem; }
.term-counts li { padding: .15rem 0; break-inside: avoid; }
@media (max-width: 52rem) { .content-browse { grid-template-columns: 1fr; } .term-nav { position: static; } .term-counts { columns: 1; } }
.term-nav ul { display: block; }
.term-nav li { display: block; }
.term-nav li a .count { margin-left: auto; }
.term-nav > p a { color: var(--accent); }

/* gallery: gallery.css */
/* gallery.css — tiles, grids and the lightbox. Uses the theme's tokens when they exist. */
.gallery-tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); margin-block: 1rem; }
.gallery-tile { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: inherit; }
.gallery-tile img, .gallery-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius, 8px); background: var(--border, #ddd); display: block; }
.gallery-tile:hover img { outline: 2px solid var(--accent, #8a2b1f); outline-offset: 2px; }
.gallery-tile-title { font-weight: 600; }
.gallery-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); margin-block: 1rem; }
.gallery-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius, 8px); display: block; }
dialog.lightbox { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; color: #fff; }
dialog.lightbox::backdrop { background: rgb(0 0 0 / .88); }
dialog.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
dialog.lightbox img { max-width: 96vw; max-height: 84vh; object-fit: contain; }
dialog.lightbox figcaption { max-width: 60ch; text-align: center; }
dialog.lightbox .lightbox-bar { display: flex; gap: .5rem; justify-content: center; }
dialog.lightbox button { background: rgb(255 255 255 / .15); color: #fff; border: 1px solid rgb(255 255 255 / .3); min-width: 3rem; }
dialog.lightbox .lightbox-count { align-self: center; opacity: .8; }
/* the grid of a gallery's photos (from the base theme) */
.gallery { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.gallery figure { margin: 0; } .gallery img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: var(--radius); }
/* the gallery's editor */
.gallery-photo-row { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; align-items: start; padding: .75rem 0; border-top: 1px solid var(--border); }
.gallery-photo-row img { width: 10rem; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; }
.gallery-photo-row label { font-weight: 500; }
@media (max-width: 40rem) { .gallery-photo-row { grid-template-columns: 1fr; } }

/* trains: trains.css */
/* trains.css — the base look of trains: station lists, the journey form, boards, routes and the railway map.
   Built only on the theme's tokens (--surface, --border, --accent, --radius...), so an
   application restyles it by its own tokens, or by its own stylesheet loaded after this. */
ul.columns { columns: 14rem; column-gap: 2rem; padding-left: 1.1rem; }
.journey-form { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); align-items: end; margin-block: 1rem; }
.journey-form .field { margin: 0; }
table.board td, table.board th { white-space: nowrap; } table.board td:nth-child(3) { white-space: normal; }
ol.route { list-style: none; padding-left: 0; border-left: 3px solid var(--accent); margin-left: .5rem; }
ol.route li { position: relative; padding: .2rem 0 .2rem 1rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
ol.route li::before { content: ""; position: absolute; left: -.45rem; top: .65rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); }
ol.route li.through { font-size: .85rem; color: var(--muted); } ol.route li.through::before { background: var(--border); width: .4rem; height: .4rem; left: -.35rem; }
ol.route .times { min-width: 7.5rem; font-variant-numeric: tabular-nums; }
.railway-map { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.railway-map svg { width: 100%; height: auto; display: block; color: var(--muted); }
.railway-map .links line { stroke-width: .5; opacity: .45; }
.railway-map circle { fill: var(--accent); } .railway-map circle.r0 { opacity: .55; }
.railway-map a:hover circle, .railway-map a:focus circle { fill: var(--text); }
.railway-map text { font-size: 9px; fill: var(--text); pointer-events: none; }
.journey-more { grid-column: 1 / -1; } .journey-more summary { cursor: pointer; color: var(--muted); }
.trip { margin: .75rem 0; padding: .75rem 1rem; }
.trip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; font-variant-numeric: tabular-nums; }
.trip-times { font-size: 1.15rem; } .trip-price { margin-left: auto; font-weight: 600; }
.trip-legs { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .35rem; }
.trip-leg { display: flex; flex-wrap: wrap; gap: .2rem .75rem; align-items: baseline; font-variant-numeric: tabular-nums; }
.trip-change { font-size: .85rem; color: var(--muted); padding-left: 1rem; border-left: 2px dashed var(--border); margin-left: .5rem; }
.train-badge { display: inline-block; min-width: 5.5rem; padding: .05rem .45rem; border-radius: 3px; font-weight: 700; text-decoration: none; background: var(--muted); color: #fff; font-variant-numeric: tabular-nums; }
.train-badge.cat-r, .train-badge.cat-rm { background: #2e7d32; } .train-badge.cat-re { background: #00838f; }
.train-badge.cat-ir, .train-badge.cat-irn { background: #c62828; } .train-badge.cat-ic { background: #6a1b9a; }
/* the train's page */
.train-facts { font-variant-numeric: tabular-nums; }
.week { display: flex; gap: .3rem; list-style: none; padding: 0; margin: .25rem 0 .5rem; }
.week li { width: 2.2rem; text-align: center; padding: .2rem 0; border-radius: 3px; font-weight: 700; font-size: .85rem; }
.week li.on { background: #2e7d32; color: #fff; } .week li.off { background: var(--border); color: var(--muted); text-decoration: line-through; }
.periods { columns: 18rem; font-size: .9rem; font-variant-numeric: tabular-nums; }
.composition { margin: .5rem 0 1rem; overflow-x: auto; }
.cars { display: flex; align-items: flex-end; gap: 2px; list-style: none; padding: 0; margin: 0; min-width: max-content; }
.car { display: flex; flex-direction: column; align-items: center; }
.car svg { height: 44px; width: auto; display: block; }
.car .body { fill: #1f5f8b; } .car .window { fill: #dbeefa; } .car .stripe { fill: #ffb400; } .car .wheel { fill: #333; }
.car-locomotive .body { fill: #c62828; } .car-locomotive .stripe { fill: #fff; }
.car-railcar .body { fill: #2e7d32; } .car-railcar .stripe { fill: #fff; }
.car-class1 .stripe { fill: #ffd400; } .car-class2 .stripe { fill: #4caf50; }
.car-restaurant .body { fill: #8e2424; } .car-couchette .body, .car-sleeper .body { fill: #1a237e; } .car-bike .body { fill: #546e7a; }
.car-label { font-size: .72rem; color: var(--muted); margin-top: .15rem; white-space: nowrap; }
.route-table tr.through { display: none; } .route-table tr.through td { font-size: .85rem; color: var(--muted); }
body:has(#show-through:checked) .route-table tr.through { display: table-row; }
.running .week + p { margin-top: 0; }
/* the webmasters' page */
.webmaster-form { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); align-items: end; }
.webmaster-preview iframe { width: 100%; height: 500px; border: 0; border-radius: var(--radius); background: #111; }
.embed-code { width: 100%; font-family: ui-monospace, monospace; font-size: .8rem; }
/* a station field's suggestions */
.station-field { position: relative; }
.station-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: .25rem 0; list-style: none; background: var(--surface, #fff); border: 1px solid var(--border, #ccd); border-radius: var(--radius, 6px); box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 18rem; overflow-y: auto; }
.station-list li { padding: .4rem .75rem; cursor: pointer; }
.station-list li[aria-selected="true"], .station-list li:hover { background: var(--accent, #12355b); color: #fff; }
/* the timetable's home: the journey search first, in the middle */
.trains-hero { margin: clamp(.5rem, 3vw, 2rem) 0 2rem; display: flex; justify-content: center; }
.trains-hero-card { width: min(100%, 60rem); padding: clamp(1.25rem, 4vw, 2.5rem); border-radius: 12px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #1d4f84 0%, #12355b 55%, #0b2440 100%); box-shadow: 0 18px 40px rgba(18, 53, 91, .28); position: relative; overflow: hidden; }
.trains-hero-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; opacity: .55;
  background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255,255,255,.55) 14px 18px) 0 3px / 100% 4px no-repeat,
              linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)) 0 1px / 100% 1px no-repeat,
              linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7)) 0 8px / 100% 1px no-repeat; }
.trains-hero h1 { color: #fff; margin: 0 0 .25rem; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.trains-hero-lead { margin: 0 0 1.25rem; color: #cfe0f2; }
.trains-hero .journey-form { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .9rem; margin: 0; }
.trains-hero label, .trains-hero .journey-more summary { color: #dce8f5; font-weight: 600; }
.trains-hero input, .trains-hero select { font-size: 1.05rem; padding: .7rem .8rem; border-radius: 8px; border: 2px solid transparent; background: #fff; color: #10233a; width: 100%; }
.trains-hero input:focus, .trains-hero select:focus { border-color: #ffb400; outline: none; box-shadow: 0 0 0 3px rgba(255,180,0,.35); }
.trains-hero button[type="submit"] { grid-column: 1 / -1; justify-self: center; min-width: min(100%, 16rem); font-size: 1.1rem; padding: .8rem 2rem; border-radius: 8px;
  background: #ffb400; color: #10233a; border: 0; font-weight: 800; letter-spacing: .02em; cursor: pointer; }
.trains-hero button[type="submit"]:hover { background: #ffc633; }
.trains-hero .check { color: #dce8f5; }
.trains-hero .station-list li { color: #10233a; }
.trains-hero-note { margin: 1rem 0 0; font-size: .85rem; color: #a9c1db; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: .5rem 0 1rem; }
.chips a { display: inline-block; padding: .35rem .8rem; border-radius: 999px; background: var(--surface, #fff); border: 1px solid var(--border, #ccd); text-decoration: none; }
.chips a:hover { border-color: var(--accent, #12355b); }
.trains-tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); margin: 1.5rem 0 2rem; }
.trains-tiles .tile { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; padding: 1rem 1.1rem; }

.trains-hero .field { min-width: 0; }
@media (max-width: 640px) {
  .trains-hero .journey-form { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .trains-hero .journey-form .field:nth-child(-n+3) { grid-column: 1 / -1; }  /* from, to on their own lines */
  .trains-hero input, .trains-hero select { font-size: 1rem; padding: .6rem .65rem; }
}
@media (max-width: 640px) { #board table.board th:nth-child(4), #board table.board td:nth-child(4) { display: none; } }
.bus-badge { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 3px; background: #ffb400; color: #10233a; font-size: .75rem; font-weight: 700; text-transform: uppercase; vertical-align: middle; }
.car-bus svg { height: 52px; } .car-bus .body { fill: #ffb400; } .car-bus .stripe { fill: #12355b; } .car-bus .door { fill: #c8d9ea; } .car-bus .hub { fill: #bbb; }

