/* betlab101 — Paper Bets.
   Ground, ink, type, space and shape are society101's tokens
   (society101/design-system/tokens.css), so the page reads as the same house.
   Added here: one colour per voice. The crowd is ink, Jev the house blue,
   Decisions a burnt orange; each also has its own mark (diamond, dot, square),
   so nothing depends on telling two colours apart. */

:root {
  color-scheme: light;

  --paper: #fafafa;
  --surface: #ffffff;
  --line: #e3e3e3;
  --chip: #ececec;
  --hairline: #c7c7c7;

  --ink: #1a1a1a;
  --ink-soft: #3d3d3d;
  --ink-faint: #5c5c5c;
  --ink-mute: #8a8a8a;

  --accent: #2a5be6;
  --market: #1a1a1a;
  --jev: #2a5be6;
  --decisions: #c2410c;
  --yes: #15803d;
  --no: #b91c1c;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --fs-eyebrow: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-title: clamp(32px, 4.6vw, 46px);
  --fs-headline: clamp(22px, 2.4vw, 26px);

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 32px;
  --s7: 56px;

  --r-sm: 4px;
  --r-md: 8px;
  --width: 1120px;
  --gutter: clamp(16px, 5vw, 80px);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-base); line-height: 1.55;
}
a { color: inherit; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
.wrap { max-width: var(--width); margin: 0 auto; padding: 0 var(--gutter); }
.num { font-variant-numeric: tabular-nums; }

/* masthead */
.mast { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.mast-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 52px; }
.brand { font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.brand span { font-weight: 500; color: var(--ink-mute); }
.mast nav { display: flex; gap: var(--s5); font-size: var(--fs-sm); overflow-x: auto; white-space: nowrap; }
.mast nav a { text-decoration: none; color: var(--ink-faint); }
.mast nav a:hover { color: var(--accent); }

/* hero */
.hero { padding: var(--s7) 0 var(--s6); border-bottom: 1px solid var(--line); }
.eyebrow { font-size: var(--fs-eyebrow); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0 0 var(--s3); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-title); line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 var(--s4); max-width: 20ch; }
.lede { font-size: 17px; color: var(--ink-soft); max-width: 62ch; margin: 0 0 var(--s5); }
.legend { list-style: none; padding: 0; margin: 0 0 var(--s5); display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); font-size: var(--fs-sm); color: var(--ink-faint); }
.legend li { display: flex; align-items: center; gap: var(--s2); }
.legend b { color: var(--ink); font-weight: 600; }
.counts { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); margin: 0; }
.counts div { display: flex; flex-direction: column-reverse; }
.counts dt { font-size: var(--fs-xs); color: var(--ink-mute); }
.counts dd { margin: 0; font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* the three voices: colour and shape */
.mark { display: inline-block; width: 10px; height: 10px; flex: none; margin-right: 6px; background: var(--market); }
.mark.market { transform: rotate(45deg); }
.mark.jev { background: var(--jev); border-radius: 50%; }
.mark.decisions { background: var(--decisions); }
.mark.base { background: var(--hairline); border-radius: 50%; }

/* sections */
section { padding: var(--s7) 0 var(--s5); scroll-margin-top: 52px; }
section + section { border-top: 1px solid var(--line); }
h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-headline); line-height: 1.15; margin: 0 0 var(--s2); }
.sub { color: var(--ink-faint); margin: 0 0 var(--s5); max-width: 70ch; }
.empty { background: var(--surface); border: 1px dashed var(--hairline); border-radius: var(--r-md); padding: var(--s5); color: var(--ink-faint); margin: 0; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: var(--s4); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); min-width: 0; }
.card.done { background: transparent; }
.meta { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0 0 var(--s2); font-size: var(--fs-xs); }
.left { color: var(--ink-faint); font-weight: 500; }
.gap { background: #fff4e5; color: #8a4b00; padding: 2px var(--s2); border-radius: 99px; font-weight: 600; }
.result { padding: 2px var(--s2); border-radius: 99px; font-weight: 700; color: #fff; }
.result.yes { background: var(--yes); }
.result.no { background: var(--no); }
.result.void { background: var(--ink-mute); }
.card h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.25; margin: 0 0 var(--s4); }
.card h3 a { text-decoration: none; }

.now { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-bottom: var(--s3); }
.figure { display: flex; flex-direction: column; }
.who { font-size: var(--fs-xs); color: var(--ink); font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; }
.who em { font-style: normal; font-weight: 400; color: var(--ink-mute); flex-basis: 100%; margin-left: 16px; }
.pct { font-family: var(--font-display); font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; font-weight: 600; }
.figure.jev .pct { color: var(--jev); }
.figure.decisions .pct { color: var(--decisions); }

/* where the three stand between 0 and 100 */
/* one line, three lanes: Jev above it, the crowd on it, Decisions below it, so two
   voices that agree are both still seen */
.gauge { position: relative; height: 44px; margin: var(--s2) 5px var(--s3); }
.gauge::before { content: ""; position: absolute; left: 0; right: 0; top: 21px; border-top: 2px solid var(--line); }
.gauge::after { content: ""; position: absolute; left: 50%; top: 16px; height: 12px; border-left: 1px solid var(--hairline); }
.gauge .scale { position: absolute; top: 28px; left: -5px; font-size: 10px; color: var(--ink-mute); }
.gauge .scale.end { left: auto; right: -5px; }
.gauge .mark { position: absolute; top: 17px; margin: 0 0 0 -5px; width: 10px; height: 10px; transition: left 0.6s ease; }
.gauge .mark.jev { top: 4px; }
.gauge .mark.decisions { top: 30px; }

/* lines over time */
.spark { width: 100%; height: auto; display: block; margin-top: var(--s5); overflow: visible; }
.spark .grid line { stroke: var(--line); stroke-width: 1; }
.spark .grid text { font-size: 12px; fill: var(--ink-mute); text-anchor: end; font-family: var(--font); }
.spark .line polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .line.market polyline { stroke: var(--market); stroke-dasharray: 5 4; }
.spark .line.jev polyline { stroke: var(--jev); }
.spark .line.decisions polyline { stroke: var(--decisions); }
.spark .line.market circle { fill: var(--market); }
.spark .line.jev circle { fill: var(--jev); }
.spark .line.decisions circle { fill: var(--decisions); }
.spark .news circle { fill: var(--hairline); }
.spark .axis text { font-size: 12px; fill: var(--ink-mute); font-family: var(--font); }
.spark .axis text.end { text-anchor: end; }
.key, .note, .fine { font-size: var(--fs-xs); color: var(--ink-mute); margin: var(--s1) 0 0; }
.note { margin-top: var(--s5); }
.prior { font-size: var(--fs-xs); color: #8a4b00; background: #fff4e5; border-radius: var(--r-sm); padding: var(--s2) var(--s3); margin: var(--s3) 0 0; }

/* the evidence */
details { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
summary { cursor: pointer; font-size: var(--fs-sm); color: var(--ink-soft); font-weight: 500; }
summary:hover { color: var(--accent); }
.batch { margin-top: var(--s3); }
.when { font-size: var(--fs-xs); font-weight: 600; margin: 0 0 var(--s1); }
.when span { font-weight: 400; color: var(--ink-faint); margin-left: var(--s2); }
.batch ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); }
.batch li { margin-bottom: 2px; overflow-wrap: anywhere; }
.batch li span { color: var(--ink-mute); font-size: var(--fs-xs); margin-left: var(--s1); }
.batch li .full { color: var(--ink-soft); font-weight: 600; }
.none { font-size: var(--fs-xs); color: var(--ink-mute); margin: 0; }

/* the score */
.scores { display: grid; gap: var(--s5); margin-bottom: var(--s5); }
table { border-collapse: collapse; width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
th, td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
th { font-size: var(--fs-xs); color: var(--ink-mute); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th:nth-child(n + 3) { text-align: right; }
.early { background: #fff4e5; color: #8a4b00; border-radius: var(--r-md); padding: var(--s3) var(--s4); margin: 0; max-width: 640px; font-size: var(--fs-sm); font-weight: 500; }
.settled { margin-top: var(--s5); }

/* bars: Brier against the coin */
.answer { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--s4); }
.answer h3 { grid-column: 1 / -1; font-family: var(--font-display); font-size: 20px; margin: 0; }
.bars { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }
.bars h4 { margin: 0 0 var(--s3); font-size: var(--fs-base); display: flex; align-items: center; }
.bar { display: grid; grid-template-columns: minmax(0, 11em) 1fr 3.5em; gap: var(--s3); align-items: center; font-size: var(--fs-sm); margin-bottom: var(--s2); }
.bar .name { color: var(--ink-soft); }
.bar .num { text-align: right; }
.track { position: relative; height: 12px; background: var(--chip); border-radius: 2px; }
.track i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--ink-mute); }
.bars.jev .track i { background: var(--jev); }
.bars.decisions .track i { background: var(--decisions); }
.track .coin { position: absolute; left: 71.4%; top: -4px; bottom: -4px; border-left: 2px solid var(--ink); }
.findings { margin: var(--s5) 0 0; padding-left: 20px; max-width: 72ch; color: var(--ink-soft); }
.findings li { margin-bottom: var(--s2); }
.findings b { color: var(--ink); }

/* how it works */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: var(--s4); }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); font-size: var(--fs-sm); color: var(--ink-soft); }
.steps li::before { content: counter(step); display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--accent); margin-bottom: var(--s2); }
.steps b { color: var(--ink); }

.foot { border-top: 1px solid var(--line); margin-top: var(--s7); padding: var(--s6) 0 var(--s7); font-size: var(--fs-sm); color: var(--ink-faint); }
.foot p { margin: 0 0 var(--s1); }

@media (max-width: 560px) {
  .mast nav a:nth-child(n + 3) { display: none; }
  .pct { font-size: 28px; }
  .card { padding: var(--s4); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gauge .mark { transition: none; }
}
