/* ==========================================================================
   DMO Tracker — shared site stylesheet
   Two-theme system: LIGHT = Anthropic warm-cream editorial (default);
                     DARK  = PlayStation channel-tile dark.
   Theme is set via [data-theme="light"|"dark"] on <html> by js/theme.js.
   See DESIGN-dmo.md for the dark-theme token reference.
   ========================================================================== */

/* Prompt font loads via <link rel="preconnect"> + stylesheet in each page's
   <head> — no @import here (render-blocking CSS chain). */

/* ============================================================
   LIGHT theme (default) — Minimal white + blue
   ============================================================ */
:root {
  /* Surfaces — pure white floor, very subtle blue-tinted tiles */
  --canvas: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-card: #f1f5fb;
  --surface-strong: #e3ebf5;
  --surface-dark: #0b1220;         /* deep navy — footer */
  --surface-dark-elevated: #1c2638;
  --surface-dark-soft: #131b2a;

  /* Text — deep navy ink, not pure black */
  --ink: #0b1220;
  --body-strong: #1c2638;
  --body: #3d4a60;
  /* #6b7891 fell under WCAG AA (4.5) on every surface it is actually used on:
     4.45 on white, 4.22 on --surface-soft, 4.07 on --surface-card and 3.70 on
     --surface-strong. This value clears 4.5 on all four (5.66 / 5.36 / 5.17 /
     4.71). Dark mode was already fine at 7.35-7.76 and is left alone. */
  --muted: #5c6879;
  --muted-soft: #94a0b3;

  /* Text on dark surfaces (footer) */
  --on-dark: #ffffff;
  --on-dark-soft: #94a0b3;
  --on-primary: #ffffff;

  /* Brand — clean blue */
  --primary: #2563eb;
  --primary-active: #1d4ed8;
  --primary-soft: #dbeafe;
  --accent-cyan: #2563eb;          /* light theme: cyan slot collapses to primary */
  --accent-cyan-glow: transparent; /* no glow effect in light theme */
  --teal: #0891b2;
  --amber: #d97706;

  /* Legacy --coral aliases (existing markup keeps rendering) */
  --coral: var(--primary);
  --coral-active: var(--primary-active);
  --coral-soft: var(--primary-soft);

  /* Hairlines — subtle blue-tinted gray, minimal border style */
  --hairline: #d4def0;
  --hairline-soft: #e8edf5;

  /* Per-theme typography swap */
  --display-font: "Prompt", "Segoe UI", sans-serif;
  --display-weight: 400;
  --display-tracking: -0.7px;

  /* Per-theme hover effect on .card / .feature tiles */
  --card-hover-border: var(--primary);
  --card-hover-transform: none;
  --card-hover-shadow: none;
  --feature-hover-transform: translateY(-2px);

  /* Legacy aliases — existing markup keeps rendering against the new palette */
  --bg: var(--canvas);
  --surface: var(--canvas);
  --text: var(--ink);
  --text-muted: var(--muted);
  --text-soft: var(--muted-soft);
  --accent: var(--coral);
  --accent-bright: var(--coral);
  --accent-bg: var(--surface-card);
  --accent-border: var(--hairline);
  --border: var(--hairline);
  --border-soft: var(--hairline-soft);
  --rail: var(--hairline);
  --rail-node: var(--coral);
  --orange: var(--amber);
  --orange-bg: #eff6ff;           /* minimal blue-tinted wash for .note */
  --green: var(--teal);
  --red: var(--coral-active);

  /* Shape + elevation */
  --radius-xs: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(20,20,19,0.04);
  --shadow: 0 2px 8px rgba(20,20,19,0.06);
  --shadow-lg: 0 8px 24px rgba(20,20,19,0.08);

  --rail-thick: 1px;
}

/* ============================================================
   DARK theme — PlayStation channel-tile
   ============================================================ */
