/* ============================================================
   Guokai Li — personal academic website
   Palette: warm paper, ink text, celadon-teal accent,
   with a "seal red" (印章红) used sparingly for the name.
   ============================================================ */

/* Self-hosted 楷体 fallback: LXGW WenKai (SIL OFL), subset to only the ~75 Chinese
   characters this site actually uses — 17 KB instead of a multi-megabyte CJK face.
   It is last in --kai-stack, so visitors with a system 楷体 (macOS/iOS 华文楷体,
   Windows 楷体) never download it. */
@font-face {
  font-family: "LXGW WenKai Subset";
  src: url("assets/lxgw-wenkai-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Light theme (default) */
  --paper:        #fbf8f2;
  --paper-tint:   #f4efe5;
  --surface:      #ffffff;
  --ink:          #22201d;
  --ink-soft:     #4c4842;
  --muted:        #8a837a;
  --line:         #e6ded0;
  --accent:       #0f6e6a;   /* celadon teal */
  --accent-deep:  #0a504d;
  --seal:         #a23b3b;   /* seal red */
  --shadow:       0 1px 2px rgba(34, 32, 29, .04), 0 8px 30px rgba(34, 32, 29, .06);

  --kai-stack:  "Kaiti SC", "STKaiti", "\534E\6587\6977\4F53", "KaiTi", "\6977\4F53", "LXGW WenKai Subset", "Noto Serif SC";
  --font-serif: "Fraunces", Georgia, "Times New Roman", var(--kai-stack), serif;
  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", var(--kai-stack), sans-serif;
  --font-zh:    var(--kai-stack), var(--font-serif);

  --maxw: 1080px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 14px;
}

[data-theme="dark"] {
  --paper:        #16150f;
  --paper-tint:   #1e1c15;
  --surface:      #201e17;
  --ink:          #ece7dc;
  --ink-soft:     #c4bdae;
  --muted:        #8f887a;
  --line:         #322f26;
  --accent:       #57bdb3;
  --accent-deep:  #7fd3ca;
  --seal:         #d1706b;
  --shadow:       0 1px 2px rgba(0, 0, 0, .3), 0 10px 40px rgba(0, 0, 0, .35);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1.02rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s ease, color .4s ease;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; line-height: 1.15; }

strong { font-weight: 600; color: var(--ink); }
em { color: var(--ink-soft); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.nav {
  max-width: var(--maxw); margin: 0 auto;
  padding: .85rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.nav__brand {
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600;
  color: var(--ink); letter-spacing: .01em; display: inline-flex; align-items: baseline; gap: .5rem;
}
.nav__brand:hover { color: var(--ink); }
.nav__brand-zh { font-family: var(--font-zh); font-size: .92rem; color: var(--muted); font-weight: 500; }

.nav__menu {
  list-style: none; display: flex; align-items: center; gap: 1.9rem;
  margin: 0; padding: 0;
}
.nav__menu a {
  color: var(--ink-soft); font-size: .93rem; font-weight: 500;
  position: relative; padding: .2rem 0;
}
.nav__menu a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width .28s ease;
}
.nav__menu a:hover, .nav__menu a.is-current { color: var(--ink); }
.nav__menu a.is-current::after { width: 100%; }
.nav__menu a.is-current { font-weight: 600; }

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  cursor: pointer; transition: color .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-12deg); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav__toggle { display: none; }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(2.5rem, 6vw, 4.5rem);
}
.hero__inner {
  display: grid; grid-template-columns: 1.55fr .9fr; gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
}
.hero__eyebrow {
  text-transform: uppercase; letter-spacing: .18em; font-size: .72rem;
  color: var(--accent); font-weight: 600; margin: 0 0 1.1rem;
}
.hero__name {
  font-size: clamp(2.6rem, 7vw, 4.3rem); margin: 0; letter-spacing: -.02em;
  font-weight: 500;
}
.hero__name-zh {
  font-family: var(--font-zh); font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--ink-soft); margin: .35rem 0 0; font-weight: 500;
}
/* 楷体 (regular script) for the Chinese name.
   Kaiti SC / STKaiti is 华文楷体 on macOS and iOS; KaiTi is the Windows equivalent.
   Both are system fonts that cannot be redistributed, so LXGW WenKai (OFL) is the
   webfont fallback — the browser fetches it only when no local 楷体 is present. */
