/* =========================================================================
   Edward Kempa — Research Portfolio (V14 design language)
   Lato · green→teal→blue gradient used as an accent · EEG hero motif
   Light + dark modes · multi-page (index / about / publications)
   ========================================================================= */

:root {
  --bg: #ffffff; --surface: #ffffff; --ink: #101820; --ink-2: #3d4f5c; --muted: #5d6e78;
  --line: #dde4e8; --line-2: #c6d3d9; --accent: #10747e; --accent-b: #19b2c1;
  --tint: #f1f8f7; --tint-2: #f4f8f5; --sage: #7d9364;
  --g1: #10747e; --g2: #1f6fb2;
  --grad: linear-gradient(115deg, var(--g1), var(--g2));
  --grad-fill: linear-gradient(115deg, #10747e, #1f6fb2);   /* behind white text */
  --shadow: 0 18px 40px -22px rgba(16, 68, 82, .34);
  --shadow-lg: 0 30px 60px -24px rgba(16, 68, 82, .4);
  --radius: 16px; --maxw: 1080px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html[data-theme="dark"] {
  --bg: #0c1418; --surface: #12212c; --ink: #edf3f5; --ink-2: #b9c8d0; --muted: #7e929d;
  --line: #24333b; --line-2: #33454f; --accent: #3ec6d3; --accent-b: #3ec6d3;
  --tint: #10242a; --tint-2: #14231b; --sage: #a3bd85;
  --g1: #19b2c1; --g2: #5297dc;
  --grad-fill: linear-gradient(115deg, #0e7380, #2a64a8);
  --shadow: 0 18px 40px -22px rgba(0,0,0,.6); --shadow-lg: 0 30px 60px -24px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden; transition: background .3s, color .3s; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-b); color: #fff; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.gt { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

#progress { position: fixed; top: 0; left: 0; width: 2px; height: 100vh; background: var(--grad); z-index: 90; transform: scaleY(0); transform-origin: top; will-change: transform; }

/* ---------------------------------- Nav ---------------------------------- */
.nav { position: sticky; top: 0; z-index: 60; display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(20px, 5vw, 40px); border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.nav__brand { font-weight: 900; font-size: 1.05rem; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.nav__mark { width: 20px; height: 20px; border-radius: 6px; background: var(--grad); transform: skewX(-10deg); }
.nav__links { display: flex; gap: 26px; }
.nav__links a { font-weight: 700; font-size: .9rem; color: var(--ink-2); position: relative; padding: 4px 0; }
.nav__links a::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 0; height: 1.5px; background: var(--grad); transition: width .3s var(--ease); }
.nav__links a:hover::after, .nav__links a.active::after { width: 100%; }
.nav__links a.active { color: var(--ink); }
.nav__actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: border-color .3s var(--ease), background-color .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease); }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; width: 19px; height: 19px; }
.theme-toggle__moon { display: none; }
html[data-theme="dark"] .theme-toggle__sun { display: none; }
html[data-theme="dark"] .theme-toggle__moon { display: block; }
.nav__burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav__burger span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: .3s var(--ease); }
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 820px) {
  .nav__links { position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 20px; transform: translateY(-140%); transition: transform .4s var(--ease); }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav__burger { display: flex; }
}

