/* ---------- tokens ---------- */
:root {
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --white: #ffffff;
  --gray: #f5f5f7;
  --black: #000000;
  --tile-on-gray: #ffffff;
  --tile-on-white: #f5f5f7;
  --tile-on-black: #1d1d1f;
  --divider: #d2d2d7;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --link: #0066cc;
  --link-dark: #2997ff;
  --on-dark: #f5f5f7;
  --nav-bg: rgba(250, 250, 252, 0.8);
  --nav-solid: rgba(250, 250, 252, 0.98);
  --tabs-bg: rgba(0, 0, 0, 0.06);
  --pill-bg: #ffffff;
  color-scheme: light;

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --text-w: 980px;
  /* type scale. Serif for display, Geist for reading, Geist Mono for details. */
  --fs-display-xl: clamp(60px, 9vw, 112px);
  --fs-display: clamp(48px, 6.2vw, 72px);
  --fs-title: clamp(28px, 2.6vw, 34px);
  --fs-lede: clamp(19px, 1.9vw, 21px);
  --fs-body: 17px;
  --fs-small: 15px;
  --fs-ui: 15px;
  --fs-detail: 12px;
  --lh-tight: 1.04;
  --lh-title: 1.12;
  --lh-body: 1.55;
  --grid-w: 1440px;
}
/* dark theme: the same tokens, re-weighted. Section order still alternates by tone. */
:root[data-theme="dark"] {
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #86868b;
  --white: #000000;
  --gray: #0f0f11;
  --black: #161618;
  --tile-on-gray: #1c1c1e;
  --tile-on-white: #141416;
  --tile-on-black: #262628;
  --divider: #38383a;
  --blue: #0a84ff;
  --blue-hover: #2997ff;
  --link: #2997ff;
  --nav-bg: rgba(22, 22, 23, 0.8);
  --nav-solid: rgba(22, 22, 23, 0.98);
  --tabs-bg: rgba(255, 255, 255, 0.08);
  --pill-bg: #3a3a3c;
  color-scheme: dark;
}
html { transition: background-color .5s var(--ease); }
body, .tile, .card, .role, .footer, .panel { transition: background-color .5s var(--ease), color .5s var(--ease); }

