/* ==========================================================
   Fonts (self-hosted, latin subset, variable weight)
   ========================================================== */
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/EBGaramond-latin.woff2") format("woff2");
}

@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/EBGaramond-Italic-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/Inter-latin.woff2") format("woff2");
}

/* ==========================================================
   Design tokens (light, then dark)
   Blue-black ink in several strengths on a mint-white ground, one deep teal accent.
   ========================================================== */
:root {
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ink: #12262e;
  --ink-2: #2b3c43;
  --muted: #62757b;
  --line: #dce6e5;
  --bg: #fcfefd;
  --accent: #0e7c86;
  --accent-strong: #0a5a62;
  --radius: 2px;
  --wrap: 1080px;
}

body.quarto-dark {
  --ink: #e9f1f2;
  --ink-2: #c5d1d4;
  --muted: #8b9ea3;
  --line: #23343a;
  --bg: #0f181b;
  --accent: #5fc2ca;
  --accent-strong: #a3e1e5;
}

body {
  min-width: 0;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

strong,
b {
  font-weight: 600;
}

a {
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* Small uppercase labels (Inter) used across the site */
.eyebrow,
.kicker,
.section-label h2,
.label-link,
.news-date,
a.btn-solid,
a.btn-ghost,
a.profile-cv,
a.cv-ghost,
a.text-link,
a.chip,
.closing-photo .credit {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-transform: uppercase;
}

/* ==========================================================
   Navbar
   ========================================================== */
.navbar {
  padding-inline: 0 !important;
  border-bottom: 1px solid var(--line);
  background-color: rgba(252, 254, 253, 0.9) !important;
  box-shadow: none;
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.quarto-dark .navbar {
  background-color: rgba(15, 24, 27, 0.9) !important;
}

/* Keep the navbar on screen while scrolling (Quarto hides it on scroll-down by default). */
#quarto-header.headroom--unpinned {
  transform: none !important;
}

.navbar .navbar-container {
  max-width: calc(var(--wrap) + 2.5rem);
  padding-inline: 1.25rem !important;
}

.navbar .navbar-brand {
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.navbar .navbar-brand-container {
  margin-inline: 0 !important;
}

.navbar-title {
  color: var(--ink) !important;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.navbar .navbar-nav .nav-link {
  position: relative;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.navbar .navbar-nav .nav-link:is(:hover, .active) {
  color: var(--ink);
  text-decoration: none;
}

@media (min-width: 992px) {
  .navbar .navbar-nav .nav-link {
    padding-inline: 0.85rem;
  }

  .navbar .navbar-nav .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.1rem;
    height: 1px;
    background: currentColor;
  }
}

.navbar .quarto-color-scheme-toggle .bi {
  color: var(--muted);
}

/* Homepage: the navbar sits on the photo until the page scrolls past it.
   assets/scroll.html adds .nav-overlay, so without JS the navbar stays solid. */
body.nav-overlay:not(.is-scrolled) .navbar:not(:has(.navbar-collapse.show, .navbar-collapse.collapsing)) {
  border-bottom-color: transparent;
  background-color: transparent !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

body.nav-overlay:not(.is-scrolled) .navbar:not(:has(.navbar-collapse.show, .navbar-collapse.collapsing)) :is(.navbar-title, .nav-link, .nav-link.active, .quarto-color-scheme-toggle .bi) {
  color: #fff !important;
}

body.nav-overlay:not(.is-scrolled) .navbar:not(:has(.navbar-collapse.show, .navbar-collapse.collapsing)) .nav-link:not(.active):not(:hover) {
  color: rgba(255, 255, 255, 0.82) !important;
}

body.nav-overlay:not(.is-scrolled) .navbar:not(:has(.navbar-collapse.show, .navbar-collapse.collapsing)) :is(.navbar-toggler-icon, .quarto-color-scheme-toggle .bi) {
  filter: brightness(0) invert(1);
}

/* ==========================================================
   Buttons and small links
   ========================================================== */
a.btn-solid,
a.btn-ghost,
a.profile-cv,
a.cv-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.btn-solid,
a.profile-cv {
  background: var(--ink);
  color: var(--bg);
}

a:is(.btn-solid, .profile-cv):is(:hover, :focus-visible) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

body.quarto-dark a:is(.btn-solid, .profile-cv):is(:hover, :focus-visible) {
  color: #0f181b;
}

a.btn-ghost,
a.cv-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

a:is(.btn-ghost, .cv-ghost):is(:hover, :focus-visible) {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

a.text-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.45em;
}

a.text-link:is(:hover, :focus-visible) {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* DOI / arXiv / CRAN links after a reference */
a.chip {
  display: inline-block;
  margin-left: 0.55rem;
  color: var(--accent);
  font-size: 0.66rem;
  text-decoration: none;
  white-space: nowrap;
}

a.chip:is(:hover, :focus-visible) {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* ==========================================================
   Inner pages
   ========================================================== */
main.content {
  padding-bottom: 3rem;
}

body:not(.home-page) #quarto-content {
  display: block;
}

body:not(.home-page) #quarto-content > main.content {
  width: min(calc(100% - 2.5rem), var(--wrap));
  max-width: none;
  margin: 0 auto;
  padding: 0 0 4rem;
}

body:not(.home-page) main.content > :not(#title-block-header) {
  max-width: 44rem;
}

body:not(.home-page) #title-block-header {
  margin: 0 0 2.5rem;
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--line);
}

#title-block-header .quarto-title {
  margin: 0;
}

#title-block-header .title {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.5vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

#title-block-header .subtitle {
  margin: 0.8rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
}

main h2 {
  margin-top: 2.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
}

body:not(.home-page) main.content > section:first-of-type > h2:first-child,
body:not(.home-page) main.content > h2:first-of-type {
  margin-top: 0.5rem;
}

main h3 {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.35;
}

main p,
main li {
  color: var(--ink-2);
}

.section-link {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.table {
  --bs-table-bg: transparent;
  border-color: var(--line);
}

.table th {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- CV page ---------- */
.cv-meta {
  display: block;
  color: var(--muted);
  font-size: 1rem;
}

.cv-download p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 2.5rem;
}

/* ---------- Publications page ---------- */
.publication-list ul {
  padding-left: 0;
  list-style: none;
}

.publication-list li {
  margin: 0;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.55;
}

.publication-list li:last-child {
  border-bottom: 0;
}

.publication-list h3 {
  margin: 2rem 0 0.25rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

/* ---------- Blog archive ---------- */
.post-list ul {
  padding-left: 0;
  list-style: none;
}

.post-list li {
  margin-block: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.post-date {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ==========================================================
   Homepage
   ========================================================== */
.home-page #quarto-content {
  display: block;
}

.home-page #quarto-content > main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.home-page main.content {
  padding-bottom: 0;
}

.wrap {
  width: min(calc(100% - 2.5rem), var(--wrap));
  margin-inline: auto;
}

/* ---------- Photo banner ---------- */
.banner {
  position: relative;
  isolation: isolate;
  height: clamp(250px, 38vh, 370px);
  overflow: hidden;
  background: #12262e;
  color: #fff;
}

/* Pulled up under the transparent navbar; the offset is set by assets/scroll.html. */
body.nav-overlay .banner {
  margin-top: calc(-1 * var(--banner-offset, 0px));
  height: calc(clamp(250px, 38vh, 370px) + var(--banner-offset, 0px));
}

.banner-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(14, 18, 18, 0.45), rgba(14, 18, 18, 0) 30%),
    linear-gradient(to top, rgba(14, 18, 18, 0.72), rgba(14, 18, 18, 0.22) 50%, rgba(14, 18, 18, 0) 75%);
}

.banner-text {
  position: absolute;
  right: 0;
  bottom: 2.25rem;
  left: 0;
}

.banner .eyebrow {
  margin: 0 0 0.6rem;
  color: rgba(255, 255, 255, 0.88);
}

.banner h1 {
  margin: 0;
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1;
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}

/* ---------- Intro ---------- */
.intro {
  padding: 4rem 0 3.5rem;
}

.intro-grid {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  align-items: start;
  gap: 3.25rem;
}

.intro-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: 42% 50%;
}

