/* =========================================================
   Gurshaan Bhullar · Portfolio v2 — "Magma"
   Palette from matplotlib's magma colormap. See BUILD-PLAN.md (v2).
   ========================================================= */

:root {
  /* Colour */
  --bg: #0D0716;          /* near-black, purple tint */
  --surface: #1A0F2B;     /* the few raised surfaces */
  --surface-2: #241638;
  --line: #2E1F45;        /* hairlines */
  --line-2: #47336A;      /* stronger borders */
  --text: #F6EEF8;        /* ~17:1 on bg */
  --muted: #B7A6C6;       /* ~8.7:1 on bg */
  --deep: #3B0F70;
  --purple: #9B3DBA;      /* data / decorative only */
  --purple-hi: #C26BE0;   /* lighter purple for small accents */
  --pink: #F0417A;        /* primary accent, ~5.4:1 on bg */
  --pink-hi: #FF6B97;
  --orange: #FF8C42;
  --yellow: #FCD34D;      /* sparingly */

  --magma: linear-gradient(90deg, #3B0F70 0%, #9B3DBA 25%, #F0417A 55%, #FF8C42 80%, #FCD34D 100%);
  --magma-hot: linear-gradient(90deg, #F0417A, #FF8C42);

  /* Type */
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --wrap: 1240px;
  --gutter: clamp(20px, 5vw, 56px);
  --header-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t: .25s;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: transparent;        /* lets the fixed node network show through */
  color: var(--text);
  font: 400 1.0625rem/1.7 var(--body);   /* 17px */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* Film grain: decorative, very faint, never blocks clicks */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--pink-hi); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color var(--t); }
a:hover { color: var(--orange); }
strong { font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }
::selection { background: rgba(240, 65, 122, .35); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--pink); color: var(--bg); font-weight: 600;
  padding: 10px 16px; border-radius: 8px; text-decoration: none;
  transition: top .2s;
}
.skip:focus { top: 12px; color: var(--bg); }

.mono, .mono-label { font-family: var(--mono); }
.mono-label {
  font-size: .8125rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin: 0 0 10px;
}

