:root {
  --bg: #faf8f3;
  --surface: #f4f1e8;
  --surface-2: #fffdf8;
  --logo-bg: #ffffff;
  --text: #1f1e2c;
  --text-2: #2c2b3a;
  --text-3: #3c3a4a;
  --muted: #5d5a6c;
  --muted-2: #4b4858;
  --faint: #6b6878;
  --faint-2: #8a8696;
  --accent: #4a4490;
  --rule: #1f1e2c;
  --line: #e6e1d4;
  --line-soft: #ece7da;
  --pill-border: #d9d3c4;
  --chip-bg: #1f1e2c;
  --chip-text: #fff7ea;
  --header-bg: rgba(250, 248, 243, 0.92);
  --hero-image: url("/design/hero-photo.541b1422c035f72cb81394a0ef982e45b2916aed29236198b3982903be9700b6.webp");
  --hero-pos: 46% 30%;
  --hero-scrim:
    linear-gradient(90deg, rgba(244, 234, 222, 0.92) 0%, rgba(244, 234, 222, 0.78) 44%, rgba(244, 234, 222, 0.28) 66%, rgba(244, 234, 222, 0) 100%),
    linear-gradient(0deg, rgba(244, 234, 222, 0.78) 0%, rgba(244, 234, 222, 0.34) 34%, rgba(244, 234, 222, 0) 62%);
}