.intro-lead {
  max-width: 38rem;
  margin: 0;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1.45;
}

.intro-meta {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.intro-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.6rem;
  margin: 2rem 0 0;
}

/* ---------- Sections: label column + content column ---------- */
.section {
  padding: 0 0 3.5rem;
}

.section-grid {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  gap: 1.25rem 3.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--line);
}

.section-label h2 {
  margin: 0.35rem 0 0;
  padding: 0;
  border: 0;
  color: var(--ink);
}

.label-link {
  display: inline-block;
  margin-top: 0.85rem;
  color: var(--accent);
  font-size: 0.66rem;
}

.kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.66rem;
}

/* ---------- News ---------- */
.news-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-list li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  line-height: 1.5;
}

.news-list li:first-child {
  padding-top: 0;
}

.news-list li:last-child {
  border-bottom: 0;
}

.news-date {
  padding-top: 0.32rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Research ---------- */
.research-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
}

.research-item {
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}

.research-item.featured {
  grid-column: 1 / -1;
  padding: 0 0 1.5rem;
  border-top: 0;
}

.research-item h3 {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
}

.research-item.featured h3 {
  font-size: 1.65rem;
}

.research-item p:not(.kicker) {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.research-item.featured p:not(.kicker) {
  max-width: 40rem;
  font-size: 1.12rem;
}

/* ---------- Selected publications ---------- */
.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub-list li {
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
}

.pub-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.pub-list h3 {
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.3;
}

.pub-list p:not(.kicker) {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.pub-list .pub-meta {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 1rem;
}

.pub-meta .sep {
  margin: 0 0.3rem;
  color: var(--line);
}

/* ---------- About ---------- */
.about-body {
  max-width: 40rem;
}

.about-body p {
  color: var(--ink-2);
  line-height: 1.65;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* ---------- Closing photo ---------- */
/* Full-width band (about 3:1, never taller than 460px), caption set on the photo. */
.closing-photo {
  position: relative;
  isolation: isolate;
  margin: 0.5rem 0 0;
}

.closing-photo img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 220px;
  max-height: 460px;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  object-position: 50% 58%;
}

/* A short, light shade at the bottom only, so the caption reads without greying the photo. */
.closing-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14, 18, 18, 0.45), rgba(14, 18, 18, 0) 40%);
  pointer-events: none;
}

