/* =============================================================================
   Sara Aly — site design system
   Shared by index.html, projects.html and thesis.html.
   Palette follows the Research2Product brand: ink #0E1014 + violet #6C5CE7.
   ============================================================================= */

:root {
  --font-sans: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #0e1014;
  --bg-raise: #151820;
  --bg-raise-2: #1b1f28;
  --line: rgba(244, 245, 247, 0.09);
  --line-strong: rgba(244, 245, 247, 0.18);
  --text: #f4f5f7;
  --mute: #a0a6b1;
  --dim: #6b717d;
  --accent: #8b7df0;
  --accent-strong: #6c5ce7;
  --accent-soft: rgba(139, 125, 240, 0.14);
  --on-accent: #ffffff;
  --ok: #5bd49b;
  --trace-2: #5fc4e8;
  --trace-3: #f0a868;
  --viz-bg: #101218;
  --viz-grid: rgba(244, 245, 247, 0.045);
  --glow: radial-gradient(1000px 680px at 78% -10%, rgba(108, 92, 231, 0.4), transparent 60%),
          radial-gradient(900px 720px at -8% 30%, rgba(108, 92, 231, 0.3), transparent 62%),
          radial-gradient(800px 640px at 108% 85%, rgba(108, 92, 231, 0.22), transparent 62%);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --nav-h: 68px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f4f0;
  --bg-raise: #ffffff;
  --bg-raise-2: #eceae4;
  --line: rgba(14, 16, 20, 0.1);
  --line-strong: rgba(14, 16, 20, 0.2);
  --text: #0e1014;
  --mute: #4f5561;
  --dim: #848a95;
  --accent: #5a4bd9;
  --accent-strong: #4a3cb8;
  --accent-soft: rgba(90, 75, 217, 0.09);
  --ok: #1f9d64;
  --trace-2: #1f8fb8;
  --trace-3: #c9701f;
  --viz-bg: #fbfaf8;
  --viz-grid: rgba(90, 75, 217, 0.07);
  --glow: radial-gradient(1000px 680px at 78% -10%, rgba(108, 92, 231, 0.26), transparent 60%),
          radial-gradient(900px 720px at -8% 30%, rgba(108, 92, 231, 0.2), transparent 62%),
          radial-gradient(800px 640px at 108% 85%, rgba(108, 92, 231, 0.14), transparent 62%);
  color-scheme: light;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--accent-strong); color: #fff; padding: 10px 14px; border-radius: 8px;
  font-family: var(--font-mono); font-size: 13px;
}
.skip-link:focus { top: 12px; }

/* ---------- type helpers ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.accent { color: var(--accent); }
.muted { color: var(--mute); }

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

/* ---------- page grain + glow ---------- */
.page-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--glow);
}

/* ---------- scroll progress ---------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 120;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

/* =============================================================================
   LOADER — boots once per session
   ============================================================================= */
