:root {
  --gold: #f8d993;
  --card-ratio: 941 / 1672;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: #100218;
  color: #fff;
  font-family: Montserrat, sans-serif;
}

.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, #512069 0, transparent 38%),
    linear-gradient(145deg, #0b0111, #24052f 52%, #100116);
  z-index: -1;
}

.ambient::after {
  content: "";
  position: absolute;
  inset: -5%;
  background-image: url("artes/03.png");
  background-size: cover;
  background-position: center;
  filter: blur(45px) brightness(.25) saturate(1.4);
  opacity: .42;
  transform: scale(1.1);
}

.aurora {
  position: absolute;
  width: 65vmax;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .19;
  animation: drift 13s ease-in-out infinite alternate;
}

.aurora-one { background: #a54dff; left: -30vmax; top: -15vmax; }
.aurora-two { background: #f1b85b; right: -35vmax; bottom: -25vmax; animation-delay: -6s; }

#stars, #stars::before, #stars::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255,236,187,.9) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(201,152,255,.75) 0 1.5px, transparent 2px);
  background-size: 83px 79px, 131px 127px;
  background-position: 12px 9px, 37px 51px;
  animation: starsFloat 22s linear infinite;
}

#stars::before { transform: rotate(25deg) scale(1.15); opacity: .55; }
#stars::after { transform: rotate(-18deg) scale(.9); opacity: .35; }

.stage {
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.stage > [hidden] { display: none; }
.stage > section:focus { outline: none; }
.stage > section:not([hidden]) { animation: screen-in .42s ease-out both; }
.stage > .scene-entering:not([hidden]) { animation-duration: .68s; }
.stage > .navigating:not([hidden]) {
  animation: scene-exit .28s ease-in-out both;
  pointer-events: none;
}

.script-notice {
  position: fixed;
  inset: auto 0 0;
  margin: 0;
  padding: 12px;
  background: #22102f;
  color: #ffe0a4;
  text-align: center;
}

.invitation {
  position: relative;
  width: min(100%, 560px, calc((100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 941 / 1672));
  width: min(100%, 560px, calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 941 / 1672));
  aspect-ratio: var(--card-ratio);
  container-type: inline-size;
  border-radius: 8px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 28px 85px rgba(0,0,0,.65), 0 0 55px rgba(165,77,255,.22);
  transition: filter .65s ease, transform .65s ease;
}

.stage > .navigating:has(.butterfly-flight):not([hidden]) {
  animation-duration: .4s;
  animation-delay: 1s;
  filter: brightness(1.08) saturate(1.05);
  transform: scale(.995);
}

.invitation::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.12) 45%, transparent 59%);
  transform: translateX(-130%);
  animation: sheen 7s ease-in-out infinite 3s;
}

.card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.035);
  transition: opacity .85s ease, transform 1.3s cubic-bezier(.2,.7,.1,1);
  pointer-events: none;
}

.card-image.is-visible { opacity: 1; transform: scale(1); }

.art-butterflies {
  position: absolute;
  inset: 0;
  z-index: 13;
  pointer-events: none;
  perspective: 700px;
  transition: opacity .45s ease;
}

.art-butterfly {
  --wing-speed: .58s;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  aspect-ratio: 1.22;
  transform: translate(-50%, -50%) rotate(var(--rotate, 0deg));
  opacity: .9;
  filter: drop-shadow(0 0 4px rgba(237,203,255,.9)) drop-shadow(0 0 9px rgba(160,65,255,.75));
  transition: opacity .55s ease, left 1s ease, top 1s ease, width 1s ease, transform 1s ease;
  animation: butterflyHover 3s ease-in-out infinite var(--float-delay, 0s);
}

.art-butterfly::before,
.art-butterfly::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-image: url("artes/borboleta-animada.png");
  background-repeat: no-repeat;
  background-size: 200% 100%;
  will-change: transform;
}

.art-butterfly::before {
  right: 50%;
  background-position: left center;
  transform-origin: 100% 50%;
  animation: artWingLeft var(--wing-speed) ease-in-out infinite alternate;
}

