/* ===================================
   DESIGN TOKENS — single source of truth.
   =================================== */
:root {
  --bg: #050608;
  --bg-elevated: #0a0c10;
  --bg-card: #0e1116;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(96, 165, 250, 0.45);
  --text: #f5f6f8;
  --text-secondary: #a8b0bd;
  --text-muted: #5c6472;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-cyan: #22d3ee;
  --accent-violet: #8b5cf6;
  --shadow-glow: 0 20px 60px -15px rgba(59, 130, 246, 0.35);
  --shadow-card: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

body.light-theme {
  --bg: #fafafa;
  --bg-elevated: #f2f3f5;
  --bg-card: #ffffff;
  --surface: rgba(15, 23, 42, 0.03);
  --surface-hover: rgba(15, 23, 42, 0.055);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(37, 99, 235, 0.45);
  --text: #0c0e12;
  --text-secondary: #4b5563;
  --text-muted: #8a93a3;
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-cyan: #0891b2;
  --accent-violet: #7c3aed;
  --shadow-glow: 0 20px 60px -15px rgba(37, 99, 235, 0.18);
  --shadow-card: 0 30px 60px -30px rgba(15, 23, 42, 0.2);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body { background: var(--bg); color: var(--text); font-feature-settings: "ss01" on, "ss02" on; }
::selection { background: var(--accent); color: #fff; }

/* ---- Scroll progress bar (Linear/Vercel signature) ---- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
  z-index: 1100;
  transition: width 0.1s linear;
}

/* ---- Per-section ambient mood — each section gets a distinct wash ---- */
.ambient { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient::before, .ambient::after { content: ''; position: absolute; border-radius: 9999px; filter: blur(90px); }

.ambient--hero::before { width: 640px; height: 640px; top: -220px; right: -160px; background: radial-gradient(circle, rgba(59,130,246,.22), transparent 70%); }
.ambient--hero::after { width: 480px; height: 480px; bottom: -180px; left: -140px; background: radial-gradient(circle, rgba(34,211,238,.14), transparent 70%); }

.ambient--about::before { width: 500px; height: 500px; top: -120px; left: 10%; background: radial-gradient(circle, rgba(139,92,246,.14), transparent 70%); }

.ambient--projects::before { width: 560px; height: 560px; top: 10%; right: -200px; background: radial-gradient(circle, rgba(59,130,246,.16), transparent 70%); }
.ambient--projects::after { width: 420px; height: 420px; bottom: 0; left: -160px; background: radial-gradient(circle, rgba(34,211,238,.1), transparent 70%); }

.ambient--skills::before { width: 500px; height: 500px; top: 0; left: 50%; transform: translateX(-50%); background: radial-gradient(circle, rgba(59,130,246,.12), transparent 70%); }

.ambient--contact::before { width: 600px; height: 600px; bottom: -220px; right: 10%; background: radial-gradient(circle, rgba(139,92,246,.16), transparent 70%); }

/* ---- Fine grid, extremely subtle (Linear-style precision, not decoration) ---- */
.grid-field {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 0%, black 20%, transparent 80%);
}
body.light-theme .grid-field { opacity: 0.5; }

.noise-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.025; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Glass surface ---- */
.glass { background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.glass:hover { background: var(--surface-hover); }

/* ---- Gradient text ---- */
.text-gradient { background: linear-gradient(135deg, var(--accent-2), var(--accent-cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- Section eyebrow numerals ---- */
.eyebrow-num { font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--accent); letter-spacing: 0.02em; }

/* ---- Magnetic buttons ---- */
.magnetic { --mx: 0px; --my: 0px; transform: translate(var(--mx), var(--my)); transition: transform 0.25s var(--ease); will-change: transform; }

/* ---- 3D tilt ---- */
.tilt-card { --tilt-x: 0deg; --tilt-y: 0deg; transform: perspective(1000px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)); transition: transform 0.4s var(--ease); will-change: transform; }
.tilt-card.is-tilting { transition: none; }

/* ---- Cursor glow ---- */
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 9999px; background: radial-gradient(circle, rgba(59,130,246,.13), transparent 70%);
  pointer-events: none; z-index: 1; will-change: transform;
}
@media (max-width: 1023px) { .cursor-glow { display: none; } }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.active { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
.reveal-group.active > * { transition-delay: calc(var(--stagger, 1) * 80ms); }

/* ---- Word-split hero headline reveal ---- */
.split-word { display: inline-block; opacity: 0; transform: translateY(120%) rotate(4deg); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.split-ready .split-word { opacity: 1; transform: translateY(0) rotate(0deg); }
@media (prefers-reduced-motion: reduce) { .split-word { opacity: 1; transform: none; } }

/* ---- Focus visibility ---- */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 4px; }

/* ---- Browser-chrome frame for project screenshots (Shopify/Stripe product-shot language) ---- */
.device-frame { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-card); box-shadow: var(--shadow-card); }
.device-frame__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.device-frame__dot { width: 9px; height: 9px; border-radius: 9999px; }

/* ---- Skill chips (no progress bars — proficiency shown via label + glow intensity) ---- */
.skill-chip {
  --level-glow: 0.15;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 0 0 rgba(59,130,246,0);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.skill-chip:hover, .skill-chip:focus-within {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 0 40px calc(var(--level-glow) * 1px * 200) rgba(59,130,246, var(--level-glow));
}

/* ---- Stat strip ---- */
.stat-value { font-variant-numeric: tabular-nums; }

/* ---- Mobile nav open state (enhanced) ---- */
body.menu-open { overflow: hidden; }

.site-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(120%);           /* Slightly more dramatic entrance */
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), 
              opacity 0.35s ease;
  z-index: 1001;
  will-change: transform;
  box-shadow: -10px 0 30px -10px rgba(0, 0, 0, 0.6); /* deeper shadow on slide */
}

.site-nav.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) !important;
}

#mobile-nav-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  background: rgba(0, 0, 0, 0.7);        /* darker, sexier overlay */
  z-index: 998;
  backdrop-filter: blur(8px);
}

#mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .site-nav,
  .site-nav.active {
    opacity: 1;
    pointer-events: auto;
    transform: none !important;
    box-shadow: none;
  }
  #mobile-nav-overlay {
    display: none;
  }
}

/* Extra polish for the hamburger */
#mobile-menu.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
#mobile-menu.active span:nth-child(2) { opacity: 0; }
#mobile-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }