/* ==========================================================
   Happy Birthday, Papa 🤍
   Minimalist, Warm & Emotional Birthday Memorial Website
   ========================================================== */

:root {
  --bg-main: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-card-inner: #FDFCFA;
  --text-main: #2D2722;
  --text-muted: #82776B;
  --text-light: #B5AA9D;
  --accent-gold: #C5A880;
  --accent-gold-dark: #9F825C;
  --accent-gold-soft: #F1EAE0;
  --accent-heart: #D96B6B;
  --border-subtle: rgba(197, 168, 128, 0.22);
  --shadow-card: 0 16px 40px -8px rgba(45, 39, 34, 0.08), 0 4px 12px -2px rgba(45, 39, 34, 0.04);
  --shadow-hover: 0 24px 50px -10px rgba(45, 39, 34, 0.13), 0 8px 20px -3px rgba(45, 39, 34, 0.06);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --font-serif: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-main);
}

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.65;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle background grain & warm ambient glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(197, 168, 128, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(217, 107, 107, 0.04) 0%, transparent 45%);
}

/* Floating Audio Control Button */
.audio-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: var(--transition-smooth);
}

.audio-toggle:hover {
  transform: translateY(-2px);
  background: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--accent-gold);
}

.audio-toggle .icon-music {
  width: 18px;
  height: 18px;
  stroke: var(--accent-gold-dark);
  transition: var(--transition-smooth);
}

.audio-toggle.playing .icon-music {
  animation: pulseMusic 1.6s infinite ease-in-out;
  stroke: var(--accent-heart);
}

@keyframes pulseMusic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* ==========================================================
   1. HERO SECTION (หน้าเปิดเต็มจอ)
   ========================================================== */
.hero-section {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
  color: #FFFFFF;
}

/* Hero Background with Papa's Portrait */
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('IMG_0001.jpg');
  background-size: cover;
  background-position: center 30%;
  transform: scale(1.04);
  transition: transform 8s ease-out;
  z-index: 1;
}

body.loaded .hero-bg {
  transform: scale(1);
}

/* Warm Cinematic Vignette Overlay */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    rgba(24, 20, 17, 0.55) 0%,
    rgba(24, 20, 17, 0.35) 45%,
    rgba(24, 20, 17, 0.75) 85%,
    rgba(250, 247, 242, 1) 100%
  );
}

/* Hero Content Box */
.hero-content {
  position: relative;
  z-index: 3;
  max-width: 700px;
  margin-top: auto;
  margin-bottom: auto;
  opacity: 0;
  transform: translateY(24px);
  animation: heroFadeIn 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #FFFFFF;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 0.8rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hero-title .heart {
  display: inline-block;
  margin-left: 0.25rem;
  color: #FFFFFF;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  animation: gentleBeat 2.5s infinite ease-in-out;
}

@keyframes gentleBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Scroll Down Cue */
.hero-scroll {
  position: relative;
  z-index: 3;
  margin-bottom: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0;
  animation: heroFadeIn 1.2s ease 1s forwards;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.hero-scroll:hover {
  transform: translateY(4px);
}

.hero-scroll-icon {
  width: 20px;
  height: 20px;
  stroke: var(--accent-gold-dark);
  animation: bounceDown 2s infinite;
}

@keyframes bounceDown {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(6px); }
  60% { transform: translateY(3px); }
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================
   2. GALLERY SECTION (สไลด์รูปภาพแนวตั้งแบบมินิมอล)
   ========================================================== */
.gallery-section {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 5rem;
}

.section-intro {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-intro .section-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3.2vw, 1.6rem);
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.6rem;
}

.section-intro .section-divider {
  width: 48px;
  height: 2px;
  background: var(--accent-gold);
  margin: 1rem auto 0;
  border-radius: 999px;
  opacity: 0.6;
}

/* Photo Card */
.photo-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 3.75rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-smooth);
  opacity: 0;
  transform: translateY(45px);
  position: relative;
}

.photo-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.photo-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(197, 168, 128, 0.4);
}

/* Image Frame */
.photo-frame {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-card-inner);
  cursor: zoom-in;
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo-img {
  width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo-card:hover .photo-img {
  transform: scale(1.015);
}

/* Photo Meta & Caption */
.photo-details {
  padding: 1.25rem 0.5rem 0.35rem;
}

.photo-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.photo-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-dark);
}

.photo-date {
  font-size: 0.78rem;
  color: var(--text-light);
  font-feature-settings: "tnum";
}

