@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&family=Great+Vibes&family=Dancing+Script:wght@400;500;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Cormorant Garamond', serif;
  background-color: #fff8fa; /* Dasar paling belakang */
  color: #4a2333;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================================
   HERO SECTION
   ================================ */
canvas#scene {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 3; /* Dinaikkan agar berada di atas background section--hero */
  pointer-events: none;
}

.section--hero {
  position: fixed; /* Hero tetap diam di belakang */
  top: 0; left: 0; width: 100%;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  background: radial-gradient(circle at 50% 40%, #fff8fa 0%, #fff2f5 40%, #ffe8ee 70%, #ffdce5 100%); /* Latar hero, menyembunyikan bubbles di awal */
}

.hero {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 28px;
  pointer-events: none;
}

.hero__sub {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.12em;
  color: rgba(180, 80, 110, 0);
  margin-bottom: 18px;
  transition: color 1.6s cubic-bezier(.4,0,.2,1), transform 1.6s cubic-bezier(.4,0,.2,1);
  transform: translateY(16px);
}

.hero__sub.show {
  color: rgba(180, 80, 110, 0.7);
  transform: translateY(0);
}

.hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #c94070;
  margin-bottom: 12px;
  overflow: hidden;
}

.hero__title .word {
  display: inline-block;
  margin-right: 0.3em;
}

.hero__title .letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(55px) rotateX(40deg);
  filter: blur(6px);
  transition: opacity 0.7s cubic-bezier(.4,0,.2,1),
              transform 0.7s cubic-bezier(.22,1,.36,1),
              filter 0.7s cubic-bezier(.4,0,.2,1),
              text-shadow 1.2s ease;
}

.hero__title .letter.visible {
  opacity: 1;
  transform: translateY(0) rotateX(0deg);
  filter: blur(0);
  text-shadow: 0 0 20px rgba(200, 60, 100, 0.15),
               0 0 50px rgba(200, 60, 100, 0.06);
}

.hero__name-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero__name {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.8rem, 11vw, 5.5rem);
  font-weight: 400;
  line-height: 1.1;
  color: transparent;
  background: linear-gradient(135deg, #d44a6e 0%, #e8758f 25%, #c94070 50%, #e0627e 75%, #d44a6e 100%);
  background-size: 300% 300%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  transform: translateY(30px) scale(0.8);
  filter: blur(12px) drop-shadow(0 0 0px transparent);
  position: relative;
  text-align: center;
}

.hero__name--sub {
  font-family: 'Dancing Script', cursive;
  font-weight: 400; /* Dibuat regular/light, tidak bold */
  font-size: clamp(1.1rem, 4vw, 2.2rem); /* Dibuat lebih kecil dan ringan */
  margin-top: -8px; 
  letter-spacing: 1px; 
  margin-right: -1px; 
}

/* Efek Getaran (Shockwave) menggunakan ghost text */
.hero__name::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  color: transparent;
  background: linear-gradient(135deg, #d44a6e 0%, #e8758f 25%, #c94070 50%, #e0627e 75%, #d44a6e 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}

.hero__name.show {
  /* Animasi mulus tanpa bounce, tetap cepat dan sinkron dengan ledakan */
  animation: 
    nameReveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
    nameShimmer 3s 1.2s ease-in-out forwards, 
    nameGlow 4s 1.8s ease-in-out infinite alternate;
}

.hero__name.show::after {
  animation: textShockwave 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes textShockwave {
  0% { transform: scale(1); opacity: 0.8; filter: blur(2px); }
  100% { transform: scale(1.35); opacity: 0; filter: blur(12px); }
}

@keyframes nameReveal {
  0% {
    opacity: 0;
    transform: translateY(25px) scale(0.95);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes nameShimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes nameGlow {
  0%   { text-shadow: 0 2px 8px rgba(200, 60, 100, 0.12), 0 0 30px rgba(220, 80, 120, 0.06); }
  100% { text-shadow: 0 2px 12px rgba(200, 60, 100, 0.22), 0 0 50px rgba(220, 80, 120, 0.1); }
}

.hero__decor {
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.34,1.56,.64,1);
  margin-top: 12px;
}

.hero__decor.show {
  opacity: 1;
  transform: scale(1);
  animation: decorFloat 3s 0.3s ease-in-out infinite alternate;
}

@keyframes decorFloat {
  0%   { transform: scale(1) translateY(0); filter: drop-shadow(0 0 5px rgba(212, 74, 110, 0.4)); }
  100% { transform: scale(1.08) translateY(-6px); filter: drop-shadow(0 0 15px rgba(212, 74, 110, 0.8)); }
}

.hero__scroll {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
  animation: scrollFloat 2.5s ease-in-out infinite alternate;
}

@keyframes scrollFloat {
  0% { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-50%) translateY(-8px); }
}

.hero__scroll.show { opacity: 1; }

.hero__scroll span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(180, 60, 90, 0.85); /* Lebih tebal dan gelap agar terbaca jelas */
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6); /* Glow putih halus untuk kontras */
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, rgba(180, 60, 90, 0.6), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  50.1% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ================================
   HANGING DECOR (Top Corners)
   ================================ */
.hero__hanging-decor {
  position: absolute;
  top: 0;
  display: flex;
  gap: 15px;
  padding: 0 40px;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 1.5s ease, transform 1.5s ease;
  z-index: 5;
  pointer-events: none;
}
.hero__hanging-decor.show {
  opacity: 1;
  transform: translateY(0);
}
.hero__hanging-decor--left { left: 0; }
.hero__hanging-decor--right { right: 0; flex-direction: row-reverse; }

.hero__hanging-decor .drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sway 4s ease-in-out infinite alternate;
  transform-origin: top center;
}
.hero__hanging-decor .drop:nth-child(1) { animation-delay: 0s; }
.hero__hanging-decor .drop:nth-child(2) { animation-delay: 1.2s; }
.hero__hanging-decor .drop:nth-child(3) { animation-delay: 2.4s; }

