/* World Port — development log.
   Hand-authored. No framework, no JavaScript: every interaction on this page is
   `<details>` or a `:checked` radio.

   ⚠ The token block below MIRRORS the game's canonical design tokens, which live
   in `apps/web/src/app/globals.css` (`:root` + `body.theme-light`). This site is
   a separate static artifact and cannot import them, so they are restated once,
   here, with this pointer — never re-derived or eyeballed. If the game's palette
   moves, move these to match.

   The four status tones are the game's own `--success` / `--accent` / `--warning`
   / `--fg-muted`. Both theme instances were checked with the dataviz palette
   validator against their own surface: adjacent-pair separation clears the
   normal-vision floor in both, and the one tritanopia pair that sits inside the
   6–8 band is relieved by secondary encoding — every meter segment carries a
   direct label, segments are separated by a 2px surface gap, and the "dropped"
   segment is additionally hatched. Colour is never the only signal here. */

:root {
  color-scheme: dark;

  --bg: #0b0d10;
  --surface: #14181d;
  --surface-2: #191e25;
  --border: #2a3038;
  --fg: #e8eaed;
  --fg-muted: #8b94a3;

  --accent: #4f9cf9;
  --success: #4caf50;
  --warning: #f5c842;

  --accent-tint: rgba(79, 156, 249, 0.16);
  --success-tint: rgba(76, 175, 80, 0.16);
  --warning-tint: rgba(245, 200, 66, 0.16);
  --muted-tint: rgba(139, 148, 163, 0.14);

  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.42);

  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-base: 0.9rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.5rem;

  --space-1: 0.25rem;
  --space-2: 0.4rem;
  --space-3: 0.6rem;
  --space-4: 0.85rem;
  --space-5: 1.15rem;
  --space-6: 1.6rem;
  --space-7: 2.4rem;
  --space-8: 3.6rem;

  --radius: 10px;
  --wrap: 60rem;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #faf8f3;
    --surface: #ffffff;
    --surface-2: #f4f1ea;
    --border: #d3d8df;
    --fg: #1a1f2e;
    --fg-muted: #5c6573;

    --accent: #2876d8;
    --success: #2d8c4a;
    --warning: #b8870e;

    --accent-tint: rgba(40, 118, 216, 0.14);
    --success-tint: rgba(45, 140, 74, 0.14);
    --warning-tint: rgba(184, 135, 14, 0.14);
    --muted-tint: rgba(92, 101, 115, 0.12);

    --shadow-sm: 0 4px 14px rgba(26, 31, 46, 0.08);
    --shadow-md: 0 8px 24px rgba(26, 31, 46, 0.1);
  }
}

/* ---------- reset + page ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--fg);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* ---------- masthead ---------- */

.masthead {
  padding-block: var(--space-8) var(--space-7);
  background:
    radial-gradient(
      ellipse 80% 100% at 50% 0%,
      var(--accent-tint),
      transparent 70%
    ),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.masthead h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
}

.tagline {
  font-size: var(--text-lg);
  color: var(--fg-muted);
  max-width: 44rem;
  margin-bottom: var(--space-6);
}

.intro {
  max-width: 46rem;
}

/* ---------- section furniture ---------- */

