/* =========================================================
   Ahmed & Aya — Premium Wedding Invitation
   Palette: ivory / cream / champagne / beige / muted gold / dark brown
   ========================================================= */

:root {
  --ivory: #f8f3e9;
  --cream: #f1e7d5;
  --champagne: #e7d5b8;
  --beige: #ded0b8;
  --gold: #b08d4f;
  --gold-soft: #c9ac74;
  --gold-deep: #8a6d38;
  --ink: #3a2c1e;
  --ink-soft: #6b5842;

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --body: "EB Garamond", Georgia, serif;
  --mono-title: "Cinzel", "Cormorant Garamond", serif;

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

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--ivory);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(201, 172, 116, 0.10), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(176, 141, 79, 0.08), transparent 45%),
    url("assets/floral-bg.svg");
  background-size: auto, auto, 340px 340px;
  background-attachment: fixed, fixed, scroll;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

/* ---------- Floating petals ---------- */
.petals {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden;
}
.petal {
  position: absolute; top: -8vh;
  width: 14px; height: 20px;
  background: linear-gradient(160deg, var(--champagne), var(--gold-soft));
  border-radius: 60% 60% 60% 0 / 70% 70% 60% 40%;
  opacity: 0.45;
  animation: fall linear infinite;
}
.petal:nth-child(1) { left: 8%;  animation-duration: 20s; animation-delay: 0s; }
.petal:nth-child(2) { left: 27%; animation-duration: 26s; animation-delay: 4s; transform: scale(0.7); }
.petal:nth-child(3) { left: 46%; animation-duration: 23s; animation-delay: 9s; transform: scale(1.1); }
.petal:nth-child(4) { left: 63%; animation-duration: 29s; animation-delay: 2s; transform: scale(0.8); }
.petal:nth-child(5) { left: 79%; animation-duration: 22s; animation-delay: 6s; }
.petal:nth-child(6) { left: 92%; animation-duration: 27s; animation-delay: 11s; transform: scale(0.6); }

@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(120vh) rotate(360deg); }
}

/* =========================================================
   OPENING — LUXURY ENVELOPE
   Soft · slow · romantic. One gentle 5–6s reveal.
   Stages (added on #envelope-screen): s-press → s-open → s-card → s-final
   ========================================================= */

#envelope-screen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, #fdf8ee 0%, #f4ead7 46%, #ecdec4 74%, #e2d1b4 100%);
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
/* extremely subtle vignette — brighter centre, softer edges */
#envelope-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 46%, transparent 38%, rgba(96, 72, 42, 0.10) 82%, rgba(84, 62, 36, 0.18) 100%);
}
/* warm candle-soft light around the envelope, gently rises as it opens */
#envelope-screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255, 240, 212, 0.5), transparent 44%);
  opacity: 0.55;
  transition: opacity 2s var(--ease), transform 2s var(--ease);
}
#envelope-screen.s-open::before { opacity: 0.8; }
#envelope-screen.s-card::before,
#envelope-screen.s-final::before { opacity: 1; transform: scale(1.12); }
#envelope-screen.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.envelope-stage {
  width: min(84vw, 360px);
  text-align: center;
  perspective: 1800px;          /* gentle depth only */
  perspective-origin: 50% 42%;
}

.envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 5;
  margin: 0 auto;
  transform-style: preserve-3d;
  transform: rotateX(6deg);
  transition: transform 2s var(--ease);
}
#envelope-screen.s-card .envelope,
#envelope-screen.s-final .envelope { transform: rotateX(2deg); }

.envelope > * { position: absolute; }
.env-back, .env-lining, .flap, .env-front { inset: 0; }

/* ---- soft natural ground shadow ---- */
.env-ground {
  inset: auto; left: 8%; right: 8%; bottom: -11%; height: 28%;
  background: radial-gradient(ellipse at 50% 50%, rgba(74, 54, 30, 0.34), transparent 70%);
  filter: blur(16px);
  transform: translateZ(-30px);
  transition: opacity 2s var(--ease), transform 2s var(--ease);
}
#envelope-screen.s-card .env-ground,
#envelope-screen.s-final .env-ground { opacity: 0.75; transform: translateZ(-30px) translateY(8%); }

