:root {
  color-scheme: light;
  --paper: #f6f7f1;
  --white: #fffefa;
  --ink: #202a23;
  --secondary: #435149;
  --forest: #245440;
  --deep: #173d2e;
  --line: #d6ded2;
  --soft: #e8eee3;
  --outline: #aebdaf;
  --panel-border: #c6d3c4;
  --accent: #173d2e;
  --accent-hover: #245440;
  --accent-text: #ffffff;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121b17;
  --white: #1b2820;
  --ink: #edf3ee;
  --secondary: #b9cbbd;
  --forest: #abd6b9;
  --deep: #d9f0de;
  --line: #3c4a40;
  --soft: #223126;
  --outline: #63796b;
  --panel-border: #4d6656;
  --accent: #bce6c7;
  --accent-hover: #d0f2d7;
  --accent-text: #14271a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
h1, h2, h3, p, figure, ul { margin: 0; }
a { color: var(--forest); text-decoration-thickness: .07em; text-underline-offset: .19em; }
a:hover { color: var(--ink); text-decoration-thickness: .13em; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--forest); outline-offset: 4px; }
.wrap { width: min(100% - 48px, 1120px); margin-inline: auto; }
.skip-link { position: fixed; z-index: 2; inset: .75rem auto auto .75rem; transform: translateY(-180%); background: var(--white); padding: .5rem 1rem; }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; }
.header-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; min-height: 76px; padding-block: .75rem; }
.wordmark { color: var(--deep); font: 700 1.22rem/1.2 var(--serif); text-decoration: none; white-space: nowrap; }
.site-header nav { display: flex; align-items: center; justify-self: end; flex-wrap: wrap; gap: .6rem clamp(.85rem, 2vw, 1.55rem); }
.site-header nav a { font-size: .9rem; font-weight: 600; text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
.nav-cv { border: 1px solid var(--outline); border-radius: .35rem; padding: .35rem .7rem; }
.theme-toggle { min-height: 2.3rem; min-width: 4.9rem; padding: .35rem .6rem; border: 1px solid var(--outline); border-radius: .35rem; background: var(--white); color: var(--forest); font: 650 .875rem/1.2 var(--sans); cursor: pointer; }
.theme-toggle:hover { background: var(--soft); color: var(--ink); }
.theme-toggle::before { content: "☾"; margin-inline-end: .3rem; }
[data-theme="dark"] .theme-toggle::before { content: "☀︎"; }

.hero { display: grid; grid-template-columns: 1.09fr 1fr; align-items: center; gap: clamp(2rem, 5.3vw, 4.5rem); padding-block: clamp(3.3rem, 7.1vw, 6.25rem); }
.eyebrow { color: var(--forest); font-weight: 700; font-size: .86rem; line-height: 1.45; letter-spacing: .07em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--deep); }
h1 { margin-top: .55rem; font-size: clamp(4rem, 7.5vw, 6.65rem); letter-spacing: -.075em; line-height: 1.04; }
.hero-lead { max-width: 36ch; margin-top: 1rem; color: var(--deep); font: 1.5rem/1.36 var(--serif); }
.bio { margin-top: 1.1rem; max-width: 55ch; color: var(--secondary); }
.profile-links { display: flex; align-items: center; gap: .55rem 1.15rem; flex-wrap: wrap; list-style: none; padding: 0; margin-top: 1.6rem; font-size: .9rem; font-weight: 650; }
.button { display: inline-block; padding: .55rem .9rem; border-radius: .35rem; color: var(--accent-text); background: var(--accent); text-decoration: none; }
.button:hover { color: var(--accent-text); background: var(--accent-hover); }
.hero-image { position: relative; overflow: hidden; border: 1px solid var(--panel-border); border-radius: .5rem; background: var(--soft); }
.hero-image img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.image-labels { position: absolute; bottom: .85rem; inset-inline: .85rem; display: flex; justify-content: space-between; gap: 1rem; }
.image-labels span { border: 1px solid #77867d; border-radius: .25rem; padding: .24rem .55rem; background: #183328; color: white; font-size: .79rem; font-weight: 650; }
figcaption { margin-top: .5rem; color: var(--secondary); font-size: .83rem; }

.section { margin-bottom: clamp(3.5rem, 7vw, 6rem); scroll-margin-top: 1.25rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; margin-bottom: 1.35rem; }
.section-heading > a, .paper-links a { font-size: .9rem; font-weight: 700; }
h2 { font-size: clamp(2.15rem, 4vw, 3.15rem); letter-spacing: -.055em; line-height: 1.06; }
.work-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1rem; }
.paper { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; padding: clamp(1rem, 2.4vw, 1.6rem); border: 1px solid var(--line); border-radius: .5rem; background: var(--white); }
.paper-featured { background: var(--soft); border-color: var(--panel-border); }
h3 { margin-block: .72rem .6rem; font-size: clamp(1.45rem, 2.3vw, 1.85rem); line-height: 1.16; letter-spacing: -.028em; }
.paper p:not(.eyebrow) { color: var(--secondary); }
.paper .authors { margin-bottom: .85rem; font-size: .875rem; line-height: 1.52; }
.authors strong { color: var(--ink); }
.paper-links { display: flex; flex-wrap: wrap; gap: .45rem 1.2rem; margin-top: auto; padding-top: 1.15rem; }
.research-panel { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1.25rem clamp(2rem, 6vw, 4.75rem); padding: clamp(1.4rem, 4.25vw, 3.3rem); border: 1px solid var(--panel-border); border-radius: .5rem; background: var(--soft); }
.research-question { margin-top: 1rem; max-width: 28ch; font: 1.35rem/1.38 var(--serif); color: var(--deep); }
.research-copy { align-self: center; color: var(--secondary); }
.research-copy p + p { margin-top: .7rem; }

