:root {
  color-scheme: light;
  --ink: #14181f;
  --ink-soft: #3e4754;
  --muted: #667485;
  --line: #d9e0e8;
  --line-strong: #b8c4d1;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --wash-2: #ebf2f7;
  --blue: #145ca8;
  --blue-dark: #0d3f75;
  --teal: #087c74;
  --green: #22805a;
  --rust: #b3532d;
  --red: #b82e3f;
  --amber: #a66a00;
  --purple: #6b4fb3;
  /* SCOPE role colours (from the paper) */
  --challenger: #d9772e;
  --challenger-dark: #b65f1d;
  --solver: #2f9e44;
  --solver-dark: #237a35;
  --judge: #5d7186;
  --judge-dark: #45576a;
  --shadow: 0 24px 60px rgba(20, 24, 31, 0.11);
  --shadow-soft: 0 12px 36px rgba(20, 24, 31, 0.08);
  --max-width: 1180px;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
canvas {
  display: block;
  max-width: 100%;
}

canvas {
  width: 100%;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

section {
  scroll-margin-top: 92px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px max(24px, calc((100vw - var(--max-width)) / 2));
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(217, 224, 232, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--challenger), var(--solver) 55%, var(--judge));
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 650;
}

.site-header nav a,
.header-link,
.site-footer a {
  text-decoration: none;
}

.site-header nav a:hover,
.header-link:hover,
.site-footer a:hover {
  color: var(--blue);
}

.header-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  font-weight: 750;
}

.header-link:hover {
  color: #fff;
  background: var(--blue-dark);
}

.header-link svg,
.button svg,
.role-card > svg,
.takeaway svg,
.feature svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: clamp(580px, 70svh, 700px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.92fr);
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
  padding: 72px max(24px, calc((100vw - var(--max-width)) / 2));
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(90deg, #0a1320 0%, rgba(10, 19, 32, 0.98) 40%, rgba(10, 19, 32, 0.82) 68%, rgba(10, 19, 32, 0.55) 100%),
    radial-gradient(circle at 84% 30%, rgba(217, 119, 46, 0.26), transparent 38%),
    radial-gradient(circle at 96% 78%, rgba(47, 158, 68, 0.22), transparent 40%),
    #0a1320;
}

.hero::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.hero-visual {
  position: relative;
  z-index: 1;
  margin: 0;
}

.hero-visual img {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.hero-visual figcaption {
  margin-top: 12px;
  color: #aebccb;
  font-size: 0.84rem;
  text-align: center;
}

.kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .kicker {
  color: #f0a96a;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3.6rem, 5.4vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: -0.01em;
  font-weight: 850;
}

h2 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.06;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.22;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 720px;
  margin: 18px 0 0;
  color: #f0f6fb;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
}

.hero-copy {
  max-width: 660px;
  margin: 16px 0 0;
  color: #d2dde8;
  font-size: 1.05rem;
}

.hero-copy strong {
  color: #fff;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 26px;
  color: #fff;
  font-weight: 700;
}

.authors sup {
  color: #f0a96a;
  font-weight: 800;
}

.affiliations {
  margin: 8px 0 0;
  color: #c5d2dc;
  font-size: 0.95rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  color: var(--ink);
  background: #fff;
}

.button-primary:hover {
  background: #eaf3f8;
}

.button-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.08);
}

.button-secondary:hover {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.14);
}

/* ---------- Metrics strip ---------- */
.metrics-strip {
  width: min(var(--max-width), calc(100% - 48px));
  margin: -36px auto 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 124px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 22px;
  background: var(--paper);
}

.metric strong {
  color: var(--blue-dark);
  font-size: 2.35rem;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

/* ---------- Sections ---------- */
.section {
  width: min(var(--max-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 92px 0 0;
}

.section-accent {
  width: 100%;
  max-width: none;
  padding: 92px max(24px, calc((100vw - var(--max-width)) / 2)) 0;
  background: linear-gradient(180deg, transparent 0, transparent 30px, var(--wash-2) 30px, var(--wash-2) 100%);
}

.section-head {
  max-width: 840px;
  margin-bottom: 30px;
}

.section-head p:not(.kicker) {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 1.04rem;
}

/* ---------- Role cards (Challenger / Solver / Judge) ---------- */
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.role-card {
  position: relative;
  padding: 24px 22px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent, var(--blue));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.role-card.challenger { --accent: var(--challenger); }
.role-card.solver { --accent: var(--solver); }
.role-card.judge { --accent: var(--judge); }

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--accent);
}

.role-card.judge .role-tag { color: #fff; }

.role-card h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.role-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.role-card .role-state {
  display: inline-block;
  margin-top: 14px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
}

/* ---------- Pipeline steps ---------- */
.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  counter-reset: step;
}

.pipeline-step {
  position: relative;
  padding: 18px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.pipeline-step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.86rem;
}

.pipeline-step h4 {
  margin: 0 0 5px;
  font-size: 0.98rem;
}

.pipeline-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- Media / figure panels ---------- */
.media-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 20px;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.media-panel img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.media-panel figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Controls ---------- */
.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.control {
  display: grid;
  gap: 7px;
  min-width: 220px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 800;
}

.control.compact {
  min-width: 0;
  margin: 14px 0 10px;
}

.control select {
  min-height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 38px 0 12px;
  font-weight: 700;
}

/* ---------- Segmented toggle ---------- */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--wash-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.segmented button {
  min-height: 36px;
  padding: 0 15px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  font-size: 0.9rem;
}

.segmented button:hover {
  color: var(--blue);
}

.segmented button.is-active {
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 2px 6px rgba(20, 24, 31, 0.08);
}

/* ---------- Chart cards ---------- */
.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  min-width: 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.chart-card.full {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  min-height: 50px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}

.card-head h3 {
  font-size: 1.18rem;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-box {
  position: relative;
  height: 360px;
  min-height: 360px;
}

.chart-box.tall {
  height: 440px;
  min-height: 440px;
}

.chart-box.short {
  height: 300px;
  min-height: 300px;
}

/* ---------- Data tables ---------- */
.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}

table.data caption {
  caption-side: top;
  padding: 14px 18px 6px;
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
}

table.data th,
table.data td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

table.data th:first-child,
table.data td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--paper);
}

