/* DESIGN.md implementation.
   Quiet stat sheet by default; gold/turf/loss appear only at moments
   of competition. */

:root {
  --chalk: #FAFAF8;
  --ink: #141B2D;
  --line: #E3E4E0;
  --slate: #5C6470;
  --gold: #C9930A;
  --turf: #178A45;
  --loss: #C6373C;
  --display: "Archivo", sans-serif;
  --body: "Inter", sans-serif;
  --data: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
}

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

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

/* --- Type roles --- */
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: expanded;
  line-height: 1.1;
  margin: 0;
}
h1 { font-size: 28px; }
h2 { font-size: 18px; font-weight: 600; }

.eyebrow {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
}

.mono, .num {
  font-family: var(--data);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--slate); }
small, .small { font-size: 13px; }

/* --- Layout --- */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

main.wrap { padding-top: 28px; padding-bottom: 64px; }

.grid { display: grid; gap: 16px; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Nav --- */
.site-nav {
  border-bottom: 1px solid var(--line);
  background: var(--chalk);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  flex-wrap: wrap;
}
.site-nav .brand {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: expanded;
  font-size: 17px;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-nav a { text-decoration: none; font-weight: 500; font-size: 14px; }
.site-nav a:hover { text-decoration: underline; }
.site-nav .spacer { flex: 1; }
.site-nav .navlink.active { text-decoration: underline; text-underline-offset: 4px; }

/* --- Rank strip (the signature element) --- */
.rank-strip {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 34px;
  background: var(--chalk);
  border-bottom: 1px solid var(--line);
}
.rank-strip__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 10px;
  background: var(--chalk);
}
.rank-strip__fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--ink);
  transition: width 600ms ease;
}
.rank-strip__notch {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  background: var(--gold);
  transition: left 600ms ease;
}
.rank-strip__label {
  position: absolute;
  top: 3px;
  transform: translateX(-50%);
  font-family: var(--data);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  color: var(--ink);
  transition: left 600ms ease;
}
.rank-strip__label.edge-left { transform: none; }
.rank-strip__label.edge-right { transform: translateX(-100%); }
@keyframes gold-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 147, 10, 0.55); }
  100% { box-shadow: 0 0 0 9px rgba(201, 147, 10, 0); }
}
.rank-strip__notch.pulse { animation: gold-pulse 600ms ease-out 1; }

/* --- Cards --- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-quiet { border-color: var(--line); font-weight: 500; }
.btn-quiet:hover { background: var(--chalk); color: var(--ink); }

/* Side buttons on event cards: ink outline; selected = ink fill */
.side-btn {
  display: block;
  width: 100%;
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}
.side-btn[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}
.side-btn:disabled { border-color: var(--line); color: var(--slate); cursor: default; background: #fff; }
.side-btn:disabled[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: var(--slate); }

/* --- Event card --- */
.event-card .matchup {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: expanded;
  font-size: 19px;
  line-height: 1.1;
  margin: 6px 0 2px;
}
.event-card .lock {
  font-family: var(--data);
  font-weight: 500;
  font-size: 13px;
  color: var(--slate);
}
.event-card .sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 6px;
}

/* --- Confidence slider --- */
.conf {
  margin-top: 14px;
}
.conf-value {
  font-family: var(--data);
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.conf-value .unit { font-size: 20px; color: var(--slate); }
input[type="range"].conf-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 8px 0 0;
}
input[type="range"].conf-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--ink);
  border-radius: 2px;
}
input[type="range"].conf-slider::-moz-range-track {
  height: 4px;
  background: var(--ink);
  border-radius: 2px;
}
input[type="range"].conf-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
}
input[type="range"].conf-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
}
input[type="range"].conf-slider:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* --- Crowd split (post-lock) --- */
.split {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 12px;
}
.split .a { background: var(--ink); }
.split .b { background: var(--slate); }
.split-legend { display: flex; justify-content: space-between; margin-top: 6px; }

/* Outcome marks — the only place turf/loss appear */
.mark-hit { color: var(--turf); font-weight: 600; }
.mark-miss { color: var(--loss); font-weight: 600; }
.arrow-up { color: var(--turf); }
.arrow-down { color: var(--loss); }

