/* ══════════════════════════════════════════════════════════════════
   /relay/ — the agent relay page
   Loaded after css/tokens.css and css/home.css. Tokens only; no new palette.
   Agent series: Codex = ink, Claude = forest, Vibe = light forest, Antigravity = hatch.
   ══════════════════════════════════════════════════════════════════ */

/* Shares the artifact header and footer from css/essay-shared.css, at this page's width */
.relay-page {
  --artifact-width: 1040px;
  --artifact-gutter: clamp(24px, 5vw, 72px);
}

.relay-page main {
  padding-top: 3rem;
}

@media (min-width: 1800px) {
  .relay-page {
    --artifact-width: 1200px;
  }
}

/* ── Hero: text beside the topology ── */
.relay-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-lg) var(--space-xl);
  align-items: center;
  padding-top: 48px;
}

.relay-hero h1 {
  max-width: 18ch;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
}

.relay-hero .lede {
  max-width: 44ch;
  font-size: 1.08rem;
}

.relay-fig {
  padding: var(--space-sm);
  border: var(--rule);
  background: var(--surface-strong);
}

.relay-fig figcaption,
.panel figcaption {
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.relay-proof {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
}

/* ── Topology ── */
.topo {
  display: block;
  width: 100%;
  height: auto;
}

.topo .edge {
  stroke: var(--ink);
  stroke-opacity: 0.28;
  stroke-linecap: round;
}

.topo .edge-strong {
  stroke: var(--vermillion);
  stroke-opacity: 1;
}

.topo .ring {
  fill: none;
  stroke: rgb(var(--vermillion-rgb) / 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 3 4;
}

.topo .node {
  fill: var(--surface-strong);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.topo .node-owner {
  fill: var(--ink);
}

.topo .node-n {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--ink);
}

.topo .node-n-owner {
  fill: var(--surface-slate);
}

.topo .lab {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  fill: var(--ink);
}

.topo .lab-s,
.topo .edge-n {
  font-family: var(--font-mono);
  font-size: 11.5px;
  fill: var(--ink-muted);
}

.topo .edge-n {
  fill: var(--ink);
}

/* ── Cast and rules reuse .bets; cast gets a name in front ── */
.relay-page .bet {
  grid-template-columns: 52px minmax(0, 1fr);
}

.relay-page .bet p {
  max-width: 44ch;
  font-size: 1.2rem;
}

.relay-page .cast {
  grid-template-columns: 52px 8.5em minmax(0, 1fr);
}

.cast b {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--vermillion);
}

/* ── Machinery ── */
.mach-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: var(--space-md);
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.mach-row:last-child {
  border-bottom: 1px solid var(--line);
}

.mach dt {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mach dd {
  max-width: 60ch;
  color: var(--ink-soft);
}

.relay-note {
  margin-top: var(--space-sm);
}

/* ── Numbers ── */
.num-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.num-side {
  display: grid;
  gap: var(--space-sm);
  align-content: start;
}

.panel {
  padding: 20px;
  border: var(--rule);
  background: var(--surface-strong);
}

.panel h3 {
  margin-bottom: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.cadence {
  display: block;
  width: 100%;
  height: auto;
}

.cadence .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.cadence .tick,
.cadence .tot {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--ink-muted);
}

.cadence .tot {
  fill: var(--ink);
}

.seg-codex {
  fill: var(--ink);
  background: var(--ink);
}

.seg-claude {
  fill: var(--vermillion);
  background: var(--vermillion);
}

.seg-vibe {
  fill: var(--vermillion-light);
  background: var(--vermillion-light);
}

.seg-anti {
  fill: var(--line);
  background: repeating-linear-gradient(135deg, var(--ink) 0 1.5px, var(--surface-strong) 1.5px 5px);
}

.cadence .seg-anti {
  fill: url(#relay-hatch);
  stroke: var(--ink);
  stroke-width: 1;
}

.cadence .hatch-bg {
  fill: var(--surface-strong);
}

.cadence .hatch-line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

/* The chart keeps a readable size and scrolls sideways on a phone */
.chart-scroll {
  overflow-x: auto;
}

.chart-scroll .cadence {
  min-width: 500px;
}

.daily {
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.daily summary {
  cursor: pointer;
  color: var(--ink-soft);
}

.daily table {
  width: 100%;
  min-width: 420px;
  margin-top: var(--space-xs);
  border-collapse: collapse;
}

.daily caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.daily th,
.daily td {
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
  text-align: right;
}

.daily th:first-child {
  text-align: left;
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--space-sm);
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 1px solid var(--ink);
  vertical-align: -1px;
}

.squares {
  display: grid;
  grid-template-columns: repeat(17, minmax(0, 1fr));
  gap: 4px;
}

.squares i {
  aspect-ratio: 1;
  background: var(--vermillion);
}

.squares .fail {
  background: transparent;
  border: 1.5px solid var(--crimson);
}

.share {
  list-style: none;
  display: grid;
  gap: 10px;
}

.share li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.share-bar {
  height: 10px;
  border-bottom: 1px solid var(--line);
}

.share-bar i {
  display: block;
  height: 100%;
  border: 1px solid var(--ink);
}

.share b {
  font-weight: 500;
  text-align: right;
}

/* ── What I learned ── */
.learn {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-lg) var(--space-xl);
}

.learn li {
  padding-top: var(--space-sm);
  border-top: var(--rule);
}

.learn p {
  color: var(--ink-soft);
}

.thesis {
  max-width: 34em;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.relay-page .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--space-md);
}

@media (max-width: 900px) {
  .relay-hero,
  .num-grid,
  .learn {
    grid-template-columns: minmax(0, 1fr);
  }

  .relay-proof {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: var(--space-sm);
  }

  /* Two columns here; undo the one-column separators inherited from the home hero */
  .relay-proof li,
  .relay-proof li + li {
    padding: var(--space-sm) var(--space-sm) 0;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .relay-proof li:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .mach-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .relay-page .bet {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
  }

  .relay-page .cast {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .cast p {
    grid-column: 2;
  }

  .squares {
    grid-template-columns: repeat(13, minmax(0, 1fr));
  }
}
