/* ============== Tokens ============== */
:root {
  --accent: #5b6cff;

  /* Light theme */
  --bg: #fafaf9;
  --bg-alt: #f3f3f1;
  --bg-card: #ffffff;
  --fg: #131316;
  --fg-muted: #54545a;
  --fg-soft: #8a8a91;
  --line: #e5e5e2;
  --line-strong: #d6d6d2;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 0 rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 0 rgba(0,0,0,0.04), 0 8px 24px -12px rgba(20,20,30,0.10);

  --pad-y: 120px;
  --pad-x: 40px;
  --max: 1200px;

  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0e0e10;
  --bg-alt: #161618;
  --bg-card: #1a1a1d;
  --fg: #f4f4f3;
  --fg-muted: #a4a4a8;
  --fg-soft: #6f6f74;
  --line: #26262a;
  --line-strong: #34343a;
  --shadow-md: 0 1px 0 rgba(0,0,0,0.4), 0 12px 32px -12px rgba(0,0,0,0.6);
}

[data-density="compact"]      { --pad-y: 84px;  }
[data-density="comfortable"]  { --pad-y: 120px; }
[data-density="spacious"]     { --pad-y: 160px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
em { font-style: normal; font-family: var(--font-serif); font-weight: 400; letter-spacing: -0.01em; }

/* ============== Nav ============== */
.nav {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 12px auto 0;
  max-width: var(--max);
  width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 14px 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 200ms ease, border-color 200ms ease, backdrop-filter 200ms ease;
}
.nav--scrolled {
  background: color-mix(in oklab, var(--bg) 75%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-color: var(--line);
}
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.nav__brand-mark {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.nav__brand-name { letter-spacing: -0.01em; }
.nav__links { display: flex; gap: 4px; margin-left: auto; }
.nav__links a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: 14px;
  transition: color 150ms ease, background 150ms ease;
}
.nav__links a:hover { color: var(--fg); background: var(--bg-alt); }
.nav__cv {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  transition: color 150ms, border-color 150ms;
}
.nav__cv:hover { color: var(--fg); border-color: var(--fg); }

.nav__theme {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.nav__theme:hover { color: var(--fg); border-color: var(--fg); background: var(--bg-card); }

.nav__cta {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  transition: transform 150ms ease;
}
.nav__cta:hover { transform: translateY(-1px); }
@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* ============== Hero ============== */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px var(--pad-x) 96px;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: end;
}
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 32px; }
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-muted);
  background: var(--bg-card);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-soft); }
.dot--live {
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.6);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.hero__title {
  font-size: clamp(44px, 6.4vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 24px 0 28px;
  text-wrap: balance;
}
.hero__title em { color: var(--accent); }
.hero__lede {
  font-size: 18px;
  color: var(--fg-muted);
  max-width: 56ch;
  text-wrap: pretty;
  margin: 0 0 32px;
}
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero card */
.hero__card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.hero__card-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--fg-soft);
}
.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--fg-muted);
}
.hero__card-time { font-family: var(--font-mono); }
.hero__card-name { display: flex; align-items: center; gap: 14px; }
.hero__avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--fg-muted);
  overflow: hidden;
  display: grid; place-items: center;
}
.hero__card-h { font-weight: 600; letter-spacing: -0.01em; }
.hero__card-s { color: var(--fg-muted); font-size: 13px; }
.hero__meta { margin: 0; padding: 0; display: grid; gap: 10px; }
.hero__meta > div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  font-size: 13.5px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.hero__meta dt { color: var(--fg-soft); margin: 0; font-weight: 500; }
.hero__meta dd { color: var(--fg); margin: 0; }
.hero__links {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.hero__links a { color: var(--fg-muted); font-size: 13px; transition: color 150ms; }
.hero__links a:hover { color: var(--accent); }

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
  cursor: pointer;
}
.btn--primary { background: var(--fg); color: var(--bg); }
.btn--primary:hover { transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--fg); }
.btn--ghost-light { background: transparent; color: var(--bg); border-color: color-mix(in oklab, var(--bg) 30%, transparent); }
.btn--ghost-light:hover { border-color: var(--bg); }
.btn--lg { padding: 16px 26px; font-size: 16px; }

