/* ------------------------------------------------------------------
   World Cup 2026 Predictor — placeholder styles (Session 23)

   This is a clean baseline, NOT the final design. Session 24 commits to
   a real aesthetic. Everything themeable lives in the :root block below,
   so that pass is mostly editing variables rather than rewriting rules.
   ------------------------------------------------------------------ */

:root {
  /* --- surfaces & ink (editorial warm-paper theme) ----------------- */
  --bg:        #f7f5ef;   /* warm paper */
  --surface:   #fffdf8;   /* card / table background, a touch brighter */
  --text:      #1b1a17;   /* near-black ink, warm */
  --muted:     #6f6a5f;   /* secondary text, warm grey */
  --border:    #e4e0d6;   /* hairlines */
  --accent:    #1f7a4d;   /* deep pitch green — links, hover */
  --accent-gold: #c98a12; /* champion accent, matches the gold ramp */

  /* --- survival ramp: green, applied to advance→final cells -------- *
   * The generator buckets each probability and tags the cell with a   *
   * tier class (.t-surv-0 … .t-surv-5). Greener = more likely alive.  *
   * Buckets: 0=<1%  1=1–10%  2=10–25%  3=25–50%  4=50–75%  5=75–100%   */
  --t-surv-0: transparent;
  --t-surv-1: #eaf3ec;
  --t-surv-2: #cfe6d4;
  --t-surv-3: #a6d4b0;
  --t-surv-4: #79c08c;
  --t-surv-5: #4ea96e;

  /* --- champion ramp: gold, the hero column ------------------------ *
   * Finer scale at the low end because title odds are compressed:     *
   * Buckets: 0=<1%  1=1–3%  2=3–8%  3=8–15%  4=15–25%  5=25%+          */
  --t-champ-0: transparent;
  --t-champ-1: #f6ecd2;
  --t-champ-2: #f0dca6;
  --t-champ-3: #ecc971;
  --t-champ-4: #e3ad3c;
  --t-champ-5: #d4901a;

  /* --- type system (linked in base.html next step) ----------------- *
   * Fraunces       — editorial serif, headlines + hero numbers        *
   * Hanken Grotesk — clean humanist sans, body + table text           *
   * Spline Sans Mono — tabular figures for every probability cell     */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono:    "Spline Sans Mono", ui-monospace, "SF Mono", monospace;

  /* --- geometry ---------------------------------------------------- */
  --radius:    10px;
  --maxw:      1080px;   /* widened: the grid is 8 columns now */
  --shadow:    0 1px 2px rgba(27, 26, 23, 0.04),
               0 8px 24px rgba(27, 26, 23, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}

/* --- header / nav ------------------------------------------------- */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.25rem;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

/* --- main --------------------------------------------------------- */

.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem;
}

h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 2.4rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0.5rem 0 0.35rem;
}

.lede {
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 60ch;
}

/* --- tournament tree: forecast survival grid ---------------------- *
 * A FiveThirtyEight-style grid. Each row is a team; each column is a  *
 * round; each cell is shaded by P(team reaches that round). The six   *
 * survival columns use the green ramp; the Champion column uses the   *
 * gold ramp and is the visual hero. Tier classes (.t-surv-N /         *
 * .t-champ-N) are written by generate_site.py — see :root for the     *
 * bucket boundaries each tier maps to.                                */

.tree-wrap {
  overflow-x: auto;                  /* horizontal scroll on phones */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tree {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

/* header row — sticky so it stays put while scrolling 48 teams */
.tree thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.7rem 0.55rem;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  text-align: center;
}
.tree thead th.col-rank,
.tree thead th.col-team { text-align: left; }
.tree thead th.col-champ { color: var(--accent-gold); }

/* body cells */
.tree tbody td.col-rank {
  text-align: left;
  width: 2.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.tree tbody td.col-team { text-align: left; white-space: nowrap; }

/* hover: darken every cell uniformly, including the colored ones */
.tree tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(27, 26, 23, 0.05);
}

/* rank + team */
.col-rank {
  text-align: left;
  width: 2.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.col-team { text-align: left; white-space: nowrap; }
.team-name { font-weight: 500; }
.group-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.42rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}

/* probability cells — mono figures so digits line up across rows */
.prob {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text);
}

