:root {
  --bg: #f5efe4;
  --bg-alt: #fffaf2;
  --surface: rgba(255, 250, 242, 0.82);
  --surface-strong: #fffdf9;
  --ink: #16323d;
  --muted: #57737c;
  --line: rgba(22, 50, 61, 0.12);
  --accent: #0d8a7a;
  --accent-soft: #d7f2eb;
  --warm: #ffb562;
  --warm-soft: #ffe3bf;
  --shadow: 0 20px 50px rgba(41, 65, 73, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(13, 138, 122, 0.18), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(255, 181, 98, 0.22), transparent 24%),
    linear-gradient(180deg, #f9f2e7 0%, #f3ecdf 42%, #f8f3ea 100%);
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
}

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

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.hero {
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  backdrop-filter: blur(14px);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand a {
  color: inherit;
  text-decoration: none;
}

.toplinks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 auto;
}

.paper-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 181, 98, 0.34), rgba(215, 242, 235, 0.72));
  border: 1px solid rgba(13, 138, 122, 0.18);
  box-shadow: 0 10px 24px rgba(41, 65, 73, 0.08);
  font-weight: 700;
  white-space: nowrap;
}

.paper-link:hover {
  transform: translateY(-1px);
}

.paper-link-icon {
  position: relative;
  width: 14px;
  height: 16px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.78);
  flex: 0 0 auto;
}

.paper-link-icon::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, transparent 49%, currentColor 50%);
}

.toplinks a,
.reference-links a,
.button,
.paper-link {
  text-decoration: none;
}

.toplinks a,
.reference-links a {
  color: var(--ink);
  opacity: 0.8;
}

.toplinks a:hover,
.reference-links a:hover {
  opacity: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 26px;
  margin-top: 22px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.section,
.timeline-card,
.reference-card,
.toggle-card,
.method-panel,
.argument-card,
.takeaway-card,
.panel-card {
  position: relative;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.hero h1,
.section h2,
.history-callout h3,
.method-panel h3 {
  font-family: "Source Serif 4", Georgia, serif;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.55rem, 4.7vw, 4.3rem);
  line-height: 0.96;
  margin: 0 0 16px;
  max-width: 15ch;
}

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

.hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(170px, 20vw, 235px);
  gap: clamp(18px, 3vw, 32px);
  align-items: center;
  margin-bottom: 10px;
}

.lede {
  font-size: 1.09rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 24px 0 20px;
}

.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 100%;
}

.hero-art img {
  display: block;
  width: min(100%, 230px);
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 30px rgba(41, 65, 73, 0.12));
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

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

