/* Get the latest version — public page. Self-contained (no framework, no shared bundle); the
   palette matches public/dungeontrain/mods/. */

:root {
  --bg: #151816;
  --panel: #1d211e;
  --panel-2: #252a26;
  --line: #3a413b;
  --ink: #e4e8e1;
  --muted: #99a397;
  --accent: #8cc45e;      /* moss green */
  --on-accent: #0f1a0b;
  --gold: #e0a23a;
  --bad: #d15c5c;
  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}
/* The crumbling stone-brick corner the whitelist page uses. */
body::before {
  content: ""; position: fixed; left: 0; bottom: 0; width: 1280px; height: 1040px; pointer-events: none; z-index: 0;
  background: url("../mods/bricks.svg") left bottom / contain no-repeat; opacity: 0.6;
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 0 100%, #000 25%, rgba(0,0,0,0.5) 55%, transparent 85%);
          mask-image: radial-gradient(ellipse 100% 100% at 0 100%, #000 25%, rgba(0,0,0,0.5) 55%, transparent 85%);
}
.top, main, .foot { position: relative; z-index: 1; }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.top { padding: 40px 0 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1c211d, var(--bg)); }
.kicker { margin: 0 0 4px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover, .kicker a:focus-visible { text-decoration: underline; }
h1 { margin: 0 0 10px; font-size: 36px; font-weight: 700; line-height: 1.1; }
h2 { font-size: 20px; margin: 0 0 8px; }
.lede { max-width: 72ch; margin: 0; font-size: 18px; line-height: 1.45; }
.lede strong { color: var(--accent); }
.fine { color: var(--muted); font-size: 14px; }

.launchers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card.latest { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card h2 { margin: 0; }
.card .tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: #1f3320; color: var(--accent); font-size: 12px; font-weight: 600; vertical-align: middle; }
.newest { font-size: 18px; font-weight: 700; }
.detail { margin: 0; color: var(--muted); flex: 1; }
.detail.behind { color: var(--gold); }
.detail.failed { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: flex-start;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font: inherit; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.standalone { font-size: 14px; }

.news-lead { color: var(--muted); }
.changes { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.changes > summary {
  display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; cursor: pointer;
  font-weight: 600; list-style: none;
}
.changes > summary::-webkit-details-marker { display: none; }
.changes > summary::before { content: "▸"; color: var(--accent); transition: transform 0.15s; }
.changes[open] > summary::before { transform: rotate(90deg); }
.changes > summary:hover, .changes > summary:focus-visible { color: var(--accent); }
.changes .count { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 400; }
.changes .entries { padding: 0 12px 12px; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.entries li { padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.entries .title { margin: 0; font-weight: 600; }
.entries .ver { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }
.entries .summary { margin: 2px 0 0; color: var(--muted); }

/* ---- the timeline: one rail, newest at the top ------------------------------------------------- */
.history { margin: 8px 0 24px; --rail: 96px; --indent: 124px; }
/* A node's date sits left of its dot, right-aligned against the rail. */
.node-date {
  position: absolute; left: 0; top: 13px; width: calc(var(--rail) - 18px); text-align: right;
  color: var(--muted); font-size: 13px; line-height: 1.25; font-variant-numeric: tabular-nums;
}
.node-date span { display: block; }
.node-date .year { font-size: 11px; opacity: 0.75; }
.major-node .node-date { color: var(--ink); }
.history-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }

/* Filters: a funnel beside the heading opens rows of toggle chips (filters.js). */
.filter-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.filter-btn:hover, .filter-btn:focus-visible, .filter-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--ink); }
.filter-btn.active::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
/* The categories on show, beside the funnel while the panel is closed: × hides one. */
.active-filters { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.active-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 11px; border: 1px solid var(--accent);
  border-radius: 999px; background: rgba(140, 196, 94, 0.14); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.active-pill .x { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted); font-size: 14px; line-height: 1; }
.active-pill:hover .x, .active-pill:focus-visible .x { background: var(--line); color: var(--ink); }
.filters { display: grid; gap: 10px; margin: -4px 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-row .chips { display: contents; }
.filter-label { min-width: 44px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.chip {
  padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover, .chip:focus-visible { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: rgba(140, 196, 94, 0.14); color: var(--ink); }
.chip-clear { padding: 4px 6px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.history.hide-major .major-node:not(.milestone), .history.hide-milestone .major-node.milestone,
.history.hide-minor .node.gap, .history.hide-blog .origin, .history.hide-blog .vr-node, .tag-out { display: none !important; }
.history-head h2 { margin: 0; }
.history .news-lead { margin: 0 0 14px; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; white-space: normal; }
.md h3, .md h4, .md h5 { margin: 16px 0 6px; font-size: 17px; }
.md ul { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: var(--rail); top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--line);
}
/* The future half of the rail is dashed: track not laid yet. */
.timeline.future::before { background: repeating-linear-gradient(var(--line) 0 6px, transparent 6px 12px); }
.node { position: relative; padding: 0 0 20px var(--indent); }
.node::before {
  content: ""; position: absolute; left: var(--rail); top: 18px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--line); z-index: 1;
}
.when { margin: 0 0 2px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.line { margin: 6px 0 0; color: #b9c2b6; font-size: 15px; overflow-wrap: anywhere; }
/* A major with no curated summary falls back to its first paragraph — keep that preview to 3 lines. */
.tl-major .line.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }

/* Expandable nodes: a <details> whose <summary> is the collapsed card. */
.timeline details > summary { list-style: none; cursor: pointer; }
.timeline details > summary::-webkit-details-marker { display: none; }

.major-node::before { background: var(--accent); border-color: var(--accent); }
.major-node.milestone::before { background: var(--gold); border-color: var(--gold); }
/* Major releases keep the update page's coloured board: green, or gold for a milestone. */
.tl-major {
  overflow: hidden; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tl-major.milestone { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tl-major summary:hover h2, .tl-major summary:focus-visible h2 { color: var(--accent); }
.tl-major.milestone summary:hover h2, .tl-major.milestone summary:focus-visible h2 { color: var(--gold); }
.tl-major .photo { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.tl-major[open] .photo { aspect-ratio: auto; max-height: 420px; }
.tl-major .tl-body { padding: 16px 20px 18px; }
.major-kicker { margin: 0 0 2px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600; }
.tl-major h2 { margin: 0; font-size: 28px; line-height: 1.15; }
.tl-major h2 .ver { color: var(--muted); font-size: 15px; font-weight: 400; margin-left: 8px; }
.tl-major[open] .line { display: none; }
.tl-major .tl-more { padding: 0 20px 18px; }
/* A milestone (a moment, not an update) and a notable update (between a major and a minor one)
   share a smaller board — thumbnail beside the title. */
.tl-major.compact > summary { display: flex; align-items: stretch; }
.tl-major.compact .photo { width: 168px; flex: none; aspect-ratio: 16 / 9; border-bottom: 0; border-right: 1px solid var(--line); }
.tl-major.compact[open] .photo { aspect-ratio: 16 / 9; max-height: none; }
.tl-major.compact .tl-body { padding: 12px 16px; align-self: center; }
.tl-major.compact h2, .tl-major.compact[open] h2 { font-size: 20px; }
.tl-major.compact h2 .ver { font-size: 13px; }
.tl-major.compact .line { font-size: 14px; }
.tl-major.compact .tl-more { padding: 12px 16px 14px; }
.tl-major.notable .major-kicker { color: var(--accent); }
.tl-more { padding: 0 16px 16px; display: grid; gap: 12px; }

/* Between majors: the update page's change-list box, its title the count of minor updates. */
.gap::before { top: 17px; width: 10px; height: 10px; margin-left: -5px; border-color: var(--accent); }
.gap-static { margin: 0; padding: 12px 16px; font-weight: 600; color: var(--muted); }
.gap-releases { display: grid; gap: 14px; padding: 0 12px 12px; }
.gap-releases .entries { padding: 0; }
.rel h3 { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.rel.picked h3 { color: var(--accent); }
.rel.picked .entries li { border-color: var(--accent); }

/* The player's version (?v=). */
.here::before { background: var(--ink); border-color: var(--ink); }
.here { padding-top: 14px; padding-bottom: 34px; }
/* Lines up with the major cards' titles: their 1px border + 20px padding. */
.here-mark { margin: 0; padding-left: 21px; color: var(--ink); font-size: 30px; font-weight: 400; line-height: 1.2; }
.here::before, .here .node-date { top: 26px; }
.here .node-date { top: 21px; color: var(--ink); }
.here-mark .ver { margin-left: 10px; color: var(--muted); font-size: 16px; }

/* The roadmap: dashed future, then "Today". */
.roadmap { margin-bottom: 4px; }
.note {
  margin: 0 0 24px; padding: 16px 20px; border-left: 3px solid var(--accent);
  background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; color: #c9d0c6;
}
.note p { margin: 0; }
.note p + p { margin-top: 10px; }
.note strong { color: var(--ink); }
.node.future::before { border-style: dashed; border-color: var(--muted); }
/* The roadmap, origin and VR cards share the plain panel box; the majors have their own board. */
.tl-future, .tl-origin, .tl-vr { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tl-future { padding: 12px 16px 14px; background: transparent; border-style: dashed; }
.tl-future h2 { margin: 0; font-size: 19px; }
.next::before { border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(140, 196, 94, 0.18); }
.next .tl-future { border: 1px solid var(--accent); background: rgba(140, 196, 94, 0.06); }
.next .when { color: var(--accent); font-weight: 600; }
.next h2 { font-size: 22px; }
.today { position: relative; margin: 0; padding: 4px 0 22px var(--indent); }
.today::before {
  content: ""; position: absolute; left: var(--rail); top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: linear-gradient(transparent, var(--accent));
}
/* "Things I'm always working on": one card, never done, so its dot is solid. */
.node.ongoing::before { border-style: solid; border-color: var(--accent); background: var(--bg); }
.ongoing-list { margin: 8px 0 0; padding-left: 20px; color: #b9c2b6; }
.ongoing-list li { margin: 2px 0; }

/* "Things I want": above the plan, unordered, so tiles rather than a rail. */
.wishes { margin: 0 0 24px var(--indent); }  /* in the cards' column, right of the rail */
.wishes h2 { margin: 0; font-size: 22px; }
.wishes p { margin: 2px 0 12px; color: var(--muted); font-style: italic; }
.wish-tiles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
/* A mosaic: each tile is as wide as its words need, then grows to fill its row — one row tall. */
.wish-tiles li {
  flex: 1 1 auto; padding: 14px 18px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--panel); font-weight: 600; line-height: 1.2; opacity: 0.88;
}
.wish-tiles li:nth-child(3n + 2) { background: var(--panel-2); }
.wish-tiles li:nth-child(3n + 3) { background: #1a1e1b; }
/* "Today" reads like the other dates, left of the rail, beside a dot; hiding the roadmap is a
   reveal-style button in the cards' column. */
.today { padding: 0 0 22px var(--indent); }
.today::after {
  content: ""; position: absolute; left: var(--rail); top: 13px; width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(140, 196, 94, 0.2); z-index: 1;
}
/* "Today" stands out in the date column: big, white, right-aligned against the rail. */
.today-mark {
  position: absolute; top: 4px; right: calc(100% - var(--rail) + 18px); margin: 0; white-space: nowrap;
  color: var(--ink); font-size: 28px; font-weight: 400; line-height: 1.2;
}

/* The original VR game's devlog: the same train, another game — an older, quieter chapter:
   greyed photos, no accent, muted ink. Hover brings a photo's colour back. */
.origin::before, .vr-node::before, .status::before { background: var(--panel-2); border-color: var(--muted); }
.tl-origin { padding: 14px 16px; background: transparent; border-style: dashed; }
.tl-origin h2 { margin: 0; font-size: 22px; color: #c3c8c0; }
.tl-origin a { display: inline-block; margin-top: 8px; font-size: 14px; }
.tl-vr { background: #191b1a; opacity: 0.88; }
.tl-vr summary { display: flex; align-items: center; }
.tl-vr .photo { width: 120px; flex: none; aspect-ratio: 16 / 9; object-fit: cover; filter: grayscale(0.85) brightness(0.85); transition: filter 0.3s; }
.tl-vr:hover .photo, .tl-vr[open] .photo { filter: none; }
.tl-vr .tl-body { padding: 8px 14px; }
.tl-vr h3 { margin: 0; font-size: 16px; color: #c3c8c0; }
.tl-vr .tl-more { padding-top: 10px; color: var(--muted); font-size: 14px; }
.tl-vr .tl-more p { margin: 0; }
.status p { margin: 12px 0 0; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .tl-vr .photo { transition: none; }
}

.foot { padding: 8px 16px 32px; }
.foot .back { margin: 10px 0 0; font-size: 14px; }
.foot .back a { text-decoration: none; }
.foot .back a:hover { text-decoration: underline; }

@media (max-width: 520px) {
  h1 { font-size: 28px; }
  .active-filters { display: none; } /* the pills crowd a phone; the funnel still opens the filters */
  .lede { font-size: 16px; }
  .top { padding-top: 28px; }
  .card { padding: 14px; }
  .card .btn { flex: 1; }
  .entries li { padding: 10px 12px; }
  .history { --rail: 54px; --indent: 72px; }
  .here-mark { padding-left: 15px; font-size: 26px; }
  .today-mark { right: calc(100% - var(--rail) + 15px); font-size: 15px; top: 11px; }
  .node-date { font-size: 11px; width: calc(var(--rail) - 14px); }
  .node-date .year { font-size: 10px; }
  .tl-major h2 { font-size: 23px; }
  .tl-major .tl-body { padding: 14px; }
  .tl-major .tl-more { padding: 0 14px 14px; }
  .tl-major.compact .photo { width: 96px; }
  .tl-major.compact h2 { font-size: 17px; }
  .tl-vr .photo { width: 88px; }
}

/* A linked release lands with a little room above it. */
.tl-major, .rel, .roadmap { scroll-margin-top: 16px; }

/* Hidden stretches of the timeline wait behind a quiet full-width button. */
.reveal::before { display: none; }
.reveal-btn {
  width: 100%; padding: 10px 16px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.reveal-btn:hover, .reveal-btn:focus-visible { border-color: var(--accent); color: var(--ink); }

/* For a player who is behind: back to the launcher buttons, pinned once they scroll away. */
.jump-latest {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10;
  padding: 6px 14px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.jump-latest:hover { filter: brightness(1.08); }

/* Stat milestones: one quiet line on the rail — a blue dot, the number in bold. */
.node.stat { padding-bottom: 16px; }
.node.stat::before { top: 13px; width: 10px; height: 10px; margin-left: -5px; background: var(--stat); border-color: var(--stat); }
.node.stat .node-date { top: 9px; }
.stat-chip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0; padding: 3px 0 0 4px; color: #b9c2b6; font-size: 18px; }
.stat-item { white-space: nowrap; }
.stat-sep { color: var(--muted); }
.stat-chip strong { color: var(--stat); font-size: 24px; font-weight: 700; }
.stat-chip .stat-percent { color: var(--muted); font-size: 15px; }
/* A translation milestone that knows who got it there: click to list them. */
.stat-toggle { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.stat-toggle:hover, .stat-toggle:focus-visible { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 4px; }
.stat-caret { display: inline-block; margin-left: 4px; color: var(--muted); font-size: 13px; transition: transform 0.15s; }
.stat-toggle[aria-expanded="true"] .stat-caret { transform: rotate(180deg); }
.stat-people { list-style: none; margin: 6px 0 0 4px; padding: 0; max-width: 360px; color: var(--muted); font-size: 14px; }
.stat-people li { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.stat-people .who { color: var(--ink); overflow-wrap: anywhere; }
.stat-people a.who { text-decoration: none; }
.stat-people a.who:hover, .stat-people a.who:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.stat-people .lines { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Eye-off on milestones and stats: hides that whole kind. Outside the card on desktop (in the
   margin to the right), inside its top-right corner on phones. */
.hide-kind {
  position: absolute; top: 6px; right: -38px; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer; opacity: 0.55;
}
.node:hover > .hide-kind, .hide-kind:focus-visible { opacity: 1; }
.hide-kind:hover, .hide-kind:focus-visible { border-color: var(--line); color: var(--ink); }
@media (max-width: 960px) {
  .hide-kind { right: 6px; background: rgba(21, 24, 22, 0.75); opacity: 0.85; }
  .node.stat > .hide-kind { right: 0; }
  .node.stat .stat-chip { padding-right: 32px; }
}
.history.hide-stat .node.stat { display: none !important; }
:root { --stat: #6fb3e0; }
