/* ==========================================================================
   THE ADZRA AFFAIR — Retro Whimsical Birthday Invitation
   Exact palette sampled from original PDF page 1:
   - Butter yellow stripe:  #fce07b / #f7e07f
   - Cream stripe / card:   #f8f8ec / #fcf8e3
   - Golden orange display: #f8ae43 (highlight #fddb74)
   - Bubblegum pink border: #ec66b9
   - Coral pink accent:     #ff588c
   - Pastel blue accent:    #aadaf3 / #98cdec
   ========================================================================== */

:root {
  --butter-yellow: #fce07b;
  --butter-yellow-soft: #f7e07f;
  --cream-stripe: #f8f8ec;
  --cream-card: #fcf8e3;
  --golden-orange: #f8ae43;
  --golden-light: #fddb74;
  --bubblegum-pink: #ec66b9;
  --coral-pink: #ff588c;
  --pastel-blue: #aadaf3;
  --pastel-blue-deep: #7ebce0;
  --ink-warm: #7a421d;

  --font-display: 'Berkshire Swash', Georgia, serif;
  --font-body: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;

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

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

html,
body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink-warm);
  background-color: var(--cream-stripe);
  background-image: repeating-linear-gradient(
    90deg,
    var(--butter-yellow) 0px,
    var(--butter-yellow) 18px,
    var(--cream-stripe) 18px,
    var(--cream-stripe) 36px
  );
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle paper grain texture across the whole experience */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.045;
  background-image: radial-gradient(#7a421d 0.75px, transparent 0.75px);
  background-size: 6px 6px;
}

/* ==========================================================================
   SLIDE SYSTEM
   ========================================================================== */

.slide {
  width: 100%;
  transition: opacity 0.65s var(--ease-out-soft), transform 0.65s var(--ease-out-soft), visibility 0.65s;
}

/* Slide 1: Opening — strictly fits viewport without vertical scroll */
.slide--opening {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.98);
  z-index: 10;
}

.slide--opening.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

/* Slide 2: Original Invitation — allows native pinch-zoom & clean centering */
.slide--invitation {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    max(14px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  z-index: 20;
  touch-action: pinch-zoom pan-x pan-y;
}

.slide--invitation.is-mounted {
  display: flex;
}

.slide--invitation.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   DECORATIVE ORNAMENTS (OPENING ONLY)
   ========================================================================== */

.ornaments {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.ornament {
  position: absolute;
}

.ornament--bunting-left {
  top: -4px;
  left: -10px;
  width: clamp(110px, 28vw, 185px);
  animation: gentle-sway 6s ease-in-out infinite;
  transform-origin: top left;
}

.ornament--disco-right {
  top: -8px;
  right: -12px;
  width: clamp(72px, 18vw, 118px);
  animation: disco-pendulum 7s ease-in-out infinite;
  transform-origin: top center;
}

.ornament--disco-left {
  bottom: 6%;
  left: -18px;
  width: clamp(64px, 16vw, 108px);
  animation: float-slow 6.5s ease-in-out infinite;
}

.disco-ball {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(122, 66, 29, 0.14));
}

.ornament--star {
  width: clamp(18px, 4.5vw, 28px);
  animation: twinkle 3.6s ease-in-out infinite;
}

.ornament--star-1 {
  top: 15%;
  left: 6%;
  animation-delay: 0s;
}

.ornament--star-2 {
  top: 24%;
  right: 7%;
  width: clamp(14px, 3.5vw, 22px);
  animation-delay: 1.1s;
}

.ornament--star-3 {
  bottom: 22%;
  right: 6%;
  animation-delay: 0.6s;
}

.ornament--star-4 {
  bottom: 13%;
  left: 14%;
  width: clamp(14px, 3.5vw, 20px);
  animation-delay: 1.8s;
}

/* ==========================================================================
   OPENING STAGE & REFERENCE-INSPIRED COMPOSITION
   ========================================================================== */

.opening-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8dvh, 16px);
}

