/* ─────────────────────────────────────────────────────────
   CINEMATIC INTRO — intro.css
   Stage 1: Envelope Reveal
   Stage 2: Scroll-to-Break Seal → Card Unfurl
   Clean rewrite. No keypad/lock.
   ───────────────────────────────────────────────────────── */

/* ── OVERLAY ─────────────────────────────────────────── */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: #1a140a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.8s ease;
}
#intro-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ── ENVELOPE WRAPPER ────────────────────────────────── */
.intro-env-wrapper {
  position: relative;
  width: min(400px, 85vw);
  perspective: 800px;
  animation: envRise 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both,
             envFloat 4s ease-in-out 0.9s infinite;
}

@keyframes envRise {
  from { transform: translateY(35vh); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes envFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-8px) scale(1.015); }
}

/* ── ENVELOPE BODY ───────────────────────────────────── */
.intro-env-body {
  width: 100%;
  aspect-ratio: 1.55;
  background: linear-gradient(145deg, #faf7f2 0%, #f0e8d8 45%, #e8dcc8 100%);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.5);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* ── ENVELOPE FLAP ───────────────────────────────────── */
.intro-env-flap {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #f5ede0 0%, #ede1d0 60%, #e0d0bc 100%);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  z-index: 3;
  transform-origin: top center;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.intro-env-flap.open {
  transform: rotateX(-155deg);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── WAX SEAL ────────────────────────────────────────── */
.intro-env-seal {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  z-index: 5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.intro-env-seal svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}
.intro-env-seal.gone {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  pointer-events: none;
}

/* ── SEAL FRAGMENTS ──────────────────────────────────── */
.intro-seal-pieces {
  position: absolute;
  top: 46%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  z-index: 4;
  pointer-events: none;
}
.intro-seal-piece {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: #8B3A3A;
  border: 1px solid rgba(255,255,255,0.08);
}
.intro-seal-piece.fly1 { clip-path: polygon(50% 50%, 85% 10%, 100% 30%, 70% 60%); }
.intro-seal-piece.fly2 { clip-path: polygon(50% 50%, 15% 10%, 0% 30%, 30% 60%); }
.intro-seal-piece.fly3 { clip-path: polygon(50% 50%, 80% 60%, 100% 85%, 70% 95%); }
.intro-seal-piece.fly4 { clip-path: polygon(50% 50%, 20% 60%, 0% 85%, 30% 95%); }

@keyframes piece1 { to { opacity:0; transform: translate(38px,-48px) rotate(60deg) scale(0.2); } }
@keyframes piece2 { to { opacity:0; transform: translate(-34px,-44px) rotate(-45deg) scale(0.2); } }
@keyframes piece3 { to { opacity:0; transform: translate(42px,24px) rotate(70deg) scale(0.2); } }
@keyframes piece4 { to { opacity:0; transform: translate(-40px,20px) rotate(-55deg) scale(0.2); } }

/* ── SCROLL PROMPT ───────────────────────────────────── */
.intro-scroll-hint {
  margin-top: 2rem;
  text-align: center;
  color: rgba(255,255,255,0.45);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: fadeIn 0.6s 1s ease both;
}
.intro-scroll-arrow {
  display: block;
  margin: 0.5rem auto 0;
  font-size: 1.6rem;
  color: #C9A84C;
  animation: bounce 2s ease-in-out infinite;
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(10px); opacity: 1; }
}

/* ── INVITATION CARD ─────────────────────────────────── */
.intro-card {
  position: absolute;
  top: 0; left: 0; right: 0;
  margin: 18px auto 0;
  width: 88%;
  background: linear-gradient(160deg, #faf7f2 0%, #f5ede0 40%, #fefaf5 100%);
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.6);
  padding: 2rem 1.5rem;
  z-index: 2;
  transform: translateY(60px) scale(0.88);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.8s ease;
  overflow: hidden;
}
.intro-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #C9A84C, transparent);
}
.intro-card.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.intro-card-names {
  font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 400;
  font-style: italic;
  color: #9D7A42;
  text-align: center;
  margin-bottom: 0.8rem;
}
.intro-card-details {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(0.75rem, 2vw, 0.95rem);
  color: #6B5B4E;
  text-align: center;
  line-height: 1.8;
}
.intro-card-details strong {
  color: #2C2416;
  font-weight: 600;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 480px) {
  .intro-env-wrapper { width: 88vw; }
  .intro-env-seal, .intro-seal-pieces { width: 50px; height: 50px; }
  .intro-card { padding: 1.4rem 1rem; margin-top: 12px; }
  .intro-scroll-hint { font-size: 0.68rem; }
}
