/* ==========================================================================
   Ravi Shekhar Tiwari — portfolio
   "Neural Constellation" design system
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #070b16;
  --bg-2: #0a1020;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.065);
  --surface-solid: #0e1529;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf5;
  --text-2: #b9c1d6;
  --muted: #8892ab;

  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --violet-rgb: 139, 92, 246;
  --cyan-rgb: 34, 211, 238;
  --pink-rgb: 244, 114, 182;

  --grad: linear-gradient(120deg, var(--violet), var(--cyan));
  --grad-art: linear-gradient(110deg, var(--violet) 0%, var(--pink) 45%, var(--cyan) 100%);

  /* canvas */
  --node-rgb: 199, 210, 254;
  --edge-rgb: 139, 92, 246;
  --spark-rgb: 34, 211, 238;

  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --grain-opacity: 0.06;
  --aurora-opacity: 0.55;

  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --nav-h: 80px;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6fb;
  --bg-2: #eeeef8;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-2: #ffffff;
  --surface-solid: #ffffff;
  --border: rgba(13, 18, 34, 0.08);
  --border-strong: rgba(13, 18, 34, 0.16);
  --text: #0d1222;
  --text-2: #3a4258;
  --muted: #5b6480;

  --violet: #6d28d9;
  --cyan: #0e7490;
  --pink: #db2777;
  --violet-rgb: 109, 40, 217;
  --cyan-rgb: 14, 116, 144;
  --pink-rgb: 219, 39, 119;

  --node-rgb: 76, 29, 149;
  --edge-rgb: 109, 40, 217;
  --spark-rgb: 8, 145, 178;

  --shadow: 0 24px 60px -28px rgba(30, 27, 75, 0.25);
  --shadow-sm: 0 8px 24px -14px rgba(30, 27, 75, 0.25);
  --grain-opacity: 0.035;
  --aurora-opacity: 0.35;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%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; }

/* Icons: inline SVG from the local sprite (assets/img/icons.svg), sized like an icon font */
.bi {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: currentColor;
  vertical-align: -0.125em;
  overflow: visible;
}
a { color: inherit; text-decoration: none; }
p a, .link { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(var(--cyan-rgb), 0.35); text-underline-offset: 3px; transition: text-decoration-color 0.2s; }
p a:hover, .link:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; }
ul[class], ol[class] { list-style: none; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; }
p { margin: 0; }
strong { color: var(--text); font-weight: 600; }
::selection { background: rgba(var(--violet-rgb), 0.35); color: var(--text); }

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

.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-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  transform: translateY(-200%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-left: max(clamp(16px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 32px), env(safe-area-inset-right));
}