.loader {
  position: fixed; inset: 0; z-index: 300;
  background: #0b0c10; color: #f4f5f7;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 24px var(--gutter);
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.9s var(--ease-in-out);
}
.loader.is-done { clip-path: inset(0 0 100% 0); }
.loader__row { display: flex; justify-content: space-between; gap: 16px; color: #8d93a0; }
.loader__row b { color: #f4f5f7; font-weight: 500; }
.loader__center { display: grid; place-content: center; gap: 22px; width: min(720px, 100%); margin: 0 auto; }
.loader__name {
  font-size: clamp(2.2rem, 7vw, 4.5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  text-align: center;
}
.loader__name .serif { color: #8b7df0; }
.loader__trace { width: 100%; height: 80px; }
.loader__trace path {
  fill: none; stroke: #8b7df0; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: loaderTrace 1.25s var(--ease) forwards;
}
.loader__status { display: flex; justify-content: space-between; color: #8d93a0; }
.loader__status .ok { color: #5bd49b; }
@keyframes loaderTrace { to { stroke-dashoffset: 0; } }
html.no-loader .loader { display: none; }

/* =============================================================================
   NAV
   ============================================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.brand__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  position: relative; padding: 8px 12px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--mute);
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a.is-active { color: var(--text); background: var(--accent-soft); }
.nav__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); color: var(--text);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-icon--sun { display: none; }
:root[data-theme="light"] .theme-icon--sun { display: block; }
:root[data-theme="light"] .theme-icon--moon { display: none; }

/* resume dropdown */
.dropdown { position: relative; }
.dropdown__panel {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px;
  background: var(--bg-raise); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}
.dropdown.is-open .dropdown__panel { opacity: 1; transform: none; pointer-events: auto; }
.dropdown__panel a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--text);
}
.dropdown__panel a:hover { background: var(--accent-soft); }
.dropdown__panel a span { color: var(--dim); font-family: var(--font-mono); font-size: 11px; }
.dropdown [aria-expanded="true"] .chev { transform: rotate(180deg); }
.chev { transition: transform 0.25s var(--ease); }

.menu-btn { display: none; }

/* mobile menu */
.menu {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  padding: calc(var(--nav-h) + 24px) var(--gutter) 32px;
  display: flex; flex-direction: column; justify-content: space-between;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.7s var(--ease-in-out);
  visibility: hidden;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; }
.menu__links a {
  display: flex; align-items: baseline; gap: 14px;
  font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.15;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}
.menu__links a small { font-family: var(--font-mono); font-size: 12px; color: var(--dim); font-weight: 400; letter-spacing: 0.04em; }
.menu.is-open .menu__links a { opacity: 1; transform: none; }
.menu.is-open .menu__links li:nth-child(2) a { transition-delay: 0.05s; }
.menu.is-open .menu__links li:nth-child(3) a { transition-delay: 0.1s; }
.menu.is-open .menu__links li:nth-child(4) a { transition-delay: 0.15s; }
.menu.is-open .menu__links li:nth-child(5) a { transition-delay: 0.2s; }
.menu.is-open .menu__links li:nth-child(6) a { transition-delay: 0.25s; }
.menu.is-open .menu__links li:nth-child(7) a { transition-delay: 0.3s; }
.menu__foot { display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--mute); }

@media (max-width: 960px) {
  .nav__links { display: none; }
  .menu-btn { display: inline-grid; }
  .nav .dropdown { display: none; }
}

/* =============================================================================
   BUTTONS / LINKS / TAGS
   ============================================================================= */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 999px; overflow: hidden; isolation: isolate;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--text); color: var(--bg);
  transition: color 0.35s var(--ease), transform 0.35s var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent-strong);
  transform: translateY(101%); border-radius: inherit;
  transition: transform 0.45s var(--ease);
}
.btn:hover { color: #fff; }
.btn:hover::before { transform: none; }
.btn svg { width: 14px; height: 14px; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 3px;
  transition: background-size 0.4s var(--ease), color 0.25s var(--ease);
}
.link-arrow:hover { background-size: 100% 1px; color: var(--accent); }
.link-arrow svg { width: 12px; height: 12px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--mute); white-space: nowrap;
}
.tag--accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.tag--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* =============================================================================
   REVEAL TRANSITIONS
   ============================================================================= */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px); filter: blur(6px);
  transition: opacity 0.9s var(--ease), transform 1s var(--ease), filter 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}
.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

.js [data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 0.04em 0.2em; margin: 0 -0.04em -0.2em; }
.js [data-split] .w > span {
  display: inline-block; transform: translateY(calc(100% + 0.3em));
  transition: transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 45ms + var(--d, 0s));
}
.js [data-split].is-in .w > span { transform: none; }

.js [data-line] { transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.2s var(--ease); }
.js [data-line].is-in { transform: none; }

/* =============================================================================
   SECTIONS
   ============================================================================= */
