/* ── Making of Six Degrees of Play  -  Shared Styles ── */
/* Late 90s / early 2000s gaming magazine aesthetic - wide spreads, bold typography, immersive visuals */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

:root {
  --bg: #0a0e18;
  --bg-alt: #111827;
  --bg-elevated: #1a2540;
  --fg: #e0e6ef;
  --fg-muted: #9aa5b8;
  --fg-subtle: #6b7a90;
  --accent: #f93;
  --accent-glow: rgba(255, 153, 51, 0.15);
  --accent-dim: rgba(255, 153, 51, 0.10);
  --accent-bright: #ffb347;
  --accent-secondary: #4fc3f7;
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 153, 51, 0.12);
  --code-bg: #0a0f1c;
  --code-fg: #cdd6f4;
  --demo-bg: #0a1628;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-display: 'Bebas Neue', 'Inter', Impact, sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 880px;
  --wide-width: 1200px;
  --content-width: 720px;
  --radius: 4px;
  --radius-sm: 3px;
  --gutter: 3rem;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.75;
  overflow-x: hidden;
}

::selection {
  background: rgba(255, 153, 51, 0.3);
  color: #fff;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg);
}

h1 {
  font-family: var(--font-display);
  font-size: 4.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 0.95;
}

h2 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  padding: 0;
  border-top: none;
  color: var(--fg);
  position: relative;
}

/* Section divider - accent bar above h2 */
article h2 {
  margin-top: 4rem;
  padding-top: 3rem;
}
article h2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--accent);
}

article h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
}
article h2:first-of-type::before {
  display: none;
}

h3 {
  font-size: 1.5rem;
  margin: 2.5em 0 0.6em;
  font-weight: 700;
  letter-spacing: 0;
}
h4 {
  font-size: 1.1rem;
  margin: 1.5em 0 0.4em;
  color: var(--fg-muted);
  font-weight: 600;
}

p {
  margin-bottom: 1.4em;
  color: var(--fg-muted);
  font-size: 1.0625rem;
  line-height: 1.8;
}

p + p { margin-top: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
a:hover { border-bottom-color: var(--accent); }

strong { font-weight: 600; color: #fff; }

em { font-style: italic; }

ul, ol {
  margin-bottom: 1.4em;
  padding-left: 1.4em;
  font-size: 1.0625rem;
  color: var(--fg-muted);
}
li { margin-bottom: 0.5em; line-height: 1.7; }

/* ── Navigation ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 24, 0.92);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

nav .nav-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 1.5rem;
}

nav .nav-logo {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--fg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: none;
}
nav .nav-logo span { color: var(--accent); }

nav .nav-links {
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
nav .nav-links::-webkit-scrollbar { display: none; }

nav .nav-links a {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-subtle);
  padding: 0.45rem 0.55rem;
  border-radius: 3px;
  border-bottom: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
nav .nav-links a:hover {
  background: var(--accent-dim);
  color: var(--fg);
}
nav .nav-links a.active {
  color: var(--accent);
  font-weight: 600;
  background: none;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  padding-bottom: calc(0.35rem - 2px);
}

nav .nav-links a.nav-play {
  margin-left: auto;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  align-self: center;
  border: 1.5px solid rgba(255, 153, 51, 0.45);
  border-radius: 100px;
  padding: 0.3rem 1rem 0.3rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
nav .nav-links a.nav-play::before {
  content: '\25B6';
  font-size: 0.5rem;
  line-height: 1;
}
nav .nav-links a.nav-play:hover {
  background: rgba(255, 153, 51, 0.12);
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 20px rgba(255, 153, 51, 0.1);
}

/* Mobile-only play button (between logo and hamburger) */
nav .nav-play-mobile {
  display: none;
}

/* Mobile nav */
nav .nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--fg);
}
nav .nav-toggle svg { display: block; }

@media (max-width: 768px) {
  nav .nav-links {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: rgba(6, 8, 14, 0.98);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1rem;
    gap: 0;
  }
  nav .nav-links.open { display: flex; }
  nav .nav-links a { padding: 0.6rem 0.7rem; }
  nav .nav-links a.nav-play {
    display: none;
  }
  nav .nav-inner { position: relative; }
  nav .nav-play-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1.5px solid rgba(255, 153, 51, 0.45);
    border-radius: 100px;
    padding: 0.25rem 0.9rem 0.25rem 0.7rem;
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 1.5px solid rgba(255, 153, 51, 0.45);
    transition: background 0.2s, border-color 0.2s;
  }
  nav .nav-play-mobile:hover {
    background: rgba(255, 153, 51, 0.12);
    border-color: var(--accent);
    border-bottom-color: var(--accent);
  }
  nav .nav-toggle { display: block; margin-left: auto; }
}

