/* =============================================================
   Peiwen (Lucas) Zhou — Academic Homepage
   -------------------------------------------------------------
   COLOR THEME SWITCH:
   Change the data-theme value on the <html> tag to re-skin the
   whole site. Three palettes are provided:
        data-theme="green"   (default — deep green)
        data-theme="red"     (deep red)
        data-theme="blue"    (deep blue)
   ============================================================= */

/* =============================================================
   Self-hosted Chinese serif (Noto Serif SC), two-stage loading:
   1) A small "common" subset (~3,800 everyday characters, GB2312
      level-1) loads fast and covers virtually all text.
   2) The full library (variable font, all ~31k glyphs) is fetched
      ONLY if a rare character outside the common set appears.
   Bundled in the repo so mainland-China visitors (who cannot reach
   Google Fonts) get the song typeface. Latin text uses Georgia, so
   these files only download when Chinese is actually displayed.
   ============================================================= */
@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/NotoSerifSC-common-400.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/NotoSerifSC-common-700.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Serif SC Full";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/NotoSerifSC.woff2") format("woff2");
}

/* ---- Green (default) ---- */
:root,
[data-theme="green"] {
  --accent:        #2f5d4f;
  --accent-strong: #234a3f;
  --accent-tint:   #e9f0ec;
  --accent-tint-2: #dbe7e1;
  --bg:            #fbfaf6;
  --surface:       #ffffff;
  --text:          #1d211f;
  --muted:         #606b65;
  --faint:         #8a938e;
  --border:        #e7e3d9;
  --border-strong: #d8d3c6;
}

/* ---- Red ---- */
[data-theme="red"] {
  --accent:        #9a3232;
  --accent-strong: #7d2727;
  --accent-tint:   #f4e9e7;
  --accent-tint-2: #ecdad7;
  --bg:            #fbf8f6;
  --surface:       #ffffff;
  --text:          #211d1d;
  --muted:         #6b605f;
  --faint:         #938a89;
  --border:        #e8e0dc;
  --border-strong: #dccfca;
}

/* ---- Blue ---- */
[data-theme="blue"] {
  --accent:        #2a4a72;
  --accent-strong: #1f3a5c;
  --accent-tint:   #e8eef5;
  --accent-tint-2: #d8e2ee;
  --bg:            #f8fafb;
  --surface:       #ffffff;
  --text:          #1c2027;
  --muted:         #5d6671;
  --faint:         #88909b;
  --border:        #e2e6ea;
  --border-strong: #d0d6dd;
}

/* ============================================================= */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Georgia renders Latin in both languages; CJK uses the small common
     subset first, then the full self-hosted library for rare glyphs,
     then any local song serif. */
  font-family: Georgia, "Noto Serif SC", "Noto Serif SC Full", "Source Han Serif SC", "Songti SC", "SimSun", "宋体", serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img { display: block; max-width: 100%; }

/* ---------------- Top navigation ---------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav__brand {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  margin-right: auto;
  white-space: nowrap;
}
.nav__brand a { color: var(--text); }
.nav__brand a:hover { color: var(--accent); }

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav__link {
  position: relative;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color .18s, background .18s;
}
.nav__link:hover { color: var(--text); background: var(--accent-tint); }
.nav__link.is-active { color: var(--accent); }
.nav__link--caps {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.74rem;
}
/* Chinese nav labels: drop uppercase letter-spacing for a clean song look */
html[lang="zh"] .nav__link--caps {
  text-transform: none;
  letter-spacing: 0.06em;
  font-size: 0.84rem;
}

/* Full vs. short nav labels — short forms (CV, Pub) show on narrow screens */
.nav__link .lbl-short { display: none; }

/* Nav "Personal" dropdown */
.nav__dropdown { position: relative; display: flex; align-items: center; }
.nav__dropbtn { font-family: inherit; background: transparent; border: 0; cursor: pointer; }
.nav__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 168px;
  display: none;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 44px -18px rgba(20, 30, 25, .4);
}
.nav__menu::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}
.nav__dropdown.is-open .nav__menu { display: flex; }
@media (hover: hover) {
  .nav__dropdown:hover .nav__menu { display: flex; }
}
.nav__menu-item {
  font-family: inherit;
  text-align: left;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav__menu-item:hover { background: var(--accent-tint); color: var(--text); }
.nav__menu-item.is-active { color: var(--accent); }

.lang-toggle {
  margin-left: 10px;
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}
.lang-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 5px 10px;
  color: var(--muted);
  transition: background .18s, color .18s;
}
.lang-seg.is-active {
  background: var(--accent);
  color: #fff;
}