.art-butterfly::after {
  left: 50%;
  background-position: right center;
  transform-origin: 0 50%;
  animation: artWingRight var(--wing-speed) ease-in-out infinite alternate;
}

.art-butterfly span {
  position: absolute;
  z-index: 2;
  left: 47.5%;
  top: 37%;
  width: 5%;
  height: 52%;
  border-radius: 50%;
  background: linear-gradient(#f9df9c, #792ba2 38%, #e5b978);
  box-shadow: 0 0 5px #fff2bf;
}

.content-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.countdown {
  position: absolute;
  top: 63.1%;
  left: 13.2%;
  width: 73.8%;
  height: 13.7%;
  padding: 1.4% 4% 2%;
  border: 1px solid rgba(252,220,144,.75);
  border-radius: 9% / 24%;
  background: linear-gradient(145deg, #442b57, #301e41);
  box-shadow: inset 0 0 20px rgba(230,191,255,.1), 0 0 12px rgba(255,215,135,.15);
  color: #f7dda4;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
}

.countdown-title {
  margin: 0 0 2%;
  font-size: clamp(10px, 3.3cqw, 21px);
  line-height: 1;
}

.countdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.6%; height: 69%; }

.countdown-grid div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(247,217,147,.6);
  border-radius: 16%;
  background: rgba(94,51,112,.32);
}

.countdown strong { font-weight: 500; font-size: clamp(17px, 7cqw, 42px); line-height: .88; }
.countdown span { margin-top: 7%; font-size: clamp(6px, 2.1cqw, 13px); line-height: 1; }

.hotspot {
  position: absolute;
  z-index: 7;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s ease, box-shadow .25s ease, transform .2s ease;
}

.hotspot:hover, .hotspot:focus-visible {
  background: rgba(255,224,153,.12);
  box-shadow: 0 0 24px rgba(247,205,125,.28), inset 0 0 15px rgba(255,255,255,.07);
  outline: none;
  transform: scale(1.025);
}

.hotspot:active { transform: scale(.98); }
.location { left: 11.6%; top: 78.7%; width: 37.7%; height: 5.6%; }
.rsvp { left: 51.1%; top: 78.7%; width: 37.2%; height: 5.6%; }
.gifts { left: 11.6%; top: 85.9%; width: 39.6%; height: 5.7%; }
.manual { left: 51.1%; top: 85.9%; width: 37.3%; height: 5.7%; }

.butterfly-flight { position: absolute; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; }

.flying-butterfly {
  --size: 24px;
  position: absolute;
  width: var(--size);
  height: calc(var(--size) * .72);
  filter: drop-shadow(0 0 7px #d8a4ff) drop-shadow(0 0 12px rgba(255,225,170,.6));
  opacity: 0;
  animation: butterflyFly var(--duration) cubic-bezier(.2,.55,.4,1) var(--delay) both;
}

.flying-butterfly::before, .flying-butterfly::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-image: url("artes/borboleta-animada.png");
  background-repeat: no-repeat;
  background-size: 200% 100%;
}

