@font-face {
  font-family: 'IranNastaliq';
  src: url('fonts/IRANastaliq.woff2') format('woff2'),
       url('fonts/IRANastaliq.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --burgundy: #66021f;
  --burgundy-dark: #460114;
  --burgundy-light: #830a2c;
  --cream: #fffaf8;
  --gold: #d4af37;
  --gold-light: #f7e7ce;
  --gold-dark: #aa8210;
  --charcoal: #3a3a3a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #3b0110;
  color: var(--cream);
  font-family: 'Vazirmatn', sans-serif;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

.font-calligraphy {
  font-family: 'IranNastaliq', serif;
  font-weight: normal;
  line-height: 1.1;
}

.font-persian {
  font-family: 'Vazirmatn', sans-serif;
}

/* Scroll Reveal Animations */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(45px) scale(0.98);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Envelope Unboxing System */
#envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #59021c 0%, #29000a 100%);
  perspective: 1200px;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s ease;
  padding: 16px;
}

#envelope-screen.opened {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-wrapper {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 290px;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (min-width: 480px) {
  .envelope-wrapper {
    height: 310px;
  }
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #4d0116, #380110);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 55, 0.3);
  z-index: 1;
  overflow: hidden;
}

.envelope-card {
  position: absolute;
  top: 15px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  background: var(--cream);
  border-radius: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(212, 175, 55, 0.4);
  transition: transform 1.4s cubic-bezier(0.34, 1.3, 0.64, 1);
  transform: translateY(0);
}

.envelope-screen.animating .envelope-card {
  transform: translateY(-80px) scale(1.05);
  z-index: 10;
}

.pocket-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(135deg, #66021f, #530119);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  z-index: 3;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  transform-origin: left center;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pocket-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(-135deg, #66021f, #530119);
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  z-index: 3;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
  transform-origin: right center;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pocket-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(0deg, #5b021c, #700323);
  clip-path: polygon(0 100%, 50% 15%, 100% 100%);
  z-index: 4;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.35);
  transform-origin: bottom center;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pocket-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62%;
  background: linear-gradient(180deg, #7a0427, #66021f);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  z-index: 5;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  transform-origin: top center;
  transition: transform 1.4s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.2s 0.5s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.envelope-screen.animating .pocket-top {
  transform: rotateX(180deg);
  z-index: 1;
}

.envelope-screen.animating .pocket-bottom {
  transform: translateY(60px);
  opacity: 0.3;
}

.envelope-screen.animating .pocket-left {
  transform: translateX(-40px);
  opacity: 0.3;
}

.envelope-screen.animating .pocket-right {
  transform: translateX(40px);
  opacity: 0.3;
}

.wax-seal-container {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.wax-seal-body {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e63946, #9b0b28 60%, #4d0010 100%);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.6), 0 10px 25px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pulseGlow 2.5s infinite;
}

.wax-seal-body::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(212, 175, 55, 0.7);
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.4), 0 8px 20px rgba(0, 0, 0, 0.6);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(212, 175, 55, 0), 0 14px 30px rgba(0, 0, 0, 0.8);
  }
}

.envelope-screen.animating .wax-seal-container {
  transform: translate(-50%, -50%) scale(1.35);
  opacity: 0;
  pointer-events: none;
}

.floating-floral-slow {
  animation: floralFloat 6s ease-in-out infinite alternate;
}

@keyframes floralFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-12px) rotate(5deg); }
}

.btn-gold-flash {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-gold-flash::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100px;
  width: 50px;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
  transform: skewX(-35deg);
  animation: buttonFlash 3.5s linear infinite;
}

@keyframes buttonFlash {
  0%, 30% { transform: translateX(0) skewX(-35deg); }
  60%, 100% { transform: translateX(450px) skewX(-35deg); }
}

.dress-man-sway {
  animation: swayGroom 4s ease-in-out infinite alternate;
}

.dress-lady-sway {
  animation: swayBride 4s ease-in-out infinite alternate;
}

@keyframes swayGroom {
  0% { transform: rotate(0deg) translateX(0); }
  50% { transform: rotate(-3deg) translateX(4px); }
  100% { transform: rotate(-1deg) translateX(2px); }
}

@keyframes swayBride {
  0% { transform: rotate(0deg) translateX(0); }
  50% { transform: rotate(3deg) translateX(-4px); }
  100% { transform: rotate(1deg) translateX(-2px); }
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #3b0110;
}

::-webkit-scrollbar-thumb {
  background: #830a2c;
  border-radius: 3px;
}