/* ---------------- Layout shell ---------------- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 104px 32px 96px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 56px;
  align-items: start;
}

/* ---------------- Left sidebar ---------------- */
.side { position: sticky; top: 104px; }

.portrait-wrap {
  position: relative;
  width: 64%;
  line-height: 0;
}
.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 16px 36px -24px rgba(20,30,25,.35);
}
.portrait-date {
  position: absolute;
  right: 9px;
  bottom: 8px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
}
.side__name {
  font-size: 1.62rem;
  line-height: 1.18;
  font-weight: 700;
  margin: 50px 0 2px;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3em;
}
html[lang="zh"] .side__name { gap: 0; }

/* Given/surname split — English shows given+surname, Chinese surname+given */
.nm-given { order: 1; }
.nm-sur { order: 2; }
html[lang="zh"] .nm-given { order: 2; }
html[lang="zh"] .nm-sur { order: 1; }
.nav__brand a { display: inline-flex; gap: 0.28em; }
html[lang="zh"] .nav__brand a { gap: 0; }
.side__name-sub {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 16px;
}
.side__role {
  font-size: 0.96rem;
  color: var(--text);
}
.side__affil {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 1px;
}
.side__college {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 1px;
}
/* Chinese folds the college into the university name, so hide this line */
html[lang="zh"] .side__college { display: none; }
.side__affil-addr {
  font-size: 0.82rem;
  color: var(--faint);
  margin-top: 1.1em;
}

.side__rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.side__contact {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.9rem;
}
.side__contact li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.side__contact .ico {
  width: 17px; height: 17px;
  flex: none;
  color: var(--accent);
}
.email-text { color: var(--text); }

.side__social {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.side__social a {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  transition: all .18s;
}
.side__social a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.side__social svg { width: 19px; height: 19px; }

/* Color theme swatches (palette card) */
.palette { margin-top: 22px; }
.palette__hint {
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--faint);
  margin: 0 0 9px;
}
.palette__set {
  display: flex;
  gap: 10px;
}
.swatch {
  flex: 1;
  display: flex;
  height: 15px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  transition: transform .15s;
}
.swatch span { flex: 1; display: block; }
.swatch:hover { transform: translateY(-1px); }

/* ---------------- Right content ---------------- */
.main { min-width: 0; }

.section { scroll-margin-top: 92px; }
.section + .section { margin-top: 52px; }

.section__title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 4px;
}
.section__title-zh { /* applied via JS when lang=zh for non-caps look */ }
.section__rule {
  border: 0;
  border-top: 2px solid var(--accent);
  width: 38px;
  margin: 0 0 22px;
}

.lede {
  font-size: 1.08rem;
  line-height: 1.78;
  color: var(--text);
}
.lede p { margin: 0 0 1em; }
.lede p:last-child { margin-bottom: 0; }

/* CV blocks */
.cv-group + .cv-group { margin-top: 34px; }
.cv-group__head {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--accent);
  font-variant: small-caps;
  letter-spacing: 0.02em;
  margin: 0 0 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
/* Chinese headings: small-caps doesn't apply to CJK, keep them clean */
html[lang="zh"] .cv-group__head { font-variant: normal; }
.cv-group__head::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
  transform: translateY(-4px);
}

.entry {
  position: relative;
  padding: 0 0 0 20px;
  margin-bottom: 20px;
}
.entry:last-child { margin-bottom: 0; }
.entry::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.entry__line1 { font-weight: 700; font-size: 1.02rem; }
.entry__line2 { color: var(--text); font-size: 0.96rem; }
.entry__addr { color: var(--faint); font-size: 0.82rem; }
.entry__line3 { color: var(--muted); font-size: 0.9rem; }
.entry__meta { color: var(--faint); font-size: 0.85rem; font-style: italic; }
.award-authors .me { color: var(--accent); font-weight: 700; }

