/* ==========================================================================
   Kimia Abedini — research portfolio
   Palette: neobrutalism — warm surface, ink borders, vivid accents
   ========================================================================== */

:root {
  /* --- surfaces --------------------------------------------------------- */
  --bg:          #fbfbf9;          /* surface token */
  --bg-2:        #f1efe7;
  --surface:     #ffffff;
  --surface-2:   #fbfbf9;

  /* Ink is text, every border, and every shadow — the whole system leans
     on one near-black rather than a family of greys. */
  --ink:         #1c293c;          /* text token */
  --border:      #1c293c;
  --border-soft: #d7d4c8;

  /* --- accent tokens ---------------------------------------------------- */
  --primary:     #fdc800;
  --secondary:   #432dd7;
  --success:     #16a34a;
  --warning:     #d97706;
  --danger:      #dc2626;

  /* Aurora names kept as aliases so the rules below still read semantically.
     Text-facing variants are darkened: raw #fdc800 (1.4:1) and #16a34a
     (3.4:1) both fail AA as body text on --bg, so they are fills only. */
  --violet:      var(--secondary);
  --violet-lo:   #2e1da8;
  --violet-hi:   #5b47e0;
  --teal:        #0f7a38;          /* success, AA-safe as text  (5.4:1) */
  --mint:        #8a6a00;          /* primary, AA-safe as text  (5.4:1) */
  --pink:        var(--danger);

  /* --- type ------------------------------------------------------------- */
  --text:        #1c293c;          /* 14.1:1 on --bg */
  --text-dim:    #45536a;          /*  7.4:1 */
  --text-faint:  #66748a;          /*  4.6:1 — AA for normal text */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: var(--font-sans);   /* neobrutalism: one family, heavy weights */

  /* Type scale — 13/15/17/21/27/35 (neobrutalism design system) */
  --fs-13: 0.8125rem;
  --fs-15: 0.9375rem;
  --fs-17: 1.0625rem;
  --fs-21: 1.3125rem;
  --fs-27: 1.6875rem;
  --fs-35: 2.1875rem;

  /* --- geometry --------------------------------------------------------- */
  --radius:    16px;
  --radius-sm: 10px;

  /* --- neobrutalist card frame ------------------------------------------ */
  --card-border:  3px;
  --card-radius:  6px;
  --card-edge:    var(--ink);
  --card-shadow:  6px 6px 0 var(--ink);
  --card-shadow-hover: 9px 9px 0 var(--ink);
  /* Accent shadow marks featured / open state. */
  --card-shadow-teal:  6px 6px 0 var(--secondary);
  --card-shadow-teal-hover: 9px 9px 0 var(--secondary);
  --maxw:      1120px;
  --gutter:    clamp(20px, 5vw, 48px);

  /* Neobrutalism has no glows — "glow" is now a hard offset block. */
  --glow-violet: 5px 5px 0 var(--ink);
  --glow-teal:   5px 5px 0 var(--secondary);

  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ==========================================================================
   Reset-ish
   ========================================================================== */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--violet-hi); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;              /* neobrutalism: heavy display weight */
  line-height: 1.15;
  letter-spacing: -.025em;
  margin: 0;
}

::selection { background: var(--primary); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Ambient aurora wash behind everything below the hero */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 45% at 15% 0%,   rgba(253, 200,   0, .20), transparent 70%),
    radial-gradient(50% 40% at 85% 20%,  rgba( 67,  45, 215, .07), transparent 70%),
    radial-gradient(70% 50% at 50% 100%, rgba(253, 200,   0, .12), transparent 70%),
    var(--bg);
}

/* Subtle film grain so the big flat areas don't band */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

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

section { position: relative; padding-block: clamp(72px, 11vw, 132px); }

.section-head { margin-bottom: clamp(32px, 5vw, 56px); }

.section-kicker {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.section-kicker::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-soft), transparent);
}

.section-title { font-size: clamp(1.9rem, 4.6vw, 3rem); }