:root[data-theme="dark"] {
  /* Surfaces — channel-tile ladder on deep blue-black */
  --canvas: #0a0a0f;
  --surface-soft: #11151c;
  --surface-card: #1a1f2e;
  --surface-strong: #232838;
  --surface-dark: #050608;
  --surface-dark-elevated: #11151c;
  --surface-dark-soft: #0a0a0f;

  /* Text — WCAG AA-tuned for canvas + surface-card */
  --ink: #f5f7fa;
  --body-strong: #dde2ea;
  --body: #c2c9d4;
  --muted: #9aa3b1;
  --muted-soft: #828b99;

  --on-dark: #f5f7fa;
  --on-dark-soft: #b6bcc8;
  --on-primary: #ffffff;

  /* Brand — PlayStation Blue */
  --primary: #0070d1;
  --primary-active: #005ba8;
  --primary-soft: #1a3a6e;
  --accent-cyan: #5eb1ef;
  --accent-cyan-glow: rgba(94, 177, 239, 0.18);
  --teal: #00d9c0;
  --amber: #f5a623;

  --hairline: #2a2f3d;
  --hairline-soft: #1f2330;

  /* Typography swap → tight modern sans */
  --display-font: "Prompt", "SST Pro", "Segoe UI", sans-serif;
  --display-weight: 700;
  --display-tracking: -0.8px;

  /* Hover effect → cyan glow + scale (PS signature) */
  --card-hover-border: var(--accent-cyan);
  --card-hover-transform: scale(1.005);
  --card-hover-shadow: 0 0 0 1px var(--accent-cyan-glow), 0 12px 24px var(--accent-cyan-glow);
  --feature-hover-transform: translateY(-2px) scale(1.01);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: "Prompt", "StyreneB", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  margin: 0; color: var(--body); background: var(--canvas);
  line-height: 1.55; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--coral); text-decoration: none; }
a:hover { color: var(--coral-active); text-decoration: underline; }

/* Display headlines (Hero h1, large section heads) — theme-swappable */
h1, .display, .display-xl, .display-lg, .display-md {
  font-family: var(--display-font);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  color: var(--ink);
}

/* Section / card titles use sans for utility */
h2, h3, h4 {
  font-family: "Prompt", "StyreneB", "Segoe UI", sans-serif;
  color: var(--ink);
}

/* --- Sticky top nav -- cream, no blur ---------------------------------- */

.site-nav {
  position: sticky; top: 0; z-index: 30;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}