/* Publications */
.pub {
  border-left: 2px solid var(--accent-tint-2);
  padding: 2px 0 2px 18px;
  margin-bottom: 18px;
}
.pub__title { font-weight: 700; font-size: 1.02rem; }
.pub__venue { color: var(--muted); font-size: 0.92rem; font-style: italic; }
.pub__authors { color: var(--text); font-size: 0.92rem; }
.pub__authors .me { color: var(--accent); font-weight: 700; }
.pub__doi { margin-top: 4px; font-size: 0.86rem; }
.pub__doi a { font-style: italic; }

.empty-note {
  color: var(--faint);
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 6px;
}

/* Skills pills */
.skill-block + .skill-block { margin-top: 20px; }
.skill-block__label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: 0.86rem;
  background: var(--accent-tint);
  color: var(--accent-strong);
  border: 1px solid var(--accent-tint-2);
  padding: 5px 13px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill--wide { white-space: normal; }

/* Friend links */
.links {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  /* Two columns when wide; collapses to one when the window is narrow
     (or on mobile), since each track needs at least 300px. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px 24px;
}
.link-entry {
  position: relative;
  padding-left: 20px;
}
.link-entry::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.link-entry__name {
  display: block;
  font-weight: 700;
  font-size: 1.02rem;
}
.link-entry__alias {
  display: block;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
}
.link-entry__affil {
  display: block;
  color: var(--faint);
  font-size: 0.85rem;
}

/* ---------------- Footer ---------------- */
.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* =============================================================
   GALLERY
   ============================================================= */
.gallery-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 104px 24px 96px;
}
.gallery-head { margin-bottom: 40px; }
.gallery-head h1 {
  font-size: 2rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.gallery-head p { color: var(--muted); margin: 0; }

/* Sticky year selector — jumps to the year and highlights as you scroll */
.year-nav {
  position: sticky;
  top: 64px;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 30px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.year-chip {
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 5px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background .18s, color .18s, border-color .18s;
}
.year-chip:hover { color: var(--text); background: var(--accent-tint); }
.year-chip.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Year marker on the timeline */
.year-divider {
  position: relative;
  padding-left: 38px;
  margin: 0 0 24px;
  scroll-margin-top: 128px;
}
.year-divider span {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.year-divider::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}

.feed { position: relative; }
.feed::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}

.post {
  position: relative;
  padding-left: 38px;
  margin-bottom: 38px;
}
.post::before {
  content: "";
  position: absolute;
  left: 1px; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
}
.post__date {
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.post__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 30px -26px rgba(20,30,25,.4);
}
.post__media {
  width: 100%;
  background: var(--accent-tint);
}
.post__media img {
  display: block;
  width: 100%;
  height: auto;
}
/* Portrait entries: shrink the whole card so the photo still fills it */
.post--portrait .post__card { max-width: 70%; }
.post__media--ph {
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(45deg,
      var(--accent-tint) 0 12px,
      var(--accent-tint-2) 12px 24px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.post__media--ph span {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  padding: 4px 10px;
  border-radius: 4px;
}
.post__body { padding: 16px 18px 18px; }
.post--text .post__body { padding: 18px; }
.post__text { font-size: 1.02rem; line-height: 1.7; margin: 0 0 10px; }
.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.84rem;
  color: var(--muted);
}
.post__meta .loc { display: inline-flex; align-items: center; gap: 5px; }
.post__meta .ico { width: 14px; height: 14px; color: var(--accent); }

/* ---------------- Language visibility helper ---------------- */
[data-i18n] { /* swapped by JS */ }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    gap: 38px;
    padding: 92px 22px 72px;
  }
  .side { position: static; text-align: center; }
  .portrait-wrap { max-width: 260px; margin-left: auto; margin-right: auto; }
  .side__contact li { justify-content: center; }
  .side__social { justify-content: center; }
  .side__name { font-size: 1.5rem; justify-content: center; }
  .nav__inner { padding: 0 18px; gap: 2px; }
  .nav__brand { font-size: 0.92rem; }
  .nav__links { gap: 0; }
  .nav__link { padding: 8px 11px; font-size: 0.82rem; }
  .nav__link--caps { font-size: 0.74rem; letter-spacing: 0.1em; }
  .nav__link .lbl-full { display: none; }
  .nav__link .lbl-short { display: inline; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .nav__inner { height: 56px; }
  .nav__brand { display: none; }
  .nav__links { gap: 2px; }
  .nav__link { padding: 7px 7px; }
  .lang-toggle { margin-left: auto; }
  .shell { padding: 80px 18px 64px; }
  .gallery-wrap { padding: 84px 18px 72px; }
  .year-nav { top: 56px; }
  .year-divider { scroll-margin-top: 116px; }
  .portrait-wrap { max-width: 100%; }
}

/* =============================================================
   SCORE MODALS — click a result to see the breakdown
   ============================================================= */
.modal-trigger { cursor: pointer; transition: color .15s ease; }
.modal-trigger:hover { color: var(--accent); }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.is-open { display: flex; }
body.modal-open { overflow: hidden; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 34px 28px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}

.modal__close {
  position: absolute;
  top: 9px; right: 9px;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  transition: background .18s, color .18s;
}
.modal__close:hover { background: var(--accent-tint); color: var(--text); }

.modal__title {
  color: var(--accent);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 32px 14px 0;
}

.score-list { margin: 0; }
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: 0; }
.score-row dt { margin: 0; color: var(--muted); }
.score-row dd { margin: 0; font-weight: 700; color: var(--text); }
.score-row--total dt,
.score-row--total dd { color: var(--accent); }

