/* Palette: limewash walls, Mediterranean shutters, Provence lavender, ochre, olive */
:root {
  --limewash: #FBFAF7;
  --ink: #1F2A44;
  --ink-soft: #4A5468;
  --shutter: #2F6497;
  --lavender: #8C7AB8;
  --lavender-pale: #E9E3F3;
  --ochre: #C98F2E;
  --olive: #6B7650;
  --rule: #E4E1DA;
  --sky-top: #DFE9F3;
  --sky-mid: #F5E9DE;

  --serif: "Fraunces", Georgia, serif;
  /* title levels: name / section / item */
  --title-1: "Parisienne", cursive;
  --title-2: "Playfair Display", Georgia, serif;
  --title-3: "Cormorant Garamond", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --limewash: #191C28;
    --ink: #ECE7DF;
    --ink-soft: #B4B2B8;
    --shutter: #9DBFE3;
    --lavender: #B9A9E3;
    --lavender-pale: #2C2840;
    --ochre: #E2B565;
    --olive: #A9B48A;
    --rule: #2F3242;
    --sky-top: #232A40;
    --sky-mid: #2A2433;
  }
}
:root[data-theme="dark"] {
  --limewash: #191C28;
  --ink: #ECE7DF;
  --ink-soft: #B4B2B8;
  --shutter: #9DBFE3;
  --lavender: #B9A9E3;
  --lavender-pale: #2C2840;
  --ochre: #E2B565;
  --olive: #A9B48A;
  --rule: #2F3242;
  --sky-top: #232A40;
  --sky-mid: #2A2433;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--limewash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--shutter);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--shutter) 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: var(--shutter); }
a:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 3px;
  border-radius: 2px;
}

p { margin: 0; }

/* ---------- Hero: the one bold moment ---------- */

.hero {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--limewash) 100%);
  padding: clamp(4rem, 12vw, 8rem) 1rem clamp(3rem, 8vw, 5rem);
}

.hero-inner {
  position: relative;
  max-width: var(--measure);
  margin: 0 auto;
}

.sprig {
  position: absolute;
  right: -5.5rem;
  top: -2.5rem;
  width: 6.5rem;
  height: auto;
  overflow: visible;
}
.sprig .stem {
  fill: none;
  stroke: var(--olive);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: draw 1.6s cubic-bezier(.5, 0, .2, 1) 0.2s forwards;
}
.sprig .leaf {
  fill: var(--olive);
  opacity: 0;
  animation: appear 0.8s ease 1.2s forwards;
}
.sprig .buds ellipse {
  fill: var(--lavender);
  opacity: 0;
  transform-box: fill-box;
  animation: appear 0.6s ease forwards;
}
/* buds open from the base of the spike upward */
.sprig .buds ellipse:nth-child(9) { animation-delay: 1.0s; }
.sprig .buds ellipse:nth-child(8) { animation-delay: 1.08s; }
.sprig .buds ellipse:nth-child(7) { animation-delay: 1.16s; }
.sprig .buds ellipse:nth-child(6) { animation-delay: 1.24s; }
.sprig .buds ellipse:nth-child(5) { animation-delay: 1.32s; }
.sprig .buds ellipse:nth-child(4) { animation-delay: 1.4s; }
.sprig .buds ellipse:nth-child(3) { animation-delay: 1.48s; }
.sprig .buds ellipse:nth-child(2) { animation-delay: 1.56s; }
.sprig .buds ellipse:nth-child(1) { animation-delay: 1.64s; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 0.9; } }

.name {
  margin: 0;
  font-family: var(--title-1);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 4.6rem);
  line-height: 1.1;
}

.role {
  margin-top: 0.75rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 360;
  font-size: 1.25rem;
  color: var(--ink-soft);
  font-variation-settings: "SOFT" 100, "opsz" 24;
}