.kai {
  font-family: var(--font-zh);
  font-size: 1.4em;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: .08em;
  line-height: 1.2;
  vertical-align: -.06em;
}
.hero__emoji { font-size: .85em; margin-left: .15em; vertical-align: .1em; }
.hero__role { font-size: 1.1rem; margin: 1.1rem 0 0; color: var(--ink-soft); }
.hero__lede {
  font-size: 1.12rem; margin: 1.4rem 0 0; max-width: 34em; color: var(--ink-soft);
  font-family: var(--font-serif); font-weight: 400; line-height: 1.6;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2rem 0 0; }
.btn {
  display: inline-block; padding: .72rem 1.4rem; border-radius: 999px;
  font-size: .92rem; font-weight: 600; letter-spacing: .01em;
  transition: transform .2s ease, background .2s ease, color .2s, border-color .2s, box-shadow .2s;
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { background: var(--accent-deep); color: #fff; transform: translateY(-2px); }
.btn--ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero__links {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.6rem;
  margin: 1.9rem 0 0; padding: 0;
}
.hero__links li { position: relative; }
.hero__links li + li::before {
  content: ""; position: absolute; left: -.85rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--muted);
}
.hero__links a { color: var(--ink-soft); font-size: .92rem; font-weight: 500; }
.hero__links a:hover { color: var(--accent); }

/* portrait */
.hero__portrait { display: flex; justify-content: center; }
.portrait {
  position: relative; width: min(280px, 64vw); aspect-ratio: 9 / 10;
  margin: 0; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  background: linear-gradient(150deg, var(--paper-tint), var(--surface));
  border: 1px solid var(--line);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- sections ---------- */
.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
}
.section--tint {
  max-width: none; background: var(--paper-tint);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
/* Center and gutter every direct child of a tinted band.
   !important guards against component rules (e.g. `.news { margin: 0 }`)
   overriding the centering margins. */
.section--tint > * {
  max-width: var(--maxw);
  margin-left: auto !important; margin-right: auto !important;
  padding-left: var(--gutter); padding-right: var(--gutter);
}

/* page header (used on the Research / Services / Miscellaneous pages) */
.page-head { margin-bottom: 2.5rem; }
.page-head__title {
  font-size: clamp(2.1rem, 5vw, 3rem); margin: 0 0 .6rem; letter-spacing: -.02em;
}
.page-head__title::after {
  content: ""; display: block; width: 42px; height: 3px; border-radius: 2px;
  background: var(--seal); margin-top: .8rem;
}
.page-head__lede {
  color: var(--ink-soft); max-width: 44em; margin: 0 0 1.3rem;
  font-family: var(--font-serif); font-size: 1.06rem; line-height: 1.6;
}

.section__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.section__title { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0; letter-spacing: -.01em; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem, 6vw, 4rem); }
.about__bio p { margin: 0 0 1.05rem; color: var(--ink-soft); }
.about__bio p:first-child { font-size: 1.08rem; }
.about__subtitle {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 2rem 0 .9rem; font-family: var(--font-sans); font-weight: 600;
}

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.3rem; align-items: center; }
.tag {
  display: inline-block; padding: .34rem .8rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .84rem; color: var(--ink-soft); font-weight: 500;
}
/* Group label sits on its own line so the pills below it all start at the left edge
   instead of the first row being indented past the label. */
.tag--head {
  flex: 0 0 100%; min-width: 0; margin-bottom: .15rem;
  background: transparent; border: none; color: var(--accent);
  font-weight: 600; padding-left: 0;
  text-transform: uppercase; font-size: .72rem; letter-spacing: .1em;
}
.tag__link { color: var(--accent); font-weight: 600; margin-left: .3rem; font-size: .78rem; }
.tag__link:hover { text-decoration: underline; }

.timeline__sub { color: var(--muted); font-size: .84rem; }