.closing-photo figcaption {
  position: absolute;
  right: 0;
  bottom: 1.4rem;
  left: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.closing-photo .place {
  font-size: 1.35rem;
  font-style: italic;
}

.closing-photo .credit {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.62rem;
}

/* ==========================================================
   Footer
   ========================================================== */
.nav-footer {
  min-height: 3.75rem;
  padding-inline: max(1.25rem, calc((100% - var(--wrap)) / 2)) !important;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.home-page .nav-footer {
  border-top: 0;
}

.nav-footer .nav-footer-left,
.nav-footer .nav-footer-right {
  max-width: none;
}

.nav-footer .bi {
  font-size: 1rem;
}

/* ==========================================================
   Inner pages with a side table of contents (Research, Publications)
   Same two columns as the homepage sections; the list is built by assets/scroll.html.
   ========================================================== */
@media (min-width: 821px) {
  body.toc-page #quarto-content > main.content {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 44rem);
    column-gap: 3.25rem;
    align-items: start;
  }

  body.toc-page main.content > * {
    grid-column: 2;
    min-width: 0;
  }

  body.toc-page main.content > #title-block-header {
    grid-column: 1 / -1;
  }

  body.toc-page main.content > .page-toc {
    position: sticky;
    top: calc(var(--toc-top, 64px) + 2rem);
    grid-column: 1;
    grid-row: 2 / span 99;
    align-self: start;
  }
}

.page-toc {
  display: none;
}

@media (min-width: 821px) {
  .page-toc {
    display: block;
  }
}

.page-toc .toc-label {
  margin: 0.55rem 0 0.9rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-toc li {
  margin: 0;
}

.page-toc a {
  display: block;
  margin-left: -0.85rem;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.page-toc a:hover {
  color: var(--ink);
  text-decoration: none;
}

.page-toc a.active {
  border-left-color: var(--accent);
  color: var(--ink);
}

.page-toc ul ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.9rem;
  margin: 0.1rem 0 0.35rem;
}

.page-toc ul ul a {
  margin-left: 0;
  padding: 0.15rem 0;
  border-left: 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.page-toc ul ul a.active {
  color: var(--accent);
}

/* Leave room for the fixed navbar when jumping to a section. */
body.toc-page main.content :is(section, h2, h3)[id] {
  scroll-margin-top: calc(var(--toc-top, 64px) + 1.5rem);
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 820px) {
  .intro-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .intro-grid {
    gap: 1.75rem;
  }

  .intro-photo img {
    width: 8.5rem;
  }

  .section-grid {
    gap: 1.1rem;
  }

  .section-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
  }

  .section-label h2 {
    margin-top: 0;
  }

  .label-link {
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  .intro {
    padding: 2.5rem 0 2.75rem;
  }

  .intro-lead {
    font-size: 1.3rem;
  }

  .section {
    padding-bottom: 2.75rem;
  }

  .research-list {
    grid-template-columns: 1fr;
  }

  .news-list li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .news-date {
    padding-top: 0;
  }
}

/* ==========================================================
   Scroll fade-in (driven by assets/scroll.html, homepage only)
   ========================================================== */
.reveal-hidden {
  opacity: 0;
  transform: translateY(16px);
}

.reveal-anim {
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) !important;
}

@media (prefers-reduced-motion: reduce) {
  .navbar,
  a.btn-solid,
  a.btn-ghost {
    transition: none;
  }

  .reveal-hidden {
    opacity: 1;
    transform: none;
  }
}