.background-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr); align-items: start; gap: clamp(1.5rem, 5vw, 3.8rem); }
.education-card { padding: clamp(1.25rem, 3.1vw, 2rem); border: 1px solid var(--panel-border); border-radius: .5rem; background: var(--soft); color: var(--secondary); }
.education-card .degree { margin-block: .7rem .9rem; color: var(--ink); font-weight: 650; }
.experience-list { list-style: none; margin: 0; padding: 0; color: var(--secondary); }
.experience-list li { padding: 0 0 1.25rem; border-bottom: 1px solid var(--line); }
.experience-list li + li { padding-top: 1.25rem; }
.experience-list h3, .project h3 { margin-block: .45rem .35rem; }
.advisor { margin-bottom: .55rem; color: var(--ink); font-size: .9rem; font-weight: 650; }
.section-context { color: var(--secondary); font-size: .9rem; }
.project-list { border-top: 1px solid var(--line); }
.project { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.4fr); align-items: start; gap: .5rem clamp(1.5rem, 5vw, 3.8rem); padding-block: 1.35rem; border-bottom: 1px solid var(--line); color: var(--secondary); }
.project .advisor { margin-bottom: 0; }
.project-link { margin-top: .55rem; font-size: .9rem; font-weight: 700; }

.timeline { list-style: none; padding: 0; }
.timeline li { display: grid; grid-template-columns: 8rem 1fr; gap: .3rem 1rem; padding-block: .95rem; border-bottom: 1px solid var(--line); }
.timeline li:first-child { padding-top: .3rem; }
.timeline time { font-weight: 700; font-size: .9rem; color: var(--forest); padding-top: .13rem; }
.timeline p { max-width: 79ch; }
.site-footer { padding-block: 1.25rem; border-top: 1px solid var(--line); font-size: .88rem; color: var(--secondary); }
.site-footer span { margin-inline: .2rem; }

.cv-layout { max-width: 830px; padding-block: clamp(2.5rem, 7vw, 5rem); }
.cv-layout h1 { font-size: clamp(3.45rem, 7vw, 5.6rem); margin-top: 0; }
.cv-layout .hero-lead { margin-top: .55rem; }
.cv-layout section { margin-top: 2.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.cv-layout h2 { font-size: clamp(1.85rem, 4vw, 2.4rem); margin-bottom: 1rem; }
.cv-layout h3 { font-size: 1.35rem; margin-block: 0 .3rem; }
.cv-list { list-style: none; padding: 0; }
.cv-list li + li { margin-top: 1.1rem; }
.cv-detail { color: var(--secondary); }
.print-button { margin-top: 1.15rem; border: 0; font: 650 .9rem/1.5 var(--sans); cursor: pointer; }

@media (max-width: 850px) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-featured { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .header-inner { grid-template-columns: 1fr auto; gap: .6rem 1rem; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .theme-toggle { grid-column: 2; grid-row: 1; }
}
@media (max-width: 710px) {
  .hero { grid-template-columns: 1fr; }
  .hero-figure { width: min(100%, 560px); }
  .research-panel, .background-grid, .project { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .wrap { width: calc(100% - 32px); }
  .site-header nav { gap: .4rem .65rem; }
  .site-header nav a { font-size: .875rem; }
  .nav-cv { padding: .2rem .42rem; }
  .work-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; }
  .footer-inner { flex-wrap: wrap; gap: .35rem 1rem; }
}
@media (max-width: 350px) {
  h1 { font-size: 3.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  :root[data-theme] { color-scheme: light; }
  body { background: white; color: black; font-size: 10pt; }
  .site-header, .site-footer, .print-button, .skip-link { display: none; }
  .cv-layout { --deep: #173d2e; --forest: #245440; --secondary: #435149; --line: #d6ded2; width: 100%; padding: 0; }
  .cv-layout h1 { font-size: 34pt; }
  .cv-layout h2 { font-size: 16pt; }
  .cv-layout h3 { font-size: 12pt; }
  .cv-layout section { margin-top: 1rem; padding-top: .6rem; }
  .cv-layout h2, .cv-list li { break-inside: avoid; }
  .cv-layout h2 { break-after: avoid; }
}
