:root {
  color-scheme: light dark;
  --page: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f0ec;
  --ink: #171816;
  --muted: #6f716d;
  --faint: #a4a6a1;
  --line: rgba(23, 24, 22, 0.12);
  --line-strong: rgba(23, 24, 22, 0.22);
  --accent: #315efb;
  --accent-2: #13a88a;
  --accent-wash: rgba(49, 94, 251, 0.1);
  --warm: #e96d45;
  --shadow: 0 24px 80px rgba(22, 24, 22, 0.08);
  --content-width: 1440px;
}

body[data-paper="generalization"] {
  --accent: #2e62ff;
  --accent-2: #0e9e83;
  --accent-wash: rgba(46, 98, 255, 0.1);
  --warm: #ea6c42;
}

body[data-paper="orth-dion"] {
  --accent: #7357ff;
  --accent-2: #0f9f8f;
  --accent-wash: rgba(115, 87, 255, 0.1);
  --warm: #ef704d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #090a09;
    --surface: #111210;
    --surface-soft: #191a18;
    --ink: #f2f2ed;
    --muted: #a2a49f;
    --faint: #696b67;
    --line: rgba(242, 242, 237, 0.12);
    --line-strong: rgba(242, 242, 237, 0.24);
    --accent-wash: rgba(139, 119, 255, 0.14);
    --shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  background: var(--page);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 7% 5%, var(--accent-wash), transparent 24rem),
    var(--page);
  color: var(--ink);
  font: 16px/1.58 Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 4px;
}