.section { position: relative; padding: clamp(88px, 12vw, 160px) 0; }
.section + .section { padding-top: 0; }
.section-head {
  display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: 24px 40px;
  align-items: end; margin-bottom: clamp(40px, 6vw, 72px);
}
.section-head__label { display: flex; flex-direction: column; gap: 6px; color: var(--dim); padding-bottom: 12px; }
.section-head__label b { color: var(--accent); font-weight: 500; }
.section-head h2 {
  font-size: clamp(2.6rem, 7vw, 6rem); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98;
}
.section-head h2 .serif { font-weight: 400; color: var(--accent); }
.section-head__rule { grid-column: 1 / -1; height: 1px; background: var(--line-strong); }

@media (max-width: 760px) {
  .section-head { grid-template-columns: 1fr; gap: 14px; }
  .section-head__label { flex-direction: row; gap: 12px; padding-bottom: 0; }
}

/* =============================================================================
   HERO
   ============================================================================= */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--nav-h) + 32px) 0 28px;
}
.hero__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; color: var(--mute); margin-bottom: clamp(20px, 3vw, 36px); }
.hero__eyebrow .pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text);
}
.hero__name {
  font-size: clamp(4.2rem, 17vw, 16.5rem);
  font-weight: 800; letter-spacing: -0.06em; line-height: 0.82;
  margin-left: -0.04em;
}
.hero__name .serif { font-weight: 400; color: var(--accent); letter-spacing: -0.03em; }
.hero__grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px 64px; align-items: end;
  margin-top: clamp(24px, 3.5vw, 44px);
}
.hero__lede { font-size: clamp(1.25rem, 2.2vw, 1.9rem); line-height: 1.3; letter-spacing: -0.02em; max-width: 24ch; }
.hero__lede .serif { color: var(--accent); font-size: 1.08em; }
.hero__side { display: flex; flex-direction: column; gap: 22px; }
.hero__side p { color: var(--mute); max-width: 46ch; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
}

/* live signal monitor */
.monitor {
  margin-top: clamp(32px, 5vw, 56px);
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
  display: grid; grid-template-columns: 150px 1fr 180px;
}
.monitor__labels, .monitor__readout { display: grid; grid-template-rows: repeat(3, 1fr); }
.monitor__labels > div, .monitor__readout > div {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 0 14px; border-bottom: 1px dashed var(--line);
}
.monitor__labels > div:last-child, .monitor__readout > div:last-child { border-bottom: 0; }
.monitor__labels { border-right: 1px solid var(--line); }
.monitor__readout { border-left: 1px solid var(--line); }
.monitor__labels b, .monitor__readout b { font-weight: 500; color: var(--text); }
.monitor__labels span, .monitor__readout span { color: var(--dim); font-size: 10.5px; }
.monitor__readout .big { font-size: 20px; letter-spacing: 0; font-family: var(--font-mono); color: var(--text); text-transform: none; }
.monitor__canvas { position: relative; height: 204px; }
.monitor__canvas canvas { width: 100%; height: 100%; }
.monitor__caption { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0 0; color: var(--dim); }
.c-ecg { color: var(--accent); } .c-ppg { color: var(--trace-2); } .c-imu { color: var(--trace-3); }

@media (max-width: 760px) {
  .monitor { grid-template-columns: 76px 1fr; }
  .monitor__readout { display: none; }
  .monitor__labels > div { padding: 0 8px; }
  .monitor__labels span { display: none; }
  .monitor__canvas { height: 160px; }
  .monitor__caption span:last-child { display: none; }
}

.hero__meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-top: 22px; color: var(--dim);
}
.hero__meta div { display: flex; flex-direction: column; gap: 4px; }
.hero__meta b { color: var(--text); font-weight: 500; }
.hero__meta a b { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.4s var(--ease); }
.hero__meta a:hover b { background-size: 100% 1px; }
@media (max-width: 760px) { .hero__meta { grid-template-columns: repeat(2, 1fr); } }

