/* ============================================================
   刘氏家族族谱 · 全局样式 v3.0（现代升级版）
   Design System: 古典底蕴 + 现代交互
   ============================================================ */

/* ===== CSS Variables ===== */
:root {
  /* Brand Colors — 赭石国风暖色系 */
  --red:       #8b3a2f;
  --red-dark:  #6d2a1f;
  --red-light: #faf5f0;
  --red-mid:   #e8ddd0;
  --gold:      #9b4d2c;
  --gold-light:#faf6f1;
  --gold-mid:  #d4a574;

  /* Ink System */
  --ink:       #1a1612;
  --ink-2:     #4a3f35;
  --ink-3:     #7a6e62;
  --ink-4:     #a89b8d;

  /* Surface */
  --bg:        #faf7f2;
  --bg-2:      #f3ede4;
  --bg-3:      #ebe4d9;
  --white:     #ffffff;
  --border:    #e5ddd2;
  --border-2:  #d4cbc0;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,22,18,.06);
  --shadow:     0 2px 12px rgba(26,22,18,.08);
  --shadow-md:  0 4px 24px rgba(26,22,18,.10);
  --shadow-lg:  0 8px 40px rgba(26,22,18,.12);
  --shadow-xl:  0 16px 60px rgba(26,22,18,.14);

  /* Radius */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Typography */
  --font:       "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Serif SC",serif;
  --font-mono:  "SF Mono","Fira Code","Courier New",monospace;
  --nav-h:      64px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: .15s var(--ease);
  --norm: .25s var(--ease);
  --slow: .4s var(--ease);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle paper texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(155,77,44,.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,58,47,.03) 0%, transparent 50%);
  pointer-events: none; z-index: -1;
}

a { color: var(--red); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--red-dark); }
img { max-width: 100%; height: auto; }

::selection { background: var(--red-mid); color: var(--ink); }

/* ===== Typography ===== */
h1, h2, h3, h4 { line-height: 1.35; letter-spacing: .02em; }
p + p { margin-top: .6em; }

/* ===== NAVIGATION (Glass Morphism) ===== */
.site-nav {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(44,24,16,.94);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 2px 16px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.04) inset;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 16px; font-weight: 700;
  letter-spacing: 2px; flex-shrink: 0;
}
.nav-seal {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(139,58,47,.4);
}
.nav-links {
  display: flex; gap: 1px;
  align-items: center;
}
/* Nav group separators — subtle left border to group related items */
.nav-links a.nav-sep {
  margin-left: 6px;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,.1);
}
.nav-links a {
  color: rgba(255,255,255,.6);
  padding: 6px 11px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  letter-spacing: .3px;
  transition: all .2s ease;
  white-space: nowrap;
}
.nav-links a:hover {
  color: rgba(255,255,255,.95);
  background: rgba(139,58,47,.18);
  text-decoration: none;
}
.nav-links a.active {
  color: #fff;
  background: rgba(139,58,47,.5);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(139,58,47,.25), inset 0 1px 0 rgba(255,255,255,.08);
}

/* Mobile Hamburger */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: none; background: transparent;
  cursor: pointer; flex-direction: column;
  gap: 5.5px; align-items: center; justify-content: center;
  padding: 8px; border-radius: var(--radius-sm);
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { background: rgba(255,255,255,.08); }
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: all .25s ease;
}
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5.5px, 5.5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5.5px, -5.5px); }

