/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 8px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

:root {
  --bg: #f4f3f1;
  --text: #3f3f3f;
  --accent: #a6555c;
  --accent-rgb: 166, 85, 92;
  --heading: #60252a;
  --card-border: var(--accent);
  --muted: #6a665d;
  --divider: #dedad5;
  --surface: #fdfcfa;
  --radius: 4px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --nav-height: 60px;
  --max-width: 1100px;
  --column: 700px;
  --section-padding: 4rem 2rem;
}

body {
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg) url('assets/bg-texture.jpg') top center;
  background-repeat: repeat;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { text-decoration: underline; }

main { padding-top: var(--nav-height); }

section {
  padding: var(--section-padding);
  max-width: var(--max-width);
  margin: 0 auto;
}

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

h1 { font-family: 'Lora', serif; font-size: 2.25rem; font-weight: 600; line-height: 1.2; color: var(--heading); }
h2 {
  font-family: 'Lora', serif;
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  position: relative;
  color: var(--heading);
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
h3 { font-family: 'Lora', serif; font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--heading); }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ─── Nav ─── */
#site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg);
  z-index: 100;
  border-bottom: 1px solid var(--divider);
  transition: box-shadow 0.2s ease;
}

#site-nav.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: 'Lora', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--heading);
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; }

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  background: var(--heading);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus { top: 0; }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  font-family: 'Lora', serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

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

.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ─── Footer ─── */
footer {
  border-top: 1px solid var(--divider);
  background: var(--surface);
  padding: 3rem 0 2.5rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-contact {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.footer-copy {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── Home — Hero ─── */
#home { padding-top: 3rem; }

.hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--divider);
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.12);
}

.hero-role {
  font-family: 'Lora', serif;
  font-style: italic;
  color: var(--muted);
  margin: 0.35rem 0 1rem;
}

.hero-bio {
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 1rem;
  max-width: var(--column);
}

.hero-bio:last-of-type {
  margin-bottom: 0;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.contact-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Books ─── */
.books-section h2 { margin-bottom: 2rem; }

.books-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, 140px);
  gap: 2rem 1.5rem;
  justify-content: start;
}

.book {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.book a {
  display: block;
  border-radius: var(--radius);
  transition: opacity 0.2s ease;
}

.book a:hover {
  opacity: 0.85;
}

.book img {
  width: 140px;
  height: 210px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius);
  border: 1px solid var(--divider);
  box-shadow: var(--shadow);
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.book-year {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0;
}

.book-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--accent);
  margin-bottom: 0;
}

.book-publisher {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0;
}


/* ─── Shared: single-column reading layout ─── */
.section-inner {
  max-width: var(--column);
}
.section-inner h3 { margin-top: 2rem; }

/* ─── Research — pills ─── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 2rem;
}

.pill {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
}

/* ─── Research — projects ─── */
.projects-list {
  padding-left: 1.25rem;
}

.projects-list li {
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

/* ─── Invited Talks — Timeline ─── */
.timeline {
  position: relative;
  padding-left: 5rem;
  max-width: var(--column);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 3.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--divider);
}

.timeline-year {
  position: relative;
  margin-bottom: 2.5rem;
}

.timeline-year-label {
  position: absolute;
  left: -5rem;
  top: 0;
  width: 3rem;
  text-align: right;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  padding-top: 0.15rem;
}

.timeline-year::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-entries {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-entry p {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ─── Books section accent ─── */
.books-section {
  margin-top: 3rem;
  border-top: 1px solid var(--divider);
  padding-top: 2.5rem;
}

/* ─── Courses ─── */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.course-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-top: 4px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.course-code {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.course-card h3 {
  font-size: 1rem;
  margin-bottom: 0;
  margin-top: 0;
}

.course-card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0;
}

.courses-note {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: var(--column);
}

/* ─── Publications ─── */
#publications details {
  max-width: var(--column);
  margin: 0 0 0.75rem;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  overflow: hidden;
}

#publications summary {
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  background: var(--surface);
  user-select: none;
  transition: background 0.15s;
}

#publications summary::-webkit-details-marker { display: none; }

#publications summary::before {
  content: '▶';
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
  margin-right: 0.6rem;
  flex-shrink: 0;
}

#publications details[open] > summary::before {
  transform: rotate(90deg);
}

#publications summary:hover {
  background: var(--divider);
}

.pub-count {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.pub-list {
  padding: 1rem 1.25rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  background: var(--surface);
}

.pub-list li {
  font-size: 0.9rem;
  line-height: 1.65;
}

.pub-year {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.4rem;
  letter-spacing: 0.04em;
}

/* ─── Tablet (768px – 1023px) ─── */
@media (max-width: 1023px) {
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Nav */
  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .nav-links.nav-open {
    display: flex;
  }

  .nav-links li { width: 100%; }

  .nav-links a {
    display: block;
    padding: 0.75rem 1.5rem;
    border-bottom-color: transparent;
    font-size: 1rem;
    position: relative;
  }

  .nav-links a.active::before {
    content: '';
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
  }
}

/* ─── Mobile (< 768px) ─── */
@media (max-width: 767px) {
  :root {
    --section-padding: 3rem 1.25rem;
  }

  /* Hero */
  .hero {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .hero-photo { margin: 0 auto; } /* avatar centering is chrome, not a content block */

  .hero-title, .hero-role { text-align: center; }

  /* Footer contact */
  .footer-contact {
    flex-direction: column;
    gap: 1.25rem;
  }

  /* Courses */
  .courses-grid {
    grid-template-columns: 1fr;
  }

  /* Timeline */
  .timeline {
    padding-left: 4rem;
  }

  .timeline::before {
    left: 2.5rem;
  }

  .timeline-year-label {
    left: -4rem;
    width: 1.75rem;
    font-size: 0.75rem;
  }

  .timeline-year::before {
    left: -1.75rem;
  }
}