.bio {
  margin-top: 2rem;
  font-size: 1.125rem;
  line-height: 1.7;
}
.bio p + p { margin-top: 1em; }

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  font-weight: 500;
}
.links .profile {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--shutter) 30%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--limewash) 70%, transparent);
  text-decoration: none;
  line-height: 1.2;
  transition: background-color 0.15s, border-color 0.15s;
}
.links .profile:hover {
  background: var(--lavender-pale);
  border-color: var(--lavender);
}
.links .profile svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex: none;
}
.links .plain {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  gap: 0.25rem 1.25rem;
  margin-top: 0.3rem;
}

/* ---------- Sections ---------- */

main {
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding: 0 1rem;
}

section { padding-top: 4.5rem; }
section:first-child { padding-top: 1.5rem; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

h2 {
  margin: 0;
  font-family: var(--title-2);
  font-style: italic;
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.2;
}

.aside {
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

h3 {
  margin: 0;
  font-family: var(--title-3);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.3;
}
h3 a { color: inherit; text-decoration-color: color-mix(in srgb, var(--ink) 25%, transparent); }
h3 a:hover { color: var(--shutter); text-decoration-color: var(--shutter); }

/* ---------- Research ---------- */

.group {
  margin: 2.5rem 0 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.125rem;
  color: var(--olive);
}
.group:first-of-type { margin-top: 0; }
.group span {
  margin-left: 0.4em;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.papers {
  list-style: none;
  margin: 0;
  padding: 0;
}
.papers li {
  position: relative;
  padding-left: 1.25rem;
}
.papers li + li { margin-top: 1.4rem; }
.papers li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.4rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--lavender);
  opacity: 0.75;
}
.papers .title { font-weight: 500; line-height: 1.45; }
.papers .authors,
.papers .venue {
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.papers .authors { margin-top: 0.2rem; }
.papers .authors b { color: var(--ink); font-weight: 600; }

/* ---------- Projects ---------- */

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}
.projects li + li {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px dashed var(--rule);
}
.projects li p:not(.meta) { margin-top: 0.5rem; }
.meta {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--olive);
}

/* ---------- Experience & education ---------- */

.timeline { margin: 0; }
.timeline .row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1.5rem;
}
.timeline .row + .row { margin-top: 2rem; }
.timeline dt {
  padding-top: 0.2rem;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.timeline dd { margin: 0; }
.timeline .sub {
  margin-top: 0.2rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.timeline .sub + p { margin-top: 0.6rem; }

.honors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}
.honors li {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--lavender-pale);
  font-size: 0.875rem;
  line-height: 1.4;
}
.honors li:first-child {
  background: color-mix(in srgb, var(--ochre) 18%, var(--limewash));
}

/* ---------- Personal statement: set for reading, not scanning ---------- */

.essay {
  font-family: var(--serif);
  font-weight: 360;
  font-size: 1.125rem;
  line-height: 1.8;
  font-variation-settings: "SOFT" 100, "opsz" 16;
  hanging-punctuation: first;
}
.essay p + p { margin-top: 1.1em; }
.essay .coda {
  margin-top: 2em;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.65;
  color: var(--olive);
}

/* ---------- Footer ---------- */

footer {
  max-width: calc(var(--measure) + 2rem);
  margin: 5rem auto 0;
  padding: 1.5rem 1rem 3rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

/* ---------- Small screens ---------- */

@media (max-width: 52rem) {
  .sprig { right: 0; top: -3rem; width: 3.6rem; }
  .name { padding-right: 3.5rem; }
}

@media (max-width: 34rem) {
  .timeline .row { grid-template-columns: 1fr; }
  .timeline dt { padding-top: 0; margin-bottom: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sprig .stem { animation: none; stroke-dashoffset: 0; }
  .sprig .leaf, .sprig .buds ellipse { animation: none; opacity: 0.9; }
}

/* =========================================================
   Multi-page: site nav, home directory, sub-page header,
   project detail pages
   ========================================================= */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
}
.site-nav .home {
  font-family: var(--title-1);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 500;
}
.site-nav ul a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav ul a:hover { color: var(--shutter); }
.site-nav ul a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--lavender);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

