/* ============================================
   ENVELOPE ANIMATION STYLES
   A magical envelope opening experience
   ============================================ */

.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #FAFCFC;
  opacity: 1;
  visibility: visible;
}

.envelope-header {
  text-align: center;
  margin-bottom: 3vh;
  z-index: 1;
}

.envelope-header-pretext {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: #0F4C81;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 5px;
  font-weight: 500;
  opacity: 0;
}

.envelope-header-title-svg {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 0 auto 10px;
  overflow: visible;
}

.envelope-header-title-text {
  font-family: var(--font-script);
  font-size: 58px;
  fill: #0F4C81;
  stroke: #0F4C81;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  fill-opacity: 0;
}

.envelope-header-date {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: #0F4C81;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
  font-weight: 500;
  opacity: 0;
}

.envelope-header-location {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: #0F4C81;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0;
}

.envelope-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-scene {
  perspective: 1200px;
  width: 100%;
  max-width: 90vw;
  padding: 20px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================================
   ENVELOPE CONTAINER
   ============================================ */
.envelope-container {
  position: relative;
  width: 100%;
  max-width: 550px;
  aspect-ratio: 1.4;
  margin: 0 auto;
  z-index: 10;
  opacity: 0;
  transform: translateY(-80vh);
}

/* Envelope Body */
.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #3D9AD9 0%, #2D8ACF 50%, #2074B5 100%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 8px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

/* Inner fold lines (X pattern) */
.envelope-fold-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
}

.envelope-fold-lines line {
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 0.5;
}

/* Subtle texture */
.envelope-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
}

/* ============================================
   INNER CARD (hidden behind triangles)
   ============================================ */
.envelope-inner-card {
  position: absolute;
  top: 10%;
  left: 15%;
  right: 15%;
  bottom: 10%;
  background: url('/photos/Etretat-proposal-466.jpeg') center center / cover no-repeat;
  border-radius: 6px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px 20px;
  z-index: 1;
  overflow: hidden;
  filter: contrast(1.1);
}

.envelope-inner-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 0;
}

.envelope-inner-card > * {
  position: relative;
  z-index: 1;
}

.invitation-card-title {
  font-family: var(--font-script);
  font-size: clamp(2rem, 5vw, 3rem);
  color: #0F4C81;
  margin-bottom: 10px;
  line-height: 1.2;
  text-align: center;
}

.invitation-card-divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #0F4C81, transparent);
  margin: 0 auto 15px;
}

.invitation-card-names {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: #0F4C81;
  letter-spacing: 0.1em;
}

/* ============================================
   ENVELOPE TRIANGLES (4 triangles meeting at center)
   ============================================ */

/* Bottom triangle - points UP to center */
.envelope-flap-bottom {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #2074B5 0%, #2D8ACF 100%);
  clip-path: polygon(0 100%, 50% 50%, 100% 100%);
  z-index: 10;
  filter: 
    drop-shadow(1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.5));
}

/* Left triangle - points RIGHT to center */
.envelope-flap-left {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #2074B5 0%, #2D8ACF 100%);
  clip-path: polygon(0 0, 50% 50%, 0 100%);
  z-index: 11;
  filter: 
    drop-shadow(1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.5));
}

/* Right triangle - points LEFT to center */
.envelope-flap-right {
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, #2074B5 0%, #2D8ACF 100%);
  clip-path: polygon(100% 0, 50% 50%, 100% 100%);
  z-index: 11;
  filter: 
    drop-shadow(1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.5));
}

/* Top flap/triangle (the one that opens) - points DOWN to center */
.envelope-flap {
  position: absolute;
  inset: 0;
  transform-origin: top center;
  transform-style: preserve-3d;
  z-index: 8;
}

.envelope-flap-front {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #3D9AD9 0%, #2D8ACF 100%);
  clip-path: polygon(0 0, 50% 50%, 100% 0);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  backface-visibility: hidden;
  filter: 
    drop-shadow(1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5))
    drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.5));
}

/* Back of top flap (visible when opened) */
.envelope-flap-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #185F9B 0%, #2074B5 100%);
  clip-path: polygon(0 0, 50% 50%, 100% 0);
  transform: rotateY(180deg);
  backface-visibility: hidden;
}

/* ============================================
   LANGUAGE BUTTONS
   ============================================ */
.envelope-lang-buttons {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  gap: 50px;
  z-index: 25;
}

.envelope-lang-btn-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.envelope-lang-btn {
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  color: #0F4C81;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.envelope-lang-btn:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.envelope-btn-arrows {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.envelope-btn-arrow {
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.85);
  border-bottom: 2px solid rgba(255, 255, 255, 0.85);
  transform: rotate(-135deg);
  animation: btnArrowBounce 1.5s ease-in-out infinite;
  opacity: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.envelope-btn-arrow:nth-child(1) {
  animation-delay: 0s;
}

.envelope-btn-arrow:nth-child(2) {
  animation-delay: 0.15s;
  margin-top: -4px;
}

@keyframes btnArrowBounce {
  0% {
    opacity: 0;
    transform: rotate(-135deg) translate(-4px, -4px);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(-135deg) translate(4px, 4px);
  }
}

/* ============================================
   WAX SEAL
   ============================================ */
.envelope-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 80px;
  height: 80px;
  z-index: 30;
  opacity: 0;
}

.envelope-seal-circle {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #ffffff 0%, #f8f5f2 50%, #f0ebe5 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 3px;
  padding-top: 2px;
  box-sizing: border-box;
  box-shadow: 
    0 6px 25px rgba(0, 0, 0, 0.35),
    0 3px 10px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08);
  font-family: var(--font-script);
  font-size: 32px;
  color: #0F4C81;
  border: 2px solid rgba(45, 138, 207, 0.4);
}


/* ============================================
   LANGUAGE HINT TEXT
   ============================================ */
.envelope-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2vh;
  opacity: 0;
}

.envelope-hint-text {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #0F4C81;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
  .envelope-container {
    max-width: 420px;
  }
  
  .envelope-inner-card {
    padding: 25px 15px;
  }
  
  .envelope-lang-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
  }
  
  .envelope-seal {
    width: 75px;
    height: 75px;
  }
  
  .envelope-seal-circle {
    font-size: 28px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .envelope-overlay {
    padding-top: 4vh;
  }
  
  .envelope-header {
    margin-bottom: 2vh;
  }
  
  .envelope-scene {
    max-width: 95vw;
    padding: 10px;
  }
  
  .envelope-container {
    max-width: 100%;
  }
  
  .envelope-inner-card {
    top: 10%;
    left: 12%;
    right: 12%;
    bottom: 18%;
    padding: 20px 15px;
  }
  
  .invitation-card-title {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
  }
  
  .envelope-seal {
    width: 65px;
    height: 65px;
  }
  
  .envelope-seal-circle {
    font-size: 22px;
    border-width: 2px;
  }
  
  .envelope-lang-buttons {
    gap: 20px;
    bottom: 4%;
  }
  
  .envelope-lang-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
  }
}