a:hover {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.research-shell {
  width: min(var(--content-width), calc(100% - 56px));
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.back-home,
.paper-switcher a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.back-home {
  justify-self: start;
}

.back-home svg,
.paper-switcher svg,
.text-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.series-label {
  grid-column: 2;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.paper-switcher {
  justify-self: end;
}

.hero {
  max-width: 1040px;
  padding: clamp(84px, 12vw, 170px) 0 clamp(110px, 15vw, 210px);
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 30px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.hero h1 {
  max-width: 1010px;
  margin: 0;
  font-size: clamp(46px, 6.8vw, 96px);
  font-weight: 590;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-lede {
  max-width: 760px;
  margin: 36px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: -0.015em;
  line-height: 1.45;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.hero-meta li {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.hero-meta li:first-child {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: var(--accent-wash);
  color: var(--ink);
}

.scroll-cue {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  margin-top: 46px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scroll-cue::before {
  width: 1px;
  height: 28px;
  background: linear-gradient(var(--accent), transparent);
  content: "";
}

.story {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(360px, 0.84fr);
  gap: clamp(48px, 6vw, 104px);
  align-items: start;
  padding-bottom: 10vh;
}

.visual-column {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  height: calc(100svh - 48px);
  min-height: 560px;
  align-self: start;
}

.visual-frame {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, var(--accent) 8%), var(--surface));
  box-shadow: var(--shadow);
  isolation: isolate;
}

.visual-frame::before {
  position: absolute;
  z-index: -1;
  inset: -18% auto auto -12%;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent-wash);
  filter: blur(16px);
  content: "";
}

.visual-header,
.visual-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.visual-header {
  border-bottom: 1px solid var(--line);
}

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

.visual-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}

.visual-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-wash);
  content: "";
}

.scene-wrap {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  padding: clamp(8px, 1.6vw, 24px);
}

.scene {
  display: block;
  width: 100%;
  max-height: 100%;
  overflow: visible;
}

.story-progress {
  position: absolute;
  z-index: 4;
  top: 72px;
  right: 16px;
  bottom: 72px;
  width: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.story-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
}

.story-copy {
  min-width: 0;
}

.story-step {
  display: flex;
  min-height: 92vh;
  min-height: 92svh;
  align-items: center;
  padding: 92px 0;
  opacity: 1;
  transition: opacity 220ms ease;
}

[data-research-story][data-enhanced="true"] .story-step {
  opacity: 0.42;
}

[data-research-story][data-enhanced="true"] .story-step[data-active="true"] {
  opacity: 1;
}

.step-inner {
  width: 100%;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.step-label {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 46px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.step-label span:last-child {
  color: var(--accent);
}

.story-step h2,
.section-heading {
  margin: 0;
  font-size: clamp(30px, 3.3vw, 52px);
  font-weight: 590;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.story-step p {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.62;
}

.story-step strong,
.summary-grid strong,
.limitation-note strong {
  color: var(--ink);
  font-weight: 700;
}

.concept-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 28px;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 12px;
  background: var(--accent-wash);
  color: var(--ink);
  font: 600 13px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.concept-line code {
  font: inherit;
}

.content-section {
  padding: clamp(100px, 13vw, 180px) 0;
  border-top: 1px solid var(--line);
}

.section-kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 52px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--line);
}

.summary-grid article {
  min-height: 178px;
  padding: 24px;
  background: var(--surface);
}

.summary-grid span {
  display: block;
  margin-bottom: 16px;
  color: var(--accent);
  font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.summary-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.limitation-note {
  margin-top: 28px;
  padding: 20px 22px;
  border-left: 2px solid var(--warm);
  background: color-mix(in srgb, var(--warm) 7%, transparent);
  color: var(--muted);
  font-size: 14px;
}

.paper-preview {
  margin-top: 54px;
}

.paper-sheet {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(20, 22, 20, 0.08);
}

.paper-sheet::after {
  position: absolute;
  right: -52px;
  bottom: -66px;
  width: 190px;
  height: 190px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 50%;
  content: "";
}

.paper-kicker {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--ink);
  color: var(--muted);
  font: 700 10px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper-thumbnail {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 24px;
  border: 1px solid var(--line);
  background: #fffefb;
  box-shadow: 0 12px 30px rgba(20, 22, 20, 0.08);
}

.paper-sheet h3 {
  max-width: 92%;
  margin: 24px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.5vw, 36px);
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.paper-authors {
  max-width: 94%;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.5;
}

.paper-abstract {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 18px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.paper-abstract h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.paper-abstract p {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.55;
}

.paper-figure {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  align-items: end;
  height: 74px;
  margin-top: 30px;
  padding: 10px 12px 0;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  background: var(--surface-soft);
}

.paper-figure span {
  display: block;
  min-height: 12px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--accent) 68%, var(--surface));
}

.paper-figure span:nth-child(2n) {
  background: color-mix(in srgb, var(--accent-2) 62%, var(--surface));
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 22px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.indexing-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 42px 0 56px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.page-footer a {
  font-weight: 700;
  text-decoration: none;
}

/* Shared SVG vocabulary. Meaning is duplicated in adjacent text. */
.scene text {
  fill: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
}

.scene .scene-title {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.scene .scene-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene .scene-mono {
  fill: var(--ink);
  font: 700 13px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.scene .axis,
.scene .grid-line {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
}

.scene .grid-line {
  stroke: var(--line);
  stroke-dasharray: 4 7;
}

.scene .accent-stroke {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene .secondary-stroke {
  fill: none;
  stroke: var(--accent-2);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene .warm-stroke {
  fill: none;
  stroke: var(--warm);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene .panel-fill {
  fill: var(--surface);
  stroke: var(--line);
}

.scene .soft-fill {
  fill: var(--surface-soft);
  stroke: var(--line);
}

.scene .accent-fill {
  fill: var(--accent);
}

.scene .secondary-fill {
  fill: var(--accent-2);
}

.scene .warm-fill {
  fill: var(--warm);
}

@media (max-width: 1040px) {
  .story {
    grid-template-columns: minmax(0, 1.04fr) minmax(330px, 0.96fr);
    gap: 38px;
  }

  .visual-column {
    min-height: 500px;
  }
}

@media (max-width: 820px) {
  .research-shell {
    width: min(100% - 34px, 760px);
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .series-label {
    display: none;
  }

  .paper-switcher {
    grid-column: 2;
  }

  .hero {
    padding: 72px 0 110px;
  }

  .hero h1 {
    font-size: clamp(42px, 12vw, 72px);
  }

  .story {
    display: block;
  }

  .visual-column {
    z-index: 5;
    top: 0;
    height: 44vh;
    height: 44svh;
    min-height: 300px;
    margin: 0 -17px;
  }

  .visual-frame {
    border-radius: 0 0 24px 24px;
    box-shadow: 0 22px 48px rgba(22, 24, 22, 0.12);
  }

  .visual-header,
  .visual-footer {
    padding: 11px 17px;
  }

  .visual-header span:last-child,
  .visual-footer > span:not(.visual-status) {
    display: none;
  }

  .scene-wrap {
    padding: 0 10px;
  }

  .story-progress {
    top: 52px;
    right: 8px;
    bottom: 48px;
  }

  .story-copy {
    position: relative;
    z-index: 2;
  }

  .story-step {
    min-height: 76vh;
    min-height: 76svh;
    align-items: flex-end;
    padding: 120px 0 54px;
  }

  .step-inner {
    padding: 22px 18px 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--page) 93%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .step-label {
    margin-bottom: 30px;
  }

  .content-section {
    padding: 100px 0;
  }

  .paper-sheet {
    padding: 30px 24px;
  }
}

@media (max-width: 560px) {
  .site-header {
    min-height: 70px;
  }

  .paper-switcher span {
    display: none;
  }

  .hero-lede {
    font-size: 18px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid article {
    min-height: 0;
  }

  .paper-abstract {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .story {
    display: block;
  }

  .visual-column {
    position: relative;
    top: auto;
    width: min(560px, 100%);
    height: auto;
    min-height: 0;
    margin: 0 auto 70px;
  }

  .scene-wrap {
    aspect-ratio: 1.5;
  }

  .story-step {
    min-height: auto;
    padding: 60px 0;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .story-step {
    opacity: 1;
  }

  .scroll-cue {
    display: none;
  }
}

@media print {
  .visual-column {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
  }

  .story {
    display: block;
  }

  .story-step {
    min-height: 0;
    opacity: 1;
    page-break-inside: avoid;
  }
}
