/* ============================================================================
   V2 Home — Standalone academic homepage
   Own design system, independent from v3.
   Palette: deep navy + warm gold accent. Dense, journal-style layout.
   ============================================================================ */

/* ── Tokens ── */
:root {
  --v2-bg: #fafaf8;
  --v2-surface: #ffffff;
  --v2-ink: #1a1a2e;
  --v2-body: #3d3d50;
  --v2-muted: #7a7a8c;
  --v2-line: #e2e2e0;
  --v2-line-light: #eeeeec;
  --v2-accent: #a72126;
  --v2-accent-hover: #8c1b1f;
  --v2-accent-soft: rgba(167,33,38,0.06);
  --v2-navy: #0852a2;
  --v2-navy-light: #0a65c0;
  --v2-radius: 6px;
  --v2-font-sans: "Source Sans 3", "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --v2-font-serif: "Merriweather", "Source Serif 4", "Noto Serif SC", "Songti SC", Georgia, serif;
  --v2-font-body: "Source Serif 4", "Noto Serif SC", "Songti SC", Georgia, serif;
  --v2-max: 1120px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; touch-action: manipulation; -ms-touch-action: manipulation; }
body, body * { touch-action: manipulation; }
body.v2-body {
  margin: 0;
  font-family: var(--v2-font-sans);
  background: var(--v2-bg);
  color: var(--v2-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
p {
  orphans: 2;
  widows: 2;
  text-wrap: pretty;
}
img { max-width: 100%; height: auto; }
main { flex: 1; }
a { color: var(--v2-accent); transition: color 0.15s; }
a:hover { color: var(--v2-accent-hover); }
a[href^="mailto:"] { text-decoration: none; }
a[href^="mailto:"]:hover { text-decoration: none; }
a[href^="mailto:"] { text-decoration: none; }
a[href^="mailto:"]:hover { text-decoration: none; opacity: 0.8; }

/* ── Top Bar ── */
.v2-topbar {
  background: var(--v2-navy);
  position: sticky;
  top: 0;
  z-index: 100;
}
.v2-topbar__inner {
  max-width: var(--v2-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.v2-topbar__brand {
  font-family: var(--v2-font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.v2-topbar__brand:hover {
  color: #fff;
}
.v2-topbar__nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.v2-topbar__nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.v2-topbar__nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ── Mobile Nav Toggle ── */
.v2-topbar__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}
.v2-topbar__toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
@media (max-width: 640px) {
  .v2-topbar__toggle { display: flex; }
  .v2-topbar { position: sticky; }
  .v2-topbar__nav {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--v2-navy);
    flex-direction: column;
    padding: 0 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }
  .v2-topbar__nav.is-open { max-height: 500px; padding: 0.5rem 1.5rem 1rem; }
  .v2-topbar__nav a {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .v2-topbar__nav a:last-child { border-bottom: none; }
  .v2-topbar__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }
  .v2-topbar__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .v2-topbar__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }
}

/* ── Lab Header ── */
.v2-lab-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.5rem;
  padding: 1.5rem 0 1rem;
}
.v2-lab-header__name {
  font-family: var(--v2-font-serif);
  font-size: clamp(2rem, 1.6rem + 1.2vw, 2.8rem);
  font-weight: 900;
  color: var(--v2-ink);
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.v2-lab-header__logo {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.v2-lab-header__logo img { height: 44px; width: auto; }
@media (max-width: 600px) {
  .v2-lab-header { grid-template-columns: 1fr auto; gap: 0.5rem; }
  .v2-lab-header__name { font-size: 1.6rem; }
  .v2-lab-header__logo img { height: 28px; }
}

/* ── About: mission + PI ── */
.v2-about {
  padding: 1.5rem;
  margin-bottom: 0.5rem;
  background: var(--v2-surface);
  border: 1px solid var(--v2-navy);
  border-radius: 8px;
  overflow: hidden;
}
.v2-about__pi {
  float: right;
  text-align: center;
  margin: 0 0 0.8rem 1.5rem;
}
.v2-about__mission {
  font-family: var(--v2-font-body);
  font-variant-numeric: oldstyle-nums;
  font-size: 1.05rem;
  color: var(--v2-ink);
  line-height: 1.8;
  font-weight: 400;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}
.v2-about__mission p { margin: 0 0 0.7rem; }
.v2-about__mission p:last-child { margin-bottom: 0; }
.v2-about__mission strong { font-weight: 700; }
.v2-about__mission em { color: var(--v2-accent); font-style: italic; }
.v2-about__pi img {
  width: 130px;
  border-radius: 8px;
  border: 2px solid var(--v2-line);
  margin-bottom: 0.4rem;
}
.v2-about__pi-name {
  font-family: var(--v2-font-serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--v2-ink);
  margin: 0;
}
.v2-about__pi-title {
  font-family: var(--v2-font-body);
  font-size: 0.85rem;
  color: var(--v2-muted);
  margin: 0.1rem 0 0;
  line-height: 1.35;
}
@media (max-width: 640px) {
  .v2-about__pi { margin: 0 0 0.5rem 1rem; }
  .v2-about__pi img { width: 90px; }
  .v2-about__mission { text-align: left; }
}

/* ── Research Topic ── */
.v2-topic {
  padding: 1.3rem 0;
  overflow: hidden;
}

.v2-topic__header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.v2-topic__title {
  font-family: var(--v2-font-serif);
  font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.85rem);
  font-weight: 900;
  color: var(--v2-ink);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.v2-topic__figure {
  float: right;
  width: 300px;
  margin: 0 0 0.6rem 1.3rem;
  border-radius: var(--v2-radius);
  overflow: hidden;
  border: 1px solid var(--v2-line);
}
.v2-topic__figure img { display: block; width: 100%; }
@media (max-width: 640px) {
  .v2-topic__figure { float: none; width: 100%; margin: 0 0 0.8rem 0; }
}

.v2-topic__body {
  font-family: var(--v2-font-body);
  font-variant-numeric: oldstyle-nums;
  color: var(--v2-body);
  font-size: 0.95rem;
  line-height: 1.8;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}
.v2-topic__body ul {
  margin: 0;
  padding-left: 1.2rem;
}
.v2-topic__body ul li {
  margin-bottom: 0.5rem;
}
.v2-topic__body ul li:last-child { margin-bottom: 0; }
.v2-topic__body h3 {
  font-family: var(--v2-font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--v2-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--v2-accent);
  display: inline-block;
}
.v2-topic__body h3:first-child { margin-top: 0; }
.v2-topic__body p { margin: 0 0 0.7rem; }
.v2-topic__body p:last-child { margin-bottom: 0; }

.v2-readmore {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--v2-font-sans);
  color: var(--v2-accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.v2-readmore:hover { text-decoration: underline; }

/* Unified arrow CTA — SVG mask icon as ::after.
   vertical-align:middle aligns to baseline+½x-height (the Latin visual center).
   CJK fonts have no x-height; their visual center sits higher relative to baseline
   because ascent ≫ descent. CSS has no cross-script "ideographic-center" alignment,
   so :lang(zh) shifts the arrow up to match the CJK visual center. This is the
   same pattern as language-specific font-family — a font-metric reality, not a patch. */
.v2-readmore::after,
.v2-card__more::after,
.v2-dir-card a::after,
.bib-link::after {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.3em;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8h11M9 4l4 4-4 4' stroke='black' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8h11M9 4l4 4-4 4' stroke='black' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform 0.2s ease;
}
:lang(zh) .v2-readmore::after,
:lang(zh) .v2-card__more::after,
:lang(zh) .v2-dir-card a::after { vertical-align: 0.03em; }
@media (hover: hover) {
  .v2-readmore:hover::after,
  .bib-link:hover::after,
  .v2-dir-card a:hover::after,
  .v2-pi-card:hover .v2-card__more::after,
  .v2-member-card:hover .v2-card__more::after { transform: translateX(3px); }
}

/* ── Citations ── */
.v2-cite {
  color: var(--v2-accent);
  font-size: 0.88em;
  text-decoration: none;
  white-space: nowrap;
}
.v2-cite:hover { text-decoration: underline; }
.v2-cite em { font-style: italic; }

/* ── Research Directions Overview ── */
.v2-dir-overview {
  padding: 1.3rem 0 0;
  border-top: 3px solid var(--v2-accent);
  margin-top: 0.5rem;
}
.v2-dir-overview__title {
  font-family: var(--v2-font-serif);
  font-size: clamp(1.3rem, 1.15rem + 0.4vw, 1.6rem);
  font-weight: 900;
  color: var(--v2-ink);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.v2-dir-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
@media (max-width: 768px) { .v2-dir-grid { grid-template-columns: 1fr; } }
.v2-dir-card {
  padding: 1rem;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: var(--v2-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
@media (hover: hover) { .v2-dir-card:hover { border-color: var(--v2-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.05); } }
.v2-dir-card h3 { font-family: var(--v2-font-serif); font-size: 1.05rem; font-weight: 600; color: var(--v2-ink); margin: 0 0 0.25rem; }
.v2-dir-card p { font-family: var(--v2-font-body); font-size: 0.92rem; color: var(--v2-muted); line-height: 1.5; margin: 0 0 0.4rem; }
.v2-dir-card a { font-size: 0.92rem; font-weight: 600; text-decoration: none; }
.v2-dir-card a:hover { text-decoration: underline; }

/* ── Footer Info ── */
.v2-footer-info {
  padding: 1rem 0 0;
  margin-top: 1.2rem;
  border-top: 1px solid var(--v2-line);
  font-size: 0.88rem;
  color: var(--v2-muted);
  line-height: 1.6;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}
@media (max-width: 580px) { .v2-footer-info { flex-direction: column; gap: 0.3rem; } }

/* ── Site Footer ── */
.v2-site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  background: var(--v2-navy);
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  text-align: center;
}
.v2-site-footer__inner { max-width: var(--v2-max); margin: 0 auto; padding: 0 1.5rem; }
.v2-site-footer__logos {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.8rem;
}
.v2-site-footer__logos img { height: 36px; width: auto; opacity: 0.6; filter: brightness(0) invert(1); }
@media (max-width: 600px) {
  .v2-site-footer__logos { gap: 0.8rem; flex-wrap: wrap; }
  .v2-site-footer__logos img { height: 28px; }
}
.v2-site-footer p { margin: 0; }

/* ── Page Container ── */
.v2-home { max-width: var(--v2-max); margin: 0 auto; padding: 0 1.5rem 2rem; }

/* ── Back to Top ── */
.v2-back-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--v2-navy);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background 0.15s;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.v2-back-top.is-visible { opacity: 1; visibility: visible; }
.v2-back-top:hover { background: var(--v2-navy-light); }
@media (max-width: 640px) {
  .v2-back-top { bottom: 1.2rem; right: 1.2rem; width: 36px; height: 36px; font-size: 0.9rem; }
}

/* ── Clearfix ── */
.v2-clearfix::after { content: ""; display: table; clear: both; }

/* ── CJK Typography ── */
/* Serif (Noto Serif SC) for titles/headings; Sans (Noto Sans SC) for body */
:lang(zh) .v2-about__mission,
:lang(zh) .v2-topic__body,
:lang(zh) .v2-footer-info {
  text-align: justify;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.9;
}
:lang(zh) .v2-about__mission > p,
:lang(zh) .v2-topic__body > p {
  text-indent: 2em;
}
:lang(zh) .v2-topic__title,
:lang(zh) .v2-dir-overview__title {
  font-family: "Noto Serif SC", "Songti SC", STSong, serif;
  letter-spacing: 0.02em;
  font-weight: 700;
}
:lang(zh) .v2-dir-card h3 {
  font-family: "Noto Serif SC", "Songti SC", STSong, serif;
  font-weight: 700;
}
:lang(zh) .v2-dir-card p,
:lang(zh) .v2-about__pi-title {
  letter-spacing: 0.02em;
}
:lang(zh) .v2-about__pi-name {
  font-family: "Noto Serif SC", "Songti SC", STSong, serif;
  font-weight: 700;
}
:lang(zh) .v2-site-footer p {
  letter-spacing: 0.02em;
}
/* Chinese spacing: more breathing room between sections and list items */
:lang(zh) .v2-topic {
  padding: 1.8rem 0;
}
:lang(zh) .v2-topic + .v2-topic {
  border-top: 1px solid var(--v2-line);
}
:lang(zh) .v2-topic__body ul li {
  margin-bottom: 0.75rem;
  line-height: 1.85;
}
:lang(zh) .v2-dir-overview {
  margin-top: 1rem;
  padding-top: 1.8rem;
}
:lang(zh) .v2-dir-grid {
  gap: 1rem;
}
:lang(zh) .v2-dir-card {
  padding: 1.2rem;
}
:lang(zh) .v2-dir-card p {
  line-height: 1.65;
}
@media (max-width: 640px) {
  /* English: left-align on mobile to avoid large word gaps */
  :lang(en) .v2-about__mission,
  :lang(en) .v2-topic__body {
    text-align: left;
  }
  /* Chinese: keep justify — CJK characters justify well at any width */
  :lang(zh) .v2-about__mission { text-align: justify; }
}