.grad-text {
  background: var(--grad-art);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-name .grad-text,
.contact-title .grad-text { animation: shimmer 8s ease-in-out infinite alternate; }

@keyframes shimmer {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

/* ---------- Ambient background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--aurora-opacity);
}
.aurora span {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(var(--violet-rgb), 0.35), transparent 60%);
  animation: drift 38s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { top: -25vmax; left: -15vmax; }
.aurora span:nth-child(2) {
  top: 30vh; right: -25vmax;
  background: radial-gradient(circle at center, rgba(var(--cyan-rgb), 0.25), transparent 60%);
  animation-duration: 46s;
  animation-delay: -12s;
}
.aurora span:nth-child(3) {
  bottom: -30vmax; left: 20vw;
  background: radial-gradient(circle at center, rgba(var(--pink-rgb), 0.18), transparent 60%);
  animation-duration: 52s;
  animation-delay: -24s;
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(8vw, 6vh, 0) scale(1.15); }
  100% { transform: translate3d(-6vw, -4vh, 0) scale(0.95); }
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 120;
  background: var(--grad-art);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- Navigation ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 110;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: height 0.35s var(--ease), background-color 0.35s, border-color 0.35s, backdrop-filter 0.35s;
  border-bottom: 1px solid transparent;
}
.site-nav.is-scrolled,
.site-nav.is-open {
  --nav-h: 66px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-right: auto;
}
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--surface-solid);
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(var(--violet), var(--cyan), var(--pink), var(--violet));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rotate 6s linear infinite;
}
.brand-name { font-size: 1.25rem; }
/* header name scales down on phones so it always stays on one line beside the buttons */
.site-nav .brand-name { font-size: clamp(0.95rem, 9.6vw - 1.25rem, 1.25rem); white-space: nowrap; }
@media (max-width: 359px) {
  .site-nav .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

/* Continuous effects only animate transform/opacity so they stay on the GPU. */
@keyframes rotate { to { transform: rotate(360deg); } }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 999px;
  font-size: 1.0625rem;
  color: var(--text-2);
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.is-active {
  color: var(--text);
  background: rgba(var(--violet-rgb), 0.16);
  box-shadow: inset 0 0 0 1px rgba(var(--violet-rgb), 0.35);
}
.nav-links .bi-arrow-up-right { font-size: 0.7em; opacity: 0.7; }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.icon-btn .bi { font-size: 1.2rem; line-height: 1; }

.theme-toggle .bi-sun { display: none; }
:root[data-theme="light"] .theme-toggle .bi-sun { display: inline-block; }
:root[data-theme="light"] .theme-toggle .bi-moon-stars { display: none; }

.nav-toggle { display: none; }

@media (max-width: 1200px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px clamp(16px, 4vw, 32px) 20px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.3s var(--ease), visibility 0s 0.3s;
  }
  .nav-links {
    max-height: calc(100vh - var(--nav-h));
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav-links a { padding: 13px 16px; font-size: 1.15rem; border-radius: 12px; }
  .site-nav.is-open .nav-links {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
  }
  .nav-toggle .bi-x-lg { display: none; }
  .site-nav.is-open .nav-toggle .bi-x-lg { display: inline-block; }
  .site-nav.is-open .nav-toggle .bi-list { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.2s, box-shadow 0.3s, background-color 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: rgba(var(--violet-rgb), 0.6); }
.btn .bi { font-size: 1.15em; transition: transform 0.3s var(--ease); }
.btn:hover .bi-arrow-right,
.btn:hover .bi-arrow-up-right { transform: translateX(3px); }

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 30px -10px rgba(var(--violet-rgb), 0.7);
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grad-art);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.35s;
}
.btn-primary:hover { border-color: transparent; box-shadow: 0 16px 40px -12px rgba(var(--violet-rgb), 0.8); }
.btn-primary:hover::before { opacity: 1; animation: shimmer 3s ease-in-out infinite alternate; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 40px) 0 96px;
  overflow: hidden;
}
.constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 55% 45%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 80% at 55% 45%, #000 40%, transparent 100%);
}
.constellation.is-ready { opacity: 1; }
.contact-card .constellation.is-ready { opacity: 0.7; }
.no-js .constellation { display: none; }
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 160px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.pulse-dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #34d399;
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.hero-name {
  margin: 22px 0 22px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.9rem, 8.2vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.hero-name .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.hero-name .line > span { display: inline-block; }
.hero-name .line-accent > span { font-style: italic; font-weight: 400; }
.js .hero-name .line > span {
  transform: translateY(105%);
  animation: rise 1.1s var(--ease) forwards;
}
.js .hero-name .line:nth-child(2) > span { animation-delay: 0.14s; }
@keyframes rise { to { transform: none; } }

.hero-thesis {
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  color: var(--text-2);
}
.hero-typed {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--muted);
  min-height: 1.6em;
}
.hero-typed .typed { color: var(--cyan); }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.18em;
  background: var(--cyan);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  list-style: none;
}
.social-row a {
  display: inline-grid;
  place-items: center;
  width: 48px; height: 48px;
  font-size: 1.3rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: transform 0.3s var(--ease), color 0.2s, border-color 0.2s, background-color 0.2s;
}
.social-row a:hover {
  transform: translateY(-3px);
  color: var(--text);
  border-color: rgba(var(--cyan-rgb), 0.5);
  background: rgba(var(--cyan-rgb), 0.08);
}

