/* ═══════════════════════════════════════════════════
   VARIABLES & RESET
═══════════════════════════════════════════════════ */
:root {
  --bg:          #080c16;
  --bg-2:        #0c1220;
  --bg-3:        #111827;
  --surface:     rgba(255,255,255,0.035);
  --surface-2:   rgba(255,255,255,0.06);
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);

  --text-primary:   #e8edf5;
  --text-secondary: #8896a8;
  --text-dim:       #4a5568;

  --accent-blue:  #3b82f6;
  --accent-violet:#8b5cf6;
  --accent-cyan:  #06b6d4;
  --accent-grad:  linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
  --glow-blue:    0 0 40px rgba(59,130,246,0.15);
  --glow-violet:  0 0 40px rgba(139,92,246,0.15);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;

  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  32px;
  --space-xl:  64px;
  --space-2xl: 120px;
}

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

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

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(139,92,246,0.35);
  color: #fff;
}

/* ═══════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* ═══════════════════════════════════════════════════
   NAV
═══════════════════════════════════════════════════ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  background: rgba(8,12,22,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.25em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }

/* ═══════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 48px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#binaryCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.18;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, transparent 0%, var(--bg) 80%),
              linear-gradient(to bottom, transparent 50%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 780px;
  padding-top: 80px;
}

.hero-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-label::before {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--accent-blue);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(52px, 7vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.hero-title .line {
  display: block;
  color: var(--text-primary);
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-title .line:nth-child(2) { animation-delay: 0.08s; }
.hero-title .line:nth-child(3) { animation-delay: 0.16s; }

.accent-line {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-style: italic;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.75;
  max-width: 520px;
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

.hero-scroll-cue {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 56px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.36s both;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--text-dim));
  animation: scrollPulse 2s ease-in-out infinite;
}

.hero-stats {
  position: absolute;
  right: 48px;
  bottom: 80px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: right;
  backdrop-filter: blur(10px);
  min-width: 180px;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════
   SECTIONS — SHARED
═══════════════════════════════════════════════════ */
.section {
  padding: var(--space-2xl) 48px;
  position: relative;
  border-top: 1px solid var(--border);
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 64px;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-blue);
  padding: 4px 10px;
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 20px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.section-title em {
  font-style: italic;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-body {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 480px;
}

/* ═══════════════════════════════════════════════════
   BINARY SECTION
═══════════════════════════════════════════════════ */
.binary-section { background: var(--bg); }

.binary-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.bit-progression {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bit-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bit-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  width: 50px;
  flex-shrink: 0;
}

.bit-track {
  display: flex;
  gap: 6px;
}

.bit-cell {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
  transition: all 0.3s ease;
}

.bit-cell.active {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.4);
  color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59,130,246,0.1);
}

.bit-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

/* Byte display */
.byte-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
}

.byte-display::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--accent-grad);
  opacity: 0.6;
}

.byte-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.byte-bits {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.byte-bits .bit-cell {
  width: 38px;
  height: 38px;
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.byte-decimal {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.byte-hex {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-dim);
}

.byte-char {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 44px;
}

.byte-slider-wrap {
  width: 100%;
}

.byte-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--border-2);
  outline: none;
  cursor: pointer;
}

.byte-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-violet);
  cursor: pointer;
  box-shadow: 0 0 16px rgba(139,92,246,0.5);
  transition: box-shadow 0.2s;
}

.byte-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 24px rgba(139,92,246,0.7);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.byte-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-align: center;
}

/* ═══════════════════════════════════════════════════
   TEXT SECTION
═══════════════════════════════════════════════════ */
.text-section { background: var(--bg-2); }

.text-layout { max-width: 1100px; }

.text-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 64px;
  align-items: start;
}

.char-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.pipe-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}

.pipe-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.char-big {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 60px;
  text-align: center;
}

.code-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.binary-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
}

.pipe-arrow {
  color: var(--text-dim);
  width: 40px;
  flex-shrink: 0;
  opacity: 0.5;
}

.char-keyboard {
  margin-bottom: 48px;
}

.kb-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.kb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kb-key {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.kb-key:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-primary);
}

.kb-key.active {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.5);
  color: var(--accent-violet);
  box-shadow: 0 0 16px rgba(139,92,246,0.15);
}

/* Encoding systems */
.encoding-systems {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 680px;
}

.enc-system {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 100px 160px 1fr auto;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}

.enc-system.featured {
  border-color: rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.05);
}

.enc-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.enc-range {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
}

.enc-desc {
  font-size: 13px;
  color: var(--text-dim);
}

.enc-bar {
  width: 120px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.enc-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════════════
   IMAGE SECTION
═══════════════════════════════════════════════════ */
.image-section { background: var(--bg); }

.image-layout { max-width: 1100px; }

.image-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 64px;
  align-items: start;
}