/* See more / project CTA */
.see-more {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 32px;
  padding: 24px 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 200ms, background 200ms;
}
.see-more:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 4%, transparent); }
.see-more__label { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.see-more__sub { font-size: 14px; color: var(--fg-muted); }

/* Timeline detail */
.timeline__detail { color: var(--fg-muted); margin: 0; max-width: 70ch; }

/* Footer CV button spacing */
.footer__cv { margin-left: 12px; }
@media (max-width: 600px) {
  .footer__cv { margin-left: 0; margin-top: 10px; }
}

/* Print styles — for when employer prints to PDF */
@media print {
  .nav, .tweaks, .nav__cta, .nav__cv, .hero__cta, .footer .btn, .see-more, .project__arrow { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero, .section, .footer__inner, .footer__base { padding-top: 12pt; padding-bottom: 12pt; }
  .footer { background: #fff; color: #000; }
  .footer__cols a, .footer__cols span, .footer__sub, .footer__title, .footer__eyebrow, .footer__col-h { color: #000 !important; }
  a { color: #000 !important; text-decoration: underline; }
  .section { border-top: 1px solid #ccc; }
  .hero__title, .section__title, .footer__title { font-size: 22pt !important; }
}

/* ============== Section ============== */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x);
  border-top: 1px solid var(--line);
}
.section--alt { background: var(--bg-alt); max-width: none; padding-left: 0; padding-right: 0; }
.section--alt > * { max-width: var(--max); margin-left: auto; margin-right: auto; padding-left: var(--pad-x); padding-right: var(--pad-x); }
.section__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 56px;
}
.section__head-l { display: flex; align-items: center; gap: 14px; grid-column: 1 / -1; }
.section__num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-soft);
  letter-spacing: 0.06em;
}
.section__eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-card);
}
.section__title {
  font-size: clamp(32px, 4.4vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}
.section__kicker { justify-self: end; }
.kicker { color: var(--fg-muted); font-size: 14px; }
.kicker:hover { color: var(--accent); }

/* ============== About ============== */
.about__grid {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px;
}
@media (max-width: 800px) {
  .about__grid { grid-template-columns: 1fr; gap: 24px; }
}
.about__lede {
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin: 0;
  text-wrap: pretty;
}
.about__lede strong { font-weight: 500; color: var(--accent); }
.about__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; align-content: start; }
.about__list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.about__list li:last-child { border-bottom: 1px solid var(--line); }
.about__list span { color: var(--fg-soft); font-size: 13px; padding-top: 1px; }
.about__list strong { font-weight: 500; }

/* ============== Timeline ============== */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline__item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.timeline__item:last-child { border-bottom: 1px solid var(--line); }
.timeline__when { font-family: var(--font-mono); font-size: 13px; color: var(--fg-soft); padding-top: 4px; }
.timeline__role { font-size: 22px; letter-spacing: -0.015em; margin: 0 0 14px; font-weight: 600; }
.timeline__org { color: var(--fg-muted); font-weight: 400; }
.timeline__bullets { padding-left: 18px; margin: 0 0 16px; color: var(--fg-muted); }
.timeline__bullets li { margin-bottom: 6px; }
@media (max-width: 720px) {
  .timeline__item { grid-template-columns: 1fr; gap: 12px; }
}

/* ============== Chips ============== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--fg-muted);
  background: var(--bg-card);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.chip--sm { font-size: 11.5px; padding: 4px 9px; }

/* ============== Papers ============== */
.papers { display: grid; gap: 16px; }
.paper {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: border-color 200ms ease, transform 200ms ease;
}
.paper:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.paper__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}
.paper__role {
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); font-weight: 500;
}
.paper__when { font-family: var(--font-mono); color: var(--fg-soft); }
.paper__title { font-size: 20px; letter-spacing: -0.015em; margin: 0 0 10px; line-height: 1.25; font-weight: 600; }
.paper__summary { color: var(--fg-muted); margin: 0 0 18px; font-size: 15px; max-width: 75ch; }
.paper__foot { display: flex; align-items: center; gap: 10px; }
.paper__doi {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--font-mono); font-size: 12px;
  overflow: hidden;
  transition: border-color 200ms ease;
}
.paper__doi:hover { border-color: var(--accent); }
.paper__doi-label { padding: 5px 9px; background: var(--bg-alt); color: var(--fg-soft); border-right: 1px solid var(--line); }
.paper__doi-id { padding: 5px 10px; color: var(--fg-muted); }
.paper__doi--pending .paper__doi-label { color: var(--accent); }

