/* ============================================
   DESIGN TOKENS — Single source of truth
   ============================================ */
:root {
  /* Color Architecture */
  --bg: #080810;
  --bg-elevated: #0e0e1a;
  --accent: #C8F04A;
  --accent-secondary: #F0A030;
  --text: #E8E5DE;
  --text-muted: #4A4845;
  --text-dim: #2a2825;
  --terminal-green: #5af78e;

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing (8px base) */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 7.5rem;
  --space-2xl: 15rem;

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --gutter: 2rem;
}

/* ============================================
   RESET
   ============================================ */
*, *::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 { background: var(--bg); color: var(--text); font-family: var(--font-display); line-height: 1.7; overflow-x: hidden; cursor: none; }
a { color: inherit; text-decoration: none; cursor: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { cursor: none; }

/* ============================================
   PRELOADER — Scene 0
   ============================================ */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: clip-path 1.2s var(--ease-in-out-quart);
  clip-path: inset(0 0 0 0);
}
#preloader.loaded { clip-path: inset(0 0 0 100%); pointer-events: none; }
.preloader-inner { text-align: center; }
.preloader-counter {
  font-family: var(--font-mono); font-size: 5rem; font-weight: 300;
  color: var(--accent); letter-spacing: 0.05em; display: block; margin-bottom: var(--space-md);
}
.preloader-line { width: 200px; height: 1px; background: var(--text-dim); position: relative; margin: 0 auto; }
.preloader-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.05s linear; }

/* ============================================
   CUSTOM CURSOR
   ============================================ */
#custom-cursor { position: fixed; top: 0; left: 0; z-index: 10000; pointer-events: none; mix-blend-mode: difference; }
.cursor-dot {
  width: 8px; height: 8px; background: var(--text); border-radius: 50%;
  position: absolute; top: -4px; left: -4px;
}
.cursor-ring {
  width: 48px; height: 48px; border: 1px solid var(--text); border-radius: 50%;
  position: absolute; top: -24px; left: -24px;
  opacity: 0.5; transition: width 0.4s var(--ease-spring), height 0.4s var(--ease-spring),
    top 0.4s var(--ease-spring), left 0.4s var(--ease-spring), opacity 0.3s, border-color 0.3s;
}
.cursor-label {
  position: absolute; top: -8px; left: 32px; font-family: var(--font-mono);
  font-size: 0.65rem; letter-spacing: 0.15em; color: var(--text); white-space: nowrap;
  opacity: 0; transition: opacity 0.3s;
}
body.cursor-hover-project .cursor-ring { width: 80px; height: 80px; top: -40px; left: -40px; border-color: var(--accent); opacity: 1; }
body.cursor-hover-project .cursor-label { opacity: 1; }
body.cursor-hover-link .cursor-ring { width: 64px; height: 64px; top: -32px; left: -32px; opacity: 0.8; }

/* ============================================
   ATMOSPHERE — Noise, Vignette, Ambient Light
   ============================================ */
#noise-overlay {
  position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 128px 128px;
}
#vignette {
  position: fixed; inset: 0; z-index: 9989; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(8,8,16,0.7) 100%);
}
#ambient-light {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(200,240,74,0.04), transparent 60%);
  transition: background 0.3s;
}

/* ============================================
   THREE.JS CANVAS
   ============================================ */
#three-canvas {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0;
  transition: opacity 0.8s var(--ease-out-expo);
}
body.scrolled-past-hero #three-canvas { opacity: 0; }

/* ============================================
   TYPOGRAPHY
   ============================================ */
