/* ---------- theme ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --text: #1f2328;
  --muted: #59636e;
  --border: #e3e6ea;
  --accent: #1e407c;          /* Penn State navy */
  --accent-soft: rgba(30, 64, 124, .09);
  --badge-pre: #6e7781;
  --badge-ws: #0f766e;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --radius: 10px;
  --maxw: 1040px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1216;
  --bg-soft: #171b21;
  --text: #e6e8eb;
  --muted: #9aa4af;
  --border: #2a3038;
  --accent: #8ab4ff;
  --accent-soft: rgba(138, 180, 255, .12);
  --badge-pre: #8b949e;
  --badge-ws: #5eead4;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; }
p { margin: 0 0 .9rem; }
ul { margin: 0; padding: 0; list-style: none; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; height: 60px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 1.4rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); font-size: .94rem; font-weight: 500; white-space: nowrap; }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }
.nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid var(--border); border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer; font-size: 1rem;
}
.theme-toggle:hover { background: var(--bg-soft); }
[data-theme="dark"] .when-light, [data-theme="light"] .when-dark { display: none; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 300px 1fr; gap: 3.5rem;
  padding: 3.5rem 0 2.5rem;
}
.profile { text-align: center; }
.avatar {
  width: 200px; height: 200px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--border), var(--shadow);
}
.profile-name { font-size: 1.6rem; font-weight: 700; margin-top: 1.1rem; letter-spacing: -.01em; }
.profile-role { color: var(--muted); margin: .3rem 0 .8rem; font-size: .95rem; line-height: 1.45; }
.profile-meta { font-size: .9rem; color: var(--muted); display: grid; gap: .25rem; }
.profile-meta li { display: flex; justify-content: center; align-items: center; gap: .4rem; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.1rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .8rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: .87rem; font-weight: 500; color: var(--text); background: var(--bg);
  transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.intro { padding-top: .4rem; }
.hello { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 1rem; }
.label {
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 1.5rem 0 .6rem;
}
.tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.tags li {
  padding: .25rem .75rem; border-radius: 999px; font-size: .88rem; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
}
.callout {
  margin: 1.6rem 0 0; padding: .7rem 1rem; font-size: .95rem;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

/* ---------- sections ---------- */
.section { padding: 2.25rem 0; border-top: 1px solid var(--border); }
.section-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 1.1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }

/* news */
.news li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .95rem;
}
.news li:last-child { border-bottom: 0; }
.news-date { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.fold { margin-top: .4rem; }
.fold summary {
  cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--accent);
  padding: .5rem 0; list-style: none;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸ "; }
.fold[open] summary::before { content: "▾ "; }

/* publications */
.filter { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.filter button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 500;
  padding: .3rem .85rem; cursor: pointer;
}
.filter button + button { border-left: 1px solid var(--border); }
.filter button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.pubs-selected .pub[data-selected="false"] { display: none; }
.pubs-selected .pub-group:not(:has(.pub[data-selected="true"])) { display: none; }

.pub-year {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 1.6rem 0 .3rem;
}
.pub {
  display: grid; grid-template-columns: 128px 1fr; gap: 1.25rem; align-items: start;
  padding: 1rem; margin: 0 -1rem; border-radius: var(--radius);
  transition: background-color .15s;
}
.pub:hover { background: var(--bg-soft); }
.pub-media img { width: 100%; border-radius: 6px; border: 1px solid var(--border); display: block; }
.pub-media .venue { display: block; text-align: center; padding: .3rem .5rem; margin-top: .1rem; }
.venue {
  --c: var(--accent);
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .01em; line-height: 1.35;
  padding: .12rem .55rem; border-radius: 6px;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 9%, transparent);
}
.venue-preprint { --c: var(--badge-pre); }
.venue-workshop { --c: var(--badge-ws); }
.pub-venue .venue { margin-right: .4rem; }
.pub-title { font-size: 1.02rem; font-weight: 600; margin-bottom: .3rem; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
.pub-authors .me { color: var(--text); }
.pub-venue { font-size: .9rem; margin-bottom: .4rem; }
.pub-venue .note { color: var(--muted); }
.pub-tldr { font-size: .9rem; margin-bottom: .5rem; }
.pub-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.pub-links a {
  font-size: .8rem; font-weight: 500; padding: .1rem .6rem;
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
}
.pub-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* timeline */
.timeline { border-left: 2px solid var(--border); padding-left: 1.25rem; }
.timeline li { position: relative; display: grid; padding-bottom: 1.15rem; line-height: 1.45; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.25rem - 6px); top: .35rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-date { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .1rem; }

/* plain lists */
.plain li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .95rem;
}
.plain li:last-child { border-bottom: 0; }

/* footer + to-top */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0 2rem; margin-top: 1rem; font-size: .85rem; color: var(--muted); }
.to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 30;
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 1.75rem; padding-top: 2.25rem; }
  .intro { padding-top: 0; }
  .hello { font-size: 1.6rem; }
  .grid-2 { grid-template-columns: 1fr; gap: 2.25rem; }
}
@media (max-width: 600px) {
  .container { padding: 0 1.1rem; }
  .topbar-inner { gap: 1rem; }
  .brand { display: none; }
  .nav { margin-left: 0; gap: 1.1rem; }
  .theme-toggle { margin-left: auto; }
  .pub { grid-template-columns: 1fr; gap: .5rem; }
  .pub-media .venue { display: inline-block; }
  .pub-media img { max-width: 320px; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .plain li { flex-direction: column; gap: 0; }
}