/* ---- back wall ---- */
.env-back {
  border-radius: 13px;
  background: linear-gradient(155deg, #f8eede 0%, #efe0c6 58%, #e6d5b6 100%);
  box-shadow:
    0 26px 50px -20px rgba(74, 54, 30, 0.42),
    0 6px 16px rgba(74, 54, 30, 0.18),
    inset 0 0 60px rgba(255, 255, 255, 0.25);
}
.env-back::after, .env-front::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: url("assets/paper-noise.svg");
  background-size: 180px 180px;
  opacity: 0.4; mix-blend-mode: multiply; pointer-events: none;
}

/* ---- warm inner lining, revealed softly as the flaps open ---- */
.env-lining {
  border-radius: 10px;
  background: linear-gradient(165deg, #efdcb8 0%, #e3caa0 50%, #f0dfbe 100%);
  box-shadow: inset 0 0 44px rgba(120, 88, 44, 0.28);
  transform: translateZ(1px);
  filter: brightness(0.9);
  transition: filter 2s var(--ease);
}
#envelope-screen.s-open .env-lining  { filter: brightness(1); }
#envelope-screen.s-card .env-lining,
#envelope-screen.s-final .env-lining { filter: brightness(1.05); }

/* ---- invitation card (inside) ---- */
.env-card {
  left: 8%; right: 8%; top: 9%; height: 82%;
  border-radius: 5px;
  background: linear-gradient(180deg, #fffdf9 0%, #f8f1e4 100%);
  border: 1px solid rgba(176, 141, 79, 0.4);
  box-shadow: 0 3px 12px rgba(74, 54, 30, 0.18);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow: hidden;
  transform-origin: 50% 100%;
  /* very smooth, slow, ease-out — no bounce, no overshoot */
  transform: translateZ(3px) translateY(0) scale(1);
  transition: transform 2.6s var(--ease), box-shadow 2.6s var(--ease), filter 2.6s var(--ease);
  filter: brightness(0.96);
}
#envelope-screen.s-card .env-card,
#envelope-screen.s-final .env-card {
  transform: translateZ(34px) translateY(-56%) scale(1.04);
  box-shadow: 0 26px 48px rgba(74, 54, 30, 0.28);
  filter: brightness(1);
}

/* soft warm highlight that drifts across the card once it has settled */
.env-card .sweep {
  position: absolute; top: 0; bottom: 0; width: 60%; left: -85%;
  background: linear-gradient(100deg, transparent, rgba(255, 246, 227, 0.55), transparent);
  transform: skewX(-14deg);
  opacity: 0; pointer-events: none;
}
#envelope-screen.s-final .env-card .sweep { animation: cardSweep 2.4s var(--ease) 0.3s 1; }
@keyframes cardSweep {
  0%   { left: -85%; opacity: 0; }
  25%  { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

.gold-frame {
  border: 1px solid var(--gold-soft);
  padding: 18px 12px;
  outline: 3px solid rgba(255,255,255,0.6);
  outline-offset: -7px;
}
.script-sm { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 0.95rem; }
.couple-mini { font-family: var(--mono-title); font-weight: 500; color: var(--ink); font-size: 1.35rem; margin: 6px 0; letter-spacing: 1px; }
.rule { display: block; width: 46px; height: 1px; background: var(--gold); margin: 8px auto; }
.date-mini { font-family: var(--serif); letter-spacing: 3px; color: var(--gold-deep); font-size: 0.95rem; }

/* ---- flaps: gentle, slow, ease-out ---- */
.flap { border-radius: 10px; backface-visibility: hidden; }

.flap-left {
  clip-path: polygon(0 0, 60% 50%, 0 100%);
  background: linear-gradient(115deg, #f2e5cd 0%, #e1cfac 100%);
  transform-origin: left center;
  transform: translateZ(8px) rotateY(0deg);
  box-shadow: 6px 0 16px -8px rgba(74, 54, 30, 0.26);
  transition: transform 2.1s var(--ease);
}
.flap-right {
  clip-path: polygon(100% 0, 40% 50%, 100% 100%);
  background: linear-gradient(245deg, #f2e5cd 0%, #e1cfac 100%);
  transform-origin: right center;
  transform: translateZ(8px) rotateY(0deg);
  box-shadow: -6px 0 16px -8px rgba(74, 54, 30, 0.26);
  transition: transform 2.1s var(--ease) 0.15s;
}
#envelope-screen.s-open .flap-left,
#envelope-screen.s-card .flap-left,
#envelope-screen.s-final .flap-left  { transform: translateZ(8px) rotateY(-152deg); }
#envelope-screen.s-open .flap-right,
#envelope-screen.s-card .flap-right,
#envelope-screen.s-final .flap-right { transform: translateZ(8px) rotateY(152deg); }

/* ---- front pocket (embossed floral) ---- */
.env-front {
  clip-path: polygon(0 100%, 0 33%, 50% 72%, 100% 33%, 100% 100%);
  border-radius: 12px;
  background: linear-gradient(165deg, #f5ead7 0%, #eadabe 66%, #dfccaa 100%);
  transform: translateZ(11px);
  box-shadow: 0 -3px 14px rgba(74, 54, 30, 0.14), inset 0 0 30px rgba(255, 255, 255, 0.22);
}
.env-front::before {
  content: ""; position: absolute; inset: 0;
  background: url("assets/floral-corner.svg") center 60% / 42% no-repeat;
  opacity: 0.22; mix-blend-mode: multiply;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.7)) drop-shadow(0 -1px 0 rgba(120,90,45,0.2));
}

/* ---- top flap: gently lifts on its top hinge ---- */
.flap-top {
  clip-path: polygon(0 0, 100% 0, 50% 66%);
  transform-origin: top center;
  transform-style: preserve-3d;
  transform: translateZ(14px) rotateX(0deg);
  transition: transform 2.3s var(--ease);
}
.flap-top .face {
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 66%);
  border-radius: 12px 12px 0 0;
  backface-visibility: hidden;
}
.flap-top .face-front {
  background: linear-gradient(160deg, #f5ead7 0%, #e9d8bb 100%);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.35), 0 4px 12px rgba(74,54,30,0.16);
}
.flap-top .face-front::before {
  content: ""; position: absolute; inset: 0;
  background: url("assets/floral-corner.svg") center 15% / 38% no-repeat;
  opacity: 0.2; mix-blend-mode: multiply;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.7)) drop-shadow(0 -1px 0 rgba(120,90,45,0.2));
}
.flap-top .face-back {
  transform: rotateX(180deg);
  background: linear-gradient(160deg, #ecdbb6 0%, #dcc59a 100%);
  box-shadow: inset 0 0 26px rgba(120, 88, 44, 0.28);
}
#envelope-screen.s-open .flap-top,
#envelope-screen.s-card .flap-top,
#envelope-screen.s-final .flap-top { transform: translateZ(14px) rotateX(-166deg); }

/* ---- wax seal ---- */
.seal {
  inset: auto; left: 50%; top: 50%;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  border: 0; background: none; padding: 0; cursor: pointer;
  transform: translateZ(22px) scale(1);
  transition: transform 0.8s var(--ease), opacity 1.1s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.seal:hover { transform: translateZ(22px) scale(1.03); }
.seal:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 6px; border-radius: 50%; }

.seal-glow {
  position: absolute; inset: -24px; border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 190, 128, 0.45), transparent 70%);
  animation: sealGlow 5s ease-in-out infinite;
  transition: opacity 1s ease;
}
.seal-wax {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ad8850, #7f6132 66%, #5f4720);
  box-shadow:
    inset 0 3px 7px rgba(255, 228, 184, 0.4),
    inset 0 -8px 15px rgba(0, 0, 0, 0.34),
    0 5px 14px rgba(60, 42, 20, 0.34);
}
.seal-wax::before { /* soft irregular wax edge */
  content: ""; position: absolute; inset: -4px;
  border-radius: 47% 53% 51% 49% / 53% 47% 53% 47%;
  background: radial-gradient(circle at 40% 36%, #9a7642, #6b4f26);
  z-index: -1;
}
.seal-monogram {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono-title); color: #f5e6c9;
  font-size: 1.12rem; letter-spacing: 1px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.42), 0 0 3px rgba(255, 232, 194, 0.3);
}
.seal-monogram small { font-size: 0.7rem; opacity: 0.85; }

