/* ==========================================================================
   Three Years of Us — style.css
   Complements Tailwind utility classes in index.html.
   Only mechanics that Tailwind can't express well live here:
   scroll/hero reveal timing, decorative animation keyframes,
   the polaroid heart-shape gallery, and the 3D flip cards.
   ========================================================================== */

:root {
  --ease-dream: cubic-bezier(0.22, 1, 0.36, 1);
}

body.pre-login { overflow: hidden; height: 100vh; }

/* ---------- Photo-backed section backgrounds ----------
   A translucent pink gradient sits on top of a full-bleed photo (cover keeps
   the aspect ratio and crops the excess) so it reads softly behind the text. */
.bg-photo-login,
.bg-photo-hero,
.bg-photo-stillyou,
.bg-photo-gallery {
  background-color: #FFEAF0;
  background-image: var(--bg-gradient), var(--bg-photo);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
.bg-photo-hero,
.bg-photo-stillyou {
  --bg-photo: url('assets/bg.webp');
}
.bg-photo-gallery {
  --bg-photo: url('assets/bg-gallery.webp');
  --bg-gradient: linear-gradient(180deg, rgba(255, 248, 249, 0.72) 0%, rgba(255, 234, 240, 0.66) 50%, rgba(255, 248, 249, 0.74) 100%);
  background-position: center, 60% 30%;
}
.bg-photo-login {
  --bg-photo: url('assets/login2.webp');
  --bg-gradient: radial-gradient(circle at 50% 20%, rgba(255, 214, 224, 0.55) 0%, rgba(255, 234, 240, 0.62) 55%, rgba(255, 248, 249, 0.7) 100%);
}
.bg-photo-hero {
  --bg-gradient: radial-gradient(ellipse at 50% 0%, rgba(255, 214, 224, 0.55) 0%, rgba(255, 234, 240, 0.6) 45%, rgba(255, 248, 249, 0.7) 100%);
}
.bg-photo-stillyou {
  --bg-gradient: radial-gradient(ellipse at 50% 100%, rgba(255, 214, 224, 0.55) 0%, rgba(255, 234, 240, 0.6) 45%, rgba(255, 248, 249, 0.7) 100%);
}

/* ---------- Blurred photo texture for content sections ----------
   A heavily blurred, tiny copy of a photo gives the section depth and colour
   without competing with the cards on top of it. */
.bg-blur-a {
  background-color: #FFF8F9;
  background-image:
    linear-gradient(180deg, rgba(255, 248, 249, 0.62) 0%, rgba(255, 234, 240, 0.56) 100%),
    url('assets/bg-section-a.webp');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* ---------- Text over photos: soft glow instead of a solid card ----------
   A radial wash that fades to transparent keeps the photo visible around
   the text while still lifting contrast where the words actually sit.
   text-shadow inherits, so .text-glow on a wrapper covers all its text. */
.soft-glow {
  background: radial-gradient(
    ellipse 75% 70% at 50% 50%,
    rgba(255, 248, 249, 0.85) 0%,
    rgba(255, 240, 244, 0.62) 40%,
    rgba(255, 234, 240, 0.25) 68%,
    rgba(255, 234, 240, 0) 100%
  );
}
.text-glow {
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.95),
    0 0 24px rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(255, 255, 255, 0.9);
}

/* ---------- Login screen transitions ---------- */
#loginScreen.is-unlocked { opacity: 0; visibility: hidden; pointer-events: none; }
#loginCard.is-unlocking { opacity: 0; transform: scale(0.94) translateY(-10px); }

/* ---------- Scroll reveal ---------- */
.reveal-el {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-dream), transform 0.9s var(--ease-dream);
}
.reveal-el.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Hero staggered reveal ---------- */
.hero-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease-dream), transform 0.9s var(--ease-dream);
}
#hero.hero-play .hero-reveal[data-delay="0"] { opacity: 1; transform: none; transition-delay: 0.1s; }
#hero.hero-play .hero-reveal[data-delay="1"] { opacity: 1; transform: none; transition-delay: 0.9s; }
#hero.hero-play .hero-reveal[data-delay="2"] { opacity: 1; transform: none; transition-delay: 1.5s; }
#hero.hero-play .hero-reveal[data-delay="3"] { opacity: 1; transform: none; transition-delay: 2.1s; }
#hero.hero-play .hero-reveal[data-delay="4"] { opacity: 1; transform: none; transition-delay: 2.8s; }
#hero.hero-play .hero-reveal[data-delay="5"] { opacity: 1; transform: none; transition-delay: 3.3s; }

