:root {
  --bg: #f7f6f3;
  --text: #24221f;
  --text-muted: #514d46;   /* darkened for AA contrast */
  --heading: #14130f;
  --accent: #8a3232;       /* oxblood, AA on light bg */
  --accent-soft: rgba(138, 50, 50, 0.1);
  --border: #d9d5cd;
  --card: #ffffff;
  --focus: #8a3232;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] {
  --bg: #0e1116;
  --text: #d2d9e0;
  --text-muted: #9aa4af;   /* lightened for AA contrast */
  --heading: #eef2f6;
  --accent: #7fd3c1;
  --accent-soft: rgba(127, 211, 193, 0.12);
  --border: #262c34;
  --card: #161b22;
  --focus: #7fd3c1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
strong { color: var(--heading); font-weight: 600; }
em { color: var(--text); }
button { font-family: inherit; cursor: pointer; }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--card); color: var(--heading);
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 6px;
}
.skip-link:focus { left: 12px; top: 12px; }

.theme-toggle {
  position: fixed; top: 20px; right: 22px; z-index: 20;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: inline; }

/* ===== Layout ===== */
.layout {
  max-width: 1100px; margin: 0 auto; padding: 0 40px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
}

/* ===== Sidebar ===== */
.sidebar__inner {
  position: sticky; top: 0; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 100px 0 80px;
}
.name {
  font-family: var(--serif); font-weight: 600; font-size: 2.6rem;
  letter-spacing: -0.015em; line-height: 1.05; color: var(--heading);
}
.title { font-size: 1.15rem; color: var(--heading); margin-top: 12px; font-weight: 500; }
.tagline { color: var(--text-muted); margin-top: 16px; max-width: 300px; }

.nav { margin-top: 44px; }
.nav ul { display: flex; flex-direction: column; gap: 2px; }
.nav__link {
  display: inline-flex; align-items: center; gap: 14px;
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 8px 0; transition: color 0.2s;
}
.nav__line { height: 1px; width: 28px; background: currentColor; transition: width 0.2s ease; }
.nav__link:hover, .nav__link.is-active { color: var(--heading); }
.nav__link.is-active .nav__line { width: 56px; background: var(--accent); }

.socials { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 40px; }
.socials a {
  font-size: 0.9rem; color: var(--text-muted);
  border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Content ===== */
.content { padding: 100px 0 80px; }
.section { margin-bottom: 84px; scroll-margin-top: 40px; }
.section:focus { outline: none; }
.section > p { color: var(--text); margin-bottom: 16px; }
.section__label {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted);
  margin-bottom: 22px;
}
.hint { font-size: 0.9rem; color: var(--text-muted); margin: -6px 0 20px; }
.note { font-size: 0.92rem; color: var(--text-muted); }
.note a, .section p a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pills span {
  font-size: 0.82rem; padding: 5px 12px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}

/* ===== Accordion cards ===== */
.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  border: 1px solid var(--border); border-radius: 10px;
  background: transparent; overflow: hidden;
}
.card.is-open { background: var(--card); }
.card__h { margin: 0; font-size: inherit; font-weight: inherit; }
.card__head {
  width: 100%; text-align: left; background: none; border: 0;
  display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: start;
  padding: 18px 20px;
}
.card__date {
  font-size: 0.74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
  padding-top: 3px;
}
.card__heading { display: flex; flex-direction: column; gap: 3px; }
.card__title { font-size: 1.02rem; color: var(--heading); font-weight: 600; }
.card__org { color: var(--text-muted); font-size: 0.92rem; }
.card__chevron {
  width: 10px; height: 10px; margin-top: 5px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: transform 0.25s ease;
}
.card.is-open .card__chevron { transform: rotate(-135deg); }

.card__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s ease; }
.card.is-open .card__panel { grid-template-rows: 1fr; }
.card__panel-inner { overflow: hidden; padding: 0 20px; }
.card.is-open .card__panel-inner { padding: 0 20px 20px 158px; }
.card__panel-inner p { font-size: 0.96rem; color: var(--text); margin-bottom: 12px; }
@media (max-width: 860px) {
  .card.is-open .card__panel-inner { padding: 0 20px 20px; }
}

.hl { margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.hl li {
  position: relative; padding-left: 18px;
  font-size: 0.94rem; color: var(--text);
}
.hl li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 0.74rem; padding: 4px 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}

/* ===== Mentorship ===== */
.mentees { display: flex; flex-direction: column; gap: 12px; }
.mentees li {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: 16px; border-left: 2px solid var(--border);
}
.mentee__name { font-family: var(--serif); font-size: 1.08rem; color: var(--heading); font-weight: 600; }
.mentee__now { font-size: 0.92rem; color: var(--text-muted); }
.mentees__note { font-size: 0.94rem; color: var(--text-muted); margin-top: 18px; }

/* ===== Research tiles ===== */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  padding: 20px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--border); transition: border-color 0.2s ease;
  display: flex; flex-direction: column;
}
.tile.is-active { border-color: var(--accent); }
.tile h3 { font-family: var(--serif); font-size: 1.14rem; color: var(--heading); margin-bottom: 8px; font-weight: 600; }
.tile p { font-size: 0.92rem; color: var(--text-muted); margin: 0 0 14px; flex: 1; }
.tile__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tile__filter {
  font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 6px; padding: 6px 12px;
}
.tile__filter:hover { border-color: var(--accent); }
.tile__filter[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.tile__link {
  font-size: 0.82rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border); transition: color 0.2s, border-color 0.2s;
}
.tile__link:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Publications ===== */
.pubs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pub-reset {
  font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 6px;
}
.pub-reset:hover { border-color: var(--accent); }
.pubs { display: flex; flex-direction: column; margin-top: 8px; }
.pub {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: 0; }
.pub[hidden] { display: none; }
.pub__title {
  font-family: var(--serif); font-size: 1.08rem; color: var(--heading); font-weight: 500;
  align-self: start; text-decoration: none;
  transition: color 0.15s ease;
}
a.pub__title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pub__meta { font-size: 0.9rem; color: var(--text-muted); }

.foot {
  margin-top: 44px; font-size: 0.84rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 20px;
}

/* ===== Reveal (respects reduced motion) ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card__panel, .card__chevron { transition: none; }
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 0 24px; }
  .sidebar__inner { position: static; min-height: 0; padding: 72px 0 20px; }
  .nav { display: none; }
  .content { padding: 20px 0 56px; }
  .section { margin-bottom: 56px; }
  .card__head { grid-template-columns: 1fr auto; }
  .card__date { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; }
}
