@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Spectral:ital,wght@0,300;0,400;1,300&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #080808;
  --bg-surface: #0e0e0e;
  --text: #b8b8b8;
  --text-bright: #e4e4e4;
  --text-dim: #555;
  --accent: #c8c8c8;
  --border: #1a1a1a;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-serif: 'Spectral', 'Georgia', serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navigation ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 3rem;
  background: linear-gradient(to bottom, var(--bg) 60%, transparent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  text-transform: lowercase;
  transition: color 0.3s ease;
}
.nav-link:hover { color: var(--text-bright); }
.nav-title {
  margin-left: auto;
  font-size: 1rem;
  color: var(--text-bright);
  font-family: var(--font-serif);
  animation: subtle-pulse 8s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ── Main ── */
main {
  flex: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 7rem 2rem 4rem;
  width: 100%;
}

/* ── Sections ── */
section {
  padding: 4rem 0;
  scroll-margin-top: 5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-number {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 0.3rem;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: lowercase;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}
.content-block { padding-left: 0.5rem; }
.caption {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  line-height: 1.8;
}
.divider {
  text-align: center;
  color: var(--border);
  font-size: 1.2rem;
  letter-spacing: 0.5em;
  padding: 1rem 0;
}

/* ── 01: Halting Problem ── */
.halt-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
}

.halt-machine {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.3rem;
}

.machine-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.machine-output {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
}

.halt-answer {
  color: var(--text-bright);
  font-weight: bold;
}

.halt-proof p {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.halt-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-bright);
  background: var(--bg);
  padding: 1rem;
  border: 1px solid var(--border);
  white-space: pre;
  margin-bottom: 1.2rem;
  line-height: 1.8;
}

.halt-analysis {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.halt-case {
  display: flex;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  align-items: baseline;
}

.halt-case span:first-child {
  color: var(--text-bright);
  min-width: 10rem;
  flex-shrink: 0;
}

.halt-case span:last-child {
  color: var(--text-dim);
}

/* ── 02: Collatz ── */
.collatz-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2rem;
}

.collatz-rule {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.collatz-formula {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.collatz-case.even { color: var(--text-bright); }
.collatz-case.odd { color: #888; }

.collatz-try {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

.collatz-try span {
  color: var(--text-bright);
  cursor: pointer;
  border-bottom: 1px dashed var(--text-dim);
}

.collatz-trace {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text);
  line-height: 1.8;
  max-height: 3.6rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.collatz-canvas {
  display: block;
  width: 100%;
  height: 60px;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.collatz-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-bright);
}

.collatz-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.5rem;
}

/* ── 03: Quine ── */
.quine-intro {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.quine-display {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.quine-meta {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.quine-status {
  color: var(--text-dim);
}

.quine-code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text);
  padding: 1.5rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
}

/* ── 04: Lambda ── */
.lambda-intro {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.lambda-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-bright);
  background: var(--bg-surface);
  padding: 1.5rem;
  border: 1px solid var(--border);
  white-space: pre;
  line-height: 2;
  margin-bottom: 1.5rem;
}

.lambda-try {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.lambda-input {
  width: 60px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  text-align: center;
}

.lambda-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 1rem;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.2s;
}

.lambda-btn:hover {
  border-color: var(--text-dim);
  color: var(--text-bright);
}

.lambda-output {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-bright);
  min-height: 1.5rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.lambda-step {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  min-height: 1.5rem;
  word-break: break-all;
  font-style: italic;
}

.lambda-tree {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tree-x {
  color: var(--text-bright);
  font-weight: bold;
}

.tree-f {
  color: var(--text-dim);
}

.tree-level {
  color: var(--text-dim);
}

.tree-arrow {
  color: var(--border);
  font-size: 0.7rem;
}

/* ── 05: Gödel ── */
.godel-thesis {
  font-size: 1.1rem;
  color: var(--text-bright);
  font-style: italic;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.godel-diagram {
  margin: 0 auto 2rem;
}

.godel-svg {
  width: 280px;
  height: 160px;
  display: block;
}

.godel-outer {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.godel-inner {
  fill: var(--bg-surface);
  stroke: var(--border);
  stroke-width: 1;
}

.godel-point {
  fill: var(--text-bright);
}

.godel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-bright);
}

.godel-center-label {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--text-dim);
  text-anchor: middle;
  dominant-baseline: middle;
}

.godel-edge-label {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--text-dim);
}

.godel-region-label {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--text-dim);
  opacity: 0.7;
}