.site-nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 24px;
  height: 64px;
}
.site-nav .brand {
  font-weight: 600; letter-spacing: -0.2px; font-size: 15px;
  color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.site-nav .brand .dot {
  width: 14px; height: 14px;
  background:
    conic-gradient(from 0deg,
      var(--ink) 0deg 22deg, transparent 22deg 90deg,
      var(--ink) 90deg 112deg, transparent 112deg 180deg,
      var(--ink) 180deg 202deg, transparent 202deg 270deg,
      var(--ink) 270deg 292deg, transparent 292deg 360deg);
  border-radius: 0;
  display: inline-block;
  /* Anthropic radial-spike mark — 4-spoke asterisk-style */
}
.site-nav .brand:hover { color: var(--coral); }
.site-nav nav { display: flex; gap: 4px; flex: 1; }
.site-nav nav a {
  color: var(--body); text-decoration: none;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.site-nav nav a:hover { background: var(--surface-card); color: var(--ink); }
.site-nav nav a.is-active { background: var(--surface-card); color: var(--ink); }
.site-nav .nav-meta {
  color: var(--muted-soft); font-size: 12px;
  font-family: "JetBrains Mono", "Consolas", monospace;
}

/* --- Page wrapper ------------------------------------------------------ */

.page {
  max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px;
}
.page.has-toc {
  display: grid; grid-template-columns: 220px 1fr; gap: 36px;
}
@media (max-width: 900px) {
  .page.has-toc { grid-template-columns: 1fr; }
  .toc { position: static !important; max-height: none !important; }
}

/* --- Hero strip — cream, no gradient ---------------------------------- */

.hero {
  background: var(--surface-card);
  color: var(--ink);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  margin-bottom: 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 24px;
  border: 1px solid var(--hairline);
}
.hero h1 {
  margin: 0; font-size: 36px; font-weight: 400;
  letter-spacing: -0.8px; line-height: 1.1;
  font-family: var(--display-font);
}
.hero p.lead {
  margin: 8px 0 0; font-size: 15px;
  color: var(--body); max-width: 540px;
}
.hero-stats { display: flex; gap: 28px; }
.hero-stat { text-align: center; padding: 0 4px; }
.hero-stat .num {
  font-size: 32px; font-weight: 400; line-height: 1;
  color: var(--ink);
  font-family: var(--display-font);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.hero-stat .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-top: 6px; font-weight: 500;
}

/* --- Table of contents (sidebar) -------------------------------------- */

.toc {
  position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--canvas); border-radius: var(--radius-lg);
  padding: 16px 14px; font-size: 13px;
  border: 1px solid var(--hairline);
}
.toc h3 {
  margin: 0 0 10px; color: var(--ink); font-size: 11px;
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
  border-bottom: 1px solid var(--hairline-soft); padding-bottom: 8px;
}
.toc h4 {
  margin: 14px 0 4px; font-size: 10px; color: var(--muted-soft);
  text-transform: uppercase; letter-spacing: 1.4px; font-weight: 500;
}
.toc a {
  color: var(--body); text-decoration: none; display: block;
  padding: 4px 8px; border-radius: var(--radius-xs); line-height: 1.4;
  transition: background 0.12s, color 0.12s;
}
.toc a:hover { background: var(--surface-card); color: var(--ink); }
.toc a.is-active { background: var(--surface-card); color: var(--ink); font-weight: 500; }

/* --- Filter bar ------------------------------------------------------- */

.filter-bar {
  background: var(--canvas); border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 24px;
  border: 1px solid var(--hairline);
}
.filter-bar h4 {
  margin: 0 0 8px; font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
}
.filter-bar h4 .hint {
  font-weight: 400; text-transform: none; color: var(--muted-soft);
  font-size: 10.5px; margin-left: 6px; letter-spacing: 0;
}
.filter-group {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center;
}
.filter-group:last-child { margin-bottom: 0; }
.filter-pill {
  padding: 5px 12px 5px 6px; border-radius: 9999px;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--hairline);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  opacity: 0.7; transition: opacity 0.12s, transform 0.12s, background 0.12s;
  background: var(--canvas); color: var(--body);
}
.filter-pill:hover { opacity: 1; background: var(--surface-card); }
.filter-pill.active {
  opacity: 1; background: var(--coral); color: var(--on-primary);
  border-color: var(--coral);
}
.filter-pill img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
/* filter-pill used as a plain link (related-tools rows) */
a.filter-pill { padding: 5px 12px; text-decoration: none; }
a.filter-pill:hover { text-decoration: none; color: var(--ink); }

.filter-reset {
  background: transparent; color: var(--coral); border: none;
  padding: 4px 8px; font-size: 12px; cursor: pointer;
  font-weight: 500; text-decoration: underline;
}
.filter-reset:hover { color: var(--coral-active); }
.filter-count { font-size: 11px; color: var(--muted); margin-left: auto;
                font-family: "JetBrains Mono", "Consolas", monospace; }