/* press → gentle release → soft fade */
#envelope-screen.s-press .seal { transform: translateZ(20px) scale(0.94); }
#envelope-screen.s-press .seal-glow { opacity: 0.85; }
#envelope-screen.s-open .seal,
#envelope-screen.s-card .seal,
#envelope-screen.s-final .seal {
  opacity: 0; pointer-events: none;
  transform: translateZ(22px) scale(0.9) translateY(6px);
}

@keyframes sealGlow {
  0%,100% { opacity: 0.4; transform: scale(1); }
  50%     { opacity: 0.7; transform: scale(1.08); }
}

.tap-hint {
  margin-top: 26px;
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 2px;
  color: var(--ink-soft);
  font-size: 1rem;
  animation: fade-breathe 3.4s ease-in-out infinite;
  transition: opacity 0.7s ease;
}
#envelope-screen.s-press .tap-hint,
#envelope-screen.s-open .tap-hint,
#envelope-screen.s-card .tap-hint,
#envelope-screen.s-final .tap-hint { opacity: 0; animation: none; }
@keyframes fade-breathe { 0%,100% { opacity: 0.45; } 50% { opacity: 0.95; } }

/* =========================================================
   MAIN INVITATION
   ========================================================= */
#invitation {
  position: relative; z-index: 2;
  max-width: 560px;
  margin: 0 auto;
  padding: 44px 22px 60px;
}

