:root {
  color-scheme: dark;
  color: #fff1d2;
  background: #10090c;
  font: 16px/1.35 Georgia, serif;
}

@font-face {
  font-family: "Mila Invitation";
  src: url("assets/cormorantgaramond-500i-cyrillic.woff2") format("woff2");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Mila Invitation Latin";
  src: url("assets/cormorantgaramond-500i-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: min(100%, 540px); margin: 0 auto; }
.frame { position: relative; margin: 0; }
.frame > :is(img, video) { display: block; width: 100%; height: auto; }
.stage { background: #052d35; }
#entrance { position: absolute; inset: 0; }
.stage:has(.static-invitation) #stage-still { display: none; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#microphone {
  position: absolute;
  inset: 0;
  width: 100%;
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #ffe8c0;
  -webkit-tap-highlight-color: transparent;
}

#microphone::before {
  content: "";
  position: absolute;
  top: 31%;
  left: 50.6%;
  width: 25%;
  height: 15%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, #ffe2a978, #ffe4a000 72%);
  animation: microphone-glow 2.4s ease-in-out infinite alternate;
  pointer-events: none;
}

.stage-title {
  position: absolute;
  inset: 10% 5% auto;
  text-align: center;
  text-wrap: balance;
  font: italic 500 clamp(26px, 8.6cqw, 47px)/1.04 "Mila Invitation", Georgia, serif;
  text-shadow: 0 2px 12px #160608;
}

.stage-cursor {
  position: absolute;
  top: 32.5%;
  left: 53.8%;
  width: clamp(24px, 6.7cqw, 34px);
  overflow: visible;
  fill: currentColor;
  stroke: #351311;
  stroke-width: 1.6;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px #160608);
  animation: stage-point 2.8s ease-in-out infinite;
}

#microphone:focus-visible { outline: none; }
#microphone:focus-visible .stage-cursor {
  animation: none;
  border-radius: 50%;
  outline: 2px solid #ffe4a0;
  outline-offset: 5px;
}

#music-toggle {
  position: fixed;
  z-index: 10;
  top: calc(12px + env(safe-area-inset-top));
  right: max(calc(12px + env(safe-area-inset-right)), calc((100% - 540px) / 2 - 58px));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #e8c597a6;
  border-radius: 50%;
  background: #261318ec;
  color: #ffe8c0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#music-toggle svg { width: 22px; height: 22px; }
#music-toggle[aria-pressed="true"] .music-slash { display: none; }
#music-toggle:focus-visible { outline: 2px solid #ffe4a0; outline-offset: 3px; }

@keyframes stage-point {
  0%, 100% { transform: translate(4px, 4px); }
  46%, 56% { transform: translate(0, 0); }
}

@keyframes microphone-glow {
  from { opacity: .14; }
  to { opacity: .83; }
}
@media (prefers-reduced-motion: reduce) {
  #microphone::before, .stage-cursor { animation: none; }
}

/* Координаты сняты с макетов при ширине 540 px.
   Высота листа с анкетой — 1467 px, с кнопкой карты — 1620 px. */