/* ---------- Progress bar + background network ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--magma); transform-origin: 0 50%; transform: scaleX(0); }
.bg-net { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: .9; }

/* ---------- Buttons ---------- */
.btn {
  --tx: 0px; --ty: 0px; --s: 1;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 14px 24px;
  font: 600 1rem/1 var(--body);
  border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transform: translate(var(--tx), var(--ty)) scale(var(--s));
  transition: transform .3s var(--ease-out), background-color var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
}
.btn:hover, .btn:focus-visible { --s: 1.04; }
.btn:active { --s: .98; }
.btn-primary { background: var(--pink); color: var(--bg); }
.btn-primary:hover, .btn-primary:focus-visible {
  color: var(--bg);
  background: var(--magma-hot);
  box-shadow: 0 12px 40px -10px rgba(240, 65, 122, .75), 0 0 0 1px rgba(255, 140, 66, .35);
}
.btn-outline {
  color: var(--text);
  border-color: var(--line-2);
  background: transparent;
}
.btn-outline:hover, .btn-outline:focus-visible {
  color: var(--text);
  border-color: transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--magma-hot) border-box;
  box-shadow: 0 10px 34px -12px rgba(240, 65, 122, .6);
}
.btn-ghost { color: var(--text); background: transparent; padding-inline: 14px; }
.btn-ghost::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 12px; height: 1px;
  background: var(--magma-hot); transform: scaleX(.35); transform-origin: left; transition: transform .3s var(--ease-out);
}
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--text); }
.btn-ghost:hover::after, .btn-ghost:focus-visible::after { transform: scaleX(1); }
.btn-sm { min-height: 42px; padding: 10px 18px; font-size: .9375rem; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s, transform .4s var(--ease-out);
}
.site-header.is-scrolled {
  background: rgba(13, 7, 22, .78);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
html:not(.js) .site-header { background: rgba(13, 7, 22, .92); border-bottom-color: var(--line); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; border-radius: 10px; }
.brand:hover { color: var(--text); }
.brand-mark { flex: none; overflow: visible; }
.brand-word { font: 700 1.1875rem/1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.brand-last { color: var(--muted); transition: color var(--t); }
.brand:hover .brand-last, .brand:focus-visible .brand-last { color: var(--text); }

.nav-list { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-list a:not(.btn) {
  position: relative; display: inline-block; padding: 10px 14px;
  color: var(--muted); text-decoration: none; font-size: 1rem; font-weight: 500;
  transition: color var(--t);
}
.nav-list a:not(.btn)::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px; border-radius: 2px;
  background: var(--magma-hot);
  transform: scaleX(0); transform-origin: right;
  transition: transform .3s var(--ease-out);
}
.nav-list a:not(.btn):hover, .nav-list a:not(.btn):focus-visible, .nav-list a.is-active { color: var(--text); }
.nav-list a:not(.btn):hover::after, .nav-list a:not(.btn):focus-visible::after, .nav-list a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-resume { margin-left: 10px; }
.nav-toggle { display: none; }

/* ---------- Scenes ---------- */
.scene { position: relative; }
.section {
  padding: clamp(110px, 16vh, 200px) 0;
  scroll-margin-top: 0;
}
@media (min-width: 1024px) and (min-height: 700px) {
  .scene { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
}
.scene > .wrap { width: 100%; }
.section-title {
  font-size: clamp(3rem, 9vw, 7.5rem);
  font-weight: 800; letter-spacing: -.045em; line-height: .95;
  margin-bottom: clamp(16px, 2vw, 28px);
}
.lead {
  font: 500 clamp(1.375rem, 2.6vw, 2rem)/1.3 var(--display);
  letter-spacing: -.015em; color: var(--muted);
  max-width: 32ch; margin-bottom: clamp(48px, 7vw, 96px);
}
.sub-title { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: clamp(80px, 10vw, 140px) 0 28px; }

/* split text (built by JS) */
.split .sw { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .12em .08em 0; margin: 0 -.12em -.08em 0; }
.split .sc { display: inline-block; will-change: transform; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + clamp(32px, 6vh, 72px)) 0 clamp(72px, 10vh, 120px);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  width: 100%;
}
.eyebrow {
  display: inline-block;
  font: 500 .9375rem/1.4 var(--body); color: var(--muted);
  margin-bottom: 26px;
}
.eyebrow::before {
  content: ""; display: inline-block; vertical-align: middle; margin: -2px 12px 0 0;
  width: 8px; height: 8px; border-radius: 50%; background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(252, 211, 77, .14), 0 0 14px rgba(252, 211, 77, .6);
}
.hero-name {
  font-size: clamp(3.25rem, 8.6vw, 8rem); font-weight: 800; line-height: .9; letter-spacing: -.055em;
  margin-bottom: 30px;
}
.hero-name .word { display: block; overflow: hidden; padding: .02em 0 .1em; margin-bottom: -.1em; }
.hero-name .w {
  display: inline-block;
  padding-right: .12em; margin-right: -.12em;
  background: linear-gradient(90deg, #F6EEF8 0%, #D58BEB 18%, #F0417A 40%, #FF8C42 60%, #FCD34D 75%, #F0417A 88%, #F6EEF8 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: magmaShift 14s linear infinite;
}
.hero-name .word:nth-child(2) .w { animation-delay: -4s; }
@keyframes magmaShift { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }

.hero-headline {
  font: 600 clamp(1.5rem, 2.8vw, 2.25rem)/1.2 var(--display);
  letter-spacing: -.02em; margin-bottom: 16px;
}
.hero-sub { color: var(--muted); max-width: 46ch; font-size: 1.125rem; margin-bottom: 34px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hero-email { margin: 28px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.hero-email .mono-label { margin: 0; }
.hero-email a { font-weight: 500; font-size: 1.0625rem; color: var(--text); text-decoration-color: var(--pink); word-break: break-all; }
.hero-email a:hover { color: var(--pink-hi); }

/* Hero copy is hidden only for the instant before the entrance animation starts */
.preload .hero-in, .preload .hero-name .w { opacity: 0; }


/* K-Means stage */
.demo { margin: 0; }
.demo-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 72svh;
  margin-inline: auto;
  border-radius: 28px;
  background:
    radial-gradient(60% 60% at 50% 50%, rgba(155, 61, 186, .16), transparent 70%),
    radial-gradient(40% 40% at 70% 70%, rgba(255, 140, 66, .08), transparent 70%);
  cursor: crosshair;
  touch-action: manipulation;
}
.demo-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: inherit; transition: opacity .6s var(--ease); }
.demo-stage canvas.is-fading { opacity: 0; }
.demo-hud {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); margin: 0;
  font-size: .8125rem; letter-spacing: .02em; color: var(--muted); white-space: nowrap;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(13, 7, 22, .7); border: 1px solid var(--line);
  pointer-events: none; z-index: 2;
}
.demo-noscript { position: absolute; inset: auto 16px 16px; margin: 0; color: var(--muted); }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.k-toggle { display: inline-flex; padding: 4px; border: 1px solid var(--line-2); border-radius: 999px; }
.k-btn {
  min-height: 34px; padding: 6px 14px; border: 0; border-radius: 999px; cursor: pointer;
  font: 500 .9375rem/1 var(--mono); color: var(--muted); background: transparent;
  transition: color var(--t), background-color var(--t);
}
.k-btn:hover, .k-btn:focus-visible { color: var(--text); }
.k-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.demo-caption { margin: 14px auto 0; color: var(--muted); font-size: .9375rem; max-width: 52ch; text-align: center; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 120px); align-items: start; }
.prose { max-width: 62ch; }
.prose p { font-size: 1.1875rem; line-height: 1.75; }
.currently { display: flex; gap: 14px; align-items: baseline; margin-top: 32px; color: var(--text); }
.pulse {
  flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); transform: translateY(-2px);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(252, 211, 77, .5); } 80%, 100% { box-shadow: 0 0 0 12px rgba(252, 211, 77, 0); } }

