/* ============================================
   WEDDING INVITATION — Керей & Райхан
   ============================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Cormorant Garamond', serif;
  color: #1a1a1a;
  background: #1e1e1e;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.locked {
  overflow: hidden;
}

/* ---------- SECTIONS ---------- */
.section {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---------- VIDEO BACKGROUNDS ---------- */
.section-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.section-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.section-overlay--invitation {
  background:
    radial-gradient(ellipse at center, rgba(245,240,232,0.92) 0%, rgba(239,232,220,0.88) 50%, rgba(245,240,232,0.95) 100%);
}

.section-overlay--details {
  background: rgba(250,247,242,0.95);
}

.section-overlay--rsvp {
  background: rgba(252,250,246,0.85);
}

.section-overlay--closing {
  background:
    linear-gradient(180deg,
      rgba(0,0,0,0.35) 0%,
      rgba(0,0,0,0.45) 40%,
      rgba(0,0,0,0.6) 70%,
      rgba(0,0,0,0.75) 100%
    );
}


/* ============================================
   ENVELOPE GATE OVERLAY
   ============================================ */
.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
}

.envelope-overlay.opened {
  pointer-events: none;
}

.envelope-overlay.hidden {
  visibility: hidden;
}

/* Envelope body — slides LEFT on open */
.envelope-body {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    url('../assets/images/layers/envelope-base.webp') center / cover no-repeat,
    transparent;
  transition: transform 2.4s cubic-bezier(0.7, 0, 0.15, 1);
  transition-delay: 0.4s;
  will-change: transform;
}

.envelope-overlay.opened .envelope-body {
  transform: translateX(100%);
}

/* Envelope flap + seal group — slides RIGHT on open */
.envelope-flap-group {
  position: absolute;
  inset: 0;
  z-index: 2;
  transition: transform 2.4s cubic-bezier(0.7, 0, 0.15, 1);
  transition-delay: 0.4s;
  will-change: transform;
  pointer-events: none;
}

.envelope-flap__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.envelope-overlay.opened .envelope-flap-group {
  transform: translateX(-100%);
}

/* Wax Seal — centered where flap meets body */
.wax-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 80px;
  height: 80px;
  z-index: 10;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.6));
  animation: sealBounce 0.8s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wax-seal__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.envelope-overlay.opened .wax-seal {
  animation: sealBreak 0.5s ease forwards;
}

/* CTA text */
.envelope-cta {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  z-index: 10;
  opacity: 0;
  animation: ctaPulse 2.5s ease-in-out infinite;
  animation-delay: 1.5s;
}

.envelope-overlay.opened .envelope-cta {
  opacity: 0 !important;
  animation: none;
}

@keyframes sealBounce {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); }
  60% { transform: translate(-50%, -50%) scale(1.15) rotate(5deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

@keyframes sealBreak {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1.2) rotate(5deg); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(0.3) rotate(-15deg); opacity: 0; }
}

@keyframes ctaPulse {
  0%, 100% { opacity: 0; }
  30%, 70% { opacity: 0.7; }
  50% { opacity: 1; }
}


/* ============================================
   SECTION 1: INVITATION
   ============================================ */
.section--invitation {
  background: linear-gradient(170deg, #f7f2ea 0%, #efe8dc 40%, #f5f0e8 100%);
}

.invitation-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 40px 16px;
  text-align: center;
  z-index: 2;
}

/* Floral corners */
.floral {
  position: absolute;
  width: 110px;
  height: 110px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  z-index: 2;
}

.section--invitation.in-view .floral {
  opacity: 1;
}

.floral--top-left { top: 0; left: 0; }
.floral--top-right { top: 0; right: 0; }
.floral--bottom-left { bottom: 0; left: 0; }
.floral--bottom-right { bottom: 0; right: 0; }

.floral-svg {
  width: 100%;
  height: 100%;
}

/* Invitation text */
.invitation__families {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(13px, 3vw, 16px);
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #5a5040;
  margin-bottom: 20px;
}

.invitation__names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.invitation__name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 400;
  font-style: italic;
  color: #1a1a1a;
  line-height: 1;
}

.invitation__and {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(40px, 10vw, 70px);
  color: #8a7a5a;
  line-height: 1;
  margin: 0 5px;
}

.invitation__subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 400;
  font-style: italic;
  color: #5a5040;
  margin-bottom: 30px;
  line-height: 1.6;
}

