:root {
  --bg: #f6f2e8;
  --paper: rgba(255, 250, 240, 0.78);
  --card: rgba(255, 248, 235, 0.88);
  --line: rgba(48, 30, 13, 0.14);
  --text: #23160e;
  --muted: #6e5a47;
  --accent: #dd5f2a;
  --accent-2: #0c7c59;
  --accent-3: #1846a3;
  --shadow: 0 24px 70px rgba(80, 42, 6, 0.12);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --max: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 153, 102, 0.16), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(12, 124, 89, 0.11), transparent 24%),
    linear-gradient(180deg, #fbf8ef 0%, #f5ecde 48%, #f7f1e7 100%);
  font-family: "Space Grotesk", sans-serif;
  min-height: 100vh;
}

img,
svg {
  max-width: 100%;
}

code {
  overflow-wrap: anywhere;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(35, 22, 14, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 22, 14, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

.hero,
.slides,
.roadmap,
.resources,
.footer {
  position: relative;
  z-index: 1;
}

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 44px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-kicker,
.eyebrow,
.slide-index,
.mini-chip,
.decode-label,
.resource-list a,
.bridge-detail span {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.hero-link,
.resource-list a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(35, 22, 14, 0.25);
  transition: border-color 180ms ease, color 180ms ease;
}

.hero-link:hover,
.resource-list a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 28px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.slide,
.roadmap-card,
.resource-list,
.footer {
  backdrop-filter: blur(20px);
}

.hero-copy {
  padding: 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  margin: 10px 0 14px;
  font-size: clamp(3rem, 5vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-copy h1 span,
.section-head h2,
.slide h3,
.roadmap-card h3 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-style: italic;
}

.lead {
  max-width: 60ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

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

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

.button.secondary {
  border-color: rgba(35, 22, 14, 0.18);
  color: var(--text);
}

.hero-points {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

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

.stack-card,
.glass-card,
.slide,
.roadmap-card,
.resource-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.stack-card,
.glass-card {
  padding: 28px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(12, 124, 89, 0.1);
  color: var(--accent-2);
}

.core-loop {
  margin: 18px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 14px;
  font-size: 1.2rem;
}

.glass-card h2 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

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

.progression {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.progression span,
.bridge-node {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(24, 70, 163, 0.08);
  color: var(--accent-3);
}

.slides,
.roadmap,
.walkthrough,
.sp1-map,
.resources {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px;
}

.section-head {
  margin: 14px 0 22px;
}

.section-head.narrow {
  max-width: 720px;
}

.section-head h2 {
  margin: 10px 0 0;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 1;
}

.slide {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(300px, 1.05fr);
  gap: 24px;
  padding: 30px;
  margin-bottom: 22px;
  overflow: hidden;
}

.slide-copy {
  align-self: center;
}

.slide-index {
  color: var(--accent);
  margin-bottom: 10px;
}

.slide h3 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 3vw, 3.2rem);
  line-height: 1.02;
}

.slide p,
.slide li,
.roadmap-card p,
.bridge-detail strong {
  line-height: 1.7;
}

.slide p,
.slide li,
.teach-box p,
.teacher-notes p,
.guide-card p,
.walkthrough-grid p,
.walkthrough-claim,
.sp1-card p,
.sp1-banner p {
  overflow-wrap: anywhere;
}

.slide ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.teach-box,
.guide-card,
.walkthrough-card,
.walkthrough-grid article,
.sp1-banner,
.sp1-card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(35, 22, 14, 0.08);
  border-radius: 20px;
}

.teach-box {
  margin-top: 18px;
  padding: 16px 18px;
}

.teach-box p {
  margin: 0;
  color: var(--muted);
}

.teach-box p + p {
  margin-top: 10px;
}

.teacher-notes {
  margin-top: 16px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(221, 95, 42, 0.08), rgba(24, 70, 163, 0.06));
  border: 1px solid rgba(35, 22, 14, 0.08);
}

.teacher-notes h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.teacher-notes p {
  margin: 0;
  color: var(--muted);
}

.teacher-notes p + p {
  margin-top: 10px;
}

.slide-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 8px;
}

.statement-card,
.venn-panel,
.quantifier-panel,
.proof-flow,
.mod-panel,
.mapping-panel,
.bridge-panel {
  width: 100%;
  border-radius: var(--radius-lg);
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 247, 235, 0.84));
  border: 1px solid rgba(35, 22, 14, 0.1);
}

.statement-card {
  margin-bottom: 18px;
}

.statement-title {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 700;
}

.decode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.decode-grid > div,
.bridge-detail article {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(35, 22, 14, 0.08);
}

