/* ==========================================================================
   Saim Mehmood: portfolio styles
   Plain CSS (no Sass) so GitHub Pages and local Jekyll build it identically.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7fb;
  --bg-2: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f3f4fa;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #5b6478;
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.16);
  --accent: #5b5bf0;
  --accent-ink: #ffffff;
  --accent-2: #0891b2;
  --accent-3: #db2777;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, 0.04), 0 24px 48px -20px rgba(15, 23, 42, 0.25);
  --tile-l: 52%;
  --tile-s: 70%;
  --tint-a: 0.10;
  --grid-dot: rgba(15, 23, 42, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1160px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0c16;
  --bg-2: #0f1222;
  --surface: #12152a;
  --surface-2: #181c35;
  --ink: #eceefb;
  --ink-2: #c7cbe0;
  --muted: #9aa2bf;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #8b8cff;
  --accent-ink: #0a0c16;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -20px rgba(0, 0, 0, 0.8);
  --tile-l: 72%;
  --tile-s: 85%;
  --tint-a: 0.16;
  --grid-dot: rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.3s ease, color 0.3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600;
}
.skip-link:focus { top: 16px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* Ambient background: soft colour blobs over a dot grid */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -5%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(500px 380px at -5% 30%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 70%),
    radial-gradient(500px 400px at 100% 85%, color-mix(in srgb, var(--accent-3) 10%, transparent), transparent 70%),
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 22px 22px;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav-inner { max-width: var(--wrap); margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 20px; }
.nav-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; flex-shrink: 0; }
.nav-brand:hover { text-decoration: none; }
.nav-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font: 700 14px var(--font-display); color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.nav-links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--muted); font-size: 14px; font-weight: 500; padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.nav-links a.is-active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.theme-toggle {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--ink-2);
  transition: transform 0.2s var(--ease), border-color 0.2s ease;
}
.theme-toggle:hover { transform: rotate(-12deg); border-color: var(--line-strong); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -10px var(--accent); }
.btn-primary:hover { box-shadow: 0 14px 30px -12px var(--accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-sm { padding: 9px 14px; font-size: 14px; border-radius: 10px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 18px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
  transition: transform 0.2s var(--ease), color 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { transform: translateY(-2px); color: var(--accent); border-color: var(--line-strong); text-decoration: none; }
.text-link { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.text-link i { transition: transform 0.2s var(--ease); }
.text-link:hover i { transform: translateX(3px); }

/* ---------- Tiles ---------- */
.tile {
  --hue: 240;
  --tint: hsl(var(--hue) var(--tile-s) var(--tile-l));
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  isolation: isolate;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s ease, opacity 0.35s ease;
}
/* Cursor-following spotlight; --mx/--my are set from JS */
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), hsl(var(--hue) var(--tile-s) var(--tile-l) / var(--tint-a)), transparent 60%);
  transition: opacity 0.35s ease;
}
.tile:hover::before { opacity: 1; }
a.tile, .tile:has(.tile-open) { cursor: pointer; color: inherit; }
a.tile:hover, .tile:has(.tile-open):hover {
  text-decoration: none; transform: translateY(-4px);
  box-shadow: var(--shadow-lg); border-color: hsl(var(--hue) var(--tile-s) var(--tile-l) / 0.45);
}
.tile-arrow {
  position: absolute; top: 20px; right: 20px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 12px; color: var(--muted); background: var(--surface-2);
  transition: transform 0.3s var(--ease), color 0.3s ease, background-color 0.3s ease;
}
a.tile:hover .tile-arrow { color: var(--accent-ink); background: var(--tint); transform: rotate(-8deg) scale(1.05); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font: 500 12px/1 var(--font-mono); padding: 6px 9px; border-radius: 8px;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
}
.tags .tag-more { color: var(--muted); }

.mini-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 17px;
  color: var(--tint); background: hsl(var(--hue) var(--tile-s) var(--tile-l) / 0.14);
}
.mini-label { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.mini-value { font: 600 18px/1.3 var(--font-display); color: var(--ink); }
.mini-sub { font-size: 14px; color: var(--muted); }

.monogram {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  font: 700 16px var(--font-display); color: #fff; letter-spacing: 0;
  background: linear-gradient(135deg, hsl(var(--hue) 75% 58%), hsl(calc(var(--hue) + 40) 80% 50%));
  box-shadow: 0 8px 20px -10px hsl(var(--hue) 80% 50%);
}
.monogram-lg { width: 60px; height: 60px; font-size: 20px; border-radius: 18px; }

/* ---------- Sections ---------- */
.section { padding: 96px 0 0; }
.section-head { max-width: 680px; margin-bottom: 36px; }
.eyebrow {
  font: 500 13px var(--font-mono); color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(30px, 4.4vw, 44px); }
.lead { margin-top: 14px; color: var(--muted); font-size: 17px; }
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 48px 0 18px; }
.subhead h3 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 18px; }

