:root {
  --bg-deep: #140d10;
  --bg-velvet: #24151b;
  --gold-soft: #e2c286;
  --gold-glow: rgba(226, 194, 134, 0.35);
  --rose-glow: rgba(212, 132, 148, 0.22);
  --card-ivory: #fcf9f2;
  --card-warm: #f5efe2;
  --text-light: #f8f2e8;
  --text-muted: #cbbba8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 35%, var(--bg-velvet) 0%, var(--bg-deep) 75%);
  color: var(--text-light);
  font-family: "Vazirmatn", "Cormorant Garamond", system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Romantic Video-Effect Canvas */
#romantic-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Soft Cinematic Light Leaks */
.ambient-glow {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

.ambient-glow--warm {
  background: radial-gradient(circle at 22% 28%, rgba(226, 194, 134, 0.14), transparent 50%);
}

.ambient-glow--rose {
  background: radial-gradient(circle at 78% 72%, rgba(206, 118, 138, 0.14), transparent 52%);
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-paused) .ambient-glow--warm {
    animation: drift-warm 18s ease-in-out infinite alternate;
  }
  body:not(.motion-paused) .ambient-glow--rose {
    animation: drift-rose 22s ease-in-out infinite alternate;
  }
}

@keyframes drift-warm {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.08); }
}

@keyframes drift-rose {
  from { transform: translate3d(3%, 2%, 0) scale(1.04); }
  to   { transform: translate3d(-4%, -3%, 0) scale(0.96); }
}

/* =========================================================
   Intro Envelope / Wax Seal Curtain (@starting-style)
   ========================================================= */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(44, 24, 32, 0.94), rgba(16, 10, 13, 0.98));
  backdrop-filter: blur(12px);
  opacity: 1;
  transform: scale(1);
  transition:
    display,
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

@starting-style {
  .intro-overlay {
    opacity: 0;
    transform: scale(1.02);
  }
}

.intro-overlay:where([hidden], [data-closing]) {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.intro-overlay[hidden] {
  display: none;
}

.intro-card {
  text-align: center;
  max-width: 420px;
  width: 100%;
  padding: 2.75rem 2rem;
  border-radius: 20px;
  border: 1px solid rgba(226, 194, 134, 0.28);
  background: linear-gradient(160deg, rgba(42, 24, 31, 0.82), rgba(20, 12, 16, 0.9));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.65),
    inset 0 0 40px rgba(226, 194, 134, 0.06);
}

.intro-bism {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--gold-soft);
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.intro-names {
  margin: 0 0 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.intro-names__fa {
  font-size: clamp(1.85rem, 5.2vw, 2.35rem);
  font-weight: 500;
  color: var(--text-light);
}

.intro-names__sub {
  font-size: clamp(1.05rem, 3.2vw, 1.25rem);
  font-weight: 300;
  color: var(--gold-soft);
  margin-top: 0.2rem;
}

.intro-names__en {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

.intro-date {
  margin: 0 0 2rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.wax-seal-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1px solid rgba(226, 194, 134, 0.55);
  background: radial-gradient(circle at 35% 30%, #a53c4c, #641c29 70%, #44101a);
  color: #fff8ee;
  cursor: pointer;
  box-shadow:
    0 12px 35px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(226, 194, 134, 0.25),
    inset 0 2px 6px rgba(255, 255, 255, 0.22);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wax-seal-btn:hover,
.wax-seal-btn:focus-visible {
  transform: scale(1.05);
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.65),
    0 0 46px rgba(226, 194, 134, 0.42);
  outline: 2px solid var(--gold-soft);
  outline-offset: 5px;
}

.wax-seal-btn__ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(226, 194, 134, 0.45);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-paused) .wax-seal-btn__ring {
    animation: slow-spin 24s linear infinite;
  }
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

.wax-seal-btn__text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  line-height: 1.3;
}

.wax-seal-btn__fa {
  font-size: 1rem;
  font-weight: 500;
}

.wax-seal-btn__en {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--gold-soft);
}

.intro-silent-btn {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.45rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.8;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.intro-silent-btn:hover,
.intro-silent-btn:focus-visible {
  color: var(--gold-soft);
  opacity: 1;
}

/* =========================================================
   Main Card Stage & 3D Perspective
   ========================================================= */
.stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1.25rem 1rem;
}

.card-perspective {
  perspective: 1400px;
  width: min(92vw, 560px, calc((100svh - 2.5rem) * 1358 / 1992));
}

