* {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --text: #1b1d1f;
  --muted: #666b70;
  --line: #d9dcde;
  --accent: #2c4f3b;
  --dark: #18201b;
  --max: 1120px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

a {
  color: inherit;
}

.container {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.narrow {
  max-width: var(--max);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.nav-wrap {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
}

.brand {
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}

nav {
  display: flex;
  justify-content: flex-start;
  gap: 22px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.94rem;
}

nav a:hover {
  color: var(--text);
}

.hero {
  padding: 20px 0 90px;
  background: #ffffff;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 70px;
  align-items: center;
}

.eyebrow,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 14px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 0 0 22px;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
}

h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0 0 8px;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-copy {
  max-width: 720px;
  font-size: 1.08rem;
  color: #44494d;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.button {
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 19px;
  font-weight: 700;
  font-size: 0.94rem;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  border: 1px solid var(--line);
  background: var(--paper);
}

.profile-card,
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 30px;
}

.profile-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 2rem;
  margin-bottom: 28px;
}

.profile-card h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.profile-card p {
  margin: 5px 0;
  color: var(--muted);
}

.section {
  padding: 95px 0;
}

.alt {
  background: var(--paper);
}

.section p {
  color: #4d5256;
}

.paper {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 24px;
  padding: 38px 0;
  border-top: 1px solid var(--line);
}

.paper:last-child {
  border-bottom: 1px solid var(--line);
}

.paper-number {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  color: var(--accent);
}

.paper-meta {
  margin-top: 0;
  font-size: 0.9rem;
  color: var(--muted) !important;
}

.paper-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 70px;
  align-items: start;
}

.text-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 750;
}

.dark {
  background: var(--dark);
  color: #fff;
}

.dark p {
  color: #d8ddd9;
}

.section-label.light {
  color: #b7cabc;
}

.contact-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.contact-links a {
  color: var(--accent);
  font-weight: 750;
}

footer {
  padding: 30px 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

code {
  background: #eceeea;
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 780px) {
  .nav-wrap {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  nav {
    gap: 14px;
  }

  .hero {
    padding-top: 20px;
  }

  .hero-grid,
  .split {
    grid-template-columns: 1fr;
    gap: 38px;
  }

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

  .footer-wrap {
    flex-direction: column;
  }
}


.contact-details p {
  margin: 0 0 8px;
}

.contact-details a {
  color: #ffffff;
  font-weight: 750;
  text-underline-offset: 3px;
}

.placeholder {
  color: #b7cabc;
  font-style: italic;
}

.hero .eyebrow {
  margin-top: 0;
  padding-top: 0;
}

.hero h1 {
  margin-top: 0;
}

#cv > .container,
#teaching > .container,
#research > .container,
#contact > .container {
  width: min(calc(100% - 40px), var(--max));
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}




.abstract-text {
  max-width: 900px;
  text-align: justify;
}

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




/* Force a uniform white background everywhere except the Contact section */
html,
body,
.site-header,
.hero,
.section,
.section.alt,
main,
footer {
  background: #ffffff !important;
  background-image: none !important;
}

#contact,
#contact.dark {
  background: var(--dark) !important;
}


.working-paper-text {
  margin-top: 16px;
  color: var(--accent) !important;
  font-weight: 700;
}


/* Current layout spacing */
.cv-items {
  margin-top: 18px;
}

.cv-items p {
  margin: 0 0 8px;
  color: var(--accent) !important;
  font-weight: 700;
}

.working-paper-text {
  margin-top: 16px;
  color: var(--accent) !important;
  font-weight: 700;
}

/* Entire site stays white */
html,
body,
.site-header,
.hero,
.section,
.section.alt,
main,
footer,
#contact,
#contact.dark {
  background: #ffffff !important;
  background-image: none !important;
}

#contact,
#contact.dark {
  color: var(--text) !important;
}

#contact p,
#contact.dark p {
  color: #4d5256 !important;
}

#contact a,
#contact.dark a {
  color: var(--accent) !important;
}

/* Exact requested vertical spacing */
.hero {
  padding-top: 20px !important;
  padding-bottom: 38px !important;
}

.hero .subtitle {
  margin-bottom: 0 !important;
}

#cv.compact-cv {
  padding-top: 0 !important;
  padding-bottom: 62px !important;
  margin: 0 !important;
}

#research.compact-research {
  padding-top: 0 !important;
  margin: 0 !important;
}

#teaching {
  padding-top: 20px !important;
}

#cv .cv-items p:last-child {
  margin-bottom: 0 !important;
}


/* Final spacing values — cache-busted in index.html */
.hero {
  padding-bottom: 38px !important;
}

#cv.compact-cv {
  padding-top: 0 !important;
  padding-bottom: 70px !important;
  margin: 0 !important;
}

#research.compact-research {
  padding-top: 0 !important;
  margin: 0 !important;
}

.hero .subtitle,
#cv .cv-items p:last-child {
  margin-bottom: 0 !important;
}


.teaching-table-wrap { width:100%; overflow-x:auto; margin-top:28px; }
.teaching-table { width:100%; border-collapse:collapse; font-size:.96rem; }
.teaching-table th { padding:12px 16px 12px 0; border-bottom:2px solid var(--text); text-align:left; font-size:.78rem; text-transform:uppercase; letter-spacing:.08em; }
.teaching-table td { padding:14px 16px 14px 0; border-bottom:1px solid var(--line); vertical-align:top; }
.teaching-table th:first-child,.teaching-table td:first-child { width:150px; }
.teaching-table th:nth-child(2),.teaching-table td:nth-child(2) { width:155px; white-space:nowrap; }
@media (max-width:650px) { .teaching-table { min-width:620px; } }

