/* ============================================================
   Theme tokens — change --accent to recolor the whole site.
   ============================================================ */
:root {
  --bg: #fdfdfc;
  --bg-soft: #f4f4f1;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --border: #e3e3de;
  --accent: #1d5fa8;
  --accent-soft: #e6eef8;
  --badge: #e8743b;
  --badge-text: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);

  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-head: "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --maxw: 920px;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --bg-soft: #1b1e23;
    --surface: #1d2026;
    --text: #e6e6e3;
    --muted: #9aa1ab;
    --border: #2d3139;
    --accent: #7ab0f0;
    --accent-soft: #1f2d40;
    --badge: #d9682f;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-soft: #1b1e23;
  --surface: #1d2026;
  --text: #e6e6e3;
  --muted: #9aa1ab;
  --border: #2d3139;
  --accent: #7ab0f0;
  --accent-soft: #1f2d40;
  --badge: #d9682f;
  --shadow: none;
  color-scheme: dark;
}

/* ============================================================
   Base
   ============================================================ */
*, *::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: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 32px; padding-bottom: 48px; }
section { margin: 0 0 44px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ============================================================
   Navigation
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--text); }
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.nav-links a {
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  color: var(--text); padding: 6px 12px; border-radius: 6px;
}
.nav-links a:hover { background: var(--bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-toggle, .theme-toggle {
  background: none; border: 0; cursor: pointer; padding: 6px 10px;
  border-radius: 6px; color: var(--muted); font-size: 1rem;
}
.theme-toggle:hover, .nav-toggle:hover { background: var(--bg-soft); color: var(--text); }
.nav-toggle { display: none; font-size: 1.2rem; }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .fa-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .fa-moon { display: none; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 10px 12px; }
  .theme-toggle { margin-top: 4px; }
}

/* ============================================================
   Home hero
   ============================================================ */
.hero { display: flex; gap: 32px; align-items: center; margin-bottom: 28px; }
.hero-photo {
  width: 200px; height: 200px; flex-shrink: 0;
  object-fit: cover; border-radius: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  background: var(--bg-soft);
}
.hero h1 { font-size: 2.6rem; margin-bottom: .15em; }
.hero-aka { display: flex; gap: 8px; align-items: center; margin: -2px 0 8px; color: var(--muted); font-family: var(--font-head); font-size: 1.05rem; }
.hero-aka strong { color: var(--text); }
.pronouns { font-size: .85rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-soft); }
@media (max-width: 640px) { .hero-aka { justify-content: center; } }
.hero-role { font-family: var(--font-head); font-size: 1.2rem; margin: 0; }
.hero-loc { color: var(--muted); margin: 2px 0 14px; font-size: .95rem; }
.hero-loc i { margin-right: 4px; }
.bio p { margin: 0 0 1em; }

@media (max-width: 640px) {
  .hero { flex-direction: column; text-align: center; gap: 18px; }
  .hero-photo { width: 160px; height: 160px; }
  .hero h1 { font-size: 2.1rem; }
  .hero .social { justify-content: center; }
}

/* Social icon buttons */
.social { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); font-size: 1.15rem;
  transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-2px); text-decoration: none; }
.social-sm .icon-btn { width: 34px; height: 34px; font-size: .95rem; }

/* ============================================================
   Section headings, buttons, chips, tags
   ============================================================ */
.section-title {
  font-size: 1.6rem; padding-bottom: 6px; margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin-bottom: 18px; padding-bottom: 6px; }
.section-head .section-title { border: 0; margin: 0; padding: 0; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 2.4rem; margin-bottom: .2em; }
.page-subtitle { color: var(--muted); margin: 0; font-size: 1.1rem; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 600; font-size: .98rem;
  padding: 8px 16px; border-radius: 8px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent); cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; padding: 4px 8px; }
