/* ===== CSS Variables / Design Tokens ===== */
:root {
  /* Warm Dark Theme - Refined */
  --bg-primary: #0b0b12;
  --bg-secondary: #12121a;
  --bg-card: #181821;
  --bg-card-alt: #1e1e2a;
  --bg-hover: #252535;
  --border-subtle: rgba(255,255,255,0.06);
  --border-card: rgba(255,255,255,0.08);
  --border-active: rgba(255,255,255,0.14);

  /* Text */
  --text-primary: #eeeef2;
  --text-secondary: #9a9ab0;
  --text-tertiary: #6a6a80;
  --text-muted: #4a4a5a;

  /* Accent — warm amber-gold family */
  --accent-primary: #f0a520;
  --accent-secondary: #ff8c42;
  --accent-glow: rgba(240, 165, 32, 0.12);
  --accent-gradient: linear-gradient(135deg, #f0a520, #ff6b35);

  /* Semantic colors */
  --color-green: #22c55e;
  --color-cyan: #06b6d4;
  --color-purple: #8b5cf6;
  --color-rose: #f43f5e;
  --color-amber: #eab308;
  --color-emerald: #10b981;
  --color-blue: #3b82f6;
  --color-pink: #ec4899;

  /* Typography */
  --font-display: 'SF Pro Display', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'SF Pro Text', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  /* Radius - slightly larger for modern feel */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-elevated: 0 10px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--text-primary);
  text-decoration: none;
}

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

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ===== Navigation Bar ===== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 11, 18, 0.82);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.nav-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.nav-links a.active {
  color: var(--accent-primary);
  background: var(--accent-glow);
}

.nav-links a .avatar-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ===== Hero Section ===== */
.hero-section {
  padding: 120px 24px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  background: rgba(240, 165, 32, 0.08);
  border: 1px solid rgba(240, 165, 32, 0.2);
  border-radius: 100px;
  font-size: 13px;
  color: var(--accent-primary);
  margin-bottom: 24px;
}

.hero-section h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.12;
  margin-bottom: 16px;
  position: relative;
  letter-spacing: -1px;
}

.hero-section .subtitle {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* ===== Family Grid (Homepage) ===== */
.family-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.family-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.family-card:hover {
  border-color: var(--border-active);
  transform: translateY(-6px);
  box-shadow: var(--shadow-elevated);
}

.family-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.family-card:hover::before {
  opacity: 1;
}

.family-card.card-yuan::before { background: var(--accent-gradient); }
.family-card.card-chun::before { background: linear-gradient(90deg, var(--color-pink), var(--color-rose)); }
.family-card.card-fei::before { background: linear-gradient(90deg, var(--color-cyan), var(--color-blue)); }
.family-card.card-elders::before { background: linear-gradient(90deg, var(--color-emerald), var(--color-amber)); }

.family-card.card-elders {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.family-card .card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.avatar-yuan { background: linear-gradient(135deg, #f5a623, #ff6b35); color: #fff; }
.avatar-chun { background: linear-gradient(135deg, #ec4899, #f43f5e); color: #fff; }
.avatar-fei { background: linear-gradient(135deg, #06b6d4, #3b82f6); color: #fff; }
.avatar-elder { background: linear-gradient(135deg, #10b981, #f59e0b); color: #fff; }

.family-card .card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.family-card .card-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

.family-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.family-card .card-tags span {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* ===== Elder sub-cards in grid ===== */
.elder-sub {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: all var(--transition-fast);
}

.elder-sub:hover {
  border-color: var(--border-active);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.elder-sub .elder-emoji {
  font-size: 36px;
  margin-bottom: 8px;
}

.elder-sub .elder-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.elder-sub .elder-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ===== Page Layout ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 84px 24px 60px;
}

/* Back to home */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--accent-primary);
}

.back-link::before {
  content: '←';
}

/* ===== Profile Header ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 40px;
  padding: 32px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.profile-info h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.profile-info .profile-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-tags span {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

/* ===== Section Styling ===== */
.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.section-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 40px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Cards ===== */
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-fast);
}

.dash-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-alt);
}

.dash-card .card-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.dash-card .card-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.dash-card .card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== Timeline ===== */
.timeline {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 40px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 18px 0;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 40px;
  bottom: 0;
  width: 1px;
  background: var(--border-card);
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 3px var(--bg-card);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-tertiary);
  min-width: 60px;
  padding-top: 3px;
}

.timeline-content {
  flex: 1;
}

.timeline-content .tl-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}

.timeline-content .tl-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Progress Bar ===== */
.progress-block {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 40px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-header .prog-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-header .prog-pct {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-desc {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== Milestone / Detail Cards ===== */
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-fast);
}

.detail-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-alt);
}

.detail-card .dc-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.detail-card .dc-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-card .dc-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.detail-card .dc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}

.detail-card .dc-tags span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-tertiary);
}

/* ===== Travel Section ===== */
.travel-section {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 24px;
}

.travel-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
}

.travel-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
}

.travel-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 0;
}

.travel-year {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

.travel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.travel-place {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.travel-divider {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
  font-style: italic;
}

@media (max-width: 768px) {
  .travel-inner {
    padding: 24px 16px;
  }
  .travel-year {
    min-width: 48px;
    font-size: 12px;
  }
  .travel-place {
    font-size: 13px;
  }
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 24px;
  text-align: center;
}

.site-footer p {
  font-size: 13px;
  color: var(--text-tertiary);
}

.site-footer .footer-quote {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 10px;
}

.site-footer a {
  color: var(--accent-primary);
  transition: opacity var(--transition-fast);
}

.site-footer a:hover {
  opacity: 0.8;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in-delay-1 { animation-delay: 0.08s; }
.fade-in-delay-2 { animation-delay: 0.16s; }
.fade-in-delay-3 { animation-delay: 0.24s; }
.fade-in-delay-4 { animation-delay: 0.32s; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .family-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .family-card.card-elders {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px;
    flex-direction: column;
    gap: 2px;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 12px 16px;
    width: 100%;
  }
  .nav-toggle {
    display: block;
  }

  .family-grid {
    grid-template-columns: 1fr;
  }
  .family-card.card-elders {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
  .profile-tags {
    justify-content: center;
  }

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

  .hero-section {
    padding: 100px 16px 60px;
  }

  .back-link {
    margin-bottom: 20px;
  }

  .timeline {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 74px 16px 40px;
  }
  .nav-bar {
    padding: 0 16px;
  }
  .timeline {
    padding: 16px;
  }
  .timeline-item {
    gap: 12px;
  }
  .timeline-year {
    min-width: 42px;
    font-size: 12px;
  }
}
