:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #555555;
  --link: #333333;
  --card: #f7f7f8;
  --border: #e6e6e8;
  --header-height: 64px; /* fallback; updated via JS */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --fg: #f2f2f2;
    --muted: #aaaaaa;
    --link: #ffffff;
    --card: #121212;
    --border: #222222;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 8px); }
body {
  margin: 0;
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: underline; }
a:hover { text-decoration: underline; }
.site-header a, .site-footer a { text-decoration: none; }
.site-header a:hover, .site-footer a:hover { text-decoration: underline; }

.container { max-width: 984px; margin: 0 auto; padding: 0 16px; }
.site-header, .site-footer { border-bottom: 1px solid var(--border); }
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg); }
.site-footer { border-top: 1px solid var(--border); border-bottom: 0; margin-top: 48px; }
.site-header .container, .site-footer .container { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px; }
.site-title { font-size: 1.25rem; margin: 0; }
.site-title a { color: inherit; }
.site-nav ul { list-style: none; display: flex; gap: 16px; padding: 0; margin: 0; }

.skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { position: static; width: auto; height: auto; padding: 8px; background: var(--card); border: 1px solid var(--border); }

.section { padding-bottom: 40px; }
.section h2 { margin-top: 0; font-size: 1.5rem; }
.about-section { padding-bottom: 10px; }
.about-section p { font-size: 1.25em; }
.columns { display: grid; grid-template-columns: 160px 1fr; gap: 24px; align-items: start; }
.col-image img { border-radius: 50%; }

/* Layout with left sidebar */
.layout { display: grid; grid-template-columns: minmax(0, 220px) 1fr; gap: 32px; align-items: start; }
.sidebar { position: sticky; top: calc(var(--header-height) + 1em); align-self: start; max-width: 220px; width: 100%; margin-top: 0; }
.sidebar .photo-frame { padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.sidebar .photo-frame picture { display: block; }
.sidebar .photo-frame img { width: 100%; height: auto; aspect-ratio: 864 / 975; }
.sidebar img { border-radius: 8px; }
.sidebar-name { font-size: 1.125rem; margin: 12px 0 0; }
.meta { list-style: none; padding: 0; margin: 12px 0 0; color: var(--muted); }
.sidebar .meta { display: grid; gap: 8px; }
.sidebar .meta a { color: inherit; text-decoration: none; }
.sidebar .meta a:hover { text-decoration: underline; }

.sidebar .meta .icon { display: inline-block; font-size: 0.9em; margin-right: 6px; opacity: 0.8; }

.cards { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
.card { display: grid; grid-template-columns: 1fr 180px; grid-template-areas: "content thumb"; gap: 16px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.card h4 { margin: 0 0 8px; color: var(--link); }
.card h4 + .authors { margin-top: 0; }
.paper-link { font-weight: normal; }
.card .thumb img { border-radius: 6px; transition: box-shadow 0.15s ease-in-out; }

.card > div { grid-area: content; }
.card .thumb { grid-area: thumb; display: block; padding: 0; border-radius: 8px; }
.card .thumb:hover img { box-shadow: 0 0 0 3px var(--border); }

.teaching-list { list-style: none; padding: 0; margin: 8px 0 0; }
.teaching-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }

@media (max-width: 720px) {
  .columns { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; gap: 4px; }
  .sidebar { position: static; margin: 1em auto 0; text-align: center; display: grid; justify-items: center; }
  .sidebar-name { display: none; }
  .sidebar .meta { display: none; }
  .sidebar .photo-frame { max-width: 400px; width: 100%; }
  .about-section { padding-bottom: 0px; }
  .about-section p { font-size: 1.2em; }
  .card { grid-template-columns: 1fr; grid-template-areas: "thumb" "content"; }
  .card .thumb img { width: 100%; max-width: 400px; margin: 0 auto; }
  .site-header .container { flex-wrap: wrap; gap: 8px; }
}