/* ===== HERO SECTION ===== */
.hero {
  position: relative; overflow: hidden;
  color: #fff; text-align: center;
  padding: 90px 24px 72px;
  background:
    linear-gradient(135deg, #2c1810 0%, #3d2015 30%, #4a2818 70%, #3d1a10 100%);
}
/* Decorative pattern overlay */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 15% 30%, rgba(139,58,47,.15) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(155,77,44,.10) 0%, transparent 40%);
  pointer-events: none;
}
/* Giant watermark character */
.hero::after {
  content: "劉";
  position: absolute; right: -30px; top: -50px;
  font-size: 380px; font-weight: 900;
  color: rgba(255,255,255,.028);
  pointer-events: none; user-select: none;
  line-height: 1;
  font-family: "STKaiti","KaiTi","SimSun",serif;
}
.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px 16px; border-radius: var(--radius-full);
  margin-bottom: 20px; letter-spacing: 2.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 12px rgba(139,58,47,.3);
}
.hero h1 {
  font-size: 46px; font-weight: 800;
  letter-spacing: 6px; margin-bottom: 14px;
  text-shadow: 0 2px 20px rgba(0,0,0,.3);
  position: relative; z-index: 1;
}
.hero p {
  font-size: 15.5px; color: rgba(255,255,255,.62);
  max-width: 520px; margin: 0 auto 36px;
  line-height: 1.8;
  position: relative; z-index: 1;
}
.hero-stats {
  display: flex; gap: 44px; justify-content: center; flex-wrap: wrap;
  position: relative; z-index: 1;
}
.hero-stat .num {
  font-size: 34px; font-weight: 800;
  background: linear-gradient(135deg, var(--gold-mid), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-stat .lbl {
  font-size: 12px; color: rgba(255,255,255,.48);
  margin-top: 3px; letter-spacing: 1px;
}

/* ===== CONTAINER ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.container-lg { max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* ===== SECTIONS ===== */
.section { padding: 64px 0; }
.section-alt {
  background: var(--bg-2);
  position: relative;
}
.section-alt::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.section-header {
  text-align: center; margin-bottom: 44px;
}
.section-header .eyebrow {
  font-size: 11px; letter-spacing: 3px;
  color: var(--red); text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 600;
  display: inline-block;
  padding: 3px 12px;
  background: var(--red-light);
  border-radius: var(--radius-full);
}
.section-header h2 {
  font-size: 28px; font-weight: 800; color: var(--ink);
  margin-bottom: 10px;
}
.section-header p {
  font-size: 14.5px; color: var(--ink-3);
  max-width: 580px; margin: 0 auto;
  line-height: 1.7;
}

/* ===== CARDS ===== */
.card-grid {
  display: grid; gap: 18px;
}
.card-grid-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: all var(--norm);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  opacity: 0;
  transition: opacity var(--norm);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--border-2);
}
.card:hover::before { opacity: 1; }
.card-icon {
  font-size: 32px; margin-bottom: 12px;
  display: inline-block;
  filter: grayscale(.15);
}
.card h3 {
  font-size: 16px; font-weight: 700; color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.4;
}
.card p {
  font-size: 13.5px; color: var(--ink-2);
  line-height: 1.7;
}

