/* =============================================
   MOTHER'S DAY ECARD — style.css
   ============================================= */

:root {
  --pink-dark:  #c2185b;
  --pink-mid:   #e91e8c;
  --pink-light: #f8bbd0;
  --cream:      #fff8f0;
  --text-dark:  #4a1535;
}

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

html, body {
  height: 100%;           /* needed so scenes can fill 100vh reliably */
}

body {
  font-family: 'Lato', sans-serif;
  background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 40%, #fce4ec 100%);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;       /* no page scroll — each scene handles its own */
  position: relative;
}

/* =============================================
   MUSIC BUTTON — fixed in top-right corner
   ============================================= */

#music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(6px);
  border: 2px solid var(--pink-light);
  color: var(--pink-dark);
  box-shadow: 0 4px 14px rgba(194,24,91,0.2);
  transition: transform 0.2s ease, background 0.2s ease;
  /* Override the shared button gradient for this one */
  font-family: inherit;
}

#music-btn:hover {
  background: rgba(255,255,255,0.8);
  transform: scale(1.1);
}

/* Muted state — dimmed icon */
#music-btn.muted {
  opacity: 0.45;
}

/* =============================================
   FLOATING PETALS
   ============================================= */

.petal {
  position: fixed;
  top: -60px;
  animation: fall linear infinite;
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

@keyframes fall {
  0%   { transform: translateY(0)     rotate(0deg);   opacity: 0.8; }
  50%  { transform: translateY(50vh)  rotate(180deg); opacity: 0.6; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0;   }
}

/* =============================================
   SCENES
   ============================================= */

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  /* Slower, silkier fade between scenes */
  transition: opacity 1s ease;
  z-index: 10;
}

.scene.active {
  opacity: 1;
  pointer-events: all;
}

/* =============================================
   SCENE 1 — ENVELOPE
   ============================================= */

#envelope-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-12px); }
}

#envelope {
  width: 260px;
  height: 180px;
  background: var(--cream);
  border-radius: 8px;
  border: 3px solid var(--pink-dark);
  position: relative;
  box-shadow: 0 12px 40px rgba(194, 24, 91, 0.25);
}

#flap {
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  border-left:  130px solid transparent;
  border-right: 130px solid transparent;
  border-top:   100px solid var(--pink-light);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
  transition: transform 0.6s ease;
  transform-origin: top center;
}

#envelope.open #flap {
  transform: rotateX(180deg);
}

#seal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  transition: transform 0.3s ease;
}
#seal:hover { transform: translate(-50%, -50%) scale(1.2); }

/* Shared button style */
button {
  font-family: 'Pacifico', cursive;
  color: white;
  background: linear-gradient(135deg, var(--pink-mid), var(--pink-dark));
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
button:hover  { transform: scale(1.08); box-shadow: 0 8px 28px rgba(233,30,140,0.55); }
button:active { transform: scale(0.96); }

#open-btn {
  font-size: 1.3rem;
  padding: 14px 36px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(233,30,140,0.4); }
  50%       { box-shadow: 0 6px 35px rgba(233,30,140,0.75); }
}

/* =============================================
   SCENE 2A — SPOTLIGHT
   ============================================= */

#spotlight-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 20px;
  max-width: 700px;
  width: 90%;
  text-align: center;
}

#spotlight-line {
  font-family: 'Pacifico', cursive;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  color: var(--text-dark);
  line-height: 1.4;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.6);
  min-height: 1.4em;
}

/* Entrance: fades in + scales up gently */
#spotlight-line.enter {
  animation: spotEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes spotEnter {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* Exit: fades out + drifts upward */
#spotlight-line.exit {
  animation: spotExit 0.5s ease forwards;
}

@keyframes spotExit {
  to { opacity: 0; transform: translateY(-24px) scale(0.95); }
}

/* Progress dots */
#progress-dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(194, 24, 91, 0.22);
  transition: background 0.4s ease, transform 0.3s ease;
}

.dot.filled {
  background: var(--pink-dark);
  transform: scale(1.3);
}

/* =============================================
   SCENE 2B — FULL LETTER  (fits the screen)
   ============================================= */

/* The scene itself takes the full viewport but doesn't scroll */
#scene-letter {
  padding: 16px;
  align-items: stretch;     /* let the inner box stretch to fit */
}

