/* css/card.css */

/* Stages */
.stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.stage.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

/* =========================================================
   1. 3D WAX-SEALED ENVELOPE STAGE
   ========================================================= */
#envelope-stage {
  perspective: 1200px;
  min-height: 80vh;
  justify-content: center;
}

.envelope-wrapper {
  position: relative;
  width: 340px;
  height: 240px;
  background: #c0392b;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  transform-style: preserve-3d;
}

.envelope-wrapper:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 35px 70px rgba(0, 0, 0, 0.85);
}

/* Envelope Flaps */
.envelope-flap-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 170px solid transparent;
  border-right: 170px solid transparent;
  border-top: 135px solid #d63031;
  transform-origin: top;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
}

.envelope-flap-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 120px solid transparent;
  border-bottom: 120px solid transparent;
  border-left: 185px solid #b71540;
  border-radius: 12px 0 0 12px;
  z-index: 3;
}

.envelope-flap-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 120px solid transparent;
  border-bottom: 120px solid transparent;
  border-right: 185px solid #a4133c;
  border-radius: 0 12px 12px 0;
  z-index: 3;
}

.envelope-flap-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 170px solid transparent;
  border-right: 170px solid transparent;
  border-bottom: 140px solid #800f2f;
  border-radius: 0 0 12px 12px;
  z-index: 4;
}

/* Wax Seal */
.wax-seal {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at 35% 35%, #e84393, #800f2f 75%);
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), inset 0 2px 5px rgba(255, 255, 255, 0.4);
  border: 3px solid #d4af37;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.wax-seal::after {
  content: '❤️';
  font-size: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.wax-seal-badge {
  position: absolute;
  top: 195px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid var(--color-gold);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: pulseGlow 2.5s infinite;
  z-index: 7;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    transform: translateX(-50%) scale(1);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 94, 126, 0.7);
    transform: translateX(-50%) scale(1.05);
  }
}

/* Envelope Open Animation */
.envelope-wrapper.open .envelope-flap-top {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope-wrapper.open .wax-seal {
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.envelope-wrapper.open .wax-seal-badge {
  opacity: 0;
  pointer-events: none;
}

/* Letter peek inside envelope */
.envelope-letter-peek {
  position: absolute;
  bottom: 15px;
  left: 20px;
  width: 300px;
  height: 200px;
  background: var(--paper-cream);
  border-radius: 8px 8px 0 0;
  z-index: 2;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  text-align: center;
}

.envelope-wrapper.open .envelope-letter-peek {
  transform: translateY(-160px);
}

/* =========================================================
   2. READING STAGE (PARCHMENT LETTER & CONTENT)
   ========================================================= */
#letter-stage {
  max-width: 500px;
  width: 100%;
}

.letter-sheet {
  width: 100%;
  background: var(--paper-cream);
  border-radius: 20px;
  padding: 32px 24px 40px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(212, 175, 55, 0.1);
  border: 1px solid var(--paper-border);
  position: relative;
  overflow: hidden;
}

.letter-sheet::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 2px solid rgba(212, 175, 55, 0.35);
  border-radius: 14px;
  pointer-events: none;
}

.letter-header {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
}

.letter-badge-ribbon {
  display: inline-block;
  background: linear-gradient(135deg, var(--color-love-primary), var(--color-love-dark));
  color: #fff;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px var(--color-love-glow);
}

.letter-title {
  font-family: var(--font-script);
  font-size: 2.8rem;
  color: var(--color-love-dark);
  line-height: 1.2;
  margin-bottom: 6px;
}

.letter-recipient {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--color-gold);
  font-style: italic;
  font-weight: 600;
}

.letter-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--color-gold), transparent);
  margin: 16px auto 20px;
}

/* Typewriter Area */
.typewriter-wrapper {
  margin-bottom: 30px;
  position: relative;
}

.typewriter-text {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-main);
  min-height: 120px;
}