.decode-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.venn-controls,
.quantifier-row,
.mapping-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toggle,
.quantifier-btn,
.proof-mode,
.mapping-btn {
  appearance: none;
  border: 1px solid rgba(35, 22, 14, 0.12);
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.toggle:hover,
.quantifier-btn:hover,
.proof-mode:hover,
.mapping-btn:hover {
  transform: translateY(-1px);
}

.toggle.active,
.quantifier-btn.active,
.proof-mode.active,
.mapping-btn.active {
  background: var(--text);
  color: #fff;
}

.venn {
  width: 100%;
  height: auto;
  overflow: visible;
}

.venn-circle {
  fill: rgba(221, 95, 42, 0.16);
  stroke: rgba(35, 22, 14, 0.22);
  stroke-width: 2;
}

.venn-circle.right {
  fill: rgba(12, 124, 89, 0.16);
}

.venn-highlight {
  fill: rgba(24, 70, 163, 0.3);
  transition: d 240ms ease;
}

.venn-caption,
.quantifier-explainer,
.flow-caption,
.clock-caption,
.mapping-caption {
  color: var(--muted);
  margin: 12px 0 0;
}

.quantifier-stage {
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  gap: 12px;
  align-items: center;
  margin: 26px 0 10px;
}

.quantifier-pill {
  min-height: 76px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: rgba(24, 70, 163, 0.1);
  border: 1px solid rgba(24, 70, 163, 0.15);
}

.quantifier-pill.alt {
  background: rgba(221, 95, 42, 0.1);
  border-color: rgba(221, 95, 42, 0.16);
}

.quantifier-arrow {
  position: relative;
  height: 2px;
  background: rgba(35, 22, 14, 0.28);
}

.quantifier-arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -5px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid rgba(35, 22, 14, 0.42);
}

.proof-flow {
  min-height: 360px;
}

.flowchart {
  width: 100%;
  height: auto;
  margin-top: 14px;
  color: var(--text);
}

.flow-box {
  fill: rgba(255, 255, 255, 0.72);
  stroke: rgba(35, 22, 14, 0.24);
  stroke-width: 1.5;
}

.flow-text {
  font-size: 15px;
  fill: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

.flow-line {
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  marker-end: url(#arrow);
}

.mod-panel label {
  display: block;
  margin-bottom: 14px;
}

#mod-slider {
  width: 100%;
  accent-color: var(--accent);
}

.clock {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 1;
  margin: 22px auto 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.86) 0%, rgba(255, 248, 235, 0.7) 55%, rgba(221, 95, 42, 0.09) 100%);
  border: 1px solid rgba(35, 22, 14, 0.1);
}

.clock-node {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(35, 22, 14, 0.1);
  transform: translate(-50%, -50%);
  transition: transform 220ms ease, background 220ms ease, color 220ms ease;
}

.clock-node.active {
  background: var(--text);
  color: #fff;
  transform: translate(-50%, -50%) scale(1.08);
}

.mapping-svg {
  width: 100%;
  height: auto;
}

.map-node {
  fill: rgba(255, 255, 255, 0.84);
  stroke: rgba(35, 22, 14, 0.18);
  stroke-width: 1.5;
}

.map-label {
  font-size: 15px;
  fill: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

.map-link {
  stroke: rgba(24, 70, 163, 0.8);
  stroke-width: 2.2;
  fill: none;
  marker-end: url(#arrow);
}

.bridge-track {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bridge-node.active {
  background: rgba(12, 124, 89, 0.12);
  color: var(--accent-2);
}

.bridge-detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.guide-intro {
  margin-bottom: 20px;
}

.guide-grid,
.walkthrough-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.guide-card,
.walkthrough-card,
.sp1-banner,
.sp1-card {
  padding: 22px;
  box-shadow: var(--shadow);
}

.guide-card h3,
.walkthrough-grid h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.guide-card p,
.walkthrough-grid p,
.walkthrough-claim {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.walkthrough-card {
  background: var(--card);
}

.walkthrough-claim {
  font-size: 1.08rem;
  color: var(--text);
  margin-bottom: 18px;
}

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

.walkthrough-grid article {
  padding: 16px;
}

.sp1-banner {
  margin-top: 18px;
  background: linear-gradient(135deg, rgba(12, 124, 89, 0.12), rgba(24, 70, 163, 0.08));
}

.sp1-banner p,
.sp1-card p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.sp1-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.sp1-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.roadmap-card {
  padding: 24px;
}

.roadmap-card.wide {
  grid-column: span 4;
}

.resource-list {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.footer {
  max-width: var(--max);
  margin: 0 auto 32px;
  padding: 0 24px 28px;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

@media (max-width: 980px) {
  .hero-grid,
  .slide,
  .roadmap-grid,
  .bridge-detail,
  .guide-grid,
  .walkthrough-grid,
  .sp1-grid {
    grid-template-columns: 1fr;
  }

  .roadmap-card.wide {
    grid-column: auto;
  }

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

@media (max-width: 720px) {
  .hero,
  .slides,
  .roadmap,
  .walkthrough,
  .sp1-map,
  .resources,
  .footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 28px;
  }

  .hero-copy,
  .slide,
  .stack-card,
  .glass-card,
  .roadmap-card,
  .guide-card,
  .walkthrough-card,
  .sp1-banner,
  .sp1-card,
  .resource-list {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-copy h1 {
    font-size: 2.8rem;
  }

  .section-head h2 {
    font-size: 2.2rem;
  }

  .slide h3 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .button {
    width: 100%;
  }

  .toggle,
  .quantifier-btn,
  .proof-mode,
  .mapping-btn {
    min-height: 44px;
    flex: 1 1 140px;
  }

  .slide-visual {
    min-height: auto;
    padding: 0;
  }

  .quantifier-stage {
    grid-template-columns: 1fr;
  }

  .quantifier-pill {
    min-height: 64px;
    font-size: 1rem;
  }

  .quantifier-arrow {
    width: 2px;
    height: 44px;
    margin: 0 auto;
  }

  .quantifier-arrow::after {
    right: -4px;
    top: auto;
    bottom: -2px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid rgba(35, 22, 14, 0.42);
    border-bottom: 0;
  }

  .venn text,
  .flow-text,
  .map-label {
    font-size: 12px;
  }

  .clock {
    width: min(280px, 100%);
  }

  .clock-node {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
}