.wedding-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1358 / 1992;
  border-radius: 16px;
  background:
    radial-gradient(circle at 15% 18%, rgba(246, 206, 214, 0.32) 0%, transparent 45%),
    radial-gradient(circle at 85% 84%, rgba(240, 202, 152, 0.3) 0%, transparent 48%),
    radial-gradient(circle at 50% 35%, #fffdf9 0%, #fcf4e8 58%, #f6e7d4 100%);
  box-shadow:
    0 32px 95px rgba(0, 0, 0, 0.7),
    0 0 75px rgba(226, 194, 134, 0.22),
    0 0 0 1px rgba(226, 194, 134, 0.45);
  overflow: hidden;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.25s ease-out;
}

/* Soft moving watercolor rose & champagne aura inside the card */
.card-color-wash {
  position: absolute;
  inset: -15%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 25%, rgba(232, 150, 170, 0.16), transparent 46%),
    radial-gradient(circle at 82% 75%, rgba(222, 178, 102, 0.18), transparent 48%),
    radial-gradient(circle at 50% 50%, rgba(255, 240, 220, 0.25), transparent 60%);
}

@media (prefers-reduced-motion: no-preference) {
  .wedding-card.is-revealed .card-color-wash {
    animation: wash-drift 12s ease-in-out infinite alternate;
  }
}

@keyframes wash-drift {
  from { transform: translate3d(-2%, -2%, 0) scale(1); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.06); }
}

/* Subtle moving silk/gold sheen across the card */
.card-paper-sheen {
  position: absolute;
  inset: -40%;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 236, 190, 0.55) 50%,
    transparent 65%
  );
  opacity: 0;
  z-index: 3;
}

@media (prefers-reduced-motion: no-preference) {
  .wedding-card.is-revealed .card-paper-sheen {
    animation: card-sheen 6.5s ease-in-out 1s infinite;
  }
}

@keyframes card-sheen {
  0%, 100% { transform: translateX(-45%) translateY(-10%); opacity: 0; }
  45%      { opacity: 0.65; }
  65%      { transform: translateX(45%) translateY(10%); opacity: 0; }
}

.card-gold-frame {
  position: absolute;
  inset: 2%;
  border: 1.5px solid rgba(190, 146, 72, 0.48);
  border-radius: 10px;
  pointer-events: none;
  z-index: 1;
}

.card-gold-frame--inner {
  inset: 3%;
  border: 1px solid rgba(186, 110, 128, 0.26);
  border-radius: 7px;
}

/* =========================================================
   Animated Divider Lines
   ========================================================= */
.divider-line {
  position: absolute;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(184, 137, 58, 0.18), #9c6f28 22%, #7d223f 50%, #9c6f28 78%, rgba(184, 137, 58, 0.18));
  z-index: 2;
  opacity: 1;
  transform: scaleX(1);
}

/* Exact card line coordinates */
.divider-line--top-left {
  left: 10.45%;
  top: 46.03%;
  width: 17.8%;
  transform-origin: right center;
}

.divider-line--top-right {
  left: 68.7%;
  top: 46.03%;
  width: 20.8%;
  transform-origin: left center;
}

.divider-line--bottom-left {
  left: 10.45%;
  top: 53.46%;
  width: 36.2%;
  transform-origin: right center;
}

.divider-line--bottom-right {
  left: 50.1%;
  top: 53.46%;
  width: 39.4%;
  transform-origin: left center;
}

/* =========================================================
   Card Calligraphic Elements & Choreographed Motion
   ========================================================= */
