/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Noto+Serif+SC:wght@400;700;900&family=Inter:wght@300;400;500;600&display=swap');

/* ===== 1. CSS Variables & Reset ===== */
:root {
  --bg-primary: #06060f;
  --bg-secondary: #0c0c1d;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --gold: #ffd700;
  --gold-light: #ffe566;
  --gold-dark: #b8960f;
  --gold-dim: rgba(255, 215, 0, 0.15);
  --accent-rose: #ff6b9d;
  --accent-purple: #7c5bf5;
  --accent-blue: #4a9eff;
  --accent-cyan: #00d4ff;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.3);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(255, 215, 0, 0.25);
  --shadow-gold: 0 0 40px rgba(255, 215, 0, 0.12);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font-display: 'Playfair Display', 'Noto Serif SC', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-cn: 'Noto Serif SC', '宋体', serif;
  --timeline-width: 2px;
  --card-radius: 24px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) var(--bg-primary);
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 3px;
}

/* ===== 2. Canvas & Background ===== */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 91, 245, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(255, 107, 157, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 20% 60%, rgba(74, 158, 255, 0.05) 0%, transparent 50%);
}

/* ===== 3. Loading Screen ===== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-ring {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 24px;
  font-family: var(--font-cn);
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 4px;
}

/* ===== 4. Hero Section ===== */
.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  position: relative;
  z-index: 2;
  padding: 40px;
}

.hero-sparkle {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.03) 0%, transparent 40%);
  animation: pulse-glow 4s ease-in-out infinite;
}

.age-number {
  font-family: var(--font-display);
  font-size: clamp(120px, 20vw, 260px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 30%, var(--gold-dark) 60%, var(--gold-light) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite;
  filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.3));
  opacity: 0;
  transform: scale(0.5);
  transition: all 1.2s var(--ease-out-expo);
}

.age-number.animate-in {
  opacity: 1;
  transform: scale(1);
}

.hero-label {
  font-family: var(--font-body);
  font-size: clamp(11px, 1.5vw, 15px);
  font-weight: 500;
  letter-spacing: 12px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s var(--ease-out-expo) 0.6s;
}

.hero-label.animate-in {
  opacity: 0.8;
  transform: translateY(0);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: 3px;
  margin-top: 16px;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s var(--ease-out-expo) 0.8s;
}

.hero-title.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.hero-subtitle {
  font-family: var(--font-cn);
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 20px;
  min-height: 36px;
  opacity: 0;
  transition: opacity 0.5s ease 1.2s;
}

.hero-subtitle.animate-in {
  opacity: 1;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--gold);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

.hero-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 32px auto 0;
  opacity: 0;
  transform: scaleX(0);
  transition: all 0.8s var(--ease-out-expo) 1.5s;
}

.hero-divider.animate-in {
  opacity: 1;
  transform: scaleX(1);
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeInUp 1s ease 2.5s forwards;
}

.scroll-indicator span {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-muted);
}

.scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--gold-dim);
  border-bottom: 2px solid var(--gold-dim);
  transform: rotate(45deg);
  animation: bounce-arrow 2s ease-in-out infinite;
}

/* ===== 5. Section Title ===== */
.section-title-container {
  text-align: center;
  padding: 100px 20px 60px;
  position: relative;
  z-index: 1;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-family: var(--font-cn);
  font-size: clamp(14px, 2vw, 18px);
  color: var(--text-muted);
  margin-top: 12px;
  letter-spacing: 6px;
}

/* ===== 6. Timeline ===== */
.timeline-section {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--timeline-width);
  height: 100%;
  background: linear-gradient(180deg,
      transparent 0%,
      var(--gold-dim) 5%,
      var(--gold-dim) 95%,
      transparent 100%);
}

.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 80px;
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.8s var(--ease-out-expo);
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:nth-child(odd) {
  flex-direction: row;
  padding-right: calc(50% + 40px);
}

.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
  padding-left: calc(50% + 40px);
}

/* Timeline Node */
.timeline-node {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.age-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border: 2px solid var(--gold-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  box-shadow: var(--shadow-gold), 0 0 0 6px var(--bg-primary);
  transition: all 0.4s var(--ease-out-expo);
}

.timeline-item.visible .age-badge {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), 0 0 0 6px var(--bg-primary);
}

/* Timeline Card */
.timeline-card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-out-expo);
}

.timeline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.timeline-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 215, 0, 0.15);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.timeline-card:hover::before {
  opacity: 1;
}

.card-header {
  margin-bottom: 20px;
}