/* Marker-highlight instead of gradient text — solid fill, ink on primary. */
.section-title em {
  font-style: normal;
  background: var(--primary);
  color: var(--ink);
  box-shadow: 0 0 0 4px var(--primary);
  border-radius: 2px;
}

.section-sub {
  color: var(--text-dim);
  max-width: 62ch;
  margin-top: 14px;
  font-size: 1.02rem;
}

/* ==========================================================================
   Loader
   ========================================================================== */

#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  background: var(--bg);
  transition: opacity .7s var(--ease), visibility .7s;
}
#loader.done { opacity: 0; visibility: hidden; }

.loader-mark {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink);
}

.loader-bar {
  width: 190px;
  height: 8px;
  border: 2px solid var(--ink);
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar span {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--secondary);
  animation: slide 1.25s var(--ease) infinite;
}
@keyframes slide {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(430%); }
}

.loader-note {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--text-faint);
  letter-spacing: .06em;
}

/* ==========================================================================
   Nav
   ========================================================================== */

#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px var(--gutter);
  transition: background .35s var(--ease), border-color .35s var(--ease), padding .35s var(--ease);
  border-bottom: 2px solid transparent;
}
#nav.stuck {
  background: rgba(251, 251, 249, .88);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--ink);
  padding-block: 11px;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-brand .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--secondary);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.nav-links { display: flex; gap: 4px; align-items: center; }

.nav-links a {
  font-size: .875rem;
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: 999px;
  transition: color .25s, background .25s;
  position: relative;
}
.nav-links a:hover { color: var(--ink); background: rgba(67, 45, 215, .10); }
.nav-links a.active {
  color: var(--ink);
  background: var(--primary);
  box-shadow: 2px 2px 0 var(--ink);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  width: 40px; height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 100%; right: var(--gutter);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    min-width: 190px;
    background: var(--surface);
    border: 3px solid var(--ink);
    border-radius: var(--card-radius);
    box-shadow: 6px 6px 0 var(--ink);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: .28s var(--ease);
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
}

/* ==========================================================================
   Hero + 3D canvas
   ========================================================================== */

#hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding-block: 0;
  overflow: hidden;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#scene canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
/* The canvas is focusable so the arrow keys can drive the character without
   hijacking page scrolling. Keyboard users need to see that focus landed. */
#scene canvas:focus-visible { outline: 3px solid var(--secondary); outline-offset: -3px; }

/* Vignette so hero text stays readable over the 3D */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg,  rgba(251, 251, 249, .94) 0%, rgba(251, 251, 249, .55) 42%, transparent 68%),
    linear-gradient(180deg, rgba(251, 251, 249, .60) 0%, transparent 22%, transparent 72%, var(--bg) 100%);
}
@media (max-width: 960px) {
  /* Copy sits in the lower half on narrow screens — shade it heavily so the
     islands (pushed up by the frustum offset) never fight the text. */
  #hero::after {
    background:
      linear-gradient(180deg,
        rgba(251, 251, 249, .55) 0%,
        rgba(251, 251, 249, .10) 26%,
        rgba(251, 251, 249, .82) 46%,
        rgba(251, 251, 249, .96) 62%,
        var(--bg) 100%);
  }
  .hero-inner { padding-block: 46svh 84px; }
}

.hero-inner {
  position: relative;
  z-index: 2;
  pointer-events: none;
  padding-block: 120px 96px;
}
/* Only genuinely interactive elements may swallow clicks. The headings and the
   button row are full-width blocks — giving *those* pointer-events would let
   them eat clicks across the whole column and block the canvas behind them,
   which is exactly what broke focusing the scene. */
.hero-inner a,
.hero-inner button { pointer-events: auto; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--primary);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 26px;
}

.hero-name {
  font-size: clamp(2.9rem, 9vw, 6.1rem);
  line-height: .95;
  letter-spacing: -.045em;
  margin-bottom: 22px;
  max-width: 14ch;
}
.hero-name .l2 {
  display: block;
  color: var(--secondary);
}