/* =============================================================================
   STATS
   ============================================================================= */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
}
.stat { padding: clamp(24px, 3vw, 40px) clamp(14px, 2vw, 28px); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.stat:last-child { border-right: 0; }
.stat__value { font-size: clamp(2.4rem, 5vw, 4.4rem); font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.stat__value .serif { font-weight: 400; color: var(--accent); }
.stat__label { color: var(--mute); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* =============================================================================
   ABOUT
   ============================================================================= */
.about { display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: 40px; }
.about__statement { font-size: clamp(1.6rem, 3.4vw, 2.9rem); line-height: 1.18; letter-spacing: -0.03em; font-weight: 500; }
.about__statement .serif { color: var(--accent); }
.about__statement em.hl { font-style: normal; color: var(--mute); }
.about__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 44px; color: var(--mute); }
.about__cols p + p { margin-top: 14px; }
.about__cols strong { color: var(--text); font-weight: 500; }
.now { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; background: var(--bg-raise); }
.now h3 { display: flex; align-items: center; gap: 10px; color: var(--text); }
.now ul li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--mute); font-size: 15px; }
.now ul li span:first-child { color: var(--dim); flex: 0 0 104px; padding-top: 2px; }
@media (max-width: 520px) {
  .now ul li { flex-direction: column; gap: 4px; }
  .now ul li span:first-child { flex: none; }
}
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; gap: 0; }
  .about > .spacer { display: none; }
  .about__cols { grid-template-columns: 1fr; }
}

/* =============================================================================
   RESEARCH SPOTLIGHT
   ============================================================================= */