.card, .block, .foot { text-align: center; }

.card-frame {
  border: 1px solid var(--gold-soft);
  outline: 1px solid rgba(176, 141, 79, 0.3);
  outline-offset: 6px;
  padding: 40px 22px 44px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.6), transparent 55%),
    linear-gradient(180deg, #fffdf8, var(--ivory));
  background-image: url("assets/floral-corner.svg"),
    linear-gradient(180deg, #fffdf8, var(--ivory));
  background-repeat: no-repeat, no-repeat;
  background-position: center 14px, center;
  background-size: 116px, cover;
  box-shadow: 0 18px 40px rgba(90, 68, 40, 0.14);
}

.eyebrow {
  font-family: var(--serif); font-style: italic;
  color: var(--ink-soft); font-size: 1.05rem;
  letter-spacing: 1px; margin-top: 46px;
}
.couple {
  font-family: var(--mono-title);
  font-weight: 500;
  font-size: clamp(2.3rem, 11vw, 3.4rem);
  letter-spacing: 2px;
  margin: 14px 0 16px;
  color: var(--ink);
  line-height: 1.1;
}
.couple .amp { color: var(--gold); font-family: var(--serif); font-style: italic; }
.invite-text {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-soft);
}

.divider {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 26px 0;
  color: var(--gold);
}
.divider span { display: block; width: 54px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

.big-date {
  font-family: var(--mono-title);
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  letter-spacing: 2px;
  color: var(--ink);
}
.big-time {
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 3px;
  color: var(--gold-deep);
  margin-top: 4px;
}
.venue {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin-top: 20px;
  color: var(--ink);
}
.venue-sub { font-family: var(--body); color: var(--ink-soft); letter-spacing: 0.5px; }

/* ---------- Blocks ---------- */
.block { margin-top: 54px; }
.section-title {
  font-family: var(--mono-title);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 22px;
}

/* ---------- Countdown ---------- */
.countdown {
  display: flex; justify-content: center; gap: 7px;
  flex-wrap: wrap;
}
.cd-unit {
  min-width: 0;
  flex: 1 1 0;
  max-width: 82px;
  padding: 14px 4px;
  background: linear-gradient(180deg, #fffdf8, var(--cream));
  border: 1px solid rgba(176, 141, 79, 0.4);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(90, 68, 40, 0.1);
}
.cd-num {
  display: block;
  font-family: var(--mono-title);
  font-size: 1.7rem;
  color: var(--ink);
  line-height: 1;
}
.cd-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 6px;
}
.cd-done {
  font-family: var(--mono-title);
  font-size: 1.5rem;
  color: var(--gold-deep);
  letter-spacing: 1px;
}

/* ---------- Details ---------- */
.detail-line { font-family: var(--serif); font-size: 1.2rem; letter-spacing: 1px; color: var(--ink); }
.detail-venue { font-family: var(--serif); font-size: 1.3rem; margin-top: 10px; color: var(--ink); }
.detail-sub { color: var(--ink-soft); margin-top: 2px; }

.btn-row {
  display: flex; flex-direction: column; gap: 12px;
  align-items: center; margin-top: 24px;
}

.btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ivory);
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border: 1px solid var(--gold-deep);
  padding: 14px 30px;
  border-radius: 3px;
  cursor: pointer;
  min-width: 240px;
  min-height: 48px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s;
  box-shadow: 0 8px 18px rgba(138, 109, 56, 0.28);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--gold-deep);
  border: 1px solid var(--gold);
  box-shadow: none;
}
.btn-outline:hover { background: rgba(176, 141, 79, 0.08); }

