/* --- Tokens --- */
:root {
  --bg: #0b0b0f;
  --bg-2: #11121a;
  --surface: #14161f;
  --surface-2: #181b27;
  --surface-3: #1c1f2d;
  --border: #23263433;
  --border-strong: #2a2e40;
  --border-bright: #3a3f55;
  --text: #e7e9f3;
  --text-dim: #a4a7b8;
  --text-mute: #6e7185;
  --accent: #8b7cff;
  --accent-2: #7ee7c4;
  --accent-warm: #ffb37c;
  --accent-red: #ff7a8a;
  --grad: linear-gradient(135deg, #8b7cff 0%, #7ee7c4 60%, #ffb37c 100%);
  --grad-cool: linear-gradient(135deg, #8b7cff 0%, #7ee7c4 100%);
  --grad-warm: linear-gradient(135deg, #ffb37c 0%, #ff7a8a 100%);
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  --radius: 14px;
  --radius-lg: 20px;
  --mx: 50vw;
  --my: 50vh;
}

* { box-sizing: border-box; }
::selection { background: rgba(139, 124, 255, 0.35); color: var(--text); }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

/* --- Custom cursor --- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor-dot {
  width: 7px; height: 7px;
  background: #f5f5ff;
  --x: -100px; --y: -100px;
  transform: translate3d(var(--x), var(--y), 0) translate(-50%, -50%);
}
.cursor-ring {
  width: 38px; height: 38px;
  border: 1.5px solid #f5f5ff;
  --x: -100px; --y: -100px;
  --scale: 1;
  transform: translate3d(var(--x), var(--y), 0) translate(-50%, -50%) scale(var(--scale));
  transition: transform .18s ease-out, border-color .18s ease-out, opacity .18s;
  opacity: 0.85;
}
.cursor-ring.hover { --scale: 1.6; opacity: 0.4; }
.cursor-ring.press { --scale: 0.8; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* --- Scroll progress --- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--grad);
  z-index: 100;
  transition: width .1s ease-out;
  box-shadow: 0 0 12px rgba(139, 124, 255, 0.6);
}

/* --- Cursor glow --- */
.cursor-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    480px circle at var(--mx) var(--my),
    rgba(139, 124, 255, 0.07),
    transparent 60%
  );
  transition: background-position .1s ease-out;
}

/* --- WebGL fluid background --- */
.fluid-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -3;
  opacity: 0.55;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* --- Backgrounds --- */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  pointer-events: none;
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(45rem 32rem at 80% -10%, rgba(139,124,255,0.18), transparent 60%),
    radial-gradient(38rem 26rem at -10% 30%, rgba(126,231,196,0.12), transparent 60%),
    radial-gradient(42rem 30rem at 50% 110%, rgba(255,179,124,0.10), transparent 60%);
  pointer-events: none;
}

/* --- Nav --- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(11, 11, 15, 0.55);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 16px;
}
.brand-mark {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: 'JetBrains Mono', monospace;
}
.brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: 8px; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all .15s ease;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--surface);
}
.link-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  opacity: 0.7;
}
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease;
}
.nav-cta:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.cta-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 2s infinite;
}
@media (max-width: 760px) {
  .nav { padding: 14px 18px; }
  .nav-links { display: none; }
}

/* --- Layout --- */
main { max-width: 1180px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 1; }
@media (max-width: 720px) { main { padding: 0 18px; } }

.section { padding: 110px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: none; padding-top: 0; }

.section-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 44px;
}
.section-head.center { justify-content: center; }
.section-num {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(30px, 4.5vw, 48px);
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.05;
}