.facts { margin: 0; display: grid; gap: 28px; padding-top: 8px; }
.fact dt { font: 500 .8125rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.fact dd { margin: 0; font: 600 1.25rem/1.35 var(--display); letter-spacing: -.01em; }
.fact dd .muted { font: 400 1rem var(--body); }

.stats {
  list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
  margin-top: clamp(80px, 10vw, 140px);
  padding-top: 40px; border-top: 1px solid var(--line);
}
.stat-num {
  display: block;
  font: 800 clamp(4rem, 9vw, 7.5rem)/.9 var(--display); letter-spacing: -.05em;
  background: linear-gradient(100deg, #D58BEB 0%, #F0417A 45%, #FF8C42 80%, #FCD34D 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 14px; font-variant-numeric: tabular-nums;
}
.stat-label { display: block; font-size: 1.0625rem; font-weight: 500; }

.edu { list-style: none; max-width: 980px; }
.edu-item { padding: 28px 0; border-top: 1px solid var(--line); }
.edu-item:last-child { border-bottom: 1px solid var(--line); }
.edu-item p { margin-bottom: 0; }
.edu-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 6px; }
.edu-head h4 { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 700; letter-spacing: -.015em; }
.meta { margin: 0; color: var(--muted); font-size: 1rem; font-weight: 500; }

.courses-toggle {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 8px 0; border: 0; background: none; cursor: pointer;
  font: 600 1rem/1.2 var(--body); color: var(--pink-hi);
}
.courses-toggle:hover, .courses-toggle:focus-visible { color: var(--orange); }
.courses-toggle-icon { position: relative; width: 12px; height: 12px; }
.courses-toggle-icon::before, .courses-toggle-icon::after {
  content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .3s var(--ease-out);
}
.courses-toggle-icon::after { transform: rotate(90deg); }
.courses-toggle[aria-expanded="true"] .courses-toggle-icon::after { transform: rotate(0deg); }
.courses { margin-top: 16px; }
.courses.is-collapsed { display: none; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.chips li {
  padding: 7px 14px; border-radius: 999px; font-size: .9375rem; line-height: 1.35;
  border: 1px solid var(--line-2); color: var(--text);
  transition: transform var(--t) var(--ease-out), border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.chips li:hover {
  transform: translateY(-3px);
  border-color: var(--pink);
  background: rgba(240, 65, 122, .08);
  box-shadow: 0 10px 26px -12px rgba(240, 65, 122, .7);
}

/* ---------- Projects: expanding rows ---------- */
.prows { border-top: 1px solid var(--line); }
.prow {
  --mx: 50%; --my: 50%;
  position: relative;
  border-bottom: 1px solid var(--line);
  border-radius: 24px;
  transition: transform .35s var(--ease-out), box-shadow .35s, border-color .35s, background-color .35s;
}
.prow::before {
  /* mouse-following spotlight */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(240, 65, 122, .13), transparent 60%);
  opacity: 0; transition: opacity .35s;
}
.prow:hover, .prow:focus-within {
  transform: scale(1.02);
  border-color: transparent;
  background: rgba(26, 15, 43, .55);
  box-shadow: 0 0 0 1px rgba(240, 65, 122, .35), 0 30px 80px -40px rgba(240, 65, 122, .55);
}
.prow:hover::before, .prow:focus-within::before { opacity: 1; }
.prow-h { margin: 0; font: inherit; letter-spacing: normal; }
.prow-head {
  position: relative; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title icon" "meta icon";
  align-items: center; gap: 10px 24px;
  padding: clamp(28px, 4vw, 44px) clamp(16px, 2.4vw, 32px);
  background: none; border: 0; color: var(--text); text-align: left; cursor: pointer;
  border-radius: 24px;
}
.prow-title {
  grid-area: title;
  font: 800 clamp(2rem, 5.4vw, 4.5rem)/1 var(--display); letter-spacing: -.04em;
  transition: color var(--t);
}
.prow-head:hover .prow-title, .prow-head:focus-visible .prow-title {
  background: var(--magma-hot); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.prow-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 1rem; font-weight: 500; }
.prow-stack { font-family: var(--mono); font-size: .9375rem; color: var(--orange); }
.prow-icon {
  grid-area: icon; position: relative; width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--line-2); transition: transform .4s var(--ease-out), border-color var(--t), background-color var(--t);
}
.prow-icon::before, .prow-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px; margin: -1px 0 0 -9px; border-radius: 2px; background: var(--text);
}
.prow-icon::after { transform: rotate(90deg); }
.prow-head:hover .prow-icon, .prow-head:focus-visible .prow-icon { border-color: var(--pink); background: rgba(240, 65, 122, .1); }
.prow-head[aria-expanded="true"] .prow-icon { transform: rotate(45deg); border-color: var(--pink); }