.hero__hanging-decor .drop:nth-child(1) .line { height: 120px; }
.hero__hanging-decor .drop:nth-child(2) .line { height: 80px; }
.hero__hanging-decor .drop:nth-child(3) .line { height: 45px; }

.hero__hanging-decor .line {
  width: 1px;
  background: linear-gradient(to bottom, rgba(212, 74, 110, 0.4), rgba(212, 74, 110, 0.1));
}

.hero__hanging-decor .star {
  color: rgba(212, 74, 110, 0.6);
  font-size: 14px;
  margin-top: 5px;
  animation: starTwinkle 2s infinite alternate;
}

@keyframes sway {
  0% { transform: rotate(-3deg); }
  100% { transform: rotate(3deg); }
}
@keyframes starTwinkle {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); text-shadow: 0 0 5px rgba(212,74,110,0.5); }
}

/* ================================
   LETTER SECTION
   ================================ */
.section--letter {
  position: relative;
  margin-top: 100vh; /* Memberikan ruang scroll agar hero terlihat di awal */
  min-height: 100vh;
  z-index: 10;
  /* overflow: hidden; Dihapus agar gradasi tepi atas bisa keluar */
}

/* --- Floating Memory Bubbles Background --- */
.letter-video-bg {
  position: fixed; /* Berubah menjadi fixed agar statis di background */
  inset: 0;
  z-index: 1; /* Berada tepat di bawah hero section (z-index: 2) */
  overflow: hidden;
  /* Dihapus: background dan opacity di sini agar video tidak nge-lag saat di-composite oleh browser */
}

/* Layer terpisah khusus untuk transisi warna background agar tidak membebani video */
.letter-video-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #fff8fa;
  /* Mesh Gradient yang kaya dan bertekstur lembut */
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(255, 180, 200, 0.6) 0%, transparent 35%),
    radial-gradient(circle at 85% 25%, rgba(255, 220, 235, 0.7) 0%, transparent 40%),
    radial-gradient(circle at 25% 45%, rgba(255, 190, 215, 0.5) 0%, transparent 45%),
    radial-gradient(circle at 75% 65%, rgba(255, 175, 205, 0.6) 0%, transparent 40%),
    radial-gradient(circle at 15% 85%, rgba(255, 210, 230, 0.7) 0%, transparent 35%),
    radial-gradient(circle at 85% 95%, rgba(255, 195, 225, 0.5) 0%, transparent 45%);
  opacity: 1; /* Selalu tampil, disembunyikan oleh hero section di depannya */
  pointer-events: none;
  z-index: -1;
}