.typewriter-paragraph {
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.typewriter-paragraph.visible {
  opacity: 1;
  transform: translateY(0);
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: var(--color-love-primary);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.skip-typewriter-btn {
  background: none;
  border: 1px dashed rgba(212, 175, 55, 0.6);
  color: var(--color-gold);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 8px;
  display: block;
  margin-left: auto;
  transition: all 0.2s ease;
}

.skip-typewriter-btn:hover {
  background: rgba(212, 175, 55, 0.1);
}

/* =========================================================
   3. POLAROID MEMORIES GALLERY
   ========================================================= */
.polaroid-gallery {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin: 32px 0 40px;
  width: 100%;
}

.polaroid-card {
  background: #ffffff;
  padding: 14px 14px 22px;
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.polaroid-card:nth-child(odd) {
  transform: rotate(-2deg);
}

.polaroid-card:nth-child(even) {
  transform: rotate(2.5deg);
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

.polaroid-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 26px;
  background: rgba(245, 215, 110, 0.65);
  backdrop-filter: blur(2px);
  border-left: 2px dashed rgba(212, 175, 55, 0.5);
  border-right: 2px dashed rgba(212, 175, 55, 0.5);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.polaroid-img-wrapper {
  width: 100%;
  height: 280px;
  overflow: hidden;
  border-radius: 2px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.polaroid-card:hover .polaroid-img-wrapper img {
  transform: scale(1.05);
}

.polaroid-caption {
  font-family: var(--font-script);
  font-size: 1.5rem;
  color: var(--text-main);
  text-align: center;
  margin-top: 14px;
}

.polaroid-date {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* =========================================================
   4. CAKE & CANDLE CEREMONY STAGE
   ========================================================= */
.cake-ceremony-section {
  text-align: center;
  padding: 30px 16px 20px;
  background: rgba(255, 240, 243, 0.6);
  border-radius: 18px;
  border: 1px dashed rgba(255, 94, 126, 0.4);
  margin-top: 20px;
}

.cake-ceremony-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--color-love-dark);
  margin-bottom: 8px;
}

.cake-ceremony-section p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Cake Illustration */
.cake-graphic {
  position: relative;
  width: 180px;
  height: 160px;
  margin: 0 auto 24px;
}

.cake-bottom-tier {
  position: absolute;
  bottom: 0;
  left: 10px;
  width: 160px;
  height: 65px;
  background: linear-gradient(to right, #ffccd5, #ffb3c1, #ffccd5);
  border-radius: 12px 12px 20px 20px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid #fff;
}

.cake-top-tier {
  position: absolute;
  bottom: 60px;
  left: 35px;
  width: 110px;
  height: 50px;
  background: linear-gradient(to right, #fff0f3, #ffccd5, #fff0f3);
  border-radius: 10px 10px 14px 14px;
  border: 2px solid #fff;
}

.cake-candle {
  position: absolute;
  bottom: 110px;
  left: 84px;
  width: 12px;
  height: 38px;
  background: repeating-linear-gradient(45deg, #f5d76e, #f5d76e 6px, #ff5e7e 6px, #ff5e7e 12px);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.candle-flame {
  position: absolute;
  top: -24px;
  left: -4px;
  width: 20px;
  height: 28px;
  background: radial-gradient(ellipse at 50% 80%, #ffffff 0%, #f5d76e 40%, #e67e22 80%, transparent 100%);
  border-radius: 50% 50% 20% 20%;
  animation: flicker 1s infinite alternate ease-in-out;
  box-shadow: 0 0 20px rgba(245, 215, 110, 0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1deg); }
  50% { transform: scale(1.08) rotate(2deg); }
  100% { transform: scale(0.95) rotate(-2deg); }
}

.candle-smoke {
  position: absolute;
  top: -20px;
  left: 2px;
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
}

.cake-graphic.blown .candle-flame {
  opacity: 0;
  transform: scale(0);
}

.cake-graphic.blown .candle-smoke {
  animation: riseHeartSmoke 2.5s ease-out forwards;
}

@keyframes riseHeartSmoke {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  30% { opacity: 0.9; transform: translateY(-30px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-90px) scale(1.6); }
}

/* Wish Reveal Box */
.wish-reveal-box {
  margin-top: 20px;
  padding: 18px 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 2px solid var(--color-gold);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
  animation: popIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.wish-reveal-box h4 {
  font-family: var(--font-script);
  font-size: 2rem;
  color: var(--color-love-dark);
  margin-bottom: 6px;
}

.wish-reveal-box p {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Letter Footer */
.letter-footer {
  text-align: center;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.3);
}

.letter-sign-off {
  font-family: var(--font-script);
  font-size: 2.2rem;
  color: var(--color-love-primary);
  margin-bottom: 4px;
}

.letter-date {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* =========================================================
   5. PHOTO ZOOM LIGHTBOX MODAL
   ========================================================= */
.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.photo-modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  border: 4px solid #fff;
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.85); }
  to { transform: scale(1); }
}

.photo-modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   6. LOVE DAYS BADGE & TOUCH HEART PARTICLES
   ========================================================= */
.love-days-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255, 94, 126, 0.12), rgba(212, 175, 55, 0.15));
  border: 1px solid rgba(255, 94, 126, 0.35);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-love-dark);
  box-shadow: 0 4px 12px rgba(255, 94, 126, 0.15);
  margin-top: 8px;
  animation: floatSoft 3s ease-in-out infinite;
}

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

.touch-heart-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  user-select: none;
  font-size: 22px;
  animation: floatAndFadeHeart 1.1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  filter: drop-shadow(0 2px 6px rgba(255, 94, 126, 0.5));
}

@keyframes floatAndFadeHeart {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.6) rotate(0deg);
  }
  30% {
    opacity: 1;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 40px)) scale(1.3) rotate(var(--rot, 15deg));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px) * 1.5), calc(-50% - 100px)) scale(0.85) rotate(var(--rot, 30deg));
  }
}

/* =========================================================
   7. PRANK SLEEPING TROLL MODAL
   ========================================================= */
.prank-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  animation: prankBackdropFadeIn 0.35s ease forwards;
}

.prank-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 10, 15, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.prank-card {
  position: relative;
  z-index: 1;
  max-width: 380px;
  width: 92%;
  background: linear-gradient(145deg, #ffffff, #fff5f7);
  border-radius: 24px;
  border: 3px solid var(--color-gold);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 107, 139, 0.35);
  padding: 20px 18px 22px;
  text-align: center;
  animation: prankCardPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes prankCardPopIn {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-6deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.06) rotate(2deg);
  }
  80% {
    transform: scale(0.97) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes prankBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.prank-modal.closing {
  pointer-events: none;
  animation: prankModalFadeOut 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes prankModalFadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.85);
  }
}

.prank-sleeping-badge {
  display: inline-block;
  background: #ffe3ea;
  color: #c92a42;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 12px;
  border: 1px dashed #ff8fab;
}

.prank-img-wrapper {
  position: relative;
  width: 100%;
  max-height: 48vh;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid #ffccd5;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.1), 0 8px 24px rgba(0,0,0,0.15);
  background: #fbf5f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prank-img-wrapper img {
  width: 100%;
  height: 100%;
  max-height: 48vh;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.prank-card:hover .prank-img-wrapper img {
  transform: scale(1.03);
}

.prank-title {
  margin: 16px 0 6px;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: #b31b34;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(255, 182, 193, 0.4);
}

.prank-hint {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: #886b75;
  animation: pulseHint 1.6s ease-in-out infinite;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.55; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