/* Schedule modal — a small accent-coloured timeline */
.modal__dialog--wide { max-width: 384px; }
.sched { list-style: none; margin: 2px 0 0; padding: 0; }
.sched__item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--accent-tint-2);
}
.sched__item:last-child { padding-bottom: 2px; }
.sched__item::before {
  content: "";
  position: absolute;
  left: -6px; top: 3px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.sched__date {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  margin-bottom: 3px;
}
.sched__desc {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
}
/* expired items (1–6 days past): dimmed grey */
.sched__item--expired { opacity: 0.5; }
.sched__item--expired::before { background: var(--muted); }
.sched__item--expired .sched__date { color: var(--muted); }
.sched__item--expired .sched__desc { color: var(--muted); }
.sched__empty {
  border-left: 0;
  padding-left: 0;
  color: var(--faint);
  font-style: italic;
}
.sched__empty::before { display: none; }

/* Language-variety list (Chinese modal) */
.lang-list { list-style: none; margin: 2px 0 0; padding: 0; }
.lang-list li {
  position: relative;
  padding: 8px 0 8px 18px;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.lang-list li:last-child { border-bottom: 0; }
.lang-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* =============================================================
   PRIVACY ("Hide") MODE — a footer toggle blurs identifying details
   while leaving headings, the photo, icons, swatches, skills, the
   surname and the nav intact.
   ============================================================= */
.hide-btn {
  margin-left: auto;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color .18s;
}
.hide-btn:hover { color: var(--accent); }
.hide-btn__on { display: none; }
body.privacy .hide-btn__off { display: none; }
body.privacy .hide-btn__on { display: inline; }

/* Smooth the blur transition both ways */
.lede, .entry, .pub, .empty-note, .link-entry,
.side__name-sub, .side__role, .side__college, .side__affil,
.side__affil-addr, .email-text, .foot__copy, .orcid-tail,
.side__name .nm-given { transition: filter .25s ease; }

body.privacy .lede,
body.privacy .entry,
body.privacy .pub,
body.privacy .empty-note,
body.privacy .link-entry,
body.privacy .side__name-sub,
body.privacy .side__role,
body.privacy .side__college,
body.privacy .side__affil,
body.privacy .side__affil-addr,
body.privacy .email-text,
body.privacy .foot__copy,
body.privacy .orcid-tail {
  filter: blur(5px);
}
/* The name is larger type, so it needs a slightly stronger blur */
body.privacy .side__name .nm-given {
  filter: blur(6px);
}
body.privacy .nav__brand .nm-given { display: none; }

/* =============================================================
   EASTER EGGS — formula rain (click a heading) & idle orbit
   ============================================================= */
.formula-rain {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  overflow: hidden;
}
.formula-rain span {
  position: absolute;
  top: 0;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  opacity: 0;
  will-change: transform, opacity;
  animation-name: formula-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes formula-fall {
  0%   { transform: translateY(-12vh) rotate(0deg); opacity: 0; }
  12%  { opacity: .85; }
  88%  { opacity: .85; }
  100% { transform: translateY(112vh) rotate(var(--rot, 180deg)); opacity: 0; }
}


/* =============================================================
   GALLERY: hover tilt, lightbox, end-of-feed note
   ============================================================= */
.post__card { transition: transform .18s ease, box-shadow .18s ease; }
.post__card:hover { box-shadow: 0 20px 44px -24px rgba(20,30,25,.55); }

/* End-of-feed note (revealed on scroll) */
.feed-end {
  position: relative;
  padding-left: 38px;
  margin-top: 4px;
  color: var(--faint);
  font-style: italic;
  font-size: 0.92rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s ease, transform .8s ease;
}
.feed-end.is-visible { opacity: 1; transform: none; }
.feed-end::before {
  content: "";
  position: absolute;
  left: 2px; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--bg);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 14, .82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox__fig {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lightbox__img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .6);
  object-fit: contain;
}
.lightbox__cap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px 16px;
  color: rgba(255, 255, 255, .92);
  font-size: 0.9rem;
  letter-spacing: .02em;
}
.lightbox__count { color: rgba(255, 255, 255, .55); font-size: 0.82rem; }
.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background .18s;
}
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, .28); }
.lightbox__close { top: 16px; right: 18px; width: 40px; height: 40px; font-size: 1.6rem; line-height: 1; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 2rem; line-height: 1; }
.lightbox__nav--prev { left: 14px; }
.lightbox__nav--next { right: 14px; }
@media (max-width: 600px) {
  .lightbox__nav { width: 38px; height: 38px; font-size: 1.5rem; }
  .lightbox__nav--prev { left: 6px; }
  .lightbox__nav--next { right: 6px; }
  .lightbox__close { top: 10px; right: 10px; }
}

