/* =========================================================
   Шаблон «Павлиний сад». Всё приглашение — одна сцена 9:16: закрытый конверт-раскладка с бантом,
   по касанию бант соскальзывает, створки раздвигаются, и идёт видео — беседка на закате, павлины,
   в верхних углах распускаются цветочные рамки. Текст — в светлом небе над беседкой,
   страницы сменяются кнопкой «Далее». Размеры — в долях сцены (cqw/cqh).
   ========================================================= */

:root {
  --ivory: #FBF5EC;
  /* тёплый закат: золото надписей, пыльная роза имён и мягкие коричневые чернила */
  --ink: #6A5244;
  --ink-2: rgba(106, 82, 68, .86);
  --gold: #A9813F;
  --gold-2: #C9A469;
  --rose: #B8706A;
  --gold-line: rgba(169, 129, 63, .42);
  --gold-text: linear-gradient(100deg, #9C7536 0%, #D6B57A 30%, #A9813F 55%, #E7CD97 75%, #9C7536 100%);
  --glass: rgba(255, 252, 247, .74);

  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Great Vibes", cursive;
  --sans: "Montserrat", system-ui, sans-serif;
  --ease: cubic-bezier(.19, 1, .22, 1);
  /* «камера» — плавный разгон и долгое мягкое торможение */
  --cam: cubic-bezier(.55, 0, .15, 1);
  /* светлое свечение вокруг букв: текст читается на любом участке картинки */
  --glow: 0 0 14px rgba(255, 251, 245, .95), 0 0 3px rgba(255, 251, 245, .9);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  display: grid;
  place-items: center;
  margin: 0;
  overflow: hidden;
  background: #EFE6DD;
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* вокруг сцены — та же картинка, сильно размытая и высветленная: края сцены не видны */
.backdrop {
  position: fixed;
  inset: -10%;
  z-index: -1;
  background: url("images/loop-poster.jpg") center / cover;
  filter: blur(40px) brightness(1.06) saturate(.85);
  opacity: .9;
}

img, svg { display: block; }
h1, h2, p { margin: 0; font-weight: 400; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* ---------- Сцена 9:16 ---------- */

.stage {
  position: relative;
  width: min(100vw, 56.25vh);
  width: min(100vw, 56.25svh);
  height: min(100vh, 177.78vw);
  height: min(100svh, 177.78vw);
  overflow: hidden;
  container-type: size;
  box-shadow: 0 30px 80px -30px rgba(94, 70, 54, .45);
  user-select: none;
  -webkit-user-select: none;
}

.stage__media, .stage__media video { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage__media video { object-fit: cover; }
.stage__open.is-done { visibility: hidden; }
/* под видео — первый кадр раскрытия: пока ролик стартует, вместо пустого фона виден тот же кадр */
.stage__media { background: url("images/open-poster.jpg") center / 100% 100% no-repeat; }
/* бесконечная сцена спрятана до своей очереди, иначе её кадр мелькает, пока раскрытие стартует */
.stage__loop { visibility: hidden; }
.stage__loop.is-on { visibility: visible; }

/* --- при листании страниц разлетается золотая пыль --- */
.dust-box { position: absolute; inset: 0; pointer-events: none; }
.dust {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF4D6, #D9B56E 60%, transparent 72%);
  box-shadow: 0 0 6px 1px rgba(230, 196, 120, .7);
  animation: dust-fly var(--dur) cubic-bezier(.2, .7, .3, 1) var(--delay) both;
}
@keyframes dust-fly {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1); }
}

/* ---------- Конверт-раскладка ----------
   Две створки с павлинами закрывают сцену целиком, на шве — бант. По касанию бант
   развязывается и соскальзывает, створки раздвигаются влево и вправо, а за ними уже идёт видео. */

.gate { position: absolute; inset: 0; z-index: 5; perspective: 1400px; pointer-events: none; }
.gate__door {
  position: absolute;
  top: 0;
  width: 50.2%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
}
/* петли — на внешних краях, шов — по центру */
.gate__door--l { left: 0; object-position: 100% 50%; transform-origin: 0 50%; box-shadow: inset -6px 0 10px -6px rgba(120, 80, 50, .3); }
.gate__door--r { right: 0; object-position: 0 50%; transform-origin: 100% 50%; box-shadow: inset 6px 0 10px -6px rgba(120, 80, 50, .3); }
.gate__bow {
  position: absolute;
  left: 50%;
  top: 19cqh;
  width: 24cqw;
  translate: -50% 0;
  transform-origin: 50% 12%;
  filter: drop-shadow(0 6px 10px rgba(120, 70, 50, .3));
  animation: bow-sway 3.4s ease-in-out infinite alternate;
}
/* бант до касания чуть покачивается на шве — подсказывает, куда нажать */
@keyframes bow-sway {
  from { transform: rotate(-2deg); }
  to { transform: rotate(2deg) scale(1.02); }
}
/* касание: петли распускаются, бант соскальзывает вниз по шву и тает */
.is-gate-open .gate__bow { animation: bow-untie 1.1s cubic-bezier(.5, 0, .75, .45) forwards; }
@keyframes bow-untie {
  0%   { transform: none; opacity: 1; }
  25%  { transform: scale(1.12, .9); }
  55%  { transform: translateY(6cqh) scale(.8, 1.15) rotate(4deg); opacity: 1; filter: drop-shadow(0 6px 10px rgba(120, 70, 50, .3)) blur(0); }
  100% { transform: translateY(40cqh) scale(.6, 1.3) rotate(10deg); opacity: 0; filter: drop-shadow(0 6px 10px rgba(120, 70, 50, 0)) blur(4px); }
}
/* створки раздвигаются влево и вправо, как раздвижные двери, и уходят за края экрана */
.is-gate-open .gate__door--l { animation: door-l 1.9s cubic-bezier(.65, 0, .25, 1) .5s forwards; }
.is-gate-open .gate__door--r { animation: door-r 1.9s cubic-bezier(.65, 0, .25, 1) .5s forwards; }
@keyframes door-l { to { transform: translateX(-102%); } }
@keyframes door-r { to { transform: translateX(102%); } }
.is-gate-gone .gate, .is-instant .gate { display: none; }

/* ---------- Касание для открытия ---------- */

.tap { position: absolute; inset: 0; z-index: 6; padding: 0; border: 0; background: none; cursor: pointer; }
.is-gate-open .tap, .is-instant .tap { display: none; }
/* подсказка в духе сказки: золотая линия с полумесяцем, надпись каллиграфией с бегущим бликом
   и мелкая подпись — без рамки, прямо на бумаге конверта */
.tap__hint {
  position: absolute;
  left: 50%;
  top: 47.5cqh;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  filter: drop-shadow(0 0 8px rgba(255, 251, 246, .95));
  animation: hint 3.2s ease-in-out infinite;
}
.tap__orn { width: 34cqw; height: 3.8cqw; color: var(--gold); }
.tap__text {
  margin-top: .4cqh;
  font-family: var(--script);
  font-size: min(8.8cqw, 4.9cqh);
  line-height: 1.15;
  padding: 0 .15em;
  /* розовое золото с бликом, который медленно пробегает по буквам */
  background: linear-gradient(100deg, #A0603F 0%, #C98A6E 35%, #F6E1CF 48%, #C98A6E 60%, #A0603F 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hint-shine 3.6s ease-in-out infinite;
}
.tap__sub {
  margin-top: .2cqh;
  font-family: var(--sans);
  font-size: max(8.5px, 2.3cqw);
  letter-spacing: .32em;
  padding-left: .32em;
  text-transform: uppercase;
  color: #9C7B66;
}
@keyframes hint { 50% { opacity: .78; scale: 1.02; } }
@keyframes hint-shine { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- Страницы ---------- */

/* текст — в светлом небе: ниже цветочных рамок в углах и выше купола беседки */
.slides { position: absolute; top: 10cqh; bottom: 57.5cqh; left: 0; right: 0; z-index: 2; }
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20cqw;
  overflow-y: auto;
  scrollbar-width: none;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2cqh) scale(.98);
  filter: blur(6px);
  transition: opacity .45s ease, transform .5s ease, filter .45s ease, visibility 0s linear .5s;
}
.slide::-webkit-scrollbar { display: none; }
.slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  filter: none;
  transition: opacity .9s var(--ease) .3s, transform 1.1s var(--ease) .3s, filter .9s ease .3s, visibility 0s;
}

/* буквы: каждая проявляется из размытия, по очереди (--i — номер буквы, --d — задержка строки) */
.ch { display: inline-block; opacity: 0; filter: blur(6px); transform: translateY(.3em) scale(.9); }
.w { display: inline-block; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-in .ch { animation: ch-in 1.3s var(--ease) forwards; animation-delay: calc(var(--d, .35s) + var(--i, 0) * 45ms); }
.ch-now .ch { animation: none !important; opacity: 1; filter: none; transform: none; }
@keyframes ch-in {
  0% { text-shadow: 0 0 10px rgba(226, 190, 120, 1), 0 0 22px rgba(226, 190, 120, .9); }
  45% { opacity: 1; filter: blur(0); transform: none; text-shadow: 0 0 8px rgba(226, 190, 120, .95), 0 0 18px rgba(226, 190, 120, .6); }
  100% { opacity: 1; filter: blur(0); transform: none; }
}

.reveal { opacity: 0; filter: blur(6px); transform: translateY(1.4cqh); }
.is-in .reveal { animation: rise 1.1s var(--ease) forwards; animation-delay: calc(.5s + var(--r, 0) * .16s); }
@keyframes rise { to { opacity: 1; filter: none; transform: none; } }

.flourish { width: 32cqw; height: 3.2cqw; margin: 1.2cqh auto; color: var(--gold-2); stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; flex: none; }
.flourish.reveal { filter: none; transform: none; }
.is-in .flourish { animation: draw 1.6s ease-out forwards, bud 1.4s var(--ease) both; animation-delay: calc(.5s + var(--r, 0) * .16s); }
@keyframes bud { from { scale: .6; rotate: 30deg; } to { scale: 1; rotate: 0deg; } }
@keyframes draw { from { opacity: 1; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes fade-in { to { opacity: 1; } }

/* ---------- Типографика ---------- */

.cap {
  font-family: var(--sans);
  font-size: max(9.5px, 2.7cqw);
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  color: var(--rose);
  text-shadow: var(--glow);
}
.title { font-weight: 400; font-size: min(5.4cqw, 3cqh); letter-spacing: .1em; padding-left: .1em; white-space: nowrap; text-transform: uppercase; color: var(--ink); line-height: 1.15; text-shadow: var(--glow); }
.text { max-width: 100%; font-size: min(5cqw, 2.7cqh); line-height: 1.55; color: var(--ink-2); text-shadow: var(--glow); }
.welcome .text { font-style: italic; font-size: min(5.4cqw, 2.9cqh); }
.bismillah { font-family: "Amiri", serif; font-size: min(6.6cqw, 3.6cqh); color: var(--gold); text-shadow: var(--glow); }
.date { font-size: min(5.4cqw, 2.9cqh); letter-spacing: .22em; padding-left: .22em; color: var(--ink); text-shadow: var(--glow); }

/* имена — каллиграфией, как на референсе. Связная пропись не разбивается на буквы:
   строка проявляется из дымки слева направо, будто её пишут */
.couple { margin: 1.4cqh 0 0; font-weight: 400; line-height: 1; }
.script {
  display: block;
  padding: 0 .18em .06em;
  font-family: var(--script);
  /* имена одной строкой; длинные уменьшаются, чтобы не задеть цветы (--len — длина строки, ставит main.js) */
  font-size: min(11cqw, 6.2cqh, calc(150cqw / var(--len, 12)));
  white-space: nowrap;
  line-height: 1.12;
  color: var(--rose);
  text-shadow: var(--glow);
  opacity: 0;
  -webkit-mask: linear-gradient(90deg, #000 45%, transparent 55%) 100% 0 / 260% 100% no-repeat;
          mask: linear-gradient(90deg, #000 45%, transparent 55%) 100% 0 / 260% 100% no-repeat;
  filter: blur(6px);
}
.is-in .script { animation: ink-in 2.4s cubic-bezier(.45, .1, .35, 1) 2.2s forwards; }
@keyframes ink-in {
  0%   { opacity: 1; -webkit-mask-position: 100% 0; mask-position: 100% 0; filter: blur(6px); }
  100% { opacity: 1; -webkit-mask-position: 0 0; mask-position: 0 0; filter: blur(0); }
}
.ch-now .script, .ch-now.script { animation: none !important; opacity: 1; -webkit-mask: none; mask: none; filter: none; }
.couple__amp { display: block; margin: -.2em 0 -.1em; font-family: var(--script); font-size: min(9cqw, 5cqh); color: var(--gold-2); text-shadow: var(--glow); opacity: 0; }
.is-in .couple__amp { animation: fade-in 1.2s ease 1.5s forwards; }

.invite { margin-top: .8cqh; font-style: italic; font-size: min(4.8cqw, 2.6cqh); color: var(--ink-2); text-shadow: var(--glow); }

.chapter {
  display: flex;
  align-items: center;
  gap: 2.4cqw;
  margin-bottom: 1cqh;
  font-family: var(--sans);
  font-size: max(9px, 2.4cqw);
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: var(--glow);
}
.chapter::before, .chapter::after { content: ""; width: 7cqw; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }

.std { line-height: 1; }
.std__big {
  display: block;
  font-weight: 400;
  font-size: min(15cqw, 8.4cqh);
  letter-spacing: .14em;
  padding-left: .14em;
  /* буквы проявляются по одной, поэтому золото сплошное: градиент по тексту не переживает разбивку на буквы */
  color: #A9813F;
  text-shadow: 0 1px 0 rgba(255, 246, 225, .8), var(--glow);
}
.std__the { display: block; margin: -.15em 0 -.05em; font-family: var(--script); font-size: min(9cqw, 5cqh); color: var(--gold); opacity: 0; text-shadow: var(--glow); }
.is-in .std__the { animation: fade-in 1.2s ease .9s forwards; }

/* очередь на первой странице */
.slide--cover .std__big:first-child { --d: .1s; }
.slide--cover .std__big:last-child { --d: .9s; }
.slide--cover .flourish { margin: .8cqh auto .6cqh; --r: 9; }
.slide--cover > .cap { --d: 1.8s; color: var(--gold); }
.slide--cover .script { margin-top: .4cqh; }
.slide--cover .date { margin-top: .4cqh; --d: 3.8s; }
.slide--cover .cap--city { margin-top: .8cqh; --d: 4.3s; color: var(--gold); }

.pen { font-family: var(--script); font-size: min(7.4cqw, 4cqh); color: var(--rose); line-height: 1.2; text-shadow: var(--glow); }
.pen span { display: inline-block; padding: 0 .1em; clip-path: inset(0 100% 0 0); }
.is-in .pen span { animation: write 2.2s cubic-bezier(.45, .1, .4, 1) .9s forwards; }
@keyframes write { to { clip-path: inset(0 -6% 0 -6%); } }

/* ---------- Таймер ---------- */

.slide.countdown { overflow: visible; }
.timer { position: relative; display: flex; justify-content: center; gap: 1.8cqw; margin-top: .6cqh; }
/* ячейка — светлое матовое стекло с золотой рамкой, на ней золотая наклейка */
.timer__cell {
  position: relative;
  width: 14.6cqw;
  padding: 1.6cqh 0 1.3cqh;
  overflow: hidden;
  border: 1px solid var(--gold-line);
  border-radius: 2.4cqw;
  background: rgba(255, 252, 247, .84); /* плотнее: подложка без размытия */
  box-shadow: 0 10px 22px -14px rgba(94, 70, 54, .5);
}
/* три цифры дней должны целиком помещаться под наклейкой */
.timer b { display: block; font-weight: 400; font-size: min(8cqw, 4.4cqh); line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.timer span { display: block; margin-top: 1cqh; font-family: var(--sans); font-size: max(7.5px, 1.9cqw); letter-spacing: .1em; text-transform: uppercase; color: var(--rose); }
.countdown > .cap { margin-top: 1cqh; }
.countdown .chapter { margin-bottom: .4cqh; }
.countdown .title { margin-bottom: 1.2cqh; }
.schedule > .cap, .welcome > .cap { margin-top: .4cqh; }

.scratch {
  position: absolute;
  inset: 3px;
  z-index: 2;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border-radius: 1.8cqw;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 3px 5px rgba(94, 70, 54, .35)) brightness(1) blur(0);
  transition: opacity .45s var(--ease), filter .45s var(--ease);
}
.scratch:active { cursor: grabbing; }
.scratch:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.scratch.is-gone { opacity: 0; filter: drop-shadow(0 3px 5px rgba(94, 70, 54, 0)) brightness(1.5) blur(2px); pointer-events: none; }
.timer__cell.is-revealed { animation: cell-pop 1.1s var(--ease); }
@keyframes cell-pop {
  0% { transform: scale(.95); }
  35% { transform: scale(1.06); box-shadow: 0 0 0 1px rgba(196, 160, 106, .7), 0 0 26px 4px rgba(201, 168, 102, .45); }
  100% { transform: none; }
}
.timer__cell.has-foil:not(.is-touched)::after {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 3;
  border-radius: 1.8cqw;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 246, 220, .75) 50%, transparent 62%) -150% 0 / 250% 100% no-repeat;
  mix-blend-mode: soft-light;
  animation: foil-shine 4.2s ease-in-out infinite;
}
.timer__cell:nth-child(2)::after { animation-delay: .25s; }
.timer__cell:nth-child(3)::after { animation-delay: .5s; }
.timer__cell:nth-child(4)::after { animation-delay: .75s; }
@keyframes foil-shine {
  0%, 55% { background-position: -150% 0; }
  85%, 100% { background-position: 250% 0; }
}
/* свой слой отрисовки: браузер перерисовывает его целиком и не оставляет следов хлопьев */
.scratch-fx { position: absolute; z-index: 5; pointer-events: none; will-change: transform; }
.timer-hint { margin-top: 1.2cqh; font-family: var(--sans); font-size: max(9px, 2.4cqw); letter-spacing: .12em; color: var(--ink-2); text-shadow: var(--glow); }
.timer-hint.is-done { opacity: 0 !important; transition: opacity .6s; }

/* ---------- Программа ---------- */

.plan { width: 100%; margin: .4cqh 0 0; padding: 1cqh 4cqw; list-style: none; border-radius: 3cqw; background: rgba(255, 252, 247, .55); }
.plan li {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4cqw;
  align-items: baseline;
  padding: .7cqh 0;
  border-bottom: 1px solid rgba(169, 129, 63, .22);
}
.plan li:last-child { border-bottom: 0; }
.plan time { text-align: right; font-size: min(6cqw, 3.2cqh); letter-spacing: .04em; background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan p { text-align: left; font-family: var(--sans); font-size: max(9px, 2.5cqw); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }

/* ---------- Место ---------- */

.location .cap { margin-top: .4cqh; }
.venue { margin-top: .6cqh; font-style: italic; font-size: min(7.4cqw, 4cqh); line-height: 1.15; color: #8C6440; text-shadow: var(--glow); }
.address { margin-top: 1cqh; font-size: min(4.8cqw, 2.6cqh); color: var(--ink-2); text-shadow: var(--glow); }

.btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 2.2cqh;
  padding: 0 7cqw;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--glass);
  font-family: var(--sans);
  font-size: max(10px, 2.6cqw);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background .5s var(--ease), border-color .5s;
}
.btn-line:hover { background: rgba(255, 252, 247, .95); border-color: var(--gold); }
.btn-line--solid { background: linear-gradient(120deg, #9C7536, #D6B57A 50%, #A07A3B); border-color: transparent; color: #FFFDF8; font-weight: 500; box-shadow: 0 10px 22px -12px rgba(140, 100, 50, .7); }
.btn-line--solid:hover { background: linear-gradient(120deg, #A67F3E, #E0C189 50%, #AA8443); }

/* ---------- Для гостей ---------- */

.wish { margin-top: 1.6cqh; }
.wish__icon { width: 7.5cqw; height: 7.5cqw; margin: 0 auto .6cqh; fill: none; stroke: var(--gold-2); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.wish .text { margin-top: .6cqh; font-size: min(4.6cqw, 2.5cqh); }

/* ---------- Финал ---------- */

.photo { width: 22cqw; margin: 0 auto 1.4cqh; padding: 1.4cqw; border: 1px solid var(--gold-line); border-radius: 50% / 42%; background: rgba(255, 252, 247, .6); flex: none; }
.photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 38%; border-radius: 50% / 42%; }
.names--final { margin-top: .6cqh; font-family: var(--script); font-size: min(9cqw, 5cqh); line-height: 1.1; color: var(--rose); text-shadow: var(--glow); --d: 1.8s; }

/* ---------- Навигация ---------- */

.nav {
  position: absolute;
  left: 0;
  right: 0;
  /* под текстом, в небе над куполом беседки */
  bottom: 51.5cqh;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2cqw;
  opacity: 0;
  pointer-events: none;
}
.is-open .nav { animation: fade-in 1s ease 4.6s forwards; pointer-events: auto; }
.is-preview .nav { animation-delay: 0s; }
.nav__back, .nav__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink);
  cursor: pointer;
  transition: background .4s, border-color .4s, opacity .4s;
}
.nav__back { width: 38px; }
.nav__back svg { width: 20px; height: 20px; transform: scaleX(-1); }
.nav__next { gap: 4px; padding: 0 10px 0 13px; font-family: var(--sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.nav__next svg { width: 18px; height: 18px; }
.nav__back:hover, .nav__next:hover { background: rgba(255, 252, 247, .95); border-color: var(--gold); }
.nav__back:disabled { opacity: 0; pointer-events: none; }
.nav__dots { display: flex; gap: 5px; padding: 6px 8px; border-radius: 999px; background: rgba(255, 252, 247, .6); }
.nav__dots i { width: 5px; height: 5px; border-radius: 3px; background: rgba(169, 129, 63, .35); transition: width .5s var(--ease), background .5s; }
.nav__dots i.is-on { width: 16px; background: var(--gold); }

/* ---------- Музыка ---------- */

.music {
  position: absolute;
  top: 2.4cqh;
  right: 4cqw;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold-line);
  border-radius: 50%;
  background: var(--glass);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.music__bars { display: flex; align-items: flex-end; gap: 3px; height: 15px; }
.music__bars i { width: 2px; height: 100%; background: var(--rose); transform-origin: bottom; animation: bars 1.1s ease-in-out infinite; }
.music__bars i:nth-child(2) { animation-delay: -.3s; }
.music__bars i:nth-child(3) { animation-delay: -.6s; }
.music__bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes bars { 50% { transform: scaleY(.3); } }
.music[aria-pressed="false"] .music__bars i { animation: none; transform: scaleY(.25); }

/* ---------- Окно ответа ---------- */

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--ivory);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(94, 70, 54, .6);
}
.dialog::backdrop { background: rgba(94, 70, 54, .3); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.form { position: relative; padding: 38px 26px 28px; text-align: center; background: radial-gradient(120% 90% at 50% 0%, #FFFDF9, #F6EEE4); }
.form::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--gold-line); border-radius: 12px; pointer-events: none; }
.form .cap { font-size: 10px; text-shadow: none; }
.form .title { margin-top: 4px; font-size: 28px; white-space: normal; text-shadow: none; }
.dialog__close { position: absolute; top: 14px; right: 16px; z-index: 1; width: 36px; height: 36px; border: 0; background: none; font-size: 26px; color: var(--rose); cursor: pointer; }
.field { display: block; margin-top: 16px; padding: 0; border: 0; text-align: left; }
.field > span, .field legend { display: block; margin-bottom: 6px; padding: 0; font-family: var(--sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--rose); }
.field input[type="text"], .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  background: #fff;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 1px solid var(--gold); outline-offset: 1px; }
.choice label { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 18px; cursor: pointer; }
.choice input { accent-color: var(--rose); width: 18px; height: 18px; }
.form .btn-line { width: 100%; margin-top: 22px; font-size: 11px; }
.form__thanks { margin-top: 14px; font-size: 19px; color: var(--ink-2); }
.pen-text { display: block; font-family: var(--script); font-size: 46px; color: var(--rose); line-height: 1.2; }
.form.is-sent .field, .form.is-sent .btn-line { display: none; }

/* ---------- Компактная типографика ----------
   Небо над беседкой — узкая полоса между цветочными рамками и куполом, поэтому всё мельче и плотнее,
   чем в других шаблонах: каждая страница целиком помещается без прокрутки */
.std__big { font-size: min(10.2cqw, 5.7cqh); }
.std__the { font-size: min(7cqw, 3.9cqh); }
.slide--cover .flourish { margin: .4cqh auto .3cqh; }
.script { font-size: min(9cqw, 5cqh, calc(130cqw / var(--len, 12))); }
.slide--cover .date { margin-top: 0; font-size: min(4.6cqw, 2.5cqh); }
.slide--cover .cap--city { margin-top: .4cqh; }
.flourish { margin: .7cqh auto; }
.title { font-size: min(5cqw, 2.8cqh); }
.text { font-size: min(4.2cqw, 2.3cqh); line-height: 1.45; }
.welcome .text { font-size: min(4.4cqw, 2.4cqh); }
.bismillah { font-size: min(5.4cqw, 3cqh); }
.plan { padding: .3cqh 4cqw; }
.plan li { padding: .15cqh 0; }
.schedule .flourish { margin: .4cqh auto; }
.plan time { font-size: min(4.4cqw, 2.4cqh); }
.plan p { font-size: max(7.5px, 2.2cqw); line-height: 1.25; }
.wish { margin-top: .8cqh; }
.wish__icon { width: 6cqw; height: 6cqw; margin-bottom: .2cqh; }
.wish .text { font-size: min(3.7cqw, 2.05cqh); line-height: 1.4; }
.btn-line { margin-top: 1.4cqh; }

/* ---------- Вытянутые телефоны ----------
   Экран уже, чем 9:16 (почти все современные телефоны): сцена заполняет экран по высоте,
   а края кадра немного уходят за бока — как вертикальное видео в сторис. Срезается не больше
   12% ширины с каждой стороны; --cx — ширина среза, на неё кнопки у края сдвигаются внутрь */
@media (max-aspect-ratio: 9/16) {
  .stage {
    --cx: max(0px, (min(56.25vh, 131.6vw) - 100vw) / 2);
    --cx: max(0px, (min(56.25svh, 131.6vw) - 100vw) / 2);
    width: min(56.25vh, 131.6vw);
    width: min(56.25svh, 131.6vw);
    height: min(100vh, 233.9vw);
    height: min(100svh, 233.9vw);
    margin: 0 calc(-1 * var(--cx, 0px));
  }
  .music { right: calc(4cqw + var(--cx, 0px)); }
}

/* ---------- Без сдвига вбок ----------
   Ветки, свет и холсты эффектов могут выходить за край сцены — страница от этого
   не должна сдвигаться пальцем вбок и «оттягиваться» на iPhone */
html, body { overflow: hidden; overscroll-behavior: none; }

/* ---------- Телефон боком ----------
   Приглашение — вертикальная открытка 9:16; на телефоне, повёрнутом боком, она превращается
   в узкую полоску, поэтому просим повернуть телефон (на компьютере подсказки нет) */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body::before {
    content: "Поверните телефон вертикально";
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 70px 24px 0;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23A9813F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><rect x='16' y='6' width='16' height='28' rx='3'/><path d='M22 30h4'/><path d='M38 26a14 14 0 0 1-12 14'/><path d='M29 37l-3 3 3 3'/></svg>") center calc(50% - 26px) / 46px no-repeat, #F6ECE2;
    font: 500 12px/1.5 "Montserrat", system-ui, sans-serif;
    letter-spacing: .24em;
    text-transform: uppercase;
    text-align: center;
    color: #A9813F;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .001s !important; transition-delay: 0s !important; }
  .ch, .reveal, .couple__amp, .nav { opacity: 1 !important; filter: none !important; transform: none !important; }
  .script { opacity: 1 !important; -webkit-mask: none !important; mask: none !important; filter: none !important; }
  .slide.is-active { filter: none; transform: none; }
  .flourish { stroke-dashoffset: 0 !important; opacity: 1 !important; }
  .pen span { clip-path: none !important; }
  .gate__bow { animation: none; }
}