.hero-pills li,
.badge {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.hero-pills a {
  color: inherit;
  text-decoration: none;
}

.hero-pills a:hover {
  text-decoration: underline;
}

.hero-panel {
  display: grid;
  gap: 18px;
}

.panel-card,
.section,
.timeline-card,
.reference-card,
.toggle-card,
.method-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.panel-card {
  padding: 22px;
}

.gradient-card {
  background:
    linear-gradient(145deg, rgba(13, 138, 122, 0.16), rgba(255, 250, 242, 0.95) 40%, rgba(255, 181, 98, 0.2)),
    var(--surface-strong);
}

.panel-label {
  margin: 0 0 14px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.default-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.stack-name {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.panel-note {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.code-card pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--ink);
}

.section {
  padding: 30px;
  margin-top: 26px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 0.96;
}

.section-heading p {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.7;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  align-items: end;
}

.section-side-note {
  align-self: center;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  border: 1px solid var(--line);
}

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

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

.examples-grid,
.example-entry-grid {
  display: grid;
  gap: 16px;
}

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

.example-entry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.argument-card,
.takeaway-card,
.info-box,
.mini-box {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}

.argument-card h3,
.takeaway-card h3,
.info-box h4 {
  margin: 0 0 8px;
}

.argument-card p,
.takeaway-card p,
.info-box p,
.info-box li,
.mini-box span,
.argument-card pre {
  color: var(--muted);
  line-height: 1.65;
}

.argument-card pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
}

.example-entry {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.example-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.example-call {
  margin: 0;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.55;
}

.example-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.example-links a {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 700;
}

.example-links a:hover {
  opacity: 1;
}

.case-study-figure {
  margin: 18px 0 0;
  padding: 10px 10px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.case-study-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.case-study-figure figcaption {
  margin: 10px auto 0;
  max-width: 28ch;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.method-tabs,
.toggle-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.tab-button:hover {
  transform: translateY(-1px);
}

.tab-button.is-active {
  background: var(--ink);
  color: white;
}

.method-panel,
.toggle-card {
  padding: 22px;
}

.panel-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-banner h3 {
  margin: 0;
  font-size: 2rem;
}

.method-summary {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.method-visual-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 0 0 22px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(215, 242, 235, 0.45)),
    rgba(255, 255, 255, 0.72);
}

.method-visual-card.is-hidden {
  display: none;
}

.curve-kicker {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.method-visual-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.curve-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px 12px;
  align-items: center;
}

.curve-y-label {
  grid-row: 1 / span 2;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.88rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.curve-canvas {
  width: 100%;
  min-height: 250px;
  display: block;
}

.curve-x-label {
  grid-column: 2;
  justify-self: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.math-label {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  color: var(--ink);
}

.math-label sub,
.math-label sup {
  font-style: normal;
}

.curve-legend {
  grid-column: 2;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.curve-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}

.curve-legend-swatch {
  width: 30px;
  border-top: 3px solid var(--swatch-color);
  border-top-style: solid;
  flex: 0 0 auto;
}

.curve-legend-swatch[data-dashed="true"] {
  border-top-style: dashed;
}

.equation-card {
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(215, 242, 235, 0.42)),
    rgba(255, 255, 255, 0.78);
}

.pseudo-equation {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.equation-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.mini-equation {
  margin: 10px 0 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
  width: 100%;
  overflow-x: auto;
}

.mini-equation mjx-container {
  margin: 0 !important;
  max-width: 100%;
}

.mini-equation mjx-container[jax="SVG"] > svg {
  max-width: 100%;
  height: auto !important;
}

.argument-card,
.equation-card,
.theory-note {
  overflow: hidden;
}

.theory-visual {
  margin-top: 20px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.85), rgba(255, 227, 191, 0.34)),
    rgba(255, 255, 255, 0.75);
}

.theory-visual h3 {
  margin: 0 0 8px;
}

.theory-visual p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.theory-diagram {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 16px;
  overflow: hidden;
}

.diagram-caption {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.68;
}

.diagram-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.diagram-panel {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(22, 50, 61, 0.12);
  stroke-width: 1.5;
}

.diagram-panel-strong {
  fill: rgba(215, 242, 235, 0.82);
  stroke: rgba(13, 138, 122, 0.24);
  stroke-width: 1.5;
}

.diagram-panel-warm {
  fill: rgba(255, 227, 191, 0.88);
  stroke: rgba(255, 181, 98, 0.36);
  stroke-width: 1.5;
}

.diagram-line {
  stroke: rgba(22, 50, 61, 0.28);
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagram-line-dashed {
  stroke-dasharray: 7 8;
}

.diagram-accent {
  stroke: var(--accent);
}

.diagram-warm {
  stroke: #d28d3d;
}

.diagram-text {
  fill: var(--ink);
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 15px;
}

.diagram-text-small {
  fill: var(--muted);
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 12px;
}

.diagram-text-strong {
  font-weight: 700;
}

.theory-note {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.68;
}

.takeaway-card ul,
.theory-note ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.takeaway-card li,
.theory-note li {
  color: var(--muted);
  line-height: 1.68;
}

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

.curve-backdrop {
  fill: rgba(255, 253, 249, 0.92);
  stroke: rgba(22, 50, 61, 0.08);
}

.curve-grid-line {
  stroke: rgba(22, 50, 61, 0.08);
  stroke-width: 1;
}

.curve-axis {
  stroke: rgba(22, 50, 61, 0.42);
  stroke-width: 1.6;
}

.curve-reference {
  fill: none;
  stroke: rgba(22, 50, 61, 0.18);
  stroke-width: 2.5;
  stroke-dasharray: 6 8;
  stroke-linecap: round;
}

.method-columns,
.mini-grid,
.reference-links {
  display: grid;
  gap: 14px;
}

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

.info-box ul {
  margin: 0;
  padding-left: 18px;
}

.mini-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.mini-box strong {
  display: block;
  margin-top: 8px;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-card {
  padding: 22px;
  overflow: hidden;
}

.timeline-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
}

.timeline-year {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 12px;
}

.timeline-card h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.timeline-card p,
.history-callout p,
.reference-card p,
.reference-card li {
  margin: 0;
  line-height: 1.74;
  color: var(--muted);
}

.history-callout {
  margin-top: 18px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(13, 138, 122, 0.12), rgba(255, 181, 98, 0.18));
  border: 1px solid var(--line);
}

.history-callout h3 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

.reference-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.reference-links {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.reference-links a {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
  font-weight: 700;
}

.is-revealed {
  animation: fadeUp 0.6s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .hero-grid,
  .split,
  .method-visual-card,
  .method-columns,
  .theory-comparison-grid,
  .examples-grid,
  .example-entry-grid,
  .argument-grid,
  .takeaway-grid,
  .mini-grid,
  .reference-links {
    grid-template-columns: 1fr;
  }

  .default-stack {
    grid-template-columns: 1fr;
  }

  .curve-legend {
    grid-column: 1;
  }

  .hero-head {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 18px;
  }

  .hero-art {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
  }

  .topbar {
    border-radius: 28px;
    align-items: flex-start;
    flex-direction: column;
  }

  .paper-link {
    width: 100%;
    justify-content: center;
  }

  .hero h1 {
    max-width: 100%;
  }

  .hero-head {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-art {
    width: 100%;
  }

  .hero-art img {
    width: min(100%, 180px);
    margin: 0 auto;
  }

  .section,
  .panel-card,
  .method-panel,
  .toggle-card,
  .timeline-card {
    padding: 20px;
  }

  .curve-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .curve-y-label {
    grid-row: auto;
    writing-mode: horizontal-tb;
    transform: none;
    justify-self: center;
  }

  .curve-canvas,
  .curve-x-label {
    grid-column: 1;
  }

  .pseudo-equation {
    font-size: 1.35rem;
  }
}
