/* Agent debates: tokens */
:root {
  --bg: #eef1f4;
  --surface: #f8fafb;
  --ink: #1b2433;
  --muted: #5b6678;
  --line: #d3d9e1;
  --focus: #2457c5;

  /* One colour per speaker; used only to show who is talking. */
  --moderator: #5a6577;
  --P1: #b36b00;
  --P2: #0b7f82;
  --P3: #7446b0;
  --P4: #b0263f;
  --P5: #2f7d34;

  /* One family, chosen for legibility: distinct letterforms that are hard to confuse. */
  --font: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --measure: 68ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a24;
    --surface: #1c2330;
    --ink: #e6eaf0;
    --muted: #9aa5b6;
    --line: #2e3747;
    --focus: #8fb0ff;
    --moderator: #9aa5b6;
    --P1: #f0a531;
    --P2: #3cc3c4;
    --P3: #b08ae6;
    --P4: #f0647c;
    --P5: #6cc26f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
}

a { color: inherit; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Home page */

.masthead, .featured, .browse, .how, .site-foot { max-width: 72rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
.hero, .page-index .ai-note { width: min(70rem, 100% - 2rem); margin-left: auto; margin-right: auto; }

.masthead {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.5rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; letter-spacing: -0.01em; }
.masthead-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.9375rem; }
.masthead-nav a { color: var(--muted); text-decoration: none; }
.masthead-nav a:hover { color: var(--ink); text-decoration: underline; }

/* Hero banner: the illustration, with the pitch set on a dark scrim so it reads on any image. */
.hero { position: relative; margin-top: 1.25rem; border-radius: 14px; overflow: hidden; background: #f4efe8; }
.hero-art { display: block; width: 100%; height: clamp(15rem, 38vw, 28rem); object-fit: cover; }
.hero-copy {
  position: absolute; inset: 0 auto 0 0;
  width: min(34rem, 55%);
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  /* The hero art is light and airy, so the copy sits on a soft light scrim in both colour schemes. */
  background: linear-gradient(to right, rgb(250 246 240 / 0.92) 50%, rgb(250 246 240 / 0.5) 80%, transparent);
  color: #1b2433;
}
@media (max-width: 40rem) {
  .hero-copy { position: static; width: auto; background: #faf6f0; }
  .hero-art { height: 13rem; }
}
.hero-line { margin: 0 0 0.4rem; font: 700 clamp(1.6rem, 4.4vw, 3rem)/1.08 var(--font); letter-spacing: -0.015em; max-width: 22ch; text-wrap: balance; }
.hero-sub { margin: 0; max-width: 46ch; font-size: clamp(1rem, 1.8vw, 1.1875rem); color: #3d4757; }

/* The AI-generated notice: impossible to miss, but calm. */
.ai-note {
  display: flex; gap: 0.85rem; align-items: flex-start;
  margin-top: 1.25rem; margin-bottom: 0;
  padding: 1rem 1.15rem;
  border: 1.5px solid color-mix(in srgb, var(--P1) 55%, var(--line));
  background: color-mix(in srgb, var(--P1) 8%, var(--surface));
  border-radius: 10px;
  font-size: 0.9375rem; line-height: 1.55;
}
.ai-note svg { flex: none; width: 1.3rem; height: 1.3rem; margin-top: 0.1rem; fill: var(--P1); }
.ai-note p { margin: 0; max-width: 88ch; }
.ai-note.is-compact { display: block; margin-top: 1.25rem; max-width: 60ch; font-size: 0.875rem; padding: 0.75rem 0.95rem; }

/* Featured: the newest debate, with its speaker fingerprint as the centrepiece. */
.featured { padding-top: clamp(2rem, 6vw, 4.5rem); padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.featured-meta { margin: 0 0 1rem; color: var(--muted); font-size: 0.9375rem; }
.topic-link { color: var(--ink); font-weight: 600; }
.featured-top { display: grid; gap: 2rem; align-items: center; margin-bottom: 2.25rem; }
.featured-top.has-cover { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.featured-top .actions { margin-bottom: 0; }
.featured-cover { display: block; width: 100%; height: auto; aspect-ratio: 7 / 4; object-fit: cover; border-radius: 12px; }
.featured h1 {
  font: 700 clamp(2.2rem, 5.6vw, 4.2rem)/1.04 var(--font);
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  max-width: 20ch;
  text-wrap: balance;
}
.featured h1 a { text-decoration: none; }
.featured h1 a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }
.featured-summary { margin: 0 0 1.75rem; max-width: 52ch; font-size: 1.1875rem; line-height: 1.55; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 2.25rem; }
.listen {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1.4rem 0.8rem 1.1rem;
  border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-weight: 700; text-decoration: none;
}
.listen svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.listen:hover { background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
.read { font-weight: 600; }

.fingerprint { display: flex; gap: 3px; height: var(--h, 4.5rem); }
.fingerprint span {
  flex: var(--w) 1 0;
  min-width: 2px;
  border-radius: 3px;
  background: var(--c);
  transform-origin: bottom;
}
.fingerprint.is-small { --h: 0.6rem; gap: 2px; }
.fingerprint.is-small span { border-radius: 1px; }
@media (prefers-reduced-motion: no-preference) {
  .featured .fingerprint span { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i) * 45ms); }
  @keyframes rise { from { transform: scaleY(0.08); opacity: 0.3; } }
}
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin: 0.9rem 0 0; padding: 0; list-style: none; font-size: 0.875rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend li::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 2px; background: var(--c); }

/* Browse: topic filters and the feed. */
.browse { padding-top: 2.5rem; padding-bottom: 3rem; border-top: 1px solid var(--line); }
.browse-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.browse h2, .how h2 { font: 700 1.5rem/1.2 var(--font); margin: 0; }
.topics { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.topics button {
  font: 600 0.9375rem/1 var(--font);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
}
.topics button:hover { border-color: var(--ink); }
.topics button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1.25rem; }
.card { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card-cover { display: block; width: 100%; height: auto; aspect-ratio: 7 / 4; object-fit: cover; }
.card-art { aspect-ratio: 7 / 4; display: flex; align-items: flex-end; padding: 1.25rem; background: color-mix(in srgb, var(--ink) 6%, var(--surface)); }
.card-art .fingerprint { --h: 45%; width: 100%; }
.card-body { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; padding: 1.1rem 1.25rem 1.1rem; }
.cards > .empty { grid-column: 1 / -1; }
.card:hover { border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); }
.card-topic { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.card h3 { font: 700 1.3rem/1.22 var(--font); margin: 0; text-wrap: balance; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; } /* whole card is the link */
.card h3 a:focus-visible { outline: none; }
.card:has(a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.card-summary { margin: 0; color: var(--muted); font-size: 0.9375rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .fingerprint { margin-top: auto; padding-top: 0.6rem; }
.card-facts { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }

.how { padding-top: 2.5rem; padding-bottom: 3.5rem; border-top: 1px solid var(--line); }
.steps { list-style: none; counter-reset: step; margin: 1.5rem 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1.5rem 2rem; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: 0.75rem; border-radius: 50%; border: 1.5px solid var(--ink); font-weight: 700; }
.steps h3 { font: 700 1.125rem/1.3 var(--font); margin: 0 0 0.35rem; }
.steps p { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.how-note { margin: 0; max-width: 60ch; font-size: 0.9375rem; }

.site-foot { padding-top: 1.5rem; padding-bottom: 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.site-foot p { margin: 0; }

/* Debate page */

.back { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 0; font-size: 0.9375rem; }
.back a { color: var(--muted); }

.debate-head { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 1.5rem; }
.debate-head h1 {
  font: 700 clamp(1.9rem, 5vw, 3.3rem)/1.1 var(--font);
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  max-width: 22ch;
}
.debate-head.has-cover { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.debate-cover { display: block; width: 100%; height: auto; aspect-ratio: 7 / 4; object-fit: cover; border-radius: 12px; }
.debate-facts { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9375rem; }
.debate-summary { margin: 0; max-width: 60ch; font: 400 1.125rem/1.6 var(--font); }

/* Player: sticky so the timeline is always in reach while reading. */
.player {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem max(1rem, calc((100% - 70rem) / 2));
}
.player-row { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }

.play {
  flex: none;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  cursor: pointer;
}
.play svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
.play .icon-pause, .play.is-playing .icon-play { display: none; }
.play.is-playing .icon-pause { display: inline; }

.now { display: grid; min-width: 0; flex: 1 1 12rem; line-height: 1.3; }
.now-speaker { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-speaker i { font-style: normal; font-weight: 400; color: var(--muted); }
.now-time { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

.controls { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.control { display: flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; color: var(--muted); }
.control select {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
}

/* The speaker timeline: one block per contribution, coloured by speaker. */
.timeline {
  position: relative;
  margin-top: 0.75rem;
  height: 2.25rem;
  cursor: pointer;
  touch-action: none;
  border-radius: 4px;
}
.timeline-blocks { display: flex; gap: 2px; height: 100%; }
.block {
  flex: var(--w) 1 0;
  min-width: 2px;
  background: var(--c);
  opacity: 0.35;
  border-radius: 2px;
  transition: opacity 0.2s;
}
.block.is-past { opacity: 0.75; }
.block.is-current { opacity: 1; }
.timeline:hover .block { opacity: 0.55; }
.timeline:hover .block.is-past, .timeline:hover .block.is-current { opacity: 0.9; }
.playhead {
  position: absolute; top: -3px; bottom: -3px; left: 0;
  width: 3px; margin-left: -1px;
  background: var(--ink);
  border-radius: 2px;
  pointer-events: none;
}

.follow { display: inline-flex; gap: 0.4rem; align-items: center; margin-top: 0.5rem; font-size: 0.8125rem; color: var(--muted); }

.debate-body {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1rem 5rem;
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.cast { position: sticky; top: 11rem; }
.cast h2 { font: 600 0.9375rem/1.3 var(--font); margin: 0 0 0.75rem; }
.cast ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.cast li { border-left: 4px solid var(--c); padding-left: 0.65rem; font-size: 0.875rem; line-height: 1.45; color: var(--muted); }
.cast strong { display: block; color: var(--ink); font-weight: 600; font-size: 0.9375rem; }

/* Transcript */

.transcript { font: 400 1.0625rem/1.75 var(--font); max-width: var(--measure); }
.transcript > h1 { display: none; }
.transcript h2 {
  font: 700 1.5rem/1.25 var(--font);
  margin: 3rem 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.transcript h2:first-of-type { margin-top: 1.5rem; }
.transcript p, .transcript ul, .transcript ol { margin: 0 0 1em; }
.transcript blockquote { margin: 0 0 1em; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--muted); }
.transcript em { color: var(--muted); }
.transcript code { font-size: 0.9em; }
.transcript .table-wrap { overflow-x: auto; margin: 0 0 1.5em; }
.transcript table { border-collapse: collapse; font: 400 0.875rem/1.45 var(--font); min-width: 36rem; }
.transcript th, .transcript td { text-align: left; vertical-align: top; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--line); }
.transcript th { font-weight: 600; }
.transcript a { overflow-wrap: anywhere; }

.entry {
  position: relative;
  margin: 0 0 2rem;
  padding: 0 0 0 1.25rem;
  border-left: 4px solid var(--c, var(--line));
  scroll-margin-top: 12rem;
}
.entry.is-playing { background: color-mix(in srgb, var(--c) 9%, transparent); border-radius: 0 6px 6px 0; }
.entry-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem;
  margin: 0 0 0.6rem;
  padding-top: 0.2rem;
  font: 400 0.9375rem/1.4 var(--font);
}
.entry-who { font-weight: 600; color: var(--c, var(--ink)); }
.entry-context { color: var(--muted); }
.entry-num { color: var(--muted); text-decoration: none; }
.entry-num:hover { text-decoration: underline; }
.play-from {
  margin-left: auto;
  font: 600 0.8125rem/1 var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}
.play-from:hover { border-color: var(--c, var(--ink)); }

/* The word being spoken, tinted with its speaker's colour. Literal values: custom properties
   aren't reliably available inside ::highlight() in every browser. Keep in step with the tokens. */
::highlight(spoken-moderator) { background-color: rgb(90 101 119 / 0.28); }
::highlight(spoken-P1) { background-color: rgb(179 107 0 / 0.28); }
::highlight(spoken-P2) { background-color: rgb(11 127 130 / 0.28); }
::highlight(spoken-P3) { background-color: rgb(116 70 176 / 0.28); }
::highlight(spoken-P4) { background-color: rgb(176 38 63 / 0.28); }
::highlight(spoken-P5) { background-color: rgb(47 125 52 / 0.28); }

@media (prefers-color-scheme: dark) {
  ::highlight(spoken-moderator) { background-color: rgb(154 165 182 / 0.34); }
  ::highlight(spoken-P1) { background-color: rgb(240 165 49 / 0.34); }
  ::highlight(spoken-P2) { background-color: rgb(60 195 196 / 0.34); }
  ::highlight(spoken-P3) { background-color: rgb(176 138 230 / 0.34); }
  ::highlight(spoken-P4) { background-color: rgb(240 100 124 / 0.34); }
  ::highlight(spoken-P5) { background-color: rgb(108 194 111 / 0.34); }
}

/* Participant numbers in the verbatim text get their speaker's colour and name on hover. */
abbr.ref { text-decoration: none; font-weight: 600; color: var(--c); cursor: help; }

@media (max-width: 52rem) {
  .featured-top.has-cover, .debate-head.has-cover { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .featured-cover, .debate-cover { order: -1; }
  .debate-body { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .cast { position: static; }
  .cast ul { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
  .controls { width: 100%; }
  .entry { scroll-margin-top: 14rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