.hero-role {
  font-size: clamp(1.02rem, 2.1vw, 1.28rem);
  color: var(--text-dim);
  max-width: 44ch;
  margin-bottom: 12px;
}
.hero-role strong { color: var(--text); font-weight: 600; }

.hero-typed {
  font-family: var(--font-mono);
  font-size: clamp(.86rem, 1.9vw, 1rem);
  color: var(--secondary);
  margin-bottom: 34px;
  min-height: 1.7em;
}
.hero-typed .caret {
  display: inline-block;
  width: 9px;
  background: var(--secondary);
  margin-left: 2px;
  animation: blink 1.05s steps(1) infinite;
  color: transparent;
}
@keyframes blink { 50% { opacity: 0; } }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: .92rem;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease),
              border-color .3s, background .3s, color .3s;
  font-family: inherit;
}
.btn:hover {
  transform: translate(-2px, -2px);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

.btn-primary {
  background: var(--primary);
  color: var(--ink);
  font-weight: 700;
}
.btn-primary:hover { color: var(--ink); }

.hero-scroll {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  pointer-events: none;
}
.hero-scroll .line {
  width: 1px; height: 34px;
  background: var(--ink);
  animation: drop 1.9s var(--ease) infinite;
}
@keyframes drop {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* --- 3D hints & island tooltip ------------------------------------------ */

.scene-hint {
  position: absolute;
  right: var(--gutter);
  bottom: 26px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text-faint);
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: opacity .5s;
}
.scene-hint.hide { opacity: 0; }
.scene-hint b { color: var(--secondary); font-weight: 700; }
.scene-hint.driving { border-color: var(--secondary); }
/* She is standing at a signpost — the prompt goes loud. */
.scene-hint.at-goal {
  background: var(--primary);
  border-color: var(--ink);
  color: var(--ink);
}
.scene-hint.at-goal b { color: var(--ink); }
@media (max-width: 860px) { .scene-hint { display: none; } }

#tooltip {
  position: fixed;
  z-index: 950;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -120%) scale(.94);
  transition: opacity .2s, transform .25s var(--ease);
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--card-radius);
  padding: 10px 14px;
  max-width: 260px;
  box-shadow: 5px 5px 0 var(--ink);
}
#tooltip.show { opacity: 1; transform: translate(-50%, -135%) scale(1); }
#tooltip .tt-label {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 3px;
}
#tooltip .tt-title { font-size: .9rem; font-weight: 600; line-height: 1.35; }
#tooltip .tt-hint { font-size: .72rem; color: var(--text-faint); margin-top: 5px; }

/* Fallback when WebGL is unavailable */
#scene-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  background:
    radial-gradient(50% 60% at 70% 40%, rgba(253, 200,   0, .35), transparent 70%),
    radial-gradient(40% 50% at 30% 70%, rgba( 67,  45, 215, .12), transparent 70%);
}
#scene-fallback.on { display: grid; }

/* ==========================================================================
   About
   ========================================================================== */

.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 280px; }
}

.portrait {
  position: relative;
  aspect-ratio: 1;
  border-radius: 24px;
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--bg-2);
  box-shadow: 8px 8px 0 var(--ink);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

/* Animated monogram used when no photo file is present */
.portrait .monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-family: var(--font-display);
  font-size: 5.4rem;
  font-weight: 600;
  letter-spacing: -.04em;
  color: var(--secondary);
}
}
.portrait .monogram-note {
  position: absolute;
  bottom: 14px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-faint);
  letter-spacing: .08em;
}

