/* ==========================================================================
   zoe-wang.com — OpenAI-inspired minimal academic homepage
   Light/dark themes, one sans-serif, hairline dividers, generous whitespace.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: rgba(0, 0, 0, 0.04);
  --bg-elev-2: rgba(0, 0, 0, 0.1);
  --fg: #000000;
  --fg-2: rgba(0, 0, 0, 0.78);
  --muted: rgba(0, 0, 0, 0.6);
  --muted-2: rgba(0, 0, 0, 0.44);
  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.3);
  --accent: #000000;
  --accent-fg: #ffffff;
  --focus: #2a6df4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.18);
  --overlay: rgba(0, 0, 0, 0.88);
  --hl: rgba(120, 175, 255, 0.32);       /* highlighter fill */
  --hl-line: rgba(46, 118, 232, 0.9);    /* accent underline (sky blue) */

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;     /* 12px */
  --fs-sm: 0.8125rem;   /* 13px */
  --fs-base: 0.9375rem; /* 15px */
  --fs-md: 1rem;        /* 16px */
  --fs-lg: 1.125rem;    /* 18px */
  --fs-h2: clamp(1.375rem, 1.05rem + 1.1vw, 1.875rem);
  --fs-h1: clamp(2rem, 1.4rem + 2.2vw, 3.125rem);

  --maxw: 1260px;
  --gutter: clamp(20px, 4vw, 44px);
  --section: clamp(56px, 8vw, 104px);
  --header-h: 64px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 150ms;
  --t-med: 260ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "calt";
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(120, 175, 255, 0.45); color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -48px; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { top: 12px; }

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

/* Text links: a thin accent line, and a highlighter fill that sweeps up on hover */
.prose a, .hero-sub a, .news-text a, .pub-authors a, .footer a:not(.to-top), .u-link, .themes .theme-papers a, .personal-list a {
  text-decoration: none;
  color: inherit;
  background-image: linear-gradient(var(--hl-line), var(--hl-line)), linear-gradient(var(--hl), var(--hl));
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 0.1em, 100% 0;
  padding: 0 0.08em;
  margin: 0 -0.08em;
  border-radius: 2px;
  transition: background-size var(--t-med) var(--ease), color var(--t-fast) var(--ease);
}
.prose a:hover, .hero-sub a:hover, .news-text a:hover, .pub-authors a:hover, .footer a:not(.to-top):hover, .u-link:hover, .themes .theme-papers a:hover, .personal-list a:hover {
  background-size: 100% 0.1em, 100% 100%;
  color: var(--fg);
}


/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  transition: box-shadow var(--t-med) linear;
}
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 16px; }
.brand { font-weight: 500; letter-spacing: -0.01em; font-size: var(--fs-md); display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 18px; height: 18px; border-radius: 50%; background: #3d8ef0; flex: 0 0 auto; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 12px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
@media (hover: hover) {
  .nav:hover a { color: var(--muted); }
  .nav a:hover { color: var(--fg); }
}
.nav a[aria-current="page"], .nav a.is-active { color: var(--fg); }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.icon-btn:hover { color: var(--fg); background: var(--bg-elev); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

@media (max-width: 720px) {
  .menu-btn { display: inline-flex; }
  .js .nav {
    position: absolute; left: 0; right: 0; top: var(--header-h); z-index: 49;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .js .nav.is-open { display: flex; }
  /* Without JavaScript: no hamburger; links wrap onto a second header row */
  html:not(.js) .menu-btn { display: none; }
  html:not(.js) .site-header { height: auto; }
  html:not(.js) .site-header .wrap { flex-wrap: wrap; padding-block: 10px; }
  html:not(.js) .nav { order: 3; width: 100%; flex-wrap: wrap; gap: 0; }
  html:not(.js) .nav a { padding: 8px 10px 4px 0; font-size: var(--fs-sm); }
  .nav a { padding: 12px 8px; font-size: var(--fs-md); border-radius: var(--r-sm); }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 7vw, 96px) var(--section); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.hero h1 { font-size: var(--fs-h1); font-weight: 500; letter-spacing: -0.035em; }
.hero .name-cn { display: inline-block; margin-left: 0.35em; font-weight: 500; color: var(--fg-2); letter-spacing: 0.02em; font-size: 0.8em; vertical-align: 0.06em; }
.hero-sub { margin-top: 16px; font-size: var(--fs-lg); line-height: 1.5; color: var(--fg-2); font-weight: 400; letter-spacing: -0.01em; }
.hero-sub b { font-weight: 500; color: var(--fg); }
.hero .prose { margin-top: 24px; color: var(--fg-2); font-size: var(--fs-base); }
.hero .prose p:last-child { margin-bottom: 0; }
.interests { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--bg-elev); color: var(--fg-2);
  font-size: var(--fs-sm); font-weight: 500;
  border: 1px solid transparent;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--bg-elev);
  font-size: var(--fs-sm); font-weight: 500; line-height: 1;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--bg-elev-2); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); opacity: 0.85; border-color: var(--accent); }