/* --- Hero --- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 90px 0 60px;
  min-height: 78vh;
  position: relative;
}
.hero-particles {
  position: absolute;
  inset: -40px -30px;
  width: calc(100% + 60px);
  height: calc(100% + 80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}
.hero > *:not(.hero-particles) {
  position: relative;
  z-index: 2;
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 0; min-height: 0; }
}

.hero-text .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 7px 14px;
  border-radius: 999px;
  margin-bottom: 26px;
  font-family: 'JetBrains Mono', monospace;
}
.kicker .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  margin: 0 0 22px;
  font-size: clamp(38px, 6.5vw, 72px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.serif {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
}
.grad-1, .grad-2 {
  background: var(--grad-cool);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.grad-2 { background: var(--grad-warm); -webkit-background-clip: text; background-clip: text; color: transparent; }

.lede {
  font-size: clamp(15px, 1.5vw, 17px);
  color: var(--text-dim);
  margin: 0 0 30px;
  max-width: 56ch;
}
.lede strong { color: var(--text); font-weight: 600; }

.cta-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: all .2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.btn.small { padding: 9px 16px; font-size: 13px; }
.btn.primary {
  background: var(--text);
  color: var(--bg);
}
.btn.primary:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgba(139, 124, 255, 0.7);
}
.btn.primary svg { transition: transform .2s ease; }
.btn.primary:hover svg { transform: translateX(3px); }
.btn.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.hero-meta {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px dashed var(--border-strong);
}
.meta-item {
  display: flex; flex-direction: column;
}
.meta-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.meta-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}
.meta-sep {
  width: 1px; height: 24px;
  background: var(--border-strong);
}

/* Robot */
.hero-robot {
  position: relative;
  justify-self: center;
  width: 100%;
}
.robot-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  max-width: 460px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(80% 60% at 50% 50%, rgba(139,124,255,0.10), transparent 60%),
    linear-gradient(145deg, rgba(20,22,31,0.9), rgba(11,11,15,0.6));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  isolation: isolate;
}
.robot-stage::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(139,124,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,124,255,0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 75%);
  pointer-events: none;
}
.robot-stage::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(60% 80% at 50% 100%, rgba(139,124,255,0.25), transparent 60%);
  pointer-events: none;
}
#robot-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.robot-hint {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  background: rgba(11,11,15,0.7);
  border: 1px solid var(--border-strong);
  padding: 5px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.robot-tag {
  position: absolute;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  background: rgba(11,11,15,0.7);
  border: 1px solid var(--border-strong);
  padding: 4px 9px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  backdrop-filter: blur(8px);
}
.tag-top { top: 14px; left: 14px; }
.tag-bot { top: 14px; right: 14px; color: var(--accent-2); }

/* --- Marquee --- */
.marquee-wrap {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  margin: 40px 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, transparent, rgba(20,22,31,0.4), transparent);
  position: relative;
}
.marquee-wrap::before,
.marquee-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  z-index: 2;
  pointer-events: none;
}
.marquee-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.marquee-wrap::after  { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }

.marquee {
  display: flex;
  overflow: hidden;
}
.marquee-track {
  display: flex; gap: 32px;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: var(--text-dim);
}
.marquee-track span:nth-child(even) { color: var(--accent); opacity: 0.5; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; gap: 30px; } }

.about-portrait {
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  margin-bottom: 18px;
  position: relative;
}
.about-portrait::before {
  content: ''; position: absolute; inset: -3px;
  background: var(--grad);
  z-index: -1;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.5;
}
.about-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 70% center;
}

.about-copy p {
  font-size: 16.5px;
  color: var(--text-dim);
  margin: 0 0 16px;
  max-width: 62ch;
}
.about-copy strong { color: var(--text); font-weight: 600; }
.about-copy em { color: var(--accent-2); font-style: normal; }

.now-card {
  margin-top: 24px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.now-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--grad-cool);
}
.now-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.now-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.now-row { display: flex; gap: 14px; font-size: 14px; }
.now-row b {
  color: var(--text);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 80px;
  padding-top: 2px;
}
.now-row span { color: var(--text-dim); }

