/* Layout concept: an expedition ledger. A navy masthead, then a timeline ribbon you can tap
   to pick an era, region chips beneath it, and a grid of journey cards stamped with their years. */
:root {
  --paper: #f2f4f1;
  --surface: #ffffff;
  --ink: #1c2a35;
  --muted: #56646e;
  --line: #d3dad5;
  --band: #1c2a35;
  --band-fg: #eef2ee;
  --band-muted: #a9b7bf;
  --accent: #c98a12;
  --accent-ink: #1c2a35;
  --focus: #2f6fd0;

  --era-ancient: #b07a1c;
  --era-medieval: #7b4f80;
  --era-exploration: #2c7470;
  --era-frontier: #b2522c;
  --era-modern: #3e5c88;

  --display: "Zilla Slab", "Rockwell", "Roboto Slab", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11181e; --surface: #19232b; --ink: #e5ebe8; --muted: #9caab2; --line: #2b3842;
    --band: #0a1116; --band-fg: #eef2ee; --band-muted: #93a3ac;
    --accent: #e0a63a; --accent-ink: #11181e; --focus: #7fb0ff;
    --era-ancient: #d9a446; --era-medieval: #b48bc0; --era-exploration: #5cb3ad;
    --era-frontier: #e07f56; --era-modern: #7f9fd3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11181e; --surface: #19232b; --ink: #e5ebe8; --muted: #9caab2; --line: #2b3842;
  --band: #0a1116; --band-fg: #eef2ee; --band-muted: #93a3ac;
  --accent: #e0a63a; --accent-ink: #11181e; --focus: #7fb0ff;
  --era-ancient: #d9a446; --era-medieval: #b48bc0; --era-exploration: #5cb3ad;
  --era-frontier: #e07f56; --era-modern: #7f9fd3;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Masthead */
.masthead {
  background: var(--band);
  color: var(--band-fg);
  margin-top: calc(-1 * env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
.masthead .wrap { padding-block: 2.25rem 2rem; display: grid; gap: 0.75rem; }
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--band-muted); text-decoration: none;
}
.brand svg { flex: none; }
.masthead h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.1rem, 5.5vw, 3.6rem); line-height: 1.02; letter-spacing: -0.01em;
  margin: 0; max-width: 18ch; text-wrap: balance;
}
.masthead h1 em { font-style: normal; color: var(--accent); }
.masthead p { margin: 0; max-width: 58ch; color: var(--band-muted); font-size: 1.08rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.35rem 0 0; padding: 0; list-style: none;
  font-family: var(--mono); font-size: 0.82rem; color: var(--band-fg); }
.facts li::before { content: "✓ "; color: var(--accent); }

/* Filters */
.filters { padding-block: 1.75rem 0.5rem; display: grid; gap: 1.35rem; }
.filter-label {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.5rem;
}

.timeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.era-btn {
  --c: var(--muted);
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); cursor: pointer; text-align: left;
  padding: 0; display: grid; grid-template-rows: auto 26px; overflow: hidden; min-width: 0;
  font: inherit;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.era-btn .era-text { padding: 0.55rem 0.65rem 0.4rem; display: grid; gap: 0.1rem; min-width: 0; }