.about-body p { color: var(--text-dim); margin: 0 0 18px; font-size: 1.04rem; }
.about-body strong { color: var(--text); font-weight: 600; }
.about-body em { color: var(--mint); font-style: normal; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.chip {
  font-family: var(--font-mono);
  font-size: .74rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  transition: .18s var(--ease);
}
.chip:hover {
  background: var(--primary);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.advisors {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--ink);
  border-left: 8px solid var(--primary);
  background: var(--bg-2);
  font-size: .94rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Fun-fact marquee
   ========================================================================== */

.marquee {
  overflow: hidden;
  border-block: 3px solid var(--ink);
  background: var(--primary);
  padding-block: 15px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 42px;
  width: max-content;
  animation: marquee 34s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

.marquee-item {
  display: flex;
  align-items: center;
  gap: 42px;
  font-family: var(--font-mono);
  font-size: var(--fs-15);
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.marquee-item::after {
  content: '✦';
  color: var(--ink);
  font-size: .7rem;
}

/* ==========================================================================
   Publications
   ========================================================================== */

.pub-list { display: flex; flex-direction: column; gap: 18px; }

/* Publication cards share the card frame so both surfaces read as one system. */
.pub {
  position: relative;
  border: var(--card-border) solid var(--card-edge);
  border-radius: var(--card-radius);
  background: var(--surface-2);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease);
}
.pub:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--card-shadow-hover);
  background: var(--surface);
}
/* Open state is a persistent, distinct signal — teal, and sitting flat. */
.pub.open {
  transform: none;
  background: #fff8e1;
  box-shadow: var(--card-shadow-teal);
}
.pub.open:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--card-shadow-teal-hover);
}

.pub-head {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 22px;
  align-items: start;
  padding: 24px 26px;
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}
@media (max-width: 700px) {
  .pub-head { grid-template-columns: 1fr auto; gap: 14px; padding: 20px; }
  .pub-year { grid-column: 1 / -1; }
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--violet);
  line-height: 1.1;
}
.pub-year small {
  display: block;
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 4px;
}

.pub-title { font-size: var(--fs-17); line-height: 1.4; margin-bottom: 8px; }

.pub-authors { font-size: var(--fs-15); color: var(--text-dim); margin-bottom: 8px; }
.pub-authors .me { color: var(--mint); font-weight: 600; }

.pub-venue {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-faint);
}
.pub-venue .badge {
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--surface);
  border-radius: 4px;
  padding: 2px 7px;
  margin-right: 8px;
}

.pub-toggle {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 4px;
  border: 2px solid var(--ink);
  display: grid;
  place-content: center;
  color: var(--ink);
  background: var(--surface);
  transition: transform .18s var(--ease), border-color .18s, color .18s;
  font-size: var(--fs-17);
  font-weight: 700;
  line-height: 1;
}
.pub.open .pub-toggle {
  transform: rotate(45deg);
  background: var(--secondary);
  border-color: var(--ink);
  color: #ffffff;
}

.pub-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .45s var(--ease);
}
.pub.open .pub-body { grid-template-rows: 1fr; }
.pub-body-inner { overflow: hidden; }
.pub-body-pad { padding: 0 26px 26px; }
@media (max-width: 700px) { .pub-body-pad { padding: 0 20px 20px; } }

.pub-abstract {
  color: var(--text-dim);
  font-size: var(--fs-15);
  padding: 18px 20px;
  border-radius: var(--card-radius);
  background: var(--surface);
  border: 2px solid var(--ink);
  margin-bottom: 16px;
}
.pub-extra {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.tag {
  font-family: var(--font-mono);
  font-size: .7rem;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--ink);
  border: 2px solid var(--ink);
}

.res-row { display: flex; flex-wrap: wrap; gap: 9px; }
.res-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .82rem;
  font-family: var(--font-mono);
  padding: 7px 14px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  transition: .18s var(--ease);
}
.res-link svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
.res-link:hover {
  background: var(--primary);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.thesis-note {
  margin-top: 22px;
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  border: 3px dashed var(--ink);
  background: var(--bg-2);
  font-size: .92rem;
  color: var(--text-dim);
}
.thesis-note b { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Journey timeline
   ========================================================================== */

.timeline { position: relative; padding-left: 34px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--ink);
}

.tl-item { position: relative; padding-bottom: 40px; }
.tl-item:last-child { padding-bottom: 0; }

.tl-item::before {
  content: '';
  position: absolute;
  left: -34px; top: 7px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--ink);
  transition: .2s var(--ease);
}
.tl-item.now::before {
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(253, 200, 0, .35);
}
.tl-item:hover::before { transform: scale(1.25); }