.invitation__divider {
  width: 80px;
  height: 1px;
  background: #b8a88a;
  margin: 0 auto 30px;
}

.invitation__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.invitation__date-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.invitation__day-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: capitalize;
  color: #5a5040;
}

.invitation__date-num {
  font-family: 'Playfair Display', serif;
  font-size: clamp(50px, 13vw, 80px);
  font-weight: 400;
  color: #1a1a1a;
  line-height: 1;
}

.invitation__time {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 400;
  letter-spacing: 2px;
  color: #5a5040;
}

.invitation__date-sub {
  display: flex;
  align-items: baseline;
  gap: 15px;
}

.invitation__month {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: lowercase;
  color: #5a5040;
}

.invitation__year {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 400;
  letter-spacing: 3px;
  color: #8a7a5a;
}


/* ============================================
   SECTION 2: DETAILS
   ============================================ */
.section--details {
  background:
    url('../assets/images/details-bg.webp') center / cover no-repeat,
    linear-gradient(180deg, #faf7f2 0%, #f5f0e8 50%, #faf7f2 100%);
  padding: 80px 20px;
}

.details-content {
  width: 100%;
  max-width: 480px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.details__title-img {
  max-width: 280px;
  width: 70%;
  height: auto;
  margin: 0 auto 50px;
  display: block;
}

.detail-card {
  margin-bottom: 50px;
  position: relative;
}

.detail-card:last-child {
  margin-bottom: 0;
}

.detail-card__icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 12px;
  position: relative;
}

.detail-card__icon::after {
  content: '';
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  border: 1.5px solid #1a1a1a;
  border-radius: 50%;
  background: transparent;
}

.detail-card__icon svg {
  width: 100%;
  height: 100%;
}

.detail-card__title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: lowercase;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.detail-card__text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(15px, 3.5vw, 18px);
  font-weight: 400;
  line-height: 1.7;
  color: #5a5040;
  max-width: 400px;
  margin: 0 auto;
}

.detail-card__link {
  display: inline-block;
  margin-top: 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: lowercase;
  color: #8a7a5a;
  text-decoration: none;
  border-bottom: 1px solid #b8a88a;
  padding-bottom: 2px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.detail-card__link:hover,
.detail-card__link:focus-visible {
  color: #5a5040;
  border-bottom-color: #5a5040;
}

.detail-card__time {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 600;
  color: #5a5040;
  line-height: 1.1;
  letter-spacing: 1px;
}

/* ---------- COUNTDOWN TIMER ---------- */
.countdown {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 10px 6px 8px;
  border: 1px solid #b8a88a;
}

.countdown__number {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.1;
  letter-spacing: 1px;
}

.countdown__label {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: lowercase;
  color: #b8a88a;
  margin-top: 4px;
}


/* ============================================
   SECTION 3: RSVP
   ============================================ */
.section--rsvp {
  background: #fcfaf6;
  overflow: hidden;
}

.rsvp-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 20px;
  width: 100%;
  max-width: 480px;
}

.rsvp__please-img {
  max-width: 700px;
  width: 80%;
  height: auto;
  display: block;
  margin: 0 auto 50px;
  position: relative;
  z-index: 1;
}

.rsvp__icon {
  display: block;
  width: 55%;
  max-width: 140px;
  height: auto;
  margin: 0 auto 30px;
  position: relative;
  z-index: 1;
}

