:root {
  --paper: #fbfbfa;
  --ink: #15171b;
  --muted: #62666e;
  --faint: #8b8f97;
  --line: #e3e4e7;
  --accent: #23408e;
  --max: 1120px;
  --gutter: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

/* Background flow field, kept quiet behind the content */
.ambient-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px max(var(--gutter), (100% - var(--max)) / 2);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 250, 0.84);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.brand {
  width: max-content;
  font-size: 15px;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
}

.site-nav a {
  padding: 6px 0;
  color: var(--muted);
  transition: color 150ms ease;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--ink);
}

.header-action {
  justify-self: end;
  padding: 7px 14px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  transition: background 150ms ease, color 150ms ease;
}

.header-action:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ── Type ───────────────────────────────────────────────── */

h1 {
  max-width: 17em;
  margin-bottom: 28px;
  font-size: clamp(38px, 5.4vw, 64px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

h2 {
  margin-bottom: 12px;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

/* ── Layout ─────────────────────────────────────────────── */

.section,
.hero-section,
.site-footer {
  width: min(100% - var(--gutter) * 2, var(--max));
  margin: 0 auto;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 72px;
  align-items: end;
  padding: 112px 0 96px;
}

.hero-lede,
.page-hero p {
  max-width: 36em;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.page-hero {
  padding: 112px 0 72px;
}

.page-hero p:last-child {
  margin-bottom: 0;
}

.page-hero a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}

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

.hero-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  border-radius: 2px;
  background: #eceef1;
}

.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  object-fit: cover;
  /* anchor to the top so the crop only trims below the torso */
  object-position: 50% 0;
  filter: grayscale(0.15);
}

.hero-photo span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 40px;
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  transition: background 150ms ease, color 150ms ease;
}

.button-dark {
  background: var(--ink);
  color: var(--paper);
}

.button-dark:hover {
  background: #2c3038;
}

.button-light:hover {
  background: var(--ink);
  color: var(--paper);
}

/* Two-column section: heading on the left, content on the right */
.preview-section,
.publications-section,
.records-section,
.experience-section,
.interests-section,
.skills-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  gap: 48px;
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.section-heading p {
  max-width: 22em;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Lists share one row pattern: hairline on top, generous air */
.publication-list,
.record-list,
.experience-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.publication-item,
.record-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.publication-item:first-child,
.record-item:first-child,
.experience-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.record-entry {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  min-width: 0;
}

.record-thumb {
  flex: 0 0 260px;
  width: 260px;
  max-width: 260px;
  margin-top: 2px;
}

.record-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  cursor: zoom-in;
}