.tl-period {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--teal);
  letter-spacing: .06em;
  margin-bottom: 5px;
}
.tl-title { font-size: 1.1rem; margin-bottom: 3px; }
.tl-org { color: var(--secondary); font-size: var(--fs-15); font-weight: 500; }
.tl-place { font-size: .85rem; color: var(--text-faint); margin-top: 2px; }
.tl-note { color: var(--text-dim); font-size: .93rem; margin-top: 9px; max-width: 62ch; }

.tl-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--primary);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1px 8px;
  margin-left: 9px;
  vertical-align: 3px;
}

/* ==========================================================================
   Cards grid (projects + teaching)
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 18px;
}

/* Neobrutalist frame: flat surface, thick edge, hard offset shadow.
   No gradients, no blur — the shadow is a solid block, not a glow. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: var(--card-radius);
  border: var(--card-border) solid var(--card-edge);
  background: var(--surface-2);
  box-shadow: var(--card-shadow);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              border-color .18s var(--ease), background .18s var(--ease);
  color: inherit;
}

/* Hover/focus push the card off its shadow — the canonical neobrutalist state. */
.card:hover,
.card:focus-visible {
  transform: translate(-3px, -3px);
  box-shadow: var(--card-shadow-hover);
  background: var(--surface);
}
.card:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--violet-lo); }
.card:focus-visible { outline: 3px solid var(--secondary); outline-offset: 4px; }

.card-emoji { font-size: var(--fs-27); line-height: 1; }
.card-title {
  font-size: var(--fs-17);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.card-title .arrow { color: var(--violet); transition: transform .3s var(--ease); }
.card:hover .card-title .arrow { transform: translate(3px, -3px); }
.card-blurb { color: var(--text-dim); font-size: var(--fs-15); flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text-dim);
}
.card-meta .lang { display: flex; align-items: center; gap: 6px; }
.card-meta .lang::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--violet);
}
/* Featured variant: same frame, different shadow colour — one signal, not three. */
.card.feat { box-shadow: var(--card-shadow-teal); }
.card.feat:hover,
.card.feat:focus-visible { box-shadow: var(--card-shadow-teal-hover); }
.card.feat:active { box-shadow: 3px 3px 0 #2aa892; }
.card.feat .card-meta .lang::before { background: var(--mint); }

.star {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--primary);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1px 7px;
}

.teach-role {
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--teal);
  letter-spacing: .06em;
}

/* ==========================================================================
   Contact
   ========================================================================== */

#contact { text-align: center; }

.contact-inner {
  border: 4px solid var(--ink);
  border-radius: var(--card-radius);
  padding: clamp(40px, 7vw, 76px) var(--gutter);
  background: var(--primary);
  box-shadow: 10px 10px 0 var(--ink);
  position: relative;
  overflow: hidden;
}

/* On the primary fill, invert the highlight and drop the accent colours —
   green-on-yellow and violet-on-yellow both fall under 4.5:1. */
.contact-inner .section-kicker { color: var(--ink); }
.contact-inner .section-kicker::after { background: var(--ink); opacity: .35; }
.contact-inner .section-title em {
  background: var(--ink);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--ink);
}
.contact-inner .section-sub { color: var(--ink); }

.contact-inner > * { position: relative; }

.social-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px;
  margin-top: 30px;
}
.social {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-15);
  font-weight: 500;
  box-shadow: 4px 4px 0 var(--ink);
  transition: .18s var(--ease);
}
.social:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}
.social:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.social svg { width: 17px; height: 17px; fill: currentColor; flex: none; }

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  border-top: 3px solid var(--ink);
  padding: 30px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--teal); }

.to-top {
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-13);
  transition: .18s var(--ease);
}
.to-top:hover {
  background: var(--primary);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

/* ==========================================================================
   Scroll reveal
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .75s var(--ease), transform .75s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .marquee-track,
  .hero-scroll .line,
  .nav-brand .dot { animation: none !important; }
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