.prow-panel { overflow: hidden; }
.prow-inner {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px); align-items: start;
  padding: 0 clamp(16px, 2.4vw, 32px) clamp(32px, 4vw, 48px);
}
/* Media frame: rounded, hairline border, soft magma glow; tilts in 3D on hover (script.js) */
.tilt { perspective: 1000px; }
.project-media {
  --rx: 0deg; --ry: 0deg; --ts: 1;
  --sx: 0px; --sy: 24px; --gx: 0px; --gy: 0px; --glx: 50%; --gly: 50%; --go: 0;
  position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(240, 65, 122, .28);
  background: radial-gradient(70% 70% at 30% 40%, rgba(155, 61, 186, .35), transparent 70%), radial-gradient(60% 60% at 75% 70%, rgba(255, 140, 66, .25), transparent 70%), var(--surface);
  transform: rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--ts));
  box-shadow:
    var(--sx) var(--sy) 60px -22px rgba(0, 0, 0, .85),
    var(--gx) var(--gy) 70px -18px rgba(240, 65, 122, .38),
    0 0 90px -30px rgba(155, 61, 186, .55),
    0 30px 80px -50px rgba(255, 140, 66, .45);
  will-change: transform;
  isolation: isolate;
}
.project-media > .media-poster,
.project-media > .media-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.project-media > .media-video { opacity: 0; transition: opacity .5s var(--ease); background: transparent; }
.project-media.is-playing > .media-video { opacity: 1; }
.project-media.is-pixel img, .project-media.is-pixel video { image-rendering: pixelated; }
.media-glare {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(circle at var(--glx) var(--gly), rgba(255, 255, 255, .22), rgba(255, 255, 255, .06) 30%, transparent 60%);
  opacity: var(--go);
}
.project-media.is-empty::after {
  content: attr(data-label);
  position: absolute; left: 20px; bottom: 18px; right: 20px; z-index: 2;
  font: 700 1.5rem/1.1 var(--display); letter-spacing: -.02em; color: var(--text);
}
.project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px; font-size: .875rem; font-weight: 500;
  color: var(--text); border: 1px solid var(--line-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.badge-live { border-color: rgba(252, 211, 77, .4); }
.stack { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 18px; font: 500 .875rem/1.4 var(--mono); color: var(--orange); }
.stack li + li::before { content: "/"; margin-right: 14px; color: var(--line-2); }
.bullets { list-style: none; display: grid; gap: 12px; max-width: 64ch; }
.bullets li { position: relative; padding-left: 22px; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--pink)); }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* ---------- Experience timeline ---------- */
.tl-wrap { position: relative; max-width: 980px; margin-top: clamp(48px, 6vw, 88px); }
.tl-line { position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-fill { position: absolute; inset: 0; background: linear-gradient(var(--pink), var(--orange), var(--yellow)); border-radius: 2px; transform-origin: top; }
.timeline { list-style: none; }
.tl-item { position: relative; padding: 0 0 clamp(56px, 7vw, 88px) clamp(48px, 6vw, 72px); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--dot); border: 3px solid var(--dot);
  box-shadow: 0 0 0 6px var(--bg), 0 0 22px 2px var(--dot);
  transition: background-color .4s, box-shadow .4s, transform .4s var(--ease-out);
}
/* Unlit state only applies while the scroll animation is active */
.tl-anim .tl-item:not(.is-lit)::before { background: var(--bg); border-color: var(--line-2); box-shadow: 0 0 0 6px var(--bg); transform: scale(.85); }
.tl-item .bullets li::before { background: var(--dot); }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 24px; margin-bottom: 16px; }
.tl-head h3 { font-size: clamp(1.5rem, 2.6vw, 2.125rem); font-weight: 700; letter-spacing: -.025em; }
.tl-org { font-weight: 500; color: var(--muted); }
.tl-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; align-items: start; }
.tl-body:has(.tl-thumb[hidden]) { grid-template-columns: 1fr; }
.tl-thumb { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; transition: border-color var(--t), transform .3s var(--ease-out), box-shadow var(--t); }
.tl-thumb:hover, .tl-thumb:focus-visible { border-color: var(--pink); transform: translateY(-3px) scale(1.02); box-shadow: 0 20px 50px -24px rgba(240, 65, 122, .6); }
.tl-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.tl-thumb-label { display: block; padding: 8px 12px; font: 500 .8125rem/1.3 var(--mono); color: var(--muted); }