/* ---------- Still You staggered reveal ---------- */
.still-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.1s var(--ease-dream), transform 1.1s var(--ease-dream);
}
#stillYou.still-play .still-reveal[data-delay="0"] { opacity: 1; transform: none; transition-delay: 0.1s; }
#stillYou.still-play .still-reveal[data-delay="1"] { opacity: 1; transform: none; transition-delay: 1.1s; }
#stillYou.still-play .still-reveal[data-delay="2"] { opacity: 1; transform: none; transition-delay: 2.1s; }
#stillYou.still-play .still-reveal[data-delay="3"] { opacity: 1; transform: none; transition-delay: 3.3s; }
#stillYou.still-play .still-reveal[data-delay="4"] { opacity: 1; transform: none; transition-delay: 4.0s; }
#stillYou.still-play .still-reveal[data-delay="5"] { opacity: 1; transform: none; transition-delay: 4.9s; }
#stillYou.still-play .still-reveal[data-delay="6"] { opacity: 1; transform: none; transition-delay: 5.6s; }
#stillYou.still-play .still-reveal[data-delay="7"] { opacity: 1; transform: none; transition-delay: 6.3s; }

/* ==========================================================================
   Decorative layer (clouds / birds / butterflies / petals / hearts / sparkles)
   ========================================================================== */
.decor-item {
  position: absolute;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}
.decor-item img { width: 100%; height: 100%; display: block; }
.decor-paused .decor-item { animation-play-state: paused; }

@keyframes driftRight { from { transform: translateX(-20vw); } to { transform: translateX(120vw); } }
@keyframes driftLeft  { from { transform: translateX(120vw); } to { transform: translateX(-20vw); } }

@keyframes flyRight {
  0%   { transform: translate(-15vw, 0); }
  50%  { transform: translate(50vw, -18px); }
  100% { transform: translate(115vw, 0); }
}
@keyframes flyLeft {
  0%   { transform: translate(115vw, 0); }
  50%  { transform: translate(50vw, -18px); }
  100% { transform: translate(-15vw, 0); }
}
@keyframes flutterOnce {
  0%   { transform: translate(0, 0) rotate(-4deg); opacity: 0; }
  10%  { opacity: 1; }
  30%  { transform: translate(40px, -30px) rotate(6deg); }
  50%  { transform: translate(10px, -55px) rotate(-6deg); }
  70%  { transform: translate(-35px, -25px) rotate(4deg); }
  90%  { opacity: 1; }
  100% { transform: translate(0, -70px) rotate(0deg); opacity: 0; }
}
@keyframes fall {
  0%   { transform: translate(0, -10vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translate(var(--drift, 30px), 110vh) rotate(340deg); opacity: 0; }
}
@keyframes floatUp {
  0%   { transform: translate(0, 0) scale(0.8) rotate(-6deg); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 0.85; }
  100% { transform: translate(var(--drift, 10px), -70vh) scale(1.1) rotate(8deg); opacity: 0; }
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(90deg); }
}
@keyframes shakeErr {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.login-error.shake { animation: shakeErr 0.5s var(--ease-dream); }

/* ==========================================================================
   Polaroid Heart Gallery
   ========================================================================== */
.heart-gallery { aspect-ratio: 1 / 1.05; }

.polaroid {
  position: absolute;
  width: 13%;
  aspect-ratio: 0.85 / 1;
  background: transparent;
  padding: 0;
  box-shadow: none;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  transition: transform 0.35s var(--ease-dream), box-shadow 0.35s, z-index 0s;
  border: none;
  cursor: pointer;
  animation: polaroidFloat 6s ease-in-out infinite;
  animation-delay: var(--fdelay, 0s);
}
.polaroid-frame {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: linear-gradient(155deg, #FFD6E0, #F7A8B8);
  border: 1px solid rgba(217, 108, 133, 0.35);
  border-radius: 4px;
  padding: 6% 6% 16%;
  box-shadow: 0 4px 10px rgba(217, 108, 133, 0.25);
}
.polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}
.polaroid:focus-visible { outline: 3px solid #D96C85; outline-offset: 3px; }
@media (hover: hover) {
  .polaroid:hover {
    transform: translate(-50%, -50%) rotate(0deg) scale(1.18);
    z-index: 50 !important;
  }
  .polaroid:hover .polaroid-frame {
    box-shadow: 0 10px 22px rgba(217, 108, 133, 0.4);
  }
}
.polaroid:active { transform: translate(-50%, -50%) rotate(0deg) scale(1.1); }

@keyframes polaroidFloat {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -4px; }
}

@media (min-width: 640px)  { .polaroid { width: 11%; } }
@media (min-width: 1024px) { .polaroid { width: 9%; } }

/* ==========================================================================
   Love cards — 3D flip
   ========================================================================== */
.love-card { perspective: 1200px; }
.love-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 190px;
  transition: transform 0.7s var(--ease-dream);
  transform-style: preserve-3d;
}
.love-card.is-flipped .love-card-inner { transform: rotateY(180deg); }
.love-card-front, .love-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.love-card-back { transform: rotateY(180deg); }