/* survival ramp (green) */
.t-surv-0 { background: var(--t-surv-0); color: var(--muted); }
.t-surv-1 { background: var(--t-surv-1); }
.t-surv-2 { background: var(--t-surv-2); }
.t-surv-3 { background: var(--t-surv-3); }
.t-surv-4 { background: var(--t-surv-4); }
.t-surv-5 { background: var(--t-surv-5); }

/* champion column — the hero: gold ramp, bolder, divider on its left */
.tree th.col-champ,
.tree td.col-champ { border-left: 1.5px solid var(--border); }
.prob.col-champ { font-size: 0.98rem; font-weight: 600; }
.t-champ-0 { background: var(--t-champ-0); color: var(--muted); }
.t-champ-1 { background: var(--t-champ-1); }
.t-champ-2 { background: var(--t-champ-2); }
.t-champ-3 { background: var(--t-champ-3); }
.t-champ-4 { background: var(--t-champ-4); }
.t-champ-5 { background: var(--t-champ-5); }
/* --- footer ------------------------------------------------------- */

.site-footer {
  max-width: var(--maxw);
  margin: 2rem auto 3rem;
  padding: 1.25rem 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer a { color: var(--accent); }

/* --- per-match page (Session 25) --------------------------------- *
 * Three stacked probability bars (model / sportsbook / Polymarket),  *
 * one outcome trio per bar so the segment boundaries line up across  *
 * sources and divergence reads at a glance. Reuses the Session 24    *
 * type system and warm-paper palette; W/D/L gets its own colour trio *
 * (green / sand / clay) so survival-green and champion-gold keep     *
 * their meaning on the grid page. This block is self-contained: it   *
 * adds its own :root vars and is safe to append.                     */

:root {
  --home: #2f8f5b;   /* home win — pitch green */
  --draw: #d8d0bf;   /* draw     — warm sand   */
  --away: #c46a3f;   /* away win — clay        */
}

.crumb { margin: 0 0 1.25rem; font-size: 0.9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.match-head { margin-bottom: 1.75rem; }
.match-meta {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.match-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.match-title .mt-v {
  font-family: var(--font-body);
  font-weight: 400;
  font-style: italic;
  font-size: 1.3rem;
  color: var(--muted);
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

/* comparison card */
.compare {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem 1.6rem;
  margin-bottom: 1.75rem;
}
.compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.2rem;
}
.compare-head .section-label { margin: 0; }

.legend {
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.sw { width: 0.8rem; height: 0.8rem; border-radius: 3px; display: inline-block; }
.sw-home { background: var(--home); }
.sw-draw { background: var(--draw); }
.sw-away { background: var(--away); }

/* one source row: fixed label column + flexible bar */
.bar-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.bar-row:last-child { margin-bottom: 0; }
.bar-label { font-size: 0.92rem; font-weight: 600; line-height: 1.2; }
.bar-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.1rem;
}

.bar {
  display: flex;
  height: 2.6rem;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}
.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
.seg-pct {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 0.3rem;
}
.seg-home { background: var(--home); }
.seg-away { background: var(--away); }
.seg-home .seg-pct, .seg-away .seg-pct { color: #fff; }
.seg-draw { background: var(--draw); }
.seg-draw .seg-pct { color: var(--text); }

.bar-absent {
  align-items: center;
  padding: 0 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  background: var(--bg);
  border: 1px dashed var(--border);
}
.bar-row--empty .bar-label { color: var(--muted); }

/* divergence callout */
.divergence {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: #f1f6f1;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.75rem;
}
.divergence--note {
  border-left-color: var(--muted);
  background: var(--surface);
}
.divergence-tag {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.divergence--note .divergence-tag { color: var(--muted); }
.divergence-headline {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}
.divergence-text { margin: 0; }

/* preview prose */
.preview { max-width: 64ch; }
.preview p { margin: 0 0 0.85rem; }
.preview-credit { margin-top: 1.1rem; font-size: 0.8rem; color: var(--muted); }
.preview-credit a { color: var(--accent); }

/* --- what-changed panel (Session 26) --------------------------------- *
 * Card above the survival grid. Pre-tournament it shows a baseline      *
 * message; once results move probabilities it shows two mover tables    *
 * (title odds / group advance) plus a fresh-divergences list.           */

.changes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem 1.6rem;
  margin-bottom: 2rem;
}

.changes-block-title {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.changes-empty {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
  margin: 0;
}

.changes-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 560px) {
  .changes-tables { grid-template-columns: 1fr; }
}

/* mover tables */
.movers-table {
  width: 100%;
  border-collapse: collapse;
}
.movers-table td {
  padding: 0.25rem 0;
  font-size: 0.88rem;
  vertical-align: baseline;
}
.mover-name  { font-weight: 500; }
.mover-arrow,
.mover-delta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding-left: 0.5rem;
  white-space: nowrap;
}
.mover-up   { color: #2f8f5b; }  /* --home pitch green */
.mover-down { color: #c46a3f; }  /* --away clay        */

/* fresh divergences */
.fresh-divs {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.fresh-div-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fresh-div-item {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-size: 0.88rem;
  flex-wrap: wrap;
}
.fresh-div-item a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.fresh-div-item a:hover { text-decoration: underline; }
.fresh-div-gap  { font-family: var(--font-mono); font-size: 0.82rem; }
.fresh-div-type { color: var(--muted); font-size: 0.82rem; }

/* --- browsable fixtures index (Session 35a) -------------------------- *
 * Below the survival grid: every group-stage fixture, grouped by letter *
 * and date-sorted, so pages that aren't movers/divergent are reachable. */

.fixtures { margin-top: 2.25rem; }

.fixtures-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.1rem;
}

.fixtures-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem 1.1rem;
}

.fixtures-group-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}

.fixtures-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fixtures-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.fixtures-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.fixtures-item a {
  color: var(--accent);
  text-decoration: none;
  text-align: right;
}
.fixtures-item a:hover { text-decoration: underline; }

/* --- calibration page (Session 27) ---------------------------------- */

.cal-stats {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.5rem 1.2rem;
  min-width: 10rem;
}

.stat-val {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-meta {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 18ch;
}

.cal-secondary {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.cal-diagram {
  margin-bottom: 2rem;
}

.cal-diagram svg {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cal-table-wrap {
  overflow-x: auto;
  margin-bottom: 2rem;
}

.cal-table {
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 22rem;
}

.cal-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0 1.2rem 0.5rem 0;
  border-bottom: 1.5px solid var(--border);
}

.cal-table td {
  padding: 0.45rem 1.2rem 0.45rem 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}

.cal-table td:first-child {
  font-family: var(--font-body);
  font-weight: 500;
}

.cal-row-highlight td { background: #fdf6e3; }

.cal-note {
  max-width: 64ch;
  font-size: 0.88rem;
  color: var(--muted);
}

.cal-note a { color: var(--accent); }

/* --- methodology page (Session 31) ---------------------------------- */

.method-prose { margin-bottom: 1.5rem; }
.method-prose p { margin: 0 0 1rem; max-width: 70ch; }

.method-context {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 70ch;
  margin: 0.5rem 0 1.5rem;
}

.method-limits,
.method-sources {
  padding-left: 1.3rem;
  margin: 0 0 2rem;
}

.method-limits li { margin-bottom: 1rem; max-width: 70ch; }
.method-sources li { margin-bottom: 0.6rem; max-width: 70ch; }
.method-sources a { color: var(--accent); }