/* ---------- Skills ---------- */
.marquee {
  margin: clamp(24px, 4vw, 48px) 0 clamp(64px, 8vw, 110px);
  display: grid; gap: 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-row { overflow: hidden; }
.marquee-track { display: flex; width: max-content; gap: 0; animation: marquee 38s linear infinite; }
.marquee-reverse .marquee-track { animation-direction: reverse; animation-duration: 44s; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font: 700 clamp(1.75rem, 4.4vw, 3.5rem)/1.2 var(--display); letter-spacing: -.03em;
  padding: 0 clamp(18px, 2.5vw, 36px); white-space: nowrap; color: var(--muted);
  display: inline-flex; align-items: center; gap: clamp(18px, 2.5vw, 36px);
  transition: color var(--t);
}
.marquee-track span::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); opacity: .7; }
.marquee-reverse .marquee-track span::after { background: var(--orange); }
.marquee-track span:hover { color: var(--text); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: clamp(40px, 5vw, 64px) clamp(32px, 5vw, 80px); }
.skill-group h3 {
  display: flex; align-items: center; gap: 12px;
  font: 600 1.25rem/1.3 var(--display); letter-spacing: -.01em; margin-bottom: 16px;
}
.skill-group h3::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(48px, 7vw, 120px); align-items: start; }
.contact-lede { font: 600 1.25rem/1.3 var(--display); margin-bottom: 20px; }
.open-to { list-style: none; }
.open-to li {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
  font: 600 clamp(1.125rem, 1.8vw, 1.375rem)/1.3 var(--display); letter-spacing: -.01em;
}
.open-to li:first-child { border-top: 1px solid var(--line); }
.open-to li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.contact-email { font: 700 clamp(1.5rem, 2.5vw, 2.25rem)/1.15 var(--display); letter-spacing: -.03em; margin-bottom: 24px; overflow-wrap: break-word; }
.contact-email a { color: var(--text); text-decoration: none; background: linear-gradient(var(--pink), var(--pink)) 0 100% / 100% 2px no-repeat; transition: background-size .35s var(--ease-out), color var(--t); }
.contact-email a:hover, .contact-email a:focus-visible { color: var(--text); background-image: var(--magma-hot); background-size: 100% 4px; }
.contact-list { margin: 40px 0 0; display: grid; gap: 24px; padding-top: 32px; border-top: 1px solid var(--line); }
.contact-list dt { font: 500 .8125rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; font-size: 1.0625rem; }
.resume-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
#copyEmail.is-copied { border-color: var(--yellow); color: var(--yellow); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0 52px; color: var(--muted); font-size: 1rem; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; align-items: center; }
.footer-inner p { margin: 0; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--pink-hi); text-decoration: underline; }
.footer-note { grid-column: 1 / -1; font-size: .9375rem; }