html[data-theme="dark"] {
  --bg: #131019;
  --surface: #0e0c14;
  --surface-2: #17131f;
  --logo-bg: #f3f0e9;
  --text: #f4f1ea;
  --text-2: #e6e2d8;
  --text-3: #d2cde0;
  --muted: #a39eb2;
  --muted-2: #b3aec0;
  --faint: #948fa6;
  --faint-2: #807b93;
  --accent: #b6aef0;
  --rule: #4a4659;
  --line: #2b2836;
  --line-soft: #24222e;
  --pill-border: #3a3746;
  --chip-bg: #f4f1ea;
  --chip-text: #131019;
  --header-bg: rgba(19, 16, 25, 0.94);
  --hero-image: url("/design/hero-photo-dark.f4ef901da3584d6b53388c6a362803c5c63f88f95a6fb28f23733026632f9477.webp");
  --hero-pos: 46% 28.6%;
  --hero-scrim:
    linear-gradient(90deg, rgba(19, 16, 25, 0.95) 0%, rgba(19, 16, 25, 0.82) 44%, rgba(19, 16, 25, 0.38) 68%, rgba(19, 16, 25, 0) 100%),
    linear-gradient(0deg, rgba(19, 16, 25, 0.86) 0%, rgba(19, 16, 25, 0.42) 36%, rgba(19, 16, 25, 0) 64%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--bg);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.menu-toggle { display: none; }
.menu-toggle[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.privacy-controls {
  padding: 0 24px 20px;
  text-align: center;
}

.privacy-controls button, .privacy-actions button {
  border: 1px solid var(--pill-border);
  border-radius: 4px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: 500 14px "IBM Plex Sans", system-ui, sans-serif;
}

.privacy-banner {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: 16px;
  left: 16px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: auto;
  padding: 18px;
  border: 1px solid var(--pill-border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 4px 20px #0003;
}

.privacy-banner[hidden] { display: none; }
.privacy-banner p { margin: 0 0 12px; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 8px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Literata", Georgia, serif;
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #e2dcf4;
}

html[data-theme="dark"] ::selection {
  background: #3a3550;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--text);
}

p,
ul,
ol,
li {
  font-size: 1rem;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  line-height: 1.16;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 3.35rem);
  font-weight: 700;
}

h2 {
  font-size: 26px;
  font-weight: 600;
}

h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}

main,
footer {
  width: 100%;
}

main:not(.home-main) {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 32px 96px;
}

body > footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

body > footer .footer-text,
body > footer p {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 32px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
}

.site-header__inner {
  max-width: 1060px;
  height: 64px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-brand,
nav a,
.inline-nav,
.breadcrumbs,
.article-meta,
.subtitle,
.links-row,
.xp-meta,
.pub-meta,
.footer-text,
.contact-list {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.site-brand {
  color: var(--muted-2);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-brand:hover,
nav a:hover {
  color: var(--accent);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  row-gap: 8px;
}

nav a {
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.research-kicker {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.5rem, 7vw, 3.35rem);
  font-weight: 700;
  line-height: 1.16;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle,
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover,
.lang-toggle:hover {
  background: var(--line-soft);
  color: var(--text);
}

body > .theme-toggle,
body > .lang-toggle {
  position: fixed;
  top: 18px;
  z-index: 50;
  background: var(--bg);
}

body > .theme-toggle {
  right: 18px;
}

body > .lang-toggle {
  right: 62px;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.lang-toggle {
  padding: 0 13px;
}

.hero {
  position: relative;
  min-height: 600px;
  margin-top: -64px;
  padding-top: 64px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background-image: var(--hero-image);
  background-position: var(--hero-pos);
  background-size: cover;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-scrim);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 44px 32px;
}

.hero__content {
  max-width: clamp(300px, 44vw, 560px);
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--muted);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.hero h1 {
  max-width: 9ch;
  font-size: clamp(2.1rem, 10.8vw, 3rem);
  font-weight: 600;
  line-height: 1.24;
}

.hero__lead {
  max-width: 100%;
  margin: 16px 0 0;
  color: var(--text-3);
  font-size: 1.05rem;
  line-height: 1.52;
}

.hero__actions,
.hero__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

.hero__actions {
  margin-top: 24px;
}

.hero__links {
  margin-top: 22px;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.button-primary {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.button-primary:hover {
  color: var(--chip-text);
  opacity: 0.86;
}

.text-link-strong {
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid var(--text);
  padding-bottom: 2px;
}

.resume-link {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 56px 32px 0;
}

#contact {
  padding-bottom: 56px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.section-heading {
  margin-bottom: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.bio-stack {
  display: grid;
  gap: 16px;
  color: var(--text-2);
}

.bio,
.section-note,
.desc,
.card p,
.article-body p,
.article-body li {
  color: var(--muted);
}

.bio {
  margin: 0 0 16px;
}

.bio-stack .bio {
  margin: 0;
}

.xp-entry {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

.xp-entry:first-of-type {
  padding-top: 0;
}

.xp-entry:last-child {
  border-bottom: 0;
}

.xp-logo {
  flex: none;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--logo-bg);
  object-fit: contain;
  padding: 4px;
}

.xp-logo--badge {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.xp-body strong,
.entry strong,
.pub-item strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.xp-meta {
  margin: 4px 0 6px;
  color: var(--faint-2);
  font-size: 13px;
  font-weight: 500;
}

.desc,
.pub-item p,
.card p,
.article-body p,
.article-body li {
  margin: 0;
}

.edu-heading {
  margin-top: 48px;
}

.edu-entry {
  padding-bottom: 0;
  border-bottom: 0;
}

.edu-stage + .edu-stage {
  margin-top: 14px;
}

.edu-stage .desc {
  margin-top: 4px;
}

.education-grid,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.mini-card,
.card {
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}

.mini-card p,
.section-note {
  margin: 8px 0 0;
}

.section-note {
  max-width: 720px;
}

.card-grid {
  display: grid;
}

.card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 22px;
}

.card:first-child {
  border-top-color: var(--rule);
}

.card h3 a {
  color: var(--text);
  text-decoration: none;
}

.card h3 a:hover {
  color: var(--accent);
}

.pub-meta {
  color: var(--faint-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.pub-year {
  color: var(--faint-2);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding-top: 5px;
}

.pub-list,
.contact-list,
.article-list,
.article-body ul {
  margin: 0;
  padding-left: 20px;
}

.contact-list {
  color: var(--muted);
}

.inline-nav,
.breadcrumbs,
.article-meta,
.footer-text,
.links-row,
.subtitle {
  color: var(--faint);
  font-size: 14px;
  line-height: 1.7;
}

.subtitle {
  margin: 14px 0 0;
  font-size: 17px;
}

.links-row {
  margin: 14px 0 0;
}

.author-bio {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.author-bio p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.author-bio strong {
  color: var(--text-2);
}

.article-byline {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--text-2);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.article-links {
  margin: 8px 0 0;
  color: var(--faint);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

.article-links a {
  text-underline-offset: 2px;
}

.article-links .sep {
  color: var(--faint-2);
  margin: 0 9px;
}

.article-header {
  margin: 34px 0 24px;
  padding-top: 24px;
  border-top: 2px solid var(--rule);
}

.article-title {
  max-width: 760px;
  margin-top: 10px;
  font-size: clamp(2rem, 5vw, 2.9rem);
}

.article-lead {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1.7;
}

.article-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.meta-pill .pill-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

.meta-pill:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface);
}

.article-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 18px;
}

.article-body > * {
  min-width: 0;
  max-width: 100%;
}

.article-body pre {
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.6;
}

.article-body :not(pre) > code {
  overflow-wrap: anywhere;
  font-size: 0.9em;
}

.article-body ul,
.article-body ol {
  display: grid;
  gap: 8px;
  padding: 18px 20px 18px 38px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.article-figure {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 6px 0;
  overflow: hidden;
}

.article-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
}

.article-figure figcaption {
  margin-top: 10px;
  color: var(--faint);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

.lecture-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 600;
  fill: var(--text);
}

.lecture-diagram .lecture-diagram__detail {
  font-size: 18px;
  font-weight: 500;
  fill: var(--muted);
}

.lecture-diagram__boundary {
  fill: none;
  stroke: var(--faint);
  stroke-dasharray: 5 5;
  stroke-width: 1.5;
}

.lecture-diagram__node,
.lecture-diagram__edge {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}

hr.major {
  margin: 24px 0 0;
  border-top: 2px solid var(--rule);
}

.section-note + hr.major {
  margin-top: 40px;
}

.profile-photo {
  display: none;
}

@media (max-width: 860px) {
  :root {
    --hero-image: url("/design/hero-photo-mobile.8e6b287cf1519a6ba24b56268c96b0381c87c0b097f20e86fba6177eb8d52667.webp");
  }
  html[data-theme="dark"] {
    --hero-image: url("/design/hero-photo-dark-mobile.5ea176fdde642b6e72cb406df6dbdd843a5d004892efec91f685a40cfca094c2.webp");
  }

  .site-header__inner {
    height: auto;
    min-height: 64px;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: flex-start;
  }

  .header-actions {
    gap: 8px;
    flex-shrink: 0;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--pill-border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: 600 12px "IBM Plex Sans", system-ui, sans-serif;
    cursor: pointer;
  }

  .site-header nav[data-menu-ready="true"] {
    display: none;
  }

  .site-header nav[data-expanded="true"] {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    padding: 8px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--pill-border);
    box-shadow: 0 6px 12px #0001;
  }

  .site-header nav a { padding: 12px 0; }

  .site-header nav:not([data-menu-ready]) {
    flex-direction: column;
    gap: 0;
  }

  .site-brand { white-space: normal; line-height: 1.3; }

  .hero {
    --hero-pos: 28% 30%;
    --hero-scrim:
      linear-gradient(90deg, rgba(244, 234, 222, 0.96) 0%, rgba(244, 234, 222, 0.88) 48%, rgba(244, 234, 222, 0.42) 70%, rgba(244, 234, 222, 0) 100%),
      linear-gradient(0deg, rgba(244, 234, 222, 0.82) 0%, rgba(244, 234, 222, 0.38) 36%, rgba(244, 234, 222, 0) 64%);
  }

  html[data-theme="dark"] .hero {
    --hero-pos: 28% 28.6%;
    --hero-scrim:
      linear-gradient(90deg, rgba(19, 16, 25, 0.96) 0%, rgba(19, 16, 25, 0.88) 48%, rgba(19, 16, 25, 0.48) 72%, rgba(19, 16, 25, 0) 100%),
      linear-gradient(0deg, rgba(19, 16, 25, 0.88) 0%, rgba(19, 16, 25, 0.46) 38%, rgba(19, 16, 25, 0) 66%);
  }

  .hero__content {
    max-width: min(42vw, 300px);
  }

  .hero h1 {
    font-size: clamp(2.1rem, 6vw, 2.45rem);
  }

  .hero__lead {
    font-size: 1rem;
    line-height: 1.5;
  }

  .split-grid,
  .education-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 38px;
  }
}

@media (max-width: 620px) {
  main:not(.home-main) {
    padding: 44px 20px 72px;
  }

  body > footer .footer-text,
  body > footer p,
  .site-header__inner,
  .hero__inner,
  .section {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero__content {
    max-width: min(58vw, 300px);
  }

  .card {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pub-year {
    padding-top: 0;
  }

  .header-row {
    display: block;
  }

  .header-row nav {
    margin-top: 14px;
  }

  body > .theme-toggle {
    top: 12px;
    right: 12px;
  }

  body > .lang-toggle {
    top: 12px;
    right: 56px;
  }

  h1 {
    font-size: 2.45rem;
  }
}