/* ---------------------------------- Buttons ---------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; padding: 14px 30px; font-weight: 700; font-size: .92rem; letter-spacing: .02em; border-radius: 10px; cursor: pointer; border: 1px solid transparent; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.btn--grad { background: var(--grad-fill); color: #fff; box-shadow: 0 8px 20px -10px rgba(16,116,126,.5); }
.btn--grad:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(16,116,126,.6); }
.btn--line { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn--line:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { padding: 9px 18px; font-size: .84rem; border-radius: 8px; }

/* ---------------------------------- Hero ---------------------------------- */
.hero { position: relative; min-height: 86vh; display: flex; align-items: center; padding: 80px 0 56px; overflow: hidden; }
.hero__bg { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 100vw; z-index: 0; pointer-events: none; }
/* readability: fade the visual behind the (left-aligned) text, keep it lively on the right */
.hero__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 2%, color-mix(in srgb, var(--bg) 55%, transparent) 34%, transparent 62%); }
html[data-theme="dark"] .hero__bg::after { background: linear-gradient(90deg, var(--bg) 2%, color-mix(in srgb, var(--bg) 60%, transparent) 36%, transparent 66%); }
.hero__text { position: relative; z-index: 2; max-width: 640px; }
@media (max-width: 880px) { .hero__bg::after { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 55%, transparent) 55%, var(--bg)); } }
.hero__kicker { font-size: .78rem; letter-spacing: .32em; text-transform: uppercase; font-weight: 700; margin-bottom: 24px; }
.hero h1 { font-weight: 900; font-size: clamp(3.2rem, 7.4vw, 5.8rem); letter-spacing: -.04em; line-height: .92; }
.hero h1 .l { display: inline-block; opacity: 0; transform: translateY(40px); animation: rise .8s var(--ease) forwards; }
.hero h1 .l:nth-child(2) { animation-delay: .12s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.hero__tagline { font-weight: 300; font-size: clamp(1.3rem, 3vw, 2rem); margin-top: 22px; color: var(--ink-2); }
.hero__tagline .gt { font-weight: 700; }
.hero__blurb { max-width: 520px; margin-top: 22px; color: var(--muted); font-size: 1.04rem; }
.hero__cta { margin-top: 34px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero__badge { margin-top: 36px; font-size: .87rem; color: var(--muted); }
.hero__badge b { color: var(--ink); }

@media (max-width: 880px) { .hero { min-height: 78vh; } }

/* ---------------------------------- Logo band ---------------------------------- */
.logos { border-top: 1px solid var(--ink); margin-top: 56px; padding: 32px 0 6px; }
.logos__label { font-size: .72rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 22px; }
.logos__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.logos__row + .logos__row { margin-top: 14px; }
/* Logos: bordered tiles; full colour on the tile in light mode, white silhouettes
   in dark (brightness(0) invert(1) flips every non-transparent pixel to white). */
.logo { flex: 0 0 calc((100% - 42px) / 4); display: flex; align-items: center; justify-content: center; height: 92px; padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; transition: transform .3s, box-shadow .3s, border-color .3s; }
@media (max-width: 900px) { .logo { flex-basis: calc((100% - 28px) / 3); } }
.logo:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.logo__img { width: 100%; height: 48px; background-position: center; background-repeat: no-repeat; background-size: contain; transition: filter .3s, opacity .3s; }
[data-theme="dark"] .logo__img { filter: brightness(0) invert(1); opacity: .92; }
[data-theme="dark"] .logo:hover .logo__img { opacity: 1; }
.venues { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.venue-chip { font-size: .8rem; font-weight: 700; color: var(--ink-2); border: 1px solid var(--line); border-radius: 100px; padding: 7px 16px; background: var(--surface); }
.venue-chip b { color: var(--accent); font-weight: 900; }
.venues:empty { display: none; }
@media (max-width: 720px) { .logo { flex-basis: calc((100% - 14px) / 2); } }

/* ---------------------------------- Stats ---------------------------------- */
.stats { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
.stat { padding: 30px 24px 30px 26px; border-left: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.stat:first-child { border-left: 0; padding-left: 0; }
.gauge { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 7; }
.gauge .track { stroke: var(--line); }
.gauge .val { stroke: url(#gaugeGrad); stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220; transition: stroke-dashoffset 1.6s var(--ease); }
.gauge.in .val { stroke-dashoffset: 4; }
.gauge b { position: absolute; inset: 0; display: grid; place-content: center; font-weight: 900; font-size: 1.08rem; }
.stat .txt b { display: block; font-weight: 900; font-size: 1.95rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .txt span, .stat .glabel { font-size: .82rem; color: var(--muted); font-weight: 700; }
.stat .spark { width: 100%; height: 20px; margin-top: 6px; display: block; }
.stat .spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 300; stroke-dashoffset: 300; }
.stat.in .spark polyline { animation: sparkdraw 1.4s ease forwards .3s; }
@keyframes sparkdraw { to { stroke-dashoffset: 0; } }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } .stat:nth-child(3) { border-left: 0; padding-left: 0; } }

/* ---------------------------------- Sections ---------------------------------- */
section { padding: 84px 0 40px; }
.page-head { padding: 76px 0 8px; }
.kicker { display: inline-block; font-weight: 900; font-size: .76rem; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 12px; }
h2 { font-weight: 900; font-size: clamp(1.7rem, 3.6vw, 2.5rem); letter-spacing: -.03em; }
.sub { color: var(--muted); max-width: 640px; margin: 10px 0 0; }
.rule { height: 1px; background: var(--ink); width: 100%; margin: 26px 0 34px; }

/* ---------------------------------- Talks hero (faint world map behind heading) ---------------------------------- */
.talks-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.talks-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.talks-hero__scrim { position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 100%); }
.talks-hero__inner { position: relative; z-index: 2; padding: 82px 28px 60px; }
.talks-hero h1 { font-weight: 900; font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.03em; line-height: 1.02; margin-top: 2px; }
.talks-hero .sub { margin-top: 14px; }
.talks-hero__meta { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 26px; }
.talks-hero__meta span { font-size: .82rem; color: var(--muted); font-weight: 700; }
.talks-hero__meta b { color: var(--ink); font-size: 1.2rem; font-weight: 900; letter-spacing: -.02em; margin-right: 2px; }
@media (max-width: 640px) { .talks-hero__inner { padding: 58px 22px 42px; } }

/* ---------------------------------- Project cards ---------------------------------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 13px; cursor: pointer;
  }
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.icochip { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; }
.icochip--grad { background: var(--grad-fill); color: #fff; }
.icochip--sage { background: var(--tint-2); color: var(--sage); }
.icochip--tint { background: var(--tint); color: var(--accent); }
.card__yr { font-size: .78rem; font-weight: 900; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.card h3 { font-weight: 900; font-size: 1.18rem; letter-spacing: -.02em; line-height: 1.25; }
.card__summary { color: var(--muted); font-size: .93rem; flex: 1; }
.card__kv { border-top: 1px solid var(--line); padding-top: 12px; font-size: .84rem; color: var(--ink-2); }
.card__kv b { color: var(--accent); font-weight: 900; }
.card__foot { display: flex; align-items: center; justify-content: space-between; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: .76rem; font-weight: 900; background: var(--tint); color: var(--accent); border-radius: 8px; padding: 4px 11px; }
.card__more { font-weight: 900; font-size: .82rem; color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.filter { padding: 8px 18px; border-radius: 100px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: .86rem; color: var(--ink-2); cursor: pointer; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter.active { background: var(--grad-fill); color: #fff; border-color: transparent; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

/* pointer card to another page/section */
.pointer { display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid var(--line); border-radius: 14px; padding: 26px 30px; margin-top: 40px; transition: border-color .3s; }
.pointer:hover { border-color: var(--accent); }
.pointer .t { font-weight: 900; font-size: 1.2rem; }
.pointer .d { color: var(--muted); font-size: .92rem; margin-top: 4px; max-width: 640px; }
@media (max-width: 720px) { .pointer { flex-direction: column; align-items: flex-start; } }

/* ---------------------------------- Modal ---------------------------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: none; }
.modal.open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: color-mix(in srgb, #0a1a22 62%, transparent); backdrop-filter: blur(6px); animation: fade .3s var(--ease); }
.modal__panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(760px, 92vw); max-height: 88vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .4s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
.modal__close { position: sticky; top: 16px; float: right; margin: 16px 16px 0 0; z-index: 5; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.modal__close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal__body { padding: 0 clamp(24px, 5vw, 44px) clamp(28px, 5vw, 44px); }
.mhead { padding-top: 22px; }
.mhead__kicker { font-size: .8rem; font-weight: 800; color: var(--accent); }
.mhead h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin: 8px 0; }
.mhead__meta { color: var(--muted); font-size: .88rem; font-weight: 700; }
.mbody p { color: var(--ink-2); font-size: 1.03rem; margin: 18px 0; }
.mmetrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 24px 0; }
.mmetric { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint); }
.mmetric__k { font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; }
.mmetric__v { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.mchart { margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; padding: 20px 18px; background: var(--surface); }
.mchart h4 { font-size: .95rem; margin-bottom: 4px; }
.mchart p { font-size: .84rem; color: var(--muted); margin-bottom: 14px; }
.mchart__canvas { position: relative; height: 260px; }
.mfig { margin: 22px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.mpipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 24px 0; }
.pnode { border: 1px solid var(--line); border-radius: 10px; padding: 14px 8px; text-align: center; background: var(--tint); position: relative; }
.pnode__t { font-weight: 800; font-size: .76rem; }
.pnode__d { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.pnode:not(:last-child)::after { content: "→"; position: absolute; right: -8px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 900; z-index: 2; }
@media (max-width: 620px) { .mpipeline { grid-template-columns: 1fr 1fr; } .pnode:not(:last-child)::after { display: none; } }
.mlinks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.mlink { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; font-size: .86rem; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.mlink:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.mlink--xp { background: var(--grad-fill); color: #fff; border-color: transparent; }
.mlink--xp:hover { color: #fff; transform: translateY(-2px); filter: brightness(1.06); }

/* ---------------------------------- Publications ---------------------------------- */
.yearlab { font-weight: 900; font-size: .82rem; letter-spacing: .22em; color: var(--muted); margin: 34px 0 14px; }
.pub { border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; margin-bottom: 14px;
  }
.pub:hover { border-color: var(--accent); }
.pub__yr { background: var(--grad-fill); color: #fff; font-weight: 900; border-radius: 10px; padding: 12px 16px; font-size: 1.02rem; }
.pub.alt .pub__yr { background: var(--tint); color: var(--accent); }
.pub__t { font-weight: 900; font-size: 1.06rem; line-height: 1.35; }
.pub__v { color: var(--muted); font-size: .9rem; margin-top: 5px; }
.pub__v strong { color: var(--ink-2); }
.pub__note { display: inline-block; margin-top: 9px; font-size: .74rem; font-weight: 900; padding: 3px 11px; border-radius: 7px; background: var(--tint); color: var(--accent); }
.pub__links { display: flex; flex-direction: column; gap: 8px; text-align: right; }
.pub__links a { font-weight: 900; color: var(--accent); font-size: .86rem; white-space: nowrap; }
.pub__links a:hover { text-decoration: underline; }
@media (max-width: 700px) { .pub { grid-template-columns: 1fr; gap: 10px; } .pub__yr { width: 84px; text-align: center; } .pub__links { flex-direction: row; text-align: left; } }

/* documents / outputs index */
.outgroup { margin-top: 34px; }
.outgroup h3 { font-size: 1.05rem; font-weight: 900; margin-bottom: 14px; }
.outlist { display: grid; gap: 10px; }
.outitem { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; transition: border-color .3s, transform .2s; }
.outitem:hover { border-color: var(--accent); transform: translateX(4px); }
.outitem .t { font-weight: 700; font-size: .96rem; }
.outitem .r { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.outitem .yr { color: var(--muted); font-size: .84rem; font-weight: 700; }
.outitem .go { color: var(--accent); font-weight: 900; font-size: .85rem; white-space: nowrap; }

/* ---------------------------------- About page ---------------------------------- */
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 52px; align-items: start; }
.about-lead p { font-size: 1.1rem; color: var(--ink-2); margin-bottom: 16px; }
.about-lead strong { color: var(--ink); }
.about-sig { font-style: italic; color: var(--accent); font-weight: 700; }
.pillars { display: grid; gap: 14px; }
.pillar { border: 1px solid var(--line); border-radius: 14px; padding: 22px; transition: border-color .3s, transform .3s; }
.pillar:hover { border-color: var(--accent); transform: translateX(4px); }
.pillar h3 { font-size: 1.06rem; font-weight: 900; margin-bottom: 5px; }
.pillar p { font-size: .93rem; color: var(--muted); }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 28px; } }

.cv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 52px; margin-top: 20px; }
.cv-h { font-size: 1.15rem; font-weight: 900; margin: 8px 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.cv-col > .cv-h:not(:first-child) { margin-top: 40px; }
.edu, .award { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.edu__top, .award__top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.edu__school { font-weight: 800; font-size: 1rem; }
.edu__date, .award__year { font-size: .82rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.edu__detail, .award__detail { font-size: .92rem; color: var(--muted); margin-top: 6px; }
.edu__tag { display: inline-block; margin-top: 8px; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 100px; background: var(--grad-fill); color: #fff; }
.award__title { font-weight: 800; font-size: .98rem; }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--g2)); }
.tl { position: relative; padding: 8px 0 16px; }
.tl::before { content: ""; position: absolute; left: -23px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl__role { font-weight: 800; font-size: 1rem; }
.tl__org { font-size: .9rem; color: var(--accent); font-weight: 700; }
.tl__date { font-size: .8rem; color: var(--muted); font-weight: 700; }
.tl__note { font-size: .9rem; color: var(--muted); margin-top: 3px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: .84rem; font-weight: 700; padding: 7px 14px; border-radius: 100px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.skillgroup { margin-bottom: 16px; }
.skillgroup__label { font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.skillgroup__items { display: flex; flex-wrap: wrap; gap: 7px; }
.skillgroup__items span { font-size: .84rem; font-weight: 700; padding: 6px 13px; border-radius: 8px; background: var(--tint); color: var(--accent); }
@media (max-width: 860px) { .cv-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ---------------------------------- Talks ---------------------------------- */
.talks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.talk { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .3s, transform .3s; }
.talk:hover { border-color: var(--accent); transform: translateY(-3px); }
.talk__video { position: relative; aspect-ratio: 16/9; background: #000; }
.talk__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.talk__ph { aspect-ratio: 16/9; display: grid; place-content: center; gap: 8px; text-align: center; color: #fff; background: var(--grad-fill); }
.talk__ph span { font-size: 2rem; } .talk__ph p { font-weight: 900; font-size: .9rem; opacity: .95; }
.talk__b { padding: 18px 20px 20px; }
.talk__b h3 { font-size: 1.05rem; font-weight: 900; }
.talk__b .v { font-size: .84rem; color: var(--accent); font-weight: 700; margin-top: 4px; }
.talk__b p { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.soon { display: inline-block; margin-top: 14px; font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 100px; padding: 5px 14px; }
@media (max-width: 720px) { .talks { grid-template-columns: 1fr; } }

/* ---------------------------------- Slide decks ---------------------------------- */
.deckgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.deck { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .3s, box-shadow .3s, transform .3s; display: flex; flex-direction: column; }
.deck:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.deck__cover { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--surface-2, #f2f6f7); cursor: pointer; aspect-ratio: 16 / 9; overflow: hidden; }
.deck__cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .5s var(--ease); }
.deck:hover .deck__cover img { transform: scale(1.04); }
.deck__badge { position: absolute; bottom: 12px; right: 12px; font-size: .74rem; font-weight: 900; color: #fff; background: rgba(8, 18, 24, .72); backdrop-filter: blur(4px); padding: 5px 12px; border-radius: 100px; }
.deck__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.deck__body h3 { font-size: 1.1rem; font-weight: 900; letter-spacing: -.01em; line-height: 1.25; }
.deck__venue { font-size: .86rem; color: var(--accent); font-weight: 800; }
.deck__meta { font-size: .82rem; color: var(--muted); }
.deck__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.deck__links .mlink { font-size: .82rem; padding: 9px 14px; cursor: pointer; }
button.mlink { font-family: inherit; color: var(--ink); }
button.mlink:hover { color: var(--accent); }
@media (max-width: 720px) { .deckgrid { grid-template-columns: 1fr; } }

/* ---------------------------------- Posters ---------------------------------- */
.postergrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.poster { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .3s, box-shadow .3s, transform .3s; }
.poster:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.poster__img { position: relative; display: block; width: 100%; border: 0; padding: 0; cursor: pointer; background: #fff; max-height: 420px; overflow: hidden; }
.poster__img img { width: 100%; height: auto; display: block; }
.poster__zoom { position: absolute; top: 12px; right: 12px; font-size: .74rem; font-weight: 900; color: #fff; background: color-mix(in srgb, var(--ink) 72%, transparent); backdrop-filter: blur(4px); padding: 5px 12px; border-radius: 100px; opacity: 0; transition: opacity .3s; }
.poster:hover .poster__zoom { opacity: 1; }
.poster__body { padding: 18px 22px 20px; }
.poster__body h3 { font-size: 1.04rem; font-weight: 900; line-height: 1.3; }
.poster__venue { font-size: .84rem; color: var(--muted); margin: 4px 0 12px; }
.poster__credit { font-size: .76rem; font-style: italic; color: var(--muted); margin: -6px 0 12px; padding: 6px 10px; border-left: 2px solid var(--line-2); background: var(--tint); border-radius: 0 8px 8px 0; }
@media (max-width: 720px) { .postergrid { grid-template-columns: 1fr; } }

/* ---------------------------------- Lightbox ---------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 250; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, #05131a 88%, transparent); backdrop-filter: blur(8px); padding: 40px 68px; }
.lightbox.open { display: flex; animation: fade .25s var(--ease); }
.lb__stage { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 100%; max-height: 100%; margin: 0; }
.lb__stage img { max-width: 100%; max-height: 82vh; border-radius: 8px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); background: #fff; }
.lb__stage figcaption { color: #cfe0e8; font-size: .88rem; font-weight: 700; text-align: center; }
.lb__count { color: #fff; font-weight: 900; }
.lb__close { position: fixed; top: 20px; right: 24px; width: 46px; height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.lb__close:hover { background: var(--accent); border-color: var(--accent); }
.lb__nav { position: fixed; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.lb__nav:hover { background: rgba(255,255,255,.2); }
.lb__prev { left: 18px; } .lb__next { right: 18px; }
@media (max-width: 640px) { .lightbox { padding: 20px 8px; } .lb__nav { width: 42px; height: 42px; font-size: 1.5rem; } .lb__prev { left: 6px; } .lb__next { right: 6px; } }

/* ---------------------------------- Explorers (interactive figures) ---------------------------------- */
.xp { padding-bottom: 30px; }
.xp__head { max-width: 720px; margin-bottom: 28px; }
.explorer { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.explorer__stage { position: relative; padding: clamp(16px, 3vw, 30px); min-height: 300px; }
.explorer__stage svg { display: block; width: 100%; height: auto; }
.explorer__caption { display: flex; align-items: baseline; gap: 12px; padding: 16px clamp(16px, 3vw, 30px); border-top: 1px dashed var(--line); min-height: 64px; }
.explorer__caption .stepno { font-weight: 900; font-size: 1.15rem; flex-shrink: 0; }
.explorer__caption p { color: var(--ink-2); font-size: .95rem; margin: 0; }
.xp-quote { margin-top: 8px !important; padding-left: 12px; border-left: 3px solid var(--accent); font-style: italic; color: var(--muted) !important; font-size: .9rem !important; }
.explorer__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 3vw, 30px); border-top: 1px solid var(--line); background: var(--tint); flex-wrap: wrap; }
.explorer__nav { display: flex; align-items: center; gap: 10px; }
.xbtn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 1.25rem; line-height: 1; cursor: pointer; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); display: grid; place-items: center; }
.xbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.xbtn:disabled { opacity: .35; cursor: default; }
.xbtn--play { width: auto; padding: 0 18px; font-size: .86rem; font-weight: 900; }
.xdots { display: flex; gap: 8px; align-items: center; }
.xdot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); background: none; padding: 0; cursor: pointer; transition: border-color .3s var(--ease), background-color .3s var(--ease), color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease); }
.xdot.on { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }
.explorer__src { font-size: .78rem; color: var(--muted); font-weight: 700; }
.explorer__src a { color: var(--accent); }

/* shared svg element states */
.explorer .xe { opacity: 0; transition: opacity .7s var(--ease), transform .7s var(--ease); }
.explorer .xe.on { opacity: 1; }
.explorer .xe--rise { transform: translateY(14px); }
.explorer .xe--rise.on { transform: none; }
.explorer .xe--dim.on { opacity: .28; }

/* sankey */
.sk-node rect { rx: 4; }
.sk-node text { font: 700 11px 'Lato', sans-serif; fill: var(--ink); }
.sk-node text.cnt { font-weight: 900; fill: var(--accent); }
.sk-node text.onbar { fill: #fff; }
.sk-col-label { font: 900 10.5px 'Lato', sans-serif; fill: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.sk-link { fill-opacity: .34; transition: fill-opacity .3s; }
.sk-link:hover { fill-opacity: .62; }
.sk-quote { font: italic 700 12px 'Lato', sans-serif; fill: var(--ink-2); }

/* dataset pipeline */
.dp-box rect { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.4; rx: 10; transition: stroke .4s, fill .4s; }
.dp-box.hot rect { stroke: var(--accent); stroke-width: 2; }
.dp-box text { font: 900 12px 'Lato', sans-serif; fill: var(--ink); }
.dp-box .sub { font: 700 10px 'Lato', sans-serif; fill: var(--muted); }
.dp-box .num { font: 900 15px 'Lato', sans-serif; fill: var(--accent); }
.dp-edge { stroke: var(--line-2); stroke-width: 1.6; fill: none; transition: stroke .4s; }
.dp-edge.hot { stroke: var(--accent); }
.dp-flow { fill: var(--accent-b); }
.dp-note { font: italic 700 11.5px 'Lato', sans-serif; fill: var(--ink-2); }
.dp-tag { font: 900 9.5px 'Lato', sans-serif; fill: #fff; }
@keyframes dpdash { to { stroke-dashoffset: -14; } }
.dp-edge.hot.animated { stroke-dasharray: 7 7; animation: dpdash .6s linear infinite; }

/* mdi chart */
.mdi-bar { transform-origin: left center; transform: scaleX(0); transition: transform .8s var(--ease), opacity .4s; }
.mdi-bar.on { transform: scaleX(1); }
.mdi-bar.faded { opacity: .16; }
.mdi-label { font: 700 10.5px 'Lato', sans-serif; fill: var(--ink); opacity: 0; transition: opacity .5s; }
.mdi-label.on { opacity: 1; }
.mdi-label.faded { opacity: .25; }
.mdi-val { font: 900 9.5px 'Lato', sans-serif; fill: var(--muted); }
.mdi-dir { font: 900 9px 'Lato', sans-serif; fill: var(--muted); }
.mdi-axis line { stroke: var(--line); }
.mdi-axis text { font: 700 9.5px 'Lato', sans-serif; fill: var(--muted); }
.mdi-legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 clamp(16px, 3vw, 30px) 14px; }
.mdi-chip { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 900; color: var(--ink-2); border: 1.5px solid var(--line); border-radius: 100px; padding: 6px 14px; background: var(--surface); cursor: pointer; transition: border-color .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.mdi-chip i { width: 10px; height: 10px; border-radius: 3px; font-style: normal; }
.mdi-chip.on { border-color: var(--accent); color: var(--ink); box-shadow: 0 4px 12px -6px rgba(16,116,126,.5); }
.mdi-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .78rem; font-weight: 700; padding: 8px 12px; border-radius: 8px; opacity: 0; transition: opacity .2s; max-width: 260px; z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  .explorer .xe { transition: none; opacity: 1 !important; transform: none !important; }
  .mdi-bar { transition: none; transform: scaleX(1); }
  .dp-edge.hot.animated { animation: none; }
}

/* ---------------------------------- Contact ---------------------------------- */
.contact { text-align: center; border-top: 1px solid var(--ink); margin-top: 40px; padding-top: 70px; }
.contact h2 { margin-bottom: 12px; }
.contact p { color: var(--muted); margin-bottom: 26px; }
.contact .hero__cta { justify-content: center; }

/* ---------------------------------- Footer ---------------------------------- */
.footer { text-align: center; padding: 50px 20px 70px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; margin-top: 40px; }
.footer a { color: var(--accent); font-weight: 700; }

/* ---------------------------------- Reveal ---------------------------------- */
.reveal, .card, .pub { opacity: 0; translate: 0 22px;
  transition: opacity .8s var(--ease) var(--d, 0s), translate .8s var(--ease) var(--d, 0s),
              transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.reveal.in, .card.in, .pub.in { opacity: 1; translate: none; }
/* the section rule draws across instead of fading up */
.rule.reveal { opacity: 1; translate: none; transform: scaleX(0); transform-origin: left; transition: transform 1.1s var(--ease); }
.rule.reveal.in { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .reveal, .card, .pub, .rule { opacity: 1 !important; translate: none !important; transform: none !important; transition: none !important; }
  .hero h1 .l, .wave, .spark polyline { animation: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
  .gauge .val { transition: none; stroke-dashoffset: 4 !important; }
}

/* ---------------------------------- Now (current projects, About page) ---------------------------------- */
.now-asof { color: var(--muted); max-width: 680px; margin-top: 10px; }
.now-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.now { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; display: flex; flex-direction: column; gap: 8px; }
.now:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-3px); }
.now__top { display: flex; }
.now__status { font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; padding: 4px 11px; border-radius: 100px; background: var(--tint); color: var(--accent); }
.now h3 { font-size: 1.12rem; font-weight: 900; letter-spacing: -.01em; line-height: 1.3; }
.now__org { font-size: .86rem; color: var(--accent); font-weight: 700; }
.now p { font-size: .93rem; color: var(--ink-2); }
.now__pts { margin: 2px 0 4px 18px; display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
.now .mlink { align-self: flex-start; margin-top: auto; font-size: .82rem; padding: 9px 14px; }
.award__link { color: inherit; border-bottom: 1px dashed var(--line-2); }
.award__link:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .now-grid { grid-template-columns: 1fr; } }