/* ── Page Header - Magazine Spread Style ── */
.page-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 2rem 2rem;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0 2rem;
  align-items: end;
}

.page-header .breadcrumb {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  font-family: var(--font-mono);
  writing-mode: horizontal-tb;
}

.page-header .page-title {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 5rem;
  margin-bottom: 0.3em;
  color: var(--fg);
  -webkit-text-fill-color: unset;
  background: none;
  background-clip: unset;
  -webkit-background-clip: unset;
  line-height: 0.9;
  letter-spacing: 0.03em;
}

.page-header .page-subtitle {
  grid-column: 1 / -1;
  grid-row: 3;
  font-size: 1.05rem;
  color: var(--fg-muted);
  line-height: 1.65;
  max-width: 600px;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

/* ── Article Layout - Wide Desktop Magazine ── */
article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

/* On wide screens, generous padding */
@media (min-width: 1024px) {
  .page-header {
    padding: 5rem 2.5rem 2.5rem;
  }
  .page-header .page-title {
    font-size: 6.5rem;
  }
  article {
    padding: 2rem 2.5rem 5rem;
  }
}

/* ── Inline Code & Code Blocks ── */
code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: rgba(255, 153, 51, 0.08);
  padding: 0.15em 0.45em;
  border-radius: 2px;
  color: var(--accent-bright);
  border: 1px solid rgba(255, 153, 51, 0.12);
}

pre {
  background: #060a14;
  color: var(--code-fg);
  padding: 1.5rem 1.8rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.8em 0;
  line-height: 1.55;
  font-size: 0.9375rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--accent);
  position: relative;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border: none;
}

