/* ============================================================
   THEME — high-contrast, art-directed. Navy accent.
   Edit variables to restyle everything.
   ============================================================ */
:root, [data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-2: #131316;
  --text: #f4f2ec;
  --text-soft: #adaaa2;
  --text-faint: #6a6863;
  --accent: #4266b8;           /* navy blue (bright enough on near-black) */
  --accent-2: #8fb3ff;
  --line: rgba(244, 242, 236, 0.14);
  --line-2: rgba(244, 242, 236, 0.28);
  --grain: 0.05;

  /* ---- TYPE SCALE (tune here) ------------------------------- */
  --fs-display: clamp(3rem, 9vw, 7rem);      /* hero name        */
  --fs-contact: clamp(2.8rem, 10vw, 6.5rem); /* big contact word */
  --fs-h2:      clamp(1.7rem, 3.4vw, 2.6rem);/* section titles   */
  --fs-h3:      1.22rem;                      /* entry titles     */
  --fs-statement: clamp(1.3rem, 2.6vw, 2rem);/* research line    */
  --fs-lead:    clamp(1.05rem, 1.4vw, 1.2rem);
  --fs-body:    1rem;
  --fs-mono:    0.78rem;
}
[data-theme="light"] {
  --bg: #efece3;
  --bg-2: #e4e0d4;
  --text: #131210;
  --text-soft: #55524b;
  --text-faint: #928d81;
  --accent: #274690;           /* navy (deeper for light bg) */
  --accent-2: #3a5bb5;
  --line: rgba(19, 18, 16, 0.16);
  --line-2: rgba(19, 18, 16, 0.30);
  --grain: 0.035;
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 17px; line-height: 1.65; letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  transition: background .5s ease, color .5s ease;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
mark { background: transparent; color: var(--accent); }
::selection { background: var(--accent); color: #fff; }
section { scroll-margin-top: 88px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
strong { font-weight: 600; }

@media (hover: hover) and (pointer: fine) {
  .cursor-on, .cursor-on a, .cursor-on button, .cursor-on [data-cursor] { cursor: none; }
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor { position: fixed; top: 0; left: 0; z-index: 950; pointer-events: none; mix-blend-mode: difference; display: none; }
@media (hover: hover) and (pointer: fine) { .cursor { display: block; } }
.cursor__dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); }
.cursor__ring { position: absolute; width: 36px; height: 36px; border-radius: 50%; border: 1px solid #fff; transform: translate(-50%, -50%); transition: width .25s, height .25s, opacity .25s; }
.cursor.is-hover .cursor__ring { width: 58px; height: 58px; }
.cursor.is-big .cursor__ring { width: 90px; height: 90px; opacity: .5; }
.cursor__label { position: absolute; transform: translate(-50%, -50%); color: #fff; font-family: "JetBrains Mono", monospace; font-size: 11px; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.cursor.is-hover .cursor__label { opacity: 1; }

/* ============================================================
   FILM GRAIN
   ============================================================ */
.grain {
  position: fixed; inset: -100%; z-index: 900; pointer-events: none;
  opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(3) infinite;
}
@keyframes grain { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-4%,3%)} 66%{transform:translate(3%,-4%)} }

/* ============================================================
   NAV
   ============================================================ */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; gap: 22px; padding: 16px 32px; background: linear-gradient(var(--bg), transparent); transition: background .3s; }
.nav.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nav__brand { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.nav__brand span { color: var(--accent); }
.nav__clock { font-size: .72rem; color: var(--text-faint); margin-right: auto; letter-spacing: .04em; }
.nav__links { display: flex; gap: 2px; }
.nav__link { font-family: "JetBrains Mono", monospace; font-size: .74rem; color: var(--text-soft); padding: 8px 11px; border-radius: 999px; display: inline-flex; align-items: baseline; gap: 6px; transition: color .2s, background .2s; }
.nav__link i { font-style: normal; font-size: .6rem; color: var(--text-faint); }
.nav__link:hover { color: var(--text); }
.nav__link.is-active { color: #fff; background: var(--accent); }
.nav__link.is-active i { color: #fff; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: transparent; border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: border-color .2s, color .2s; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.nav__burger { display: none; }

/* ============================================================
   KINETIC TYPE REVEAL
   ============================================================ */
.kin { display: block; overflow: hidden; }
.kin > span { display: block; transform: translateY(115%) rotate(3deg); transform-origin: left; transition: transform 1s cubic-bezier(.16,1,.3,1); }
.is-visible .kin > span, .kin.is-visible > span { transform: none; }
.outline { color: transparent; -webkit-text-stroke: 1.4px var(--text); }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.kin-lines .word { display: inline-block; opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s cubic-bezier(.16,1,.3,1); }
.kin-lines.is-visible .word { opacity: 1; transform: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; padding-top: 80px; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero__inner { position: relative; z-index: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 40px 32px; display: grid; grid-template-columns: 1.5fr 0.9fr; gap: 50px; align-items: center; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: "JetBrains Mono", monospace; font-size: .8rem; color: var(--text-soft); margin-bottom: 18px; }
.hero__eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2.2s 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} }
.hero__title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: var(--fs-display); line-height: .9; letter-spacing: -0.04em; margin-bottom: 24px; }
.hero__lead { font-size: var(--fs-lead); color: var(--text-soft); max-width: 42ch; margin-bottom: 26px; }
.hero__lead strong { color: var(--text); }
.hero__enter { display: inline-flex; align-items: center; gap: 12px; font-family: "JetBrains Mono", monospace; font-size: .82rem; color: var(--text); }
.hero__enter svg { transition: transform .3s, color .3s; }
.hero__enter:hover svg { transform: translateY(5px); color: var(--accent); }

/* PHOTO */
.hero__photo { display: flex; justify-content: center; }
.photo {
  position: relative; width: 100%; max-width: 300px; aspect-ratio: 4/5;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line-2);
  background: radial-gradient(120% 90% at 70% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), var(--bg-2);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo__ph {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  text-align: center; color: var(--text-faint); font-size: .82rem; letter-spacing: .1em; line-height: 1.5;
}
.photo--empty .photo__ph { display: flex; }
.photo__cap { position: absolute; left: 12px; bottom: 12px; font-size: .68rem; color: var(--text); mix-blend-mode: difference; }

/* ============================================================
   MARQUEE
   ============================================================ */
.marq { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.marq__row { display: inline-flex; gap: 28px; align-items: center; white-space: nowrap; will-change: transform; }
.marq__row span { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.7rem; letter-spacing: -0.02em; }
.marq__row b { color: var(--accent); font-size: 1rem; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { max-width: 1240px; margin: 0 auto; padding: 100px 32px; }
.section__head { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 20px; margin-bottom: 48px; padding-top: 26px; }
/* accent rule that draws across the top of each section header on reveal */
.section__head::before { content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); transition: width 1.1s cubic-bezier(.16,1,.3,1) .05s; }
.section__head.is-visible::before { width: 100%; }
.section__num { font-size: .78rem; color: var(--accent); }
.section__title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: var(--fs-h2); letter-spacing: -0.02em; line-height: 1; grid-column: 2; }
.section__note { font-size: .74rem; color: var(--text-faint); }
.section__note a:hover { color: var(--accent); }

/* ============================================================
   UNIFIED LIST (education, conferences, teaching)
   ============================================================ */
.list { list-style: none; }
.entry {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 28px; align-items: start;
  padding: 26px 6px; border-top: 1px solid var(--line);
  transition: padding-left .35s cubic-bezier(.16,1,.3,1), opacity .6s ease, transform .6s cubic-bezier(.16,1,.3,1);
}
/* staggered entrance when the list scrolls into view (container stays put; items animate) */
.list.reveal { opacity: 1; transform: none; }
.list.reveal .entry { opacity: 0; transform: translateY(18px); }
.list.reveal.is-visible .entry { opacity: 1; transform: none; }
.list.reveal.is-visible .entry:nth-child(1) { transition-delay: .06s, .06s, .06s; }
.list.reveal.is-visible .entry:nth-child(2) { transition-delay: .14s, .14s, .14s; }
.list.reveal.is-visible .entry:nth-child(3) { transition-delay: .22s, .22s, .22s; }
.list.reveal.is-visible .entry:nth-child(4) { transition-delay: .30s, .30s, .30s; }
.list.reveal.is-visible .entry:nth-child(5) { transition-delay: .38s, .38s, .38s; }
.list.reveal.is-visible .entry:nth-child(6) { transition-delay: .46s, .46s, .46s; }
.list .entry:last-child { border-bottom: 1px solid var(--line); }
.entry:hover { padding-left: 14px; }
.entry__year { font-size: .82rem; color: var(--accent); padding-top: 4px; white-space: nowrap; }
.entry__title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: var(--fs-h3); letter-spacing: 0; line-height: 1.3; margin-bottom: 6px; transition: color .2s; }
.entry:hover .entry__title { color: var(--accent); }
.entry__meta { font-size: .95rem; color: var(--text-soft); }
.entry__meta strong { color: var(--text); }
.entry__desc { font-size: .95rem; line-height: 1.55; color: var(--text-soft); margin-top: 6px; }
.entry__desc i { font-style: italic; color: var(--text); }
.entry__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.entry__links a { font-family: "JetBrains Mono", monospace; font-size: .74rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-soft); transition: all .2s; }
.entry__links a:hover { border-color: var(--accent); color: var(--accent); }
.entry__side { font-size: .78rem; color: var(--text-faint); padding-top: 4px; white-space: nowrap; text-align: right; }