/* ============== Projects ============== */
.projects { display: grid; gap: 0; }
.project {
  display: grid;
  grid-template-columns: 60px 1fr 30px;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  position: relative;
  transition: padding 200ms ease;
}
.project:last-child { border-bottom: 1px solid var(--line); }
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: -1;
  margin: 0 -24px;
  border-radius: var(--radius);
}
.project:hover { padding-left: 24px; padding-right: 24px; }
.project:hover::before { opacity: 0.04; }
.project__num { font-family: var(--font-mono); color: var(--fg-soft); font-size: 13px; }
.project__head {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px;
  flex-wrap: wrap;
}
.project__name { font-size: 24px; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
.project__tag { font-size: 13px; color: var(--fg-soft); font-family: var(--font-mono); }
.project__desc { margin: 0 0 14px; color: var(--fg-muted); font-size: 15px; max-width: 70ch; }
.project__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.project__role { font-size: 12px; color: var(--fg-soft); font-family: var(--font-mono); }
.project__arrow { color: var(--fg-soft); font-size: 22px; transition: transform 200ms ease, color 200ms ease; }
.project:hover .project__arrow { transform: translate(2px, -2px); color: var(--accent); }

@media (max-width: 720px) {
  .project { grid-template-columns: 1fr 24px; }
  .project__num { display: none; }
}

/* ============== Skills ============== */
.skills { display: grid; gap: 0; }
.skill-group {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.skill-group:last-child { border-bottom: 1px solid var(--line); }
.skill-group__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-soft);
  font-weight: 500;
}
.skill-group__items { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 600px) { .skill-group { grid-template-columns: 1fr; gap: 8px; } }

/* ============== Achievements ============== */
.ach {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.ach__item {
  padding: 32px 24px;
  border-right: 1px solid var(--line);
}
.ach__item:last-child { border-right: 0; }
.ach__num {
  font-size: 44px;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
  font-family: var(--font-serif);
  font-style: italic;
}
.ach__label { font-size: 14px; color: var(--fg-muted); }
@media (max-width: 800px) {
  .ach { grid-template-columns: repeat(2, 1fr); }
  .ach__item:nth-child(2) { border-right: 0; }
  .ach__item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* ============== Footer ============== */
.footer { background: var(--fg); color: var(--bg); margin-top: 80px; }
.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 96px var(--pad-x) 64px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
}
.footer__eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: color-mix(in oklab, var(--bg) 55%, transparent);
  margin-bottom: 18px;
}
.footer__title {
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  font-weight: 600;
  text-wrap: balance;
  line-height: 1.05;
}
.footer__sub { color: color-mix(in oklab, var(--bg) 70%, transparent); margin: 0 0 28px; max-width: 50ch; }
.footer .btn--primary { background: var(--bg); color: var(--fg); }
.footer__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-self: end; }
.footer__col-h {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: color-mix(in oklab, var(--bg) 55%, transparent);
  margin-bottom: 14px;
}
.footer__cols ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer__cols a, .footer__cols span { color: color-mix(in oklab, var(--bg) 80%, transparent); font-size: 14px; transition: color 150ms ease; }
.footer__cols a:hover { color: var(--bg); }
.footer__base {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--pad-x);
  border-top: 1px solid color-mix(in oklab, var(--bg) 12%, transparent);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: color-mix(in oklab, var(--bg) 50%, transparent);
}
@media (max-width: 800px) {
  .footer__inner { grid-template-columns: 1fr; gap: 32px; }
  .footer__cols { grid-template-columns: 1fr 1fr; }
  .footer__base { flex-direction: column; gap: 6px; }
}

/* ============== Tweaks ============== */
.tweaks {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px;
  z-index: 100;
  font-size: 13px;
}
.tweaks__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tweaks__title { font-weight: 600; letter-spacing: -0.01em; }
.tweaks__close {
  width: 24px; height: 24px;
  border: 0; background: transparent;
  font-size: 18px; line-height: 1;
  color: var(--fg-muted); cursor: pointer;
  border-radius: 6px;
}
.tweaks__close:hover { background: var(--bg-alt); color: var(--fg); }
.tweaks__group { margin-bottom: 12px; }
.tweaks__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-soft);
  margin-bottom: 6px;
}
.tweaks__seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}
.tweaks__seg-btn {
  border: 0; background: transparent;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: 6px;
  text-transform: capitalize;
  font-family: inherit;
  transition: background 150ms, color 150ms;
}
.tweaks__seg-btn.is-active { background: var(--bg-card); color: var(--fg); box-shadow: var(--shadow-sm); }
.tweaks__swatches { display: flex; gap: 8px; }
.tweaks__sw {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  outline: 1px solid var(--line);
  cursor: pointer;
  transition: transform 150ms;
}
.tweaks__sw:hover { transform: scale(1.08); }
.tweaks__sw.is-active { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ============== Misc ============== */
::selection { background: var(--accent); color: white; }