/* =============================================================
   TRAVELS MAP MODAL
   ============================================================= */
.modal__dialog--map { max-width: 760px; max-height: 90vh; overflow-y: auto; }
.map-stage-wrap { position: relative; }
.map-note {
  position: absolute;
  right: 6px;
  bottom: 4px;
  margin: 0;
  max-width: 52%;
  text-align: right;
  font-size: 0.62rem;
  line-height: 1.3;
  color: var(--muted);
}
.map-panel[data-panel="usa"] .map-note {
  position: static;
  max-width: none;
  margin-top: 6px;
}

.map-tabs { display: flex; gap: 6px; margin: 2px 0 14px; }
.map-tab {
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.map-tab:hover { background: var(--accent-tint); color: var(--text); }
.map-tab.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.map-stage { margin-bottom: 14px; min-height: 40px; }
.travel-map { width: 100%; height: auto; display: block; }
.travel-map .rg {
  fill: var(--accent-tint-2);
  stroke: var(--surface);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
}
.travel-map .rg--lived { fill: var(--accent-strong); }
.travel-map .rg--travel { fill: var(--accent); }
.travel-map .rg--pass { fill: color-mix(in srgb, var(--accent) 42%, var(--accent-tint)); }
.travel-map .rg--sea-line {
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.map-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.map-legend .lg-head { display: flex; align-items: center; gap: 8px; }
.map-legend b { color: var(--text); font-weight: 700; font-size: 0.9rem; }
.map-legend .lg-names { color: var(--muted); font-size: 0.85rem; line-height: 1.5; padding-left: 20px; margin-top: 1px; }
.lg-sw { width: 13px; height: 13px; border-radius: 3px; flex: none; }
.lg-sw--lived { background: var(--accent-strong); }
.lg-sw--travel { background: var(--accent); }
.lg-sw--pass { background: color-mix(in srgb, var(--accent) 42%, var(--accent-tint)); }

@media (max-width: 600px) {
  .modal__dialog--map { max-width: 94vw; }
}

/* =============================================================
   CITIES PAGE — province selector + prefecture/district maps
   ============================================================= */
.cities-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 104px 24px 96px;
}
.prov-nav {
  position: sticky;
  top: 64px;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 26px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.prov-btn {
  font-family: inherit;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.prov-btn:hover { color: var(--text); background: var(--accent-tint); }
.prov-btn.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
.prov-panel .map-stage { display: flex; justify-content: center; margin-bottom: 18px; }
.prov-panel .travel-map { max-height: 66vh; }
.prov-panel .map-legend { max-width: 560px; margin: 0 auto; }

@media (max-width: 600px) {
  .cities-wrap { padding: 84px 18px 72px; }
  .prov-nav { top: 56px; }
}

/* CV "coming soon" modal note */
.cv-note { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