.rsvp__deadline {
  font-family: 'Playfair Display', serif;
  font-size: clamp(18px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: 4px;
  color: #1a1a1a;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

/* RSVP Form */
.rsvp-form {
  width: 100%;
  max-width: 320px;
  margin: 20px auto 20px;
  position: relative;
  z-index: 1;
}

.rsvp-form__group {
  margin-bottom: 20px;
  text-align: left;
}

.rsvp-form__fieldset {
  border: none;
  padding: 0;
  margin: 0 0 20px;
}

.rsvp-form__label {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #5a5040;
  margin-bottom: 8px;
  text-align: center;
}

.rsvp-form__input {
  width: 100%;
  padding: 12px 16px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 400;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #b8a88a;
  border-radius: 0;
  outline: none;
  text-align: center;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.rsvp-form__input::placeholder {
  color: #b8a88a;
  font-style: italic;
}

.rsvp-form__input:focus {
  border-color: #8a7a5a;
  background: rgba(255, 255, 255, 0.8);
}

.rsvp-form__input.error {
  border-color: #c0392b;
}

.rsvp-form__radios {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.rsvp-form__radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.rsvp-form__radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.rsvp-form__radio-custom {
  width: 18px;
  height: 18px;
  border: 1.5px solid #b8a88a;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

.rsvp-form__radio input[type="radio"]:checked + .rsvp-form__radio-custom {
  border-color: #8a7a5a;
}

.rsvp-form__radio input[type="radio"]:checked + .rsvp-form__radio-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a7a5a;
}

.rsvp-form__radio input[type="radio"]:focus-visible + .rsvp-form__radio-custom {
  outline: 2px solid #8a7a5a;
  outline-offset: 2px;
}

.rsvp-form__radio-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 500;
  font-style: italic;
  color: #5a5040;
}

.rsvp-form__submit {
  display: block;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #fcfaf6;
  background: #5a5040;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.rsvp-form__submit:hover {
  background: #8a7a5a;
}

.rsvp-form__submit:active {
  transform: scale(0.98);
}

.rsvp-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.rsvp-form__message {
  margin-top: 16px;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(14px, 3.5vw, 17px);
  font-weight: 400;
  font-style: italic;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.rsvp-form__message.visible {
  opacity: 1;
  transform: translateY(0);
}

.rsvp-form__message--success {
  color: #5a5040;
}

.rsvp-form__message--error {
  color: #8b4513;
}

.rsvp-form__confirmation {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(16px, 4vw, 20px);
  font-style: italic;
  color: #5a5040;
  line-height: 1.7;
  text-align: center;
}

.rsvp__thankyou-img {
  max-width: 700px;
  width: 90%;
  height: auto;
  display: block;
  margin: 50px auto 0;
  position: relative;
  z-index: 1;
}


/* ============================================
   SECTION 4: CLOSING
   ============================================ */
.section--closing {
  background:
    url('../assets/images/closing-bg.webp') center / cover no-repeat,
    #2a2520;
}

.closing-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  margin-top: 20vh;
}

.closing__monogram {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(28px, 7vw, 42px);
  color: rgba(255,255,255,0.3);
  margin-bottom: 20px;
}

.closing__date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: -10px;
}

.closing__date-month,
.closing__date-day {
  font-family: 'Playfair Display', serif;
  font-size: clamp(60px, 18vw, 120px);
  font-weight: 400;
  color: #fff;
  line-height: 1;
}

.closing__date-dot {
  font-size: clamp(40px, 12vw, 80px);
  color: #fff;
  line-height: 1;
}

.closing__year {
  font-family: 'Playfair Display', serif;
  font-size: clamp(60px, 18vw, 120px);
  font-weight: 400;
  color: #fff;
  line-height: 1;
  margin-bottom: 20px;
}

.closing__names {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(28px, 7vw, 44px);
  color: #fff;
  letter-spacing: 2px;
}


/* ============================================
   ANIMATIONS — BASE STATES (hidden, blurred)
   ============================================ */

/* Blur + Fade */
.anim-blur-fade {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Blur + Fade + Rise */
.anim-blur-fade-up {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(25px);
  transition: opacity 1.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Blur + Slide from Left */
.anim-blur-slide-left {
  opacity: 0;
  filter: blur(12px);
  transform: translateX(-60px);
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Blur + Slide from Right */
.anim-blur-slide-right {
  opacity: 0;
  filter: blur(12px);
  transform: translateX(60px);
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Blur + Scale (for the "&" symbol) */
.anim-blur-scale {
  opacity: 0;
  filter: blur(10px);
  transform: scale(0.7);
  transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Scale X (divider line) */
.anim-scale-x {
  transform: scaleX(0);
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}



/* ============================================
   ANIMATIONS — VISIBLE STATES
   ============================================ */
.in-view .anim-blur-fade,
.anim-blur-fade.visible {
  opacity: 1;
  filter: blur(0);
}

.in-view .anim-blur-fade-up,
.anim-blur-fade-up.visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.in-view .anim-blur-slide-left {
  opacity: 1;
  filter: blur(0);
  transform: translateX(0);
}

.in-view .anim-blur-slide-right {
  opacity: 1;
  filter: blur(0);
  transform: translateX(0);
}

.in-view .anim-blur-scale {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.in-view .anim-scale-x {
  transform: scaleX(1);
}



/* ============================================
   SEQUENTIAL ANIMATION DELAYS
   ============================================ */

/* Invitation stagger — cinematic pacing */
.section--invitation.in-view .invitation__families { transition-delay: 0.3s; }
.section--invitation.in-view .invitation__name--left { transition-delay: 0.7s; }
.section--invitation.in-view .invitation__and { transition-delay: 1.0s; }
.section--invitation.in-view .invitation__name--right { transition-delay: 1.3s; }
.section--invitation.in-view .invitation__subtitle { transition-delay: 1.8s; }
.section--invitation.in-view .invitation__divider { transition-delay: 2.2s; }
.section--invitation.in-view .invitation__date { transition-delay: 2.5s; }

/* Details stagger */
.section--details.in-view .details__title-img { transition-delay: 0.2s; }
.section--details.in-view .detail-card:nth-child(2) { transition-delay: 0.6s; }
.section--details.in-view .detail-card:nth-child(3) { transition-delay: 1.0s; }
.section--details.in-view .detail-card:nth-child(4) { transition-delay: 1.4s; }

/* RSVP stagger */
.section--rsvp.in-view .rsvp__please-img { transition-delay: 0.3s; }
.section--rsvp.in-view .rsvp__icon { transition-delay: 0.6s; }
.section--rsvp.in-view .rsvp__deadline { transition-delay: 1.5s; }
.section--rsvp.in-view .rsvp-form { transition-delay: 1.8s; }
.section--rsvp.in-view .rsvp__thankyou-img { transition-delay: 2.4s; }

/* Closing stagger */
.section--closing.in-view .closing__monogram { transition-delay: 0.3s; }
.section--closing.in-view .closing__date { transition-delay: 0.7s; }
.section--closing.in-view .closing__year { transition-delay: 1.1s; }
.section--closing.in-view .closing__names { transition-delay: 1.6s; }


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

/* --- Small phones (360px+) --- */
@media (min-width: 360px) {
  .wax-seal { width: 85px; height: 85px; }
  .invitation-card { padding: 50px 20px; }
  .floral { width: 130px; height: 130px; }
}

/* --- Medium phones / iPhone 14-15 (390px+) --- */
@media (min-width: 390px) {
  .wax-seal { width: 90px; height: 90px; }
  .invitation-card { padding: 55px 24px; }
  .floral { width: 150px; height: 150px; }
  .rsvp__letters { max-width: 55%; }
  .countdown { gap: 14px; }
  .countdown__unit { min-width: 56px; }
}

/* --- Large phones / iPhone Plus (414px+) --- */
@media (min-width: 414px) {
  .wax-seal { width: 95px; height: 95px; }
  .invitation-card { padding: 60px 28px; }
  .floral { width: 160px; height: 160px; }
  .closing-content { margin-top: 25vh; }
  .countdown { gap: 16px; }
  .countdown__unit { min-width: 60px; padding: 12px 8px 10px; }
}

/* --- Tablets (768px+) --- */
@media (min-width: 768px) {
  .wax-seal { width: 120px; height: 120px; }
  .floral { width: 200px; height: 200px; }
  .invitation-card { padding: 70px 36px; max-width: 520px; }
  .details-content { max-width: 520px; }
  .rsvp-content { max-width: 520px; padding: 60px 30px; }
  .rsvp__icon { max-width: 140px; }
  .rsvp__please-img { max-width: 240px; }
  .rsvp__thankyou-img { max-width: 240px; }
  .rsvp-form { max-width: 360px; }
  .closing-content { margin-top: 25vh; }
  .detail-card__text { max-width: 440px; }
  .section--details { padding: 80px 30px; }
  .countdown { gap: 20px; }
  .countdown__unit { min-width: 72px; padding: 14px 10px 12px; }
}

/* --- Laptops (1024px+) --- */
@media (min-width: 1024px) {
  .wax-seal { width: 130px; height: 130px; }
  .floral { width: 220px; height: 220px; }
  .invitation-card { padding: 80px 40px; max-width: 560px; }
  .details-content { max-width: 560px; }
  .rsvp-content { max-width: 560px; }
  .countdown { gap: 24px; }
  .countdown__unit { min-width: 80px; padding: 16px 12px 14px; }
}

/* --- Desktop / PC (1440px+) --- */
@media (min-width: 1440px) {
  .wax-seal { width: 140px; height: 140px; }
  .floral { width: 260px; height: 260px; }
  .invitation-card { max-width: 640px; padding: 100px 50px; }
  .details-content { max-width: 640px; }
  .rsvp-content { max-width: 640px; }
  .closing-content { margin-top: 30vh; }
}

/* --- Envelope: rotated landscape layout on wide screens --- */
@media (min-width: 768px) and (min-height: 600px) {
  .envelope-overlay {
    background: transparent;
  }

  /* Landscape constraint (swap from portrait max-width to landscape max-height) */
  .envelope-body,
  .envelope-flap-group {
    max-width: none;
    max-height: min(100%, 56.25vw);
    margin: auto 0;
  }

  /* Rotated flap image on body layer (swapped) via pseudo-element */
  .envelope-body {
    background: none;
    overflow: hidden;
  }

  .envelope-body::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100vw, 100vh);
    height: max(100vw, 100vh);
    transform: translate(-50%, -50%) rotate(270deg);
    background: url('../assets/images/layers/envelope-flap.webp') center / cover no-repeat;
    pointer-events: none;
  }

  /* Rotated base image on flap layer (swapped — no overflow:hidden to keep seal visible) */
  .envelope-flap__img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100vw, 100vh);
    height: max(100vw, 100vh);
    transform: translate(-50%, -50%) rotate(270deg);
    object-fit: cover;
    object-position: center;
    content: url('../assets/images/layers/envelope-base.webp');
  }

  /* Bigger seal on wide screens */
  .wax-seal {
    width: 450px;
    height: 450px;
  }

  /* Vertical open animation: base slides down, flap slides up */
  .envelope-overlay.opened .envelope-body {
    transform: translateY(100vh);
  }

  .envelope-overlay.opened .envelope-flap-group {
    transform: translateY(-100vh);
  }
}

/* --- Landscape phones --- */
@media (max-height: 500px) and (orientation: landscape) {
  .envelope-cta { bottom: 8%; font-size: 11px; }
  .wax-seal { width: 60px; height: 60px; }
  .invitation-card { padding: 30px 20px; }
  .rsvp-content { padding: 20px 16px; }
  .rsvp__please-img { max-width: 120px; margin-bottom: 10px; }
  .rsvp__thankyou-img { max-width: 120px; margin-top: 10px; }
  .rsvp-form { max-width: 280px; margin: 10px auto; }
  .rsvp-form__group { margin-bottom: 12px; }
  .rsvp-form__input { padding: 8px 12px; font-size: 16px; }
  .rsvp-form__submit { padding: 10px 20px; }
  .closing-content { margin-top: 10vh; }
  .countdown { gap: 10px; }
  .countdown__unit { min-width: 48px; padding: 8px 4px 6px; }
  .countdown__number { font-size: clamp(18px, 5vw, 26px); }
}

/* ============================================
   MUSIC TOGGLE BUTTON
   ============================================ */
.music-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(184, 168, 138, 0.4);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, transform 0.3s ease, background 0.3s ease;
  opacity: 0;
  transform: scale(0.8);
}

.music-toggle[hidden] {
  display: none;
}

.music-toggle.visible {
  opacity: 1;
  transform: scale(1);
}

.music-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.music-toggle:active {
  transform: scale(0.92);
}

/* Equalizer bars — playing state */
.music-toggle__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.music-toggle__bars span {
  display: block;
  width: 3px;
  background: #8a7a5a;
  border-radius: 1px;
  animation: eqBar 1s ease-in-out infinite;
}

.music-toggle__bars span:nth-child(1) {
  height: 8px;
  animation-delay: 0s;
}

.music-toggle__bars span:nth-child(2) {
  height: 14px;
  animation-delay: 0.2s;
}

.music-toggle__bars span:nth-child(3) {
  height: 10px;
  animation-delay: 0.4s;
}

@keyframes eqBar {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* Muted icon — hidden by default */
.music-toggle__muted {
  display: none;
  width: 20px;
  height: 20px;
  color: #8a7a5a;
}

.music-toggle__muted svg {
  width: 100%;
  height: 100%;
}

/* Paused state */
.music-toggle.paused .music-toggle__bars {
  display: none;
}

.music-toggle.paused .music-toggle__muted {
  display: flex;
}

/* Dark sections — lighter button */
.section--closing.in-view ~ .music-toggle,
.music-toggle--light {
  border-color: rgba(255, 255, 255, 0.25);
}

.music-toggle--light .music-toggle__bars span {
  background: rgba(255, 255, 255, 0.8);
}

.music-toggle--light .music-toggle__muted {
  color: rgba(255, 255, 255, 0.8);
}

/* --- iPhone safe areas --- */
@supports (padding: env(safe-area-inset-top)) {
  .envelope-overlay {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