.btn-whatsapp {
  background: linear-gradient(180deg, #cbb37f, var(--gold));
}

.rsvp-text { font-family: var(--serif); font-size: 1.15rem; color: var(--ink-soft); margin-bottom: 20px; }

/* ---------- Footer ---------- */
.foot { margin-top: 60px; }
.foot-names { font-family: var(--mono-title); font-size: 1.4rem; letter-spacing: 3px; color: var(--ink); }
.foot-note { font-family: var(--serif); letter-spacing: 4px; color: var(--gold-deep); margin-top: 6px; }

/* ---------- Music indicator (small, elegant) ---------- */
.music-btn {
  position: fixed;
  right: 14px; bottom: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(138, 109, 56, 0.45);
  background: linear-gradient(180deg, rgba(233, 220, 193, 0.92), rgba(201, 172, 116, 0.94));
  z-index: 30;
  cursor: pointer;
  opacity: 0.7;
  box-shadow: 0 3px 10px rgba(90, 68, 40, 0.22);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease, transform 0.3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.music-btn:hover { opacity: 1; transform: scale(1.06); }
.music-ico { color: var(--ivory); font-size: 13px; line-height: 1; }
.music-btn.playing { animation: mnote 3.6s ease-in-out infinite; }
@keyframes mnote {
  0%,100% { box-shadow: 0 3px 10px rgba(90,68,40,0.22), 0 0 0 0 rgba(201,172,116,0.3); }
  50%     { box-shadow: 0 3px 10px rgba(90,68,40,0.22), 0 0 0 6px rgba(201,172,116,0); }
}

/* =========================================================
   REVEAL ANIMATION
   ========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 600px) {
  .envelope-stage { width: min(64vw, 420px); }
  .btn-row { flex-direction: row; justify-content: center; }
  .btn { min-width: 200px; }
  .card-frame { padding: 52px 40px 56px; }
}

@media (max-width: 360px) {
  .cd-unit { min-width: 60px; padding: 12px 6px; }
  .cd-num { font-size: 1.4rem; }
  .btn { min-width: 200px; font-size: 0.9rem; padding: 13px 20px; }
  .seal { width: 76px; height: 76px; margin: -38px 0 0 -38px; }
}

/* =========================================================
   REDUced MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .petals { display: none; }
  [data-reveal] { opacity: 1; transform: none; }

  /* Envelope: no physical motion — the sequence is skipped in JS,
     but keep a safe static fallback just in case. */
  .envelope { transform: none !important; }
  .env-card { animation: none !important; }
  .flap-top, .flap-left, .flap-right, .seal, .seal-glow { animation: none !important; }
}