.record-thumb img:hover {
  transform: translateY(-2px);
  border-color: var(--faint);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.record-body {
  flex: 1;
  min-width: 0;
}

.record-body h3 {
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.35;
}

.record-body .record-org {
  margin-bottom: 8px;
  color: var(--ink) !important;
  font-size: 14px;
  font-weight: 500;
}

.record-body p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.publication-year,
.record-period,
.experience-period {
  color: var(--faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.publication-item h3,
.record-item h3 {
  max-width: 36em;
  font-weight: 400;
  font-size: 19px;
  line-height: 1.4;
}

.publication-item p,
.record-item p {
  max-width: 44em;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 15px;
}

.publication-authors strong {
  color: var(--ink);
}

.publication-note {
  margin-left: 6px;
  color: var(--faint);
  font-size: 13px;
}

.publication-abstract {
  margin-top: 8px;
}

.record-org {
  color: var(--ink) !important;
}

.publication-award {
  margin-left: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.publication-item a,
.record-item a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
  transition: text-decoration-color 150ms ease;
}

.publication-item a:hover,
.record-item a:hover {
  text-decoration-color: currentColor;
}

.publication-venue a {
  color: var(--accent);
}

/* Experience */
.experience-list {
  display: grid;
  gap: 56px;
}

.experience-role-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}

.experience-logo {
  display: block;
  width: 64px;
  height: 60px;
  object-fit: contain;
}

.experience-when {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.experience-place {
  color: var(--faint);
  font-size: 13px;
}

.experience-role-head h3 {
  margin-bottom: 2px;
  font-size: 21px;
  font-weight: 400;
}

.experience-role-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.experience-item {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.experience-item h4 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.4;
}

.experience-item p {
  max-width: 44em;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.experience-funder {
  margin-left: 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}

/* Home: profile routes */
.route-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--ink);
}

.route-card {
  padding: 20px 24px 8px 0;
}

.route-card + .route-card {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.route-card h3 {
  transition: color 150ms ease;
}

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

.route-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Closing call to action */
.contact-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  padding: 88px 0;
  border-top: 1px solid var(--line);
}

.contact-section h2 {
  max-width: 18em;
  margin-bottom: 0;
  font-size: clamp(26px, 3.2vw, 36px);
}

/* ── Methods ────────────────────────────────────────────── */

.interest-grid,
.skills-grid {
  display: grid;
}

.interest-card,
.skill-group-card {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

/* Icon sits in its own column, spanning the title, text and tags */
.interest-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 24px;
}

.interest-card > :not(.interest-icon) {
  grid-column: 2;
}

.interest-icon {
  grid-row: 1 / span 3;
  width: 56px;
  height: 56px;
}

.interest-card:first-child,
.skill-group-card:first-child {
  padding-top: 0;
  border-top: 0;
}

.interest-card p,
.skill-group-card p {
  max-width: 44em;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 15px;
}

.skill-sub {
  display: block;
  margin: -4px 0 8px;
  color: var(--faint);
  font-size: 14px;
}

.skill-badge-note {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  border-radius: 4px;
  vertical-align: 2px;
}

/* Tool lists read as a plain comma-separated line */
.interest-tags,
.skill-badges {
  color: var(--ink);
  font-size: 14px;
}

.interest-tags span:not(:last-child)::after,
.skill-badges span:not(:last-child)::after {
  content: ", ";
}

/* ── Contact ────────────────────────────────────────────── */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding-bottom: 72px;
  border-top: 1px solid var(--ink);
}

.contact-card {
  display: block;
  padding: 24px 24px 28px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.contact-card:nth-child(even) {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.contact-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 13px;
}

.contact-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 400;
  transition: color 150ms ease;
}

.contact-card:hover strong {
  color: var(--accent);
}

.contact-card p {
  max-width: 30em;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.availability-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  padding: 56px 0 96px;
}

.availability-section h2 {
  margin-bottom: 0;
}

.availability-section p {
  margin-bottom: 0;
  color: var(--muted);
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}

.site-footer a:hover {
  color: var(--ink);
}

/* ── CV request dialog ──────────────────────────────────── */

.cv-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(21, 23, 27, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.cv-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cv-modal {
  width: min(500px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(21, 23, 27, 0.22);
  transform: translateY(8px);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cv-modal-backdrop.is-open .cv-modal {
  transform: none;
}

.cv-modal-inner {
  padding: 32px;
}

.cv-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.cv-modal-header h3 {
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 400;
}

.cv-modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.cv-modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.cv-modal-close:hover {
  background: #f1f2f4;
  color: var(--ink);
}

.cv-form {
  display: grid;
  gap: 18px;
}

.cv-field {
  display: grid;
  gap: 6px;
}

.cv-field label {
  font-size: 13px;
  font-weight: 700;
}

.cv-field .req {
  color: var(--faint);
  font-weight: 400;
}

.cv-field input,
.cv-field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd2d7;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.cv-field input:focus,
.cv-field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(21, 23, 27, 0.08);
}

.cv-field textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

.cv-notice {
  color: var(--faint);
  font-size: 13px;
  line-height: 1.5;
}

.cv-status-box {
  display: none;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
}

.cv-status-box.is-error {
  display: block;
  background: #fbefee;
  color: #8f2219;
}

.cv-status-box.is-success {
  display: block;
  background: #eef5f1;
  color: #1d5c3c;
}

.cv-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.cv-btn-cancel,
.cv-btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.cv-btn-cancel {
  background: #fff;
  color: var(--ink);
}

.cv-btn-cancel:hover {
  background: #f1f2f4;
}

.cv-btn-submit {
  background: var(--ink);
  color: #fff;
}

.cv-btn-submit:hover {
  background: #2c3038;
}

.cv-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Image Lightbox ─────────────────────────────────────── */

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.image-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.image-lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 21, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.image-lightbox-container {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 920px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.96);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.image-lightbox.is-open .image-lightbox-container {
  transform: scale(1);
}

.image-lightbox-container img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.image-lightbox-caption {
  margin-top: 14px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  text-align: center;
  max-width: 44em;
}

.image-lightbox-close {
  position: absolute;
  top: -42px;
  right: 0;
  background: none;
  border: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 150ms ease;
}

.image-lightbox-close:hover {
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
    row-gap: 10px;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 22px;
    overflow-x: auto;
  }

  .hero-section,
  .preview-section,
  .publications-section,
  .records-section,
  .experience-section,
  .interests-section,
  .skills-section,
  .contact-section,
  .availability-section {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-section {
    padding: 72px 0 64px;
  }

  .hero-photo {
    max-width: 360px;
  }

  .page-hero {
    padding: 72px 0 48px;
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .route-card,
  .route-card + .route-card {
    padding: 18px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .publication-item,
  .record-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .record-entry {
    flex-direction: column;
    gap: 12px;
  }

  .record-thumb {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin: 4px 0 8px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .experience-role-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .experience-when {
    justify-items: start;
  }

  .contact-card,
  .contact-card:nth-child(even) {
    padding: 20px 0;
    border-left: 0;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }

  .cv-modal-inner {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
