/* ============================================
   仙溪郑氏数字家园 — Design System
   Modern Heritage (现代传承风) Theme
   ============================================ */

/* --- Local Google Fonts --- */
@import url('./fonts.css');

/* --- CSS Custom Properties --- */
:root {
  /* Brand Colors */
  --imperial-red: #8B1A1A;
  --imperial-red-light: #C41E3A;
  --imperial-red-glow: rgba(196, 30, 58, 0.25);
  --vermilion: #E2553D;
  --gold-accent: #C9A94E;
  --gold-light: #E8D48B;

  /* Neutrals */
  --charcoal: #2C2C2C;
  --charcoal-light: #4A4A4A;
  --ink-dark: #1A1A1A;
  --ink-medium: #3D3D3D;

  /* Backgrounds */
  --parchment: #F5F0E8;
  --parchment-light: #FAF7F2;
  --parchment-dark: #E8E0D0;
  --cream: #FFFDF7;
  --wood-brown: #8B7355;
  --wood-light: #A0896C;

  /* Status */
  --status-online: #2ECC71;
  --status-offline: #E74C3C;

  /* Typography */
  --font-serif: 'Noto Serif SC', 'Songti SC', serif;
  --font-sans: 'Noto Sans SC', 'Inter', 'PingFang SC', sans-serif;
  --font-calligraphy: 'Ma Shan Zheng', cursive;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Borders & Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 40px var(--imperial-red-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.2s var(--ease-out);
  --transition-med: 0.4s var(--ease-out);
  --transition-slow: 0.7s var(--ease-out);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--parchment);
  color: var(--charcoal);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--imperial-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--imperial-red-light);
}

/* --- Utility Classes --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section-pad {
  padding: var(--space-4xl) 0;
}

.text-center {
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* --- Ink Wash Background Texture --- */
.ink-wash-bg {
  position: relative;
}

.ink-wash-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 115, 85, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 30%, rgba(139, 26, 26, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(201, 169, 78, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ======================
   NAVIGATION
   ====================== */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(139, 26, 26, 0.1);
  transition: all var(--transition-med);
}

.main-nav.scrolled {
  background: rgba(245, 240, 232, 0.97);
  box-shadow: var(--shadow-md);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-seal {
  width: 40px;
  height: 40px;
  background: var(--imperial-red);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-accent);
  font-family: var(--font-calligraphy);
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgba(139, 26, 26, 0.3);
  transition: transform var(--transition-fast);
}

.nav-seal:hover {
  transform: scale(1.08);
}

.nav-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--imperial-red);
  letter-spacing: 0.02em;
}

.nav-subtitle {
  font-size: 0.7rem;
  color: var(--charcoal-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--charcoal);
  position: relative;
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--imperial-red);
  transition: width var(--transition-fast);
}

.nav-links a:hover {
  color: var(--imperial-red);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--parchment-dark);
  border-radius: var(--radius-md);
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  color: var(--charcoal-light);
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.lang-btn.active {
  background: white;
  color: var(--imperial-red);
  box-shadow: var(--shadow-sm);
}

.lang-btn:hover:not(.active) {
  color: var(--charcoal);
}