/* Collapsible abstract */
.abstract { margin-top: 12px; }
.abstract > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-family: "JetBrains Mono", monospace; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); width: fit-content;
}
.abstract > summary::-webkit-details-marker { display: none; }
.abstract > summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 16px; height: 16px;
  border: 1px solid var(--accent); border-radius: 4px; font-size: .8rem; line-height: 1;
  transition: background .2s, color .2s;
}
.abstract[open] > summary::before { content: "–"; background: var(--accent); color: var(--bg); }
.abstract > summary:hover::before { background: var(--accent); color: var(--bg); }
.abstract__body {
  margin-top: 12px; max-width: 74ch; font-size: .92rem; line-height: 1.65; color: var(--text-soft);
  padding-left: 14px; border-left: 2px solid var(--line-2);
  animation: abstract-in .4s cubic-bezier(.16,1,.3,1);
}
.abstract__body sub, .abstract__body sup { font-size: .72em; }
@keyframes abstract-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   RESEARCH MAP
   ============================================================ */
.section--map { position: relative; }
.research__statement { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: var(--fs-statement); line-height: 1.25; letter-spacing: -0.02em; max-width: 30ch; margin: -20px 0 44px; }
.mapwrap { display: block; }
.papers__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 8px; }

/* CV download card */
.cvcard {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px 30px; border: 1px solid var(--line-2); border-radius: 18px;
  background: radial-gradient(120% 160% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%), var(--bg-2);
}
.cvcard__title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 4px; }
.cvcard__sub { color: var(--text-soft); font-size: .98rem; max-width: 52ch; }
.cvcard__btn {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 14px 24px; border-radius: 999px; background: var(--accent); color: #fff;
  font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1rem;
  transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .25s;
}
.cvcard__btn svg { transition: transform .25s; }
.cvcard__btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -12px var(--accent); }
.cvcard__btn:hover svg { transform: translateY(3px); }
.graph { position: relative; min-height: 560px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: radial-gradient(55% 55% at 50% 45%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--bg-2); }
.graph__edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.node { position: absolute; top: 0; left: 0; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; white-space: nowrap; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: .9rem; cursor: grab; user-select: none; touch-action: none; transition: border-color .2s, background .2s, color .2s, box-shadow .2s; }
.node::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.node:hover, .node.is-active { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.node.is-active { background: var(--accent); color: #fff; }
.node.is-active::before { background: #fff; }
.node.is-dragging { cursor: grabbing; }
.graph__panel { border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--bg-2); }
.graph__panel-idx { font-size: .78rem; color: var(--accent); margin-bottom: 12px; }
.graph__panel-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: 10px; line-height: 1.1; }
.graph__panel-text { color: var(--text-soft); font-size: 1rem; }

/* ============================================================
   CV
   ============================================================ */
.cv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.cv__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cv__item { display: grid; grid-template-columns: 72px 1fr; gap: 14px; margin-bottom: 20px; font-size: .98rem; }
.cv__item .mono { font-size: .8rem; color: var(--accent); padding-top: 2px; }
.cv__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-family: "JetBrains Mono", monospace; font-size: .78rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-soft); transition: all .2s; }
.pill:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   CONTACT
   ============================================================ */