/* portrait */
.hero-portrait {
  position: relative;
  justify-self: center;
  width: min(26rem, 36vw);
  aspect-ratio: 4 / 5;
}
.portrait-halo {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: conic-gradient(rgba(var(--violet-rgb), 0.55), rgba(var(--cyan-rgb), 0.45), rgba(var(--pink-rgb), 0.45), rgba(var(--violet-rgb), 0.55));
  filter: blur(48px);
  opacity: 0.55;
  will-change: transform;
  animation: rotate 14s linear infinite;
}
.portrait-frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 3px;
  border-radius: 46% 54% 52% 48% / 42% 44% 56% 58%;
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow);
}
/* the gradient ring is a rotating layer clipped by the blob shape */
.portrait-frame::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: -1;
  background: conic-gradient(var(--violet), var(--cyan), var(--pink), var(--violet));
  animation: rotate 8s linear infinite;
}
/* the shape morph repaints every frame, so it is reserved for desktops */
@media (hover: hover) and (min-width: 901px) {
  .portrait-frame { animation: morph 16s ease-in-out infinite; }
}
.portrait-frame img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  background: var(--surface-solid);
}
@keyframes morph {
  0%, 100% { border-radius: 46% 54% 52% 48% / 42% 44% 56% 58%; }
  33% { border-radius: 58% 42% 44% 56% / 52% 58% 42% 48%; }
  66% { border-radius: 42% 58% 56% 44% / 58% 42% 58% 42%; }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue .mouse {
  width: 22px; height: 34px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  position: relative;
}
.scroll-cue .mouse::after {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  width: 3px; height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--cyan);
  animation: wheel 1.8s var(--ease) infinite;
}
@keyframes wheel {
  0% { opacity: 0; transform: translateY(-2px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; width: min(320px, 76vw); margin-top: 8px; }
  .scroll-cue { display: none; }
}

/* ---------- Sections ---------- */
.section {
  position: relative;
  padding-block: clamp(80px, 11vw, 136px);
}
/* Below-the-fold sections render on demand: the browser skips their style, layout and paint
   until they approach the viewport ("auto" remembers each section's real size once seen).
   Content stays in the DOM, so search engines and find-in-page still see everything. */
main > .section {
  content-visibility: auto;
  contain-intrinsic-size: auto 1200px;
}
.section-alt {
  background: linear-gradient(180deg, transparent, var(--bg-2) 12%, var(--bg-2) 88%, transparent);
}
.section-head {
  max-width: 46rem;
  margin-bottom: clamp(40px, 6vw, 64px);
}
.section-head.center { margin-inline: auto; text-align: center; }
.section-index {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}
.section-index::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.section-head.center .section-index::after {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.section-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144;
}
.section-title em { font-style: italic; font-weight: 400; }
.section-lede {
  margin-top: 18px;
  font-size: 1.075rem;
  color: var(--text-2);
}

/* ---------- Glass card ---------- */
.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.4s var(--ease), border-color 0.3s, box-shadow 0.4s;
}
[data-spotlight] { isolation: isolate; }
[data-spotlight]::before,
[data-spotlight]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
}
[data-spotlight]::before {
  z-index: -1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--violet-rgb), 0.14), transparent 45%);
}
[data-spotlight]::after {
  padding: 1px;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--cyan-rgb), 0.7), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
[data-spotlight]:hover::before,
[data-spotlight]:hover::after { opacity: 1; }
.card:hover { box-shadow: var(--shadow); }