/* ---------- Intro overlay (created by JS) ---------- */
/* Blank cover for the instant before the intro script runs (auto-removed after 1.2s max) */
html.intro-pending::after { content: ""; position: fixed; inset: 0; z-index: 149; background: var(--bg); }
.intro {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: var(--bg);
  font: 500 clamp(1.125rem, 2.4vw, 1.5rem)/1.6 var(--mono); color: var(--text);
  transition: opacity .35s var(--ease), visibility .35s;
}
.intro.is-done { opacity: 0; visibility: hidden; }
.intro-box { min-width: min(90vw, 22ch); }
.intro-prompt { color: var(--pink); }
.intro-ok { color: var(--yellow); }
.intro-caret { display: inline-block; width: .55em; height: 1.1em; margin-left: 2px; vertical-align: -.18em; background: var(--pink); animation: blink .8s steps(2) infinite; }
.intro-skip { position: absolute; right: 24px; bottom: 20px; font: 400 .8125rem/1 var(--mono); color: var(--muted); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Custom cursor (created by JS, fine pointers only) ---------- */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor input, html.has-cursor textarea, html.has-cursor [contenteditable] { cursor: text !important; }
.cursor-dot, .cursor-ring {
  position: fixed; left: 0; top: 0; z-index: 140; pointer-events: none;
  border-radius: 50%; will-change: transform;
}
.cursor-dot { width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; background: var(--text); transition: opacity .2s, transform 0s; }
.cursor-ring {
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  display: grid; place-items: center;
  font: 600 .75rem/1 var(--body); color: var(--bg);
}
.cursor-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(246, 238, 248, .55);
  transition: transform .3s var(--ease-out), border-radius .3s var(--ease-out), border-color .25s, background-color .25s, box-shadow .25s, width .3s, height .3s;
}
.cursor-label { position: relative; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s var(--ease-out); white-space: nowrap; }
.cursor-hidden .cursor-dot, .cursor-hidden .cursor-ring { opacity: 0; }