/* Attribute colour variants — keep semantic tints but mute them */
.filter-pill.chip-attr-VA { background: #e5efde; color: #4a6a2f; border-color: #d5e3c4; }
.filter-pill.chip-attr-VI { background: #e8d8e8; color: #6b3868; border-color: #d6c0d6; }
.filter-pill.chip-attr-DA { background: #dde5e5; color: #2f5f6a; border-color: #c8d5d6; }
.filter-pill.chip-attr-FR { background: #f0e4cc; color: #8a6a1a; border-color: #e1d2b3; }
.filter-pill.chip-attr-UN { background: var(--surface-card); color: var(--body); }
.filter-pill.chip-elem { background: var(--surface-soft); color: var(--body); }
.filter-pill.chip-families { background: #fbe9d2; color: #8a5b1a; border-color: #f0d4a8; }
.filter-pill.active.chip-attr-VA,
.filter-pill.active.chip-attr-VI,
.filter-pill.active.chip-attr-DA,
.filter-pill.active.chip-attr-FR,
.filter-pill.active.chip-attr-UN,
.filter-pill.active.chip-elem,
.filter-pill.active.chip-families {
  background: var(--coral); color: var(--on-primary); border-color: var(--coral);
}

/* --- Timeline rail ---------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: ""; position: absolute;
  left: 12px; top: 8px; bottom: 8px;
  width: 1px; background: var(--hairline);
}

.tl-month {
  position: relative;
  margin: 20px 0 14px -32px;
  padding-left: 32px;
  display: flex; align-items: center; gap: 12px;
}
.tl-month::before {
  content: ""; position: absolute;
  left: 8px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px;
  background: var(--coral); border-radius: 0;
  /* small square node to echo Anthropic's geometric marks */
  box-shadow: 0 0 0 4px var(--canvas);
}
.tl-month-label {
  font-size: 11px; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: 1.5px;
  font-family: "Prompt", sans-serif;
}
.tl-month-count {
  font-size: 11px; color: var(--muted-soft);
  font-family: "JetBrains Mono", "Consolas", monospace;
}

.tl-entry {
  position: relative;
  margin: 0 0 18px 0;
}
.tl-entry::before {
  content: ""; position: absolute;
  left: -25px; top: 22px;
  width: 7px; height: 7px;
  background: var(--canvas);
  border: 1px solid var(--muted);
}

/* --- Entry card ------------------------------------------------------- */

.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--card-hover-border);
  transform: var(--card-hover-transform);
  box-shadow: var(--card-hover-shadow);
}

.card-head {
  padding: 16px 20px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-date {
  font-size: 11px; font-weight: 500; color: var(--muted);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "Consolas", monospace;
}
.card-kind-badge {
  font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 9999px;
  letter-spacing: 1.2px; text-transform: uppercase;
  background: var(--surface-card); color: var(--body);
}
.card-idx {
  font-size: 11px; color: var(--muted-soft);
  font-family: "JetBrains Mono", "Consolas", monospace;
}
.card-title {
  margin: 8px 20px 12px;
  font-size: 22px; font-weight: 400; color: var(--ink);
  line-height: 1.25;
  font-family: var(--display-font);
  letter-spacing: -0.4px;
}
/* a digimon only KR has so far -- same colour as the KR source chip */
.kr-only-badge {
  display: inline-block; vertical-align: 4px; margin-left: 8px;
  font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0;
  padding: 2px 8px; border-radius: 9999px;
  background: var(--coral); color: var(--on-primary);
}
.card-body { padding: 0 20px 18px; }
.card-image {
  display: block; max-width: 100%; max-height: 320px;
  margin: 4px auto 14px;       /* center horizontally inside its card */
  border-radius: var(--radius); border: 1px solid var(--hairline);
  object-fit: contain; background: var(--surface-soft);
}
/* one picture per digimon of a post: side by side when the card is wide */
.card-gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 12px; align-items: start;
}
.card-gallery .card-image { margin: 4px 0 14px; width: 100%; }

/* Source links */
.sources { display: flex; flex-wrap: wrap; gap: 4px 14px;
           font-size: 12px; padding: 0 20px 14px; }
.sources .src-item { display: inline-flex; align-items: center; gap: 6px; }
.sources .src-label {
  font-weight: 600; font-size: 9.5px; letter-spacing: 1.3px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 9999px;
  background: var(--surface-card); color: var(--body);
}
.sources .src-item.is-na .src-label { background: var(--amber); color: var(--on-primary); }
.sources .src-item.is-kr .src-label { background: var(--coral); color: var(--on-primary); }
.sources .src-item.is-th .src-label { background: var(--teal); color: var(--on-primary); }
.sources .src-date { color: var(--muted-soft); font-size: 10.5px;
                     font-variant-numeric: tabular-nums;
                     font-family: "JetBrains Mono", monospace; }
.sources .src-item a { color: var(--body); font-size: 11.5px; }
.sources .src-item a:hover { color: var(--coral); }
/* NA/KR/TH badge is itself the clickable link (URL text removed) */
.sources .src-item a.src-label {
  font-size: 9.5px; text-decoration: none; cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
}
.sources .src-item a.src-label:hover { opacity: 0.82; filter: brightness(1.08); }

/* --- Digimon list (chip rows) ----------------------------------------- */

.digimon-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.digimon-list li {
  padding: 12px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 15px; font-weight: 500; color: var(--ink);
  border: 1px solid var(--hairline);
}
.digimon-name { display: block; margin-bottom: 8px; font-size: 14px;
                font-weight: 500; color: var(--ink); }
.chips-row {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
  align-items: center; font-size: 11px; color: var(--muted);
}
.chips-row .chips-label {
  font-weight: 600; text-transform: uppercase; letter-spacing: 1.3px;
  font-size: 10px; color: var(--muted-soft); min-width: 72px;
}
.chip-icon-only {
  width: 24px; height: 24px; object-fit: contain; cursor: help;
  transition: transform 0.12s;
}
.chip-icon-only:hover { transform: scale(1.18); }
.rebalance-src {
  margin-left: 8px; font-size: 10px; color: var(--coral);
  text-decoration: none; padding: 2px 8px; border-radius: 9999px;
  background: var(--surface-card); font-weight: 500;
}
.rebalance-src:hover { background: var(--coral); color: var(--on-primary); }

/* --- Deck-specific (decks.html) --------------------------------------- */

.deck {
  margin: 14px 0 0; padding: 16px 18px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
}
.deck-name {
  font-size: 17px; font-weight: 400; color: var(--ink);
  margin-bottom: 12px;
  font-family: var(--display-font);
  letter-spacing: -0.2px;
}
.gk-label {
  font-size: 12px; font-weight: 600; color: var(--ink);
  margin: 14px 0 6px; padding: 0;
  text-transform: uppercase; letter-spacing: 1.3px;
}
.gk-table {
  border-collapse: collapse; margin: 4px auto 10px;   /* center horizontally */
  background: var(--canvas); font-size: 13px;
  border-radius: var(--radius-xs); overflow: hidden;
}
.gk-table th, .gk-table td {
  border: 1px solid var(--hairline); padding: 7px 14px;
}
.gk-table th {
  background: var(--ink); color: var(--on-dark);
  text-align: center; font-weight: 500;
  font-size: 12px; letter-spacing: 0.5px;
}
.gk-table td { text-align: center; background: var(--canvas); color: var(--body); }
:root[data-theme="dark"] .gk-table th {
  background: var(--surface-strong); color: var(--ink); font-weight: 600;
}
:root[data-theme="dark"] .gk-table td { background: var(--surface-soft); }
.digimon-table { min-width: 280px; }
.effect-table { min-width: 560px; }
@media (max-width: 700px) {
  .effect-table { min-width: 0; width: 100%; }
  .gk-table th, .gk-table td { padding: 6px 8px; font-size: 12px; }
}
.note {
  font-size: 12px; color: var(--body); font-style: normal;
  margin-top: 8px; padding: 8px 12px;
  background: var(--orange-bg);
  border-radius: var(--radius-xs);
}
:root[data-theme="dark"] .note {
  color: var(--amber);
  background: rgba(245, 166, 35, 0.08);
  border-left: 2px solid var(--amber);
}

/* --- Index landing (feature cards) ------------------------------------ */

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; margin-bottom: 36px;
}
.feature {
  background: var(--surface-card); border-radius: var(--radius-lg);
  padding: 28px; text-decoration: none; color: inherit;
  border: 1px solid var(--hairline);
  transition: border-color 0.15s, transform 0.15s;
  display: flex; flex-direction: column; gap: 8px;
}
.feature:hover {
  border-color: var(--card-hover-border);
  transform: var(--feature-hover-transform);
  box-shadow: var(--card-hover-shadow);
}
.feature.disabled { opacity: 0.55; cursor: not-allowed; }
.feature.disabled:hover { transform: none; border-color: var(--hairline); }
.feature .icon { font-size: 28px; line-height: 1; margin-bottom: 6px; }
.feature h3 {
  margin: 0; color: var(--ink); font-size: 22px; font-weight: 400;
  font-family: var(--display-font);
  letter-spacing: -0.4px;
}
.feature p { color: var(--body); font-size: 13.5px; margin: 0; line-height: 1.5; }
.feature .feature-stats {
  display: flex; gap: 20px; margin-top: 12px; padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.feature .stat { font-size: 12px; color: var(--muted); }
.feature .stat b {
  display: block; color: var(--ink); font-size: 24px; font-weight: 400;
  font-variant-numeric: tabular-nums;
  font-family: var(--display-font);
  letter-spacing: -0.4px;
}
.feature .badge {
  display: inline-block; background: var(--surface-strong); color: var(--muted);
  padding: 3px 12px; border-radius: 9999px; font-size: 10px; font-weight: 600;
  letter-spacing: 1.3px; text-transform: uppercase;
  align-self: flex-start;
}

/* Section header inside page */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 36px 0 16px;
}
.section-header h2 {
  margin: 0; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
}
.section-header .see-all {
  font-size: 12px; color: var(--coral); font-weight: 500;
}

/* --- Footer — dark navy band ----------------------------------------- */

.site-footer {
  background: var(--surface-dark); color: var(--on-dark-soft);
  text-align: center; font-size: 13px;
  padding: 36px 24px; margin-top: 56px;
  border-radius: 0;
}
.site-footer a { color: var(--on-dark); font-weight: 500; }
.site-footer a:hover { color: var(--coral); }

/* --- Theme toggle button (injected by js/theme.js) --------------------- */

.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--body);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
  flex-shrink: 0;
  padding: 0;
  margin-left: 8px;
}
.theme-toggle:hover {
  background: var(--surface-card);
  border-color: var(--card-hover-border);
  color: var(--ink);
}
.theme-toggle:active { transform: scale(0.96); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }

/* Show moon when current theme is light (click → go dark)
   Show sun when current theme is dark  (click → go light) */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle[data-current="dark"] .icon-sun { display: block; }
.theme-toggle[data-current="dark"] .icon-moon { display: none; }

/* --- Mobile ------------------------------------------------------------ */

body { overflow-x: hidden; }

@media (max-width: 720px) {
  .site-nav-inner {
    gap: 10px; padding: 10px 14px; height: auto; min-height: 56px;
  }
  /* nav row scrolls sideways instead of overflowing the page */
  .site-nav nav {
    overflow-x: auto; flex-wrap: nowrap; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Fade hint that more links exist to the right. It is dropped once the row
       is scrolled to the end (js/theme.js sets .is-scroll-end), otherwise the
       last link -- which is the current page on the deepest pages -- stays half
       faded with nowhere left to scroll. */
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .site-nav nav::-webkit-scrollbar { display: none; }
  .site-nav nav.is-scroll-end { mask-image: none; -webkit-mask-image: none; }
  .site-nav nav a { padding: 8px 10px; font-size: 13px; flex-shrink: 0; }
  .site-nav .nav-meta { display: none; }
  .site-nav .brand { flex-shrink: 0; }

  /* Under ~340px the brand and the theme button squeeze the link row down to
     114px, which is narrower than the longest link (116px) -- the current page
     can then never be shown whole, however far the row is scrolled. */
  @media (max-width: 340px) {
    .site-nav-inner { gap: 6px; padding: 10px 8px; }
    .site-nav .brand { font-size: 14px; }
    .site-nav nav a { padding: 8px 7px; }
  }

  .page { padding: 20px 14px 48px; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 27px; }
  .hero-stats { gap: 18px; }
  .hero-stat .num { font-size: 26px; }
  .feature { padding: 20px; }
  .timeline { padding-left: 24px; }
  .tl-month { margin-left: -24px; padding-left: 24px; }
  .tl-entry::before { left: -17px; }

  /* wide tables scroll inside the card, not the page.
     .deck-body is a separate wrapper from .card-body, and the deck tables
     carry min-width: 280px, which is wider than the column they sit in at
     320px -- without this they push the whole page sideways. */
  .card-body, .deck-body { overflow-x: auto; }
}

/* ============================================================
   Poster promo — sections injected by backoffice/publish_posters.py
   (markers POSTERS:top / POSTERS:bottom in each page)
   ============================================================ */
.poster-promo { margin: 28px 0; }
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  justify-content: center;
  gap: 16px;
}
.poster-item {
  display: block; margin: 0;
  border: 1px solid var(--hairline); border-radius: 12px;
  background: var(--surface-card); overflow: hidden;
  text-decoration: none; color: inherit;
}
a.poster-item:hover { border-color: var(--primary); }
.poster-item img { display: block; width: 100%; height: auto; }
.poster-caption {
  margin: 0; padding: 10px 14px;
  font-size: 13px; color: var(--body); text-align: center;
}