/*
  letter-wrap is a flex column that fills the viewport height.
  The scroll area inside it grows to fill available space,
  so the header and button stay visible without scrolling the page.
*/
#letter-wrap {
  background: var(--cream);
  border-radius: 16px;

  /* Responsive padding: smaller on small screens */
  padding: clamp(16px, 3vw, 36px) clamp(18px, 4vw, 44px);

  max-width: 520px;
  width: 100%;

  /* Fill the height of the scene minus the scene padding */
  max-height: calc(100vh - 32px);

  display: flex;
  flex-direction: column;   /* stack header / scroll-area / button */

  box-shadow: 0 20px 60px rgba(194, 24, 91, 0.2);
  border-top: 6px solid var(--pink-dark);
  position: relative;
  animation: slideUp 0.7s ease;
}

@keyframes slideUp {
  from { transform: translateY(50px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#letter-header {
  font-family: 'Pacifico', cursive;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--pink-dark);
  text-align: center;
  /* Fixed height — doesn't shrink */
  flex-shrink: 0;
  padding-bottom: clamp(10px, 2vh, 20px);
  border-bottom: 1px dashed var(--pink-light);
  margin-bottom: clamp(8px, 1.5vh, 16px);
}

/*
  This area grows to fill whatever space is left between
  the header and the button. It scrolls ONLY if the text
  is too tall even for the shrunk-down size.
*/
#letter-scroll-area {
  flex: 1;                  /* take up all remaining vertical space */
  overflow-y: auto;         /* scroll only this box, not the page */
  padding-right: 4px;       /* small gap so scrollbar doesn't overlap text */

  /* Lined paper effect — on the scroll area, not the whole card */
  background: repeating-linear-gradient(
    transparent,
    transparent 1.7em,
    #f8bbd0 1.8em
  );
}

.letter-line {
  /* Font size scales down on small screens */
  font-size: clamp(0.82rem, 2.2vw, 1rem);
  color: var(--text-dark);
  line-height: 1.8em;       /* matches the lined-paper stripe height */
  opacity: 0;
  animation: lineAppear 0.4s ease forwards;
}

@keyframes lineAppear {
  to { opacity: 1; }
}

/* Signature — right-aligned like a real letter */
#letter-signature {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-top: clamp(10px, 2vh, 20px);
  padding-top: 10px;
  border-top: 1px dashed var(--pink-light);
  opacity: 0;
  animation: lineAppear 0.6s ease forwards;
}

#sig-love { font-size: 0.88rem; color: var(--text-dark); font-style: italic; }
#sig-name { font-family: 'Pacifico', cursive; font-size: 1.35rem; color: var(--pink-dark); }
#sig-date { font-size: 0.78rem; color: #a0607a; letter-spacing: 0.04em; }

/* Button sits at the bottom, never hidden */
#finish-btn {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  padding: 10px 28px;
  display: block;
  flex-shrink: 0;
  margin: clamp(10px, 2vh, 20px) auto 0;
}

/* =============================================
   SCENE 3 — FINAL MESSAGE
   ============================================= */

#final-message {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#big-smile {
  font-size: clamp(5rem, 15vw, 8rem);
  animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  0%   { transform: scale(0);   opacity: 0; }
  70%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

#big-smile.wiggle {
  animation: bounceIn 0.8s ease, wiggle 1.5s 0.8s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg) scale(1);   }
  50%       { transform: rotate(5deg)  scale(1.05); }
}

#final-text {
  font-family: 'Pacifico', cursive;
  font-size: clamp(1.8rem, 6vw, 3.5rem);
  color: var(--pink-dark);
  text-shadow: 2px 2px 0 var(--pink-light), 4px 4px 12px rgba(194,24,91,0.2);
  opacity: 0;
  animation: fadeInUp 0.7s 0.4s ease forwards;
}

#final-sub {
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  color: var(--pink-mid);
  opacity: 0;
  animation: fadeInUp 0.7s 0.7s ease forwards;
}

#final-name {
  font-family: 'Pacifico', cursive;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--text-dark);
  opacity: 0;
  animation: fadeInUp 0.7s 1s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

#replay-btn {
  font-size: 1rem;
  padding: 12px 28px;
  opacity: 0;
  animation: fadeInUp 0.7s ease forwards;
}
