:root {
  --bg: #fafbfc; --card: #fff; --ink: #18212b; --muted: #667085;
  --accent: #0f766e; --accent-soft: #e6f4f2; --rule: #e7eaee;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --card: #161d25; --ink: #e6e9ee; --muted: #98a2b3;
    --accent: #2dd4bf; --accent-soft: #12302d; --rule: #243040;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --card: #161d25; --ink: #e6e9ee; --muted: #98a2b3;
  --accent: #2dd4bf; --accent-soft: #12302d; --rule: #243040;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

.wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }

/* Sidebar */
aside { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 56px 32px; border-right: 1px solid var(--rule); }
.photo { width: 100%; max-width: 235px; height: auto; aspect-ratio: 1; border-radius: 0; object-fit: contain; background: #fff; border: 4px solid var(--card); box-shadow: 0 0 0 1px var(--rule); }
aside h1 { font-size: 24px; margin: 18px 0 2px; letter-spacing: -.01em; }
.role { color: var(--muted); font-size: 14px; line-height: 1.5; }
.role a { color: inherit; }
.email { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 500; }
aside nav { margin: 26px 0; display: flex; flex-direction: column; gap: 2px; }
aside nav a { color: var(--ink); padding: 4px 10px; border-radius: 6px; font-weight: 500; }
aside nav a:hover { background: var(--accent-soft); text-decoration: none; }
aside nav a.on { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { font-size: 13px; font-weight: 500; padding: 5px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); }
.chips a:hover { border-color: var(--accent); text-decoration: none; }
.theme { margin-top: 22px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0; }
.theme:hover { color: var(--ink); }

/* Content */
main { padding: 56px 56px 72px; }
section { margin-bottom: 52px; scroll-margin-top: 24px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 18px; font-weight: 600; }
/* Collapsible sections: About, News and Publications start open */
section:has(> details:not([open])) { margin-bottom: 24px; }
summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; width: fit-content; border-radius: 6px; }
summary::-webkit-details-marker { display: none; }
summary h2 { margin: 0; }
details[open] > summary { margin-bottom: 18px; }
summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details[open] > summary::after { transform: rotate(45deg) translate(-2px, -2px); }
summary:hover h2 { color: var(--ink); }
summary:hover::after { border-color: var(--ink); }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.lead { font-size: 16.5px; max-width: 72ch; margin: 0 0 14px; }

.news-box { max-height: 340px; overflow-y: auto; scrollbar-width: thin; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px 6px 26px; }
.news-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Fade at the bottom while more news is below; site.js adds .end when scrolled to the bottom */
.news-box::after { content: ""; display: block; position: sticky; bottom: -6px; height: 48px; margin-top: -48px; background: linear-gradient(to bottom, transparent, var(--card)); pointer-events: none; transition: opacity .2s; }
.news-box.end::after { opacity: 0; }
.news { border-left: 2px solid var(--rule); padding-left: 20px; }
.news div { margin-bottom: 12px; position: relative; }
.news div::before { content: ""; position: absolute; left: -26px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--card); }
.news .d { font-size: 13px; color: var(--muted); display: block; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filters button { font: inherit; font-size: 13px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--card); }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px; margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.card[hidden] { display: none; }
.card h3 { font-size: 15.5px; line-height: 1.45; margin: 0; font-weight: 600; }
.authors { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.authors b { color: var(--ink); }
.venue { font-size: 13.5px; margin-top: 4px; }
.plinks { display: flex; gap: 6px; margin-top: 10px; }
.plinks a { font-size: 12px; font-weight: 600; padding: 2px 9px; border: 1px solid var(--rule); border-radius: 6px; }
.plinks a:hover { border-color: var(--accent); text-decoration: none; }
/* Figures under a paper: one row, equal heights (flex set per image from its aspect ratio) */
.figs { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; }
.figs a { display: block; min-width: 0; }
.figs img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); background: #fff; }
.badge { font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--ink); color: var(--card); padding: 3px 9px; border-radius: 6px; }
a.badge::after { content: " \2197"; }   /* the badge links to the paper */
a.badge:hover { background: var(--accent); color: var(--card); text-decoration: none; }
.note { font-size: 13px; color: var(--muted); }

.row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.row .d { color: var(--muted); }
footer { color: var(--muted); font-size: 13px; }

/* Short laptop screens: keep the links and theme toggle in view */
@media (min-width: 901px) and (max-height: 820px) {
  aside { padding-top: 28px; padding-bottom: 20px; }
  aside h1 { margin-top: 12px; }
  aside nav { margin: 16px 0; }
}
@media (max-width: 600px) {
  .figs { flex-direction: column; }
  .figs a { flex: none !important; width: 100%; }
}
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 36px 16px 24px; text-align: center; }
  aside nav { flex-direction: row; flex-wrap: wrap; justify-content: center; margin: 18px 0; }
  .chips { justify-content: center; }
  main { padding: 32px 16px 56px; }
  .card { grid-template-columns: 1fr; gap: 10px; }
  .badge { justify-self: start; order: -1; }
  .row { grid-template-columns: 1fr; gap: 0; }
}