.quickfacts {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: sticky;
  top: 100px;
}
.qf-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.qf-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulse 2s infinite;
}
.quickfacts h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-family: 'JetBrains Mono', monospace;
}
.quickfacts ul { list-style: none; padding: 0; margin: 0; }
.quickfacts li {
  display: flex; justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.quickfacts li:last-child { border: none; }
.quickfacts span { color: var(--text-mute); }
.quickfacts b { color: var(--text); font-weight: 500; }

/* --- Spotlight project --- */
.spotlight {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 40px;
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  align-items: center;
}
.spotlight::before {
  content: '';
  position: absolute;
  top: -60%; right: -20%;
  width: 80%; height: 220%;
  background: radial-gradient(closest-side, rgba(139,124,255,0.18), transparent);
  pointer-events: none;
}
@media (max-width: 840px) {
  .spotlight { grid-template-columns: 1fr; padding: 28px; }
}
.spotlight-text { position: relative; z-index: 1; }
.spotlight-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--grad);
  color: var(--bg);
  font-weight: 700;
  margin-bottom: 14px;
}
.spotlight-text h3 {
  font-size: clamp(28px, 4vw, 38px);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.spotlight-sub {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 14px;
}
.spotlight-body {
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 0 0 18px;
  max-width: 50ch;
}
.spotlight-stack {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; padding: 0; margin: 0 0 22px;
}
.spotlight-stack li {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 6px;
}

.spotlight-visual { position: relative; z-index: 1; }
.terminal {
  background: #0a0a0e;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: var(--shadow-lg);
}
.term-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: #15161e;
  border-bottom: 1px solid var(--border);
}
.term-header .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.term-header .red    { background: #ff5f57; }
.term-header .yellow { background: #ffbd2e; }
.term-header .green  { background: #28c940; }
.term-title {
  margin-left: 12px;
  font-size: 11px;
  color: var(--text-mute);
}
.term-body {
  margin: 0;
  padding: 18px 22px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
}
.c-mute  { color: var(--text-mute); }
.c-accent{ color: var(--accent); }
.c-good  { color: var(--accent-2); }
.c-key   { color: var(--accent-warm); }
.c-prop  { color: var(--accent); }
.c-str   { color: var(--accent-2); }
.cursor-blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- Projects grid --- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.project {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.project::before {
  content: ''; position: absolute; inset: 0;
  background: var(--grad);
  opacity: 0;
  transition: opacity .25s ease;
  z-index: -1;
  filter: blur(40px);
}
.project:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.project:hover::before { opacity: 0.07; }

.project header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.project h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tag {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  background: rgba(139, 124, 255, 0.1);
  padding: 3px 9px;
  border-radius: 999px;
}

.project p {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 16px;
  flex: 1;
}

.stack {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0; margin: 0 0 16px;
}
.stack li {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
}

.proj-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.proj-link:hover { color: var(--accent-2); }

.ghost-card {
  background:
    repeating-linear-gradient(45deg, transparent 0, transparent 6px, rgba(139,124,255,0.03) 6px, rgba(139,124,255,0.03) 12px),
    var(--surface);
  border-style: dashed;
}

/* --- Skills --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.skill-col {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  transition: all .2s ease;
}
.skill-col:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.skill-col h4 {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}
.skill-col ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 7px;
}
.skill-col li {
  font-size: 14px;
  color: var(--text-dim);
  padding-left: 14px;
  position: relative;
}
.skill-col li::before {
  content: '▸';
  position: absolute;
  left: 0; top: 0;
  color: var(--accent);
  font-size: 10px;
  opacity: 0.6;
}

/* --- Stats --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all .2s ease;
}
.stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.stat::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.stat-num {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.stat-num span { font-size: 26px; }
.stat-label {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

/* GitHub stats embeds */
.gh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.gh-stats img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.awards {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.awards li {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 22px;
  transition: all .2s ease;
}
.awards li:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.medal {
  font-size: 26px;
  filter: drop-shadow(0 0 8px rgba(139, 124, 255, 0.4));
}
.awards b {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.awards span {
  color: var(--text-dim);
  font-size: 13px;
}

/* --- Contact --- */
.contact { text-align: center; }
.contact-lede {
  max-width: 52ch; margin: 0 auto 30px;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
}
.contact-actions {
  display: flex; gap: 12px; justify-content: center;
  margin-bottom: 44px; flex-wrap: wrap;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  max-width: 820px; margin: 0 auto;
}
.contact-grid a {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  transition: all .2s ease;
  display: block;
  text-align: left;
}
.contact-grid a:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  background: var(--surface-2);
}
.contact-grid h4 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}
.contact-grid span {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 28px 32px;
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-mute);
  max-width: 1180px;
  margin-left: auto; margin-right: auto;
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--accent); }

/* --- Text reveal (word stagger) --- */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0 0.04em;
  margin: 0 -0.04em;
}
.word-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform .85s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i, 0) * 45ms);
  will-change: transform;
}
.in .word-inner { transform: translateY(0); }

/* --- 3D project carousel --- */
.carousel3d-wrap {
  position: relative;
  width: 100%;
  height: 460px;
  perspective: 1500px;
  perspective-origin: 50% 38%;
  user-select: none;
  margin-bottom: 24px;
}
.carousel3d-stage {
  position: absolute;
  inset: 0;
  cursor: grab;
}
.carousel3d-stage.dragging { cursor: grabbing; }
.carousel3d {
  position: absolute;
  top: 40px;
  left: 50%;
  width: 280px;
  height: 360px;
  margin-left: -140px;
  transform-style: preserve-3d;
  transform: translateZ(-360px) rotateY(var(--rot, 0deg));
  transition: transform .9s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.carousel3d.dragging { transition: none; }

.c3d-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px 26px 24px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  backface-visibility: hidden;
  transform: rotateY(calc(var(--i) * 60deg)) translateZ(360px);
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease, opacity .35s ease;
  overflow: hidden;
}
.c3d-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 50% at 50% 0%, rgba(139,124,255,0.18), transparent 70%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.c3d-card.active {
  border-color: var(--accent);
  box-shadow: 0 30px 60px -25px rgba(139,124,255,0.5);
}
.c3d-card.active::before { opacity: 1; }
.c3d-card:not(.active) { opacity: 0.55; }
.c3d-card.c3d-ghost {
  background:
    repeating-linear-gradient(45deg, transparent 0, transparent 6px, rgba(139,124,255,0.04) 6px, rgba(139,124,255,0.04) 12px),
    var(--surface);
  border-style: dashed;
}