/* Top pill banner */
.top-pill {
  background: var(--cream-card);
  border: 2px solid var(--bubblegum-pink);
  border-radius: 999px;
  padding: clamp(6px, 1.1dvh, 9px) clamp(18px, 5vw, 28px);
  box-shadow: 0 4px 14px rgba(236, 102, 185, 0.16);
}

.top-pill span {
  display: block;
  font-size: clamp(0.62rem, 1.9vw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--coral-pink);
  text-align: center;
  line-height: 1.25;
}

/* Framed main card */
.opening-card {
  position: relative;
  width: 100%;
  background: var(--cream-card);
  border: 3px solid var(--bubblegum-pink);
  border-radius: 26px;
  padding: clamp(16px, 2.8dvh, 26px) clamp(16px, 4.5vw, 26px) clamp(14px, 2.4dvh, 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow:
    0 12px 30px rgba(122, 66, 29, 0.12),
    0 0 0 5px rgba(252, 248, 227, 0.85),
    0 0 0 7px rgba(248, 174, 67, 0.45);
}

/* Corner brackets echoing opening-reference.jpg */
.corner-bracket {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--golden-orange);
  border-style: solid;
  pointer-events: none;
}

.corner-bracket--tl {
  top: 10px;
  left: 10px;
  border-width: 2.5px 0 0 2.5px;
  border-top-left-radius: 4px;
}

.corner-bracket--tr {
  top: 10px;
  right: 10px;
  border-width: 2.5px 2.5px 0 0;
  border-top-right-radius: 4px;
}

.corner-bracket--bl {
  bottom: 10px;
  left: 10px;
  border-width: 0 0 2.5px 2.5px;
  border-bottom-left-radius: 4px;
}

.corner-bracket--br {
  bottom: 10px;
  right: 10px;
  border-width: 0 2.5px 2.5px 0;
  border-bottom-right-radius: 4px;
}

/* Arch-framed photo */
.arch-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: clamp(10px, 1.8dvh, 16px);
}

.arch-frame {
  width: clamp(128px, 34vw, 176px);
  height: clamp(146px, 22dvh, 198px);
  border-radius: 999px 999px 18px 18px;
  overflow: hidden;
  border: 3px solid var(--golden-orange);
  background-color: var(--butter-yellow-soft);
  box-shadow:
    0 8px 20px rgba(248, 174, 67, 0.28),
    inset 0 0 0 2px var(--cream-card);
}

.arch-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 24%;
  display: block;
}

.age-badge {
  margin-top: -12px;
  background: var(--cream-card);
  border: 2px solid var(--bubblegum-pink);
  border-radius: 999px;
  padding: 2px 14px;
  box-shadow: 0 3px 8px rgba(236, 102, 185, 0.2);
}

.age-badge span {
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--coral-pink);
}

/* Typography hierarchy */
.subtitle {
  font-size: clamp(0.64rem, 2vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--coral-pink);
  margin-bottom: clamp(4px, 0.8dvh, 8px);
  line-height: 1.35;
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(1.95rem, 7.2vw, 2.75rem);
  font-weight: 400;
  line-height: 1.08;
  color: var(--golden-orange);
  text-shadow:
    1px 1px 0 var(--cream-card),
    2px 3px 0 rgba(236, 102, 185, 0.26);
  margin-bottom: clamp(6px, 1.1dvh, 10px);
}

.tagline {
  font-size: clamp(0.76rem, 2.4vw, 0.88rem);
  font-weight: 600;
  font-style: italic;
  color: var(--ink-warm);
  opacity: 0.88;
  max-width: 28ch;
  line-height: 1.4;
  margin-bottom: clamp(10px, 1.8dvh, 16px);
}

/* Outlined date pill */
.date-pill {
  border: 1.5px solid var(--pastel-blue-deep);
  background: rgba(170, 218, 243, 0.22);
  border-radius: 999px;
  padding: clamp(5px, 0.9dvh, 7px) clamp(14px, 4vw, 20px);
}