.card-el {
  position: absolute;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  z-index: 2;
  /* Static default: always visible if motion is reduced or disabled */
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .wedding-card.is-waiting .card-el,
  .wedding-card.is-waiting .divider-line {
    opacity: 0;
  }

  .wedding-card.is-revealed .divider-line {
    animation: line-draw 1s cubic-bezier(0.22, 1, 0.36, 1) 1.5s both;
  }

  .wedding-card.is-revealed .el-header {
    animation: focus-drop 1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
  }

  .wedding-card.is-revealed .el-bride {
    animation:
      brush-rtl 1.35s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both,
      gold-halo 2.2s ease-out 0.45s both,
      float-gentle 6s ease-in-out 2s infinite alternate;
  }

  .wedding-card.is-revealed .el-groom {
    animation:
      brush-ltr 1.35s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both,
      gold-halo 2.2s ease-out 0.65s both,
      float-gentle 6.5s ease-in-out 2.2s infinite alternate;
  }

  .wedding-card.is-revealed .el-floral-tl {
    animation:
      bloom-in 1.3s cubic-bezier(0.22, 1, 0.36, 1) 0.95s both,
      gentle-sway 7s ease-in-out 2.3s infinite alternate;
    transform-origin: bottom left;
  }

  .wedding-card.is-revealed .el-poem {
    animation: ink-reveal-down 1.5s cubic-bezier(0.22, 1, 0.36, 1) 1.1s both;
  }

  .wedding-card.is-revealed .el-family-right {
    animation: wing-right 1.05s cubic-bezier(0.22, 1, 0.36, 1) 1.45s both;
  }

  .wedding-card.is-revealed .el-family-left {
    animation: wing-left 1.05s cubic-bezier(0.22, 1, 0.36, 1) 1.45s both;
  }

  .wedding-card.is-revealed .el-date-center {
    animation:
      sweep-tail-reveal 1.55s cubic-bezier(0.22, 1, 0.36, 1) 1.65s both,
      gold-halo 2.4s ease-out 1.65s both;
  }

  .wedding-card.is-revealed .el-event-day {
    animation: silk-rise 1s cubic-bezier(0.22, 1, 0.36, 1) 2.1s both;
  }

  .wedding-card.is-revealed .el-event-time {
    animation: silk-rise 1s cubic-bezier(0.22, 1, 0.36, 1) 2.25s both;
  }

  .wedding-card.is-revealed .el-venue {
    animation:
      grand-venue 1.35s cubic-bezier(0.22, 1, 0.36, 1) 2.5s both,
      gold-halo 2.4s ease-out 2.5s both;
  }

  .wedding-card.is-revealed .el-footer {
    animation: silk-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) 2.85s both;
  }

  .wedding-card.is-revealed .el-floral-br {
    animation:
      bloom-in 1.3s cubic-bezier(0.22, 1, 0.36, 1) 2.65s both,
      gentle-sway-br 8s ease-in-out 4s infinite alternate;
    transform-origin: bottom right;
  }

  /* Pause ambient motion when user clicks Pause Motion */
  body.motion-paused .card-el {
    animation-play-state: paused !important;
  }
}