.mono-label {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 400;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted);
}
.section-label {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.2em;
  color: var(--text-muted); margin-bottom: var(--space-xl); text-transform: uppercase;
}
.blink-cursor { animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Character reveal animation */
.char-wrap { display: inline-block; overflow: hidden; vertical-align: bottom; }
.char-wrap .char {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.8s var(--ease-out-expo);
}
.char-wrap.revealed .char { transform: translateY(0); }

/* ============================================
   SCENE 1 — IDENTITY
   ============================================ */
#scene-identity {
  position: relative; height: 100vh; display: flex; flex-direction: column;
  justify-content: flex-end; padding: var(--space-lg); z-index: 2;
  min-height: 100vh;
}
.identity-content { margin-bottom: var(--space-xl); }
.identity-label { margin-bottom: var(--space-md); }
.identity-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(4rem, 12vw, 10rem); line-height: 0.9;
  letter-spacing: -0.04em; color: var(--text);
}
.name-line { display: block; white-space: nowrap; }
.name-line-2 { color: var(--accent); font-size: clamp(4.5rem, 13vw, 12rem); }
.identity-descriptor { margin-top: var(--space-md); max-width: 40ch; font-size: 0.8rem; line-height: 1.8; }

.identity-scroll-hint {
  position: absolute; bottom: var(--space-lg); right: var(--space-lg);
  animation: pulse-hint 3s var(--ease-in-out-quart) infinite;
}
@keyframes pulse-hint { 0%,100% { opacity: 0.3; } 50% { opacity: 0.7; } }

/* Ticker */
.ticker-wrap {
  position: absolute; bottom: 0; left: 0; width: 100%; overflow: hidden;
  border-top: 1px solid var(--text-dim); padding: var(--space-sm) 0;
}
.ticker-content {
  display: flex; gap: var(--space-lg); white-space: nowrap;
  animation: ticker-scroll 30s linear infinite;
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.2em;
  color: var(--text-dim); text-transform: uppercase;
}
.ticker-content span { flex-shrink: 0; }
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ============================================
   SCENE 2 — ABOUT
   ============================================ */
#scene-about { position: relative; z-index: 2; padding: var(--space-2xl) var(--space-lg); }
.about-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--space-xl); align-items: start; }
.about-left { position: sticky; top: 10vh; }
.ascii-art {
  font-family: var(--font-mono); font-size: 0.45rem; line-height: 1.1;
  color: var(--accent); opacity: 0.6; letter-spacing: 0.05em; white-space: pre;
  overflow: hidden; max-height: 60vh;
}
.terminal-block {
  background: var(--bg-elevated); border: 1px solid var(--text-dim);
  border-radius: 8px; overflow: hidden; margin-bottom: var(--space-lg);
}
.terminal-header {
  display: flex; gap: 6px; padding: 12px 16px;
  border-bottom: 1px solid var(--text-dim);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); }
.terminal-body { padding: var(--space-md); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.8; }
.terminal-line { margin-bottom: var(--space-xs); }
.prompt { color: var(--accent); }
.terminal-output { color: var(--text-muted); padding-left: 1rem; }
.terminal-title { margin-left: auto; }

.about-specs { margin-bottom: var(--space-lg); }
.spec-item {
  display: flex; justify-content: space-between; padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--text-dim);
}
.spec-item dt { flex-shrink: 0; }
.spec-item dd { text-align: right; font-size: 0.95rem; }

.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); margin-top: var(--space-lg); }
.stat { text-align: center; }
.stat-number {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2rem, 4vw, 3.5rem); color: var(--accent);
  display: block; line-height: 1;
}
.stat-label { display: block; margin-top: var(--space-xs); }

/* ============================================
   SCENE 3 — PROJECTS
   ============================================ */
#scene-projects { position: relative; z-index: 2; padding: var(--space-2xl) 0; }
#scene-projects .section-label { padding-left: var(--space-lg); }
.project {
  position: relative; padding: var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--text-dim);
  transform-style: preserve-3d; perspective: 1000px;
  overflow: hidden;
}
.project-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl);
  align-items: center; transform-style: preserve-3d;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.6s var(--ease-out-expo);
}
.project.revealed .project-inner { clip-path: inset(0 0 0 0); }
.project-index { display: block; margin-bottom: var(--space-sm); color: var(--accent); }
.project-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 0.95;
  letter-spacing: -0.03em; margin-bottom: var(--space-md);
}
.project-desc { font-size: 0.9rem; line-height: 1.8; color: var(--text-muted); max-width: 45ch; margin-bottom: var(--space-md); }
.project-stack { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.tag {
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em;
  padding: 0.4rem 0.8rem; border: 1px solid var(--text-dim); border-radius: 2px;
  color: var(--text-muted); text-transform: uppercase;
  transition: border-color 0.3s, color 0.3s;
}
.project:hover .tag { border-color: var(--accent); color: var(--accent); }

/* Project visuals */
.project-visual {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; transform: translateZ(30px);
}

/* BenefitBridge architectural viz */
#viz-benefitbridge {
  width: 100%; height: 300px; border: 1px solid var(--text-dim);
  position: relative; overflow: hidden; border-radius: 4px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-elevated) 100%);
}