.hero-photo { position: relative; margin: 28px 0 0; }
.hero-photo img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 50%;
  border-radius: 0;
  background: var(--bg-elev);
}
.hero-photo figcaption { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { max-width: 260px; }
}

/* ---------- Sections ---------- */
.section { padding-block: 0 var(--section); }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding-bottom: 20px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}
.section-head h2 { font-size: var(--fs-h2); font-weight: 500; }
.section-head .aside { font-size: var(--fs-sm); color: var(--muted); text-align: right; }
.section-head .aside a { color: var(--fg); }
.section-head .aside a:hover { color: var(--muted); }
.eyebrow { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-bottom: 10px; }

/* ---------- News ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item {
  display: grid; grid-template-columns: 104px 1fr; gap: 24px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: 0; }
.news-date { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; white-space: nowrap; }
.news-text { color: var(--fg-2); }
.news-text b { font-weight: 500; color: var(--fg); }
.news-text .badge { vertical-align: 2px; margin-left: 2px; }
.news-item[hidden] { display: none; }
.more-row { display: flex; justify-content: center; padding-top: 20px; }
.btn-ghost { color: var(--fg-2); }
.btn-ghost:hover { color: var(--fg); }
@media (max-width: 600px) {
  .news-item { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Publications ---------- */
.research { padding: 22px 0 6px; }
.research-q { margin: 0 0 14px; font-size: var(--fs-md); font-style: italic; color: var(--fg); letter-spacing: -0.005em; }
.themes { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.themes li { color: var(--fg-2); line-height: 1.6; padding-left: 0.2em; }
.themes li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.themes b { font-weight: 500; color: var(--fg); }
.themes .theme-desc { display: block; }
.themes .theme-papers { display: block; margin-top: 2px; font-size: var(--fs-sm); color: var(--muted); }
.themes .theme-papers a { color: var(--fg-2); }
.pub-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 18px 0 6px;
}
.tabs { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--bg-elev); gap: 2px; }
.tab {
  padding: 7px 14px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--muted);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.tab:hover { color: var(--fg); }