.teaching-group { margin-top: 42px; }
.teaching-group:first-of-type { margin-top: 28px; }
.teaching-group h3 { margin-bottom: 10px; }


/* =========================================================
   CLEAN FINAL LAYOUT — replaces all old spacing experiments
   ========================================================= */

/* Research */
#research.compact-research {
  position: static !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 34px !important;
}

#research .paper.research-paper {
  margin: 0 !important;
  padding-top: 28px !important;
  padding-bottom: 0 !important;
}

#research .paper.research-paper + .paper.research-paper {
  margin-top: 18px !important;
}

#research .working-paper-text {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Teaching — normal document flow, no transform/overlap */
#teaching {
  position: static !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  padding-top: 38px !important;
  padding-bottom: 30px !important;
}

#teaching > .container > h2 {
  margin-bottom: 42px !important;
}

#teaching .teaching-group,
#teaching .teaching-group:first-of-type {
  margin: 0 0 52px !important;
}

#teaching .teaching-group:last-child {
  margin-bottom: 0 !important;
}

#teaching .teaching-group h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 16px !important;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

#teaching .teaching-table-wrap {
  width: 100%;
  margin: 0 !important;
  overflow-x: auto;
}

#teaching .teaching-table {
  width: auto !important;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.94rem;
}

#teaching .teaching-table th {
  padding: 10px 18px 10px 0 !important;
  border: 0 !important;
  border-bottom: 2px solid var(--text) !important;
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  white-space: nowrap;
}

#teaching .teaching-table td {
  padding: 13px 18px 13px 0 !important;
  border-bottom: 1px solid var(--line) !important;
  vertical-align: middle;
  color: #3f4448;
}

#teaching .teaching-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

#teaching .teaching-table th:first-child,
#teaching .teaching-table td:first-child {
  width: 145px;
  white-space: nowrap;
}

#teaching .teaching-table th:nth-child(2),
#teaching .teaching-table td:nth-child(2) {
  width: 165px;
  white-space: nowrap;
  font-weight: 650;
}

#teaching .teaching-table th:nth-child(3),
#teaching .teaching-table td:nth-child(3) {
  width: 330px !important;
}

#teaching .teaching-table th:last-child,
#teaching .teaching-table td:last-child {
  width: 85px !important;
  text-align: left !important;
  padding-left: 6px !important;
  padding-right: 0 !important;
  font-variant-numeric: tabular-nums;
}

/* Contact — immediately follows Teaching, eliminating the huge empty gap */
#contact,
#contact.dark {
  position: static !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
  padding-top: 24px !important;
  padding-bottom: 28px !important;
  background: #ffffff !important;
  color: var(--text) !important;
}

#contact .split {
  display: block !important;
}

#contact h2 {
  margin-bottom: 20px !important;
}

#contact .split > div,
#contact .contact-links,
#contact p:first-of-type {
  margin-top: 0 !important;
}

#contact p,
#contact.dark p {
  color: #4d5256 !important;
}

#contact a,
#contact.dark a {
  color: var(--accent) !important;
}

/* No trailing blank page area */
html,
body {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

footer {
  position: static !important;
  margin: 0 !important;
  padding: 14px 0 !important;
}

@media (max-width: 700px) {
  #research.compact-research {
    padding-bottom: 28px !important;
  }

  #teaching {
    padding-top: 34px !important;
    padding-bottom: 26px !important;
  }

  #teaching .teaching-group,
  #teaching .teaching-group:first-of-type {
    margin-bottom: 44px !important;
  }

  #teaching .teaching-table {
    min-width: 660px;
  }

  #contact,
  #contact.dark {
    padding-top: 20px !important;
  }
}


/* Match whitespace beneath the final Working Paper PDF to the other paper separators */
#research .paper.research-paper:last-child {
  padding-bottom: 18px !important;
}

#research .paper.research-paper:last-child .working-paper-text {
  margin-bottom: 0 !important;
}


/* Explicit final research-paper spacing fix */
#research .paper.research-paper:nth-of-type(3) {
  padding-bottom: 18px !important;
  margin-bottom: 0 !important;
}

#research .paper.research-paper:nth-of-type(3) .working-paper-text {
  display: block !important;
  margin: 12px 0 18px 0 !important;
  padding: 0 !important;
}

/* Ensure the bottom rule sits below that whitespace */
#research .paper.research-paper:nth-of-type(3) {
  border-bottom: 1px solid var(--line) !important;
}

/* Research up another 1/16 inch (~6px) */
#research.compact-research {
  position: relative !important;
  top: -6px !important;
  margin-bottom: -6px !important;
}


/* Force Research visibly up another 1/16 inch (~6px) */
#research.compact-research {
  position: relative !important;
  top: auto !important;
  transform: translateY(-6px) !important;
  margin-bottom: -6px !important;
}

/* Research up one additional 1/16 inch: total forced shift now 12px */
#research.compact-research {
  transform: translateY(-12px) !important;
  margin-bottom: -12px !important;
}

/* Research up one more 1/16 inch: total visual shift = 18px */
#research.compact-research {
  transform: translateY(-18px) !important;
  margin-bottom: -18px !important;
}

/* Fine-tune final Working Paper PDF bottom rule spacing */
#research .paper.research-paper:nth-of-type(3) {
  padding-bottom: 0 !important;
}

#research .paper.research-paper:nth-of-type(3) .working-paper-text {
  margin-top: 12px !important;
  margin-bottom: 24px !important;
}

/* Keep the final separator directly after the refined 24px breathing room */
#research .paper.research-paper:nth-of-type(3) {
  border-bottom: 1px solid var(--line) !important;
}