/* Mobile Menu Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--charcoal);
  position: absolute;
  left: 4px;
  transition: all var(--transition-fast);
}

.nav-toggle span:nth-child(1) {
  top: 8px;
}

.nav-toggle span:nth-child(2) {
  top: 15px;
}

.nav-toggle span:nth-child(3) {
  top: 22px;
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg);
  top: 15px;
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg);
  top: 15px;
}

/* ======================
   HERO SECTION
   ====================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--ink-dark);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transform: scale(1.05);
  transition: transform 20s linear;
}

.hero:hover .hero-bg img {
  transform: scale(1.12);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg,
      rgba(26, 26, 26, 0.5) 0%,
      rgba(26, 26, 26, 0.2) 40%,
      rgba(26, 26, 26, 0.4) 70%,
      rgba(26, 26, 26, 0.85) 100%);
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: var(--space-xl);
  max-width: 800px;
}

.hero-emblem {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-xl);
  background: rgba(139, 26, 26, 0.9);
  border: 2px solid var(--gold-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-calligraphy);
  font-size: 2.5rem;
  color: var(--gold-accent);
  box-shadow: 0 0 40px rgba(139, 26, 26, 0.4);
  animation: emblemFloat 4s ease-in-out infinite;
}

@keyframes emblemFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.hero-couplet {
  font-family: var(--font-calligraphy);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--gold-light);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-md);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);
}

.hero-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(0.9rem, 1.8vw, 1.15rem);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-2xl);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 36px;
  background: var(--imperial-red);
  color: white;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 20px rgba(139, 26, 26, 0.4);
  letter-spacing: 0.05em;
}

.hero-cta:hover {
  background: var(--imperial-red-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(196, 30, 58, 0.4);
  color: white;
}

.hero-cta svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.hero-cta:hover svg {
  transform: translateX(4px);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  animation: scrollBounce 2s infinite;
}

.scroll-indicator span {
  display: block;
  width: 24px;
  height: 24px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
  border-right: 2px solid rgba(255, 255, 255, 0.5);
  transform: rotate(45deg);
  margin: -10px;
}

@keyframes scrollBounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
    opacity: 0.5;
  }

  50% {
    transform: translateX(-50%) translateY(10px);
    opacity: 1;
  }
}

/* ======================
   QUOTE 365 WIDGET
   ====================== */
.quote-section {
  background: linear-gradient(135deg, var(--ink-dark) 0%, #2a1a1a 50%, var(--ink-dark) 100%);
  padding: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
}

.quote-section::before {
  content: '语';
  position: absolute;
  font-family: var(--font-calligraphy);
  font-size: 20rem;
  color: rgba(255, 255, 255, 0.02);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.quote-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
}

.quote-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(196, 30, 58, 0.15);
  border: 1px solid rgba(196, 30, 58, 0.3);
  border-radius: 50px;
  padding: 6px 18px;
  margin-bottom: var(--space-xl);
  color: var(--imperial-red-light);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.quote-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--imperial-red-light);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.quote-text {
  font-family: var(--font-calligraphy);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  color: var(--gold-light);
  line-height: 1.8;
  margin-bottom: var(--space-lg);
  position: relative;
}

.quote-text::before,
.quote-text::after {
  font-family: var(--font-serif);
  font-size: 3rem;
  color: rgba(201, 169, 78, 0.2);
  position: absolute;
}

.quote-text::before {
  content: '"';
  top: -15px;
  left: -20px;
}

.quote-text::after {
  content: '"';
  bottom: -30px;
  right: -20px;
}

.quote-source {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.quote-day {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: var(--space-md);
  letter-spacing: 0.1em;
}

/* ======================
   SERVER STATUS BAR
   ====================== */
.server-status-bar {
  background: var(--parchment-dark);
  border-bottom: 1px solid rgba(139, 26, 26, 0.08);
  padding: 8px 0;
}

.status-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  font-size: 0.8rem;
  color: var(--charcoal-light);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  animation: statusPulse 2s infinite;
}

.status-dot.online {
  background: var(--status-online);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.status-dot.offline {
  background: var(--status-offline);
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
  animation: none;
}

.status-dot.checking {
  background: var(--gold-accent);
  box-shadow: 0 0 8px rgba(201, 169, 78, 0.5);
}

@keyframes statusPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(0.85);
  }
}

.status-link {
  color: var(--imperial-red);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.status-stats {
  color: var(--charcoal-light);
  font-size: 0.75rem;
}

/* ======================
   ABOUT / ORIGIN SECTION
   ====================== */
.about-section {
  background: var(--cream);
  position: relative;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--imperial-red);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.section-label::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--imperial-red);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 900;
  color: var(--charcoal);
  margin-bottom: var(--space-lg);
  line-height: 1.3;
}

.section-title .highlight {
  color: var(--imperial-red);
}

.about-text {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--charcoal-light);
  margin-bottom: var(--space-lg);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.stat-card {
  text-align: center;
  padding: var(--space-lg);
  background: var(--parchment);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 26, 26, 0.08);
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 900;
  color: var(--imperial-red);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--charcoal-light);
  margin-top: var(--space-xs);
}

.about-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  position: relative;
  aspect-ratio: 4/3;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.about-image:hover img {
  transform: scale(1.05);
}

.about-image-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-lg);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  font-family: var(--font-serif);
  font-size: 0.9rem;
}