/* Mavira terminal */
.fake-terminal {
  width: 100%; max-width: 500px; background: var(--bg);
  border: 1px solid var(--text-dim); border-radius: 8px; overflow: hidden;
}

/* Trading display */
.trading-display {
  width: 100%; max-width: 400px; padding: var(--space-md);
  background: var(--bg); border: 1px solid var(--text-dim); border-radius: 4px;
  font-family: var(--font-mono); position: relative;
}
.trading-pair { color: var(--text-muted); margin-bottom: var(--space-xs); }
.trading-price {
  font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; font-family: var(--font-display);
  color: var(--text); line-height: 1;
}
.trading-cents { font-size: 0.5em; color: var(--text-muted); }
.trading-change { margin-top: var(--space-xs); margin-bottom: var(--space-md); }
.trading-change.positive { color: var(--terminal-green); }
.trading-change.negative { color: #ff5555; }
.trading-chart { width: 100%; height: 120px; display: block; }
.chart-line { stroke: var(--accent); }

/* Chat mockup */
.chat-mockup {
  width: 100%; max-width: 420px; display: flex; flex-direction: column;
  gap: var(--space-sm); padding: var(--space-md);
  background: var(--bg); border: 1px solid var(--text-dim); border-radius: 12px;
}
.chat-bubble {
  padding: var(--space-sm) var(--space-md); border-radius: 12px;
  font-size: 0.85rem; line-height: 1.6; max-width: 85%;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}
.project:hover .chat-bubble { opacity: 1; transform: translateY(0); }
.project:hover .chat-bubble:nth-child(2) { transition-delay: 0.15s; }
.project:hover .chat-bubble:nth-child(3) { transition-delay: 0.3s; }
.chat-bubble .mono-label { display: block; margin-bottom: 4px; font-size: 0.6rem; }
.chat-user { background: var(--bg-elevated); border: 1px solid var(--text-dim); align-self: flex-end; }
.chat-ai { background: rgba(200,240,74,0.05); border: 1px solid rgba(200,240,74,0.15); align-self: flex-start; }
.chat-ai .mono-label { color: var(--accent); }

/* Project link */
.project-link {
  display: inline-block; margin-top: var(--space-md);
  color: var(--accent); font-size: 0.75rem; letter-spacing: 0.15em;
  padding: 0.6rem 0; border-bottom: 1px solid var(--accent);
  transition: letter-spacing 0.5s var(--ease-out-expo), padding-bottom 0.3s;
}
.project-link:hover { letter-spacing: 0.25em; padding-bottom: 0.3rem; }

/* Triage display */
.triage-display {
  width: 100%; max-width: 420px; padding: var(--space-md);
  background: var(--bg); border: 1px solid var(--text-dim); border-radius: 8px;
  font-family: var(--font-mono);
}
.triage-header {
  font-size: 0.65rem; letter-spacing: 0.2em; color: var(--text-muted);
  margin-bottom: var(--space-md); padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--text-dim);
}
.triage-levels { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: var(--space-md); }
.triage-level {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: 0.8rem; padding: 0.5rem 0.8rem;
  border: 1px solid var(--text-dim); border-radius: 4px;
  opacity: 0; transform: translateX(-10px);
  transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}