/* Envelope look for the card front — signals "tap to open" at a glance. */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56%;
  background: linear-gradient(135deg, #FFD6E0, #F7A8B8);
  clip-path: polygon(0 0, 100% 0, 50% 72%);
}
.envelope-seal {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8899E, #D96C85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 12px rgba(217, 108, 133, 0.4), 0 0 0 3px #fff;
  animation: sealPulse 2.4s ease-in-out infinite;
}
@keyframes sealPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .envelope-seal { animation: none; }
}
/* Two-column phone layout: cards are narrower, so give the back text more
   height and shrink the envelope details to match. */
@media (max-width: 639px) {
  .love-card-inner { min-height: 224px; }
  .envelope-flap { height: 50%; clip-path: polygon(0 0, 100% 0, 50% 70%); }
  .envelope-seal { width: 40px; height: 40px; font-size: 1.15rem; top: 30%; }
}

/* ==========================================================================
   Gallery modal
   ========================================================================== */
.modal-content {
  transform: scale(0.92) translateY(10px);
  transition: transform 0.35s var(--ease-dream);
}
.gallery-modal.is-open {
  opacity: 1 !important;
  visibility: visible !important;
}
.gallery-modal.is-open .modal-content { transform: scale(1) translateY(0); }

/* ==========================================================================
   Song + floating lyrics
   ========================================================================== */
.lyric-toggle,
.lyric-gutter,
.lyric-mobile-ticker {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease-dream), visibility 0.6s var(--ease-dream);
}
body:not(.pre-login) .lyric-toggle,
body:not(.pre-login) .lyric-gutter,
body:not(.pre-login) .lyric-mobile-ticker {
  opacity: 1;
  visibility: visible;
}

.lyric-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #F7A8B8, #E8899E);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(217, 108, 133, 0.4);
  cursor: pointer;
}
.lyric-toggle:active { transform: scale(0.92); }
.lyric-toggle.is-playing { animation: toggleBeat 1.6s ease-in-out infinite; }
@keyframes toggleBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.lyric-mobile-ticker {
  position: fixed;
  left: 16px;
  right: 80px;
  bottom: 24px;
  z-index: 55;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.8rem;
  color: #8A6670;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(217, 108, 133, 0.18);
  pointer-events: none;
  /* Only shown as a text fallback when floating words are disabled (reduced motion). */
  display: none;
}

.lyric-gutter {
  position: fixed;
  top: 0;
  bottom: 0;
  width: clamp(84px, 30vw, 220px);
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
  display: block;
}
.lyric-gutter-left { left: 0; }
.lyric-gutter-right { right: 0; }

.lyric-word {
  position: absolute;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: clamp(1.15rem, 4.8vw, 1.7rem);
  color: #D96C85;
  white-space: nowrap;
  opacity: 0;
  animation: lyricFloat 3.6s ease-out forwards;
}
@keyframes lyricFloat {
  0%   { opacity: 0; transform: translateY(10px); }
  15%  { opacity: 0.9; }
  75%  { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-46px); }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .reveal-el, .hero-reveal, .still-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .decor-item, .polaroid, .lyric-word, .lyric-toggle.is-playing { animation: none !important; }
  .love-card-inner, .modal-content, #loginScreen, #loginCard {
    transition-duration: 0.01ms !important;
  }
  .lyric-gutter { display: none; }
  .lyric-mobile-ticker { display: block; }
}