/* ======================
   INTERACTIVE TIMELINE
   ====================== */
.timeline-section {
  background: var(--parchment);
  position: relative;
}

.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--imperial-red), var(--imperial-red), transparent);
  transform: translateX(-50%);
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s var(--ease-out);
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
}

.timeline-content {
  width: 45%;
  background: white;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  border: 1px solid rgba(139, 26, 26, 0.06);
  transition: all var(--transition-fast);
}

.timeline-content:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.timeline-year {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--imperial-red);
  margin-bottom: var(--space-xs);
}

.timeline-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: var(--space-sm);
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--charcoal-light);
  line-height: 1.6;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  background: var(--imperial-red);
  border: 3px solid var(--parchment);
  border-radius: 50%;
  position: absolute;
  top: var(--space-lg);
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(139, 26, 26, 0.15);
}

.timeline-item:nth-child(odd) .timeline-dot {
  right: -38px;
}

.timeline-item:nth-child(even) .timeline-dot {
  left: -38px;
}

.timeline-spacer {
  width: 10%;
}

/* ======================
   ANCESTRAL HALLS GALLERY
   ====================== */
.gallery-section {
  background: var(--cream);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.gallery-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid rgba(139, 26, 26, 0.05);
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.gallery-card-img {
  aspect-ratio: 16/10;
  overflow: hidden;
}

.gallery-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-card:hover .gallery-card-img img {
  transform: scale(1.08);
}

.gallery-card-body {
  padding: var(--space-lg);
}

.gallery-card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}

.gallery-card-sub {
  font-size: 0.85rem;
  color: var(--charcoal-light);
  line-height: 1.5;
}

.gallery-card-tag {
  display: inline-block;
  margin-top: var(--space-sm);
  padding: 3px 10px;
  background: var(--parchment);
  color: var(--imperial-red);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 50px;
  letter-spacing: 0.05em;
}

/* ======================
   FAMILY TREE CTA
   ====================== */
.tree-cta-section {
  background: linear-gradient(135deg, var(--imperial-red) 0%, #6B1212 100%);
  padding: var(--space-4xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tree-cta-section::before {
  content: '族';
  position: absolute;
  font-family: var(--font-calligraphy);
  font-size: 25rem;
  color: rgba(255, 255, 255, 0.03);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.tree-cta-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-md);
}

.tree-cta-desc {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 550px;
  margin: 0 auto var(--space-xl);
}

.tree-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 16px 40px;
  background: white;
  color: var(--imperial-red);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-lg);
}

.tree-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  color: var(--imperial-red);
}

.tree-cta-btn svg {
  width: 20px;
  height: 20px;
}

/* ======================
   FOOTER
   ====================== */
.main-footer {
  background: var(--ink-dark);
  color: rgba(255, 255, 255, 0.6);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-sm);
}

.footer-brand-desc {
  font-size: 0.85rem;
  line-height: 1.7;
}

.footer-heading {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--gold-accent);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

/* ======================
   LIGHTBOX
   ====================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-caption {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  text-align: center;
  padding: var(--space-sm) var(--space-lg);
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
}

/* ======================
   REVEAL ANIMATIONS
   ====================== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ======================
   NEWS / LATEST UPDATES
   ====================== */
.news-section {
  background: var(--parchment);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.news-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(139, 26, 26, 0.05);
  transition: all var(--transition-fast);
}

.news-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.news-card-date {
  font-size: 0.75rem;
  color: var(--imperial-red);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.news-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: var(--space-sm);
}

.news-card-text {
  font-size: 0.85rem;
  color: var(--charcoal-light);
  line-height: 1.6;
}

/* ======================
   RESPONSIVE
   ====================== */
@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--parchment);
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-lg);
    border-bottom: 1px solid rgba(139, 26, 26, 0.1);
    box-shadow: var(--shadow-lg);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .lang-switcher {
    order: -1;
  }

  .hero-emblem {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    flex-direction: column;
    padding-left: 50px;
  }

  .timeline-content {
    width: 100%;
  }

  .timeline-dot,
  .timeline-item:nth-child(odd) .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 12px !important;
    right: auto !important;
    top: 0;
    position: absolute;
  }

  .timeline-item {
    position: relative;
  }

  .timeline-spacer {
    display: none;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .about-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .quote-text::before,
  .quote-text::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .about-stats {
    grid-template-columns: 1fr;
  }

  .stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-align: left;
  }
}