.btn-ghost:hover { background: var(--accent-soft); filter: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-head); font-size: .85rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.chip:hover, .chip[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip[aria-expanded="true"] { background: var(--accent-soft); }
.chip-sm { font-size: .78rem; padding: 1px 8px; margin-left: 4px; }

.tag {
  display: inline-block; font-family: var(--font-head); font-size: .78rem;
  padding: 1px 8px; border-radius: 4px; margin-right: 4px;
  background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border);
}
.tag-journal    { background: #f3edfb; color: #5b3a8c; border-color: #dccdf0; }
.tag-conference { background: #fdeef0; color: #9b2c3f; border-color: #f2c9d0; }
.tag-workshop   { background: #eef6ee; color: #2f6b36; border-color: #cbe3cd; }
.tag-preprint   { background: #fff4e5; color: #9a5b00; border-color: #f3d7a8; }
.tag-thesis     { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
:root[data-theme="dark"] .tag-journal    { background: #2b2140; color: #c9b3ef; border-color: #43355f; }
:root[data-theme="dark"] .tag-conference { background: #3a1d24; color: #f0a9b6; border-color: #5a2d37; }
:root[data-theme="dark"] .tag-workshop   { background: #1d3121; color: #9fd3a6; border-color: #2e4a33; }
:root[data-theme="dark"] .tag-preprint   { background: #3a2c14; color: #f0c27a; border-color: #5a4521; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag-journal    { background: #2b2140; color: #c9b3ef; border-color: #43355f; }
  :root:not([data-theme="light"]) .tag-conference { background: #3a1d24; color: #f0a9b6; border-color: #5a2d37; }
  :root:not([data-theme="light"]) .tag-workshop   { background: #1d3121; color: #9fd3a6; border-color: #2e4a33; }
  :root:not([data-theme="light"]) .tag-preprint   { background: #3a2c14; color: #f0c27a; border-color: #5a4521; }
}

/* ============================================================
   Cards (projects)
   ============================================================ */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}
.card h3 { font-size: 1.2rem; margin-bottom: .35em; }
.card p { margin: 0 0 .6em; font-size: .98rem; }
.card-tags { margin: 0; }

/* ============================================================
   News / talks lists with date badges
   ============================================================ */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; gap: 12px; align-items: baseline; padding: 5px 0; }
.date-badge {
  flex-shrink: 0; font-family: var(--font-head); font-weight: 700; font-size: .78rem;
  background: var(--badge); color: var(--badge-text);
  padding: 1px 8px; border-radius: 4px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.news li[hidden], .timeline li[hidden] { display: none; }
.more-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0;
  padding: 2px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted);
  font-family: var(--font-head); font-size: .85rem; line-height: 1.6;
  transition: color .15s, border-color .15s;
}
.more-toggle:hover { color: var(--accent); border-color: var(--accent); }
.more-toggle .dots { letter-spacing: 2px; font-size: .7rem; }
.more-toggle .less { display: none; }
.more-toggle[aria-expanded="true"] .dots { display: none; }
.more-toggle[aria-expanded="true"] .less { display: inline; }

/* ============================================================
   CV summary
   ============================================================ */
.cv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px 36px; }
.cv-block h3 { font-size: 1.15rem; color: var(--accent); }
.cv-block h3 i { width: 1.3em; }
.timeline { list-style: none; margin: 0 0 12px; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 4px; display: flex; flex-direction: column; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-when { font-family: var(--font-head); font-size: .85rem; color: var(--muted); }
.tl-what { font-weight: 600; }
.tl-where { font-style: italic; }
.tl-detail { font-size: .93rem; color: var(--muted); }
.plain-list { margin: 0; padding-left: 20px; }

.cv-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.pdf-viewer {
  width: 100%; height: 85vh; min-height: 520px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft);
}
.pdf-fallback { padding: 24px; }

/* ============================================================
   Research page
   ============================================================ */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.toc a { font-family: var(--font-head); font-weight: 600; font-size: .92rem; padding: 4px 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text); }
.toc a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.filter {
  font-family: var(--font-head); font-size: .88rem; font-weight: 600;
  padding: 4px 12px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.filter:hover { color: var(--text); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.pub { display: flex; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub[hidden] { display: none; }
.pub-thumb { width: 180px; flex-shrink: 0; }
.pub-thumb img, .thumb-placeholder { width: 180px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumb-placeholder { display: grid; place-items: center; background: var(--bg-soft); color: var(--border); font-size: 2rem; }
.pub-body { flex: 1; min-width: 0; }
.pub-title { font-size: 1.15rem; margin-bottom: .3em; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors, .pub-venue { margin: 0; font-size: .96rem; }
.pub-note { color: var(--badge); font-weight: 600; }
.pub-venue .tag { margin-left: 6px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pub-extra {
  margin-top: 12px; padding: 12px 14px; font-size: .95rem;
  background: var(--bg-soft); border-radius: 8px; border-left: 3px solid var(--accent);
}
.pub-extra p { margin: 0; }
.bib { position: relative; }
.bib pre { margin: 0; font-size: .8rem; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-btn { position: absolute; top: 8px; right: 8px; font-family: var(--font-head); font-size: .8rem; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 640px) {
  .pub { flex-direction: column; gap: 10px; }
  .pub-thumb, .pub-thumb img, .thumb-placeholder { width: 100%; }
  .thumb-placeholder { display: none; }
}

/* ============================================================
   Blog
   ============================================================ */
.rss { margin-top: -12px; font-family: var(--font-head); font-size: .92rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.year-sep h2 { font-size: 1.3rem; color: var(--muted); margin: 24px 0 8px; }
.post-item { display: flex; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.post-item time { flex-shrink: 0; width: 60px; font-family: var(--font-head); color: var(--muted); padding-top: 3px; }
.post-item h3 { font-size: 1.2rem; margin: 0 0 .25em; }
.post-item p { margin: 0 0 .4em; font-size: .97rem; }
.post-list.compact li { display: flex; gap: 16px; padding: 4px 0; }
.post-list.compact time { flex-shrink: 0; width: 110px; font-family: var(--font-head); color: var(--muted); }

.back-link { font-family: var(--font-head); font-size: .95rem; margin: 0 0 16px; }
.post-header h1 { font-size: 2.3rem; }
.post-meta { color: var(--muted); font-family: var(--font-head); }
.post-meta .tag { margin-left: 6px; }
.post-content { max-width: 70ch; }
.post-content h2 { margin-top: 1.6em; }
.post-content img { border-radius: 8px; margin: 1em auto; }
.post-content blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--accent); color: var(--muted); }
.post-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--bg-soft); padding: .1em .35em; border-radius: 4px; }
.post-content pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
.post-content pre code { background: none; padding: 0; }
.post-content table { border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 6px 10px; }

/* ============================================================
   Adventures
   ============================================================ */
.adventures { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.adv {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s ease;
}
.adv:hover { transform: translateY(-3px); }
.adv-media img, .adv-placeholder { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.adv-placeholder {
  display: grid; place-items: center; font-size: 2.6rem; color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft));
}
.adv-body { padding: 14px 18px 18px; }
.adv-meta { margin: 0 0 6px; color: var(--muted); font-size: .88rem; font-family: var(--font-head); }
.adv-meta .date-badge { margin-right: 6px; }
.adv h3 { font-size: 1.2rem; margin-bottom: .3em; }
.adv p { margin: 0; font-size: .97rem; }

/* ============================================================
   Footer / 404
   ============================================================ */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0 32px; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.footer-inner p { margin: 0; }
.not-found { text-align: center; padding: 60px 0; }
.not-found h1 { font-size: 5rem; color: var(--accent); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