.icon-orb {
  display: inline-grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  font-size: 1.55rem;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 24px -10px rgba(var(--violet-rgb), 0.8);
}
.icon-orb.alt { background: linear-gradient(135deg, var(--pink), var(--violet)); }
.icon-orb.alt2 { background: linear-gradient(135deg, var(--cyan), #34d399); }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.prose p + p { margin-top: 18px; }
.prose p { color: var(--text-2); font-size: 1.05rem; }
.prose p:first-child::first-letter {
  float: left;
  margin: 6px 12px 0 0;
  font-family: var(--font-display);
  font-size: 4.2rem;
  line-height: 0.8;
  font-style: italic;
  background: var(--grad-art);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.facts { padding: 8px 24px; }
.facts li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  list-style: none;
  border-bottom: 1px solid var(--border);
}
.facts li:last-child { border-bottom: 0; }
.facts .bi { margin-top: 2px; color: var(--cyan); font-size: 1.35rem; }
.facts .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts .value { font-weight: 500; overflow-wrap: anywhere; }
.facts a.value:hover { color: var(--cyan); }

.pull-quote {
  position: relative;
  margin: clamp(48px, 7vw, 80px) auto 0;
  max-width: 52rem;
  padding: 0 clamp(8px, 4vw, 48px);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  line-height: 1.4;
  color: var(--text);
}
.pull-quote::before {
  content: "\201C";
  display: block;
  height: 0.6em;
  font-size: 4em;
  line-height: 1;
  font-style: normal;
  background: var(--grad-art);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: clamp(48px, 7vw, 80px);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 22px 20px;
}
a.stat:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.stats > li > .stat { height: 100%; }
.stat .bi { color: var(--violet); font-size: 1.45rem; }
.stat:nth-child(3n + 2) .bi { color: var(--cyan); }
.stat:nth-child(3n) .bi { color: var(--pink); }
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-num sup { font-size: 0.5em; vertical-align: 0.7em; margin-left: 2px; color: var(--muted); }
.stat-label { font-size: 0.875rem; color: var(--muted); }
.stat .ext { position: absolute; top: 18px; right: 18px; font-size: 0.8rem; color: var(--muted); opacity: 0; transition: opacity 0.2s; }
a.stat:hover .ext { opacity: 1; }

/* ---------- Research ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.research-card { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.research-card:hover { transform: translateY(-6px); }
.research-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; margin-top: 6px; }
.research-card p { color: var(--text-2); font-size: 0.95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; list-style: none; }
.tags li {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- Tabs ---------- */
.tablist {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px;
  margin-bottom: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.tab {
  position: relative;
  z-index: 1;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.25s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: #fff; }
.tab-count { margin-left: 6px; font-family: var(--font-mono); font-size: 0.72rem; opacity: 0.7; }
.tab-indicator {
  position: absolute;
  top: 0; left: 0;
  border-radius: 999px;
  background: var(--grad);
  box-shadow: 0 8px 20px -8px rgba(var(--violet-rgb), 0.8);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease), height 0.45s var(--ease);
}
.no-js .tab[aria-selected="true"] { background: var(--grad); }
.no-js .tab-indicator { display: none; }
[role="tabpanel"]:not([hidden]) { animation: fade-up 0.6s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Timeline ---------- */
.timeline {
  --progress: 0;
  position: relative;
  list-style: none;
  padding-left: 40px;
}
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  top: 8px; bottom: 8px; left: 11px;
  width: 2px;
  border-radius: 2px;
}
.timeline::before { background: var(--border); }
.timeline::after {
  background: linear-gradient(to bottom, var(--violet), var(--cyan), var(--pink));
  transform-origin: top;
  transform: scaleY(var(--progress));
}
.tl-item { position: relative; }
.tl-item + .tl-item { margin-top: 20px; }
.tl-dot {
  position: absolute;
  left: -40px; top: 26px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.tl-dot::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background-color 0.4s, transform 0.4s var(--ease);
}
.tl-item.is-in .tl-dot { border-color: var(--violet); box-shadow: 0 0 0 6px rgba(var(--violet-rgb), 0.12); }
.tl-item.is-in .tl-dot::after { background: var(--cyan); transform: scale(1.1); }
.tl-card { padding: 24px 26px; }
.tl-card:hover { border-color: var(--border-strong); }
.tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.tl-date {
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.08);
  border: 1px solid rgba(var(--cyan-rgb), 0.2);
}
.tl-card h3 { margin-top: 12px; font-size: 1.15rem; font-weight: 600; }
.tl-org { margin-top: 4px; color: var(--text-2); font-style: italic; font-family: var(--font-display); font-size: 1.05rem; }
.tl-card ul { margin-top: 14px; list-style: none; display: grid; gap: 8px; }
.tl-card li { position: relative; padding-left: 20px; color: var(--text-2); font-size: 0.95rem; }
.tl-card li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.62em;
  width: 7px; height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--grad);
}
.tl-card p.desc { margin-top: 12px; color: var(--text-2); font-size: 0.95rem; }

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}
.edu-card { grid-column: span 2; padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.edu-card.minor { grid-column: span 3; }
.edu-card:hover { transform: translateY(-5px); }
.edu-years {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
}
.edu-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.45rem; line-height: 1.2; }
.edu-school { color: var(--text-2); font-size: 0.95rem; }
.edu-card p.desc { color: var(--text-2); font-size: 0.92rem; }
.score {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  border: 1px solid rgba(var(--violet-rgb), 0.35);
  background: rgba(var(--violet-rgb), 0.1);
}
.edu-card.current { border-color: rgba(var(--violet-rgb), 0.4); }
.badge-now {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
}
:root[data-theme="light"] .badge-now { color: #047857; }

/* ---------- Skills ---------- */
.marquee {
  overflow: hidden;
  padding-block: 6px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee + .marquee { margin-top: 10px; }
.marquee-track {
  display: flex;
  gap: 10px;
  width: max-content;
  list-style: none;
}
.js .marquee-track { animation: marquee 60s linear infinite; }
.js .marquee.reverse .marquee-track { animation-direction: reverse; animation-duration: 70s; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 5px)); } }
.marquee-track li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  white-space: nowrap;
}
.marquee-track li::before {
  content: "\2726";
  font-size: 0.75em;
  color: var(--violet);
}
.marquee.reverse .marquee-track li::before { color: var(--cyan); }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 48px;
}
.skill-group { padding: 24px; }
.skill-group header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.skill-group header .bi {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  padding: 10px;
  border-radius: 12px;
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.1);
}
.skill-group h3 { font-size: 1rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chips li {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease), background-color 0.2s;
}
.chips li:hover {
  color: var(--text);
  border-color: rgba(var(--violet-rgb), 0.5);
  background: rgba(var(--violet-rgb), 0.1);
  transform: translateY(-2px);
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.filter-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease);
}
.filter-btn:hover { color: var(--text); transform: translateY(-1px); }
.filter-btn[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(var(--violet-rgb), 0.6);
  background: rgba(var(--violet-rgb), 0.16);
}
.filter-btn .count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-align: center;
  background: var(--surface-2);
}

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  list-style: none;
}
.project { transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.project.is-filtered-out { opacity: 0; transform: scale(0.94); }
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
}
.project-card:hover { border-color: var(--border-strong); }
.project-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.project-thumb picture { display: block; width: 100%; height: 100%; }
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
  transition: transform 0.8s var(--ease), filter 0.4s;
}
.project-card:hover .project-thumb img { transform: scale(1.06); filter: saturate(1.1); }
.project-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(7, 11, 22, 0.55));
}
.project-type {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(7, 11, 22, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.project-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 20px;
}
.project-body h3 { font-size: 1.05rem; font-weight: 600; }
.project-body p { margin-top: 4px; font-size: 0.875rem; color: var(--muted); }
.project-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1.1rem;
  transition: transform 0.35s var(--ease), color 0.2s, border-color 0.2s, background-color 0.2s;
}
.project-card:hover .project-arrow {
  transform: rotate(45deg);
  color: #fff;
  border-color: transparent;
  background: var(--grad);
}