.c3d-num {
  position: absolute;
  top: 18px; right: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.c3d-tag {
  align-self: flex-start;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(139, 124, 255, 0.12);
  padding: 4px 9px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.c3d-card h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.c3d-card p {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0;
  flex: 1;
}
.c3d-stack {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.c3d-stack li {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 5px;
}
.c3d-arrow {
  position: absolute;
  bottom: 22px; right: 26px;
  color: var(--accent);
  font-size: 22px;
  font-family: 'JetBrains Mono', monospace;
  transition: transform .25s ease;
}
.c3d-card.active .c3d-arrow { transform: translateX(4px); }

.carousel3d-ctrl {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 3;
}
.c3d-nav {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.c3d-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.06);
}
.c3d-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  display: flex; gap: 4px;
  min-width: 56px;
  justify-content: center;
}
.c3d-current { color: var(--text); font-weight: 600; }
.c3d-divider { color: var(--text-mute); }
.c3d-hint {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .carousel3d-wrap { height: 440px; }
  .carousel3d {
    width: 230px;
    height: 320px;
    margin-left: -115px;
    transform: translateZ(-300px) rotateY(var(--rot, 0deg));
  }
  .c3d-card { transform: rotateY(calc(var(--i) * 60deg)) translateZ(300px); padding: 22px; }
  .c3d-card h3 { font-size: 20px; }
}

/* --- Physics drag chip --- */
.phys-chip {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 11px;
  background: rgba(20, 22, 31, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  cursor: grab;
  user-select: none;
  touch-action: none;
  will-change: transform;
  box-shadow: var(--shadow);
  transition: border-color .2s, color .2s;
}
.phys-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.phys-chip.dragging { cursor: grabbing; }
.phys-grip {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: -2px;
}
@media (max-width: 600px) {
  .phys-chip { bottom: 16px; right: 16px; }
}

/* --- Matrix canvas --- */
.matrix-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}
.matrix-canvas.on { opacity: 0.95; }
.matrix-msg {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9001;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #00ff88;
  color: #00ff88;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 10px 18px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s, transform .4s;
  letter-spacing: 0.08em;
}
.matrix-msg.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .fluid-canvas { display: none; }
  .hero-particles { display: none; }
  .phys-chip { display: none; }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* --- Magnetic buttons --- */
.magnetic {
  display: inline-block;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
}

/* --- 3D Tilt + spotlight on cards --- */
.project,
.stat,
.skill-col,
.contact-grid a,
.now-card,
.awards li,
.spotlight {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .25s cubic-bezier(.2, .7, .2, 1),
              border-color .25s ease,
              background .25s ease;
  will-change: transform;
}
.project::after,
.stat::after,
.skill-col::after,
.contact-grid a::after,
.now-card::after,
.awards li::after,
.spotlight::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    260px circle at var(--mx) var(--my),
    rgba(139, 124, 255, 0.18),
    transparent 60%
  );
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
  z-index: 0;
}
.project:hover::after,
.stat:hover::after,
.skill-col:hover::after,
.contact-grid a:hover::after,
.now-card:hover::after,
.awards li:hover::after,
.spotlight:hover::after {
  opacity: 1;
}

/* Tilted cards need their content lifted above the spotlight ::after */
.project > *,
.stat > *,
.skill-col > *,
.contact-grid a > *,
.now-card > *,
.awards li > *,
.spotlight > * {
  position: relative;
  z-index: 1;
}

/* Drop default lift on tilted cards — tilt does the movement */
.project:hover,
.stat:hover,
.skill-col:hover,
.contact-grid a:hover,
.awards li:hover {
  transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry));
}

/* --- Scramble char (preserve width slightly) --- */
.scramble { display: inline-block; min-width: 0.5ch; }

@media (hover: none), (pointer: coarse) {
  .magnetic { transform: none !important; }
  .project, .stat, .skill-col, .contact-grid a, .now-card, .awards li, .spotlight {
    transform: none;
  }
}