.spotlight {
  position: relative; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: calc(var(--radius) + 6px);
  background: var(--bg-raise);
  display: grid; grid-template-columns: 1fr 1.1fr;
}
.spotlight__body { padding: clamp(24px, 4vw, 52px); display: flex; flex-direction: column; gap: 20px; }
.spotlight__body h3 { font-size: clamp(1.6rem, 3vw, 2.5rem); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; }
.spotlight__body p { color: var(--mute); }
.spotlight__points li { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--mute); font-size: 15.5px; }
.spotlight__points li b { color: var(--text); font-weight: 500; }
.spotlight__points li::before { content: "→"; color: var(--accent); font-family: var(--font-mono); }
.spotlight__links { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-top: auto; padding-top: 8px; }
.spotlight__viz {
  position: relative; border-left: 1px solid var(--line);
  background:
    linear-gradient(var(--viz-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--viz-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--viz-bg);
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: clamp(20px, 3vw, 40px);
}
.spotlight__viz svg { width: 100%; height: auto; overflow: visible; }
.spotlight__viz figcaption { color: var(--mute); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pipe-box { fill: var(--bg-raise); stroke: var(--line-strong); stroke-width: 1; }
.pipe-box--accent { fill: var(--accent-soft); stroke: var(--accent); }
.pipe-text { fill: var(--text); font-family: var(--font-sans); font-size: 13px; font-weight: 600; }
.pipe-sub { fill: var(--mute); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; }
.pipe-flow { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 5; animation: flow 1.4s linear infinite; }
.pipe-flow--mute { stroke: var(--mute); opacity: 0.7; }
@keyframes flow { to { stroke-dashoffset: -18; } }
@media (max-width: 960px) {
  .spotlight { grid-template-columns: 1fr; }
  .spotlight__viz { border-left: 0; border-top: 1px solid var(--line); }
}

/* =============================================================================
   EXPERIENCE — expandable rows
   ============================================================================= */
.rows { border-top: 1px solid var(--line-strong); }
.row { border-bottom: 1px solid var(--line-strong); position: relative; }
.row__btn {
  position: relative; width: 100%; text-align: left;
  display: grid; grid-template-columns: 190px 1fr auto 40px; gap: 24px; align-items: center;
  padding: clamp(20px, 2.4vw, 30px) 8px;
  isolation: isolate;
}
.row__btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent-soft);
  transform: scaleY(0); transform-origin: 50% 100%;
  transition: transform 0.5s var(--ease);
}
.row__btn:hover::before, .row.is-open .row__btn::before { transform: scaleY(1); }
.row__date { color: var(--dim); }
.row__title { font-size: clamp(1.2rem, 2.3vw, 1.9rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; transition: transform 0.5s var(--ease); }
.row__btn:hover .row__title { transform: translateX(8px); }
.row__title .at { color: var(--mute); font-weight: 400; }
.row__kind { color: var(--dim); }
.row__icon { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; transition: transform 0.5s var(--ease), background-color 0.3s var(--ease), border-color 0.3s; }
.row__icon svg { width: 12px; height: 12px; }
.row.is-open .row__icon { transform: rotate(45deg); background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.row__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.6s var(--ease); }
.row.is-open .row__panel { grid-template-rows: 1fr; }
.row__panel > div { overflow: hidden; }
.row__content { display: grid; grid-template-columns: 190px 1fr 74px; gap: 24px; padding: 0 8px 28px; }
.row__content ul { display: flex; flex-direction: column; gap: 10px; color: var(--mute); max-width: 72ch; }
.row__content li { display: flex; gap: 12px; }
.row__content li::before { content: "—"; color: var(--accent); }
.row__org { color: var(--dim); }
@media (max-width: 760px) {
  .row__btn { grid-template-columns: 1fr 34px; gap: 6px 14px; }
  .row__date { grid-column: 1; order: -1; }
  .row__kind { display: none; }
  .row__icon { grid-row: 1 / span 2; grid-column: 2; }
  .row__content { grid-template-columns: 1fr; gap: 10px; }
}

/* =============================================================================
   SELECTED WORK
   ============================================================================= */
.work-list { border-top: 1px solid var(--line-strong); }
.work {
  position: relative; display: grid; grid-template-columns: 70px 1.3fr 1fr 44px; gap: 24px; align-items: center;
  padding: clamp(22px, 3vw, 36px) 8px; border-bottom: 1px solid var(--line-strong);
  isolation: isolate; overflow: hidden;
}
.work::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--text);
  clip-path: inset(0 100% 0 0); transition: clip-path 0.7s var(--ease);
}
.work:hover::before, .work:focus-visible::before { clip-path: inset(0 0 0 0); }
.work, .work * { transition: color 0.45s var(--ease); }
.work:hover, .work:hover .work__num, .work:hover .work__sum, .work:hover .tag { color: var(--bg); }
.work:hover .tag { border-color: color-mix(in srgb, var(--bg) 30%, transparent); background: transparent; }
.work__num { color: var(--dim); }
.work__title { font-size: clamp(1.5rem, 3.4vw, 2.9rem); font-weight: 700; letter-spacing: -0.045em; line-height: 1.02; }
.work__side { display: flex; flex-direction: column; gap: 12px; }
.work__sum { color: var(--mute); font-size: 15px; line-height: 1.5; }
.work__arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; transition: transform 0.5s var(--ease), border-color 0.3s; }
.work__arrow svg { width: 14px; height: 14px; }
.work:hover .work__arrow { transform: rotate(-45deg); border-color: var(--bg); }
.work-foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 32px; }
@media (max-width: 860px) {
  .work { grid-template-columns: 40px 1fr 40px; gap: 12px 14px; }
  .work__side { grid-column: 2 / 3; }
  .work__arrow { grid-row: 1; grid-column: 3; width: 36px; height: 36px; }
}

/* =============================================================================
   PUBLICATIONS
   ============================================================================= */
