/* Personal site styles — minimal academic theme with light/dark support */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f5f2;
  --text: #1f2328;
  --muted: #5d6570;
  --accent: #b3262c;
  --accent-soft: rgba(179, 38, 44, 0.08);
  --border: #e5e1db;
  --nav-bg: rgba(255, 255, 255, 0.82);
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05), 0 4px 16px rgba(20, 20, 30, 0.05);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --measure: 760px;
  --wrap: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1a1d22;
    --text: #e7e8ea;
    --muted: #9ba2ad;
    --accent: #f07c78;
    --accent-soft: rgba(240, 124, 120, 0.12);
    --border: #2a2e35;
    --nav-bg: rgba(20, 22, 26, 0.82);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 6px;
  position: relative;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  cursor: pointer;
}

/* ---------- Sections ---------- */
section { padding: 72px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title {
  font-size: 1.75rem;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Hero / About ---------- */
.hero { padding-top: 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 48px;
  align-items: start;
}
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.hero h1 { font-size: 2.6rem; margin-bottom: 4px; }
.role { color: var(--text); font-weight: 500; font-size: 1.05rem; margin: 0 0 22px; }
.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  margin: 0 0 22px;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 6px; color: var(--muted); font-size: 0.95rem; }

.contact { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.contact a, .contact span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
}
.contact a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.contact svg { width: 16px; height: 16px; flex: none; }

.bio { max-width: var(--measure); margin-top: 28px; }
.side .contact { flex-direction: column; flex-wrap: nowrap; gap: 8px; margin: 16px 0 0; }
.side .contact li { width: 100%; }
.side .contact a, .side .contact span {
  display: flex;
  width: 100%;
  border: 0;
  background: none;
  padding: 2px 0;
  border-radius: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}
.side .contact .loc-text { white-space: nowrap; line-height: 1.35; font-size: 0.82rem; }
/* BU logo card */
.side .bu-card { display: block; width: 64%; margin-bottom: 14px; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s; }
.side .bu-card:hover { transform: translateY(-1px); }
.side .bu-card img { width: 100%; height: auto; display: block; }

/* colored link buttons */
.side .contact a.ext, .side .contact span.ext {
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.side .contact a.ext:hover { border-color: var(--c); transform: translateY(-1px); text-decoration: none; color: var(--text); }
.side .contact .ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--c);
  color: #fff;
  padding: 0;
}
.side .contact .ico svg { width: 16px; height: 16px; }
.side .contact .ico.logo { background: #fff; border: 1px solid var(--border); }
.side .contact .ico img { width: 18px; height: auto; }
.side .contact .ico b { font-size: 0.72rem; letter-spacing: -0.02em; line-height: 1; }
.bio p { margin: 0 0 1.1em; }

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.news li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.news li:last-child { border-bottom: 0; }
.news time { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.news li[hidden] { display: none; }
.more-btn {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 16px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.more-btn:hover { border-color: var(--accent); color: var(--accent); }

.award { color: var(--accent); font-weight: 600; }

/* ---------- Publications ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 28px; }
.filter {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 14px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}
.filter:hover { color: var(--text); border-color: var(--muted); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  .filter[aria-pressed="true"] { color: #14161a; }
}

.year-group { margin-bottom: 8px; }
.year-group[hidden] { display: none; }
.year {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--muted);
  margin: 28px 0 6px;
}
.pub {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  max-width: var(--measure);
}
.pub[hidden] { display: none; }
.pub-num { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; padding-top: 3px; }
.pub-title { font-family: var(--font-head); font-size: 1.12rem; font-weight: 600; line-height: 1.35; margin: 0 0 4px; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { margin: 0; font-size: 0.95rem; }
.pub-authors strong { font-weight: 600; }
.pub-venue { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; font-style: italic; }
.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.02em;
  margin-right: 6px;
  vertical-align: 1px;
}
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 11px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
}
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip.primary { border-color: var(--accent); color: var(--accent); }
.chip.primary:hover { background: var(--accent); color: #fff; }

/* ---------- Students ---------- */
.group-title { font-size: 1.2rem; margin: 0 0 6px; }
.group-title:not(:first-of-type) { margin-top: 40px; }
.group-note { color: var(--muted); margin: 0 0 18px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px; margin-top: 18px; }
.person { text-align: center; }
.person img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 20%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.person b { display: block; line-height: 1.3; }
.person span { color: var(--muted); font-size: 0.88rem; }
.plain-list { padding-left: 20px; margin: 10px 0 0; }

/* ---------- Teaching ---------- */
.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.course {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.course h3 { font-size: 1.05rem; margin-bottom: 12px; }
.course ul { list-style: none; margin: 0; padding: 0; }
.course li { padding: 3px 0; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted); font-size: 0.88rem; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  section { padding: 52px 0; }
  .hero-grid { display: flex; flex-direction: column; gap: 0; }
  .hero-grid > div, .side { display: contents; }
  .side .bu-card { order: 1; width: 44%; margin-bottom: 14px; }
  .portrait { order: 2; margin-bottom: 20px; }
  .hero h1 { order: 3; }
  .hero .role { order: 4; margin-bottom: 18px; }
  .side .contact { order: 5; margin: 0 0 22px; }
  .callout { order: 6; }
  .hero .bio { order: 7; margin-top: 6px; }
  .portrait { max-width: 200px; }
  .hero h1 { font-size: 2.1rem; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 12px;
  }
  .nav-links.open { display: flex; }
  .news li { grid-template-columns: 1fr; gap: 2px; }
  .pub { grid-template-columns: 1fr; }
  .pub-num { display: none; }
}

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

/* ---------- Course pages ---------- */
.course-page section { padding: 44px 0; }
.course-page section:first-of-type { padding-top: 48px; }
.course-page .wrap > h2 { font-size: 1.9rem; margin-bottom: 22px; }
.course-page h4 { font-size: 1.3rem; margin: 0 0 14px; }
.course-page h5 { font-size: 1.05rem; margin: 26px 0 8px; font-family: var(--font-head); }
.course-page .wrap > p, .course-page .wrap > ul, .course-page .wrap > ol { max-width: var(--measure); }
.course-page ul, .course-page ol { padding-left: 22px; }
.course-page li { margin: 3px 0; }

.table-wrap {
  overflow-x: auto;
  margin: 14px 0 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.course-page table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.course-page th {
  text-align: left;
  background: var(--bg-alt);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.course-page td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.course-page tr:last-child td { border-bottom: 0; }
.course-page table.data tr:hover td { background: var(--accent-soft); }
.course-page table.meta td:first-child { width: 170px; white-space: nowrap; }

@media (max-width: 760px) {
  .course-page table.meta, .course-page table.meta tbody, .course-page table.meta tr, .course-page table.meta td { display: block; width: 100%; }
  .course-page table.meta td:first-child { padding-bottom: 0; border-bottom: 0; color: var(--muted); font-size: 0.82rem; width: 100%; }
  .course-page table.meta td:last-child { padding-top: 2px; }
  .course-page table.data { min-width: 560px; }
}