/* link / button */
.cursor-ring.is-link::before { transform: scale(1.45); border-color: var(--pink); background: rgba(240, 65, 122, .08); box-shadow: 0 0 12px rgba(240, 65, 122, .4); }
.cursor-dot.is-hidden { opacity: 0; }
/* project rows */
.cursor-ring.is-view::before { transform: scale(2.3); border-color: transparent; background: var(--pink); box-shadow: 0 0 16px rgba(240, 65, 122, .4); }
.cursor-ring.is-view .cursor-label { opacity: 1; transform: scale(1); }
/* K-Means demo: crosshair */
.cursor-ring.is-add::before { transform: scale(.0); }
.cursor-ring.is-add::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  background:
    linear-gradient(var(--text), var(--text)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--text), var(--text)) center / 100% 1.5px no-repeat;
}
.cursor-ring.is-add .cursor-label {
  opacity: 1; transform: none; position: absolute; left: calc(100% + 2px); top: calc(100% - 4px);
  font: 500 .75rem/1 var(--mono); color: var(--text);
  background: rgba(13, 7, 22, .85); border: 1px solid var(--line-2); padding: 5px 8px; border-radius: 6px;
}
/* body text: thin bar */
.cursor-ring.is-text::before { transform: scaleX(.08) scaleY(.8); border-color: var(--text); background: var(--text); border-radius: 2px; }
/* click pulse */
.cursor-ring.is-down::before { animation: cursorPulse .45s var(--ease-out); }
@keyframes cursorPulse { 0% { box-shadow: 0 0 0 0 rgba(240, 65, 122, .6); } 100% { box-shadow: 0 0 0 14px rgba(240, 65, 122, 0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .demo { width: 100%; max-width: 620px; margin-inline: auto; }
  .demo-stage { max-height: none; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .prow-inner { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --header-h: 66px; }
  .brand-last { display: none; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
    font: 600 .9375rem/1 var(--body); color: var(--text);
    background: rgba(26, 15, 43, .8); border: 1px solid var(--line-2);
  }
  .nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
    display: block; width: 16px; height: 2px; border-radius: 2px; background: currentColor; position: relative;
    transition: transform .25s var(--ease), background-color .2s;
  }
  .nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-bars::before { top: -5px; }
  .nav-toggle-bars::after { top: 5px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }

  .js .nav-list {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px var(--gutter) 24px;
    background: var(--bg); border-bottom: 1px solid var(--line-2);
    box-shadow: 0 24px 40px -12px rgba(0, 0, 0, .7);
    display: none;
  }
  .js .nav-list.is-open { display: flex; }
  .js .nav-list a:not(.btn) { padding: 14px 4px; font: 700 1.5rem/1.2 var(--display); color: var(--text); }
  .js .nav-list a:not(.btn)::after { left: 4px; right: auto; width: 40px; bottom: 8px; }
  .js .nav-resume { margin: 14px 0 0; }
  .js .nav-resume .btn { width: 100%; min-height: 50px; }
  html:not(.js) .nav-list { overflow-x: auto; max-width: 70vw; }
  html:not(.js) .site-header { background: var(--bg); }

  .stats { grid-template-columns: 1fr; gap: 36px; }
  .tl-body { grid-template-columns: 1fr; }
  .tl-thumb { max-width: 320px; }
  .footer-inner { grid-template-columns: 1fr; }
  .prow:hover, .prow:focus-within { transform: none; }
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .prose p { font-size: 1.0625rem; }
  .hero { min-height: auto; }
  .hero .actions .btn { flex: 1 1 100%; }
  .hero .actions .btn-ghost { flex: 0 0 auto; margin-inline: auto; }
  .demo-controls { flex-direction: column; align-items: stretch; }
  .demo-controls > * { width: 100%; }
  .k-toggle .k-btn { flex: 1; }
  .demo-hud { font-size: .75rem; }
  .prow-icon { width: 44px; height: 44px; }
  .contact-main .actions .btn { flex: 1 1 100%; }
  .tl-item { padding-left: 44px; }
}

/* ---------- Reduced motion: everything static ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .hero-name .w { animation: none; background-position: 30% 50%; }
  .marquee-track { animation: none; }
  .prow:hover, .prow:focus-within, .chips li:hover, .btn:hover { transform: none; }
  .bg-net { display: none; }
}

/* ---------- Print ---------- */
@media print {
  body::after, .site-header, .demo, .bg-net, .progress, .marquee { display: none !important; }
  html, body { background: #fff; color: #000; }
}
