/* Survivor Island Bench: a research report. One reading column, figures as dot plots with intervals,
   the game's pixel face kept to the wordmark. Honest = lagoon, free to lie = torch. */
:root {
  --paper: #f6f8f7; --surface: #fcfcfb; --ink: #17211d; --ink-2: #44524b; --muted: #66746d; --rule: #dde3df; --wash: #edf1ef;
  --honest: #008a78; --free: #d4502a; --mark: #17211d; --link: #006c5e;
  --display: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --pixel: "Press Start 2P", var(--mono);
  --measure: 680px; --wide: 800px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0f1412; --surface: #121816; --ink: #e6ece8; --ink-2: #b5c1ba; --muted: #8e9b94; --rule: #26302b; --wash: #18201d;
  --honest: #1fa48e; --free: #e2683f; --mark: #e6ece8; --link: #5cc8b4; color-scheme: dark } }
:root[data-theme="dark"] {
  --paper: #0f1412; --surface: #121816; --ink: #e6ece8; --ink-2: #b5c1ba; --muted: #8e9b94; --rule: #26302b; --wash: #18201d;
  --honest: #1fa48e; --free: #e2683f; --mark: #e6ece8; --link: #5cc8b4; color-scheme: dark }

* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 var(--sans);
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-block: 0 80px; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
main { max-width: var(--wide); margin: 0 auto; }
.col { max-width: var(--measure); }
p { margin: 0 0 1em; }
b, strong { font-weight: 650; }

/* Masthead */
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding-block: 20px; border-bottom: 1px solid var(--rule); font-size: 14px; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.top nav a { color: var(--ink-2); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); text-decoration: underline; }
.wordmark { font: 10px/1.6 var(--pixel); letter-spacing: .04em; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--free); }