/* the glance page keeps the full hero under the nav */
.hero.with-nav { padding-top: 0; }
.hero.with-nav .hero-inner { margin-top: clamp(3rem, 9vw, 5.5rem); }

/* ---------- Home ---------- */

.glance-cta {
  display: block;
  margin-top: 2.25rem;
  padding: 1.1rem 1.4rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--lavender) 55%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--lavender-pale) 65%, transparent);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.glance-cta:hover {
  border-color: var(--lavender);
  background: var(--lavender-pale);
}
.glance-cta .cta-title {
  display: block;
  font-family: var(--title-2);
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.2;
}
.glance-cta .cta-desc {
  display: block;
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.975rem;
}

.directory {
  list-style: none;
  margin: 0;
  padding: 0;
}
.directory li { border-top: 1px solid var(--rule); }
.directory li:last-child { border-bottom: 1px solid var(--rule); }
.directory a {
  display: grid;
  grid-template-columns: 12rem 1fr;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding: 1.15rem 0;
  color: var(--ink);
  text-decoration: none;
}
.directory .dir-title {
  font-family: var(--title-2);
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.2;
  transition: color 0.15s;
}
.directory .dir-desc { color: var(--ink-soft); }
.directory a:hover .dir-title { color: var(--shutter); }
@media (max-width: 34rem) {
  .directory a { grid-template-columns: 1fr; }
}

/* ---------- Sub-page header ---------- */

.page-head {
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 70%, var(--limewash) 100%);
  padding-bottom: clamp(2rem, 6vw, 3rem);
}
.page-title {
  max-width: var(--measure);
  margin: clamp(2.5rem, 8vw, 4.5rem) auto 0;
  padding: 0 1rem;
  box-sizing: content-box;
}
.page-title h1 {
  margin: 0;
  font-family: var(--title-2);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1.15;
}
.page-title .crumb {
  margin-bottom: 0.6rem;
  font-size: 0.9375rem;
}
.page-title .lede {
  margin-top: 1rem;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.page-title .meta { margin-top: 0.9rem; }

/* sub-pages: first section sits close to the header */
.page-head + main section:first-child { padding-top: 0.5rem; }

/* ---------- Project list page ---------- */

.projects .more {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ---------- Project detail ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1.25rem 1.5rem;
  margin: 0 0 1rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.2rem;
}
.stats dd {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.1;
  font-variant-numeric: lining-nums;
  font-variation-settings: "SOFT" 100, "opsz" 72;
}
.stats dt {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.doc h2 {
  margin-top: 2.75rem;
  font-size: 1.6rem;
}
.doc h2:first-child { margin-top: 1.5rem; }
.doc p, .doc ul, .doc .table-wrap { margin-top: 0.9rem; }
.doc ul { padding-left: 1.25rem; }
.doc ul li + li { margin-top: 0.35rem; }
.doc ul li::marker { color: var(--lavender); }
.doc code {
  font-size: 0.9em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: var(--lavender-pale);
}
.doc .note {
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ochre) 12%, var(--limewash));
  font-size: 0.975rem;
}

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
  font-weight: 500;
  color: var(--ink-soft);
}
.data-table caption {
  caption-side: bottom;
  padding-top: 0.5rem;
  text-align: left;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}
.pager a { max-width: 48%; }
.pager .next { margin-left: auto; text-align: right; }

/* ---------- Home: full-screen layout ---------- */

