/* ════════════════════════════════════════════════════════════
   Rajveer Singh Pall — Homepage
   Reference-faithful dark "engineering command center" aesthetic
   Self-contained (detail pages use style.css)
   ════════════════════════════════════════════════════════════ */

:root {
  --bg:        #07080b;
  --bg-2:      #0b0d12;
  --panel:     rgba(255,255,255,0.02);
  --line:      rgba(255,255,255,0.08);
  --line-2:    rgba(255,255,255,0.14);
  --text:      #ece7db;
  --text-2:    rgba(236,231,219,0.62);
  --text-3:    rgba(236,231,219,0.38);
  --gold:      #c9a25a;
  --gold-br:   #e3c07e;
  --accent:    #c9a25a;
  --disp:  'Space Grotesk', system-ui, sans-serif;
  --sans:  'DM Sans', system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;
  /* ── motion tokens (single source of truth, mirrored in style.css) ── */
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);   /* signature out-expo */
  --ease-io:   cubic-bezier(0.76, 0, 0.24, 1);  /* symmetric in-out (work cards) */
  --dur-fast:  0.25s;
  --dur-med:   0.45s;
  --dur-slow:  0.9s;
  /* ── type scale (fluid) + spacing rhythm ── */
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.12rem, 1.02rem + 0.5vw, 1.34rem);
  --step-2: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4: clamp(2.4rem, 1.7rem + 3.5vw, 4.4rem);
  --space-section: clamp(4.5rem, 4rem + 6vw, 8.5rem);
  --maxw:  1500px;
}

/* ── cross-document view transitions (Chromium; others fall back to JS fade) ── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .28s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .34s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .01s; }
}
.vt-fallback body { transition: opacity .19s ease; }
.vt-fallback.vt-leaving body { opacity: 0; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
html.js { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(201,162,90,0.28); color: #fff; }
img { display: block; max-width: 100%; }

/* film grain */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 320;
  pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Constellation canvas + vignette ── */
#field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 45%, transparent 52%, rgba(7,8,11,0.6) 100%),
    linear-gradient(rgba(7,8,11,0.30), transparent 16%, transparent 84%, rgba(7,8,11,0.55));
}

/* ── Scroll progress ── */
.scroll-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-br)); z-index: 300; }

/* ── HUD clock ── */
.hud-clock { position: fixed; bottom: 1.5rem; left: 1.75rem; z-index: 200; display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; color: var(--text-3); pointer-events: none; }
.hud-row { display: flex; align-items: center; gap: 6px; }
.hud-row svg { opacity: 0.45; }
.hud-label { color: rgba(236,231,219,0.3); }
.hud-time  { color: rgba(236,231,219,0.6); font-variant-numeric: tabular-nums; }

/* ── Bottom-right HUD ── */
.brh { position: fixed; bottom: 1.5rem; right: 1.75rem; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; color: var(--text-3); pointer-events: none; user-select: none; }
.brh-session, .brh-explore, .brh-xy { display: flex; align-items: center; }
.brh-label { color: rgba(236,231,219,0.2); }
.brh-value { color: rgba(236,231,219,0.5); font-variant-numeric: tabular-nums; }
.brh-scroll-btn { pointer-events: all; background: none; border: none; cursor: pointer; padding: 0; opacity: 0; transform: scale(0.88); transition: opacity .4s, transform .4s; margin-top: 0.15rem; }
.brh-scroll-btn.visible { opacity: 1; transform: scale(1); }
.brh-ring { width: 32px; height: 32px; transform: rotate(-90deg); }
.brh-ring-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 2; }
.brh-ring-fill  { fill: none; stroke-width: 2; stroke-linecap: round; stroke: var(--gold); stroke-dasharray: 94.25; stroke-dashoffset: 94.25; transition: stroke-dashoffset .15s linear; }

/* ── Navigation ── */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 250; display: flex; align-items: center; justify-content: space-between; padding: 1.15rem clamp(1.25rem, 4vw, 3rem); transition: background .4s, backdrop-filter .4s, border-color .4s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(7,8,11,0.72); backdrop-filter: blur(14px); border-bottom-color: var(--line); }
.nav-brand { font-family: var(--disp); font-size: 0.92rem; font-weight: 500; letter-spacing: 0.01em; color: var(--text-2); }
.nav-brand b { color: var(--text); font-weight: 600; }
.nav-links { display: flex; gap: clamp(1rem, 2.5vw, 2.2rem); }
.nav-links a { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--text-3); transition: color .2s; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -5px; height: 1px; width: 0; background: var(--gold); transition: width .25s var(--ease); }
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