.pixel-demo {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 64px;
  align-items: start;
  margin-bottom: 48px;
}

.pixel-grid-wrap {
  position: relative;
  cursor: crosshair;
}

#pixelCanvas {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

.pixel-tooltip {
  position: absolute;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  z-index: 10;
}

.rgb-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 320px;
}

.rgb-channel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rgb-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  width: 16px;
  flex-shrink: 0;
}

.r .rgb-label { color: #f87171; }
.g .rgb-label { color: #4ade80; }
.b .rgb-label { color: #60a5fa; }

.rgb-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.rgb-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s ease;
}

.r .rgb-fill { background: #f87171; }
.g .rgb-fill { background: #4ade80; }
.b .rgb-fill { background: #60a5fa; }

.rgb-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.rgb-swatch {
  width: 100%;
  height: 60px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background 0.2s;
}

.rgb-hex {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* Resolution concept */
.res-concept {
  margin-top: 28px;
}

.res-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.res-grid-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.res-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.5;
  transition: opacity 0.2s;
}

.res-grid-item.active { opacity: 1; }

.res-grid {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.res-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
}

.res-grid.tiny   { width: 24px; height: 24px; background-size: 6px 6px; }
.res-grid.small  { width: 32px; height: 32px; background-size: 4px 4px; }
.res-grid.medium { width: 40px; height: 40px; background-size: 2.5px 2.5px; }
.res-grid.large  { width: 52px; height: 52px; background-size: 1.6px 1.6px; }

.res-grid.tiny::after   { background-size: 6px 6px; }
.res-grid.small::after  { background-size: 4px 4px; }
.res-grid.medium::after { background-size: 2.5px 2.5px; }
.res-grid.large::after  { background-size: 1.6px 1.6px; }

/* Color model note */
.color-model-note {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 600px;
}

.cm-item {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cm-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.cm-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.cm-sep {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   AUDIO SECTION
═══════════════════════════════════════════════════ */
.audio-section { background: var(--bg-2); }

.audio-layout { max-width: 1100px; }

.audio-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 64px;
  align-items: start;
}

.waveform-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 40px;
}

.waveform-controls {
  display: flex;
  gap: 48px;
  margin-bottom: 28px;
}

.wf-control label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: block;
  margin-bottom: 10px;
}

.wf-options {
  display: flex;
  gap: 6px;
}

.wf-opt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.wf-opt:hover {
  border-color: var(--border-2);
  color: var(--text-primary);
}

.wf-opt.active {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.4);
  color: var(--accent-blue);
}

#waveCanvas {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-sm);
  display: block;
}

.audio-stats {
  display: flex;
  gap: 0;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.astat {
  flex: 1;
  padding: 0 24px;
  border-right: 1px solid var(--border);
}
.astat:first-child { padding-left: 0; }
.astat:last-child { border-right: none; }

.astat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.astat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

.nyquist-note {
  background: rgba(6,182,212,0.05);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nyquist-formula {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nf-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.nf-eq {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
}

.nyquist-note p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════
   VIDEO SECTION
═══════════════════════════════════════════════════ */
.video-section { background: var(--bg); }

.video-layout { max-width: 1100px; }

.video-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 64px;
  align-items: start;
}

.frame-sequence {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.frame-item {
  flex-shrink: 0;
  width: 72px;
  height: 52px;
  border-radius: 5px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.frame-item:hover { transform: translateY(-3px); }

.frame-item.keyframe {
  background: rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.4);
  color: var(--accent-blue);
}

.frame-item.pframe {
  background: rgba(139,92,246,0.08);
  border-color: rgba(139,92,246,0.25);
  color: var(--accent-violet);
}

.frame-item.bframe {
  background: rgba(6,182,212,0.07);
  border-color: rgba(6,182,212,0.2);
  color: var(--accent-cyan);
}

.frame-item .frame-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 9px;
  opacity: 0.7;
}

.frame-item .frame-num {
  font-size: 18px;
  font-weight: 700;
}

.frame-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 48px;
}

.fl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.fl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fl-dot.keyframe { background: var(--accent-blue); }
.fl-dot.pframe   { background: var(--accent-violet); }
.fl-dot.bframe   { background: var(--accent-cyan); }

.motion-vectors {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 48px;
}

.mv-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 20px;
}

#motionCanvas {
  width: 100%;
  max-width: 600px;
  height: 180px;
  display: block;
  border-radius: var(--radius-sm);
}

.mv-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 16px;
  line-height: 1.6;
}

/* Codec comparison */
.codec-comparison {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
}

.codec-item {
  display: grid;
  grid-template-columns: 130px 50px 1fr 80px;
  align-items: center;
  gap: 16px;
}