/* ===== TAGS ===== */
.tag {
  display: inline-block; font-size: 11px; font-weight: 500;
  padding: 3px 10px; border-radius: var(--radius-full);
  margin: 3px 4px 3px 0; border: 1px solid;
  transition: all var(--fast);
}
.tag-red   { background: var(--red-light); color: var(--red);   border-color: var(--red-mid); }
.tag-gold  { background: var(--gold-light); color: var(--gold); border-color: var(--gold-mid); }
.tag-gray  { background: var(--bg-3); color: var(--ink-2); border-color: var(--border); }
.tag-green { background: #eef5ee; color: #3a7a4a; border-color: #a8cfa8; }
.tag-blue  { background: #eef0f4; color: #4a6a8a; border-color: #b0bfcf; }
.tag-pink  { background: #faf5f0; color: #8b3a2f; border-color: #d4a574; }
.tag-purple{ background: #f0ecf4; color: #7b5ea7; border-color: #c0b0d0; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 28px; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--norm);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  border-radius: 3px 3px 0 0;
  opacity: 0;
  transition: opacity var(--norm);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-card:hover::after { opacity: 1; }
.stat-card .num {
  font-size: 36px; font-weight: 800;
  color: var(--red);
  line-height: 1.1;
}
.stat-card .lbl {
  font-size: 12px; color: var(--ink-3);
  margin-top: 6px; letter-spacing: .5px;
}

/* ===== PERSON CARD ===== */
.person-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 16px;
  align-items: flex-start;
  transition: all var(--norm);
  position: relative;
  overflow: hidden;
}
.person-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  opacity: 0;
  transition: opacity var(--norm);
}
.person-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-2);
}
.person-card:hover::before { opacity: 1; }
.avatar {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.av-red  { background: linear-gradient(135deg,#e8ddd0,#d4a574); color: var(--red-dark); }
.av-gold { background: linear-gradient(135deg,#d4a574,#c0904a); color: #5a3010; }
.av-blue { background: linear-gradient(135deg,#c0cdd8,#a0b0c0); color: #3a5068; }
.av-green{ background: linear-gradient(135deg,#c0d4c0,#a0c0a0); color: #2a5a30; }
.av-pink { background: linear-gradient(135deg,#e8d8d0,#d4a574); color: #7a3a20; }
.av-purple{ background: linear-gradient(135deg,#d0c8d8,#b8a8c8); color: #5b3a6a; }

.person-card .name { font-size: 16px; font-weight: 700; color: var(--ink); }
.person-card .meta { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 8px; }
.person-card .desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }

/* ===== TIMELINE ===== */
.timeline {
  position: relative; padding-left: 36px;
}
.timeline::before {
  content: ''; position: absolute;
  left: 12px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--red), var(--gold), var(--border));
  border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 28px; }
.tl-dot {
  position: absolute; left: -29px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
  transition: all var(--fast);
  z-index: 1;
}
.tl-item:hover .tl-dot {
  transform: scale(1.25);
  box-shadow: 0 0 0 4px var(--red-mid), 0 0 12px rgba(139,58,47,.2);
}
.tl-year {
  font-size: 12px; font-weight: 700;
  color: var(--red); margin-bottom: 4px;
  letter-spacing: .5px;
}
.tl-title {
  font-size: 16px; font-weight: 700;
  color: var(--ink); margin-bottom: 5px;
}
.tl-body {
  font-size: 13.5px; color: var(--ink-2);
  line-height: 1.7;
}

/* ===== DYNASTY BADGE / FILTER BUTTON ===== */
.dynasty-badge,
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--fast);
  -webkit-tap-highlight-color: transparent;
}
.dynasty-badge:hover,
.dynasty-badge.active,
.filter-btn:hover,
.filter-btn.active {
  background: var(--red);
  color: #fff; border-color: var(--red);
  box-shadow: 0 2px 10px rgba(139,58,47,.2);
  text-decoration: none;
}

/* ===== TABLE ===== */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table th {
  background: linear-gradient(135deg, #2c1810 0%, #3d2518 100%);
  color: #fff; padding: 13px 16px;
  text-align: left; font-weight: 600;
  font-size: 13px; letter-spacing: .3px;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--ink-2);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: background var(--fast);
}
.data-table tbody tr:hover td {
  background: var(--red-light);
  color: var(--ink);
}

/* ===== PAGE HEADER (sub pages) ===== */
.page-header {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2c1810 0%, #3d2015 50%, #4a2518 100%);
  color: #fff;
  padding: 56px 24px 52px;
  text-align: center;
}
.page-header::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(139,58,47,.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(155,77,44,.10) 0%, transparent 45%);
  pointer-events: none;
}
.page-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
}
.page-header h1 {
  font-size: 32px; font-weight: 800;
  letter-spacing: 4px; margin-bottom: 10px;
  position: relative; z-index: 1;
  text-shadow: 0 2px 16px rgba(0,0,0,.3);
}
.page-header p {
  font-size: 14.5px; color: rgba(255,255,255,.58);
  margin-top: 8px;
  position: relative; z-index: 1;
  max-width: 550px; margin-left: auto; margin-right: auto;
}

/* ===== UTILITIES ===== */
.divider {
  height: 1px; background: var(--border);
  margin: 44px 0;
  position: relative;
}
.divider::after {
  content: '';
  position: absolute; left: 50%; top: -1px;
  width: 60px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  transform: translateX(-50%);
}
.text-center { text-align: center; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex          { display: flex; }
.flex-wrap     { flex-wrap: wrap; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-center{ justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* ===== SCROLL ANIMATIONS (progressive reveal) ===== */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.visible {
  opacity: 1; transform: translateY(0);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ===== SEARCH BOX ===== */
.search-box {
  text-align: center; margin-bottom: 28px;
}
.search-box input {
  width: 340px; max-width: 90%;
  padding: 12px 20px 12px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px; font-family: var(--font);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: all var(--fast);
  box-shadow: var(--shadow-sm);
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.search-box input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light), var(--shadow-md);
}
.search-box input::placeholder { color: var(--ink-4); }

/* ===== SCROLL TO TOP ===== */
.scroll-top {
  position: fixed; bottom: 28px; right: 28px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--red); color: #fff;
  border: none; cursor: pointer;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(139,58,47,.3);
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: all var(--norm);
  z-index: 999;
}
.scroll-top.show {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}
.scroll-top:hover {
  background: var(--red-dark);
  transform: scale(1.08);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
  .hero h1 { font-size: 36px; letter-spacing: 4px; }
  .hero-stats { gap: 30px; }
  .page-header h1 { font-size: 26px; letter-spacing: 3px; }
  /* Full-width cards at medium screen */
  .card-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav { padding: 0 16px; }
  .nav-links {
    display: none;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: rgba(44,24,16,.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column; padding: 12px 16px 20px;
    gap: 1px;
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
    border-bottom: 1px solid rgba(255,255,255,.06);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 12px 16px; font-size: 14.5px;
    border-radius: var(--radius);
    min-height: 44px;
    display: flex; align-items: center;
  }
  .nav-links a.nav-sep {
    margin-left: 0; padding-left: 16px;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,.06);
    margin-top: 8px; padding-top: 16px;
  }

  .hero { padding: 64px 20px 56px; }
  .hero h1 { font-size: 30px; letter-spacing: 3px; }
  .hero::after { font-size: 200px; }
  .hero-stats { gap: 24px; }
  .hero-stat .num { font-size: 26px; }

  .section { padding: 44px 0; }
  .section-header { margin-bottom: 32px; }
  .section-header h2 { font-size: 23px; }

  .card-grid-2 { grid-template-columns: 1fr; }
  .card-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
  .card-grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); }

  .card { padding: 20px; }

  .page-header { padding: 44px 20px 40px; }
  .page-header h1 { font-size: 24px; }

  .container, .container-lg { padding: 0 18px; }

  .search-box input { width: 92%; min-height: 44px; }

  /* Touch-friendly sizing on mobile */
  .filter-btn, .dynasty-badge { padding: 10px 20px; min-height: 44px; }
  .tag { padding: 5px 12px; }

  /* Ensure filter rows scroll horizontally on mobile */
  .filter-row, .filter-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .filter-row::-webkit-scrollbar, .filter-bar::-webkit-scrollbar { display: none; }

  /* Section nav horizontal scroll */
  .section-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .section-nav::-webkit-scrollbar { display: none; }

  /* Full-width grids on mobile */
  .persons-grid { grid-template-columns: 1fr !important; }
  .culture-grid { grid-template-columns: 1fr !important; }

  /* Detail/info grids single column */
  .info-grid, .ct-info-grid, .mg-info-grid, .jw-info-grid, .anc-info-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 26px; letter-spacing: 2px; }
  .hero::after { font-size: 150px; right: -20px; }
  .hero-stat .num { font-size: 22px; }
  .stat-card .num { font-size: 28px; }
  .hero-stats { gap: 16px; }

  /* 4-col stat grids → 2-col */
  .hero-stats, .stats-grid, .tl-stats, .jw-stats, .mig-stats, .branch-stats,
  .famous-stats, .ancestor-stats, .citang-stats, .origin-stats, .tree-stats {
    grid-template-columns: repeat(2,1fr) !important;
    gap: 12px !important;
  }

  .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }

  /* Person cards stack */
  .person-card { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .hero { padding: 48px 16px 44px; }
  .hero h1 { font-size: 22px; letter-spacing: 1px; }
  .hero-badge { font-size: 10px; padding: 3px 12px; }
  .person-card { align-items: center; text-align: center; }
  .person-card .avatar { width: 56px; height: 56px; font-size: 20px; }

  .section { padding: 32px 0; }
  .section-header { margin-bottom: 24px; }
  .section-header h2 { font-size: 20px; }

  .card { padding: 16px; border-radius: var(--radius); }
}

/* ===== PRINT ===== */
@media print {
  .site-nav, .scroll-top, .filter-bar, .search-box, .nav-toggle, .section-nav { display: none !important; }
  body { background: #fff; overflow-x: visible; }
  .hero, .page-header { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .section { padding: 20px 0; }
  a { color: #333; }
  a::after { content: none; }
}

/* ===== Site Footer (备案号 + 版权) ===== */
.site-footer {
  background: linear-gradient(180deg, #6d2a1f 0%, #2c1810 100%);
  color: rgba(255, 250, 245, 0.85);
  padding: 32px 20px 26px;
  margin-top: 60px;
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
  border-top: 3px solid #d4a574;
  font-family: "Noto Serif SC", "STSong", serif;
}
.site-footer .footer-inner { max-width: 1200px; margin: 0 auto; }
.site-footer .footer-main { margin-bottom: 10px; }
.site-footer .footer-title {
  font-size: 16px; font-weight: 600; color: #fff;
  letter-spacing: 3px; margin-right: 4px;
}
.site-footer .footer-sep { margin: 0 10px; opacity: 0.5; }
.site-footer .footer-meta { opacity: 0.78; font-size: 12px; }
.site-footer a {
  color: #d4a574; text-decoration: none; transition: color 0.2s;
}
.site-footer a:hover { color: #fff; text-decoration: underline; }
@media (max-width: 480px) {
  .site-footer { padding: 24px 14px 20px; font-size: 12px; }
  .site-footer .footer-title { font-size: 14px; letter-spacing: 2px; }
  .site-footer .footer-sep { margin: 0 6px; }
}
@media print {
  .site-footer { display: none; }
}