.section--contact { max-width: 1240px; margin: 0 auto; padding: 100px 32px 80px; }
.section--contact .section__num { display: block; margin-bottom: 18px; }
.contact__big { display: block; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: var(--fs-contact); line-height: .85; letter-spacing: -0.04em; margin-bottom: 36px; }
.contact__big .outline { transition: -webkit-text-stroke-color .3s, color .3s; }
.contact__big:hover .outline { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.contact__row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding-top: 26px; border-top: 1px solid var(--line); }
.contact__email { font-size: 1rem; color: var(--text-soft); }
.contact__socials { display: flex; flex-wrap: wrap; gap: 22px; }
.contact__socials a { font-family: "JetBrains Mono", monospace; font-size: .88rem; color: var(--text-soft); position: relative; transition: color .2s; }
.contact__socials a::after { content: ""; position: absolute; left: 0; bottom: -3px; height: 1px; width: 0; background: var(--accent); transition: width .25s; }
.contact__socials a:hover { color: var(--text); }
.contact__socials a:hover::after { width: 100%; }

/* FOOTER */
.footer { max-width: 1240px; margin: 0 auto; padding: 26px 32px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; font-size: .74rem; color: var(--text-faint); }
.footer a:hover { color: var(--accent); }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reveal, .kin > span, .kin-lines .word, .list.reveal .entry { opacity: 1; transform: none; transition: none; }
  .section__head::before { transition: none; width: 100%; }
  .grain, .hero__eyebrow .dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .mapwrap { grid-template-columns: 1fr; }
  .graph { min-height: 420px; }
}
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; gap: 36px; }
  .hero__photo { order: -1; justify-content: flex-start; }
  .photo { max-width: 210px; }
  .cv { grid-template-columns: 1fr; gap: 30px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav { padding: 14px 20px; }
  .nav__clock { display: none; }
  .nav__links { position: fixed; inset: 60px 12px auto 12px; flex-direction: column; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .22s; }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__link { padding: 12px; }
  .nav__burger { display: grid; }
  .hero, .section, .section--contact { padding-left: 20px; padding-right: 20px; }
  .section { padding-top: 80px; padding-bottom: 80px; }
  .entry { grid-template-columns: 70px 1fr; gap: 16px; }
  .entry__side { grid-column: 2; text-align: left; padding-top: 0; }
  .marq__row span { font-size: 1.4rem; }
}