/* ======================
   FOREWORD SECTION
   ====================== */
.foreword-section {
  background: var(--parchment);
  position: relative;
}

.foreword-content {
  max-width: 800px;
  margin: var(--space-2xl) auto;
  padding: var(--space-2xl);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(139, 26, 26, 0.06);
  position: relative;
}

.foreword-content::before {
  content: '序';
  position: absolute;
  font-family: var(--font-calligraphy);
  font-size: 12rem;
  color: rgba(139, 26, 26, 0.03);
  top: -20px;
  right: 20px;
  pointer-events: none;
}

.foreword-content p {
  font-size: 1rem;
  line-height: 2;
  color: var(--charcoal-light);
  margin-bottom: var(--space-md);
  text-indent: 2em;
}

.foreword-author {
  text-indent: 0 !important;
  text-align: right;
  font-style: italic;
  color: var(--charcoal) !important;
  margin-top: var(--space-xl);
  font-weight: 500;
}

/* Motto */
.foreword-motto {
  text-align: center;
  margin: var(--space-2xl) auto;
  padding: var(--space-xl);
  max-width: 500px;
  border: 2px solid var(--imperial-red);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(139, 26, 26, 0.04) 0%, rgba(201, 169, 78, 0.06) 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.motto-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--imperial-red);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.motto-calligraphy {
  width: 100%;
  max-width: 460px;
  height: auto;
  border-radius: var(--radius-md);
}

/* Distribution Section */
.distribution-section {
  max-width: 800px;
  margin: var(--space-2xl) auto;
  text-align: center;
}

.distribution-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--imperial-red);
  margin-bottom: var(--space-sm);
}

.distribution-desc {
  font-size: 0.95rem;
  color: var(--charcoal-light);
  margin-bottom: var(--space-xl);
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.distribution-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(139, 26, 26, 0.06);
  transition: all var(--transition-fast);
}

.distribution-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.distribution-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.distribution-card h4 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: var(--space-xs);
}

.distribution-card p {
  font-size: 0.8rem;
  color: var(--charcoal-light);
  line-height: 1.5;
}

.distribution-photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  position: relative;
}

.distribution-photo img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-slow);
}

.distribution-photo:hover img {
  transform: scale(1.03);
}

.distribution-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  font-family: var(--font-serif);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .distribution-grid {
    grid-template-columns: 1fr;
  }
}

/* Generation Poem Grid */
.generation-poem-container {
  max-width: 600px;
  margin: var(--space-2xl) auto 0;
  text-align: center;
  border: 2px solid rgba(139, 26, 26, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  background: white;
  box-shadow: var(--shadow-sm);
}

.generation-poem-container h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--imperial-red);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.08em;
}

.poem-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.poem-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding: 8px 4px;
  border: 1px solid rgba(139, 26, 26, 0.1);
  border-radius: var(--radius-sm);
  font-family: var(--font-calligraphy);
  font-size: 1.4rem;
  color: var(--charcoal);
  transition: all var(--transition-fast);
  background: var(--parchment);
}

.poem-char:hover {
  background: rgba(139, 26, 26, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.poem-char.highlight-gen {
  background: var(--imperial-red);
  color: white;
  border-color: var(--imperial-red);
  box-shadow: 0 2px 8px rgba(139, 26, 26, 0.3);
}

.poem-char.highlight-gen .poem-num {
  color: rgba(255, 255, 255, 0.7);
}

.poem-num {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  color: var(--charcoal-light);
  margin-bottom: 2px;
}

/* ======================
   WEBTREES MODAL
   ====================== */
.webtrees-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.webtrees-modal-overlay.active {
  display: flex;
}

.webtrees-modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: modalSlideIn 0.3s var(--ease-out);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.webtrees-modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--parchment);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal-light);
  transition: all var(--transition-fast);
}

.webtrees-modal-close:hover {
  background: var(--imperial-red);
  color: white;
}

.webtrees-modal h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: var(--space-sm);
}

.webtrees-modal-desc {
  font-size: 0.85rem;
  color: var(--charcoal-light);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.webtrees-modal-step {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--parchment);
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 26, 26, 0.06);
}