/* ── Mobile nav: hamburger toggle + full-screen overlay (≤768 only) ── */
.nav-toggle { display: none; }
.nav-overlay { display: none; }
.nav-overlay-links { display: flex; flex-direction: column; gap: 0.15rem; width: min(86vw, 440px); }
.nav-overlay-links a {
  display: flex; align-items: baseline; gap: 1.1rem;
  font-family: var(--disp); font-weight: 600; font-size: clamp(1.9rem, 8.5vw, 2.8rem);
  letter-spacing: -0.02em; line-height: 1.2; color: var(--text-2);
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
  opacity: 0; transform: translateY(14px);
  transition: color .25s var(--ease), opacity .5s var(--ease), transform .5s var(--ease);
}
.nav-overlay.is-open .nav-overlay-links a { opacity: 1; transform: none; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(1) { transition-delay: .06s; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(2) { transition-delay: .11s; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(3) { transition-delay: .16s; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(4) { transition-delay: .21s; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(5) { transition-delay: .26s; }
.nav-overlay.is-open .nav-overlay-links a:nth-child(6) { transition-delay: .31s; }
.nav-overlay-links a:hover, .nav-overlay-links a:focus-visible { color: var(--gold-br); }
.nav-overlay-idx { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--gold); letter-spacing: 0.06em; }
html.nav-locked, html.nav-locked body { overflow: hidden; }
@media (max-width: 768px) {
  .nav-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; margin-right: -0.5rem; padding: 0;
    background: none; border: 0; cursor: pointer; position: relative; z-index: 2;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle span { display: block; width: 24px; height: 2px; margin: 0 auto; background: var(--text); border-radius: 2px; transition: transform .35s var(--ease), opacity .2s var(--ease); }
  .nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-active span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-overlay {
    display: flex; position: fixed; inset: 0; z-index: 240;
    align-items: center; justify-content: center;
    background: rgba(7,8,11,0.975); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    opacity: 0; visibility: hidden;
    padding: calc(env(safe-area-inset-top) + 4.5rem) clamp(2rem, 8vw, 4rem) calc(env(safe-area-inset-bottom) + 2rem);
    transition: opacity .42s var(--ease), visibility .42s var(--ease);
  }
  .nav-overlay.is-open { opacity: 1; visibility: visible; }
}

/* ── Safe-area insets for notched phones ── */
@supports (padding: env(safe-area-inset-top)) {
  .nav { padding-top: max(1.15rem, env(safe-area-inset-top)); }
  .hero-scroll { bottom: max(2rem, calc(env(safe-area-inset-bottom) + 0.4rem)); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-overlay, .nav-overlay-links a { transition-duration: 0.001ms; }
  .nav-overlay-links a { opacity: 1; transform: none; }
}

/* ════════════ HERO — exact port of the reference hero ════════════ */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 60px 8.5vw 4rem; gap: 4vw; }

/* top hairline — scaleX 0→1 on entrance */
.hero-hairline { position: absolute; top: 80px; left: 8.5vw; right: 8.5vw; height: 1px; background: rgba(255,255,255,0.08); transform-origin: left; transform: scaleX(0); z-index: 5; }
html.hero-go .hero-hairline { animation: h-hairline 1.2s var(--ease-io) forwards; }
@keyframes h-hairline { to { transform: scaleX(1); } }

/* kicker: 28px dash + mono line */
.hero-kicker-mask { overflow: hidden; margin-bottom: 2rem; }
.hero-kicker { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; color: #e8e0d0; opacity: 0; transform: translateY(30px); }
.kicker-dash { width: 28px; height: 1px; background: #e8e0d0; flex-shrink: 0; }
html.hero-go .hero-kicker { animation: h-rise 0.7s var(--ease-io) 0.3s forwards; }

/* name: three curtain-rise serif lines (reference technique, one mask per word) */
.hero-name { margin: 0 0 3rem; }
.hero-name-mask { display: block; overflow: hidden; margin-bottom: -0.05em; }
.hero-name-mask-last { margin-bottom: 0; }
.hero-name-line { display: block; font-family: 'Playfair Display', Georgia, serif; font-weight: 800; font-size: clamp(3.4rem, 9vw, 7.6rem); line-height: 1; letter-spacing: 0.02em; color: #fafaf8; transform: translateY(105%); }
html.hero-go .hero-name-line { animation: h-curtain 0.9s var(--ease-io) 0.5s forwards; }
html.hero-go .hero-name-line-2 { animation-delay: 0.65s; }
html.hero-go .hero-name-line-3 { animation-delay: 0.8s; }
@keyframes h-curtain { to { transform: translateY(0); } }

/* meta row: mono label over sans value */
.hero-meta-row { display: flex; flex-direction: row; gap: 3rem; margin-bottom: 2.5rem; opacity: 0; transform: translateY(20px); }
html.hero-go .hero-meta-row { animation: h-rise 0.7s ease 1s forwards; }
.hero-meta-label { display: block; font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.15em; color: rgba(255,255,255,0.45); text-transform: uppercase; margin-bottom: 0.4rem; }
.hero-meta-value { display: block; font-family: var(--sans); font-size: 0.9rem; color: #e8e0d0; line-height: 1.5; }

/* actions + status */
.hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.65rem; opacity: 0; transform: translateY(20px); }
html.hero-go .hero-actions { animation: h-rise 0.7s ease 1.2s forwards; }
.hero-status { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; margin-top: 0.65rem; font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.2em; color: rgba(255,255,255,0.55); text-transform: uppercase; opacity: 0; transform: translateY(20px); }
html.hero-go .hero-status { animation: h-rise 0.7s ease 1.2s forwards; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: h-pulse 2s infinite; flex-shrink: 0; }
@keyframes h-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes h-rise { to { opacity: 1; transform: translateY(0); } }

/* entrance end-states without motion */
@media (prefers-reduced-motion: reduce) {
  .hero-hairline { transform: scaleX(1); }
  .hero-kicker, .hero-meta-row, .hero-actions, .hero-status, .hero-photo-col { opacity: 1 !important; transform: none !important; }
  .hero-name-line { transform: none; }
}
.btn { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; padding: 0.7rem 1.3rem; border-radius: 3px; border: 1px solid var(--line-2); transition: background .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease); will-change: transform; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--gold); color: #0a0a0a; border-color: var(--gold); font-weight: 500; }
.btn-primary:hover { background: var(--gold-br); border-color: var(--gold-br); box-shadow: 0 10px 26px -12px rgba(201,162,90,0.6); }
.btn-line:hover { border-color: var(--gold); color: var(--gold-br); }
.hero-socials { display: flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.74rem; color: var(--text-2); }
.hero-socials a { transition: color .2s; }
.hero-socials a:hover { color: var(--gold-br); }
.hero-socials .dot { color: var(--text-3); }
.todo-link { opacity: 0.5; }
.todo-inline { color: var(--text-3); font-style: italic; }
.hero-scroll { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 3; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.hero-scroll::after { content: ""; width: 1px; height: 36px; background: linear-gradient(var(--gold), transparent); animation: scrolldn 2s ease-in-out infinite; }
@keyframes scrolldn { 0%,100% { transform: scaleY(0.4); opacity: 0.4; transform-origin: top; } 50% { transform: scaleY(1); opacity: 1; transform-origin: top; } }

/* ════════════ SECTIONS (shared) ════════════ */
.section { position: relative; z-index: 5; max-width: var(--maxw); margin: 0 auto; padding: var(--space-section) clamp(1.5rem, 6vw, 5rem); }
.section-head { margin-bottom: 3.8rem; max-width: 880px; }
.section-kicker { display: inline-block; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 1rem; }
.section-title { font-family: var(--disp); font-weight: 600; font-size: var(--step-4); line-height: 1.06; letter-spacing: -0.025em; color: var(--text); margin-bottom: 1.1rem; }
.section-lede { font-size: var(--step-1); line-height: 1.6; color: var(--text-2); max-width: 640px; }

/* ── About ── */
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.about-col { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.about-h { font-family: var(--disp); font-weight: 500; font-size: 1.22rem; color: var(--text); margin-bottom: 0.8rem; }
.about-col p { font-size: 1.04rem; line-height: 1.72; color: var(--text-2); }
.about-col strong { color: var(--text); font-weight: 600; }

/* ── Credentials band (academic credibility, directly below the hero) ── */
.creds { position: relative; z-index: 5; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.5rem, 6vw, 5rem); }
.creds-row { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cred-cell { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.5rem 1.5rem; border-left: 1px solid var(--line); }
.cred-cell:first-child { border-left: 0; }
.cred-value { font-family: var(--disp); font-weight: 600; font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.1; letter-spacing: -0.01em; color: var(--text); display: flex; align-items: baseline; gap: 0.3rem; }
.cred-cell--accent .cred-value { color: var(--gold-br); }
.cred-trend { color: var(--gold); font-size: 0.78em; }
.cred-label { font-family: var(--mono); font-size: 0.64rem; line-height: 1.45; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 900px) {
  .creds-row { grid-template-columns: 1fr 1fr; }
  .cred-cell { padding: 1.1rem 1.1rem; border-top: 1px solid var(--line); }
  .cred-cell:nth-child(odd) { border-left: 0; }
  .cred-cell:nth-child(-n+2) { border-top: 0; }
  .cred-cell--accent { grid-column: 1 / -1; } /* SGPA gets its own full-width row */
}
@media (max-width: 460px) {
  .creds-row { grid-template-columns: 1fr; }
  .cred-cell { border-left: 0; border-top: 1px solid var(--line); padding: 1rem 0.15rem; }
  .cred-cell:first-child { border-top: 0; }
  .cred-cell--accent { grid-column: auto; }
}

/* ── Education: SGPA progression (the full climb; band shows only Sem V) ── */
.edu-progression { margin-top: 3.2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.edu-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; margin-bottom: 1.6rem; }
.edu-kicker { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.edu-note { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.03em; color: var(--text-3); }
.sgpa-track { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.8rem; align-items: end; max-width: 560px; }
.sgpa-pt { display: grid; grid-template-rows: 92px auto auto; align-items: end; gap: 0.5rem; text-align: center; }
.sgpa-bar { display: block; width: 8px; height: var(--v, 60%); justify-self: center; align-self: end; background: linear-gradient(var(--gold-br), var(--gold)); border-radius: 4px; opacity: 0.5; }
.sgpa-pt.is-current .sgpa-bar { opacity: 1; box-shadow: 0 0 16px rgba(201,162,90,0.5); }
.sgpa-val { font-family: var(--disp); font-weight: 600; font-size: 0.95rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sgpa-pt.is-current .sgpa-val { color: var(--gold-br); }
.sgpa-sem { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
@media (max-width: 460px) {
  .sgpa-pt { grid-template-rows: 64px auto auto; gap: 0.35rem; }
  .sgpa-sem { font-size: 0.5rem; letter-spacing: 0.04em; }
}

/* ── Credentials ── */
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; max-width: var(--maxw); }
.cred-block .section-kicker { margin-bottom: 1.6rem; }
.cred-list { list-style: none; display: flex; flex-direction: column; gap: 1.3rem; }
.cred-list li { display: flex; gap: 0.9rem; font-size: 1.02rem; line-height: 1.6; color: var(--text-2); }
.cred-list strong { color: var(--text); font-weight: 600; }
.cred-mark { color: var(--gold); flex-shrink: 0; font-size: 0.8rem; padding-top: 0.2rem; }
.cred-sub { font-size: 0.85rem; color: var(--text-3); }

/* ── Impact node graph ── */
.impact-graph-wrap {
  position: relative;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  aspect-ratio: 1300 / 640;
}
.impact-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
/* SVG text styles — applied via class from JS */
.ig-hub-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.ig-val {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  fill: rgba(236, 231, 219, 0.72);
  letter-spacing: 0.04em;
  pointer-events: none;
}
/* Data dot */
.ig-dot {
  cursor: crosshair;
  r: 7.5px;
  fill-opacity: 0.88;
  transition: r 0.28s ease, fill-opacity 0.28s ease;
}
.ig-dot:hover { r: 13px; fill-opacity: 1; }
/* Central HUD — persistent panel in constellation centre */
.impact-central-hud {
  position: absolute;
  left: 50%; top: 51.5%;
  transform: translate(-50%, -50%);
  width: min(34%, 420px);
  text-align: center;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.hud-value {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 2.3rem;
  font-weight: 800;
  font-style: italic;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #fafaf8;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.hud-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  line-height: 1.4;
  margin-top: 3px;
}
.hud-sub span { transition: color 0.3s ease; }
.hud-desc {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.74rem;
  line-height: 1.48;
  color: rgba(255,255,255,0.46);
  max-width: 340px;
  margin-top: 6px;
  text-align: center;
  transition: color 0.3s ease;
}
.hud-spoke-line {
  stroke-width: 1px;
  transition: stroke-opacity 0.3s ease, stroke-width 0.3s ease;
}
@keyframes centerNodePulse {
  0%, 100% { r: 5px; fill-opacity: 0.6; }
  50%       { r: 8px; fill-opacity: 1;   }
}
.hud-center-node-circle {
  transition: fill 0.3s ease;
  animation: centerNodePulse 2.5s ease-in-out infinite;
}

/* ── Impact: mobile metric cards (shown ≤768; desktop keeps the SVG graph) ── */
.impact-mobile { display: none; }
.impact-mobile-lede { font-size: 0.95rem; line-height: 1.6; color: var(--text-2); margin-bottom: 1.8rem; max-width: 640px; }
.im-cat { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c, var(--gold)); margin: 1.9rem 0 0.6rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.im-cat:first-child { margin-top: 0; }
.im-card { display: flex; gap: 1rem; align-items: baseline; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.im-val { flex: 0 0 5rem; font-family: var(--disp); font-weight: 700; font-size: 1.12rem; line-height: 1.15; color: var(--c, var(--gold)); font-variant-numeric: tabular-nums; }
.im-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.im-desc { font-size: 0.85rem; line-height: 1.5; color: var(--text-2); }
.im-src { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }

/* ── Work cards ── */
.work-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.6rem; align-items: start; }
.work-grid > .card { margin-bottom: 0; grid-column: span 2; }
/* second row: two half-width cards (reference "rows fill" pattern) */
.work-grid > .card-half { grid-column: span 3; order: 2; }
@media (max-width: 1023px) { .work-grid { grid-template-columns: 1fr 1fr; } .work-grid > .card, .work-grid > .card-half { grid-column: span 1; } .work-grid > .card-half { order: 0; } }
@media (max-width: 767px)  { .work-grid { grid-template-columns: 1fr; } }
.card { position: relative; border: 1px solid var(--line); border-radius: 8px; padding: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 1.6rem; background: linear-gradient(180deg, rgba(255,255,255,0.012), transparent); overflow: hidden; transition: border-color var(--dur-med) var(--ease-io), transform var(--dur-med) var(--ease-io), box-shadow var(--dur-med) var(--ease-io); will-change: transform; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-6px) scale(1.025); box-shadow: 0 22px 50px -22px rgba(0,0,0,0.72), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.card-body { display: flex; flex-direction: column; gap: 1.4rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0; }
.card-title { font-family: var(--disp); font-weight: 600; font-size: clamp(1.3rem, 2.5vw, 1.7rem); color: var(--text); margin-bottom: 0.3rem; }
.card-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 0.7rem; vertical-align: middle; box-shadow: 0 0 12px var(--accent); }
.card-meta { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.03em; color: var(--text-3); }
.card-badge { flex-shrink: 0; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 100px; padding: 0.32rem 0.7rem; white-space: nowrap; }
.card-grid { display: flex; flex-direction: column; gap: 0.85rem; margin-bottom: 0; }
.card-grid > div { display: flex; gap: 0.9rem; align-items: flex-start; }
.card-grid h4 { flex-shrink: 0; width: 84px; margin-top: 0.2rem; margin-bottom: 0; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.card-grid p { flex: 1; min-width: 0; font-size: 0.88rem; line-height: 1.6; color: var(--text-2); text-align: justify; }
.card-links { display: flex; flex-wrap: wrap; gap: 1.4rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.card-links a { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--text-2); transition: color .2s; }
.card-links a:hover { color: var(--accent); }
.card-arrow { margin-top: 1.2rem; text-align: right; font-family: var(--mono); font-size: 0.85rem; color: rgba(255,255,255,0.32); transition: color .25s var(--ease); }
.card:hover .card-arrow { color: var(--accent); }
/* Reference card behavior: collapse + bottom fade-mask, expand on hover/focus — pointer devices only (touch shows full) */
@media (hover: hover) and (pointer: fine) {
  .card-body { max-height: 15rem; overflow: hidden; transition: max-height .55s var(--ease-io); -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); mask-image: linear-gradient(to bottom, #000 70%, transparent 100%); }
  .card:hover .card-body, .card:focus-within .card-body { max-height: 50rem; -webkit-mask-image: none; mask-image: none; }
}

/* ── Publications ── */
.pub { display: flex; align-items: stretch; justify-content: space-between; gap: 2rem; padding: 1.8rem 0; border-top: 1px solid var(--line); transition: padding-left .3s var(--ease); }
.research .pub:last-child { border-bottom: 1px solid var(--line); }
.pub:hover { padding-left: 0.8rem; }
.pub-main { flex: 1; }
.pub-title { font-family: var(--disp); font-weight: 500; font-size: clamp(1.05rem, 2vw, 1.32rem); line-height: 1.25; color: var(--text); margin-bottom: 0.6rem; transition: color .3s var(--ease); }
.pub:hover .pub-title { color: var(--accent); }
.pub-sub { font-size: 0.9rem; line-height: 1.6; color: var(--text-2); max-width: 640px; margin-bottom: 0.9rem; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pub-tags span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; color: var(--text-3); border: 1px solid var(--line); border-radius: 100px; padding: 0.2rem 0.6rem; }
.pub-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 0.4rem; text-align: right; min-width: 180px; }
.pub-venue { font-family: var(--sans); font-size: 0.82rem; font-weight: 600; color: var(--text); }
.pub-status { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.pub-arrow { font-family: var(--mono); color: var(--text-3); font-size: 1rem; transition: transform .25s var(--ease), color .2s; }
.pub:hover .pub-arrow { transform: translate(4px,-4px); color: var(--accent); }

/* ── Stack ── */

.stack-layout {
  display: flex;
  gap: 4rem;
  width: 100%;
}
.stack-layout-left {
  flex: 0 0 35%;
}
.stack-layout-left .section-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.stack-fable-title {
  font-family: var(--disp);
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  line-height: 1.05;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}
.stack-fable-lede {
  font-family: var(--sans);
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.6;
}

.stack-layout-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stack-fable-group {
  display: flex;
  padding: 2.2rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 2rem;
}
.stack-fable-group:first-child {
  border-top: none;
  padding-top: 0;
}

.stack-fable-label {
  flex: 0 0 130px;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  padding-top: 0.5rem;
}

.stack-fable-items {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  flex: 1;
}

.stack-fable-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  width: 90px;
}

.stack-fable-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stack-fable-icon img,
.stack-fable-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stack-fable-text {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: #d4d4d4;
  font-weight: 500;
  line-height: 1.2;
}


/* ── Contact ── */
.contact { text-align: center; }
.contact-inner { max-width: 640px; margin: 0 auto; }
.contact .section-kicker { margin-bottom: 1.2rem; }
.contact-title { font-family: var(--disp); font-weight: 600; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.025em; color: var(--text); margin-bottom: 1rem; }
.contact-tag { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--text-2); margin-bottom: 2.2rem; }
.contact-tag em { color: var(--gold-br); font-style: normal; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 1.6rem; margin-bottom: 2rem; }
.contact-links a { font-family: var(--disp); font-size: 1.05rem; color: var(--text); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.contact-links a:hover { color: var(--gold-br); border-color: var(--gold); }
.contact-loc { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--text-3); }

/* ── Footer ── */
.site-footer { position: relative; z-index: 5; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; padding: 2.5rem 1.5rem; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--text-3); text-align: center; }
.footer-mid { color: rgba(236,231,219,0.18); }

/* ════════════ Reveal animation ════════════ */
.reveal { opacity: 0; transform: translateY(24px); }
html.no-js .reveal { opacity: 1; transform: none; }
/* hero entrance without JS (hero-go never gets added) */
html.no-js .hero-hairline { transform: scaleX(1); }
html.no-js .hero-kicker, html.no-js .hero-meta-row, html.no-js .hero-actions,
html.no-js .hero-status, html.no-js .hero-photo-col { opacity: 1; transform: none; }
html.no-js .hero-name-line { transform: none; }

/* ════════════ Responsive ════════════ */
@media (max-width: 900px) {

  /* Hero → single column (reference order: text first, portrait after) */
  .hero { grid-template-columns: 1fr; gap: 3rem; padding: 110px 5.5vw 4rem; }
  .hero-hairline { top: 60px; left: 5.5vw; right: 5.5vw; }
  .hero-name-line { font-size: clamp(2.6rem, 11vw, 7.6rem); }
  .hero-name { margin-bottom: 2rem; }
  .hero-photo-col { width: 100%; margin: 0; }
  .hero-photo-bar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .hero-left { padding-top: 0; }

  .about-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .cred-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
    .stack-layout {
    flex-direction: column;
    gap: 3rem;
  }
  .stack-layout-left {
    flex: none;
  }
  .stack-fable-group {
    flex-direction: column;
    gap: 1.5rem;
  }
  .stack-fable-label {
    flex: none;
  }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-visual { opacity: 0.45; }       /* cheap native canvas — keep on mobile, just quieter */
  .hero-lineart { opacity: 0.5; }
  .hud-clock { display: none; }         /* fixed HUD collides with content on small screens */
  .brh { display: none; }
  .pub { flex-direction: column; gap: 1rem; }
  .pub-side { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; gap: 0.6rem 1rem; }
  /* touch/small screens: list only — WebGL drag+raycast hover doesn't translate well */
  .research-scroll-track { display: none; }
  .traj-scroll { display: none; }
  .research-view-toggle { display: none; }
  .pub-list.is-hidden { display: flex; flex-direction: column; }
  /* impact — native stacked metric cards (no context-free horizontal scroll) */
  .impact-graph-wrap { display: none; }
  .impact-mobile { display: block; }
  /* readability + ≥44px tap targets on phones */
  .card-grid p { text-align: left; }
  .card-grid h4 { font-size: 0.7rem; }
  .pub-tags span { font-size: 0.68rem; }
  .btn, .hero-resume-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .contact-links a { padding: 0.4rem 0; }
}
@media (max-width: 460px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero-actions { gap: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero-lineart .la-draw { stroke-dashoffset: 0 !important; }
  .hero-lineart .la-dot { opacity: 1 !important; }
}

/* -- RESEARCH VIEW TOGGLE -- */
.research-view-toggle { display: flex; align-items: center; gap: 0.7rem; margin-top: 1.2rem; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.05em; }
.rv-btn { background: none; border: none; font: inherit; cursor: pointer; color: var(--text-3); padding: 0.3rem 0.2rem; transition: color .3s; }
.rv-btn.is-active, .rv-btn:hover { color: var(--gold); }
.rv-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* -- RESEARCH SPIRAL -- */
.research-scroll-track {
  height: 300vh;
  position: relative;
  width: 100%;
  transition: opacity .4s;
}
.research-scroll-track.is-hidden { display: none; }
.research-sticky-container {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: transparent;
}
.gl-research {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: default;
}
.gl-research canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.research-hud {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  z-index: 2;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.work-label__index {
  font-family: var(--disp);
  font-size: 1rem;
  color: var(--gold);
  font-weight: 600;
}
.work-label__line {
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--text-3);
  margin: 0 12px;
  vertical-align: middle;
}
.work-label__title {
  font-family: var(--disp);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
}
.work-label__click {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

.pub-list.is-hidden { display: none; }

.hero-left { display: flex; flex-direction: column; justify-content: center; z-index: 3; will-change: transform; }

/* Hero right column and portrait — reference: 74% width, 3:4, grayscale, gradient */
.hero-photo-col { position: relative; width: 74%; margin: 0 2vw 0 auto; z-index: 3; opacity: 0; transform: translateY(60px); }
html.hero-go .hero-photo-col { animation: h-rise 1.1s var(--ease-io) 0.4s forwards; }
.hero-photo-card { will-change: transform; border-radius: 4px; }
.hero-photo-frame { position: relative; border-radius: 4px; overflow: hidden; aspect-ratio: 3 / 4; }
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  filter: grayscale(20%) contrast(1.05);
  display: block;
}
.hero-photo-grad { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,10,10,0.85) 0%, rgba(10,10,10,0.2) 40%, transparent 70%); }
.hero-photo-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hero-photo-bar span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}



.hero-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.65);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
  flex-shrink: 0;
}
.hero-icon-btn:hover {
  border-color: rgba(255,255,255,0.4);
  color: #fafaf8;
  background: rgba(255,255,255,0.06);
}
.hero-resume-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.hero-resume-btn:hover {
  border-color: rgba(255,255,255,0.4);
  color: #fafaf8;
  background: rgba(255,255,255,0.06);
}

/* Trajectory section uses bare .section styling (like .research); its spiral
   reuses the .research-scroll-track / .gl-research / .pub-list classes above. */

/* ── Trajectory — vertical Gantt (js/trajectory.js builds it inline) ── */
/* Full-bleed so the sticky-pinned chart spans the viewport like the reference. */
.trajectory { padding: 0; max-width: none; }
.traj-scroll { position: relative; }

/* ── Intro loader (masks first paint while Spline streams) ── */
.loader { position: fixed; inset: 0; z-index: 9999; background: #07080b; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1rem; transition: opacity .6s ease, visibility .6s ease; }
.loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-mark { font-family: Georgia, serif; font-size: 3rem; font-weight: 700; color: var(--gold, #c9a25a); letter-spacing: 0.04em; text-shadow: 0 0 26px rgba(201,162,90,0.45); }
.loader-bar { width: 140px; height: 2px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.loader-bar > span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--gold,#c9a25a), transparent); animation: loader-sweep 1.05s ease-in-out infinite; }
@keyframes loader-sweep { 0% { transform: translateX(-160%); } 100% { transform: translateX(420%); } }
.loader-cap { font-family: var(--mono, monospace); font-size: 0.6rem; letter-spacing: 0.32em; color: rgba(255,255,255,0.32); }
html.no-js .loader { display: none; }

/* ── Gold & Glory — highlights marquee (right → left) ── */
.glory { margin: 2.6rem 0 0.4rem; }
.glory-head { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: #f5ca40; text-align: center; margin-bottom: 1.6rem; }
.glory-viewport { position: relative; width: 100vw; margin-left: calc(-50vw + 50%); overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); }
.glory-track { display: flex; align-items: flex-start; width: max-content; animation: glory-marquee 48s linear infinite; will-change: transform; }
.glory-viewport:hover .glory-track { animation-play-state: paused; }
@keyframes glory-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.glory-item { display: flex; flex-direction: column; gap: 0.3rem; width: max-content; flex-shrink: 0; }
.glory-row { display: flex; align-items: center; gap: 0.65rem; }
.glory-ico { width: 24px; height: 24px; flex-shrink: 0; color: #f5ca40; opacity: 0.9; }
.glory-title { font-family: var(--sans); font-size: 1rem; font-weight: 700; line-height: 1.2; color: #f5ca40; letter-spacing: 0.03em; text-shadow: 0 0 12px rgba(245,202,64,0.25); white-space: nowrap; }
.glory-time { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.1em; color: rgba(245,202,64,0.45); text-transform: uppercase; padding-left: 39px; }
.glory-sub { font-family: var(--sans); font-size: 0.72rem; line-height: 1.45; color: rgba(255,255,255,0.4); letter-spacing: 0.02em; padding-left: 39px; white-space: nowrap; }
.glory-sep { font-size: 1.6rem; color: rgba(245,202,64,0.3); margin: 0 2.2rem; align-self: flex-start; flex-shrink: 0; line-height: 1; user-select: none; }
@media (prefers-reduced-motion: reduce) { .glory-track { animation: none; } .glory-viewport { overflow-x: auto; } }

/* ── Global motion safety: respect reduced-motion across the whole page ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