body.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  --wide: 76rem;
  --gutter: clamp(1rem, 5vw, 4rem);
}
.home .hero {
  flex: 1;
  display: flex;
  align-items: center;
  padding: clamp(2.5rem, 7vh, 5rem) 0 clamp(1.5rem, 4vh, 3rem);
}
.home .hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: center;
  gap: 2rem 4rem;
  width: 100%;
  max-width: var(--wide);
  padding: 0 var(--gutter);
  box-sizing: border-box;
}
.home .name { font-size: clamp(3.25rem, 5.4vw, 5.5rem); white-space: nowrap; }
.home .role { font-size: 1.35rem; }
.home .bio { max-width: 38rem; margin-top: 1.5rem; }
.home .links .plain { flex-basis: auto; margin: 0 0 0 0.75rem; }
.home .glance-cta { max-width: 34rem; margin-top: 1.75rem; }

.home .bouquet {
  position: static;
  justify-self: center;
  width: 100%;
  max-width: 23rem;
}

.home main {
  width: 100%;
  max-width: var(--wide);
  padding: 0 var(--gutter);
  box-sizing: border-box;
}
.home .directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0 2rem;
}
.home .directory li,
.home .directory li:last-child { border-bottom: 0; }
.home .directory a {
  display: block;
  padding: 1.25rem 0 1.5rem;
}
.home .directory .dir-title { display: block; font-size: 1.5rem; }
.home .directory .dir-desc { display: block; margin-top: 0.4rem; font-size: 0.9375rem; }

.home footer {
  width: 100%;
  max-width: var(--wide);
  margin-top: 1rem;
  padding: 1rem var(--gutter) 1.75rem;
  box-sizing: border-box;
}

@media (max-width: 52rem) {
  .home .hero-inner { grid-template-columns: 1fr; position: relative; }
  .home .bouquet {
    position: absolute;
    top: -2.5rem;
    right: var(--gutter);
    width: 5rem;
  }
  .home .name { padding-right: 3.75rem; font-size: clamp(2.6rem, 11vw, 3.5rem); }
}
@media (max-width: 34rem) {
  .home .links .plain { flex-basis: 100%; margin: 0.3rem 0 0; }
}

.home .sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.35rem;
  margin-top: 2.25rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.home .sections a {
  font-family: var(--title-2);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.home .sections a:hover {
  color: var(--shutter);
  text-decoration-color: var(--lavender);
}

/* ---------- Experience: collapsible roles ---------- */

.roles details { border-top: 1px solid var(--rule); }
.roles details:last-of-type { border-bottom: 1px solid var(--rule); }
.roles summary {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  align-items: baseline;
  gap: 0 1.5rem;
  padding: 1.1rem 0;
  list-style: none;
  cursor: pointer;
}
.roles summary::-webkit-details-marker { display: none; }
.roles summary:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 2px;
  border-radius: 4px;
}
.roles .when {
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.roles .org {
  display: block;
  font-family: var(--title-3);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.3;
  transition: color 0.15s;
}
.roles summary:hover .org { color: var(--shutter); }
.roles .what .sub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.roles .chev {
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.25rem;
  border-right: 1.5px solid var(--ink-soft);
  border-bottom: 1.5px solid var(--ink-soft);
  transform: translateY(-0.2rem) rotate(45deg);
  transition: transform 0.2s ease;
}
.roles details[open] .chev { transform: translateY(0.1rem) rotate(225deg); }

.role-body {
  padding: 0 0 1.6rem 8rem;
}
.role-body .lead { font-weight: 500; }
.role-body h4 {
  margin: 1.4rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--olive);
}
.role-body .lead + h4 { margin-top: 1.1rem; }
.role-body ul { margin: 0.5rem 0 0; padding-left: 1.15rem; }
.role-body > ul:first-child { margin-top: 0; }
.role-body li + li { margin-top: 0.35rem; }
.role-body li::marker { color: var(--lavender); }

@media (max-width: 34rem) {
  .roles summary { grid-template-columns: 1fr auto; }
  .roles .when { grid-column: 1 / -1; }
  .role-body { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .roles .chev { transition: none; }
}