/* Distinctions worth calling out (fellowship, class rank).
   Reads as a highlighter mark inline in prose, and as a small badge in the timeline. */
.honor {
  display: inline-block;
  padding: .08rem .45rem;
  border-radius: 5px;
  background: color-mix(in srgb, var(--seal) 13%, transparent);
  color: var(--seal);
  font-weight: 600;
  font-size: .88em;
  line-height: 1.45;
  text-decoration: none;
}
.honor::before { content: "★"; margin-right: .32em; font-size: .82em; vertical-align: .04em; }
a.honor:hover {
  background: color-mix(in srgb, var(--seal) 24%, transparent);
  color: var(--seal);
}
/* in the timeline the badge sits on its own line — give it a little breathing room */
.timeline__what .honor { margin: .2rem 0 .15rem; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px;
  background: var(--line);
}
.timeline__item { position: relative; padding: 0 0 1.35rem 1.6rem; }
.timeline__item::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline__item--future::before { background: var(--accent); }
.timeline__date {
  display: block; font-size: .76rem; letter-spacing: .06em; color: var(--muted);
  font-weight: 600; margin-bottom: .1rem;
}
.timeline__what { font-size: .93rem; color: var(--ink-soft); }
.timeline__what strong { color: var(--ink); }

/* ---------- publications ---------- */
.profile-links { display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin: 0 0 .6rem; }
.profile-links a {
  font-size: .82rem; font-weight: 600; padding: .3rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  transition: color .2s, border-color .2s, transform .2s;
}
.profile-links a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.pub-legend { font-size: .82rem; color: var(--muted); margin: 0; }
.pub-legend sup { color: var(--seal); font-weight: 700; }

/* Counts down so the newest paper carries the highest number. Each <ol> sets its
   own starting value inline (counter-reset: pubnum <count+1>). */
.pubs--numbered { list-style: none; }
.pubs--numbered .pub { counter-increment: pubnum -1; }
.pubs--numbered .pub::before {
  content: counter(pubnum); position: absolute; left: -2.4rem; top: 1.15rem;
  font-family: var(--font-serif); font-size: .95rem; font-weight: 600;
  color: var(--muted); width: 1.7rem; text-align: right;
}
@media (min-width: 861px) { .pubs--numbered { padding-left: 2.4rem; } }

.pub__authors sup { color: var(--seal); font-weight: 700; }

/* One-paragraph plain-language summary of each paper */
.pub__tldr {
  margin: .75rem 0 .7rem; padding: .8rem 1rem;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: .92rem; color: var(--ink-soft); line-height: 1.6;
}
.pub__tldr-label {
  display: inline-block; margin-right: .5rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); vertical-align: .12em;
}
.pub__prevtitle { margin: 0 0 .5rem; font-size: .82rem; color: var(--muted); }
.pub__note { margin: 0 0 .3rem; font-size: .84rem; color: var(--ink-soft); }
.pub__award {
  margin: 0 0 .6rem; font-size: .84rem; color: var(--ink-soft);
  padding-left: 1.3rem; position: relative;
}
.pub__award::before {
  content: "★"; position: absolute; left: 0; top: 0; color: var(--seal); font-size: .85rem;
}

/* ---------- publications (base) ---------- */
.pub-group { margin-bottom: 2.6rem; }
.pub-group:last-child { margin-bottom: 0; }
.pub-group__title {
  font-size: 1.15rem; color: var(--ink); margin: 0 0 1.1rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem;
}
.pub-group__title::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--seal); transform: rotate(45deg);
}

.pubs { list-style: none; margin: 0; padding: 0; }
.pub {
  position: relative; padding: 1.1rem 1.2rem 1.1rem 1.3rem;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); margin-bottom: .85rem;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.pub:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pub__title { font-size: 1.08rem; margin: 0 0 .35rem; color: var(--ink); line-height: 1.3; }
