/* The Layers — mobile first.
   One switch drives --accent and every treatment keyed to it, so flipping
   state reads as a single orchestrated change rather than nine small ones. */

:root {
  --bg: #0b0d12;
  --surface: #131722;
  --raised: #1a2030;
  --line: #262e40;
  --text: #e9ecf4;
  --muted: #8d95ab;
  --dim: #626b80;

  --claim: #ff4d6d;
  --claim-soft: #ff4d6d1f;
  --record: #4fd6c0;
  --record-soft: #4fd6c01f;

  --accent: var(--claim);
  --accent-soft: var(--claim-soft);

  --topbar-h: 104px;
  --player-h: 0px;

  --r: 14px;
  --pad: 18px;
  --maxw: 720px;
}

body[data-state="record"] {
  --accent: var(--record);
  --accent-soft: var(--record-soft);
}

* { box-sizing: border-box; }

/* A layout display value on a component beats the [hidden] attribute's own
   display:none, so a hidden panel renders anyway. Restate it with weight. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  scroll-padding-top: calc(var(--topbar-h) + 12px);
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
  overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.18; letter-spacing: -0.02em; margin: 0; font-weight: 680; }

a { color: var(--accent); text-underline-offset: 3px; }

.nowrap { white-space: nowrap; }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 60;
  background: var(--accent); color: #08090d; padding: 10px 14px; border-radius: 0 0 10px 0;
  font-weight: 700;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- top bar + the one control ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 10px var(--pad) 12px;
  padding-top: max(10px, env(safe-area-inset-top));
}

.topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto 9px;
}

.wordmark {
  font-weight: 760; letter-spacing: -0.03em; font-size: 17px;
}
.wordmark::before {
  content: ""; display: inline-block; vertical-align: -1px;
  width: 9px; height: 9px; margin-right: 8px; border-radius: 2px;
  background: var(--accent); transition: background .35s ease;
}

.chapters-open {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.chapters-open:hover { color: var(--text); border-color: var(--dim); }

.switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  max-width: var(--maxw); margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; isolation: isolate;
}

.switch-glide {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  transition: transform .34s cubic-bezier(.4, 1.3, .5, 1), background .34s ease, border-color .34s ease;
}
body[data-state="record"] .switch-glide { transform: translateX(100%); }

.switch-btn {
  position: relative; z-index: 1;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 640;
  color: var(--dim); padding: 9px 6px; border-radius: 999px;
  transition: color .24s ease;
}
.switch-btn.is-on { color: var(--accent); }

/* ---------- hero ---------- */

.hero { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--pad) 22px; }

.eyebrow {
  margin: 0 0 12px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--accent);
  transition: color .35s ease;
}

.hero h1 { font-size: clamp(31px, 8.4vw, 46px); font-weight: 760; margin-bottom: 14px; }

.lede { color: #c3c9d8; font-size: 16.5px; margin: 0 0 20px; }
.lede strong { color: var(--text); }

.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #08090d;
  border: 1px solid var(--accent); border-radius: 999px;
  font: inherit; font-size: 15px; font-weight: 700;
  padding: 11px 20px; cursor: pointer; text-decoration: none;
  transition: background .3s ease, border-color .3s ease, filter .15s ease;
}
.cta:hover { filter: brightness(1.09); }
.cta.ghost { background: none; color: var(--text); border-color: var(--line); }
.cta.ghost:hover { border-color: var(--accent); color: var(--accent); }

.rule-note {
  margin: 20px 0 0; padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  color: var(--muted); font-size: 14px;
  transition: border-color .35s ease;
}

/* ---------- the stack ---------- */

.stack { max-width: var(--maxw); margin: 0 auto; padding: 8px var(--pad) 30px; }

.layer {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  margin-bottom: 14px; overflow: hidden;
  transition: border-color .35s ease;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.layer.is-live { border-color: var(--accent); }

.layer-head {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px;
  align-items: start; padding: 16px 15px;
}

.layer-n {
  font: 700 15px/40px ui-monospace, "SF Mono", Menlo, monospace;
  text-align: center; height: 40px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent);
  transition: background .35s ease, color .35s ease, border-color .35s ease;
}