.location-details {
  position: relative;
  padding: 3cqw 4% 7cqw;
  background: linear-gradient(180deg, #0d2844, #0b3e78);
  text-align: center;
}
.location-details p {
  margin: 0 0 .45em;
  font-size: clamp(16px, 5cqw, 27px);
  font-weight: bold;
}
.map {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: .25em 1.35em;
  border-radius: 99px;
  background: #e16a55;
  color: #281110;
  font-size: clamp(16px, 5cqw, 27px);
  font-weight: bold;
  text-decoration: none;
}
.location-art, .entrance-art, .dress-art { position: relative; overflow: clip; }
.location-art img, .entrance-art img, .dress-art img {
  display: block;
  width: 100%;
  height: auto;
}
.location-art {
  height: 97.4cqw;
  margin-top: -5cqw;
  mask-image: linear-gradient(transparent, #000 5cqw);
}
.location-art img { position: absolute; top: -22.52cqw; }
.entrance-art { height: 145.45cqw; }
.dress-art { height: 140.9cqw; }
.dress-art img { position: absolute; top: -159.1cqw; }
.dress-divider {
  height: 23cqw;
  display: grid;
  place-items: center;
  color: #d3a66c;
  background: linear-gradient(115deg, #02232d, #031f2a 56%, #321a21);
  font-size: clamp(12px, 4cqw, 21px);
}
.dress-divider span { text-shadow: -2.7em 0 #9c7658, 2.7em 0 #9c7658; }
.entrance-arrow {
  position: absolute;
  top: -22.52cqw;
  left: 0;
  width: 100%;
  height: auto;
  fill: none;
  stroke: #ffd184;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px #37160b);
  pointer-events: none;
}

.rsvp-art { position: relative; height: 181cqw; overflow: clip; }
.rsvp-art img { display: block; width: 100%; height: auto; }
#rsvp {
  position: relative;
  padding: 3cqw 8.5% 7cqw;
  background: linear-gradient(180deg, #013638, #062d34 90%);
  font-size: clamp(14px, 3.8cqw, 21px);
  line-height: 1.875;
}
#rsvp fieldset { margin: 0 0 .45em; padding: 0; border: 0; min-width: 0; }
#rsvp legend { padding: 0; font-size: 1.28em; font-weight: bold; line-height: 1.4; }
.field {
  display: block;
  width: 100%;
  margin-bottom: .45em;
  padding: .18em .8em;
  border: 1px solid #d4ae6a99;
  border-radius: 6px;
  background: #062b33;
  color: #fff1d2;
  font: inherit;
  font-size: max(16px, 1em);
}
.field::placeholder { color: #eedfc6; }
.choice {
  display: flex;
  align-items: center;
  gap: .75em;
  cursor: pointer;
}
.choice input { flex: none; width: 1em; height: 1em; margin: 0; accent-color: #ff765e; }
.choice:has(input:disabled) { opacity: .48; cursor: default; }
.drink-hint { margin: 0; }
.submit {
  display: block;
  width: min(81%, 340px);
  min-height: 44px;
  margin: .55em auto 0;
  padding: .2em .5em;
  border: 0;
  border-radius: 99px;
  background: #e16a55;
  color: #281110;
  font: bold clamp(17px, 5cqw, 27px)/1.2 Georgia, serif;
  cursor: pointer;
}
.submit:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #ffe4a0; outline-offset: 2px; }
.choice:has(input:focus-visible) { outline: 2px solid #ffe4a0; outline-offset: 1px; }
#status {
  margin: .6em 0 0;
  font: 12px/1.5 system-ui, sans-serif;
  text-align: center;
}
footer { text-align: center; padding: 12px 12px max(16px, env(safe-area-inset-bottom)); font-size: 13px; }
footer a { color: inherit; }
#microphone.opening { pointer-events: none; }
#microphone.opening > *, #microphone.opening::before { visibility: hidden; }
#entrance { opacity: 0; pointer-events: none; }
#entrance.playing { opacity: 1; }

/* Отступы сняты с пустых краёв кадров. Координаты карты и формы
   остаются привязаны к полному размеру исходного макета. */
main { container-type: inline-size; }
main, #program { display: flex; flex-direction: column; }
.join {
  --trim-top: 0px;
  --trim-bottom: 0px;
  --seam-fade: 0px;
  margin-block-start: calc(-1 * (var(--trim-top) + var(--seam-fade)));
  margin-block-end: calc(-1 * var(--trim-bottom));
  overflow: clip;
  clip-path: inset(0 0 var(--trim-bottom) 0);
}
.join:not(.stage) {
  mask-image: linear-gradient(to bottom, transparent var(--trim-top),
    #000 calc(var(--trim-top) + var(--seam-fade)));
}
.stage { --trim-bottom: 1.9cqw; }
.dance-join { --trim-top: 4.5cqw; --seam-fade: 2cqw; --trim-bottom: .6cqw; }
.location-join { --seam-fade: 3.5cqw; --trim-bottom: .9cqw; }
.entrance-join { --trim-top: 4.9cqw; --seam-fade: 2.2cqw; --trim-bottom: 6.56cqw; }
.rsvp-join { --seam-fade: 1.25cqw; --trim-bottom: 2.2cqw; }
.gifts-join { --trim-top: 7.4cqw; --seam-fade: 2cqw; height: 186cqw; }
#stage-still:focus { outline: none; }

.finale {
  color: #fff1ca;
  background: #062b32;
  text-align: center;
}
#finale-title {
  margin: 0;
  padding: .8em 6% .45em;
  font: italic 500 clamp(26px, 8.6cqw, 47px)/1.04 "Mila Invitation", Georgia, serif;
  text-wrap: balance;
}
#countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 7%;
  padding: 2.5cqw 0 6cqw;
}
.timer-cell { display: grid; align-content: start; font-size: clamp(12px, 4.1cqw, 22px); }
.timer-cell + .timer-cell { border-left: 1px solid #d6b87675; }
.timer-cell b {
  font: bold 10cqw/1 Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums;
}
.finale-video { position: relative; margin: 0; }
.finale-video video { display: block; width: 100%; height: auto; }
.finale-video figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: .85em 0 .24em;
  background: linear-gradient(transparent, #062b32);
  font: italic 500 clamp(28px, 9.5cqw, 52px)/1 "Mila Invitation", Georgia, serif;
  text-shadow: 0 2px 6px #03222a;
}
/* Финальная часть исходного макета начинается ниже старого таймера. */
.finale-bow { position: relative; height: 69cqw; overflow: clip; }
.finale-bow img { position: absolute; bottom: 0; width: 100%; height: auto; display: block; }

/* Свет привязан к деталям макетов. Ни кадры, ни надписи не сдвигаются. */
.scene-light, .bow-color { position: absolute; pointer-events: none; }
.scene-light {
  left: var(--light-x);
  top: var(--light-y);
  width: var(--light-width);
  aspect-ratio: var(--light-ratio, 1);
  transform: translate(-50%, -50%);
  opacity: 0;
  background: radial-gradient(ellipse, #ffe2a6a6 0%, #ffc37454 27%, #ffb05716 50%, transparent 72%);
}
.facade-light { --light-x: 23%; --light-y: 47%; --light-width: 46%; --light-ratio: .75; }
.stage-light { --light-x: 92.4%; --light-y: 21.5%; --light-width: 32%; }
.spotlight { --light-x: 11.5%; --light-y: 81.3%; --light-width: 42%; }
.spotlight-cool {
  --light-x: 88%;
  --light-y: 80.7%;
  --light-width: 39%;
  background: radial-gradient(ellipse, #9df0f59c 0%, #54d4ed57 28%, #53c5df13 52%, transparent 72%);
}
.bow-color {
  left: 36.48%;
  top: 5.52%;
  width: 26.67%;
  height: 23.87%;
  opacity: 0;
  background: url("assets/montage-v3/panel-4-clean.webp") 49.75% 82.82% / 375% auto no-repeat;
  clip-path: polygon(2% 28%, 9% 4%, 16% 2%, 29% 9%, 41% 20%, 47% 25%, 54% 25%,
    62% 18%, 72% 9%, 84% 3%, 91% 3%, 97% 25%, 99% 38%, 96% 47%, 88% 49%,
    76% 48%, 72% 46%, 85% 59%, 94% 80%, 94% 92%, 80% 85%, 74% 100%,
    69% 81%, 62% 65%, 55% 48%, 53% 42%, 46% 42%, 45% 51%, 38% 69%,
    30% 82%, 25% 99%, 20% 85%, 7% 92%, 11% 78%, 20% 63%, 31% 49%,
    27% 48%, 12% 50%, 4% 47%, 1% 41%);
}
@media (prefers-reduced-motion: no-preference) {
  .scene-light.is-lit { animation: scene-light 3.2s ease-in-out; }
  .spotlight.is-lit { animation: scene-light 3.6s ease-in-out infinite; }
  .spotlight-cool.is-lit { animation-delay: -.75s; }
  .bow-color.is-lit { animation: bow-color 6s ease-in-out infinite; }
}
@keyframes scene-light {
  0%, 100% { opacity: 0; }
  45%, 56% { opacity: .8; }
}
@keyframes bow-color {
  0%, 100% { opacity: 0; filter: hue-rotate(0deg); }
  32% { opacity: 1; filter: hue-rotate(65deg); }
  65% { opacity: 1; filter: hue-rotate(158deg); }
}

#stage-greeting {
  position: absolute;
  inset: 15.7% 7% auto;
  min-height: 18%;
  margin: 0;
  display: grid;
  place-items: center;
  font: italic 500 clamp(16px, var(--greeting-size), 49px)/1.13 "Mila Invitation", "Mila Invitation Latin", Georgia, serif;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
  color: #fff1cd;
  text-shadow: 0 2px 6px #041e24;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  #stage-greeting { animation: greeting-in .7s ease-out both; }
}
@keyframes greeting-in { from { opacity: 0; } to { opacity: 1; } }

#stage-wave {
  position: absolute;
  inset: 84% 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  height: clamp(36px, 12cqw, 64px);
  gap: clamp(4px, 1.35cqw, 8px);
  pointer-events: none;
}
#stage-wave span {
  width: clamp(3px, 1cqw, 6px);
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(#ffe5af, #bc8956);
  box-shadow: 0 0 6px #fbc77850;
  transform: scaleY(.12);
}
#stage-wave span:nth-child(n+5):nth-child(-n+9) { transform: scaleY(.2); }
#stage-wave span:nth-child(7) { transform: scaleY(.28); }

.scene-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.scene-particles > span {
  position: absolute;
  top: var(--y);
  left: var(--x);
  opacity: 0;
}
.scene-sparkles > span {
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #fff7cd;
  box-shadow: 0 0 4px 2px #ffc164, 0 0 13px 4px #f7a93280;
}
.scene-sparkles > span::after {
  content: "";
  position: absolute;
  inset: -65%;
  background: #fff1b1;
  clip-path: polygon(50% 0, 57% 43%, 100% 50%, 57% 57%, 50% 100%, 43% 57%, 0 50%, 43% 43%);
}
.scene-snow > span {
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #fffaf1;
  box-shadow: 0 0 4px #d9e8ff80;
}
.location-art .entrance-arrow { z-index: 1; }
#stage-greeting, #stage-wave { z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .particles-visible:not(.stage) .scene-sparkles > span,
  .stage.invitation-settled.particles-visible .scene-sparkles > span {
    animation: mila-sparkle var(--duration) var(--delay) infinite ease-in-out;
  }
  .particles-visible .scene-snow > span {
    animation: mila-snow var(--duration) var(--delay) infinite linear;
  }
  .particles-visible .entrance-arrow {
    animation: mila-arrow 1.7s ease-in-out infinite;
  }
}
@keyframes mila-sparkle {
  0%, 62%, 100% { opacity: 0; transform: scale(.2); }
  22% { opacity: 1; transform: scale(1.05); }
  40% { opacity: .48; transform: scale(.65); }
}
@keyframes mila-snow {
  0% { opacity: 0; transform: translate3d(0, -8px, 0); }
  14%, 83% { opacity: var(--strength); }
  100% { opacity: 0; transform: translate3d(var(--drift), 100cqw, 0); }
}
@keyframes mila-arrow {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}