* { box-sizing: border-box; }
/* `hidden` must always win, even over components that set their own display */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 44px; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.011em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); color: var(--text); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: 44px;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav__inner {
  max-width: 1120px; height: 100%; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav__logo { display: flex; align-items: center; height: 44px; padding: 0 8px; margin-left: -8px; }
.nav__logo svg { width: 18px; height: 18px; }
.nav__logo svg path { stroke: var(--text); stroke-width: 2.4; fill: none; }
.nav__logo svg circle { fill: var(--white); stroke: var(--text); stroke-width: 2.4; }
.nav__logo svg circle.hot { fill: var(--text); }
.nav__links { display: flex; flex: 1; justify-content: space-between; margin-left: 32px; }
.nav__links a {
  font-size: 12px; letter-spacing: -0.01em; line-height: 44px;
  color: var(--text); opacity: 0.8; padding: 0 8px;
  transition: opacity .2s var(--ease);
}
.nav__links a:hover { opacity: 1; text-decoration: none; }
.nav__toggle { display: none; background: none; border: 0; width: 44px; height: 44px; margin-right: -12px; cursor: pointer; padding: 14px 13px; }
.nav__toggle span { display: block; height: 1.5px; background: var(--text); border-radius: 1px; transition: transform .3s var(--ease); }
.nav__toggle span + span { margin-top: 7px; }
.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(4.25px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child { transform: translateY(-4.25px) rotate(-45deg); }

/* ---------- tiles (full-width sections) ---------- */
.tile { padding: 120px 22px; text-align: center; position: relative; }
/* ambient background canvas: viewport-sized, sticky inside its section */
.ambient { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ambient canvas { position: sticky; top: 0; display: block; width: 100%; }
.tile > :not(.ambient) { position: relative; z-index: 1; }
.tile--white { background: var(--white); color: var(--text); --tile: var(--tile-on-white); }
.tile--gray { background: var(--gray); color: var(--text); --tile: var(--tile-on-gray); }
.tile--black { background: var(--black); color: var(--on-dark); --tile: var(--tile-on-black); }
.tile--black .subhead, .tile--black .eyebrow, .tile--black .caption, .tile--black .card__label, .tile--black .details li, .tile--black .tools { color: var(--text-3); }
.tile--black a { color: var(--link-dark); }
.tile__text { max-width: var(--text-w); margin: 0 auto; }

.eyebrow { font-size: 21px; font-weight: 600; letter-spacing: 0.011em; color: var(--text-2); margin-bottom: 6px; }
.hero__headline {
  font-size: clamp(48px, 7vw, 80px); font-weight: 600; line-height: 1.05; letter-spacing: -0.015em;
}
.hero__subhead { font-size: clamp(21px, 2.4vw, 28px); line-height: 1.14; letter-spacing: 0.007em; margin-top: 10px; }
.headline { font-size: clamp(40px, 5vw, 56px); font-weight: 600; line-height: 1.07; letter-spacing: -0.005em; }
.headline--xl { font-size: clamp(48px, 7vw, 80px); line-height: 1.05; letter-spacing: -0.015em; }
.subhead { font-size: clamp(21px, 2.2vw, 24px); line-height: 1.17; letter-spacing: 0.009em; color: var(--text-2); margin-top: 14px; max-width: 700px; margin-left: auto; margin-right: auto; }
.tile--white .subhead, .tile--gray .subhead { color: var(--text); }

/* ---------- buttons + links ---------- */
.ctas { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px 24px; margin-top: 26px; }
.pill {
  display: inline-block; border: 0; cursor: pointer;
  font: 400 17px/1.18 var(--font); letter-spacing: -0.022em;
  padding: 11px 22px; border-radius: 980px;
  background: var(--blue); color: #fff;
  transition: background .2s var(--ease);
}
.pill:hover { background: var(--blue-hover); text-decoration: none; }
.pill:disabled { opacity: .45; cursor: default; }
.more { font-size: 17px; }
.more::after { content: "›"; display: inline-block; margin-left: 4px; font-size: 1.1em; line-height: 1; transform: translateY(1px); }

/* ---------- hero ---------- */
.hero { padding: 72px 0 0; overflow: hidden; }
.hero .tile__text { padding: 0 22px; }
.hero__stage { position: relative; height: clamp(360px, 62vh, 640px); margin-top: 24px; }
.hero__net { display: block; width: 100%; height: 100%; cursor: pointer; }
.hero__net:focus-visible { outline-offset: -6px; border-radius: 28px; }

/* ---------- generic grid + cards ---------- */
.grid { display: grid; gap: 12px; max-width: var(--text-w); margin: 64px auto 0; text-align: left; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--wide { max-width: 1180px; }
.card {
  background: var(--tile); border-radius: 28px; padding: 40px 40px 44px;
  overflow: hidden;
}
.card, .role { position: relative; }
.card__big { font-size: clamp(40px, 4.4vw, 56px); font-weight: 600; line-height: 1.07; letter-spacing: -0.005em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card__label { font-size: 17px; color: var(--text-2); margin-top: 8px; max-width: 360px; }
.card__title { font-size: 24px; font-weight: 600; line-height: 1.17; letter-spacing: 0.009em; margin-bottom: 14px; }
.card__items { font-size: 19px; line-height: 1.6; letter-spacing: 0.012em; color: var(--text); }
.tile--black .card__items { color: var(--on-dark); }

.prose { max-width: 680px; margin: 64px auto 0; text-align: left; }
.prose p { font-size: 19px; line-height: 1.53; letter-spacing: 0.012em; color: var(--text-2); }
.prose p + p { margin-top: 18px; }
.prose p:first-child { color: var(--text); }

/* ---------- experience ---------- */
.roles { max-width: var(--text-w); margin: 64px auto 0; display: grid; gap: 12px; text-align: left; }
.role { background: var(--tile); border-radius: 28px; padding: 48px 48px 44px; }
.role__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 24px; flex-wrap: wrap; }
.role__name { font-size: 32px; font-weight: 600; line-height: 1.125; letter-spacing: 0.004em; }
.role__when { font-size: 14px; color: var(--text-2); letter-spacing: -0.016em; }
.role__role { font-size: 17px; color: var(--text-2); margin-top: 4px; }
.role__summary { font-size: 21px; line-height: 1.38; letter-spacing: 0.011em; margin-top: 18px; max-width: 720px; }
.role__metrics { display: flex; flex-wrap: wrap; gap: 24px 56px; margin-top: 32px; }
.role__metrics .card__big { font-size: clamp(32px, 3.4vw, 44px); }
.role__metrics .card__label { font-size: 14px; letter-spacing: -0.016em; max-width: 230px; margin-top: 4px; }

.details { list-style: none; padding: 0; margin: 32px 0 0; }
.details li { position: relative; padding-left: 18px; font-size: 17px; color: var(--text-2); }
.details li + li { margin-top: 10px; }
.details li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.tools { margin-top: 24px; font-size: 14px; color: var(--text-2); letter-spacing: -0.016em; }

/* ---------- project tiles ---------- */
.panel {
  max-width: 1180px; margin: 0 auto; border-radius: 28px; overflow: hidden;
  padding: 88px 48px 80px; text-align: center;
}
.panel + .panel { margin-top: 12px; }
.panel .headline { font-size: clamp(36px, 4.4vw, 48px); }
.panel .visual { max-width: 1000px; margin: 56px auto 0; }
.visual__img { width: 100%; height: auto; border-radius: 18px; }
.caption { font-size: 14px; color: var(--text-2); margin-top: 16px; letter-spacing: -0.016em; }
.panel .grid { max-width: 1000px; margin-top: 56px; }
.project__details { max-width: 820px; margin: 64px auto 0; text-align: left; }
.project__details h4 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: 0.009em; }
.project__details .details { margin-top: 16px; }

/* diagram (Rewardsmith) */
.diagram { max-width: 820px; margin: 0 auto; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram .diagram--narrow { display: none; max-width: 400px; margin: 0 auto; }
@media (max-width: 734px) {
  .diagram .diagram--narrow { display: block; }
  .diagram .diagram--wide { display: none; }
}
.dg-box { fill: var(--tile-on-black); }
.dg-box--hot { fill: var(--blue); }
.dg-t { fill: var(--on-dark); font: 600 15px var(--font); letter-spacing: -0.01em; }
.dg-s { fill: var(--text-3); font: 400 12.5px var(--font); }
.dg-box--hot + .dg-t, .dg-box--hot ~ .dg-s.on-hot { fill: #fff; }
.dg-e { stroke: #424245; stroke-width: 1.5; fill: none; }
.dg-loop { stroke: var(--link-dark); stroke-width: 1.5; fill: none; stroke-dasharray: 4 7; animation: flow 1.4s linear infinite; }
.dg-head { fill: var(--link-dark); }
@keyframes flow { to { stroke-dashoffset: -22; } }

/* ---------- chat ---------- */
.chat { max-width: 680px; margin: 56px auto 0; text-align: left; }
.chat__log { height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; scroll-behavior: smooth; }
.msg { max-width: 82%; padding: 10px 16px; border-radius: 20px; font-size: 17px; line-height: 1.41; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--bot { background: var(--tile-on-black); color: var(--on-dark); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg--me { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg--typing::after { content: "…"; color: var(--text-3); }
.chat__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.chip { font: 400 14px/1.2 var(--font); letter-spacing: -0.016em; color: var(--on-dark); background: var(--tile-on-black); border: 0; padding: 9px 14px; border-radius: 980px; cursor: pointer; transition: background .2s var(--ease); }
.chip:hover { background: #333336; }
.chat__form { display: flex; gap: 10px; }
.chat__form input {
  flex: 1; min-width: 0; font: 400 17px var(--font); letter-spacing: -0.022em;
  color: var(--on-dark); background: var(--tile-on-black); border: 0; border-radius: 980px; padding: 11px 20px;
}
.chat__form input::placeholder { color: var(--text-3); }
.chat__form input:focus { outline: 2px solid var(--blue); outline-offset: 0; }
.chat__mode { font-size: 12px; color: var(--text-3); margin-top: 12px; text-align: center; }

/* ---------- contact ---------- */
.contact { padding: 160px 22px; }

/* ---------- footer ---------- */
.footer { background: var(--gray); color: var(--text-2); font-size: 12px; line-height: 1.33; letter-spacing: -0.01em; }
.footer__inner { max-width: 980px; margin: 0 auto; padding: 32px 22px 22px; }
.footer__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--divider); }
.footer__col h4 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.footer__col a { display: block; color: var(--text-2); margin-bottom: 8px; }
.footer__col a:hover { color: var(--text); text-decoration: underline; }
.footer__bottom { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 16px; }

/* dark panels inside light sections keep light-on-dark text */
.panel.tile--black .subhead, .panel.tile--black .card__label, .panel.tile--black .caption,
.panel.tile--black .details li, .panel.tile--black .tools, .panel.tile--black .layer { color: var(--text-3); }

/* ---------- ML details ---------- */
/* layer label above headlines: tiny network + name */
.layer {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.016em; color: var(--text-2);
  margin-bottom: 12px;
}
.tile--black .layer { color: var(--text-3); }

.glyph { width: 30px; height: 18px; flex: none; overflow: visible; }
.glyph__e path { stroke: currentColor; stroke-width: 0.8; opacity: .35; fill: none; }
.glyph circle { fill: var(--glyph-bg, #fff); stroke: currentColor; stroke-width: 1; }
.tile--white { --glyph-bg: var(--white); }
.tile--gray { --glyph-bg: var(--gray); }
.tile--black { --glyph-bg: var(--black); }
.card, .role { --glyph-bg: var(--tile); }
/* forward pass: layers light up one after another */
.is-in > .glyph circle, .is-in .layer .glyph circle, .layer.is-in .glyph circle,
.is-done > .glyph circle { animation: fire 1.6s var(--ease) both; animation-delay: calc(var(--l) * 220ms); }
.is-in > .glyph circle.out, .layer.is-in .glyph circle.out, .is-done > .glyph circle.out { animation-name: fire-stay; }
@keyframes fire { 0% { fill: var(--glyph-bg, #fff); } 35% { fill: var(--blue); stroke: var(--blue); } 100% { fill: var(--glyph-bg, #fff); } }
@keyframes fire-stay { 0% { fill: var(--glyph-bg, #fff); } 35%, 100% { fill: var(--blue); stroke: var(--blue); } }
.glyph--corner { position: absolute; top: 22px; right: 24px; color: var(--text-3); opacity: .8; }
.glyph--lg { width: 90px; height: 54px; color: var(--text-3); }

/* metric numbers: a hairline "activation" bar fills as the number counts */
.card--metric .card__label { position: relative; }
.card--metric::after {
  content: ""; position: absolute; left: 40px; right: 40px; bottom: 22px; height: 1px;
  background: var(--blue); transform: scaleX(0); transform-origin: left;
  transition: transform 1.4s cubic-bezier(.16, 1, .3, 1); opacity: .45;
}
.card--metric.is-done::after { transform: scaleX(1); }

/* ---------- tabs ---------- */
.tabs {
  position: relative; display: inline-flex; gap: 0; margin: 44px auto 0;
  padding: 4px; border-radius: 980px; background: var(--tabs-bg);
}
.work .tile__text + .tabs { display: flex; width: fit-content; }
.tabs__pill {
  position: absolute; top: 4px; left: 0; height: calc(100% - 8px); width: 0;
  background: var(--pill-bg); border-radius: 980px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  transition: transform .45s var(--ease), width .45s var(--ease);
}
.tabs__tab {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  font: 400 17px/1.2 var(--font); letter-spacing: -0.022em; color: var(--text-2);
  padding: 9px 22px; border-radius: 980px; transition: color .3s var(--ease);
}
.tabs__tab[aria-selected="true"] { color: var(--text); }
.tabs__tab:hover { color: var(--text); }
.tabpanel { margin-top: 48px; }
.tabpanel:focus { outline: none; }
.tabpanel .roles, .tabpanel > .grid { margin-top: 0; }
.tabpanel:not([hidden]) { animation: panel-in .6s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- placeholders ---------- */
.placeholder-tag { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--blue); margin-bottom: 10px; text-transform: uppercase; }
.is-placeholder .role__name, .is-placeholder .card__title { color: var(--text-2); }

/* ---------- hobbies ---------- */
.hobby { padding: 0; display: flex; flex-direction: column; }
.hobby__text { padding: 36px 40px 28px; }
.hobby__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; margin-top: auto; }
.hobby__ph {
  margin: auto 16px 16px; aspect-ratio: 16 / 9; border-radius: 18px;
  background: var(--gray); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-3); font-size: 14px;
}
.tile--gray .hobby__ph { background: var(--gray); }

/* ---------- output network ---------- */
.contact__stage { height: 220px; margin: 56px auto 0; max-width: 1180px; }
.contact__net { display: block; width: 100%; height: 100%; }

/* ---------- section indicator: neurons down the right edge ---------- */
.fp {
  position: fixed; right: 26px; top: 50%; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: 26px; align-items: center;
  --fp-ink: rgba(29, 29, 31, .5); --fp-line: rgba(29, 29, 31, .14); --fp-bg: #fff; --fp-label: var(--text-2);
}
:root[data-theme="dark"] .fp, .fp.on-dark { --fp-ink: rgba(245, 245, 247, .55); --fp-line: rgba(245, 245, 247, .18); --fp-bg: #000; --fp-label: var(--text-3); }
.fp__line { position: absolute; top: 5px; bottom: 5px; left: 50%; width: 1px; margin-left: -.5px; background: var(--fp-line); }
.fp__fill { display: block; width: 100%; height: 0; background: var(--blue); transition: height .6s var(--ease); }
.fp__node {
  position: relative; width: 10px; height: 10px; border-radius: 50%;
  background: var(--fp-bg); border: 1px solid var(--fp-ink);
  transition: background .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.fp__node.is-past { border-color: var(--blue); }
.fp__node.is-active { background: var(--blue); border-color: var(--blue); transform: scale(1.25); box-shadow: 0 0 0 4px rgba(0, 113, 227, .15); }
.fp__label {
  position: absolute; right: 22px; top: 50%; transform: translate(6px, -50%);
  font-size: 12px; white-space: nowrap; color: var(--fp-label);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.fp__node:hover .fp__label, .fp__node:focus-visible .fp__label, .fp__node.is-active .fp__label { opacity: 1; transform: translate(0, -50%); }
.fp__node:hover { text-decoration: none; }
@media (max-width: 1300px) { .fp { display: none; } }

/* chat "thinking": neurons firing in sequence */
.fwd { display: inline-flex; align-items: center; height: 20px; }
.fwd i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--text-3); animation: fwd 1.2s infinite var(--ease); }
.fwd b { width: 12px; height: 1px; background: #424245; }
.fwd i:nth-of-type(2) { animation-delay: .2s; }
.fwd i:nth-of-type(3) { animation-delay: .4s; }
@keyframes fwd { 0%, 60%, 100% { background: transparent; border-color: var(--text-3); } 25% { background: var(--link-dark); border-color: var(--link-dark); } }


/* ---------- nav extras: loss readout + model switch ---------- */
.nav__tools { display: flex; align-items: center; gap: 14px; margin-left: 18px; flex: none; }
.lossbar { font: inherit; background: none; border: 0; cursor: pointer; padding: 5px 8px; margin: 0 -8px; border-radius: 8px; transition: background .25s var(--ease);
  display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-2); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lossbar svg { width: 38px; height: 14px; overflow: visible; }
.lossbar__track { fill: none; stroke: var(--text); stroke-opacity: .12; stroke-width: 1; }
.lossbar__line { fill: none; stroke: var(--blue); stroke-width: 1.25; stroke-linejoin: round; }
.lossbar__dot { fill: var(--blue); }
.lossbar__val { min-width: 62px; }
.lossbar.is-done .lossbar__val { color: var(--blue); }

.mswitch {
  position: relative; width: 38px; height: 22px; padding: 0; border: 0; cursor: pointer; flex: none;
  background: var(--tabs-bg); border-radius: 980px; transition: background .4s var(--ease);
}
.mswitch svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mswitch__edge { stroke: var(--text); stroke-opacity: .35; stroke-width: 1; }
.mswitch__a { fill: none; stroke: var(--text); stroke-opacity: .55; stroke-width: 1.2; }
.mswitch__knob { fill: var(--pill-bg); stroke: var(--text); stroke-opacity: .25; stroke-width: 1; transition: transform .45s var(--ease), fill .4s var(--ease); }
.mswitch__core { fill: var(--blue); transition: transform .45s var(--ease), opacity .3s var(--ease); opacity: 0; }
:root[data-theme="dark"] .mswitch__knob, :root[data-theme="dark"] .mswitch__core { transform: translateX(16px); }
:root[data-theme="dark"] .mswitch__core { opacity: 1; }
.mswitch:hover .mswitch__edge { stroke-opacity: .6; }

/* ---------- attention underlines in bullets ---------- */
.hl {
  color: var(--text); white-space: nowrap;
  background-image: linear-gradient(var(--blue), var(--blue));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: background-size 1s cubic-bezier(.65, 0, .35, 1), color .3s var(--ease);
  transition-delay: calc(var(--k, 0) * 140ms + 400ms);
}
.tile--black .hl { color: var(--on-dark); background-image: linear-gradient(var(--link-dark), var(--link-dark)); }
.is-in .hl, .reveal.is-in .hl { background-size: 100% 1px; }
.hl.is-lit { background-size: 100% 2px; transition-delay: 0s; color: var(--blue); }
.tile--black .hl.is-lit { color: var(--link-dark); }
.card--metric, .metric { cursor: default; }

/* ---------- training lab ---------- */
.lab { max-width: 1080px; margin: 56px auto 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; text-align: left; }
.lab__plot { position: relative; aspect-ratio: 1; background: var(--tile); border-radius: 28px; overflow: hidden; touch-action: none; }
.lab__plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.lab__hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); pointer-events: none;
  font-size: 13px; color: var(--text-2); background: var(--nav-bg); padding: 7px 14px; border-radius: 980px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); white-space: nowrap;
}
.lab__side { display: grid; gap: 12px; align-content: start; }
.lab__box { background: var(--tile); border-radius: 28px; padding: 26px 28px; }
.lab__k { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; letter-spacing: -0.01em; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font: 400 14px/1 var(--font); letter-spacing: -0.016em; color: var(--text);
  background: transparent; border: 0; padding: 9px 13px; border-radius: 980px; cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 16%, transparent);
  display: inline-flex; align-items: center; gap: 7px; transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.seg button:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 40%, transparent); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--white); box-shadow: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--1 { background: var(--blue); }
.dot--0 { box-shadow: inset 0 0 0 1.5px currentColor; }
.lab__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lab__stat b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.lab__stat span { font-size: 12px; color: var(--text-2); }
.lab__spark { display: block; width: 100%; height: 56px; margin-top: 14px; overflow: visible; }
.lab__sparkline { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lab__sparkbase { stroke: var(--text); stroke-opacity: .1; vector-effect: non-scaling-stroke; }
.lab__net { display: block; width: 100%; height: auto; margin-top: 2px; }
.lab__edges line { stroke-width: 1.2; transition: opacity .4s linear; }
.lab__edges line.pos { stroke: var(--blue); }
.lab__edges line.neg { stroke: var(--text); }
.lab__nodes circle { fill: var(--tile); stroke: var(--text); stroke-opacity: .6; stroke-width: 1.2; }
.lab__arch { font-size: 12px; color: var(--text-2); margin-top: 8px; }
.lab__actions { display: flex; gap: 22px; padding: 4px 6px 0; }
.lab__actions button { font: 400 15px var(--font); color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; }
.lab__actions button:hover { text-decoration: underline; }

@media (max-width: 1068px) {
  .lossbar__val { min-width: 0; }
  .lossbar .lossbar__label { display: none; }
}
@media (max-width: 900px) {
  .lab { grid-template-columns: 1fr; max-width: 560px; }
}
@media (max-width: 734px) {
  .nav__tools { margin-left: auto; margin-right: 6px; }
  .lossbar { display: none; }
  .lab__plot, .lab__box { border-radius: 18px; }
  .lab__box { padding: 22px 20px; }
  .lab__hint { font-size: 12px; }
}


/* ---------- hero: at a glance ---------- */
.glance {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  margin: 22px auto 0; max-width: 760px; font-size: 14px; color: var(--text-2); letter-spacing: -0.016em;
}
.glance__sep { color: var(--text-3); }

/* ---------- code: live GitHub ---------- */
.gh { max-width: 1180px; margin: 12px auto 0; text-align: left; display: grid; gap: 12px; }
.gh__side { display: flex; align-items: center; gap: 18px; }
.gh__side .more { font-size: 15px; }
.pw__live { font-size: 12px; color: var(--text-2); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.pw__live:empty { display: none; }
.pw__dot { width: 6px; height: 6px; border-radius: 50%; background: #30d158; flex: none; }
.gh__activity { padding: 32px 36px 28px; }
.gh__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.gh__big { font-size: clamp(40px, 4.4vw, 56px); font-weight: 600; line-height: 1; letter-spacing: -0.005em; margin-right: 12px; font-variant-numeric: tabular-nums; }
.gh__lbl { font-size: 17px; color: var(--text-2); }
.gh__live { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; }
.gh__live i { width: 7px; height: 7px; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 0 rgba(48, 209, 88, .5); animation: gh-ping 2.4s infinite; }
@keyframes gh-ping { 0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .45); } 70%, 100% { box-shadow: 0 0 0 7px rgba(48, 209, 88, 0); } }
.gh__chart { display: block; width: 100%; height: 120px; overflow: visible; }
.gh__bar { fill: var(--blue); transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform .9s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--d); }
.gh__bar--0 { fill: var(--text); fill-opacity: .12; }
.gh__activity.is-drawn .gh__bar { transform: scaleY(1); }
.gh__axis { position: relative; height: 16px; margin-top: 8px; font-size: 11px; color: var(--text-3); }
.gh__axis span { position: absolute; top: 0; white-space: nowrap; }
.gh__repos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gh__repo { display: flex; flex-direction: column; gap: 10px; padding: 28px 28px 26px; color: var(--text); transition: transform .35s var(--ease), background-color .5s var(--ease); }
.gh__repo:hover { text-decoration: none; transform: translateY(-3px); }
.gh__repo:hover .more { text-decoration: underline; }
.gh__path { font-size: 15px; color: var(--text-2); }
.gh__path b { color: var(--text); font-weight: 600; }
.gh__desc { font-size: 17px; line-height: 1.4; flex: 1; }
.gh__stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.gh__stats span { display: inline-flex; align-items: center; gap: 6px; }
.gh__lang { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.gh__repo .more { font-size: 15px; color: var(--link); margin-top: 4px; }
.gh__note { font-size: 13px; color: var(--text-3); text-align: center; }
.gh__note:empty { display: none; }
@media (max-width: 900px) { .gh__repos { grid-template-columns: 1fr; } }
@media (max-width: 734px) {
  .gh__activity { padding: 24px 20px 20px; }
  .gh__repo { padding: 24px 22px; }
  .glance { font-size: 13px; flex-direction: column; gap: 2px; }
  .glance__sep { display: none; }
  .gh__chart { height: 96px; }
}
@media (prefers-reduced-motion: reduce) { .gh__bar { transform: none; } }


.lossbar:hover { background: var(--tabs-bg); }

/* ---------- hidden training lab (overlay) ---------- */
.hero__hint {
  position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: -0.01em; color: var(--white); background: var(--text);
  padding: 6px 12px 6px 10px; border-radius: 980px;
  opacity: 0; transform: translate(14px, -140%) scale(.96);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.hero__hint i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: fwd 1.4s infinite var(--ease); }
.hero__hint.is-on { opacity: 1; transform: translate(14px, -140%); }
.hero__hint.is-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }

html.labx-open, html.labx-open body { overflow: hidden; }
.labx {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  /* no backdrop blur: re-blurring the page behind a live canvas every frame halved the frame rate on Retina screens */
  background: rgba(240, 240, 243, 0.88);
  opacity: 0; transition: opacity .4s var(--ease);
}
:root[data-theme="dark"] .labx { background: rgba(0, 0, 0, 0.8); }
.labx.is-open { opacity: 1; }
.labx__panel {
  position: relative; width: min(1180px, 100%); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain;
  background: var(--white); border-radius: 28px; padding: 52px 44px 26px; text-align: center;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .18);
  opacity: 0; transform: translate(calc(var(--ox, 50vw) - 50vw), calc(var(--oy, 60vh) - 50vh)) scale(.5);
  transition: transform .6s cubic-bezier(.2, .85, .25, 1), opacity .35s var(--ease);
}
:root[data-theme="dark"] .labx__panel { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 40px 100px rgba(0, 0, 0, .6); }
.labx.is-open .labx__panel { opacity: 1; transform: none; }
.labx.is-closing .labx__panel { opacity: 0; transform: translateY(18px) scale(.97); transition-duration: .32s; }
.labx__close {
  position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--tabs-bg); color: var(--text); display: grid; place-items: center;
  transition: background .2s var(--ease), transform .3s var(--ease);
}
.labx__close:hover { transform: rotate(90deg); }
.labx__close svg { width: 12px; height: 12px; }
.labx__close path { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.labx__head .headline { font-size: clamp(32px, 4vw, 48px); }
.labx__head .subhead { font-size: clamp(17px, 1.8vw, 21px); margin-top: 10px; }
.labx .lab {
  margin: 32px auto 0; max-width: none;
  grid-template-columns: min(calc(100dvh - 330px), 600px) minmax(300px, 420px); justify-content: center;
}
.labx .lab__box { padding: 22px 24px; }
.labx__foot { font-size: 12px; color: var(--text-3); margin-top: 18px; }

.hintpill {
  position: fixed; left: 50%; bottom: 24px; z-index: 150;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 14px; border-radius: 980px;
  background: var(--nav-solid); color: var(--text); font-size: 14px; letter-spacing: -0.016em;
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent), 0 12px 40px rgba(0, 0, 0, .14);
  opacity: 0; transform: translate(-50%, 24px); transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.hintpill.is-on { opacity: 1; transform: translate(-50%, 0); }
.hintpill__ico { width: 30px; height: 18px; flex: none; }
.hintpill__ico path { stroke: var(--text); stroke-opacity: .35; stroke-width: 1; fill: none; }
.hintpill__ico circle { fill: var(--white); stroke: var(--text); stroke-opacity: .6; stroke-width: 1; }
.hintpill__ico circle.hot { fill: var(--blue); stroke: var(--blue); animation: fwd 1.6s infinite var(--ease); }
.hintpill__try { font: 400 14px/1 var(--font); border: 0; cursor: pointer; padding: 9px 16px; border-radius: 980px; background: var(--blue); color: #fff; white-space: nowrap; }
.hintpill__try:hover { background: var(--blue-hover); }
.hintpill__x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; flex: none; }
.hintpill__x:hover { background: var(--tabs-bg); }
.hintpill__x svg { width: 10px; height: 10px; }
.hintpill__x path { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

@media (max-width: 900px) {
  .labx .lab { grid-template-columns: 1fr; max-width: 520px; }
}
@media (max-width: 734px) {
  .labx { padding: 0; }
  .labx__panel { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; padding: 60px 16px 24px; box-shadow: none; }
  .labx__close { top: 12px; right: 12px; }
  .hintpill { left: 12px; right: 12px; bottom: 16px; transform: translateY(24px); font-size: 13px; }
  .hintpill.is-on { transform: none; }
  .hintpill__ico { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .labx__panel { transform: none; }
}


/* ---------- nav: current section ---------- */
.nav__links a { position: relative; }
.nav__links a.is-active { opacity: 1; }
.nav__links a.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: 9px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--blue);
}
@media (max-width: 734px) { .nav__links a.is-active::after { left: -14px; bottom: auto; top: 50%; margin: -2px 0 0; } }

/* ---------- experience: a compact list ---------- */
.xp { list-style: none; margin: 0; padding: 8px 40px; }
.xp__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 32px; padding: 28px 0; }
.xp__row + .xp__row { border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent); }
.xp__org { font-size: 21px; font-weight: 600; line-height: 1.24; letter-spacing: 0.011em; }
.xp__role { font-size: 15px; color: var(--text-2); margin-top: 3px; }
.xp__sum { font-size: 17px; color: var(--text); margin-top: 10px; max-width: 620px; }
.xp__when { font-size: 14px; color: var(--text-2); white-space: nowrap; flex: none; }
.xp__cta { margin-top: 22px; }

/* ---------- projects: small windows ---------- */
.pws { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 1180px; margin: 0 auto; text-align: left; }
.pw { background: var(--tile-on-gray); border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; transition: transform .4s var(--ease), background-color .5s var(--ease); }
.pw:hover { transform: translateY(-4px); }
.pw__bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; font-size: 12px; color: var(--text-3); }
.pw__bar i { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 16%, transparent); }
.pw__bar span { margin-left: 8px; }
.pw__media { margin: 0 10px; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--gray); }
.pw__media img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.pw__media--dark { background: #000; display: grid; place-items: center; }
.pw__art { width: 100%; height: 100%; }
.mw__box { fill: #1d1d1f; } .mw__hot { fill: #0a84ff; }
.mw__t { font: 500 11px var(--font); fill: #d2d2d7; } .mw__thot { font: 600 11px var(--font); fill: #fff; }
.mw__e { stroke: #48484a; stroke-width: 1.2; fill: none; }
.mw__loop { stroke: #2997ff; stroke-width: 1.2; fill: none; stroke-dasharray: 3 5; animation: flow 1.4s linear infinite; }
.mw__head { fill: #2997ff; }
.pw__body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.pw__name { font-size: 24px; font-weight: 600; letter-spacing: 0.009em; }
.pw__line { font-size: 15px; line-height: 1.45; color: var(--text-2); margin-top: 6px; }
.pw__nums { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.pw__num { position: relative; padding-bottom: 10px; }
.pw__num .card__big { font-size: 24px; letter-spacing: 0; white-space: nowrap; }
.pw__num .card__label { font-size: 12px; line-height: 1.35; margin-top: 3px; }
.pw__num.card--metric::after { left: 0; right: 0; bottom: 0; }
.pw__tags { font-size: 12px; color: var(--text-3); margin-top: 16px; }
.pw__links { display: flex; align-items: center; gap: 18px; margin-top: auto; padding-top: 18px; }
.pw__links .more { font-size: 15px; }
.pill--sm { font-size: 14px; padding: 8px 16px; }

/* ---------- hobbies ---------- */
.hobby__meta { font-size: 13px; font-weight: 600; color: var(--blue); margin-bottom: 6px; letter-spacing: -0.01em; }
.hobby__text { padding: 34px 36px 8px; }
.hobby__art { margin: auto 16px 16px; border-radius: 18px; background: var(--gray); aspect-ratio: 16 / 9; display: grid; place-items: center; }
.hobby__art svg { width: 100%; height: 100%; }
.hobby__art svg * { vector-effect: non-scaling-stroke; }
.ha__grid path { stroke: var(--text); stroke-opacity: .28; stroke-width: 1; }
.ha__star { fill: var(--text); fill-opacity: .4; }
.ha__b { fill: var(--text); }
.ha__w { fill: var(--white); stroke: var(--text); stroke-opacity: .7; stroke-width: 1.2; }
.ha__ring { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.ha__arc { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-dasharray: 2 6; stroke-linecap: round; }
.ha__dot { fill: var(--blue); }
.ha__ball { fill: none; stroke: var(--text); stroke-width: 1.4; }
.ha__seam, .ha__line { fill: none; stroke: var(--text); stroke-opacity: .55; stroke-width: 1.1; }
.ha__board { fill: none; stroke: var(--text); stroke-opacity: .55; stroke-width: 1.1; }
.ha__rim { fill: none; stroke: var(--blue); stroke-width: 1.6; }
.ha__net { fill: none; stroke: var(--text); stroke-opacity: .35; stroke-width: 1; }
.ha__lbl { font: 500 9px var(--font); fill: var(--text-2); }
:root[data-theme="dark"] .ha__b { fill: #000; stroke: rgba(245, 245, 247, .85); stroke-width: 1.2; }
:root[data-theme="dark"] .ha__w { fill: #f5f5f7; stroke: none; }
.ha__base { stroke: var(--text); stroke-opacity: .15; stroke-width: 1; }
.ha__run { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.ha__next { fill: none; stroke: var(--blue); stroke-width: 1.6; stroke-dasharray: 4 5; }
.ha__flag { fill: var(--text); fill-opacity: .7; } .ha__flaghot { fill: var(--blue); }
.ha__ball2 { fill: var(--blue); }
.ha__wave { fill: none; stroke: var(--blue); stroke-width: 1.4; opacity: .9; }
.ha__wave--2 { opacity: .55; } .ha__wave--3 { opacity: .3; }
.ha__ring2 { fill: none; stroke: var(--text); stroke-width: 1.3; }
.ha__band { fill: var(--blue); }

@media (max-width: 1068px) { .pws { grid-template-columns: 1fr 1fr; } }
@media (max-width: 734px) {
  .pws { grid-template-columns: 1fr; }
  .xp { padding: 4px 22px; }
  .xp__row { flex-direction: column-reverse; gap: 4px; padding: 22px 0; }
  .xp__org { font-size: 19px; }
  .hobby__text { padding: 28px 24px 6px; }
}


/* ---------- research ---------- */
.rs { padding: 0; display: flex; flex-direction: column; }
.rs__text { padding: 34px 36px 8px; }
.rs__sum { font-size: 17px; color: var(--text); line-height: 1.45; }
.rs__role { font-size: 15px; color: var(--text-2); line-height: 1.45; margin-top: 10px; }
.rs__link { display: inline-block; margin-top: 14px; font-size: 15px; }
.rs .hobby__art { margin-top: 18px; }
.ra__line { fill: none; stroke: var(--text); stroke-width: 1.4; }
.ra__soft { fill: none; stroke: var(--text); stroke-opacity: .5; stroke-width: 1.2; }
.ra__ink { fill: var(--text); }
.ra__hot { fill: var(--blue); stroke: var(--blue); stroke-width: 1.4; stroke-linejoin: round; }
.ra__wave { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-linecap: round; }
.ra__wave--in { stroke: var(--text); stroke-opacity: .4; }
.ra__tick { stroke: var(--text); stroke-opacity: .35; stroke-width: 1.2; stroke-linecap: round; }
.ra__lbl { font: 500 9px var(--font); fill: var(--text-2); }
.ra__trace { fill: none; stroke: var(--text); stroke-opacity: .4; stroke-width: 1.1; }
.ra__die { fill: var(--white); stroke: var(--text); stroke-width: 1.4; }
.ra__core { fill: color-mix(in srgb, var(--blue) 14%, transparent); stroke: var(--blue); stroke-width: 1.2; }
.ra__grid { stroke: var(--blue); stroke-opacity: .5; stroke-width: 1; }
.ra__pad { fill: var(--text); fill-opacity: .7; }
.ra__via { fill: none; stroke: var(--blue); stroke-width: 1.3; }
@media (max-width: 734px) { .rs__text { padding: 28px 24px 6px; } }


/* ---------- typography: Instrument Serif for display, Geist for text, Geist Mono for details ---------- */
.hero__headline, .headline, .headline--xl, .card__big, .gh__big, .pw__name, .card__title, .xp__org, .role__name, .lab__stat b {
  font-family: var(--serif); font-weight: 400;
}
.hero__headline { font-size: clamp(60px, 9vw, 112px); line-height: .98; letter-spacing: -0.02em; }
.headline { font-size: clamp(48px, 6.2vw, 72px); line-height: 1.02; letter-spacing: -0.015em; }
.headline--xl { font-size: clamp(60px, 9vw, 112px); line-height: .98; letter-spacing: -0.02em; }
.headline em, .headline--xl em { font-style: italic; letter-spacing: -0.01em; }
.panel .headline, .labx__head .headline { font-size: clamp(40px, 5vw, 58px); }
.hero__subhead { font-size: clamp(19px, 2.1vw, 24px); letter-spacing: -0.012em; margin-top: 20px; }
.subhead { font-size: clamp(18px, 2vw, 21px); letter-spacing: -0.01em; line-height: 1.35; }
.card__big { font-size: clamp(46px, 5vw, 64px); line-height: 1; letter-spacing: -0.01em; }
.pw__num .card__big { font-size: 32px; }
.gh__big { font-size: clamp(52px, 5.4vw, 68px); letter-spacing: -0.01em; }
.lab__stat b { font-size: 34px; letter-spacing: -0.01em; }
.pw__name { font-size: 32px; letter-spacing: -0.01em; line-height: 1.05; }
.card__title { font-size: 32px; letter-spacing: -0.01em; line-height: 1.08; }
.xp__org { font-size: 28px; letter-spacing: -0.01em; line-height: 1.12; }
.layer, .lossbar, .pw__tags, .pw__bar, .gh__axis, .gh__live, .lab__arch, .lab__k, .lab__stat span, .xp__when,
.caption, .chat__mode, .glance, .hobby__meta, .pw__live, .lab__hint, .labx__foot, .footer__bottom {
  font-family: var(--mono); letter-spacing: -0.01em;
}
.layer { font-size: 12.5px; font-weight: 500; }
.glance { font-size: 13px; }
.hobby__meta { font-size: 12px; font-weight: 500; }
.pw__tags, .pw__live, .lab__arch { font-size: 11.5px; }
.xp__when { font-size: 13px; }
@media (max-width: 734px) {
  .pw__name, .card__title { font-size: 28px; }
  .xp__org { font-size: 24px; }
}


/* ---------- hero: name + three quiet keywords ---------- */
.hero__keys {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 14px;
  margin: 22px auto 0; font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.02em; color: var(--text-2);
}
.hero__edge { width: 22px; height: 1px; background: color-mix(in srgb, var(--text) 25%, transparent); position: relative; }
.hero__edge::before, .hero__edge::after { content: ""; position: absolute; top: -2px; width: 5px; height: 5px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--text) 40%, transparent); background: var(--white); }
.hero__edge::before { left: -3px; } .hero__edge::after { right: -3px; background: var(--blue); border-color: var(--blue); }
.hero .ctas { margin-top: 34px; }

/* ---------- about: two boxes ---------- */
.card__kicker { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 14px; letter-spacing: 0; }
.card--wide .card__big { white-space: normal; font-size: clamp(34px, 3.6vw, 46px); line-height: 1.05; max-width: 380px; }
#facts { grid-template-columns: 1.35fr 1fr; }
.subhead:empty { display: none; }

/* ---------- nav: quieter ---------- */
.nav__links { flex: 0 1 auto; justify-content: center; gap: 30px; margin: 0 auto; }
.lossbar__val { display: none; }

/* ---------- buttons: a neuron that fires ---------- */
.nb {
  position: relative; display: inline-flex; align-items: center; gap: 10px; overflow: hidden;
  font: 500 15px/1 var(--font); letter-spacing: -0.01em; text-decoration: none;
  padding: 13px 20px 13px 16px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--text); color: var(--white);
  transition: transform .3s var(--ease), background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.nb:hover { text-decoration: none; transform: translateY(-1px); }
.nb:active { transform: translateY(0) scale(.98); }
.nb::after {                                  /* activation line sweeps along the bottom */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--blue);
  transform: scaleX(0); transform-origin: left; transition: transform .55s cubic-bezier(.65, 0, .35, 1);
}
.nb:hover::after, .nb:focus-visible::after { transform: scaleX(1); }
.nb__g { width: 26px; height: 12px; flex: none; overflow: visible; }
.nb__e { stroke: currentColor; stroke-opacity: .35; stroke-width: 1.2; }
.nb__in { fill: none; stroke: currentColor; stroke-opacity: .7; stroke-width: 1.2; }
.nb__out { fill: none; stroke: currentColor; stroke-width: 1.2; transition: fill .25s var(--ease) .3s, stroke .25s var(--ease) .3s; }
.nb__spark { fill: var(--blue); opacity: 0; }
.nb:hover .nb__spark, .nb:focus-visible .nb__spark { animation: nb-fire 1.1s cubic-bezier(.5, 0, .3, 1) infinite; }
.nb:hover .nb__out, .nb:focus-visible .nb__out { fill: var(--blue); stroke: var(--blue); }
@keyframes nb-fire { 0% { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translateX(17px); opacity: 1; } 100% { transform: translateX(17px); opacity: 0; } }
.nb--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 22%, transparent); }
.nb--ghost:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 45%, transparent); }
.nb--sm { font-size: 14px; padding: 10px 16px 10px 13px; border-radius: 10px; }
.tile--black .nb, .panel.tile--black .nb { background: var(--on-dark); color: #000; }
.tile--black .nb--ghost { background: transparent; color: var(--on-dark); box-shadow: inset 0 0 0 1px rgba(245, 245, 247, .25); }
.chat__form .nb { border-radius: 980px; padding: 11px 20px 11px 16px; }
.chat__form .nb:disabled { opacity: .45; cursor: default; transform: none; }
@media (max-width: 734px) {
  .nav__links { gap: 0; margin: 0; }
  #facts { grid-template-columns: 1fr; }
  .hero__keys { font-size: 11.5px; gap: 6px 9px; letter-spacing: 0; flex-wrap: nowrap; }
  .hero__edge { width: 12px; flex: none; }
}
.hero__keys span { white-space: nowrap; }
@media (max-width: 380px) { .hero__keys { font-size: 10.5px; gap: 6px 7px; } .hero__edge { width: 9px; } }
@media (prefers-reduced-motion: reduce) { .nb:hover .nb__spark { animation: none; } }


/* ---------- research images ---------- */
.rs__media { margin: 18px 16px 16px; border-radius: 18px; background: var(--gray); overflow: hidden; position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.rs__print { width: 100%; height: 100%; object-fit: contain; padding: 14px 18px 30px; }
.rs__print--dark { display: none; }
/* in dark mode the print sits on a paper-colored panel, so it never turns into a negative */
:root[data-theme="dark"] .rs__media:not(.rs__media--photo) { background: #e9e9ec; }
:root[data-theme="dark"] .rs__media:not(.rs__media--photo) figcaption { color: #6e6e73; background: rgba(250, 250, 252, .8); }
.rs__media--photo { background: #1b1a12; }
.rs__photo { width: 100%; height: 100%; object-fit: cover; }
.rs__media figcaption {
  position: absolute; left: 12px; bottom: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0;
  color: var(--text-2); background: var(--nav-bg); padding: 4px 9px; border-radius: 980px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--white); font-size: 14px;
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast b { font-weight: 600; }
.toast span { font-family: var(--mono); font-size: 12.5px; opacity: .75; }
.toast { max-width: calc(100vw - 32px); flex-wrap: wrap; justify-content: center; text-align: center; }

/* ---------- tactile feedback ---------- */
.is-buzz { animation: buzz .26s linear; }
@keyframes buzz {
  0% { transform: translateX(0) scale(.97); } 20% { transform: translateX(-1.5px) scale(.97); }
  40% { transform: translateX(1.5px) scale(.98); } 60% { transform: translateX(-1px) scale(.99); }
  80% { transform: translateX(.5px); } 100% { transform: none; }
}
.fp__node.is-buzz { animation-name: buzz-dot; }
@keyframes buzz-dot { 0%, 100% { transform: scale(1.25); } 30% { transform: scale(1.6); } 60% { transform: scale(1.1); } }
.buzz-ring {
  position: fixed; z-index: 400; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%; border: 1px solid var(--blue); pointer-events: none;
  animation: buzz-ring .55s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes buzz-ring { from { transform: scale(.15); opacity: .7; } to { transform: scale(1); opacity: 0; } }


/* =================== type scale (applied last, so it wins) =================== */
body { font-size: var(--fs-body); line-height: var(--lh-body); letter-spacing: -0.011em; }

/* display: Instrument Serif */
.hero__headline, .headline--xl { font-size: var(--fs-display-xl); line-height: .98; letter-spacing: -0.02em; }
.headline { font-size: var(--fs-display); line-height: 1.02; letter-spacing: -0.015em; }
.pw__name, .card__title, .xp__org { font-size: var(--fs-title); line-height: var(--lh-title); letter-spacing: -0.01em; font-weight: 400; }

/* reading text: Geist, two weights of gray */
.subhead { font-size: var(--fs-lede); line-height: 1.4; letter-spacing: -0.012em; color: var(--text-2); }
.tile--white .subhead, .tile--gray .subhead { color: var(--text-2); }
.tile--black .subhead { color: var(--text-3); }
.prose p { font-size: 18px; line-height: 1.6; letter-spacing: -0.011em; color: var(--text-2); }
.prose p:first-child {                       /* the opening line reads like a lede, in the display face */
  font-family: var(--serif); font-size: clamp(26px, 2.6vw, 32px); line-height: 1.22; letter-spacing: -0.012em; color: var(--text);
  margin-bottom: 26px;
}
.card__label, .rs__sum, .xp__sum, .msg { font-size: var(--fs-body); line-height: var(--lh-body); }
.rs__sum, .xp__sum { color: var(--text); }
.pw__line, .rs__role, .xp__role { font-size: var(--fs-small); line-height: 1.5; color: var(--text-2); }
.card--metric .card__label, .pw__num .card__label { font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.more { font-size: var(--fs-ui); }
.tabs__tab { font-size: var(--fs-ui); }
.nav__links a { font-size: 12.5px; letter-spacing: 0; }

/* details: Geist Mono, one size */
.layer, .card__kicker, .hobby__meta, .xp__when, .xp__idx, .pw__tags, .pw__live, .pw__bar, .gh__axis, .gh__live,
.caption, .chat__mode, .rs__media figcaption, .lab__arch, .lab__k, .lab__stat span, .labx__foot, .footer__bottom, .lossbar {
  font-family: var(--mono); font-size: var(--fs-detail); letter-spacing: 0; line-height: 1.5;
}
.layer, .card__kicker, .hobby__meta { font-weight: 500; }
.hero__keys { font-size: 13px; letter-spacing: 0.01em; }

/* experience: dates in a quiet left column, then name, role, one sentence */
.xp { padding: 6px 44px; }
.xp__row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0 32px; align-items: start; padding: 34px 0; }
.xp__meta { display: flex; flex-direction: column; gap: 4px; padding-top: 9px; }
.xp__idx { color: var(--blue); }
.xp__when { color: var(--text-2); white-space: normal; }
.xp__role { margin-top: 6px; }
.xp__sum { margin-top: 14px; max-width: 600px; }

/* cards: a little more air between title and text */
.card__title { margin-bottom: 10px; }
.pw__line { margin-top: 8px; }
.rs__role { margin-top: 12px; }

@media (max-width: 734px) {
  .xp { padding: 2px 22px; }
  .xp__row { grid-template-columns: 1fr; padding: 26px 0; }
  .xp__meta { flex-direction: row; gap: 12px; padding: 0 0 8px; }
  .prose p:first-child { font-size: 25px; }
  .prose p { font-size: 17px; }
}


/* ---------- project previews as prints on paper (same look in both themes) ---------- */
.pw__media--print { background: #e9e9ec; display: grid; place-items: center; }
.pw__media--print img { width: 100%; height: 100%; object-fit: contain; object-position: center; padding: 10px 12px; }
.mp__box { fill: #e9e9ec; stroke: #1d1d1f; stroke-width: 1.2; }
.mp__ghost { fill: none; stroke-opacity: .35; }
.mp__hot { fill: #e9e9ec; stroke: #0071e3; stroke-width: 1.6; }
.mp__t { font: 500 11px var(--mono); fill: #1d1d1f; }
.mp__thot { font: 500 11px var(--mono); fill: #0071e3; }
.mp__e { stroke: #1d1d1f; stroke-opacity: .55; stroke-width: 1.1; fill: none; }
.mp__loop { stroke: #0071e3; stroke-width: 1.3; fill: none; stroke-dasharray: 3 5; animation: flow 1.4s linear infinite; }
.mp__head { fill: #0071e3; }


/* ---------- hobby prints (same paper panel as the research prints) ---------- */
.hobby__photo { margin-top: auto; }
.hobby__photo { background: var(--gray); }
.hobby__photo figcaption, .rs__media--photo figcaption { color: #f5f5f7; background: rgba(0, 0, 0, .45); }
.rs__media figcaption a { color: inherit; text-decoration: none; }
.rs__media figcaption a:hover { text-decoration: underline; }


/* ---------- experience: read like a well-set page, not a template ---------- */
.xp__role {
  font-family: var(--text-serif); font-style: italic; font-size: 17px; line-height: 1.4;
  letter-spacing: 0; color: var(--text-2); margin-top: 4px;
}
.xp__sum {
  font-family: var(--text-serif); font-size: 20px; line-height: 1.5; letter-spacing: -0.003em;
  font-variation-settings: "opsz" 18; color: var(--text); margin-top: 14px; max-width: 34em;
  hanging-punctuation: first; text-wrap: pretty;
}
.xp__when { font-size: 12px; color: var(--text-2); padding-top: 3px; }
.xp__meta { padding-top: 12px; }
.xp__org { text-wrap: balance; }
@media (max-width: 734px) {
  .xp__sum { font-size: 18px; }
  .xp__meta { padding: 0 0 6px; }
}

.pw__media { position: relative; }
.pw__credit {
  position: absolute; left: 8px; bottom: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0;
  color: #f5f5f7; background: rgba(0, 0, 0, .45); padding: 3px 8px; border-radius: 980px; text-decoration: none;
}
.pw__credit:hover { text-decoration: underline; }

/* ---------- contribution graph ---------- */
.gc { margin-top: 6px; }
.gc__svg { display: block; width: 100%; height: auto; overflow: visible; }
.gc__lbl { font: 400 9px var(--mono); fill: var(--text-2); }
.gc__c { transform-box: fill-box; transform-origin: center; transform: scale(.4); opacity: 0;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .5s var(--ease); transition-delay: var(--d); }
.gh__activity.is-drawn .gc__c { transform: none; opacity: 1; }
.gc__c--0 { fill: color-mix(in srgb, var(--text) 8%, transparent); }
.gc__c--1 { fill: color-mix(in srgb, var(--blue) 32%, transparent); }
.gc__c--2 { fill: color-mix(in srgb, var(--blue) 55%, transparent); }
.gc__c--3 { fill: color-mix(in srgb, var(--blue) 78%, transparent); }
.gc__c--4 { fill: var(--blue); }
.gc__legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px;
  font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.gc__legend i { width: 11px; height: 11px; border-radius: 2.5px; display: inline-block; }
.gc__legend .gc__c--0 { background: color-mix(in srgb, var(--text) 8%, transparent); }
.gc__legend .gc__c--1 { background: color-mix(in srgb, var(--blue) 32%, transparent); }
.gc__legend .gc__c--2 { background: color-mix(in srgb, var(--blue) 55%, transparent); }
.gc__legend .gc__c--3 { background: color-mix(in srgb, var(--blue) 78%, transparent); }
.gc__legend .gc__c--4 { background: var(--blue); }
@media (prefers-reduced-motion: reduce) { .gc__c { transform: none; opacity: 1; transition: none; } }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* headlines "generate" word by word, each sharpening from a blur, with a caret that follows */
.reveal.gen { opacity: 1; transform: none; transition: none; }
.gen { --step: 130ms; }
.gen__w {
  position: relative; display: inline-block;
  opacity: 0; filter: blur(10px); transform: translateY(0.12em);
  transition: opacity .55s var(--ease), filter .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i) * var(--step) + 120ms);
}
.gen.is-in .gen__w { opacity: 1; filter: blur(0); transform: none; }
.gen__w::after {
  content: ""; position: absolute; right: -0.14em; top: 0.14em; bottom: 0.1em; width: 0.05em; min-width: 2px;
  background: var(--blue); border-radius: 1px; opacity: 0;
}
.tile--black .gen__w::after { background: var(--link-dark); }
.gen.is-in .gen__w::after { animation: caret var(--step) linear both; animation-delay: calc(var(--i) * var(--step) + 160ms); }
.gen.is-in .gen__w:last-child::after { animation: caret-end 1.5s steps(1) both; animation-delay: calc(var(--i) * var(--step) + 160ms); }
@keyframes caret { 0% { opacity: 0; } 5%, 95% { opacity: 1; } 100% { opacity: 0; } }
@keyframes caret-end { 0%, 40%, 80% { opacity: 1; } 20%, 60%, 100% { opacity: 0; } }

/* ---------- breakpoints ---------- */
@media (max-width: 1068px) {
  .tile { padding: 100px 22px; }
  .nav__links { margin-left: 24px; }
  .card { padding: 32px 32px 36px; }
  .role { padding: 40px 36px 36px; }
}
@media (max-width: 734px) {
  body { font-size: 17px; }
  .tile { padding: 72px 16px; }
  .hero { padding: 48px 0 0; }
  .hero .tile__text { padding: 0 16px; }
  .hero__stage { height: 360px; margin-top: 8px; }
  .contact { padding: 110px 16px; }
  .grid, .roles, .prose, .panel .visual { margin-top: 44px; }
  .panel { padding: 56px 20px 52px; border-radius: 18px; margin-left: -4px; margin-right: -4px; }
  .panel .grid { margin-top: 40px; }
  .tabs__tab { padding: 8px 16px; font-size: 14px; }
  .hobby__ph { aspect-ratio: 16 / 10; }
  .grid--2 { grid-template-columns: 1fr; }
  .card { padding: 28px 24px 30px; border-radius: 18px; }
  .role { padding: 30px 24px 28px; border-radius: 18px; }
  .role__name { font-size: 24px; }
  .role__summary { font-size: 19px; }
  .role__metrics { gap: 20px 32px; }
  .card__big { white-space: normal; }
  .visual__img { border-radius: 12px; }
  .project__details { margin-top: 48px; }
  .project__details h4 { font-size: 21px; }
  .details li { font-size: 16px; }
  .chat__log { height: 340px; }
  .msg { max-width: 90%; }
  .footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .nav__toggle { display: block; }
  .nav__links {
    /* the nav's backdrop-filter makes it the containing block, so size explicitly */
    position: fixed; top: 44px; left: 0; right: 0; height: calc(100vh - 44px); height: calc(100dvh - 44px); margin: 0;
    flex-direction: column; justify-content: flex-start;
    padding: 12px 40px 40px; background: var(--nav-solid);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s .3s;
  }
  .nav__links.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .3s var(--ease), transform .3s var(--ease); }
  .nav__links a { font-size: 28px; font-weight: 600; line-height: 1.6; opacity: 1; padding: 0; letter-spacing: 0.007em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .gen__w { opacity: 1; filter: none; transform: none; }
  .gen__w::after { display: none; }
  .hl { background-size: 100% 1px; }
}