/* Syntax highlighting tokens */
pre .keyword { color: #cba6f7; }
pre .string { color: #a6e3a1; }
pre .number { color: #fab387; }
pre .comment { color: #6c7086; font-style: italic; }
pre .function { color: #89b4fa; }
pre .operator { color: #89dceb; }
pre .type { color: #f9e2af; }

/* ── Demo Containers - Full Width Bleed ── */
.demo-container {
  position: relative;
  width: 100%;
  margin-top: 2.5em;
  margin-bottom: 2.5em;
  background: var(--demo-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 40px rgba(0, 0, 0, 0.5),
    0 0 80px -20px rgba(255, 153, 51, 0.06);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.demo-container:hover {
  border-color: rgba(255, 153, 51, 0.2);
  box-shadow:
    0 4px 40px rgba(0, 0, 0, 0.6),
    0 0 100px -20px rgba(255, 153, 51, 0.12);
}

/* Demos sit flush with text - no bleed */

.demo-container canvas {
  display: block;
  width: 100%;
  height: 400px;
  cursor: grab;
}
.demo-container canvas:active { cursor: grabbing; }

/* ── Creature Cards - Side-by-side viewer + text ── */
.creature-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0 2.5rem;
  align-items: start;
}
@media (min-width: 860px) {
  .creature-card {
    grid-template-columns: 400px 1fr;
    gap: 2rem;
  }
}
.creature-card .demo-container {
  margin: 0;
  width: 100%;
}
@media (min-width: 1024px) {
  .creature-card .demo-container {
    width: 100%;
    margin-left: 0;
  }
}
.creature-card .demo-container canvas {
  height: 400px;
  aspect-ratio: 1 / 1;
}
.creature-card .creature-text p {
  margin-bottom: 0;
}

.demo-label {
  position: absolute;
  bottom: 12px;
  left: 14px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
}
/* When controls bar exists below canvas, anchor label to canvas bottom, not container bottom */
.demo-container:has(.demo-controls) .demo-label {
  bottom: auto;
  top: calc(400px - 2em);
}

.demo-controls {
  display: flex;
  gap: 12px 20px;
  padding: 0.85rem 1.4rem;
  background: rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  touch-action: pan-x pan-y;  /* allow scroll but let children override */
}

.demo-controls label {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.demo-controls input[type="range"] {
  min-width: 80px;
  max-width: 120px;
  width: 100px;
  accent-color: var(--accent);
  flex-shrink: 0;
  touch-action: none;          /* prevent iOS from stealing touch for scroll */
  -webkit-appearance: none;    /* required for touch-action on iOS WebKit  */
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  outline: none;
}
.demo-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.demo-controls input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.demo-controls span {
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.demo-controls button {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.demo-controls button:hover {
  background: rgba(255, 153, 51, 0.15);
  border-color: rgba(255, 153, 51, 0.3);
  color: var(--accent);
}
.demo-controls button.creature-mode-btn.active {
  background: rgba(255, 153, 51, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.demo-controls select {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  min-width: 80px;
  flex-shrink: 0;
}

.demo-controls input[type="checkbox"] {
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* ── Callout Boxes - Magazine Sidebar Feel ── */
.callout {
  background: rgba(255, 153, 51, 0.05);
  border-left: 4px solid var(--accent);
  padding: 1.5rem 1.8rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 2em 0;
  font-size: 0.95rem;
  position: relative;
}
.callout p { color: var(--fg-muted); }
.callout p:last-child { margin-bottom: 0; }

.callout.technical {
  background: rgba(79, 195, 247, 0.05);
  border-left-color: var(--accent-secondary);
}

/* On wide screens, callouts float to the side like magazine sidebars */
@media (min-width: 960px) {
  .callout.sidebar {
    float: right;
    width: 280px;
    margin: 0 0 1.5rem 2rem;
    clear: right;
  }
}

/* ── Figure/Caption ── */
figure {
  margin: 2.5em 0;
}
figure img, figure video {
  width: 100%;
  border-radius: var(--radius);
}
figcaption {
  font-size: 0.78rem;
  color: var(--fg-subtle);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ── Comparison / Side-by-Side ── */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 2.5em 0;
}
.comparison > div {
  background: var(--bg-alt);
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.comparison > div:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
}
.comparison > div:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}
.comparison > div:hover {
  border-color: rgba(255, 255, 255, 0.12);
}
.comparison h4 {
  margin: 0 0 0.8em;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
  font-weight: 700;
}
.comparison > div:first-child h4 { color: var(--fg-subtle); }
.comparison > div:last-child h4 { color: var(--accent); }

@media (max-width: 600px) {
  .comparison { grid-template-columns: 1fr; }
  .comparison > div:first-child { border-radius: var(--radius) var(--radius) 0 0; border-right: 1px solid var(--border); border-bottom: none; }
  .comparison > div:last-child { border-radius: 0 0 var(--radius) var(--radius); }
}

/* ── Stats / Metrics - Bold Magazine Callouts ── */
.stats-row,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  margin: 2.5em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-card {
  background: var(--bg-alt);
  padding: 1.5rem 1rem;
  text-align: center;
  border-right: 1px solid var(--border);
  transition: background 0.2s;
}
.stat-card:last-child { border-right: none; }
.stat-card:hover {
  background: var(--bg-elevated);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 0.02em;
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--fg-subtle);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ── Table of Contents - Magazine Index ── */
.toc {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1.5rem 1.8rem;
  margin: 2em 0;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
}
.toc h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg);
  margin: 0 0 1em;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
  padding-left: 0;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.2rem 2rem;
}
.toc ol li {
  counter-increment: toc;
  padding: 0.35em 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.toc ol li:last-child { border-bottom: none; }
.toc ol li::before {
  content: counter(toc, decimal-leading-zero) ".";
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-right: 0.6rem;
  font-weight: 700;
}
.toc ol li a {
  font-size: 0.88rem;
  color: var(--fg-muted);
  transition: color 0.15s;
}
.toc ol li a:hover { color: var(--fg); }

/* ── Page-bottom navigation ── */
.page-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 3rem 2rem 0;
  border-top: 1px solid var(--border);
}
@media (min-width: 1024px) {
  .page-nav { padding: 3rem 3rem 0; }
}

.page-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.2rem 1.5rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border-bottom: none;
  border: 1px solid var(--border);
  flex: 1;
  transition: background 0.2s, border-color 0.2s;
  min-width: 0;
}
.page-nav a:hover {
  background: var(--accent-dim);
  border-color: var(--border-glow);
}
.page-nav a .nav-dir,
.page-nav a .page-nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
}
.page-nav a .nav-title,
.page-nav a .page-nav-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--fg);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-nav a:last-child { text-align: right; }
.page-nav a:only-child { margin-left: auto; }

/* ── Footer ── */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--fg-subtle);
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

footer .footer-play {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  padding: 0.55rem 1.6rem 0.55rem 1.3rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid rgba(255, 153, 51, 0.45);
  border-radius: 100px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
footer .footer-play::before {
  content: '\25B6';
  font-size: 0.6rem;
  line-height: 1;
}
footer .footer-play:hover {
  background: rgba(255, 153, 51, 0.12);
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 20px rgba(255, 153, 51, 0.1);
  border-bottom-color: var(--accent);
}

/* ── Scroll-reveal animations ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.06s; opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.12s; opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.18s; opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.24s; opacity: 1; transform: translateY(0); }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }

/* ── Utility ── */
.wide {
  width: 100%;
}

/* ── Full-bleed section breaks ── */
.section-break {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 3rem;
  margin-bottom: 3rem;
}

/* ── Magazine pull-quote ── */
.pull-quote {
  border-left: 4px solid var(--accent);
  padding: 1.2rem 0 1.2rem 1.5rem;
  margin: 2.5rem 0;
  font-size: 1.15rem;
  color: var(--fg);
  font-style: italic;
  line-height: 1.7;
}
.pull-quote .attribution {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--fg-subtle);
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (min-width: 960px) {
  .pull-quote.float {
    float: right;
    width: 300px;
    margin: 0 0 2rem 2rem;
    clear: right;
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  html { font-size: 15px; }
  h1 { font-size: 2.8rem; }
  h2 { font-size: 2rem; }
  .page-header {
    padding: 3rem 1.5rem 1.5rem;
    display: block;
  }
  .page-header .page-title { font-size: 3rem; }
  article { padding: 0 1.5rem 3rem; }
  .demo-container canvas { height: 340px; }
  .demo-container:has(.demo-controls) .demo-label { top: calc(340px - 2em); }
  .creature-card .demo-container canvas { height: 300px; aspect-ratio: auto; }
  .page-nav {
    flex-direction: column;
    padding: 2rem 1.5rem 0;
  }
  .page-nav a:last-child { text-align: left; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card { border-bottom: 1px solid var(--border); }
  .toc ol { grid-template-columns: 1fr; }
  nav { padding: 0 1rem; }
  .demo-controls button { padding: 0.4rem 0.9rem; min-height: 36px; }
}

/* ── Extra small screens (very narrow mobile) ── */
@media (max-width: 480px) {
  html { font-size: 15px; }
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.25rem; }
  .page-header { padding: 2rem 1rem 1rem; }
  .page-header .page-title { font-size: 2.4rem; }
  .page-header .page-subtitle { font-size: 0.9rem; }
  article { padding: 0 1rem 2rem; }
  .demo-container canvas { height: 280px; }
  .demo-container:has(.demo-controls) .demo-label { top: calc(280px - 2em); }
  .demo-controls { padding: 0.6rem 0.8rem; gap: 8px 12px; }
  .demo-controls label { font-size: 0.65rem; }
  .demo-controls input[type="range"] { min-width: 60px; max-width: 90px; width: 80px; }
  pre { padding: 1rem; font-size: 0.75rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card .stat-value { font-size: 1.8rem; }
  .page-nav { padding: 1.5rem 1rem 0; }
  footer { padding: 2rem 1rem; }
  .callout { padding: 1rem 1.2rem; font-size: 0.85rem; }
  .comparison { grid-template-columns: 1fr; }
  .comparison > div:first-child { border-radius: var(--radius) var(--radius) 0 0; border-right: 1px solid var(--border); border-bottom: none; }
  .comparison > div:last-child { border-radius: 0 0 var(--radius) var(--radius); }
}

/* ── Keyframes ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 0.6s ease both;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* ── Swim Animation Editor Demo ── */
.swim-editor-demo {
  padding: 0 !important;
  overflow: hidden;
}

#swim-editor-wrapper {
  display: flex;
  width: 100%;
  height: 560px;
  background: #0a0e18;
}

#swim-editor-sidebar {
  width: 280px;
  min-width: 280px;
  background: rgba(10, 14, 24, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--fg-muted);
}

#swim-editor-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#swim-editor-viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.swim-editor-section {
  margin-bottom: 14px;
}

.swim-editor-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.swim-editor-sublabel {
  font-size: 11px;
  color: var(--fg-muted);
  margin: 8px 0 4px;
}

#swim-editor-sidebar select {
  width: 100%;
  background: #151b2e;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 3px;
}

#swim-editor-sidebar button {
  width: 100%;
  background: #1a2540;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

#swim-editor-sidebar button:hover {
  background: #253050;
}

.swim-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.swim-slider-label {
  flex: 0 0 80px;
  font-size: 11px;
  color: var(--fg-muted);
}

.swim-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--accent-secondary);
}

.swim-slider-val {
  flex: 0 0 44px;
  font-size: 11px;
  color: var(--accent-secondary);
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

@media (max-width: 768px) {
  #swim-editor-wrapper {
    flex-direction: column;
    height: auto;
  }
  #swim-editor-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 300px;
  }
  #swim-editor-viewport {
    height: 350px;
  }
}

/* ── Six Degrees overrides ── */
/* Star icon instead of play triangle for CTA buttons */
nav .nav-links a.nav-play::before {
  content: '\2734';
  font-size: 0.55rem;
}
footer .footer-play::before {
  content: '\2734';
  font-size: 0.65rem;
}