.bubble {
  position: absolute;
  /* Bentuk dasar organik, akan dianimasikan oleh keyframes morphBubble */
  border-radius: 50%;
  object-fit: cover;
  /* Dihapus: mask-image sangat membebani GPU saat diterapkan pada video yang sedang dimainkan */
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 10px 30px rgba(200, 60, 100, 0.15),
    0 0 20px rgba(255, 255, 255, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.8);
  opacity: 0;
  z-index: 1;
  will-change: transform, opacity, border-radius;
  transform: translateZ(0); /* Memaksa hardware acceleration */
  animation: morphBubble 8s ease-in-out infinite alternate;
}

/* Animasi bentuk organik (seperti tetesan air yang melayang) */
@keyframes morphBubble {
  0% {
    border-radius: 50%;
  }
  33% {
    border-radius: 45% 55% 48% 52% / 55% 45% 52% 48%;
  }
  66% {
    border-radius: 52% 48% 55% 45% / 48% 52% 45% 55%;
  }
  100% {
    border-radius: 48% 52% 45% 55% / 52% 48% 55% 45%;
  }
}

/* --- Pernak-pernik (Sparkles) Surat --- */
.letter-sparkle {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #ffecf0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 12px 3px rgba(255, 150, 180, 0.8); /* Warna pink terang agar kontras */
  z-index: 2;
  opacity: 0;
  will-change: transform, opacity;
}

/* Orb cahaya lembut seperti kunang-kunang di laut */
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 140, 180, 0.6) 0%, rgba(255, 180, 210, 0) 70%); /* Warna pink/peach solid */
  /* mix-blend-mode dihapus karena background putih membuat efek screen tidak terlihat */
  z-index: 1;
  opacity: 0;
  will-change: transform, opacity;
}

/* Hati melayang di background video */
.floating-heart {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  will-change: transform, opacity;
  color: rgba(255, 100, 150, 0.6);
  font-size: 14px;
  filter: drop-shadow(0 0 5px rgba(255, 100, 150, 0.8));
}

/* Video indicator dots (removed for marquee design) */

/* --- Letter Content --- */
.letter-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 20px 50vh 20px; /* Ditambahkan padding-bottom 50vh agar ada ruang sisa di bawah */
  gap: 12rem; /* Jarak antar card paragraf dibuat ekstra lebar agar gelembung memori terlihat jelas saat di-scroll */
}

.letter-card {
  max-width: 550px; /* Sedikit dilebarkan agar teks tidak terlalu panjang ke bawah */
  width: 100%;
  padding: 2.5rem 1.8rem;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow:
    0 8px 32px rgba(200, 60, 100, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.5) inset;
  transform: translateY(40px);
  opacity: 0;
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.letter-icon {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(.4,0,.2,1);
}

.letter-icon.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.85rem;
  font-weight: 300;
  font-style: italic;
  color: rgba(180, 80, 110, 0.6);
  text-align: right;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(.4,0,.2,1);
}

.letter-date.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter-salutation {
  font-family: 'Great Vibes', cursive;
  font-size: 1.6rem;
  color: #c94070;
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(.4,0,.2,1);
}

.letter-salutation.visible {
  opacity: 1;
  transform: translateY(0);
}

.letter-card .letter-body {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
  color: #5a2a3a;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(25px);
  transition: all 0.9s cubic-bezier(.4,0,.2,1);
}

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

.letter-closing {
  font-family: 'Great Vibes', cursive;
  font-size: 1.3rem;
  color: #c94070;
  text-align: right;
  margin-top: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(.4,0,.2,1);
}

.letter-closing.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================
   SCROLL REVEAL UTILITY
   ================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(.4,0,.2,1), transform 0.8s cubic-bezier(.4,0,.2,1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (min-width: 768px) {
  .hero__sub { font-size: 1.15rem; letter-spacing: 0.18em; margin-bottom: 24px; }
  .hero__title { letter-spacing: 0.06em; margin-bottom: 16px; }
  .hero__name { line-height: 1.2; }
  .hero__scroll { bottom: 48px; }

  .letter-card { padding: 3rem 2.5rem; }
  .letter-card .letter-body { font-size: 1.08rem; }
  .letter-salutation { font-size: 1.8rem; }
}

/* ================================
   MUSIC PLAYER TOGGLE
   ================================ */
.music-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #c94070;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(200, 60, 100, 0.2);
}

.music-toggle:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: scale(1.1);
}

.music-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.music-toggle.playing .icon-play { display: none; }
.music-toggle.playing .icon-pause { display: block; }
.music-toggle:not(.playing) .icon-play { display: block; }
.music-toggle:not(.playing) .icon-pause { display: none; }