.godel-analysis {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 2;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.godel-ring {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 0.5;
  opacity: 0.3;
}

.godel-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.legend-true { color: var(--text-dim); }
.legend-prov { color: #555; }
.legend-gap { color: #888; font-style: italic; }

/* ── 06: Banach-Tarski ── */
.banach-statement {
  font-size: 1rem;
  color: var(--text-bright);
  font-style: italic;
  margin-bottom: 2rem;
  line-height: 1.6;
  text-align: center;
}

.banach-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  min-height: 80px;
}

.banach-scene {
  position: relative;
  width: 100px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The original sphere */
.banach-sphere {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #555, #1a1a1a);
  box-shadow: 0 0 12px rgba(200,200,200,0.08);
  transition: opacity 0.8s ease, transform 0.8s ease;
  position: relative;
  z-index: 2;
}

/* Pieces that appear on hover */
.banach-pieces {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.8s ease;
  width: 50px;
  height: 50px;
}

.banach-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle at 30% 30%, #666, #222);
  border-radius: 50%;
}

.banach-piece.p1 { top: 0; left: 50%; transform: translateX(-50%); }
.banach-piece.p2 { top: 15%; left: 80%; }
.banach-piece.p3 { top: 50%; right: 0; transform: translateY(-50%); }
.banach-piece.p4 { bottom: 15%; right: 20%; }
.banach-piece.p5 { bottom: 0; left: 50%; transform: translateX(-50%); }

/* Two spheres that appear on hover */
.banach-two {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
  display: flex;
  gap: 8px;
  align-items: center;
}

.sphere-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #555, #1a1a1a);
}

.banach-arrow {
  font-size: 1.2rem;
  color: var(--text-dim);
  transition: opacity 0.6s ease;
  font-family: var(--font-mono);
}

.banach-plus {
  font-size: 1.2rem;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.6s ease;
  font-family: var(--font-mono);
}

/* Hover state: sphere explodes into pieces, two spheres appear */
.banach-scene:hover .banach-sphere {
  opacity: 0;
  transform: scale(0.3);
}

.banach-scene:hover .banach-pieces {
  opacity: 1;
}

.banach-scene:hover .banach-arrow {
  opacity: 0;
}

.banach-scene:hover .banach-plus {
  opacity: 1;
}

.banach-scene:hover .banach-two {
  opacity: 1;
}

.banach-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.8;
}

/* ── 07: Game of Life ── */
.gol-intro {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.gol-canvas-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  margin-bottom: 0;
}

.gol-canvas {
  display: block;
  cursor: crosshair;
}

.gol-controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0.8rem 0;
  flex-wrap: wrap;
}

.gol-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.2s;
}

.gol-btn:hover {
  border-color: var(--text-dim);
  color: var(--text-bright);
}

.gol-gen {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
}

.gol-rules {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.8;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}


/* ── 08: Busy Beaver ── */
.bb-intro {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.bb-values {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.bb-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.bb-n {
  color: var(--text-dim);
}

.bb-val {
  color: var(--text-bright);
  text-align: right;
}

.bb-bar {
  height: 2px;
  background: var(--text-dim);
  min-width: 2px;
  display: inline-block;
}

.bb-bar-huge {
  width: 100px !important;
  background: linear-gradient(to right, var(--text-dim), var(--border));
}

.bb-row.bb-unknown .bb-n,
.bb-row.bb-unknown .bb-val {
  opacity: 0.6;
}

.bb-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.8;
}

/* ── 08: Void ── */
.void-block {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: background 0.3s ease;
}

.void-text {
  font-size: 1.1rem;
  color: var(--text-bright);
  font-style: italic;
  line-height: 1.8;
  max-width: 520px;
  margin: 0 auto 2rem;
  transition: opacity 0.4s;
}

.void-nav {
  display: flex;
  justify-content: center;
}

.void-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.4rem 1.5rem;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: all 0.2s;
}

.void-btn:hover {
  border-color: var(--text-dim);
  color: var(--text-bright);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.footer-sep { opacity: 0.3; }

.visit-marker {
  cursor: default;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.visit-marker:hover {
  opacity: 1;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Selection ── */
::selection { background: #333; color: var(--text-bright); }

/* ── Responsive ── */
@media (max-width: 600px) {
  nav {
    padding: 1rem 1.5rem;
    gap: 1rem;
    font-size: 0.65rem;
  }
  main { padding: 5rem 1.5rem 3rem; }
  section { padding: 3rem 0; }
  .halt-block { grid-template-columns: 1fr; }
  .halt-machine { flex-direction: row; gap: 2rem; }
  .godel-diagram { transform: scale(0.8); transform-origin: top center; }
}