.card-age-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.card-title {
  font-family: var(--font-cn);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-subtitle {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
}

/* ===== 7. Photo Grid ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.photo-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.photo-grid.grid-1 {
  grid-template-columns: 1fr;
  max-width: 400px;
}

.photo-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  transform: scale(1);
  transition: transform 0.5s var(--ease-out-expo);
}

.photo-item:hover {
  transform: scale(1.03);
  z-index: 2;
}

.photo-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: 16px;
}

.photo-item:hover::after {
  opacity: 1;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  transition: transform 0.6s var(--ease-out-expo);
  display: block;
}

.photo-item:hover img {
  transform: scale(1.08);
}

.photo-zoom-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  z-index: 3;
  pointer-events: none;
}

.photo-zoom-icon svg {
  width: 16px;
  height: 16px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

.photo-item:hover .photo-zoom-icon {
  opacity: 1;
  transform: translateY(0);
}

/* First photo in grid-4 can span */
.photo-grid.grid-4-featured .photo-item:first-child {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}

/* ===== 8. Birthday Wishes Section ===== */
.wishes-section {
  position: relative;
  z-index: 1;
  padding: 100px 24px 80px;
  text-align: center;
  overflow: hidden;
}

.wishes-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 80%, rgba(255, 215, 0, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.cake-wrapper {
  margin-bottom: 50px;
  opacity: 0;
  transform: translateY(40px);
  transition: all 1s var(--ease-out-expo);
}

.cake-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
}

/* CSS Cake */
.cake {
  width: 200px;
  margin: 0 auto;
  position: relative;
}

.cake-layer {
  border-radius: 20px;
  position: relative;
  margin: 0 auto;
}

.cake-layer-1 {
  width: 180px;
  height: 60px;
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
  border-radius: 12px 12px 16px 16px;
  z-index: 1;
}

.cake-layer-2 {
  width: 140px;
  height: 50px;
  background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  margin-top: -4px;
  border-radius: 10px 10px 14px 14px;
  z-index: 2;
}

.cake-layer-3 {
  width: 100px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  margin-top: -4px;
  border-radius: 8px 8px 12px 12px;
  z-index: 3;
}

.cake-plate {
  width: 220px;
  height: 16px;
  background: linear-gradient(180deg, #e0e0e0, #bbb);
  border-radius: 50%;
  margin: 0 auto;
  margin-top: 4px;
}

/* Candles */
.candles {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: -6px;
  position: relative;
  z-index: 4;
}

.candle {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.candle-stick {
  width: 6px;
  height: 30px;
  background: linear-gradient(180deg, #ffeb3b, #ff9800);
  border-radius: 3px;
}

.flame-container {
  position: relative;
  width: 14px;
  height: 20px;
  margin-bottom: -2px;
}

.flame {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 16px;
  background: radial-gradient(ellipse at bottom, #fff 0%, #ffeb3b 30%, #ff9800 60%, transparent 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 0.5s ease-in-out infinite alternate;
  filter: blur(0.5px);
}

.flame::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  filter: blur(1px);
}

.flame-glow {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(255, 200, 0, 0.3) 0%, transparent 70%);
  animation: flicker 0.6s ease-in-out infinite alternate-reverse;
}

.wishes-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--accent-rose));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s var(--ease-out-expo) 0.3s;
}

.wishes-title.visible {
  opacity: 1;
  transform: translateY(0);
}

.wishes-text {
  font-family: var(--font-cn);
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 2;
  opacity: 0;
  transform: translateY(20px);
  transition: all 1s var(--ease-out-expo) 0.6s;
}

.wishes-text.visible {
  opacity: 1;
  transform: translateY(0);
}

.wishes-emoji {
  font-size: clamp(40px, 6vw, 60px);
  margin-top: 40px;
  opacity: 0;
  transition: all 1s var(--ease-out-expo) 0.9s;
}

.wishes-emoji.visible {
  opacity: 1;
}

/* ===== 9. Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--border-subtle);
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.footer .heart {
  color: var(--accent-rose);
  animation: heartbeat 1.5s ease-in-out infinite;
  display: inline-block;
}

/* ===== 10. Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  transition: transform 0.5s var(--ease-out-expo);
}

.lightbox.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  letter-spacing: 2px;
}

/* ===== 11. Confetti Canvas ===== */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9000;
  pointer-events: none;
}

/* ===== 12. Keyframe Animations ===== */
@keyframes shimmer {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.95);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes bounce-arrow {

  0%,
  100% {
    transform: rotate(45deg) translate(0, 0);
    opacity: 0.3;
  }

  50% {
    transform: rotate(45deg) translate(5px, 5px);
    opacity: 0.8;
  }
}

@keyframes flicker {
  0% {
    transform: translateX(-50%) scale(1) rotate(-2deg);
  }

  100% {
    transform: translateX(-50%) scale(1.1) rotate(2deg);
  }
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.15);
  }

  50% {
    transform: scale(1);
  }

  75% {
    transform: scale(1.1);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* ===== 13. Responsive ===== */
@media (max-width: 900px) {
  .timeline::before {
    left: 24px;
  }

  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    flex-direction: row;
    padding-right: 0;
    padding-left: 72px;
  }

  .timeline-node {
    left: 24px;
  }

  .age-badge {
    width: 48px;
    height: 48px;
    font-size: 12px;
  }

  .timeline-card {
    padding: 24px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .photo-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .hero-content {
    padding: 24px;
  }

  .timeline-card {
    padding: 20px;
    border-radius: 18px;
  }

  .photo-grid {
    gap: 6px;
  }

  .photo-item {
    border-radius: 12px;
  }

  .photo-item img {
    border-radius: 12px;
  }

  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .lightbox-prev {
    left: 12px;
  }

  .lightbox-next {
    right: 12px;
  }
}