/* Header */
header.lead { padding-block: 56px 8px; }
.kicker { font: 600 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
h1 { font: 600 clamp(34px, 6vw, 54px)/1.08 var(--display); letter-spacing: -.015em; margin: 0 0 20px; text-wrap: balance; max-width: 18ch; }
.dek { font-size: 20px; line-height: 1.55; color: var(--ink-2); max-width: var(--measure); margin: 0 0 24px; }
.byline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); margin: 0 0 28px; }
.byline b { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 15px var(--sans); padding: 11px 18px; border-radius: 6px; text-decoration: none; border: 1px solid var(--ink); color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn:hover { text-decoration: none; opacity: .88; }

/* The answer box */
.answer { margin: 48px 0 8px; padding: 28px 0 8px; border-top: 2px solid var(--ink); }
.answer h2 { margin-top: 0; }

/* Sections */
section { margin-top: 72px; }
h2 { font: 600 clamp(24px, 3.4vw, 30px)/1.2 var(--display); letter-spacing: -.01em; margin: 0 0 16px; text-wrap: balance; }
h3 { font: 650 18px/1.35 var(--sans); margin: 40px 0 10px; text-wrap: balance; }
.eyebrow { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.findings { list-style: none; padding: 0; margin: 0; counter-reset: f; }
.findings > li { counter-increment: f; position: relative; padding: 28px 0 8px; border-top: 1px solid var(--rule); }
.findings > li::before { content: counter(f); position: absolute; top: 30px; left: -36px; font: 600 14px var(--mono); color: var(--muted); }
.findings h3 { margin-top: 0; font: 600 21px/1.3 var(--display); }
@media (max-width: 880px) { .findings > li::before { position: static; display: block; margin-bottom: 4px; } }
.aside { font-size: 15px; color: var(--ink-2); border-left: 2px solid var(--rule); padding-left: 14px; }

/* Figures: dot plots with 95% intervals, drawn in HTML so labels never collide or scale */
figure { margin: 28px 0 32px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 20px 20px 14px; min-width: 0; }
figcaption { margin: 0 0 16px; }
figcaption .t { display: block; font: 650 15px/1.4 var(--sans); }
figcaption .s { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.plot { display: grid; grid-template-columns: minmax(96px, 30%) 1fr 64px; gap: 0 12px; align-items: center; font-size: 14px; }
.plot .lab { color: var(--ink); line-height: 1.3; padding-block: 7px; min-width: 0; }
.plot .lab small { display: block; color: var(--muted); font-size: 12px; }
.plot .val { font: 500 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
.track { position: relative; height: 30px; background: linear-gradient(var(--rule), var(--rule)) no-repeat; background-size: var(--grid, 0 0); }
.track .ci { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--c); opacity: .45; border-radius: 1px; }
.track .dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
.track .hit { position: absolute; inset: 0; cursor: default; }
.gridlines { position: absolute; inset: 0; pointer-events: none; }
.gridlines span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.axis { position: relative; height: 22px; font: 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.axis span { position: absolute; top: 4px; transform: translateX(-50%); }
.plot .group { grid-column: 1 / -1; font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 0 2px; }
.plot .group:first-child { padding-top: 0; }
.multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px 28px; }
.multiples .plot { grid-template-columns: minmax(84px, 40%) 1fr 44px; }
.multiples.stack { grid-template-columns: 1fr; gap: 24px; }
.multiples.stack .plot { grid-template-columns: minmax(96px, 30%) 1fr 64px; }
.multiples h4 { font: 650 14px/1.35 var(--sans); margin: 0 0 8px; }
.fignote { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
figure details { margin-top: 10px; font-size: 13px; }
figure summary { cursor: pointer; color: var(--link); font-weight: 600; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--paper); font: 13px/1.45 var(--sans); padding: 8px 10px; border-radius: 6px; max-width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.tip[hidden] { display: none; }

/* Method diagram */
.flow { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 24px 0; counter-reset: step; list-style: none; padding: 0; }
.flow li { counter-increment: step; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px; font-size: 14px; line-height: 1.45; position: relative; }
.flow li::before { content: counter(step); display: block; font: 600 12px var(--mono); color: var(--muted); margin-bottom: 6px; }
.flow li b { display: block; font-size: 15px; margin-bottom: 4px; }
.flow li.check { border-color: var(--honest); }
@media (min-width: 560px) { .flow { grid-template-columns: repeat(2, 1fr); } .flow li.check { grid-column: 1 / -1; } }
@media (min-width: 860px) { .flow { grid-template-columns: repeat(5, 1fr); max-width: var(--wide); } .flow li.check { grid-column: auto; } }

/* Timeline */
.timeline { list-style: none; margin: 24px 0; padding: 0 0 0 22px; border-left: 2px solid var(--rule); }
.timeline li { position: relative; margin: 0 0 22px; }
.timeline li::before { content: ""; position: absolute; left: -29px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--muted); }
.timeline li.turn::before { border-color: var(--free); background: var(--free); }
.timeline time { display: block; font: 600 12px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.timeline b { display: block; }

/* Key finding: the search, as a timeline that ends on the turn */
.key-answer { font: 600 clamp(20px, 2.6vw, 24px)/1.35 var(--display); margin: -4px 0 16px; }
.key .timeline { margin-top: 28px; }
.key .timeline li { margin-bottom: 30px; }
.key .timeline b { font: 600 19px/1.35 var(--display); margin: 2px 0 6px; }
.key .step { display: block; font: 600 12px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.key .turn .step { color: var(--free); }
.key-quote { margin: 18px 0 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--free); border-radius: 0 8px 8px 0; }
.key-quote p { margin: 0; font: 500 20px/1.45 var(--display); }
.key-quote mark { background: none; color: var(--free); font-weight: 650; }
.key-quote footer { margin-top: 10px; font-size: 13px; color: var(--muted); }
.key-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 14px; }
.key-stats div { border-top: 2px solid var(--ink); padding-top: 8px; }
.key-stats strong { display: block; font: 600 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.key-stats span { display: block; font-size: 13px; line-height: 1.35; color: var(--ink-2); margin-top: 4px; }
@media (max-width: 520px) { .key-stats { grid-template-columns: 1fr; } .key-stats strong { font-size: 22px; } }

/* Tables (data appendix) */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 600px; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; }
th { font: 600 12px/1.35 var(--sans); color: var(--muted); vertical-align: bottom; white-space: normal; }
td .ci { color: var(--muted); font-size: 12px; display: block; }
.empty { padding: 16px; color: var(--muted); }
.filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.filter button { font: 600 13px var(--sans); padding: 6px 12px; border-radius: 99px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer; min-height: 32px; }
.filter button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.note { font-size: 14px; color: var(--muted); }
ul.plain { padding-left: 20px; } ul.plain li { margin: 8px 0; }

footer { margin-top: 80px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }

/* Notebook entries */
.entry { padding: 32px 0 8px; border-top: 1px solid var(--rule); }
.entry time { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.entry h2 { font-size: 24px; margin: 6px 0 14px; }
.entry dl { margin: 0; display: grid; gap: 10px; }
.entry dt { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.entry dd { margin: 0; }
.entry.turn time { color: var(--free); }
code { font: 14px var(--mono); background: var(--wash); padding: 1px 5px; border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) { .btn, .filter button { transition: opacity .15s, background .15s; } }

/* Key finding: the Pivot as one dot per message */
.pivot-fig { margin: 4px 0 28px; padding: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; min-width: 0; }
.pv-title { margin: 0 0 14px; font: 600 20px/1.3 var(--display); }
.pv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.pv-cell { min-width: 0; }
.pv-cell svg { display: block; width: 100%; max-width: 260px; height: auto; }
.pv-head { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.pv-head b { color: var(--ink); font-weight: 600; }
.pv-note { margin: 6px 0 0; font: 600 13px/1.3 var(--mono); color: var(--muted); }
.pv-note.lied { color: var(--free); }
.d-hon { fill: none; stroke: var(--muted); stroke-width: 1.3; opacity: .55; }
.d-hon.d-won { fill: var(--muted); stroke: none; opacity: .55; }
.d-lie { fill: none; stroke: var(--free); stroke-width: 1.6; }
.d-lie.d-won { fill: var(--free); stroke: none; }
.pv-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); }
.pv-key span { display: inline-flex; align-items: center; gap: 6px; }
.pv-key svg { width: 12px; height: 12px; }
.pivot-fig figcaption { font-size: 13px; color: var(--muted); line-height: 1.45; }
@media (max-width: 520px) { .pivot-fig { padding: 16px 14px; } .pv-grid { grid-template-columns: 1fr; } }