.pubs { border-top: 1px solid var(--line-strong); }
.pub {
  display: grid; grid-template-columns: 90px 1fr 220px; gap: 24px;
  padding: 28px 8px; border-bottom: 1px solid var(--line);
  transition: background-color 0.4s var(--ease);
}
.pub:hover { background: var(--accent-soft); }
.pub:target { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pub__year { font-family: var(--font-mono); color: var(--dim); font-size: 13px; padding-top: 4px; }
.pub__title { font-size: clamp(1.1rem, 1.7vw, 1.35rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.pub__authors { color: var(--mute); font-size: 14.5px; margin-top: 8px; }
.pub__authors b { color: var(--text); font-weight: 600; }
.pub__venue { color: var(--dim); font-size: 14.5px; margin-top: 4px; }
.pub__venue em { color: var(--mute); }
.pub__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.pub__links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
@media (max-width: 860px) {
  .pub { grid-template-columns: 1fr; gap: 10px; }
  .pub__aside { align-items: flex-start; }
  .pub__links { justify-content: flex-start; }
}

/* =============================================================================
   EDUCATION
   ============================================================================= */
.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.degree { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: clamp(22px, 3vw, 36px); background: var(--bg-raise); display: flex; flex-direction: column; gap: 22px; }
.degree__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.degree h3 { font-size: clamp(1.35rem, 2.2vw, 1.8rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; }
.degree__school { color: var(--mute); margin-top: 6px; }
.degree__gpa { text-align: right; }
.degree__gpa b { display: block; font-size: 2.2rem; letter-spacing: -0.04em; line-height: 1; }
.degree__gpa span { color: var(--dim); }
.honors li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--mute); font-size: 15px; }
.honors li::before { content: "✦"; color: var(--accent); font-size: 11px; padding-top: 4px; }
.honors a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.degree__foot { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: auto; }
@media (max-width: 860px) { .edu { grid-template-columns: 1fr; } }

/* =============================================================================
   TOOLKIT
   ============================================================================= */
.marquee { overflow: hidden; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); padding: 22px 0; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track { display: flex; gap: 48px; width: max-content; animation: marquee 48s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span { font-size: clamp(1.6rem, 3.4vw, 2.8rem); font-weight: 700; letter-spacing: -0.04em; white-space: nowrap; display: inline-flex; align-items: center; gap: 48px; }
.marquee__track span::after { content: "✦"; font-size: 0.5em; color: var(--accent); }
.marquee__track span:nth-child(even) { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--mute); letter-spacing: -0.01em; }
@keyframes marquee { to { transform: translateX(-50%); } }

.stack { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 48px; border-top: 1px solid var(--line); }
.stack__col { padding: 24px 20px 8px 0; }
.stack__col + .stack__col { padding-left: 20px; border-left: 1px solid var(--line); }
.stack__col h3 { color: var(--accent); margin-bottom: 14px; font-weight: 500; }
.stack__col li { padding: 6px 0; color: var(--mute); font-size: 15px; border-bottom: 1px dashed var(--line); }
@media (max-width: 960px) {
  .stack { grid-template-columns: 1fr 1fr; }
  .stack__col:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 520px) {
  .stack { grid-template-columns: 1fr; }
  .stack__col + .stack__col { border-left: 0; padding-left: 0; }
}

/* =============================================================================
   CERTS & ACTIVITIES
   ============================================================================= */
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 56px; }
.extras h3 { margin-bottom: 8px; color: var(--dim); font-weight: 500; }
.list-link { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.list-link__main { display: flex; flex-direction: column; gap: 3px; }
.list-link__main b { font-weight: 600; letter-spacing: -0.01em; }
.list-link__main span { color: var(--mute); font-size: 14.5px; }
a.list-link:hover b { color: var(--accent); }
.list-link .tag { flex-shrink: 0; }
@media (max-width: 860px) { .extras { grid-template-columns: 1fr; } }

/* =============================================================================
   CONTACT / FOOTER
   ============================================================================= */
.contact { padding: clamp(96px, 14vw, 180px) 0 28px; border-top: 1px solid var(--line-strong); position: relative; overflow: hidden; }
.contact__kicker { color: var(--mute); display: flex; align-items: center; gap: 10px; }
.contact h2 { font-size: clamp(3rem, 10vw, 9.5rem); font-weight: 800; letter-spacing: -0.06em; line-height: 0.9; margin-top: 24px; }
.contact h2 .serif { font-weight: 400; color: var(--accent); }
.contact__mail {
  display: inline-flex; align-items: center; gap: 14px; margin-top: 40px;
  font-size: clamp(1.25rem, 3.6vw, 2.6rem); letter-spacing: -0.03em; font-weight: 500;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat;
  padding-bottom: 6px; transition: color 0.3s var(--ease), background-size 0.5s var(--ease);
  word-break: break-all;
}
.contact__mail:hover { color: var(--accent); }
.contact__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.copy-btn[data-copied="true"] { color: var(--ok); border-color: var(--ok); }
.contact__grid { display: grid; grid-template-columns: repeat(3, 1fr) 1.4fr; gap: 24px; margin-top: clamp(64px, 9vw, 120px); padding-top: 28px; border-top: 1px solid var(--line); }
.contact__grid h3 { color: var(--dim); font-weight: 500; margin-bottom: 12px; }
.contact__grid li { padding: 4px 0; }
.contact__grid a { color: var(--mute); transition: color 0.2s; }
.contact__grid a:hover { color: var(--text); }
.contact__grid p { color: var(--mute); }
.footer-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 56px; color: var(--dim); }
.footer-bar button:hover { color: var(--text); }
@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr 1fr; } }