.project.revealed .triage-level { opacity: 1; transform: translateX(0); }
.project.revealed .triage-level:nth-child(1) { transition-delay: 0.2s; }
.project.revealed .triage-level:nth-child(2) { transition-delay: 0.35s; }
.project.revealed .triage-level:nth-child(3) { transition-delay: 0.5s; }
.project.revealed .triage-level:nth-child(4) { transition-delay: 0.65s; }
.triage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.triage-red .triage-dot { background: #ff4444; box-shadow: 0 0 8px rgba(255,68,68,0.5); }
.triage-orange .triage-dot { background: #ff8c00; box-shadow: 0 0 8px rgba(255,140,0,0.5); }
.triage-yellow .triage-dot { background: #ffd700; box-shadow: 0 0 8px rgba(255,215,0,0.4); }
.triage-green .triage-dot { background: #5af78e; box-shadow: 0 0 8px rgba(90,247,142,0.4); }
.triage-label { flex: 1; color: var(--text-muted); font-size: 0.7rem; letter-spacing: 0.1em; }
.triage-score { color: var(--text); font-size: 1rem; font-weight: 600; font-family: var(--font-display); }
.triage-red .triage-score { color: #ff4444; }
.triage-orange .triage-score { color: #ff8c00; }
.triage-yellow .triage-score { color: #ffd700; }
.triage-green .triage-score { color: #5af78e; }
.triage-output {
  font-size: 0.7rem; line-height: 2; color: var(--text-muted);
  padding-top: var(--space-sm); border-top: 1px solid var(--text-dim);
}

/* ============================================
   SCENE 4 — CAPABILITIES
   ============================================ */
#scene-capabilities { position: relative; z-index: 2; padding: var(--space-2xl) var(--space-lg); text-align: center; }
.capabilities-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(3rem, 7vw, 6rem); letter-spacing: -0.04em;
  margin-bottom: var(--space-xl); line-height: 0.95;
}
.skills-constellation {
  position: relative; display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--space-xl); max-width: 1100px; margin: 0 auto; padding: var(--space-lg) 0;
}
.skills-lines {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  width: 100%; height: 100%;
}
.skills-lines line { stroke: var(--text-dim); stroke-width: 0.5; opacity: 0; transition: opacity 0.4s; }
.skills-lines line.active { opacity: 0.6; stroke: var(--accent); }
.skill-cluster {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  align-items: center; gap: var(--space-sm); min-width: 140px;
}
.cluster-label { margin-bottom: var(--space-xs); color: var(--accent); font-size: 0.65rem; }
.skill-node {
  font-family: var(--font-mono); font-size: 0.8rem; padding: 0.5rem 1.2rem;
  border: 1px solid var(--text-dim); border-radius: 4px; cursor: none;
  color: var(--text-muted); background: var(--bg);
  transition: color 0.3s var(--ease-out-expo), border-color 0.3s, background 0.3s, transform 0.3s var(--ease-spring);
}
.skill-node:hover, .skill-node.highlighted {
  color: var(--accent); border-color: var(--accent);
  background: rgba(200,240,74,0.05); transform: scale(1.08);
}
.skill-node.dimmed { opacity: 0.2; }

/* ============================================
   SCENE 5 — CONTACT
   ============================================ */
#scene-contact {
  position: relative; z-index: 2; padding: var(--space-2xl) var(--space-lg);
  min-height: 80vh; display: flex; flex-direction: column; justify-content: center;
}
.contact-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(3rem, 8vw, 7rem); line-height: 0.95;
  letter-spacing: -0.04em; margin-bottom: var(--space-xl); max-width: 12ch;
}
.contact-email-wrap { margin-bottom: var(--space-xl); }
.contact-email {
  font-family: var(--font-mono); font-size: clamp(1rem, 2.5vw, 1.8rem);
  letter-spacing: 0.05em; color: var(--accent);
  transition: letter-spacing 0.6s var(--ease-out-expo);
  display: inline-block;
}
.contact-email:hover { letter-spacing: 0.2em; }
.contact-links { display: flex; gap: var(--space-lg); margin-bottom: var(--space-2xl); flex-wrap: wrap; }
.contact-link {
  display: flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-mono); font-size: 0.8rem;
  transition: color 0.3s;
}
.contact-link:hover { color: var(--accent); }
.contact-link:hover .mono-label { color: var(--accent); }
.coord { color: var(--text-muted); }
.contact-footer {
  display: flex; justify-content: space-between; padding-top: var(--space-md);
  border-top: 1px solid var(--text-dim); font-size: 0.7rem;
}

/* ============================================
   MAGNETIC ELEMENTS
   ============================================ */
.magnetic { transition: transform 0.3s var(--ease-spring); }

/* ============================================
   SCROLL REVEAL BASE — Progressive, never binary
   Sections are always visible. Content elements
   within sections animate in smoothly.
   ============================================ */
.scene { position: relative; }

/* About section progressive reveals */
.about-grid .terminal-block,
.about-grid .about-specs,
.about-grid .about-stats,
.about-grid .about-left {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.9s var(--ease-out-expo), transform 0.9s var(--ease-out-expo);
}
.scene.in-view .terminal-block { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.scene.in-view .about-specs  { opacity: 1; transform: translateY(0); transition-delay: 0.25s; }
.scene.in-view .about-stats  { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }
.scene.in-view .about-left   { opacity: 1; transform: translateY(0); transition-delay: 0.15s; }

/* Capabilities progressive reveal */
.skill-cluster {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}
#scene-capabilities.in-view .skill-cluster { opacity: 1; transform: translateY(0); }
#scene-capabilities.in-view .skill-cluster:nth-child(2) { transition-delay: 0.05s; }
#scene-capabilities.in-view .skill-cluster:nth-child(3) { transition-delay: 0.1s; }
#scene-capabilities.in-view .skill-cluster:nth-child(4) { transition-delay: 0.15s; }
#scene-capabilities.in-view .skill-cluster:nth-child(5) { transition-delay: 0.2s; }
#scene-capabilities.in-view .skill-cluster:nth-child(6) { transition-delay: 0.25s; }

/* Contact progressive reveals */
.contact-title,
.contact-email-wrap,
.contact-links {
  opacity: 0; transform: translateY(25px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
#scene-contact.in-view .contact-title      { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
#scene-contact.in-view .contact-email-wrap { opacity: 1; transform: translateY(0); transition-delay: 0.25s; }
#scene-contact.in-view .contact-links      { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }

/* Section labels fade in */
.section-label {
  opacity: 0; transition: opacity 1s var(--ease-out-expo) 0.05s;
}
.scene.in-view .section-label,
#scene-projects.in-view .section-label { opacity: 1; }

/* ============================================
   RESPONSIVE — Tablet Landscape (≤1200px)
   ============================================ */
@media (max-width: 1200px) {
  .identity-name { font-size: clamp(3.5rem, 10vw, 8rem); }
  .name-line-2 { font-size: clamp(4rem, 11vw, 9rem); }
  .project-title { font-size: clamp(2rem, 4vw, 3.5rem); }
  .capabilities-title { font-size: clamp(2.5rem, 6vw, 5rem); }
  .contact-title { font-size: clamp(2.5rem, 6vw, 5rem); }
}

/* ============================================
   RESPONSIVE — Tablet (≤900px)
   ============================================ */
@media (max-width: 900px) {
  :root { --gutter: 1.5rem; }

  /* About */
  .about-grid { grid-template-columns: 1fr; }
  .about-left { display: none; }
  .about-stats { grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }

  /* Projects */
  .project-inner { grid-template-columns: 1fr; }
  .project-visual { min-height: 200px; order: -1; }
  .project { padding: var(--space-lg) var(--space-lg); }

  /* Skills */
  .skills-constellation { gap: var(--space-lg); }

  /* Contact */
  .contact-title { max-width: none; }
}

/* ============================================
   RESPONSIVE — Mobile (≤600px)
   ============================================ */
@media (max-width: 600px) {
  :root {
    --space-lg: 1.5rem;
    --space-xl: 3rem;
    --space-2xl: 5rem;
    --gutter: 1rem;
  }

  /* Hero */
  #scene-identity { padding: var(--space-md); }
  .identity-name { font-size: 11.5vw; }
  .name-line { white-space: nowrap; }
  .name-line-2 { font-size: 13vw; }
  .identity-descriptor { font-size: 0.7rem; max-width: none; }
  .identity-scroll-hint { right: var(--space-md); bottom: var(--space-md); }

  /* About */
  #scene-about { padding: var(--space-xl) var(--space-md); }
  .terminal-body { font-size: 0.7rem; padding: var(--space-sm); }
  .about-stats { grid-template-columns: 1fr; gap: var(--space-lg); }
  .stat-number { font-size: clamp(2rem, 8vw, 3rem); }
  .spec-item { flex-direction: column; gap: 0.25rem; }
  .spec-item dd { text-align: left; }

  /* Projects */
  #scene-projects .section-label { padding-left: var(--space-md); }
  .project { padding: var(--space-lg) var(--space-md); }
  .project-title { font-size: clamp(1.8rem, 8vw, 3rem); }
  .project-desc { font-size: 0.8rem; }
  .project-stack { gap: 0.4rem; }
  .tag { font-size: 0.6rem; padding: 0.3rem 0.6rem; }
  .project-link { font-size: 0.65rem; }

  /* Project visuals — constrain width */
  .project-visual {
    min-height: 180px;
    display: flex; justify-content: center;
  }
  .fake-terminal,
  .triage-display,
  .trading-display,
  .chat-mockup { max-width: 100%; }
  .triage-level { padding: 0.4rem 0.6rem; }
  .triage-label { font-size: 0.6rem; }
  .triage-score { font-size: 0.85rem; }
  .triage-output { font-size: 0.6rem; }
  .chat-bubble { font-size: 0.75rem; padding: 0.6rem 0.8rem; }

  /* Skills */
  #scene-capabilities { padding: var(--space-xl) var(--space-md); }
  .capabilities-title { font-size: clamp(2rem, 10vw, 4rem); }
  .skills-constellation { gap: var(--space-md); }
  .skill-cluster { min-width: 110px; }
  .skill-node { font-size: 0.7rem; padding: 0.4rem 0.8rem; }

  /* Contact */
  #scene-contact { padding: var(--space-xl) var(--space-md); min-height: 60vh; }
  .contact-title { font-size: clamp(2rem, 9vw, 4rem); max-width: none; }
  .contact-email { font-size: clamp(0.75rem, 3vw, 1.2rem); word-break: break-all; }
  .contact-links { flex-direction: column; gap: var(--space-sm); }
  .contact-link { font-size: 0.7rem; }
  .contact-footer { flex-direction: column; gap: var(--space-sm); font-size: 0.6rem; }

  /* BenefitBridge canvas */
  #viz-benefitbridge { height: 220px; min-height: 220px; }
}

/* ============================================
   RESPONSIVE — Small Mobile (≤400px)
   ============================================ */
@media (max-width: 400px) {
  :root { --space-xl: 2.5rem; --space-2xl: 4rem; }
  .identity-name { font-size: 10.5vw; }
  .name-line { white-space: nowrap; }
  .name-line-2 { font-size: 12vw; }
  .project-title { font-size: clamp(1.5rem, 9vw, 2.5rem); }
  .stat-number { font-size: 2rem; }
  .about-stats { gap: var(--space-md); }
  .terminal-body { font-size: 0.65rem; line-height: 1.6; }
  .preloader-counter { font-size: 3rem; }
  .contact-email { font-size: 0.7rem; }
  .triage-level { gap: 0.5rem; }
  .chat-bubble { font-size: 0.7rem; }
}

/* Hide custom cursor on touch devices */
@media (hover: none) {
  #custom-cursor { display: none; }
  body { cursor: auto; }
  a, button { cursor: pointer; }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  #scene-identity,
  #scene-contact { padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom)); }
}