.flying-butterfly::before { right: 50%; background-position: left center; transform-origin: right center; animation: wingL .24s ease-in-out infinite alternate; }
.flying-butterfly::after { left: 50%; background-position: right center; transform-origin: left center; animation: wingR .24s ease-in-out infinite alternate; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  padding: 13px 20px;
  border: 1px solid rgba(255,224,155,.65);
  border-radius: 999px;
  background: rgba(35,8,47,.95);
  color: #ffe8b3;
  box-shadow: 0 12px 35px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: .3s ease;
  text-align: center;
  font-size: 14px;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.music-toggle {
  position: fixed;
  z-index: 45;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255,224,151,.86);
  border-radius: 50%;
  color: #ffe7ad;
  background: radial-gradient(circle at 35% 30%, #78399b, #2c093b 72%);
  box-shadow: 0 8px 28px rgba(0,0,0,.42), 0 0 20px rgba(188,90,238,.3), inset 0 0 12px rgba(255,255,255,.08);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .25s ease, opacity .25s ease;
}

.music-toggle[hidden] { display: none; }
.music-toggle:hover, .music-toggle:focus-visible { outline: none; transform: scale(1.08); box-shadow: 0 9px 30px rgba(0,0,0,.45), 0 0 28px rgba(222,150,255,.5); }
.music-toggle span { font-size: 23px; line-height: 1; }
.music-toggle.is-playing span { animation: musicPulse 1.35s ease-in-out infinite; }
.music-toggle:not(.is-playing) { opacity: .72; }

.detail-page {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  width: min(100%, 520px);
  height: min(100%, 850px, max(600px, 195vw));
  padding: clamp(38px, 8.5dvh, 76px) clamp(26px, 10vw, 56px);
  overflow: hidden;
  isolation: isolate;
  border-radius: 8px;
  background: #211432 url("artes/moldura-detalhes.png") center / 100% 100% no-repeat;
  box-shadow: 0 28px 85px rgba(0,0,0,.65), 0 0 55px rgba(165,77,255,.22);
}

.detail-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.8dvh, 16px);
  max-height: 100%;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b28fc6 #2a183c;
  color: #fff2e4;
  font: 500 clamp(1rem, 4.4vw, 1.25rem)/1.17 "Cormorant Garamond", Georgia, serif;
}

.detail-header { text-align: center; }

.detail-header h1 {
  margin: 0;
  color: #ffe0a4;
  font-size: clamp(1.65rem, 8.2vw, 2.95rem);
  font-weight: 600;
  line-height: .99;
  text-wrap: balance;
  text-shadow: 0 2px 12px #160a24, 0 0 15px rgba(255,193,103,.25);
}

.detail-header p, .detail-signoff { margin: .4em 0 0; text-align: center; }

.detail-grid, .detail-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.detail-item {
  padding: .48em .58em;
  border: 1px solid rgba(248,217,147,.44);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(60,38,82,.92), rgba(27,15,45,.94));
}

.detail-item :is(h2, dt) {
  margin: 0 0 .22em;
  color: #ffe0a4;
  font-size: 1.08em;
  font-weight: 600;
  line-height: 1.05;
}

.detail-item :is(p, dd) { margin: 0; }
.detail-item p + p, .detail-item .dress-note { margin-top: .38em; }
.detail-wide { grid-column: 1 / -1; }

.detail-item a {
  color: #ffe0a4;
  text-underline-offset: .14em;
}

.detail-item .dress-note {
  padding-top: .4em;
  border-top: 1px solid rgba(248,217,147,.33);
}