.pub__authors { margin: 0 0 .2rem; font-size: .9rem; color: var(--ink-soft); }
.pub__venue { margin: 0 0 .6rem; font-size: .88rem; color: var(--muted); }
.pub__links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.pub__links a {
  font-size: .8rem; font-weight: 600; padding: .25rem .7rem;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--accent); transition: background .2s, color .2s;
}
.pub__links a:hover { background: var(--accent); color: #fff; }

/* ---------- services (full-width blocks, one per role) ---------- */
.svc { margin-bottom: 2.8rem; }
.svc:last-of-type { margin-bottom: 0; }
.svc__title {
  font-size: 1.3rem; margin: 0 0 1rem; color: var(--ink);
  padding-bottom: .55rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.svc__title::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: var(--seal); transform: rotate(45deg); flex: none;
}
/* Institution label, right-aligned in the heading row like the venue column below */
.svc__org {
  margin-left: auto; font-family: var(--font-sans); font-weight: 500;
  font-size: .82rem; color: var(--muted); letter-spacing: 0;
}
.svc__list { list-style: none; margin: 0; padding: 0; }
.svc__list > li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
  font-size: .96rem; color: var(--ink-soft);
}
.svc__list > li:last-child { border-bottom: none; }
.svc__what { flex: 1 1 22rem; color: var(--ink); }
.svc__where { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.eval { color: var(--accent); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.svc__list .eval {
  margin-left: auto; color: var(--accent); font-weight: 600; font-size: .88rem; white-space: nowrap;
}
.svc__list .eval--na { color: var(--muted); font-weight: 500; }
/* the reviewer list is just names — flow it into columns instead of one long strip */
.svc__list--cols { columns: 2; column-gap: 2.5rem; }
.svc__list--cols > li { break-inside: avoid; }
/* In two columns the final item sits at the foot of the RIGHT column, so the generic
   :last-child rule above would leave that column without a closing rule while the left
   column keeps one. Put it back so both columns end the same way. */
.svc__list--cols > li:last-child { border-bottom: 1px solid var(--line); }

/* ---------- miscellaneous ----------
   Prose keeps a readable measure; the photos for each topic sit together in one
   row so the page reads as two sections rather than a tall stack of images. */
.misc { margin-bottom: 1rem; }
.misc__heading { font-size: 1.25rem; margin: 0 0 .7rem; color: var(--ink); }
/* Text spans the same width as the photo row below it, so both edges line up.
   The paragraphs here are only a few lines, so the wider measure still reads fine. */
.misc__text { color: var(--ink-soft); margin: 0 0 1.5rem; font-size: 1rem; }
.misc__quote { margin-top: 1.6rem; }

.misc__grid { display: grid; gap: 1.1rem; }
.misc__grid--2 { grid-template-columns: repeat(2, 1fr); }
/* Mosaic: two stacked photos on the left, one tall photo spanning both rows on the right. */
.misc__grid--mosaic {
  grid-template-columns: 1fr 1.35fr;
  grid-template-rows: 1fr 1fr;
}
.misc__grid--mosaic .figure:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
.misc__grid--mosaic .figure:nth-child(3) a { height: 100%; }
.misc__grid--mosaic .figure:nth-child(3) img { height: 100%; aspect-ratio: auto; }

.misc__rule {
  margin: 2.8rem 0 2.6rem;
  border: none; border-top: 1px solid var(--line);
}

/* ---------- news ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news__item {
  position: relative; padding: 0 0 1.5rem 1.6rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.news__item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.news__item::before {
  content: ""; position: absolute; left: 0; top: .55rem;
  width: 8px; height: 8px; border-radius: 2px; background: var(--seal); transform: rotate(45deg);
}
.news__title { margin: 0 0 .5rem; font-family: var(--font-serif); font-size: 1.08rem; color: var(--ink); line-height: 1.35; }
.news__body { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.figure { margin: 0; }
.figure a { display: block; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.figure img {
  width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  transition: transform .5s ease;
}
.figure a:hover img { transform: scale(1.04); }
.figure figcaption {
  margin-top: .5rem; font-size: .82rem; color: var(--muted);
  text-align: center; font-family: var(--font-zh);
}
.figure figcaption em { font-family: var(--font-serif); }

/* quote */
.quote {
  margin: 1.4rem 0 0; padding: 1.2rem 1.4rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--seal); border-radius: var(--radius);
}
.quote blockquote {
  margin: 0; font-family: var(--font-serif); font-size: 1.02rem;
  line-height: 1.55; color: var(--ink); font-style: italic;
}
.quote--zh { margin-top: .9rem !important; font-family: var(--font-zh) !important; font-style: normal !important; font-size: .96rem !important; color: var(--ink-soft) !important; line-height: 1.7 !important; }
.quote figcaption { margin-top: .9rem; font-size: .86rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer {
  /* No top margin: the footer must sit flush against the preceding section, or a strip
     of the lighter page background shows between its border and a tinted section's. */
  border-top: 1px solid var(--line); background: var(--paper-tint);
}
.site-footer__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 3rem var(--gutter); text-align: center;
}
.site-footer__name { font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink); margin: 0 0 .3rem; }
.site-footer__contact { margin: 0 0 .3rem; }
.site-footer__contact a { font-weight: 600; }
.site-footer__meta { color: var(--muted); font-size: .88rem; margin: 0 0 1.2rem; }
.site-footer__copy { color: var(--muted); font-size: .8rem; margin: 0; }
.site-footer__copy::before { content: "© "; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 4vmin;
  background: rgba(20, 18, 14, .88);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
  cursor: zoom-out;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox figure { margin: 0; text-align: center; max-width: 100%; }
.lightbox img {
  max-width: 92vw; max-height: 82vh; width: auto; height: auto;
  border-radius: 10px; box-shadow: 0 20px 70px rgba(0,0,0,.5);
  transform: scale(.96); transition: transform .25s ease;
}
.lightbox.is-open img { transform: scale(1); }
.lightbox figcaption { margin-top: .9rem; color: #d8d2c6; font-size: .92rem; font-family: var(--font-zh); }
.lightbox__close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: #d8d2c6; font-size: 2rem;
  line-height: 1; cursor: pointer; padding: .3rem .6rem;
}
.lightbox__close:hover { color: #fff; }

/* ---------- print ---------- */
@media print {
  .site-header, .theme-toggle, .hero__actions, .site-footer__copy, .lightbox { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section--tint { background: #fff; border: none; }
  .pub, .news__item { break-inside: avoid; box-shadow: none; }
  a { color: #000; text-decoration: none; }
}

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; justify-content: flex-start; }
  .portrait { width: 150px; border-radius: 16px; }
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav__toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4.5px;
    width: 40px; height: 40px; border: none; background: none; cursor: pointer; padding: 8px;
  }
  .nav__toggle span { display: block; height: 2px; width: 22px; background: var(--ink); border-radius: 2px; transition: transform .3s, opacity .3s; }
  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .nav__menu {
    position: absolute; top: 100%; right: 0; left: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1.2rem;
    max-height: 0; overflow: hidden; transition: max-height .35s ease; box-shadow: var(--shadow);
  }
  .nav__menu.is-open { max-height: 340px; }
  .nav__menu li { width: 100%; }
  .nav__menu li a { display: block; padding: .8rem 0; width: 100%; }
  .nav__menu li:not(:last-child) a { border-bottom: 1px solid var(--line); }
  .theme-toggle { margin-top: .7rem; }
}

@media (max-width: 620px) {
  .svc__list--cols { columns: 1; }
  .svc__list--cols > li:last-child { border-bottom: none; }
  .svc__list .eval { margin-left: 0; }
}

@media (max-width: 700px) {
  /* narrow: drop the tall column, let all three sit in a simple 2-up grid */
  .misc__grid--mosaic { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .misc__grid--mosaic .figure:nth-child(3) { grid-column: span 2; grid-row: auto; }
  .misc__grid--mosaic .figure:nth-child(3) a { height: auto; }
  .misc__grid--mosaic .figure:nth-child(3) img { height: auto; aspect-ratio: 16 / 9; }
}
@media (max-width: 460px) {
  .misc__grid--2, .misc__grid--mosaic { grid-template-columns: 1fr; }
  .misc__grid--mosaic .figure:nth-child(3) { grid-column: auto; }
}