.photo-caption {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.45;
  margin-bottom: 0.35rem;
}

.photo-subcaption {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Photo Interaction Bar */
.photo-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.like-btn {
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  transition: var(--transition-smooth);
}

.like-btn:hover {
  background: var(--accent-gold-soft);
  color: var(--accent-heart);
}

.like-btn.liked {
  color: var(--accent-heart);
}

.like-btn .heart-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: transparent;
  transition: var(--transition-smooth);
}

.like-btn.liked .heart-icon {
  fill: var(--accent-heart);
  stroke: var(--accent-heart);
  animation: popHeart 0.45s cubic-bezier(0.17, 0.89, 0.32, 1.49);
}

@keyframes popHeart {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ==========================================================
   3. CLOSING SECTION (หน้าปิดท้าย)
   ========================================================== */
.closing-section {
  position: relative;
  z-index: 2;
  background: linear-gradient(to bottom, var(--bg-main) 0%, #F5EEE2 100%);
  padding: 6rem 1.5rem 8rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.closing-container {
  max-width: 600px;
  margin: 0 auto;
}

.closing-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.closing-subtitle {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.03em;
  margin-bottom: 3rem;
}

.closing-subtitle .white-heart {
  color: var(--accent-heart);
  display: inline-block;
  font-style: normal;
}

/* Interactive Birthday Cake & Wish */
.cake-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
  transition: var(--transition-smooth);
}

.cake-visual {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Candle & Animated Realistic Flame */
.candle-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: -4px;
}

.flame {
  width: 14px;
  height: 24px;
  background: radial-gradient(ellipse at bottom, #FFF7D1 0%, #FFB703 60%, #FB8500 100%);
  border-radius: 50% 50% 35% 35%;
  box-shadow: 0 0 16px 4px rgba(255, 183, 3, 0.7), 0 0 35px 10px rgba(251, 133, 0, 0.3);
  animation: flicker 1.2s infinite alternate ease-in-out;
  transform-origin: center bottom;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.flame.extinguished {
  opacity: 0;
  transform: scale(0.2) translateY(-10px);
}

.candle-stick {
  width: 6px;
  height: 22px;
  background: linear-gradient(to right, #FAF3E0, #E4D5B7);
  border-radius: 3px 3px 0 0;
}

.cake-icon {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.08));
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1.5deg); }
  25% { transform: scale(1.05, 0.95) rotate(1.5deg); }
  50% { transform: scale(0.95, 1.05) rotate(-1deg); }
  75% { transform: scale(1.02, 0.98) rotate(1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.wish-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  background: var(--text-main);
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(45, 39, 34, 0.18);
  transition: var(--transition-smooth);
}

.wish-button:hover {
  transform: translateY(-2px);
  background: var(--accent-gold-dark);
  box-shadow: 0 8px 25px rgba(159, 130, 92, 0.3);
}

.wish-button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

/* Blessing Message (Appears when blown) */
.blessing-box {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px dashed var(--border-subtle);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(15px);
  transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.blessing-box.show {
  opacity: 1;
  max-height: 300px;
  transform: translateY(0);
}

.blessing-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.blessing-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-credits {
  font-size: 0.8rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
}

/* ==========================================================
   LIGHTBOX MODAL (คลิกดูภาพขยายใหญ่เต็มตา)
   ========================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(18, 15, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transform: scale(0.96);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox-modal.active .lightbox-img {
  transform: scale(1);
}

.lightbox-caption {
  margin-top: 1rem;
  color: #FFFFFF;
  font-size: 0.95rem;
  text-align: center;
  font-weight: 300;
  letter-spacing: 0.03em;
}

.lightbox-close {
  position: absolute;
  top: -42px;
  right: -10px;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.lightbox-close:hover {
  opacity: 1;
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

/* ==========================================================
   RESPONSIVE DESIGN (มือถือเป็นหลัก & สวยงามบนหน้าจอใหญ่)
   ========================================================== */
@media (max-width: 640px) {
  .hero-section {
    padding: 1.5rem 1rem;
  }
  
  .gallery-section {
    padding: 2.5rem 1rem 3.5rem;
  }
  
  .photo-card {
    padding: 1rem;
    margin-bottom: 2.75rem;
    border-radius: 20px;
  }
  
  .photo-details {
    padding: 1rem 0.25rem 0.25rem;
  }
  
  .cake-card {
    padding: 2rem 1.25rem;
  }
  
  .audio-toggle {
    top: 1rem;
    right: 1rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
  }
}