.prose p + p, .prose p + ul, .prose ul + p { margin-top: 14px; }
.prose { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { list-style: disc; padding-left: 20px; }
.prose.small { font-size: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: 48px; align-items: center; }
.kicker {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--ink-2);
  box-shadow: var(--shadow);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #22c55e; opacity: 0;
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(1.8); opacity: 0; } }
.hero h1 {
  margin-top: 22px; font-size: clamp(46px, 8vw, 88px); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98;
  background: linear-gradient(120deg, var(--ink) 30%, var(--accent) 65%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.06em;
}
.hero-roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hero-roles li {
  font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line);
}
.hero-tagline { margin-top: 22px; font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 600px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 30px; }
.hero-meta { margin-top: 20px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }

.hero-visual { position: relative; aspect-ratio: 1; max-width: 400px; width: 100%; justify-self: center; display: grid; place-items: center; }
.orbit {
  position: absolute; inset: 6%; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  animation: spin 14s linear infinite;
  filter: blur(0.5px);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.orbit::after {
  content: ""; position: absolute; inset: -40px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
}
@keyframes spin { to { transform: rotate(360deg); } }
.portrait {
  width: 70%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; position: relative;
  border: 6px solid var(--surface); box-shadow: var(--shadow-lg);
  background: var(--surface-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.float-chip {
  position: absolute; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
.float-chip i { color: var(--accent); }
.chip-1 { top: 6%; left: -6%; }
.chip-2 { top: 22%; right: -8%; animation-delay: -1.5s; }
.chip-2 i { color: #4285f4; }
.chip-3 { bottom: 14%; left: -10%; animation-delay: -3s; }
.chip-3 i { color: var(--accent-3); }
.chip-4 { bottom: 2%; right: 4%; animation-delay: -4.5s; }
.chip-4 i { color: #326ce5; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 64px; }
.stat { padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.stat:nth-child(1) { --hue: 245; }
.stat:nth-child(2) { --hue: 190; }
.stat:nth-child(3) { --hue: 35; }
.stat:nth-child(4) { --hue: 330; }
.stat-value {
  font: 700 clamp(34px, 4vw, 44px)/1 var(--font-display); letter-spacing: -0.03em;
  color: var(--tint); font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 14px; color: var(--muted); line-height: 1.4; }

/* ---------- About bento ---------- */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.bento-bio { grid-column: span 2; grid-row: span 2; padding: 28px; }
.bento-bio .prose { font-size: 15.5px; }
.bento-mini { display: flex; flex-direction: column; gap: 6px; }
.bento-mini .mini-icon { margin-bottom: 10px; }
.bento-mini .mini-sub { margin-top: auto; padding-top: 6px; }
.bento-mini .mini-sub i { font-size: 11px; margin-left: 4px; }

/* ---------- Journey timeline ---------- */
.journey {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 20px 12px; margin-bottom: 22px;
}
.journey-scroll { overflow-x: auto; scrollbar-width: thin; padding-bottom: 8px; }
.journey-chart { position: relative; min-width: 760px; }
.journey-row { display: grid; grid-template-columns: 150px 1fr; align-items: start; border-top: 1px dashed var(--line); padding: 10px 0; }
.journey-row:first-child { border-top: 0; }
.journey-track-label {
  font: 500 12px var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 8px 0 0;
  position: sticky; left: 0; z-index: 3; align-self: stretch; background: var(--surface);
}
.journey-lanes { position: relative; }
.journey-lane { position: relative; height: 30px; }
.journey-lane + .journey-lane { margin-top: 6px; }
.journey-bar {
  --hue: 240;
  position: absolute; top: 0; height: 30px; min-width: 30px; border-radius: 9px; border: 0; padding: 0 10px;
  display: flex; align-items: center; overflow: hidden; cursor: pointer;
  font: 600 12px var(--font); color: #fff; white-space: nowrap; text-align: left;
  background: linear-gradient(135deg, hsl(var(--hue) 75% 58%), hsl(calc(var(--hue) + 30) 78% 50%));
  box-shadow: 0 6px 14px -8px hsl(var(--hue) 80% 45%);
  transition: transform 0.25s var(--ease), filter 0.25s ease, opacity 0.3s ease;
}
.journey-bar:hover, .journey-bar:focus-visible { transform: translateY(-2px); filter: brightness(1.08); z-index: 2; }
.journey-bar.is-dim { opacity: 0.25; }
.journey-bar.is-tight { justify-content: center; padding: 0 4px; }
.journey-bar.is-now::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 18px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45));
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.journey-axis { display: grid; grid-template-columns: 150px 1fr; border-top: 1px solid var(--line); padding-top: 8px; }
.journey-ticks { position: relative; height: 18px; }
.journey-ticks span { position: absolute; transform: translateX(-50%); font: 500 11px var(--font-mono); color: var(--muted); }
.journey-ticks span::before {
  content: ""; position: absolute; left: 50%; bottom: 100%; width: 1px; height: 6px; margin-bottom: 4px; background: var(--line-strong);
}
.journey-tip {
  position: fixed; z-index: 60; pointer-events: none; padding: 8px 12px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.35; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity 0.15s ease; max-width: 260px;
}
.journey-tip.is-visible { opacity: 1; }
.journey-tip strong { display: block; }
.journey-tip span { opacity: 0.75; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  --hue: 240;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}
.chip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--hue) var(--tile-s) var(--tile-l)); }
.chip-count { font: 500 12px var(--font-mono); color: var(--muted); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.is-active .chip-count { color: inherit; opacity: 0.7; }

/* ---------- Work tiles ---------- */
.work-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.edu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.role { display: flex; flex-direction: column; gap: 10px; }
.role::after {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, hsl(var(--hue) 75% 58%), hsl(calc(var(--hue) + 40) 80% 55%));
  opacity: 0.85;
}
.role.is-hidden { display: none; }
.role.is-flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 3px hsl(var(--hue) 80% 60% / 0.6), var(--shadow-lg); } }
.role-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.role-when { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font: 500 12px/1.5 var(--font-mono); color: var(--muted); }
.role-duration:not(:empty) { color: var(--tint); }
.role-title { font-size: 20px; }
.role-org { font-size: 14px; font-weight: 500; color: var(--muted); margin-top: -4px; }
.role-summary {
  color: var(--ink-2); font-size: 15px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.role .tags { margin-top: 4px; }
.tile-open {
  margin-top: auto; padding: 12px 0 0; align-self: flex-start; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--tint); display: inline-flex; align-items: center; gap: 6px;
}
.tile-open::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.tile-open i { transition: transform 0.25s var(--ease); }
.tile:hover .tile-open i { transform: translateX(4px); }
.empty-state { color: var(--muted); padding: 24px 0; }

