@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* web-py — self-contained styles mirroring the live Hugo site
   (Inter font, blue #3b82f6 primary, minimal layout, dark hero, light/dark). */

:root {
  --primary: #3b82f6;      /* blue-500 */
  --primary-dark: #2563eb; /* blue-600 */
  --bg: #ffffff;
  --bg-soft: #f8fafc;      /* slate-50 */
  --ink: #1f2937;          /* gray-800 */
  --muted: #6b7280;        /* gray-500 */
  --border: #e5e7eb;       /* gray-200 */
  --hero-bg: #0f172a;      /* slate-900 */
  --hero-ink: #e2e8f0;     /* slate-200 */
  --max: 820px;
}

html.dark {
  --bg: #0b1120;
  --bg-soft: #111827;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --hero-bg: #060a14;
  --hero-ink: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

.container { max-width: var(--max); margin: 0 auto; padding: 2.5rem 1.25rem; }

/* --- Navbar --------------------------------------------------------------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.75rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar-brand { font-weight: 700; color: var(--ink); }
.navbar-brand:hover { text-decoration: none; }
.navbar-links { display: flex; align-items: center; gap: 1.25rem; }
.navbar-links a { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.navbar-links a:hover, .navbar-links a.active { color: var(--primary); text-decoration: none; }
#theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--ink);
  border-radius: 999px; width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem;
}
#theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* --- Hero (mirrors resume-biography-3 dark block) ------------------------- */
.hero {
  background:
    radial-gradient(1200px 400px at 70% -10%, rgba(59,130,246,0.25), transparent),
    var(--hero-bg);
  color: var(--hero-ink);
  padding: 5rem 1.25rem;
}
.hero-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 3rem; align-items: flex-start;
}
.hero-text { flex: 2 1 320px; }
.hero-name { font-size: 2.6rem; font-weight: 800; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.hero-role { color: #93c5fd; font-weight: 600; margin: 0 0 1.25rem; }
.hero-role a { color: #93c5fd; }
.hero-bio { color: #cbd5e1; max-width: 46ch; }
.hero-social { margin-top: 1.5rem; display: flex; gap: 1rem; }
.hero-social a {
  color: var(--hero-ink); border: 1px solid rgba(255,255,255,0.25);
  padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.9rem;
}
.hero-social a:hover { background: var(--primary); border-color: var(--primary); text-decoration: none; }
.hero-interests { flex: 1 1 220px; }
.hero-interests h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: #93c5fd; }
.hero-interests ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.hero-interests li { padding: 0.3rem 0; border-bottom: 1px solid rgba(255,255,255,0.08); color: #cbd5e1; }

/* --- Page content --------------------------------------------------------- */
.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1.5rem; }
.prose h2 { margin-top: 2.25rem; font-size: 1.5rem; font-weight: 700; }
.prose h3 { margin-top: 1.75rem; font-size: 1.2rem; font-weight: 700; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose ul { padding-left: 1.25rem; }
.prose code {
  background: var(--bg-soft); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em;
}
.prose pre { background: var(--bg-soft); padding: 1rem; border-radius: 8px; overflow-x: auto; }
.prose blockquote {
  border-left: 3px solid var(--primary); margin: 1.25rem 0; padding: 0.25rem 1rem; color: var(--muted);
}

.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.page-lead { color: var(--muted); margin: 0 0 2rem; }
.section-heading {
  font-size: 1.35rem; font-weight: 700; margin: 0 0 1rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.more-link { font-weight: 600; }

/* --- Hero avatar (mirrors Hugo resume-biography) -------------------------- */
.hero-avatar {
  width: 160px; height: 160px; border-radius: 50%; object-fit: cover;
  border: 4px solid rgba(255,255,255,0.15); flex: 0 0 auto;
}
.hero-bio p { color: #cbd5e1; max-width: 52ch; margin: 0.5rem 0; }
.hero-bio a { color: #93c5fd; }

/* --- About grid: interests + education ------------------------------------ */
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-bottom: 3rem;
}
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-list li {
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.9rem;
}
.tag-list.small li { font-size: 0.8rem; padding: 0.2rem 0.6rem; }
.edu-list { list-style: none; padding: 0; margin: 0; }
.edu-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.edu-area { display: block; font-weight: 600; }
.edu-meta { display: block; color: var(--muted); font-size: 0.9rem; }

/* --- Research overview + bottom education -------------------------------- */
.research { margin: 2.5rem 0 3rem; }
.research-body { max-width: 54rem; }
.research-body p { margin: 0 0 1rem; line-height: 1.65; }
.edu-section, .experience-education { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* --- Related papers (detail page) --------------------------------------- */
.pub-related { list-style: none; padding: 0; margin: 0; }
.pub-related li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; gap: 0.85rem; align-items: flex-start; }
.related-figure { width: 76px; height: auto; flex-shrink: 0; border: 1px solid var(--border); border-radius: 4px; }
.related-body { flex: 1; min-width: 0; }
.related-title { font-weight: 600; }
.pub-related .alt-venue { color: var(--muted); font-size: 0.85rem; margin-left: 0.5rem; }
.pub-related .pub-tldr { margin-top: 0.3rem; }

/* --- PhD students -------------------------------------------------------- */
.students-section { margin-top: 3rem; }
.students-sub { font-size: 1rem; color: var(--muted); margin: 1.4rem 0 0.4rem; }
.students-list { list-style: none; padding: 0; margin: 0; }
.students-list li { padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.student-head { display: flex; gap: 0.6rem; align-items: baseline; }
.student-name { font-weight: 600; }
.student-years { color: var(--muted); font-size: 0.85rem; margin-left: auto; white-space: nowrap; }
.student-tldr { margin-top: 0.2rem; }
.student-more { margin-top: 0.3rem; }
.student-more > summary { cursor: pointer; color: var(--primary); font-size: 0.9rem; width: fit-content; }
.student-detailed { margin: 0.5rem 0 0; color: var(--muted); max-width: 54rem; }

/* --- Publications --------------------------------------------------------- */
.pub-section { margin: 3rem 0; }
.pub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.pub-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem;
  background: var(--bg-soft); transition: border-color 0.15s, transform 0.15s;
}
.pub-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.pub-card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.4rem; line-height: 1.35; }
.pub-card-authors { font-size: 0.9rem; color: var(--ink); margin-bottom: 0.25rem; }
.pub-card-meta { font-size: 0.85rem; color: var(--muted); }

.pub-card.has-image { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.pub-card-image { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg); }
.pub-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-card.has-image .pub-card-body { padding: 1.1rem 1.25rem 1.25rem; }
/* --- Tags & filtering ----------------------------------------------------- */
.tag-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 2rem; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.tag-chip {
  font: inherit; font-size: 0.78rem; cursor: pointer;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.7rem;
  transition: all 0.12s;
}
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.filter-status { color: var(--muted); font-size: 0.9rem; margin: -1rem 0 1.5rem; }
.footer-email { white-space: nowrap; }
.i-mail { font-style: normal; }

/* --- Inline alternate versions -------------------------------------------- */
.alt-header {
  margin: 0.6rem 0 0.2rem; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.alt-title { font-style: italic; color: var(--ink); }
.pub-alternates { list-style: none; margin: 0.15rem 0 0; padding: 0 0 0 1rem;
  border-left: 2px solid var(--border); }
.pub-alternates li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem;
  font-size: 0.85rem; color: var(--muted); padding: 0.15rem 0;
}
.alt-label {
  font-weight: 600; color: var(--ink); font-size: 0.75rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.02rem 0.5rem;
}
.alt-venue { font-style: italic; }

/* --- 404 ------------------------------------------------------------------- */
.notfound { text-align: center; padding: 4rem 1rem; }
.notfound-code { font-size: 5rem; font-weight: 800; color: var(--primary); margin: 0; }
.notfound-text { color: var(--muted); font-size: 1.2rem; }

.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-item { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.pub-title { font-weight: 600; }
.pub-authors { font-size: 0.92rem; color: var(--ink); }
.pub-meta { font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.2rem; }
.pub-venue { font-style: italic; }
.pub-link { font-weight: 600; }
.pub-year-group { margin-bottom: 2rem; }

/* --- Experience timeline -------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding: 0 0 1.75rem 2.25rem; }
.timeline-dot {
  position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--bg);
}
.timeline-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.timeline-org { color: var(--ink); }
.timeline-dates { color: var(--muted); font-size: 0.88rem; margin: 0.15rem 0 0.5rem; }
.timeline-summary { margin: 0; color: var(--muted); }

/* --- Projects ------------------------------------------------------------- */
.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.project-card { border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; background: var(--bg-soft); }
.project-title { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.4rem; }
.project-summary { color: var(--muted); margin: 0 0 0.75rem; }

/* --- Footer --------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border); color: var(--muted);
  font-size: 0.9rem; padding: 2rem 0; margin-top: 3rem;
}
.footer .container { padding-top: 0; padding-bottom: 0; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { padding: 3rem 1.25rem; }
  .hero-inner { flex-direction: column; text-align: center; align-items: center; }
  .hero-social { justify-content: center; }
  .hero-name { font-size: 2rem; }
  .hero-avatar { width: 120px; height: 120px; }
  .about-grid, .pub-grid, .project-grid { grid-template-columns: 1fr; }
  .navbar-links { gap: 0.85rem; }
}

/* --- publication figure (#featured) + #tldr + edited volumes --- */
.pub-item.has-figure { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: start; }
.pub-figure { width: 96px; height: auto; border-radius: 6px; border: 1px solid var(--border, #e5e7eb); background: #fff; }
.pub-tldr { margin: .4rem 0 .2rem; font-size: .92rem; color: var(--muted, #6b7280); border-left: 3px solid var(--primary, #3b82f6); padding-left: .6rem; }
.pub-tldr p { margin: .2rem 0; }
.pub-role { color: var(--muted, #6b7280); font-style: italic; }
.edited-volumes .section-heading { opacity: .85; }
@media (max-width: 560px) { .pub-item.has-figure { grid-template-columns: 1fr; } .pub-figure { width: 120px; } }

/* #tldr summary in featured cards */
.pub-card-tldr { margin-top: .5rem; font-size: .88rem; color: var(--muted, #6b7280); border-top: 1px solid var(--border, #e5e7eb); padding-top: .5rem; }
.pub-card-tldr p { margin: .2rem 0; }

/* kind badge (Tutorial / Popularization) */
.pub-kind { display:inline-block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--primary,#3b82f6); border:1px solid currentColor; border-radius:4px; padding:0 .35rem; margin-right:.4rem; }

/* --- local publication pages + clickable cards --- */
.pub-title a, .pub-card-title { color: inherit; text-decoration: none; }
.pub-title a:hover { color: var(--primary, #3b82f6); text-decoration: none; }
.pub-card-link { display: block; color: inherit; text-decoration: none; }
.pub-card-link:hover { text-decoration: none; }
.pub-card-link:hover .pub-card-title { color: var(--primary, #3b82f6); }
.pub-detail { max-width: 44rem; }
.pub-detail-figure { margin: 1rem 0; }
.pub-detail-figure img { max-width: 100%; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; }
.pub-access { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0; }
.pub-access .btn { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--primary, #3b82f6); border-radius: 6px; color: var(--primary, #3b82f6); text-decoration: none; font-weight: 600; font-size: .9rem; }
.pub-access .btn:hover { background: var(--primary, #3b82f6); color: #fff; }
.pub-access .btn-primary { background: var(--primary, #3b82f6); color: #fff; }

/* supervised (PhD / post-doc) students highlighted in author lists */
.author-supervised { color: #3b82f6; }
:root[data-theme="dark"] .author-supervised { color: #7cb0ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .author-supervised { color: #7cb0ff; } }