.modal-step-num {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--imperial-red);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.9rem;
}

.modal-step-content {
  flex: 1;
}

.modal-step-content h4 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 2px;
}

.modal-step-subtext {
  font-size: 0.78rem;
  color: var(--charcoal-light);
  margin-bottom: var(--space-sm);
}

.modal-login-btn {
  display: inline-block;
  padding: 8px 20px;
  background: var(--imperial-red);
  color: white;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.modal-login-btn:hover {
  background: var(--imperial-red-light);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 26, 26, 0.3);
}

.modal-chart-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(139, 26, 26, 0.15);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--charcoal);
  background: white;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  appearance: auto;
}

.modal-chart-select:focus {
  outline: none;
  border-color: var(--imperial-red);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.1);
}

.modal-view-btn {
  display: inline-block;
  padding: 10px 28px;
  background: var(--gold-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  text-align: center;
}

.modal-view-btn:hover {
  background: #b8952e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201, 169, 78, 0.3);
}

/* Login Form */
.modal-login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.modal-login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(139, 26, 26, 0.15);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--charcoal);
  background: white;
  box-sizing: border-box;
}

.modal-login-form input:focus {
  outline: none;
  border-color: var(--imperial-red);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.1);
}

.login-status {
  font-size: 0.8rem;
  margin-bottom: var(--space-xs);
  min-height: 1.2em;
}

.login-status.checking {
  color: var(--gold-accent);
}

.login-status.error {
  color: var(--status-offline);
}

.login-status.success {
  color: var(--status-online);
}

.login-success {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: var(--radius-md);
  color: #27ae60;
  font-weight: 600;
  font-size: 0.9rem;
}

.login-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #27ae60;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
}

.modal-login-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--imperial-red);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.modal-login-btn:hover {
  background: var(--imperial-red-light);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 26, 26, 0.3);
}

.modal-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Chart Viewer */
.chart-viewer {
  position: absolute;
  inset: 0;
  background: white;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: modalSlideIn 0.2s var(--ease-out);
}

.chart-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--ink-dark);
  color: white;
  flex-shrink: 0;
}

.chart-viewer-back {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chart-viewer-back:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chart-viewer-title {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  flex: 1;
  padding: 0 var(--space-sm);
}

.chart-viewer-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.chart-viewer-close:hover {
  background: var(--imperial-red);
}

.chart-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--parchment);
}

/* Full-screen modal when chart viewer is active */
.webtrees-modal-overlay.viewer-active .webtrees-modal {
  display: none;
}

.webtrees-modal-overlay.viewer-active {
  padding: 10px;
}

.webtrees-modal-overlay.viewer-active .chart-viewer {
  display: flex;
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

/* ======================
   ANCESTRAL SITES SECTION
   ====================== */
.sites-section {
  background: var(--ink-dark);
}

.sites-intro {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-2xl);
}

/* Override section-title color inside dark bg */
.sites-section .section-title {
  color: var(--gold-light);
}

.sites-section .section-label {
  color: var(--gold-accent);
}

.sites-section .section-label::before {
  background: var(--gold-accent);
}

/* 3-col grid; last card spans full width */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* Base Card */
.site-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(201, 169, 78, 0.15);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.site-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(201, 169, 78, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Full-width 4th card */
.site-card-wide {
  grid-column: 1 / -1;
}

/* Card Header */
.site-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-gen-badge {
  display: inline-block;
  padding: 3px 12px;
  background: rgba(201, 169, 78, 0.15);
  color: var(--gold-accent);
  border: 1px solid rgba(201, 169, 78, 0.3);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.site-gen-badge--red {
  background: rgba(196, 30, 58, 0.15);
  color: #ff8a8a;
  border-color: rgba(196, 30, 58, 0.3);
}

.site-icon {
  font-size: 2rem;
}

.site-card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

/* Address Block */
.site-address-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
}

.site-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-address-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
}

/* Action Buttons */
.site-address-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.site-map-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: rgba(201, 169, 78, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(201, 169, 78, 0.3);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.site-map-btn:hover {
  background: rgba(201, 169, 78, 0.3);
  color: white;
  border-color: var(--gold-accent);
}

.site-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.site-copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.site-copy-btn.copied {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.3);
}

