:root {
  --bg: #fdf9fb;
  --bg-pink: #fbeef4;
  --bg-blue: #f4f9fc;
  --ink: #2f2b38;
  --ink-soft: #68626f;
  --pink: #f6dce9;
  --pink-text: #9c3f72;
  --blue: #e2f0f7;
  --blue-deep: #2f6584;
  --line: #ece6ea;
  --card-bg: #ffffff;
  --btn-blue: #2f6584;
  --btn-blue-hover: #245a78;
  --btn-pink: #9c3f72;
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 760px;
}

* { box-sizing: border-box; }

html {
  font-size: 106.25%; /* 17px base, so rem-sized text scales up too */
  scroll-behavior: smooth;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Links inside running text are underlined so they don't rely on color alone */
main p a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(253, 252, 251, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1000px;
  gap: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--blue-deep); }

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

.site-nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--blue-deep); text-decoration: none; }

.site-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--blue-deep);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
}

/* Hero */

.hero {
  padding: 96px 24px 72px;
}

.hero-photo {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  border: 4px solid var(--pink);
  margin-bottom: 28px;
}

.about-photo {
  float: right;
  width: 220px;
  height: auto;
  margin: 4px 0 20px 32px;
  border-radius: 16px;
}
.about-body::after { content: ""; display: block; clear: both; }

.eyebrow {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-deep);
  margin: 0 0 14px;
}

.hero h1 {
  font-size: 2.75rem;
  line-height: 1.1;
  margin-bottom: 10px;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.hero-blurb {
  max-width: 60ch;
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--btn-blue);
  color: #fff;
}
.btn-primary:hover { background: var(--btn-blue-hover); }

.btn-secondary {
  border-color: var(--btn-pink);
  color: var(--btn-pink);
}
.btn-secondary:hover { background: var(--pink); }

/* Sections */

.section {
  padding: 64px 24px;
  border-top: 1px solid var(--line);
}

.section.alt-blue,
.section.alt-pink {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section.alt-blue { background: var(--bg-blue); }
.section.alt-pink { background: var(--bg-pink); }

.section.alt-blue > *,
.section.alt-pink > * {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 28px;
}

.section-body p {
  margin: 0 0 16px;
  max-width: 65ch;
}

/* Page header (non-home pages) */

.page-header {
  padding: 64px 24px 8px;
}

.page-title {
  font-size: 2.1rem;
  margin-bottom: 0;
}

.page-header .eyebrow {
  margin-bottom: 10px;
}

/* Field cards (homepage "What I Study") */

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.field-card {
  display: block;
  padding: 24px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.field-card:hover {
  border-color: var(--blue-deep);
  transform: translateY(-2px);
  text-decoration: none;
}

.field-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
}

.num-pink { background: var(--pink); color: var(--pink-text); }
.num-blue { background: var(--blue); color: var(--blue-deep); }

.field-card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.field-card p {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0;
}

/* Teaser cards (homepage "Explore") */

.teaser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.teaser-card {
  display: block;
  padding: 24px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.teaser-card:hover {
  border-color: var(--blue-deep);
  transform: translateY(-2px);
  text-decoration: none;
}

.teaser-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.teaser-card p {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.teaser-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--blue-deep);
}

.research-contact { margin-top: 28px; }

.entry-role-text {
  font-weight: 500;
  color: var(--blue-deep);
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.entry {
  margin-bottom: 28px;
}
.entry:last-child { margin-bottom: 0; }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.entry-head h2,
.entry-head h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.entry-date {
  font-size: 0.95rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.entry-role {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 12px;
}

.role-chip {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--blue-deep);
}

.role-date {
  margin-left: 6px;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.subject-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}

.skills-list { grid-template-columns: repeat(3, 1fr); }

.subject-list li {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.subject-list strong {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
}

.subject-list span {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.contact-label {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  min-width: 90px;
}

.contact-list a {
  font-size: 1rem;
  font-weight: 500;
}

.stat-row {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-row li {
  padding: 18px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
}

.stat-row strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--btn-blue);
  margin-bottom: 6px;
}

.stat-row span {
  display: block;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Footer */

.site-footer {
  padding: 32px 24px 48px;
}

.site-footer p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.contrast-toggle {
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.contrast-toggle:hover { color: var(--ink); }

/* Responsive */

@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .site-nav.open {
    max-height: 420px;
  }

  .site-nav a {
    padding: 14px 24px;
    border-top: 1px solid var(--line);
  }
}


@media (max-width: 640px) {
  .hero { padding: 64px 24px 48px; }
  .hero h1 { font-size: 2.1rem; }

  .field-grid,
  .teaser-grid,
  .subject-list {
    grid-template-columns: 1fr;
  }

  .stat-row { grid-template-columns: 1fr 1fr; }

  .entry-head { flex-direction: column; gap: 4px; }

  .hero-photo { width: 128px; height: 128px; }

  .about-photo {
    float: none;
    display: block;
    width: 180px;
    margin: 0 0 24px;
  }
}

/* Dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #201c22;
    --bg-pink: #2a1f26;
    --bg-blue: #1c2530;
    --ink: #f0ece8;
    --ink-soft: #b3aebb;
    --pink: #4a2f3c;
    --pink-text: #e8a8c4;
    --blue: #26374a;
    --blue-deep: #8ec2e0;
    --line: #382f3a;
    --card-bg: #2a2531;
    --btn-blue: #8ec2e0;
    --btn-blue-hover: #b0d6ec;
    --btn-pink: #e8a8c4;
  }
  .site-header { background: rgba(32, 28, 34, 0.92); }
  .btn-primary { color: #17202a; }
  .btn-secondary:hover { background: var(--pink); }
}

/* High contrast (footer toggle, or the visitor's system preference) */

:root[data-contrast="high"] {
  --ink: #1a1720;
  --ink-soft: #46404f;
  --pink-text: #7a2554;
  --blue-deep: #234b62;
  --line: #b9aeb6;
  --btn-blue: #234b62;
  --btn-blue-hover: #1a3a4c;
  --btn-pink: #7a2554;
}
:root[data-contrast="high"] main a:not(.btn):not(.field-card):not(.teaser-card) { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  :root[data-contrast="high"] {
    --bg: #141116;
    --bg-pink: #1c1620;
    --bg-blue: #152029;
    --ink: #ffffff;
    --ink-soft: #dcd7e2;
    --pink: #2a1f2f;
    --pink-text: #f7cfe0;
    --blue: #1d2a38;
    --blue-deep: #bfe2f5;
    --line: #5a4f5e;
    --card-bg: #221d27;
    --btn-blue: #bfe2f5;
    --btn-blue-hover: #dff1fb;
    --btn-pink: #f7cfe0;
  }
  :root[data-contrast="high"] .site-header { background: rgba(20, 17, 22, 0.96); }
  :root[data-contrast="high"] .btn-primary { color: #0e141a; }
}