.tab[aria-pressed="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 0 0 1px var(--line); }
.legend { font-size: var(--fs-xs); color: var(--muted); }
.legend sup { font-size: 0.8em; }
.pub-list {
  list-style: none; margin: 0; padding: 20px 0 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px 28px;
}
.pub { display: flex; flex-direction: column; min-width: 0; }
.pub[hidden] { display: none; }
.pub-thumb {
  display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-sm); background: #ffffff;
  border: 1px solid var(--line);
}
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #ffffff; transition: transform var(--t-med) var(--ease); }
@media (hover: hover) { .pub-thumb:hover img { transform: scale(1.03); } }
.pub-body { display: flex; flex-direction: column; padding-top: 14px; }
.pub-title { font-size: var(--fs-base); font-weight: 500; letter-spacing: -0.01em; line-height: 1.4; text-wrap: wrap; }
.pub-title a:hover { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.pub-title, .news-text, .pub-authors { overflow-wrap: anywhere; }
.pub-note { margin: 24px 0 0; font-size: var(--fs-xs); color: var(--muted); max-width: 70ch; }
.pub-authors { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }
.pub-authors .me {
  color: var(--fg); font-weight: 700; padding: 0 0.04em;
  background-image: linear-gradient(var(--hl-line), var(--hl-line));
  background-position: 0 100%; background-repeat: no-repeat; background-size: 100% 0.12em;
}
.pub-authors sup { font-size: 0.75em; margin-left: 1px; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: var(--r-pill); font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.01em; line-height: 1.4; background: var(--bg-elev); color: var(--muted); white-space: nowrap; }
.badge svg { width: 11px; height: 11px; flex: 0 0 auto; }
.badge-talk { background: rgba(71, 87, 217, 0.13); color: #2f3fa8; }
.badge-conference { background: rgba(20, 150, 140, 0.14); color: #0d6b63; }
.badge-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.badge-award { background: rgba(232, 147, 60, 0.16); color: #8a4a06; }
.badge-milestone { background: rgba(152, 71, 123, 0.14); color: #7a2b5c; }
.badge-press { background: rgba(71, 87, 217, 0.13); color: #2f3fa8; }
.venue {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--r-pill);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; line-height: 1.4;
  background: var(--bg-elev); color: var(--fg-2);
}
.venue.is-preprint { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-weight: 500; }
.pub-meta .flag { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pub-links a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: var(--r-pill);
  background: var(--bg-elev);
  font-size: var(--fs-xs); font-weight: 500; color: var(--fg-2);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pub-links a:hover { background: var(--bg-elev-2); color: var(--fg); }
.pub-links a svg { width: 12px; height: 12px; opacity: 0.7; }
.abstract { margin-top: 12px; font-size: var(--fs-sm); }
.abstract summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-weight: 500; user-select: none;
  transition: color var(--t-fast) var(--ease);
}
.abstract summary::-webkit-details-marker { display: none; }
.abstract summary::before {
  content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg) translateY(1px); transition: transform var(--t-fast) var(--ease);
}
.abstract[open] summary::before { transform: rotate(45deg) translateY(-1px); }
.abstract summary:hover { color: var(--fg); }
.abstract p { margin: 10px 0 0; color: var(--fg-2); line-height: 1.65; max-width: 78ch; }
.empty-note { padding: 32px 0; color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 1000px) { .pub-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pub-list { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Background (education / experience) ---------- */
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); padding-top: 24px; }
.bg-grid-3 { grid-template-columns: 1fr 1.25fr 1fr; gap: clamp(24px, 3vw, 40px); }
.bg-grid-3 .timeline li { grid-template-columns: 104px 1fr; gap: 12px; }
.bg-col h3 { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.personal { margin-top: clamp(32px, 4vw, 48px); }
.personal h3 { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.personal-list li { grid-template-columns: 150px 1fr; }
.personal-list .what { font-weight: 400; color: var(--fg-2); }
.service .what { line-height: 1.8; }
.service .badge { vertical-align: 1px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline .what { display: block; font-weight: 500; }
.timeline .where { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
@media (max-width: 960px) { .bg-grid-3 { grid-template-columns: 1fr; } .bg-grid-3 .timeline li { grid-template-columns: 150px 1fr; } }
@media (max-width: 720px) { .bg-grid { grid-template-columns: 1fr; } }

/* ---------- Design page ---------- */
.page-hero { padding-block: clamp(48px, 7vw, 96px) clamp(32px, 5vw, 64px); }
.page-hero h1 { font-size: var(--fs-h1); letter-spacing: -0.035em; }
.page-hero .hero-sub { max-width: 52ch; }
.work-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.work-nav a { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.work-nav a:hover { background: var(--bg-elev-2); color: var(--fg); }
.work { padding-block: 0 var(--section); }
.work-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px 48px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line-strong); margin-bottom: 24px; }
.work-head h2 { font-size: var(--fs-h2); }
.work-head .org { display: block; margin-top: 8px; font-size: var(--fs-md); color: var(--muted); font-weight: 400; letter-spacing: 0; }
.work-head p { margin: 0; color: var(--fg-2); max-width: 56ch; }
/* Justified gallery: each figure grows in proportion to its aspect ratio (--r = width/height) */
.gallery { display: flex; flex-wrap: wrap; gap: 14px; }
.gallery::after { content: ""; flex-grow: 1000000; min-width: 0; }
.gallery figure { margin: 0; flex-grow: calc(var(--r, 1.333) * 100); flex-basis: calc(var(--r, 1.333) * 220px); min-width: min(100%, calc(var(--r, 1.333) * 150px)); max-width: 100%; }
.gallery a.zoom {
  display: block; width: 100%; overflow: hidden; border-radius: var(--r-md);
  background: var(--bg-elev); border: 1px solid var(--line);
  transition: box-shadow var(--t-med) var(--ease);
}
.gallery a.zoom img { width: 100%; height: auto; aspect-ratio: var(--r, 1.333); object-fit: cover; transition: transform var(--t-med) var(--ease); }
.gallery figure.is-wide { flex-basis: calc(var(--r, 1.333) * 300px); }
@media (hover: hover) {
  .gallery a.zoom:hover { box-shadow: var(--shadow); }
  .gallery a.zoom:hover img { transform: scale(1.02); }
}
@media (max-width: 720px) {
  .work-head { grid-template-columns: 1fr; }
  .gallery { gap: 10px; }
  .gallery figure { flex-basis: calc(var(--r, 1.333) * 150px); }
}

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1400px); max-height: 94vh; }
.lightbox::backdrop { background: var(--overlay, rgba(0, 0, 0, 0.88)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox img { max-width: min(96vw, 1400px); max-height: calc(94vh - 3.5rem); width: auto; height: auto; border-radius: var(--r-sm); margin: 0 auto; }
.lightbox-close { position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.12); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
.lightbox-caption { color: rgba(255,255,255,0.75); text-align: center; font-size: var(--fs-sm); margin: 10px 0 0; }

/* WeChat QR popup */
.qr-dialog { border: 0; padding: 16px; border-radius: var(--r-lg); background: #fff; width: min(88vw, 320px); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45); }
.qr-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.qr-dialog img { width: 100%; height: auto; border-radius: var(--r-sm); }
.qr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px -2px 10px 4px; font-size: var(--fs-sm); font-weight: 500; color: var(--fg); }
.qr-close { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); background: var(--bg-elev); transition: background-color var(--t-fast) var(--ease); }
.qr-close svg { width: 16px; height: 16px; }
.qr-close:hover { background: var(--bg-elev-2); }

/* Dumpling photo popup (shares the WeChat popup frame) */
.cat-dialog { width: min(92vw, 420px); }
.cat-count { margin-left: auto; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.cat-stage { position: relative; }
.cat-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  border-radius: var(--r-sm); background: var(--bg-elev); scrollbar-width: none;
}
.cat-track::-webkit-scrollbar { display: none; }
.cat-track img { flex: 0 0 100%; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; scroll-snap-align: center; }
.cat-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.92); color: var(--fg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: opacity var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.cat-arrow svg { width: 18px; height: 18px; }
.cat-arrow:hover { background: #fff; }
.cat-arrow[disabled] { opacity: 0; pointer-events: none; }
.cat-prev { left: 10px; }
.cat-next { right: 10px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-strong); padding: 32px 0 48px; color: var(--muted); font-size: var(--fs-sm); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.footer p { margin: 0; }
.to-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.to-top:hover { color: var(--fg); }

/* ---------- 404 ---------- */
.nf { min-height: 60vh; display: grid; place-items: center; text-align: center; padding-block: var(--section); }
.nf h1 { font-size: var(--fs-h1); }
.nf p { color: var(--muted); margin-top: 12px; }

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --fg: #000; --fg-2: #222; --muted: #555; --line: #ddd; --line-strong: #bbb; --bg-elev: #f2f2f2; }
  .site-header, .footer .to-top, .pub-toolbar, .more-row, .menu-btn, .pub-note { display: none !important; }
  .news-item[data-extra] { display: grid !important; }
  .pub { display: flex !important; }
  body { color: #000; background: #fff; }
  .btn-primary { color: #000; background: none; border: 1px solid #000; }
  .pub, .news-item { break-inside: avoid; }
  .abstract { display: none; }
  a { color: inherit; }
}
