/* ==========================================================================
   Minimal academic theme — clean, single-column layout
   ========================================================================== */

:root {
  --maxw: 760px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Inter", sans-serif;
}

/* Light palette (default) */
:root, :root[data-theme="light"] {
  --text: #1a1a1a;
  --muted: #6b7280;
  --faint: #9ca3af;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --border: #e5e7eb;
  --bg: #ffffff;
  --tag-bg: #f3f4f6;
  --accent: #111827;
}

/* Dark palette */
:root[data-theme="dark"] {
  --text: #e5e7eb;
  --muted: #9ca3af;
  --faint: #6b7280;
  --link: #7aa2f7;
  --link-hover: #a5c0ff;
  --border: #262b36;
  --bg: #0f1115;
  --tag-bg: #1a1e26;
  --accent: #f3f4f6;
}

/* Follow the OS when the user hasn't picked a theme explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #e5e7eb;
    --muted: #9ca3af;
    --faint: #6b7280;
    --link: #7aa2f7;
    --link-hover: #a5c0ff;
    --border: #262b36;
    --bg: #0f1115;
    --tag-bg: #1a1e26;
    --accent: #f3f4f6;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

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

/* --- Top nav ------------------------------------------------------------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.topnav .brand {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.topnav nav a {
  color: var(--muted);
  margin-left: 18px;
  font-size: 15px;
}
.topnav nav a:hover { color: var(--text); text-decoration: none; }
.topnav nav { display: flex; align-items: center; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 0;
  padding: 4px;
  margin-left: 18px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Show the icon for the theme you'll switch TO */
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: inline-flex; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: inline-flex; }

@media (max-width: 560px) {
  .topnav nav a { margin-left: 12px; font-size: 14px; }
  .topnav .brand { font-size: 15px; }
  .theme-toggle { margin-left: 12px; }
}

/* --- Hero / intro -------------------------------------------------------- */
.hero {
  display: flex;
  gap: 34px;
  align-items: flex-start;
  padding: 52px 0 8px;
}
.hero .photo {
  flex: 0 0 168px;
  width: 168px;
}
.hero .photo img {
  width: 168px;
  height: 168px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.hero .intro { flex: 1 1 auto; min-width: 0; }
.hero h1 {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.hero .role {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 16px;
}
.hero .role a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.hero .role a:hover { color: var(--text); }

@media (max-width: 560px) {
  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding-top: 36px;
  }
  .hero .intro { text-align: left; }
  .hero .links { justify-content: center; }
}

/* --- Icon / text links row ---------------------------------------------- */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 4px;
  font-size: 15px;
}
.links a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.links a:hover { color: var(--link); text-decoration: none; }
.links svg { width: 17px; height: 17px; fill: currentColor; }

/* --- Sections ------------------------------------------------------------ */
section { padding: 26px 0; }
section + section { border-top: 1px solid var(--border); }

h2.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  font-weight: 600;
  margin: 0 0 18px;
}

p { margin: 0 0 16px; }
section p:last-child { margin-bottom: 0; }

/* --- News ---------------------------------------------------------------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: flex;
  gap: 16px;
  padding: 7px 0;
  font-size: 16px;
}
.news .date {
  flex: 0 0 88px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  padding-top: 1px;
}
.news .body { flex: 1 1 auto; }

/* --- Publications -------------------------------------------------------- */
.pub {
  display: flex;
  gap: 18px;
  padding: 16px 0;
}
.pub + .pub { border-top: 1px solid var(--border); }
.pub .venue-badge {
  flex: 0 0 62px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pub .meta { flex: 1 1 auto; min-width: 0; }
.pub .title {
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 3px;
}
.pub .authors { font-size: 15px; color: var(--muted); margin-bottom: 2px; }
.pub .authors .me { color: var(--text); font-weight: 600; }
.pub .where { font-size: 14px; color: var(--faint); font-style: italic; }
.pub .plinks { margin-top: 5px; font-size: 14px; }
.pub .plinks a {
  color: var(--link);
  margin-right: 12px;
}

.more-link { margin-top: 18px; font-size: 15px; }
.more-link a { font-weight: 500; }

/* --- Timeline (experience / education) ----------------------------------- */
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { padding: 10px 0; }
.timeline li + li { border-top: 1px solid var(--border); }
.timeline .head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.timeline .head .r { font-weight: 600; }
.timeline .head .when { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline .org { color: var(--muted); font-size: 15px; }
.timeline .desc { color: var(--text); font-size: 15px; margin-top: 4px; }

/* --- Tags ---------------------------------------------------------------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
  background: var(--tag-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13.5px;
}

/* --- Generic content pages (CV, Awards) ---------------------------------- */
.page { padding-bottom: 40px; }
.page-title {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 44px 0 8px;
}
.page h2 {
  font-size: 20px;
  margin: 34px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.page h3 { font-size: 16px; margin: 22px 0 6px; }
.page ul { padding-left: 20px; }
.page li { margin: 4px 0; }
.page table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 15px;
}
.page th, .page td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.page th { color: var(--muted); font-weight: 600; }

/* --- Footer -------------------------------------------------------------- */
footer.site {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding: 30px 0 48px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}
footer.site .footer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  margin: 0;
}
footer.site .counter { display: inline-flex; align-items: center; }
footer.site .counter img { vertical-align: middle; opacity: 0.9; }
footer.site .footer-updated { margin: 10px 0 0; font-size: 13px; color: var(--faint); }
footer.site a { color: var(--muted); }