/* =============================================================================
   SUB-PAGE SHELL (projects.html, thesis.html)
   ============================================================================= */
.page-hero { padding-top: calc(var(--nav-h) + clamp(56px, 9vw, 120px)); padding-bottom: clamp(40px, 6vw, 72px); }
.page-hero__crumb { display: flex; gap: 10px; color: var(--dim); margin-bottom: 22px; }
.page-hero__crumb a:hover { color: var(--text); }
.page-hero h1 { font-size: clamp(3.2rem, 11vw, 9rem); font-weight: 800; letter-spacing: -0.06em; line-height: 0.88; }
.page-hero h1 .serif { font-weight: 400; color: var(--accent); }
.page-hero__lede { margin-top: 28px; max-width: 62ch; color: var(--mute); font-size: clamp(1.05rem, 1.5vw, 1.2rem); }
.page-hero .tags { margin-top: 24px; }

/* ---------- view transitions between pages ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtOut 0.35s var(--ease) both; }
::view-transition-new(root) { animation: vtIn 0.55s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(18px); } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js [data-reveal], .js [data-split] .w > span, .js [data-line] { opacity: 1; transform: none; filter: none; }
  .marquee__track { animation: none; }
  .loader { display: none; }
}

/* menu button morphs into a close icon */
.menu-btn .bar { transform-origin: 12px 12px; transition: transform 0.45s var(--ease); }
.menu-btn[aria-expanded="true"] .bar--1 { transform: translateY(4px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bar--2 { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 520px) {
  .hero__name { font-size: 23vw; }
  .hero__ctas .btn { flex: 1 1 auto; justify-content: center; }
}

/* research interests block (About) */
.ri { display: grid; grid-template-columns: 220px 1fr; gap: 28px 40px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line-strong); }
.ri h3 { color: var(--accent); font-weight: 500; line-height: 1.5; }
.ri__lede { color: var(--mute); max-width: 68ch; }
.ri__lede strong { color: var(--text); font-weight: 500; }
.ri__list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin-top: 20px; }
.ri__list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--mute); font-size: 15px; }
.ri__list li::before { content: "✦"; color: var(--accent); font-size: 10px; padding-top: 5px; }
@media (max-width: 860px) { .ri { grid-template-columns: 1fr; } .ri__list { grid-template-columns: 1fr; } }

/* education: three degrees */
.edu { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.degree__thesis { color: var(--mute); font-size: 15px; line-height: 1.55; }
.degree__thesis .mono { color: var(--dim); margin-right: 6px; }
.degree__thesis em { color: var(--text); font-style: italic; }

/* publications note */
.pubs__note { color: var(--dim); margin-bottom: 18px; }