/* ---------- Detail dialog ---------- */
.detail {
  width: min(680px, calc(100% - 32px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--line);
  border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.detail[open] { display: flex; flex-direction: column; animation: pop 0.35s var(--ease); }
.detail::backdrop { background: rgba(5, 8, 20, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade 0.3s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
.detail-body { overflow-y: auto; padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.detail-close {
  position: absolute; top: 16px; right: 16px; z-index: 2; width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted);
}
.detail-close:hover { color: var(--ink); border-color: var(--line-strong); }
.detail-head { --hue: 240; --tint: hsl(var(--hue) var(--tile-s) var(--tile-l)); display: flex; gap: 18px; align-items: flex-start; padding-right: 40px; }
.detail-head h2 { font-size: clamp(22px, 3.4vw, 28px); margin-top: 4px; }
.detail-when { font: 500 13px var(--font-mono); color: var(--muted); }
.detail-when .role-duration:not(:empty)::before { content: " · "; color: var(--muted); }
.detail-org { margin-top: 6px; color: var(--muted); font-weight: 500; }
.detail-org i { font-size: 11px; }
.detail-prose { font-size: 15.5px; }
.detail-prose p { padding-left: 2px; }
.detail-note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--line-strong); padding-left: 14px; }

/* ---------- Projects ---------- */
.project-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.project { padding: 0; display: flex; flex-direction: column; }
.project-art {
  height: 132px; display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, hsl(calc(var(--hue) + 40) 85% 65% / 0.9), transparent 55%),
    radial-gradient(circle at 80% 70%, hsl(var(--hue) 80% 55% / 0.95), transparent 60%),
    linear-gradient(135deg, hsl(var(--hue) 70% 40%), hsl(calc(var(--hue) + 60) 70% 45%));
}
.project-art::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 14px);
}
.project-art i { font-size: 44px; color: rgba(255, 255, 255, 0.95); z-index: 1; transition: transform 0.5s var(--ease); filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25)); }
.project:hover .project-art i { transform: scale(1.12) rotate(-6deg); }
.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-kind { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--tint); }
.project-title { font-size: 18px; line-height: 1.3; }
.project-desc { font-size: 14.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.project .tile-link { margin-top: auto; padding-top: 6px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; color: var(--tint); }
.project .tile-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.project:has(.tile-link) { cursor: pointer; }
.project:has(.tile-link):hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.repo-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.repo { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.repo h4 { font-size: 16px; display: flex; align-items: flex-start; gap: 8px; padding-right: 36px; overflow-wrap: anywhere; }
.repo h4 i { margin-top: 3px; }
.repo h4 i { color: var(--muted); font-size: 14px; }
.repo p { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.repo .repo-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: auto; font: 500 12px var(--font-mono); color: var(--muted); }
.repo-meta span { display: inline-flex; align-items: center; gap: 6px; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.repo .tile-arrow { top: 16px; right: 16px; }

/* ---------- Research ---------- */
.research-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.paper { grid-column: span 2; grid-row: span 3; --hue: 35; padding: 32px; display: flex; flex-direction: column; gap: 12px; min-height: 360px; }
.badge-award {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: hsl(35 90% 35%); background: hsl(40 95% 55% / 0.2); border: 1px solid hsl(40 95% 50% / 0.35);
}
:root[data-theme="dark"] .badge-award { color: hsl(42 95% 68%); }
.paper-title { font-size: clamp(22px, 2.8vw, 30px); max-width: 560px; margin-top: 6px; }
.paper-meta { color: var(--ink-2); font-weight: 500; }
.paper-venue { color: var(--muted); font-size: 15px; max-width: 520px; }
.paper-summary { color: var(--ink-2); font-size: 16px; max-width: 560px; margin-top: 8px; }
.paper .tags { margin-top: 4px; max-width: 560px; }
.paper-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; position: relative; z-index: 1; }
.paper-cites { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 14px; }
.paper-cites .stat-value { font-size: 52px; }
.paper-links { display: flex; flex-wrap: wrap; gap: 10px; }
.paper-art { position: absolute; right: -10px; top: 20px; width: 46%; max-width: 300px; opacity: 0.5; z-index: -1; pointer-events: none; }
.paper-art svg { width: 100%; height: auto; overflow: visible; }
.paper-art path { fill: none; stroke: hsl(35 90% 55%); stroke-width: 1.5; stroke-dasharray: 4 6; animation: dash 18s linear infinite; }
.paper-art path:nth-child(2) { stroke: var(--accent); animation-duration: 24s; }
.paper-art path:nth-child(3) { stroke: var(--accent-2); animation-duration: 30s; }
.paper-art circle { fill: var(--surface); stroke: hsl(35 90% 55%); stroke-width: 2; }
@keyframes dash { to { stroke-dashoffset: -400; } }
.writing { display: flex; flex-direction: column; gap: 8px; --hue: 200; }
.writing:nth-of-type(odd) { --hue: 150; }
.writing-kind { font: 500 12px var(--font-mono); color: var(--muted); display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.writing-kind i { font-size: 15px; color: var(--ink); }
.writing-title { font-size: 17px; line-height: 1.35; padding-right: 36px; }
.writing-outlet { font-size: 14px; color: var(--muted); }
.writing .tags { margin-top: auto; padding-top: 6px; }

/* ---------- Skills ---------- */
.skills-bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.skill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.skill-head h3 { font-size: 18px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-list li {
  font-size: 14px; padding: 6px 11px; border-radius: 9px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s var(--ease);
}
.skill-list li:hover { color: var(--ink); border-color: hsl(var(--hue) var(--tile-s) var(--tile-l) / 0.5); background: hsl(var(--hue) var(--tile-s) var(--tile-l) / 0.1); transform: translateY(-1px); }
.interests { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; padding: 18px 24px; --hue: 280; }
.interests h3 { font-size: 16px; white-space: nowrap; color: var(--muted); font-weight: 500; }
.marquee { overflow: hidden; flex: 1; -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: 12px; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track li {
  font: 600 15px var(--font-display); padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent));
  border: 1px solid var(--line); color: var(--ink);
}
@keyframes marquee { to { transform: translateX(calc(-50% - 6px)); } }

/* ---------- Education & awards ---------- */
.edu { display: flex; flex-direction: column; gap: 10px; }
.cert { display: flex; flex-direction: column; gap: 6px; --hue: 160; }
.cert .mini-icon { margin-bottom: 10px; }
.cert-title { font-size: 18px; line-height: 1.3; padding-right: 36px; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.award { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; --hue: 40; }
.award:nth-child(3n+2) { --hue: 260; }
.award:nth-child(3n) { --hue: 190; }
.award-icon {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-size: 17px;
  color: var(--tint); background: hsl(var(--hue) var(--tile-s) var(--tile-l) / 0.14);
}
.award-title { font-weight: 600; font-size: 15px; line-height: 1.4; color: var(--ink); }
.award-date { font: 500 12px var(--font-mono); color: var(--muted); margin-top: 4px; }
.community-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.community { display: flex; flex-direction: column; gap: 8px; --hue: 330; }
.community h4 { font-size: 17px; }

/* ---------- Connect ---------- */
.profile-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.profile { display: flex; flex-direction: column; gap: 6px; min-height: 210px; }
.profile:nth-child(1) { --hue: 250; }
.profile:nth-child(2) { --hue: 210; }
.profile:nth-child(3) { --hue: 220; }
.profile:nth-child(4) { --hue: 28; }
.profile:nth-child(5) { --hue: 150; }
.profile-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; margin-bottom: 12px;
  color: #fff; background: linear-gradient(135deg, hsl(var(--hue) 70% 50%), hsl(calc(var(--hue) + 30) 75% 45%));
  transition: transform 0.4s var(--ease);
}
.profile:hover .profile-icon { transform: rotate(-8deg) scale(1.08); }
.profile h3 { font-size: 18px; }
.profile-handle { font: 500 13px var(--font-mono); color: var(--muted); }
.profile-blurb { font-size: 14px; color: var(--ink-2); }
.profile-live:not(:empty) {
  margin-top: auto; padding-top: 10px; font: 600 13px var(--font-mono); color: var(--tint);
  display: flex; flex-wrap: wrap; gap: 10px;
}
.cta {
  margin-top: 18px; padding: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  --hue: 245;
  background:
    radial-gradient(600px circle at 0% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(600px circle at 100% 100%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%),
    var(--surface);
}
.cta h3 { font-size: clamp(22px, 3vw, 30px); }
.cta p { color: var(--muted); margin-top: 6px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Footer ---------- */
.footer { margin-top: 96px; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 28px; padding-bottom: 40px; color: var(--muted); font-size: 14px; }

/* ---------- Reveal on scroll ----------
   Only active once index.js adds .reveal-on, so content is never hidden if the script doesn't run. */
.reveal-on .reveal { opacity: 0; transform: translateY(18px); }
.reveal-on .reveal.is-in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s ease; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-visual { max-width: 320px; order: -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .research-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper { grid-column: 1 / -1; grid-row: auto; }
  .skills-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .nav-name { display: none; }
  .nav-inner { padding: 10px 16px; gap: 12px; }
  .wrap { padding: 0 16px; }
  .hero { padding-top: 40px; }
  .hero-visual { max-width: 260px; }
  .float-chip { font-size: 12px; padding: 6px 10px; }
  .chip-1 { left: -4%; } .chip-2 { right: -6%; } .chip-3 { left: -6%; }
  .section { padding-top: 72px; }
  .bento-bio { grid-column: 1 / -1; grid-row: auto; }
  .research-grid, .skills-bento { grid-template-columns: 1fr; }
  .work-grid, .edu-grid, .awards { grid-template-columns: 1fr; }
  .paper { padding: 24px; }
  .paper-art { width: 60%; opacity: 0.3; }
  .interests { flex-direction: column; align-items: flex-start; gap: 12px; }
  .marquee { width: 100%; }
  .detail-body { padding: 24px 20px; }
  .detail-head { flex-direction: column; gap: 12px; }
  .cta { padding: 24px; }
}
@media (max-width: 420px) {
  .stats { gap: 10px; }
  .stat { padding: 16px; }
  .stat-label { font-size: 13px; }
  .bento { grid-template-columns: 1fr; }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal-on .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; }
}
@media print {
  .nav, .backdrop, .hero-visual, .journey, .filters, .live-repos, .tile-open, .tile-arrow, .theme-toggle, .cta-actions, .detail { display: none !important; }
  body { background: #fff; color: #000; }
  .tile { box-shadow: none; break-inside: avoid; }
  .reveal-on .reveal { opacity: 1; transform: none; }
  .role-summary { -webkit-line-clamp: unset; }
}