/* ---------- Services ---------- */
.service { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.service:hover { transform: translateY(-6px); }
.service-num {
  position: absolute;
  top: 20px; right: 24px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.6rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-strong);
  transition: -webkit-text-stroke-color 0.3s;
}
.service:hover .service-num { -webkit-text-stroke-color: rgba(var(--violet-rgb), 0.7); }
.service h3 { font-size: 1.15rem; font-weight: 600; margin-top: 6px; }
.service p { color: var(--text-2); font-size: 0.95rem; }
.service .more {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--cyan);
}
.service:hover .more .bi { transform: translateX(4px); }
.service .more .bi { transition: transform 0.3s var(--ease); }

/* ---------- Mentors ---------- */
.mentors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.mentor { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.mentor-head { display: flex; gap: 20px; align-items: center; }
.mentor-photo {
  flex: none;
  width: 104px; height: 120px;
  padding: 2px;
  border-radius: 46% 54% 52% 48% / 42% 44% 56% 58%;
  background: var(--grad-art);
}
.mentor-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  filter: grayscale(0.4);
  transition: filter 0.5s;
}
.mentor:hover .mentor-photo img { filter: none; }
.mentor-role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink);
}
.mentor h3 { margin-top: 6px; font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; }
.mentor-title { margin-top: 4px; font-size: 0.9rem; color: var(--text-2); }
.mentor blockquote {
  margin: 0;
  padding-left: 18px;
  border-left: 2px solid;
  border-image: linear-gradient(to bottom, var(--violet), var(--cyan)) 1;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-2);
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  list-style: none;
}
.mini-stats li {
  padding: 12px 8px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--surface);
}
.mini-stats strong { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; line-height: 1.1; }
.mini-stats span { font-size: 0.72rem; color: var(--muted); }
.mentor-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--muted); }
.mentor-meta .bi { margin-right: 4px; color: var(--cyan); }
.mentor-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text-2);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.pill-link:hover { color: var(--text); border-color: rgba(var(--cyan-rgb), 0.5); transform: translateY(-2px); }