.codec-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.codec-era {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.codec-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.codec-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.codec-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   COMPRESSION SECTION
═══════════════════════════════════════════════════ */
.compression-section { background: var(--bg-2); }

.compression-layout { max-width: 1100px; }

.comp-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 64px;
  align-items: start;
}

/* RLE Demo */
.rle-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 48px;
  max-width: 720px;
}

.rle-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.rle-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 36px;
  align-items: center;
}

.rle-cell {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  transition: all 0.2s;
}

.rle-cell.c0 { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); color: var(--accent-blue); }
.rle-cell.c1 { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.25); color: var(--accent-violet); }
.rle-cell.c2 { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.25); color: var(--accent-cyan); }

.rle-arrow {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  color: var(--text-dim);
  opacity: 0.5;
}

.rle-stats {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 24px;
}

.rle-stats strong {
  color: var(--accent-cyan);
}

/* Compression types */
.comp-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 720px;
}

.ct-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.ct-card:hover { border-color: var(--border-2); }

.ct-label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.ct-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.ct-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.ct-bar-orig,
.ct-bar-comp {
  height: 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.ct-bar-orig {
  background: var(--border-2);
  width: 100%;
  color: var(--text-dim);
}

.ct-bar-comp.lossless {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  animation: barGrow 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ct-bar-comp.lossy {
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  color: #fff;
  animation: barGrow 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

/* ═══════════════════════════════════════════════════
   UNIFIED SECTION
═══════════════════════════════════════════════════ */
.unified-section {
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.unified-section::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.unified-layout {
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.unified-title {
  font-size: clamp(40px, 6vw, 80px);
  text-align: center;
}

.unified-body {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 72px;
}

/* Diagram */
.unified-diagram {
  position: relative;
  width: 100%;
  max-width: 700px;
  height: 420px;
  margin-bottom: 64px;
}

.ud-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.ud-core {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid rgba(59,130,246,0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-blue), 0 0 80px rgba(59,130,246,0.1);
  animation: corePulse 3s ease-in-out infinite;
}

.ud-core-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.ud-core-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-blue);
}

.ud-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ud-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: all;
  cursor: default;
  transition: transform 0.2s;
}

.ud-node:hover { transform: scale(1.04); }

.ud-node[data-type="text"]  { top: 20px; left: 50%; transform: translateX(-50%); }
.ud-node[data-type="image"] { top: 50%; left: 20px; transform: translateY(-50%); }
.ud-node[data-type="audio"] { bottom: 20px; left: 50%; transform: translateX(-50%); }
.ud-node[data-type="video"] { top: 50%; right: 20px; transform: translateY(-50%); }

.ud-node:hover { transform: translateX(-50%) scale(1.04); }
.ud-node[data-type="image"]:hover,
.ud-node[data-type="video"]:hover { transform: translateY(-50%) scale(1.04); }

.ud-node-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.ud-node-icon svg { width: 22px; height: 22px; }

.ud-node > span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.ud-node-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* SVG connector lines (drawn by JS) */
.ud-connector-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Unified principle */
.unified-principle {
  max-width: 680px;
  text-align: center;
}

.unified-principle blockquote {
  font-family: var(--font-display);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.65;
  padding: 32px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  position: relative;
}

.unified-principle blockquote::before {
  content: '';
  position: absolute;
  top: 0; left: 40px; right: 40px;
  height: 1px;
  background: var(--accent-grad);
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
.footer {
  padding: 48px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-line {
  height: 1px;
  background: var(--accent-grad);
  opacity: 0.2;
  margin-bottom: 32px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.25em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: 16px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-dim);
}

.footer-right {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════
   KEYFRAMES
═══════════════════════════════════════════════════ */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.8); }
  50%       { opacity: 1;   transform: scaleY(1.1); }
}

@keyframes corePulse {
  0%, 100% { box-shadow: var(--glow-blue), 0 0 80px rgba(59,130,246,0.1); }
  50%       { box-shadow: 0 0 60px rgba(59,130,246,0.25), 0 0 120px rgba(59,130,246,0.15); }
}

@keyframes barGrow {
  from { opacity: 0; transform: scaleX(0); transform-origin: left; }
  to   { opacity: 1; transform: scaleX(1); }
}

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

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-links { display: none; }

  .hero { padding: 0 24px; }
  .hero-stats { display: none; }

  .section { padding: var(--space-xl) 24px; }

  .binary-layout,
  .text-header,
  .image-header,
  .audio-header,
  .video-header,
  .comp-header {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .pixel-demo {
    grid-template-columns: 1fr;
  }

  #pixelCanvas { width: 100%; height: auto; }

  .enc-system {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .enc-bar { display: none; }

  .codec-item {
    grid-template-columns: 120px 1fr 70px;
  }
  .codec-era { display: none; }

  .comp-types { grid-template-columns: 1fr; }

  .unified-diagram { height: 520px; }
}