.date-pill span {
  display: block;
  font-size: clamp(0.63rem, 1.9vw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-warm);
}

/* CTA button matching opening-reference.jpg pill + circle icon */
.cta-button {
  appearance: none;
  border: 2.5px solid var(--bubblegum-pink);
  background: var(--cream-card);
  color: var(--coral-pink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(0.76rem, 2.4vw, 0.88rem);
  letter-spacing: 0.16em;
  border-radius: 999px;
  padding: 6px 6px 6px clamp(20px, 5vw, 28px);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 3vw, 18px);
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(236, 102, 185, 0.24),
    0 3px 0 var(--bubblegum-pink);
  transition: transform 0.2s var(--ease-out-soft), box-shadow 0.2s var(--ease-out-soft), background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.cta-button:hover {
  transform: translateY(-2px);
  background-color: #fffdf2;
  box-shadow:
    0 12px 24px rgba(236, 102, 185, 0.3),
    0 5px 0 var(--bubblegum-pink);
}

.cta-button:active {
  transform: translateY(2px);
  box-shadow:
    0 3px 10px rgba(236, 102, 185, 0.2),
    0 1px 0 var(--bubblegum-pink);
}

.cta-button:focus-visible {
  outline: 3px solid var(--pastel-blue-deep);
  outline-offset: 3px;
}

.cta-circle {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 50%;
  background: var(--coral-pink);
  color: var(--cream-card);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-out-soft);
}

.cta-button:hover .cta-circle {
  transform: translateY(2px);
}

.cta-circle svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   SLIDE 2: ORIGINAL INVITATION IMAGE
   ========================================================================== */

.invitation-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.invitation-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(96vw, 680px);
  max-height: calc(100dvh - 28px);
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(122, 66, 29, 0.18);
  touch-action: pinch-zoom pan-x pan-y;
}

@media (max-width: 600px) {
  .slide--invitation {
    padding:
      max(6px, env(safe-area-inset-top))
      max(4px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(4px, env(safe-area-inset-left));
  }

  .invitation-image {
    width: 100%;
    max-width: 100%;
    max-height: none;
    border-radius: 10px;
  }
}

/* ==========================================================================
   SHORT VIEWPORT TUNING (e.g. 320x568 iPhone SE 1st gen)
   ========================================================================== */

@media (max-height: 600px) {
  .opening-stage {
    gap: 7px;
  }

  .opening-card {
    padding: 12px 14px 11px;
    border-radius: 20px;
  }

  .arch-frame {
    width: 106px;
    height: 118px;
  }

  .arch-wrapper {
    margin-bottom: 8px;
  }

  .main-title {
    font-size: 1.75rem;
    margin-bottom: 4px;
  }

  .tagline {
    font-size: 0.72rem;
    margin-bottom: 8px;
  }

  .cta-button {
    padding: 5px 5px 5px 18px;
    font-size: 0.72rem;
  }

  .cta-circle {
    width: 28px;
    height: 28px;
  }
}

/* Landscape mobile & ultra-short viewports (e.g. 667x375, 844x390) */
@media (max-height: 480px) {
  .slide--opening {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .opening-stage {
    margin: auto 0;
    gap: 6px;
  }

  .opening-card {
    padding: 10px 14px;
  }

  .arch-frame {
    width: 78px;
    height: 86px;
  }

  .main-title {
    font-size: 1.45rem;
  }
}

/* ==========================================================================
   ANIMATIONS & REDUCED MOTION
   ========================================================================== */

.stagger-item {
  opacity: 0;
  transform: translateY(14px);
  animation: stagger-in 0.65s var(--ease-out-soft) forwards;
  animation-delay: calc(var(--stagger, 0) * 75ms + 80ms);
}

@keyframes stagger-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gentle-sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(2.5deg); }
}

@keyframes disco-pendulum {
  0%, 100% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg); }
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.65;
    transform: scale(0.92) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(12deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ornament,
  .stagger-item {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .slide,
  .cta-button,
  .cta-circle {
    transition: none !important;
  }
}
