:root {
  color-scheme: light;
  --ink: #333333;
  --heading: #1c3b5a;
  --muted: #5e7183;
  --paper: #f8f9fb;
  --panel: #ffffff;
  --line: #d5dce4;
  --accent: #6b8e73;
  --accent-dark: #496a54;
  --warm: #6b8e73;
  --soft: #e8eef4;
  --shadow: 0 18px 45px rgba(28, 59, 90, 0.1);
  --header-bg: rgba(255, 255, 255, 0.94);
  --header-ink: #1c3b5a;
  --header-muted: #4d5c6b;
  --header-line: #d5dce4;
  --header-button-bg: #ffffff;
  --button-bg: #ffffff;
  --hero-filter: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f2ed;
  --heading: #f4f2ed;
  --muted: #b9b9b9;
  --paper: #121212;
  --panel: #1e1e1e;
  --line: #363636;
  --accent: #92ab97;
  --accent-dark: #c2d2c4;
  --warm: #92ab97;
  --soft: #262626;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  --header-bg: rgba(30, 30, 30, 0.97);
  --header-ink: #f4f2ed;
  --header-muted: #c4c4c4;
  --header-line: #3e3e3e;
  --header-button-bg: #292929;
  --button-bg: #1e1e1e;
  --hero-filter: saturate(0.9) brightness(0.86);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #f4f2ed;
    --heading: #f4f2ed;
    --muted: #b9b9b9;
    --paper: #121212;
    --panel: #1e1e1e;
    --line: #363636;
    --accent: #92ab97;
    --accent-dark: #c2d2c4;
    --warm: #92ab97;
    --soft: #262626;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
    --header-bg: rgba(30, 30, 30, 0.97);
    --header-ink: #f4f2ed;
    --header-muted: #c4c4c4;
    --header-line: #3e3e3e;
    --header-button-bg: #292929;
    --button-bg: #1e1e1e;
    --hero-filter: saturate(0.9) brightness(0.86);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  transition: background-color 180ms ease, color 180ms ease;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.18em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 64px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--header-ink);
  font-weight: 760;
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: flex-end;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

nav a {
  color: var(--header-muted);
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
}

nav a[aria-current="page"] {
  color: var(--accent-dark);
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--header-line);
  border-radius: 999px;
  background: var(--header-button-bg);
  color: var(--header-ink);
  cursor: pointer;
}

.theme-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
}

.theme-icon {
  position: absolute;
  display: block;
  width: 18px;
  height: 18px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.theme-icon.sun {
  border: 2px solid currentColor;
  border-radius: 999px;
  box-shadow: 0 -11px 0 -7px currentColor, 0 11px 0 -7px currentColor, 11px 0 0 -7px currentColor, -11px 0 0 -7px currentColor, 8px 8px 0 -7px currentColor, -8px -8px 0 -7px currentColor, 8px -8px 0 -7px currentColor, -8px 8px 0 -7px currentColor;
}

.theme-icon.moon {
  border-radius: 999px;
  box-shadow: -5px 0 0 1px currentColor;
  opacity: 0;
  transform: translateX(5px) rotate(-25deg);
}

:root[data-theme="dark"] .theme-icon.sun {
  opacity: 0;
  transform: rotate(45deg) scale(0.8);
}

:root[data-theme="dark"] .theme-icon.moon {
  opacity: 1;
  transform: translateX(3px) rotate(-25deg);
}

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

section {
  padding: 54px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 74px);
  padding-top: 34px;
  order: 0;
}

.hero-copy {
  min-width: 0;
  max-width: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 18px;
  max-width: 850px;
  font-family: Lora, Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 6vw, 4.35rem);
  line-height: 1.02;
  letter-spacing: 0;
  color: var(--heading);
}

.hero h1 {
  font-size: clamp(2.5rem, 4.4vw, 3.75rem);
  white-space: nowrap;
}

.page-title h1 {
  max-width: 1050px;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.04;
}

h2 {
  margin: 0;
  font-family: Lora, Georgia, "Times New Roman", serif;
  color: var(--heading);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin: 0 0 10px;
  color: var(--heading);
  font-size: 1.08rem;
  line-height: 1.25;
}

p {
  margin: 0 0 16px;
}

.lead {
  color: var(--ink);
  font-size: clamp(1.24rem, 2.2vw, 1.55rem);
  line-height: 1.42;
}

.personal-note {
  max-width: 60ch;
  color: var(--ink);
}

.actions,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.button,
.link-row a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #1c3b5a;
}

.hero-portrait {
  margin: 0;
  justify-self: start;
  width: min(100%, 300px);
}

.hero-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: 50% 38%;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  filter: var(--hero-filter);
}

.academic-timeline-section {
  order: 2;
  border-top: 1px solid var(--line);
}

.academic-timeline-section .section-heading {
  justify-content: flex-start;
}

.academic-timeline {
  position: relative;
  display: grid;
  gap: 0;
  max-width: 880px;
  padding-left: 28px;
}

.academic-timeline::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 6px;
  width: 1px;
  background: var(--line);
  content: "";
}

.academic-timeline-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 0.38fr) minmax(0, 1fr);
  gap: 22px;
  padding: 0 0 28px;
}

.academic-timeline-entry:last-child {
  padding-bottom: 0;
}

.academic-timeline-entry::before {
  position: absolute;
  top: 6px;
  left: -27px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--paper);
  content: "";
}

.timeline-period {
  margin: 0;
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 720;
}

.academic-timeline-entry p:not(.timeline-period) {
  margin: 0;
}

.timeline-organization {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.organization-logo {
  display: block;
  width: 42px;
  height: 42px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  object-fit: contain;
}

.timeline-detail-list {
  margin-top: 16px;
}

.connect-section {
  order: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 32px;
  align-items: end;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.connect-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
  justify-content: flex-start;
}

.contact-method {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--heading);
}

.contact-icon svg,
.social-icon {
  width: 20px;
  height: 20px;
}

.contact-label {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.obfuscated-email {
  margin: 0;
  color: var(--ink);
  font-weight: 720;
  letter-spacing: 0.01em;
}

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.social-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-weight: 720;
  text-decoration: none;
}

.social-link:hover,
.social-link:focus-visible {
  color: var(--accent-dark);
}

.social-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 4px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

main > section:not(.hero):not(.connect-section):not(.academic-timeline-section) {
  order: 3;
}

.paper,
.activity-grid article {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.date {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 760;
}

ul {
  margin: 0;
  padding-left: 1.25rem;
}

li + li {
  margin-top: 10px;
}

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

.paper + .paper {
  margin-top: 18px;
}

.paper-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.quotes {
  margin-bottom: 18px;
}

footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 46px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .site-header,
  .hero,
  .connect-section {
    display: block;
  }

  nav {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .header-actions {
    justify-content: space-between;
    margin-top: 12px;
  }

  .header-actions nav {
    margin-top: 0;
  }

  .hero {
    min-height: 0;
  }

  .hero h1 {
    white-space: normal;
  }

  .hero-portrait {
    margin-bottom: 28px;
    width: min(100%, 260px);
  }

  .section-heading {
    display: block;
  }

  .academic-timeline-entry {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .timeline-organization {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
  }

  .organization-logo {
    width: 36px;
    height: 36px;
  }

  .connect-details {
    margin-top: 20px;
  }

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

@media (max-width: 520px) {
  main,
  footer {
    width: min(100% - 28px, 1120px);
  }

  .site-header {
    padding: 16px 14px;
  }

  section {
    padding: 38px 0;
  }

  .paper,
  .activity-grid article {
    padding: 20px;
  }
}