@keyframes focus-drop {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translate3d(0, -18px, 0) scale(1.12);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes silk-rise {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translate3d(0, 20px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Calligraphic brush reveal from right to left (for Persian bride name) */
@keyframes brush-rtl {
  from {
    opacity: 0;
    clip-path: inset(0 0 0 100%);
    filter: blur(4px);
    transform: translate3d(24px, -6px, 0) scale(1.08);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0%);
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Calligraphic brush reveal from left to right (for groom name) */
@keyframes brush-ltr {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    filter: blur(4px);
    transform: translate3d(-24px, -6px, 0) scale(1.08);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0% 0 0);
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Soft warm golden halo that blooms as key calligraphy lands */
@keyframes gold-halo {
  0% {
    filter: drop-shadow(0 0 0 rgba(212, 168, 86, 0));
  }
  45% {
    filter: drop-shadow(0 0 16px rgba(212, 168, 86, 0.65));
  }
  100% {
    filter: drop-shadow(0 2px 6px rgba(28, 21, 18, 0.08));
  }
}

@keyframes float-gentle {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -3px, 0); }
}

@keyframes wing-right {
  from {
    opacity: 0;
    transform: translate3d(34px, 0, 0) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes wing-left {
  from {
    opacity: 0;
    transform: translate3d(-34px, 0, 0) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes ink-reveal-down {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    filter: blur(3px);
    transform: translate3d(0, -10px, 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0% 0);
    filter: blur(0);
    transform: translate3d(0, 0, 0);
  }
}

/* Sweeping calligraphy reveal for the center date & long tail */
@keyframes sweep-tail-reveal {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: scale(1.08) translate3d(0, -12px, 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0% 0);
    transform: scale(1) translate3d(0, 0, 0);
  }
}

@keyframes grand-venue {
  from {
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
    transform: scale(0.88) translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    clip-path: circle(85% at 50% 50%);
    transform: scale(1) translate3d(0, 0, 0);
  }
}

@keyframes bloom-in {
  from {
    opacity: 0;
    clip-path: circle(0% at 50% 80%);
    transform: scale(0.76) rotate(-6deg);
  }
  to {
    opacity: 1;
    clip-path: circle(100% at 50% 50%);
    transform: scale(1) rotate(0deg);
  }
}

@keyframes gentle-sway {
  from { transform: rotate(-1.5deg) translate3d(0, 0, 0); }
  to   { transform: rotate(1.8deg) translate3d(2px, -3px, 0); }
}

@keyframes gentle-sway-br {
  from { transform: rotate(1.5deg) translate3d(0, 0, 0); }
  to   { transform: rotate(-1.8deg) translate3d(-2px, -3px, 0); }
}

@keyframes line-draw {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

/* =========================================================
   Small Light-Blue Butterflies Around Flowers
   ========================================================= */
.butterflies-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.butterfly {
  position: absolute;
  width: 3.4%;
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(135, 206, 250, 0.7));
}

.bfly-wing {
  fill: rgba(158, 222, 255, 0.88);
  stroke: rgba(225, 246, 255, 0.9);
  stroke-width: 0.7;
}

.bfly-body {
  fill: #5a9bc4;
}

.bfly-wing--l {
  transform-origin: 15.5px 14px;
}

.bfly-wing--r {
  transform-origin: 16.5px 14px;
}

/* Top-left flower positions */
.bfly-tl-1 { left: 6%;   top: 19.5%; width: 3.3%; }
.bfly-tl-2 { left: 20%;  top: 24%;   width: 2.7%; }
.bfly-tl-3 { left: 11%;  top: 32.5%; width: 2.9%; }

/* Bottom-right flower positions */
.bfly-br-1 { left: 80.5%; top: 79.5%; width: 3.3%; }
.bfly-br-2 { left: 90.5%; top: 86%;   width: 2.6%; }
.bfly-br-3 { left: 78.5%; top: 91%;   width: 2.9%; }

@media (prefers-reduced-motion: no-preference) {
  .wedding-card.is-revealed .bfly-wing--l {
    animation: flap-left 0.36s ease-in-out infinite alternate;
  }
  .wedding-card.is-revealed .bfly-wing--r {
    animation: flap-right 0.36s ease-in-out infinite alternate;
  }

  .wedding-card.is-revealed .bfly-tl-1 {
    animation: bfly-appear 0.9s ease-out 1.4s forwards, bfly-flight-a 6.5s ease-in-out 1.4s infinite alternate;
  }
  .wedding-card.is-revealed .bfly-tl-2 {
    animation: bfly-appear 0.9s ease-out 1.75s forwards, bfly-flight-b 7.5s ease-in-out 1.75s infinite alternate;
  }
  .wedding-card.is-revealed .bfly-tl-3 {
    animation: bfly-appear 0.9s ease-out 2.1s forwards, bfly-flight-c 6.8s ease-in-out 2.1s infinite alternate;
  }

  .wedding-card.is-revealed .bfly-br-1 {
    animation: bfly-appear 0.9s ease-out 3.0s forwards, bfly-flight-b 7s ease-in-out 3.0s infinite alternate;
  }
  .wedding-card.is-revealed .bfly-br-2 {
    animation: bfly-appear 0.9s ease-out 3.35s forwards, bfly-flight-a 6.2s ease-in-out 3.35s infinite alternate;
  }
  .wedding-card.is-revealed .bfly-br-3 {
    animation: bfly-appear 0.9s ease-out 3.65s forwards, bfly-flight-c 7.4s ease-in-out 3.65s infinite alternate;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wedding-card.is-revealed .butterfly {
    opacity: 0.85;
  }
}

@keyframes flap-left {
  from { transform: scaleX(1) rotate(0deg); }
  to   { transform: scaleX(0.32) rotate(8deg); }
}

@keyframes flap-right {
  from { transform: scaleX(1) rotate(0deg); }
  to   { transform: scaleX(0.32) rotate(-8deg); }
}

@keyframes bfly-appear {
  from { opacity: 0; }
  to   { opacity: 0.92; }
}

@keyframes bfly-flight-a {
  0%   { transform: translate3d(0, 0, 0) rotate(-14deg); }
  35%  { transform: translate3d(10px, -12px, 0) rotate(6deg); }
  70%  { transform: translate3d(-6px, -18px, 0) rotate(-18deg); }
  100% { transform: translate3d(8px, -6px, 0) rotate(10deg); }
}

@keyframes bfly-flight-b {
  0%   { transform: translate3d(0, 0, 0) rotate(12deg); }
  40%  { transform: translate3d(-12px, -10px, 0) rotate(-8deg); }
  75%  { transform: translate3d(6px, -16px, 0) rotate(16deg); }
  100% { transform: translate3d(-8px, -4px, 0) rotate(-12deg); }
}

@keyframes bfly-flight-c {
  0%   { transform: translate3d(0, 0, 0) rotate(-6deg); }
  50%  { transform: translate3d(12px, -14px, 0) rotate(14deg); }
  100% { transform: translate3d(-8px, -9px, 0) rotate(-16deg); }
}