table.data thead th {
  position: sticky;
  top: 0;
  background: var(--wash-2);
  color: var(--ink-soft);
  font-weight: 750;
  font-size: 0.82rem;
}

table.data thead th:first-child {
  background: var(--wash-2);
  z-index: 1;
}

table.data tbody tr:hover td {
  background: var(--wash);
}

table.data tbody tr:hover td:first-child {
  background: var(--wash);
}

table.data td.best {
  color: var(--blue-dark);
  font-weight: 800;
}

table.data tr.group-head td {
  background: #f0f4f9;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  border-top: 2px solid var(--line-strong);
}

table.data tr.is-scope td:first-child {
  color: var(--solver-dark);
  font-weight: 750;
}

table.data .delta-pos { color: var(--solver); font-weight: 700; }
table.data .delta-neg { color: var(--red); font-weight: 700; }

.row-note {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ---------- Feature / takeaway grids ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.feature {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.feature svg {
  width: 22px;
  height: 22px;
  color: var(--blue);
  margin-bottom: 12px;
}

.feature h3 {
  margin-bottom: 8px;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.takeaways {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.takeaway {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.takeaway svg {
  width: 22px;
  height: 22px;
  color: var(--challenger-dark);
  margin-bottom: 14px;
}

.takeaway h3 {
  margin-bottom: 8px;
}

.takeaway p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Positioning table (highlight SCOPE row) ---------- */
.positioning td .check { color: var(--solver); font-weight: 800; }
.positioning td .cross { color: var(--red); font-weight: 800; }
.positioning tr.is-ours td {
  background: color-mix(in srgb, var(--solver) 9%, white);
}
.positioning tr.is-ours td:first-child {
  background: color-mix(in srgb, var(--solver) 9%, white);
  color: var(--solver-dark);
  font-weight: 800;
}

/* ---------- Cite ---------- */
.cite-section {
  padding-bottom: 88px;
}

pre {
  margin: 16px 0 0;
  padding: 20px;
  overflow-x: auto;
  color: #e8edf4;
  background: #121820;
  border-radius: var(--radius);
  border: 1px solid #263240;
  font-size: 0.9rem;
  line-height: 1.55;
}

.note-banner {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  background: color-mix(in srgb, var(--amber) 10%, white);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, white);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.note-banner svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--amber);
  margin-top: 1px;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  margin-top: 92px;
  padding: 28px 24px 40px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .role-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

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

  .chart-layout,
  .takeaways {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .site-header nav {
    display: none;
  }

  .hero {
    min-height: 0;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 30px;
    padding-top: 48px;
    padding-bottom: 58px;
    background:
      linear-gradient(90deg, #0a1320 0%, rgba(10, 19, 32, 0.96) 70%, rgba(10, 19, 32, 0.78) 100%),
      radial-gradient(circle at 82% 78%, rgba(217, 119, 46, 0.22), transparent 42%),
      #0a1320;
  }

  .hero-visual {
    max-width: 640px;
  }

  h1 {
    font-size: 3.4rem;
  }

  h2 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.16rem;
  }

  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100% - 28px, var(--max-width));
  }

  .section,
  .section-accent {
    width: min(100% - 28px, var(--max-width));
    padding-top: 72px;
  }

  .section-accent {
    width: 100%;
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 560px) {
  .site-header {
    min-height: 62px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand span:last-child {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-link span {
    display: none;
  }

  .hero {
    padding-left: 18px;
    padding-right: 18px;
  }

  h1 {
    font-size: 2.7rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .hero-actions .button {
    flex: 1 1 100%;
  }

  .metrics-strip,
  .pipeline {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 96px;
  }

  .chart-card {
    padding: 14px;
  }

  .chart-box,
  .chart-box.tall,
  .chart-box.short {
    height: 320px;
    min-height: 320px;
  }

  .control,
  .control-grid {
    width: 100%;
  }
}