/* ---------- Beyond research ---------- */
.interests {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  list-style: none;
}
.interest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 10px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-2);
}
.interest .bi {
  font-size: 2rem;
  color: var(--c, var(--violet));
  transition: transform 0.4s var(--ease);
}
.interest:hover { transform: translateY(-4px); border-color: var(--border-strong); color: var(--text); }
.interest:hover .bi { transform: scale(1.18) rotate(-8deg); }
.beyond-foot {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  margin-top: 22px;
}
.kind-note { padding: 32px; }
.kind-note blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.55;
}
.writing-card { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.writing-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; }
.writing-card p { color: var(--text-2); font-size: 0.95rem; }
.writing-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* ---------- Resource banner ---------- */
.resource {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 4vw, 40px);
  overflow: hidden;
}
.resource::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px circle at 0% 0%, rgba(var(--violet-rgb), 0.18), transparent 50%),
    radial-gradient(600px circle at 100% 100%, rgba(var(--cyan-rgb), 0.14), transparent 50%);
}
.resource { margin-top: 56px; }
.resource:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.resource h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.resource p { margin-top: 6px; color: var(--text-2); }
.rank-pills { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Contact ---------- */
#contact.section { padding-top: clamp(32px, 5vw, 64px); }
.contact-card {
  position: relative;
  padding: clamp(32px, 6vw, 72px);
  overflow: hidden;
  text-align: center;
}
.contact-card .constellation {
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.contact-inner { position: relative; z-index: 1; }
.contact-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.contact-title em { font-style: italic; font-weight: 400; }
.contact-card .section-lede { max-width: 38rem; margin-inline: auto; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.contact-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--muted);
  list-style: none;
}
.contact-meta .bi { margin-right: 6px; color: var(--cyan); }
.contact-card .social-row { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 44px 0 52px;
  border-top: 1px solid var(--border);
  font-size: 1.0625rem;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 26px; list-style: none; }
.footer-links a:hover { color: var(--text); }
.footer-credit a { color: var(--text-2); }
.footer-credit a:hover { color: var(--cyan); }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 30px -10px rgba(var(--violet-rgb), 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0s 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s, transform 0.3s var(--ease); }
.to-top:hover { transform: translateY(-3px); }

/* ---------- Off-screen pausing ---------- */
.is-offscreen *,
.is-offscreen *::before,
.is-offscreen *::after { animation-play-state: paused !important; }

/* ---------- Reveal ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
/* site.js removes [data-reveal] once the entrance finishes so hover transitions run undelayed */

/* ==========================================================================
   Conference rankings page
   ========================================================================== */
.page-hero {
  position: relative;
  padding: calc(var(--nav-h) + 56px) 0 56px;
  overflow: hidden;
}
.page-hero .container { position: relative; z-index: 1; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.2s;
}
.crumb:hover { color: var(--text); }
.page-title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 1;
  letter-spacing: -0.025em;
}
.page-title em { font-style: italic; font-weight: 400; }
.page-hero .section-lede { max-width: 44rem; }
.rank-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 44rem;
  margin-top: 32px;
}
.rank-summary .card { padding: 16px 18px; }
.rank-summary strong { display: block; font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; line-height: 1.1; }
.rank-summary span { font-size: 0.8rem; color: var(--muted); }

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}
.rank-badge[data-rank="A+"] { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); }
.rank-badge[data-rank="A"] { color: #a78bfa; border-color: rgba(167, 139, 250, 0.4); background: rgba(167, 139, 250, 0.1); }
.rank-badge[data-rank="B"] { color: #22d3ee; border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.rank-badge[data-rank="C"] { color: #94a3b8; border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.08); }
:root[data-theme="light"] .rank-badge[data-rank="A+"] { color: #b45309; }
:root[data-theme="light"] .rank-badge[data-rank="A"] { color: #6d28d9; }
:root[data-theme="light"] .rank-badge[data-rank="B"] { color: #0e7490; }
:root[data-theme="light"] .rank-badge[data-rank="C"] { color: #475569; }

.rank-panel { padding: clamp(16px, 3vw, 28px); margin-bottom: 80px; }
.rank-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.search {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
}
.search .bi-search {
  position: absolute;
  left: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: 48px;
  padding: 12px 52px 12px 44px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: rgba(var(--violet-rgb), 0.7); box-shadow: 0 0 0 4px rgba(var(--violet-rgb), 0.15); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  position: absolute;
  right: 14px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.rank-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.results-meta { margin: 18px 2px 12px; font-size: 0.875rem; color: var(--muted); }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
/* Until the first page of rows renders, hold a screen's height so nothing below jumps (CLS). */
.table-wrap[data-loading] { min-height: 100vh; }
.no-js .table-wrap[data-loading] { display: none; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.rank-table th {
  position: sticky;
  top: 0;
  padding: 14px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
}
.rank-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rank-table tbody tr:last-child td { border-bottom: 0; }
.rank-table tbody tr { transition: background-color 0.2s; }
.rank-table tbody tr:hover { background: rgba(var(--violet-rgb), 0.06); }
.rank-table .col-num { width: 64px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.rank-table .col-acr { width: 160px; font-weight: 600; }
.rank-table .col-rank { width: 90px; text-align: right; }
.rank-table th.col-rank { text-align: right; }
.rank-table mark { background: rgba(var(--cyan-rgb), 0.22); color: inherit; border-radius: 3px; padding: 0 1px; }
.js .rank-table tbody tr { animation: row-in 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.empty-state { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state .bi { display: block; margin: 0 auto 8px; font-size: 1.8rem; color: var(--violet); }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 22px; }
.pager button,
.pager span {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.875rem;
}
.pager button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.pager button:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.pager button[aria-current="page"] { color: #fff; border-color: transparent; background: var(--grad); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager span { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-3, .skills-grid, .projects { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .interests { grid-template-columns: repeat(4, 1fr); }
  .edu-card { grid-column: span 3; }
  .edu-card.current { grid-column: span 6; }
}
@media (max-width: 860px) {
  .about-grid, .mentors, .beyond-foot { grid-template-columns: 1fr; }
  .resource { grid-template-columns: 1fr; text-align: left; }
}
@media (max-width: 640px) {
  .grid-3, .skills-grid, .projects { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 18px 16px; }
  .interests { grid-template-columns: repeat(3, 1fr); }
  .edu-card, .edu-card.minor, .edu-card.current { grid-column: span 6; }
  .timeline { padding-left: 32px; }
  .timeline::before, .timeline::after { left: 9px; }
  .tl-dot { left: -32px; width: 20px; height: 20px; }
  .tl-card { padding: 20px; }
  .tablist { display: flex; border-radius: 18px; }
  .tab { flex: 1 1 auto; padding: 10px 12px; }
  .tab-indicator { border-radius: 14px; }
  .mentor-head { flex-direction: column; align-items: flex-start; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .rank-summary { grid-template-columns: repeat(2, 1fr); }

  /* conference table → stacked cards */
  .table-wrap { border: 0; overflow: visible; }
  .rank-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .rank-table, .rank-table tbody { display: block; }
  .rank-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 4px 12px;
    align-items: center;
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  .rank-table td { padding: 0; border: 0; }
  .rank-table .col-num { width: auto; grid-row: 1; grid-column: 1; }
  .rank-table .col-acr { width: auto; grid-row: 1; grid-column: 2; }
  .rank-table .col-rank { width: auto; grid-row: 1; grid-column: 3; }
  .rank-table .col-name { grid-row: 2; grid-column: 1 / -1; font-size: 0.9rem; color: var(--text-2); }
  .search kbd { display: none; }
  .search input { padding-right: 20px; }
}
@media (max-width: 380px) {
  .interests { grid-template-columns: repeat(2, 1fr); }
  .btn { width: 100%; }
}

/* ---------- Readable copy ----------
   All running text (paragraphs, bullet points, card descriptions, section intros) shares one
   larger size and is justified, with hyphenation so even edges don't open wide gaps. */
:root { --fs-copy: 1.125rem; --lh-copy: 1.75; }
@media (max-width: 640px) { :root { --fs-copy: 1.0625rem; } }

.section-lede,
.prose p,
.research-card p,
.tl-card li,
.tl-card p.desc,
.edu-card p.desc,
.service p,
.writing-card p,
.resource p,
.mentor blockquote {
  font-size: var(--fs-copy);
  line-height: var(--lh-copy);
}
.hero-thesis {
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  line-height: var(--lh-copy);
}
.hero-thesis,
.section-lede,
.prose p,
.research-card p,
.tl-card li,
.tl-card p.desc,
.edu-card p.desc,
.service p,
.writing-card p,
.resource p,
.mentor blockquote,
.kind-note blockquote {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  text-wrap: pretty;
}
/* centred contexts stay centred */
.section-head.center .section-lede,
.contact-card .section-lede { text-align: center; -webkit-hyphens: manual; hyphens: manual; }

/* secondary text scales up with the copy */
.tl-card h3 { font-size: 1.25rem; }
.tl-org { font-size: 1.125rem; }
.research-card h3 { font-size: 1.5rem; }
.service h3 { font-size: 1.25rem; }
.project-body h3 { font-size: 1.125rem; }
.project-body p { font-size: 0.95rem; }
.edu-school { font-size: 1rem; }
.mentor-title { font-size: 0.95rem; }
.mentor-meta { font-size: 0.9rem; }
.skill-group h3 { font-size: 1.05rem; }
.chips li { font-size: 0.9rem; }
.stat-label { font-size: 0.95rem; }
.interest { font-size: 0.95rem; }
.facts .value { font-size: 1.05rem; }
.rank-table { font-size: 1rem; }

/* Justified text needs a comfortable measure, so paragraph-heavy cards get wider columns */
@media (min-width: 900px) {
  #research .grid-3,
  #services .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 899px) {
  #research .grid-3,
  #services .grid-3 { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .edu-card { grid-column: span 3; }
  .edu-card.current { grid-column: span 6; }
  .edu-card.current .desc { max-width: 72ch; }
}
@media (max-width: 900px) {
  .edu-card,
  .edu-card.minor,
  .edu-card.current { grid-column: span 6; }
}

/* 11 skill groups: let the last card fill the row instead of leaving a gap */
@media (min-width: 1025px) {
  .skills-grid > :last-child:nth-child(3n + 2) { grid-column: span 2; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .skills-grid > :last-child:nth-child(odd) { grid-column: span 2; }
}

/* the rotating phrase can wrap to two lines on phones: reserve both so nothing below shifts */
@media (max-width: 640px) { .hero-typed { min-height: 3.3em; } }

/* social icons: a neat 4 + 4 grid on phones instead of a ragged wrap */
@media (max-width: 480px) {
  .social-row { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 12px; }
  .contact-card .social-row { justify-content: center; }
}

/* very narrow columns read better ragged than stretched */
@media (max-width: 400px) {
  .tl-card li, .tl-card p.desc, .research-card p, .service p { text-align: left; }
}

/* ---------- Adaptive: very small, landscape, large and touch screens ---------- */
/* Fold-style and 320px phones */
@media (max-width: 359px) {
  .hero-name { font-size: 2.45rem; }
  .section-title { font-size: 1.85rem; }
  .contact-title { font-size: 1.95rem; }
  .page-title { font-size: 2.3rem; }
  .stat-num { font-size: 1.75rem; }
  .eyebrow { font-size: 0.68rem; letter-spacing: 0.04em; }
  .tl-card { padding: 18px 16px; }
  .research-card, .service, .mentor, .edu-card, .skill-group, .writing-card, .kind-note { padding: 22px 18px; }
}

/* Phones in landscape: keep the hero side-by-side and compact */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 540px) {
  .hero { min-height: auto; padding: calc(var(--nav-h) + 24px) 0 56px; }
  .hero-grid { grid-template-columns: 1fr auto; gap: 28px; }
  .hero-portrait { order: 0; width: min(240px, 32vw); margin-top: 0; }
  .hero-name { font-size: clamp(2.3rem, 6.5vw, 3.4rem); margin: 14px 0; }
  .hero-cta { margin-top: 20px; }
  .hero-cta .btn { width: auto; }
  .page-hero { padding: calc(var(--nav-h) + 28px) 0 32px; }
}

/* Tablets in portrait: give the hero a little more presence */
@media (min-width: 641px) and (max-width: 900px) and (orientation: portrait) {
  .hero-portrait { width: min(360px, 54vw); }
}

/* Large desktops and TVs: scale type and widen the layout */
@media (min-width: 1680px) {
  html { font-size: 17px; }
  .container { max-width: 1320px; }
}
@media (min-width: 2200px) {
  html { font-size: 18.5px; }
  .container { max-width: 1500px; }
  :root { --nav-h: 88px; }
}
@media (min-width: 2800px) {
  html { font-size: 21px; }
  .container { max-width: 1720px; }
}

/* Touch screens: no sticky hover lifts after a tap */
@media (hover: none) {
  .card:hover, a.stat:hover, .research-card:hover, .edu-card:hover, .service:hover,
  .interest:hover, .resource:hover, .btn:hover, .icon-btn:hover, .social-row a:hover,
  .chips li:hover, .pill-link:hover, .filter-btn:hover { transform: none; }
  .project-card:hover .project-thumb img { transform: none; }
}

/* Small screens: drop backdrop blur on cards for smoother scrolling */
@media (max-width: 640px) {
  .card { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Reduced motion ---------- */
@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;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .hero-name .line > span { transform: none; }
  .timeline { --progress: 1 !important; }
  .caret { display: none; }
}