.era-btn .era-name { font-family: var(--display); font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.era-btn .era-dates { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.era-btn .track { position: relative; background: color-mix(in srgb, var(--c) 14%, transparent); border-top: 3px solid var(--c); }
.era-btn .dot {
  position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--surface);
}
.era-btn:hover { border-color: var(--c); }
.era-btn[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.timeline.has-pick .era-btn[aria-pressed="false"] { opacity: 0.55; }
.era-btn .era-count { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  appearance: none; font: inherit; font-size: 0.95rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 0.38rem 0.85rem; display: inline-flex; align-items: center; gap: 0.45rem;
}
.chip .n { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.75; }

.status { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem;
  border-top: 1px solid var(--line); padding-top: 1rem; }
.status p { margin: 0; color: var(--muted); }
.status strong { color: var(--ink); }
.linkish { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Game grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; padding: 1rem 0 3rem; list-style: none; margin: 0; }
.card {
  --c: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; grid-template-rows: auto 1fr auto; min-width: 0; overflow: hidden;
}
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
  padding: 0.7rem 1rem; border-bottom: 1px dashed var(--line); }
.stamp { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; color: var(--c); font-variant-numeric: tabular-nums; }
.era-tag { text-decoration: none; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: right; }
.card-body { padding: 1rem 1rem 0.5rem; display: grid; gap: 0.55rem; align-content: start; min-width: 0; }
.card h2 { font-family: var(--display); font-size: 1.45rem; line-height: 1.12; margin: 0; text-wrap: balance; }
.card h2 a { text-decoration: none; }
.card h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.place { margin: 0; font-size: 0.92rem; color: var(--muted); display: flex; gap: 0.35rem; }
.place svg { flex: none; margin-top: 0.22rem; }
.hook { margin: 0; }
.manage { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.25rem 0 0; padding: 0; list-style: none; }
.manage li { font-family: var(--mono); font-size: 0.74rem; border: 1px solid var(--line); border-radius: 3px; padding: 0.1rem 0.4rem; color: var(--muted); }
.card-foot { padding: 0.85rem 1rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.soon { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  border-radius: var(--radius); padding: 0.55rem 1rem; border: 0; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.era-ancient { --c: var(--era-ancient); }
.era-medieval { --c: var(--era-medieval); }
.era-exploration { --c: var(--era-exploration); }
.era-frontier { --c: var(--era-frontier); }
.era-modern { --c: var(--era-modern); }

.empty { padding: 2rem 0 4rem; color: var(--muted); }
.empty h2 { font-family: var(--display); color: var(--ink); margin: 0 0 0.3rem; }

/* Parents band */
.parents { border-top: 1px solid var(--line); background: var(--surface); }
.parents .wrap { padding-block: 2.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1.5rem 2.5rem; }
.parents h2 { font-family: var(--display); font-size: 1.5rem; margin: 0 0 0.4rem; }
.parents p { margin: 0 0 0.6rem; max-width: 60ch; }
.fine { font-size: 0.85rem; color: var(--muted); }

.site-foot .wrap { padding-block: 1.5rem 2.5rem; font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }

/* Launch page */
.crumb { font-family: var(--mono); font-size: 0.8rem; color: var(--band-muted); text-decoration: none; }
.crumb:hover { color: var(--band-fg); }
.play-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-family: var(--mono); font-size: 0.85rem; color: var(--band-muted); margin: 0; padding: 0; list-style: none; }
.play-meta .yr { color: var(--accent); font-weight: 600; }
.stage-wrap { padding-block: 1.75rem 0; }
.stage {
  aspect-ratio: 16 / 10; max-width: min(100%, 60rem); width: 100%; margin-inline: auto;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface);
  display: grid; place-items: center; text-align: center; padding: 1.5rem;
}
.stage h2 { font-family: var(--display); margin: 0 0 0.3rem; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.stage p { margin: 0 auto; color: var(--muted); max-width: 44ch; }
.play-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2rem; padding-block: 2rem 3rem; }
@media (max-width: 760px) { .play-cols { grid-template-columns: minmax(0, 1fr); } }
.play-cols h2 { font-family: var(--display); font-size: 1.4rem; margin: 0 0 0.5rem; }
.play-cols p { margin: 0 0 0.75rem; max-width: 62ch; }
.dig { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.1rem 1.2rem; align-self: start; }
.dig ol { margin: 0.25rem 0 0.75rem; padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.dig .slot { color: var(--muted); font-style: italic; }

@media (max-width: 640px) {
  .timeline { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .era-btn .era-text { padding: 0.45rem 0.35rem 0.35rem; }
  .era-btn .era-name { font-size: 0.74rem; overflow-wrap: anywhere; }
  .era-btn .era-dates { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.era-btn .era-name.short { display: none; }
@media (max-width: 640px) {
  .era-btn .era-name.full { display: none; }
  .era-btn .era-name.short { display: block; }
}

/* Era hub */
.era-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.era-tab { font-family: var(--mono); font-size: 0.8rem; color: var(--band-muted); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--band-fg) 22%, transparent); border-radius: 999px; padding: 0.25rem 0.7rem; }
.era-tab:hover { color: var(--band-fg); border-color: var(--c); }
.era-tab[aria-current="page"] { color: var(--band); background: var(--band-fg); border-color: var(--band-fg); }
.stage.live { display: block; padding: 0; border: 0; background: var(--band); overflow: hidden; border-bottom: 4px solid var(--c, var(--accent)); }
.stage.live canvas { display: block; }
.journeys { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.journey { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.journey.is-playing { border-color: var(--c); box-shadow: inset 4px 0 0 var(--c); }
.journey-text { min-width: 0; display: grid; gap: 0.2rem; }
.journey h3 { font-family: var(--display); font-size: 1.3rem; margin: 0; line-height: 1.15; }
.journey p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.journey .btn { flex: none; }
@media (max-width: 520px) { .journey { flex-direction: column; align-items: stretch; } }
.status-links { display: flex; gap: 1rem; align-items: baseline; }
.era-tag:hover { text-decoration: underline; color: var(--c); }
