:root {
  --paper: #fbfbf9;
  --surface: #ffffff;
  --ink: #20211f;
  --muted: #656862;
  --line: #d8d7d1;
  --forest: #3f6650;
  --lake: #477487;
  --amber: #ad7041;
  --rust: #a45f37;
  --shadow: 0 20px 60px rgba(32, 33, 31, 0.12);
  --content: min(1120px, calc(100vw - 40px));
  --header-link-size: 1.08rem;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 92px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Charter, Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-180%);
  background: var(--ink);
  color: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 18px max(20px, calc((100vw - 1120px) / 2));
  color: var(--surface);
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, padding 180ms ease;
}

.site-header.is-scrolled,
.site-header.nav-visible {
  background: rgba(251, 251, 249, 0.96);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
  backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.72rem;
  letter-spacing: 0;
}

.brand-text {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--header-link-size);
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-contact-links {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--header-link-size);
  font-weight: 700;
  text-transform: uppercase;
}

.header-contact-links a {
  padding: 6px 0;
  text-decoration: none;
  opacity: 0.92;
}

.header-contact-links a:hover {
  opacity: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--header-link-size);
  font-weight: 700;
}

.site-nav a {
  position: relative;
  text-decoration: none;
}

.site-nav a::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  content: "";
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-nav a:hover::after,
.site-nav a.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.nav-toggle-line {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
}

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 78vh;
  padding: 120px 0 64px;
  overflow: hidden;
  color: var(--surface);
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(24, 31, 27, 0.78) 0%, rgba(24, 31, 27, 0.55) 38%, rgba(24, 31, 27, 0.14) 78%),
    linear-gradient(180deg, rgba(24, 31, 27, 0.2), rgba(24, 31, 27, 0.35)),
    url("assets/hero-research.jpg") center / cover no-repeat;
  transform: scale(1.01);
}

.hero-content {
  position: relative;
  width: var(--content);
  margin: 0 auto;
  max-width: 760px;
  justify-self: center;
  text-align: center;
}

.hero-portrait {
  width: min(132px, 38vw);
  margin: 0 auto 16px;
}

.hero-portrait img {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  object-fit: cover;
  object-position: center 32%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  font-weight: 700;
}

h1 {
  max-width: 620px;
  margin-inline: auto;
  font-size: clamp(2.7rem, 6.2vw, 5.25rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h3 {
  font-size: 1.18rem;
}

.hero-lead {
  max-width: 690px;
  margin: 24px auto 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.12rem, 2vw, 1.4rem);
  line-height: 1.5;
}

.hero-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 760px;
  margin: 24px auto 0;
}

.hero-fields span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.94);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
}

.button-primary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--surface);
}

.button-secondary {
  color: var(--surface);
  background: rgba(255, 255, 255, 0.08);
}

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

.button-outline {
  color: var(--ink);
  background: transparent;
  border-color: var(--ink);
}

.intro-section,
.section {
  padding: 82px 0;
}

.intro-section {
  padding-top: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.section-inner {
  width: var(--content);
  margin: 0 auto;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 42px;
  align-items: start;
}

.intro-grid h2 {
  max-width: 520px;
}

.thesis-layout {
  display: grid;
  gap: 26px;
  justify-items: center;
  text-align: center;
}

.section-kicker {
  margin: 0;
  color: var(--rust);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
}

.thesis-layout h2 {
  max-width: 900px;
  margin-inline: auto;
}

.thesis-copy {
  max-width: 860px;
  margin-inline: auto;
}

.thesis-copy p {
  margin: 0;
  color: var(--muted);
}

.thesis-copy p + p {
  margin-top: 16px;
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field-list span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f7f3;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  font-weight: 650;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 34px;
}

.section-heading.compact {
  margin-bottom: 0;
}

.section-heading p,
.contact-panel p {
  margin: 16px 0 0;
  color: var(--muted);
}

#research .section-heading {
  max-width: none;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.project-card,
.experience-item,
.reference-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(32, 33, 31, 0.04);
}

.project-card {
  padding: 24px;
}

.project-card h3 {
  max-width: 980px;
  line-height: 1.28;
}

.project-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  font-weight: 750;
}

.project-authors {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.55;
}

.project-authors span {
  color: var(--ink);
  font-weight: 800;
}

.project-authors a {
  color: var(--lake);
  text-decoration-thickness: 0.08em;
}

.project-status a {
  color: var(--lake);
  text-decoration-thickness: 0.08em;
}

.logo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.thesis-logo-grid {
  width: min(760px, 100%);
  margin-top: 4px;
}

.logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(32, 33, 31, 0.04);
}

.logo-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.logo-link:hover {
  border-color: rgba(71, 116, 135, 0.48);
  box-shadow: 0 10px 28px rgba(32, 33, 31, 0.08);
  transform: translateY(-2px);
}

.logo-link:focus-visible {
  outline: 2px solid var(--lake);
  outline-offset: 4px;
}

.logo-card img {
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.logo-usmb {
  max-height: 104px;
}

.logo-irege {
  max-height: 74px;
}

.card-meta {
  grid-row: 1 / span 2;
  align-content: start;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 8px 12px;
  color: var(--forest);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.institution {
  margin: 8px 0 0;
  color: var(--muted);
  font-style: italic;
}

ul {
  padding-left: 1.1em;
  margin: 18px 0 0;
}

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

.muted {
  background: #f2f5f1;
  border-block: 1px solid var(--line);
}

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

.split-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 54px;
  align-items: start;
}

.timeline {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.timeline-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
  background: var(--surface);
}

.timeline-date,
.item-date {
  color: var(--lake);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-item p,
.experience-item p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.experience-item,
.reference-card {
  padding: 24px;
}

.experience-item .institution {
  color: var(--ink);
}

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

.experience-grid > :last-child:nth-child(odd),
.reference-grid > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, calc((100% - 18px) / 2));
}

.reference-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.reference-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

.reference-links a {
  color: var(--lake);
  text-decoration-thickness: 0.08em;
}

.reference-position {
  margin: 10px 0 0;
  color: var(--muted);
}

.cv-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(32, 33, 31, 0.04);
}

.cv-viewer {
  display: block;
  width: 100%;
  height: min(78vh, 760px);
  min-height: 560px;
  border: 0;
  background: #f7f7f3;
}

.cv-viewer p {
  padding: 24px;
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.contact-section {
  padding-bottom: 96px;
}

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 42px;
  align-items: center;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.contact-panel p {
  color: rgba(255, 255, 255, 0.74);
}

.contact-links {
  display: grid;
  gap: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

.contact-links a,
.contact-links span {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.site-footer {
  width: var(--content);
  margin: 0 auto;
  padding: 26px 0 42px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

@media (max-width: 900px) {
  body {
    font-size: 17px;
  }

  :root {
    --header-link-size: 0.82rem;
  }

  .site-header {
    padding-inline: 20px;
    gap: 14px;
  }

  .header-left {
    gap: 12px;
  }

  .header-contact-links {
    gap: 10px;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: fixed;
    top: 74px;
    left: 20px;
    right: 20px;
    display: none;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: grid;
    gap: 10px;
  }

  .site-nav a {
    padding: 10px 4px;
  }

  .hero {
    min-height: 72vh;
    padding-top: 112px;
  }

  .hero-content {
    padding-inline: 20px;
    width: 100%;
  }

  .intro-grid,
  .split-layout,
  .contact-panel {
    grid-template-columns: 1fr;
  }

  .project-grid,
  .experience-grid,
  .reference-grid,
  .logo-grid {
    grid-template-columns: 1fr;
  }

  .experience-grid > :last-child:nth-child(odd),
  .reference-grid > :last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: stretch;
    width: auto;
  }

  .card-meta {
    grid-column: auto;
  }

  .card-meta {
    grid-row: auto;
    flex-direction: row;
    margin-bottom: 6px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cv-viewer {
    height: 620px;
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  :root {
    --content: min(100vw - 28px, 1120px);
    --header-link-size: 0.72rem;
  }

  .hero {
    min-height: 68vh;
  }

  .hero-portrait {
    width: min(108px, 38vw);
    margin-bottom: 14px;
  }

  .hero-media {
    background:
      linear-gradient(90deg, rgba(24, 31, 27, 0.84) 0%, rgba(24, 31, 27, 0.62) 62%, rgba(24, 31, 27, 0.32) 100%),
      linear-gradient(180deg, rgba(24, 31, 27, 0.16), rgba(24, 31, 27, 0.45)),
      url("assets/hero-research.jpg") 58% center / cover no-repeat;
  }

  h1 {
    font-size: clamp(2.35rem, 11vw, 3.6rem);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .intro-section,
  .section {
    padding: 58px 0;
  }

  .contact-panel {
    padding: 24px;
  }

  .button {
    flex: 1 1 150px;
  }

  .hero-fields span {
    font-size: 0.78rem;
  }

  .cv-viewer {
    height: 520px;
    min-height: 460px;
  }
}

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