/* 17th Gen Branches (3 columns inside wide card) */
.site-branches {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0;
  margin-top: var(--space-sm);
}

.site-branch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-align: center;
}

.site-branch-flag {
  font-size: 2.5rem;
  line-height: 1;
}

.site-branch-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.site-branch-label {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 2px;
}

.site-branch-divider {
  width: 1px;
  background: rgba(201, 169, 78, 0.15);
  align-self: stretch;
  margin: var(--space-lg) 0;
}

/* Responsive */
@media (max-width: 900px) {
  .sites-grid {
    grid-template-columns: 1fr 1fr;
  }

  .site-card-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .sites-grid {
    grid-template-columns: 1fr;
  }

  .site-branches {
    grid-template-columns: 1fr;
  }

  .site-branch-divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }

  .site-branch-item {
    padding: var(--space-md);
  }
}

/* ======================
   PWA INSTALL BANNER
   ====================== */

@keyframes bannerSlideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: linear-gradient(135deg, #6b1111 0%, var(--imperial-red) 50%, #a02020 100%);
  color: white;
  box-shadow: 0 4px 24px rgba(139, 26, 26, 0.45);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.pwa-install-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  animation: bannerSlideDown 0.5s var(--ease-out) forwards;
}

.pwa-install-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-install-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.pwa-install-sub {
  font-size: 0.78rem;
  opacity: 0.82;
  font-family: var(--font-sans);
  line-height: 1.3;
}

.pwa-install-btn {
  flex-shrink: 0;
  padding: 8px 22px;
  background: var(--gold-accent);
  color: var(--ink-dark);
  border: none;
  border-radius: var(--radius-xl);
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.pwa-install-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.pwa-install-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: all var(--transition-fast);
}

.pwa-install-close:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

/* Shift nav down when banner is visible */
.pwa-install-banner.visible ~ .main-nav,
body:has(.pwa-install-banner.visible) .main-nav {
  top: 62px;
  transition: top 0.5s var(--ease-out);
}

@media (max-width: 600px) {
  .pwa-install-inner {
    padding: 10px var(--space-md);
    gap: var(--space-sm);
  }

  .pwa-install-icon {
    width: 34px;
    height: 34px;
  }

  .pwa-install-title {
    font-size: 0.85rem;
  }

  .pwa-install-sub {
    font-size: 0.72rem;
  }

  .pwa-install-btn {
    padding: 7px 15px;
    font-size: 0.82rem;
  }
}

/* ======================
   iOS INSTALL GUIDE MODAL
   ====================== */

.ios-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 10, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 var(--space-md) var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.ios-guide-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.ios-guide-modal {
  background: linear-gradient(145deg, var(--cream) 0%, var(--parchment) 100%);
  border: 1px solid rgba(139, 26, 26, 0.15);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.25), var(--shadow-xl);
  transform: translateY(40px);
  transition: transform 0.35s var(--ease-out);
}

.ios-guide-overlay.active .ios-guide-modal {
  transform: translateY(0);
}

.ios-guide-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--parchment-dark);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal-light);
  transition: all var(--transition-fast);
}

.ios-guide-close:hover {
  background: var(--parchment-dark);
  color: var(--imperial-red);
}

.ios-guide-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.ios-guide-app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.ios-guide-header h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--imperial-red);
}

.ios-guide-desc {
  font-size: 0.9rem;
  color: var(--charcoal-light);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.ios-guide-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.ios-guide-steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  font-size: 0.92rem;
  color: var(--charcoal);
  line-height: 1.5;
}

.ios-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--imperial-red);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  margin-top: 1px;
}

.ios-share-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  background: rgba(0, 122, 255, 0.12);
  border: 1px solid rgba(0, 122, 255, 0.25);
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 4px;
}

.ios-share-icon svg {
  width: 16px;
  height: 16px;
  color: #007AFF;
  stroke: #007AFF;
}

.ios-guide-arrow {
  text-align: center;
  font-size: 0.82rem;
  color: var(--charcoal-light);
  padding: var(--space-sm) var(--space-md);
  background: rgba(139, 26, 26, 0.06);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(139, 26, 26, 0.2);
  animation: arrowBounce 1.5s ease-in-out infinite;
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(4px); }
}