.section {
  padding-block: var(--space-7);
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section-head {
  margin-bottom: var(--space-5);
}

.section-head h2 {
  font-size: var(--text-xl);
}

.section-head p {
  color: var(--fg-muted);
  margin: var(--space-2) 0 0;
  max-width: 44rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
}

/* ---------- progress meter ----------
   One stacked bar: composition of the work by state. Rounded 4px outer ends
   anchored to the track; a 2px surface-coloured gap between segments so
   adjacent fills never touch. */

.meter {
  display: flex;
  gap: 2px;
  height: 14px;
  margin-bottom: var(--space-4);
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.meter-seg {
  min-width: 3px;
}

.meter-seg[data-status='shipped'] {
  background: var(--success);
}

.meter-seg[data-status='building'] {
  background: var(--accent);
}

.meter-seg[data-status='planned'] {
  background: var(--warning);
}

/* Dropped work is hatched as well as desaturated — the secondary encoding the
   palette check requires, and it reads as "struck" on sight. */
.meter-seg[data-status='struck'] {
  background: repeating-linear-gradient(
    135deg,
    var(--fg-muted) 0 3px,
    transparent 3px 6px
  );
  background-color: var(--muted-tint);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.stat {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-key {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.dot[data-status='shipped'] {
  background: var(--success);
}

.dot[data-status='building'] {
  background: var(--accent);
}

.dot[data-status='planned'] {
  background: var(--warning);
}

.dot[data-status='struck'] {
  background: repeating-linear-gradient(
    135deg,
    var(--fg-muted) 0 2px,
    transparent 2px 4px
  );
  background-color: var(--muted-tint);
}

/* The number wears a text token, never the series colour — the dot beside it
   carries identity. */
.stat-num {
  font-size: var(--text-2xl);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.15;
}

.stat-pct {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.asof {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.asof code {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

/* ---------- release note ---------- */

.release {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5);
}

.release h2 {
  font-size: var(--text-md);
  margin-bottom: var(--space-3);
}

/* ---------- filters ---------- */

.filter-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.filters label {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.filters label:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.filter-input:focus-visible + .filters label,
.filters label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- blocks + timeline ---------- */

.block {
  margin-bottom: var(--space-7);
}

.block:last-child {
  margin-bottom: 0;
}

.block-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.block-head h2 {
  font-size: var(--text-xl);
}

.count {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.block-note {
  color: var(--fg-muted);
  max-width: 44rem;
  margin-bottom: var(--space-5);
}

.group {
  margin-bottom: var(--space-6);
}

.group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--space-3) 0;
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0 0 0 var(--space-6);
  position: relative;
}

/* The timeline spine. */
.entries::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.entry {
  position: relative;
  margin-bottom: var(--space-3);
}

.entry::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-6) + 1px);
  top: 1.15rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--fg-muted);
  z-index: 1;
}

.entry[data-status='shipped']::before {
  border-color: var(--success);
  background: var(--success);
}

.entry[data-status='building']::before {
  border-color: var(--accent);
  background: var(--accent);
}

.entry[data-status='planned']::before {
  border-color: var(--warning);
}

.entry[data-status='struck']::before {
  border-color: var(--fg-muted);
  border-style: dashed;
}

.entry > details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.entry > details[open] {
  box-shadow: var(--shadow-sm);
}

summary {
  display: block;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  background: var(--surface-2);
}

summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.entry-top {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.entry-title {
  font-size: var(--text-md);
  font-weight: 640;
  color: var(--fg);
  flex: 1 1 18rem;
  min-width: 0;
}

.entry[data-status='struck'] .entry-title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--fg-muted);
  color: var(--fg-muted);
}

.entry-summary {
  color: var(--fg-muted);
  font-size: var(--text-base);
  margin: 0;
}

.chev {
  flex: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  transition: transform 0.12s ease;
}

details[open] .chev {
  transform: rotate(90deg);
}

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

/* ---------- badges ---------- */

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.1rem var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge[data-status='shipped'] {
  color: var(--success);
  background: var(--success-tint);
  border-color: var(--success);
}

.badge[data-status='building'] {
  color: var(--accent);
  background: var(--accent-tint);
  border-color: var(--accent);
}

.badge[data-status='planned'] {
  color: var(--warning);
  background: var(--warning-tint);
  border-color: var(--warning);
}

.badge[data-status='struck'] {
  color: var(--fg-muted);
  background: var(--muted-tint);
  border-color: var(--fg-muted);
}

.track-tag {
  flex: none;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.when {
  flex: none;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- entry body ---------- */

.body {
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--border);
  margin-top: var(--space-1);
  padding-top: var(--space-4);
  max-width: 46rem;
}

.why {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--muted-tint);
  border-left: 3px solid var(--fg-muted);
  border-radius: 0 6px 6px 0;
}

.why strong {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: var(--space-1);
}

.why p {
  margin: 0;
  color: var(--fg);
}

.supersede {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* ---------- footer ---------- */

.foot {
  padding-block: var(--space-7) var(--space-8);
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.foot p {
  max-width: 44rem;
}

/* ---------- print ---------- */

@media print {
  :root {
    color-scheme: light;
  }

  .filters,
  .filter-input,
  .chev,
  .skip {
    display: none;
  }

  .entry > details {
    break-inside: avoid;
  }

  .group-head {
    position: static;
  }
}

@media (max-width: 34rem) {
  .masthead {
    padding-block: var(--space-6) var(--space-5);
  }

  .masthead h1 {
    font-size: var(--text-2xl);
  }

  .tagline {
    font-size: var(--text-md);
  }

  .entries {
    padding-left: var(--space-5);
  }

  .entry::before {
    left: calc(-1 * var(--space-5) + 1px);
  }

  summary {
    padding: var(--space-4);
  }

  .body {
    padding-inline: var(--space-4);
  }
}

.provenance {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
}

/* Qualifies the meter directly above it: a percentage of ITEMS is not a
   percentage of TIME. Sits inside the panel, between the numbers and the
   as-of line, because that is where the wrong inference gets made. */
.caveat {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--warning-tint);
  border-left: 3px solid var(--warning);
  border-radius: 0 6px 6px 0;
  font-size: var(--text-sm);
}