.dress-note strong { color: #f6caff; }
.detail-signoff { margin: 0; font-style: italic; }

.detail-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid rgba(255,226,158,.75);
  border-radius: 999px;
  color: #ffe8b2;
  background: linear-gradient(145deg, #513768, #291938);
  box-shadow: inset 0 0 12px rgba(255,255,255,.08);
  font: 600 clamp(.68rem, 2.9vw, .84rem)/1.15 Montserrat, sans-serif;
  text-align: center;
  cursor: pointer;
}

.detail-button:hover, .detail-button:focus-visible { background: #654480; }

.detail-button:focus-visible, .detail-item a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.pix-action {
  grid-column: 1 / -1;
  color: #2d1a36;
  background: linear-gradient(135deg, #ffe3ab, #dcb482);
}

.pix-action:hover, .pix-action:focus-visible { background: #ffe7b8; }

.glamour-sparkles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.glamour-sparkle {
  position: absolute;
  left: var(--sx);
  top: var(--sy);
  width: var(--ss);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #fff1bd;
  box-shadow: 0 0 5px #fff, 0 0 11px #b964ff;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: glamourTwinkle 1.9s ease-in-out infinite var(--spark-delay);
}

.chandelier-lights {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.chandelier-light {
  position: absolute;
  left: var(--lx);
  top: var(--ly);
  width: var(--ls);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(255,255,255,1) 0 7%,
    rgba(255,236,174,.95) 13%,
    rgba(255,195,94,.55) 30%,
    rgba(217,132,255,.2) 52%,
    transparent 72%);
  filter: blur(.2px);
  animation: chandelierGlow 2.35s ease-in-out infinite var(--lamp-delay);
}

.scene-trigger {
  position: absolute;
  inset: 0;
  z-index: 20;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.scene-trigger:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -7px;
  border-radius: 8px;
}

.continue-cue {
  position: absolute;
  left: 50%;
  bottom: 10.8%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  padding: 8px 17px;
  border: 1px solid rgba(255,224,159,.72);
  border-radius: 999px;
  color: #ffe7ae;
  background: rgba(35,7,49,.72);
  box-shadow: 0 5px 22px rgba(0,0,0,.35), 0 0 16px rgba(175,91,239,.2);
  backdrop-filter: blur(8px);
  font: 600 clamp(10px, 2.5vw, 14px)/1 Montserrat, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.continue-cue > span {
  font-size: 18px;
  animation: cueBounce 1.2s ease-in-out infinite;
}

@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scene-exit { from { opacity: 1; } to { opacity: 0; } }
@keyframes drift { to { transform: translate(20vmax, 10vmax) scale(1.12); } }
@keyframes starsFloat { to { background-position: 95px 88px, -94px 178px; } }
@keyframes sheen { 0%, 75% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
@keyframes wingL { from { transform: perspective(30px) rotateY(5deg); } to { transform: perspective(30px) rotateY(34deg); } }
@keyframes wingR { from { transform: perspective(30px) rotateY(-5deg); } to { transform: perspective(30px) rotateY(-34deg); } }
@keyframes butterflyFly {
  0% { opacity: 0; transform: translate(var(--x0), var(--y0)) rotate(var(--r0)) scale(.4); }
  12% { opacity: 1; }
  45% { transform: translate(var(--x1), var(--y1)) rotate(var(--r1)) scale(1); }
  100% { opacity: 0; transform: translate(var(--x2), var(--y2)) rotate(var(--r2)) scale(.65); }
}

@keyframes artWingLeft {
  0% { transform: rotateY(4deg) rotateZ(-2deg); }
  100% { transform: rotateY(36deg) rotateZ(3deg); }
}

@keyframes artWingRight {
  0% { transform: rotateY(-4deg) rotateZ(2deg); }
  100% { transform: rotateY(-36deg) rotateZ(-3deg); }
}

@keyframes butterflyHover {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -1.4%; }
}

@keyframes cueBounce {
  0%, 100% { transform: translateX(-2px); opacity: .65; }
  50% { transform: translateX(3px); opacity: 1; }
}

@keyframes chandelierGlow {
  0%, 100% { opacity: .22; transform: translate(-50%, -50%) scale(.58); }
  42% { opacity: 1; transform: translate(-50%, -50%) scale(1.28); }
  58% { opacity: .72; transform: translate(-50%, -50%) scale(.92); }
}

@keyframes glamourTwinkle {
  0%, 100% { opacity: .12; transform: translate(-50%, -50%) rotate(45deg) scale(.35); }
  45% { opacity: 1; transform: translate(-50%, -50%) rotate(135deg) scale(1.35); }
  62% { opacity: .58; transform: translate(-50%, -50%) rotate(90deg) scale(.75); }
}

@keyframes musicPulse {
  0%, 100% { transform: scale(.9) rotate(-5deg); text-shadow: 0 0 5px rgba(255,233,177,.45); }
  50% { transform: scale(1.14) rotate(5deg); text-shadow: 0 0 13px #fff0bd; }
}

@media (max-width: 600px) {
  .invitation, .detail-page { border-radius: 0; box-shadow: none; }
  .music-toggle { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (max-height: 650px) {
  .detail-content { gap: 8px; line-height: 1.12; }
  .detail-item { padding-block: .36em; }
  .gift-list { grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .invitation { transition: none; }
}