/* --- Tables (leaderboards) --- */
table.board {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
table.board caption { text-align: left; }
table.board th {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  text-align: right;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
table.board td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
table.board tr:last-child td { border-bottom: 0; }
table.board th.rank-col, table.board td.rank-col {
  text-align: left;
  width: 30%;
}
table.board td.num, table.board th.num-h { font-family: var(--data); font-weight: 500; font-variant-numeric: tabular-nums; }
table.board tr.top3 td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
table.board .rank-num {
  font-family: var(--data);
  font-weight: 500;
  color: var(--gold);
  font-size: 16px;
}
@keyframes row-flash {
  from { background: var(--chalk); }
  to { background: #fff; }
}
table.board tr.moved { animation: row-flash 400ms ease-out 1; }

/* --- Gold: earned only --- */
.gold { color: var(--gold); }
.pool-figure {
  font-family: var(--data);
  font-weight: 500;
  font-size: clamp(44px, 8vw, 64px);
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Payout curve segmented bar */
.curve-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; margin-top: 14px; }
.curve-bar .seg1 { background: var(--ink); }
.curve-bar .seg2 { background: var(--slate); }
.curve-bar .seg3 { background: var(--line); }
.curve-legend { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }

/* --- Badges: the only rounded-full elements --- */
.badge-chip {
  display: inline-block;
  font-family: var(--data);
  font-weight: 500;
  font-size: 12px;
  border: 1.5px solid var(--gold);
  color: var(--ink);
  background: var(--chalk);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.badge-chip--filled {
  background: var(--gold);
  color: #fff;
}

/* --- Hero numbers --- */
.hero-num {
  font-family: var(--data);
  font-weight: 500;
  font-size: clamp(44px, 7vw, 64px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* --- Forms --- */
label { font-weight: 500; display: block; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="datetime-local"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.field { margin-bottom: 16px; }
.form-error { font-weight: 500; margin: 12px 0; }

/* Tier picker on signup */
.tier-pick { display: grid; gap: 10px; }
@media (min-width: 640px) { .tier-pick { grid-template-columns: repeat(3, 1fr); } }
.tier-pick label {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  margin: 0;
}
.tier-pick input { position: absolute; opacity: 0; }
.tier-pick input:checked + span .tier-name { text-decoration: underline; text-underline-offset: 4px; }
.tier-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tier-pick .tier-name { font-family: var(--display); font-weight: 800; font-stretch: expanded; font-size: 18px; display: block; }

/* --- Calibration chart --- */
.cal-chart line.ref { stroke: var(--line); stroke-width: 1; }
.cal-chart path.curve { stroke: var(--ink); stroke-width: 2; fill: none; }
.cal-chart circle.pt { fill: var(--gold); }
.cal-chart text { font-family: var(--data); font-size: 11px; fill: var(--slate); }

/* Percentile history bars */
.pct-bars { display: flex; align-items: flex-end; gap: 10px; height: 120px; }
.pct-bars .bar { flex: 1; background: var(--ink); min-width: 18px; }
.pct-bars .bar.best { background: var(--gold); }

/* --- Footer --- */
footer.site-footer {
  border-top: 1px solid var(--line);
  color: var(--slate);
  font-size: 13px;
}
footer.site-footer .wrap { padding: 20px; }

/* --- Landing (airy, unlike the dense boards) --- */
.hero { padding: 72px 0 48px; }
.hero h1 { font-size: clamp(34px, 6vw, 54px); max-width: 720px; }
.hero p.lede { font-size: 18px; max-width: 560px; color: var(--slate); }

/* --- Utility --- */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* --- Motion policy: exactly three animations; kill them all here --- */
@media (prefers-reduced-motion: reduce) {
  .rank-strip__fill, .rank-strip__notch, .rank-strip__label { transition: none; }
  .rank-strip__notch.pulse { animation: none; }
  table.board tr.moved { animation: none; }
  /* conf number tick is disabled in JS via the same media query */
}