.layer-title { font-size: 20px; font-weight: 700; margin: 0 0 3px; }
.layer-role { margin: 0; font-size: 12.5px; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; font-weight: 650; }

.panel { padding: 0 15px 16px; }

.panel-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 9px;
  transition: color .35s ease;
}
.panel-label::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); transition: background .35s ease;
}

.panel-headline {
  font-size: 18.5px; font-weight: 700; letter-spacing: -0.015em;
  margin: 0 0 9px; line-height: 1.3;
}

.panel-body { margin: 0; color: #c3c9d8; font-size: 16px; }

/* The two states read differently on purpose: the claim is louder and
   tighter, the record is quieter and more generously set. */
body[data-state="claim"] .panel-headline { letter-spacing: -0.025em; font-weight: 740; }
body[data-state="record"] .panel-body { line-height: 1.68; }

.verdict {
  margin: 14px 0 0; padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-size: 15.5px; font-weight: 620; color: var(--text);
  transition: background .35s ease, border-color .35s ease;
}

.swap { animation: swap .34s ease both; }
@keyframes swap {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- disclosure: note + sources ---------- */

.more { border-top: 1px solid var(--line); }

.more-btn {
  width: 100%; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 650; color: var(--muted);
  padding: 13px 15px; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.more-btn:hover { color: var(--text); }
.more-btn .chev { transition: transform .26s ease; flex: 0 0 auto; }
.more-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.more-body { padding: 0 15px 16px; display: none; }
.more-body.is-open { display: block; }

.note {
  margin: 0 0 15px; padding: 13px 15px;
  border-left: 2px solid var(--dim);
  background: var(--raised); border-radius: 0 10px 10px 0;
  font-size: 15px; color: #c3c9d8;
}

.src-h {
  font-size: 11px; font-weight: 750; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim); margin: 0 0 10px;
}

.src { padding: 11px 0; border-top: 1px solid var(--line); }
.src:first-of-type { border-top: 0; padding-top: 0; }

.src-name { font-size: 14.5px; font-weight: 650; margin: 0 0 4px; }
.src-name a { color: var(--text); }
.src-name a:hover { color: var(--accent); }
.src-detail { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.tag {
  display: inline-block; vertical-align: 1px; margin-right: 7px;
  font: 700 9.5px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 4px; border: 1px solid;
}
.tag.artifact      { color: #ffb057; border-color: #ffb05755; background: #ffb0571a; }
.tag.movement      { color: #b28cff; border-color: #b28cff55; background: #b28cff1a; }
.tag.primary       { color: #6fd3ff; border-color: #6fd3ff55; background: #6fd3ff1a; }
.tag.institutional { color: var(--dim); border-color: var(--line); background: #ffffff08; }

/* ---------- method ---------- */

.method { max-width: var(--maxw); margin: 0 auto; padding: 26px var(--pad) 10px; }
.method h2, .share h2 { font-size: 25px; margin-bottom: 16px; }

.method-grid { display: grid; gap: 12px; }
.method-grid article {
  padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.method-grid h3 { font-size: 15.5px; margin: 0 0 6px; color: var(--accent); transition: color .35s ease; }
.method-grid p { margin: 0; font-size: 15px; color: #c3c9d8; }

.tiers { margin-top: 16px; display: grid; gap: 9px; }
.tier-row {
  display: flex; gap: 11px; align-items: baseline;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 14px; color: var(--muted);
}

/* ---------- share ---------- */

.share { max-width: var(--maxw); margin: 0 auto; padding: 26px var(--pad) 34px; }
.share-lede { color: var(--muted); font-size: 15px; margin: 0 0 16px; }

.tilegrid {
  display: grid; grid-auto-flow: column; grid-auto-columns: 78%;
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 12px; margin: 0 calc(var(--pad) * -1); padding-inline: var(--pad);
  scrollbar-width: thin;
}
.tile {
  scroll-snap-align: center; display: block;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--surface); text-decoration: none; color: inherit;
}
.tile img { width: 100%; height: auto; display: block; }
.tile figcaption { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.share-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.share-row .cta { font-size: 14px; padding: 10px 16px; }

footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 22px var(--pad) 40px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
footer p { margin: 0 0 9px; }
footer .fine { font-size: 13px; color: var(--dim); }

/* ---------- player ---------- */

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--accent);
  padding: 10px var(--pad) calc(8px + env(safe-area-inset-bottom));
  transition: border-color .35s ease;
}

.player-row {
  display: grid; grid-template-columns: 46px 1fr 40px; gap: 12px;
  align-items: center; max-width: var(--maxw); margin: 0 auto;
}

.pp {
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: var(--accent); border: 0; color: #08090d;
  display: grid; place-items: center; transition: background .3s ease;
}
.pp svg { width: 22px; height: 22px; fill: currentColor; }
.pp .i-pause { display: none; }
body.is-playing .pp .i-play { display: none; }
body.is-playing .pp .i-pause { display: block; }

.player-mid { min-width: 0; }
.player-title {
  font-size: 13.5px; font-weight: 650; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.player-time {
  display: flex; justify-content: space-between;
  font: 400 11px/1 ui-monospace, Menlo, monospace; color: var(--dim); margin-top: 3px;
}

.scrub {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px;
  background: none; cursor: pointer; display: block;
}
.scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.scrub::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); margin-top: -5.5px; border: 0;
}
.scrub::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 0; }

.chapbtn {
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  background: none; border: 1px solid var(--line); color: var(--muted);
  display: grid; place-items: center;
}
.chapbtn svg { width: 20px; height: 20px; fill: currentColor; }
.chapbtn:hover { color: var(--text); border-color: var(--dim); }

.follow {
  display: flex; align-items: center; gap: 7px;
  max-width: var(--maxw); margin: 7px auto 0;
  font-size: 12.5px; color: var(--dim); cursor: pointer;
}
.follow input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- chapter sheet ---------- */

.sheet {
  position: fixed; inset: 0; z-index: 70;
  background: #000000b8; backdrop-filter: blur(3px);
  display: flex; align-items: flex-end;
}
.sheet-panel {
  background: var(--surface); width: 100%;
  border-radius: 18px 18px 0 0; border-top: 1px solid var(--line);
  max-height: 82vh; display: flex; flex-direction: column;
  animation: rise .26s ease both;
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 18px; }
.sheet-x {
  background: none; border: 0; color: var(--muted); font-size: 30px;
  line-height: 1; cursor: pointer; padding: 0 4px;
}

.chapterlist { overflow-y: auto; padding: 8px 12px 18px; }

.chap {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; border-radius: 11px;
  padding: 12px 10px; color: inherit; font: inherit;
}
.chap:hover { background: var(--raised); }
.chap.is-live { background: var(--accent-soft); }
.chap-n {
  font: 700 13px/1 ui-monospace, Menlo, monospace; color: var(--dim);
  text-align: center;
}
.chap.is-live .chap-n { color: var(--accent); }
.chap-t { display: block; font-size: 15px; font-weight: 620; }
.chap-s { display: block; font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.chap-d { font: 400 12px/1 ui-monospace, Menlo, monospace; color: var(--dim); }

/* ---------- wider screens ---------- */

@media (min-width: 700px) {
  :root { --pad: 26px; --topbar-h: 108px; }
  body { font-size: 17.5px; }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .tilegrid { grid-auto-columns: 44%; }
  .layer-head { grid-template-columns: 46px 1fr; padding: 20px 19px; }
  .panel { padding: 0 19px 20px; }
  .more-btn { padding: 14px 19px; }
  .more-body { padding: 0 19px 20px; }
}
