  /* шрифт обработан tools/champion-script-tame.py — без сверхдлинных росчерков «д» и «ф».
     Поменяли файл шрифта — поменяйте и этот комментарий: адрес CSS с хэшем считается по его тексту,
     иначе закэшированный CSS ещё год будет ссылаться на старый шрифт */
  @font-face {
    font-family: "Champion Script";
    src: url("/champion-script-b10c444b88b0cfd89fcffd6d97b1e57a.woff2") format("woff2");
    font-display: swap;
  }
  /* рукописные OFL-шрифты с дорисованными ң ө ү (tools/script-font-kg.py, лицензии рядом — *.OFL.txt);
     браузер качает файл, только если шрифт выбран у надписи. Пересобрали шрифт — поднять ?v */
  @font-face { font-family: "Great Vibes KG"; src: url("/fonts/great-vibes-kg-ed1675fb9301469ba434d01d561f06ae.woff2?v=2") format("woff2"); font-display: swap; }
  @font-face { font-family: "Comforter KG"; src: url("/fonts/comforter-kg-999c119f7343b7cd1c10d8a6dc89c451.woff2?v=2") format("woff2"); font-display: swap; }
  @font-face { font-family: "Marck KG"; src: url("/fonts/marck-kg-5329cfffa19b2fb75534a2f6e2881e06.woff2?v=2") format("woff2"); font-display: swap; }
  @font-face { font-family: "Champignon KG"; src: url("/assets/akkuu/fonts/champignon-kg-33e0a308c15b8bf3b54f81444bc87a4c.woff2?v=4") format("woff2"); font-display: swap; }
  :root {
    --s: 1.21875;                 /* 390 / 320; уточняется скриптом */
    --wine: #431822;              /* основное поле */
    --deep: #2b0f16;              /* глубокий бордо: обложка, ленты, финал */
    --gold: #d2ad72;
    --gold-soft: rgba(210, 173, 114, .55);
    --milk: #fbf3ea;              /* текст, тёплый белый */
    --milk-soft: rgba(251, 243, 234, .72);
    --paper: #f1e6d4;
    --ink: #4b1320;
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --script: "Champion Script", cursive;
    --serif: "Cormorant Garamond", Georgia, serif;
    --sc: "Cormorant SC", "Cormorant Garamond", Georgia, serif;
  }
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; background: var(--deep); }
  body {
    margin: 0;
    color: var(--milk);
    font-family: var(--serif);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: lining-nums;
  }
  html.env-lock, html.env-lock body { overflow: hidden; }
  main { position: relative; max-width: 430px; margin: 0 auto; background: var(--wine); overflow: hidden; }
  p, h1, h2 { margin: 0; font-weight: inherit; }
  .defs { position: absolute; width: 0; height: 0; overflow: hidden; }

  /* ---------- Артборд: сцена 320 px, масштабируется целиком (как Tilda Zero Block) ---------- */
  .ab { position: relative; height: calc(var(--h) * var(--s) * 1px); }
  .stage {
    position: absolute;
    top: 0; left: 50%;
    width: 320px;
    height: calc(var(--h) * 1px);
    transform: translateX(-50%) scale(var(--s));
    transform-origin: 50% 0;
  }
  .el { position: absolute; top: calc(var(--t) * 1px); left: calc(var(--l, 0) * 1px); width: calc(var(--w, 320) * 1px); text-align: center; }
  /* предпросмотр в админке: надписи перетаскиваются (invitation.js) */
  html.preview [data-slot] { cursor: grab; touch-action: none; user-select: none; }
  html.preview [data-slot]:hover { outline: 1px dashed rgba(210, 173, 114, .7); outline-offset: 2px; }

  /* ---------- Типографика ---------- */
  .script { font-family: var(--script); font-style: var(--script-style); font-weight: var(--script-weight);
            font-size-adjust: var(--script-adjust); letter-spacing: var(--script-spacing); line-height: 1.15; white-space: nowrap; }
  .script.names { font-family: var(--names); font-style: var(--names-style); font-weight: var(--names-weight);
                  font-size-adjust: var(--names-adjust); letter-spacing: normal; }
  .script.hosts { font-family: var(--hosts); font-style: var(--hosts-style); font-weight: var(--hosts-weight);
                  font-size-adjust: var(--hosts-adjust); letter-spacing: normal; }

  /* ---------- Наборы шрифтов (конструктор, InvitationContent.PART_CHOICES.fonts): класс fonts-<набор> на <html>.
     Три роли, у каждой свой шрифт: --names — имена героев (.script.names), --hosts — имена родителей
     (.script.hosts), --script — заголовки разделов, конверт, анкета. Кегли в разметке подобраны под Champion Script,
     у которого строчные — 0.2 кегля (у обычных шрифтов ~0.5): font-size-adjust (-adjust) ставит высоту строчных
     других шрифтов в долю кегля, и те же кегли дают соразмерные надписи ---------- */
  :root {
    --script-style: normal; --script-weight: 400; --script-adjust: none; --script-spacing: normal;
    --names: var(--script); --names-style: normal; --names-weight: 400; --names-adjust: none;
    --hosts: var(--script); --hosts-style: normal; --hosts-weight: 400; --hosts-adjust: none;
  }
  /* у всех наборов, кроме «как было», родители — Cormorant курсив */
  html:not(.fonts-champion) { --hosts: "Cormorant Garamond", Georgia, serif; --hosts-style: italic; --hosts-weight: 500; --hosts-adjust: .27; }
  /* заголовки Playfair курсив / Cormorant SC (капитель вразрядку) */
  html.fonts-signature, html.fonts-grand, html.fonts-lobster { --script: "Playfair Display", Georgia, serif; --script-style: italic; --script-adjust: .3; }
  html.fonts-classic, html.fonts-hand, html.fonts-pacifico { --script: "Cormorant SC", Georgia, serif; --script-weight: 500; --script-adjust: .24; --script-spacing: .04em; }
  /* имена */
  html.fonts-signature { --names: "Champion Script", cursive; }
  html.fonts-classic { --names: "Playfair Display", Georgia, serif; --names-style: italic; --names-adjust: .31; }
  html.fonts-grand { --names: "Yeseva One", Georgia, serif; --names-adjust: .28; }
  html.fonts-hand { --names: "Bad Script", cursive; --names-adjust: .31; }
  html.fonts-lobster { --names: "Lobster", cursive; --names-adjust: .31; }
  html.fonts-pacifico { --names: "Pacifico", cursive; --names-adjust: .29; }
  /* рукописные с дорисованными ң ө ү (static/fonts, @font-face вверху) — и в именах, и в заголовках; доли — как у
     «Шрифтов надписей» (Typography.aspect: имена .31, заголовки .27); тонкий Comforter — крупнее, широкий Marck — мельче */
  html.fonts-vibes { --script: "Great Vibes KG", cursive; --names: "Great Vibes KG", cursive; }
  html.fonts-comforter { --script: "Comforter KG", cursive; --names: "Comforter KG", cursive; }
  html.fonts-marck { --script: "Marck KG", cursive; --names: "Marck KG", cursive; }
  html.fonts-vibes { --script-adjust: .27; --names-adjust: .31; }
  html.fonts-comforter { --script-adjust: .31; --names-adjust: .36; }
  html.fonts-marck { --script-adjust: .23; --names-adjust: .26; }
  /* Champignon «Ак куу» — как Champion: кегли разметки под него, без поправки (Typography.aspect) */
  html.fonts-champignon { --script: "Champignon KG", cursive; --names: "Champignon KG", cursive; }
  /* «Роза»: всё курсивом Playfair 2 (не Playfair Display — у того нет ң ө ү), родители — тоже им */
  html.fonts-roza {
    --script: "Playfair", Georgia, serif; --script-style: italic; --script-adjust: .3;
    --names: "Playfair", Georgia, serif; --names-style: italic; --names-adjust: .31;
    --hosts: "Playfair", Georgia, serif; --hosts-style: italic; --hosts-weight: 400; --hosts-adjust: .27;
  }
  /* Свой шрифт и размер отдельной надписи (админка → «Шрифты надписей», web.Typography) — во встроенном стиле
     поверх набора; размер — --k, поэтому кегли в разметке записаны как calc(… * var(--k, 1)) */
  .serif  { font-family: var(--serif); }
  .label  { font-family: var(--sc); font-weight: 500; font-size: 15px; line-height: 1.2; letter-spacing: 1.8px; color: var(--milk-soft); }
  .gold   { color: var(--gold); }

  /* ---------- Лента-разделитель «тасма»: одна полоса орнамента мүйүз ---------- */
  .ribbon { height: 40px; background: var(--deep); border-top: 1px solid var(--gold-soft); border-bottom: 1px solid var(--gold-soft); }
  .ribbon svg { display: block; width: 288px; height: 24px; margin: 7px auto 0; color: var(--gold); opacity: .8; }

  /* ================= ОБЛОЖКА ================= */
  .cover {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 560px;
    background: radial-gradient(90% 60% at 50% 45%, #56202d 0%, var(--deep) 70%);
    overflow: hidden;
  }
  .cover-frame { position: absolute; inset: 14px; border: 1px solid var(--gold-soft); pointer-events: none; }
  .cover-frame::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(210, 173, 114, .22); }
  .cover > .stage { top: 50%; height: 520px; transform: translate(-50%, -50%) scale(var(--s)); transform-origin: 50% 50%; }
  .rosette { color: var(--gold); }

  /* ================= КОНВЕРТ (только при html.env; без JS его нет) ================= */
  .flaps { display: none; }
  html.env .flaps {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 5;
    perspective: 1400px;
    touch-action: none;
  }
  .flap { position: absolute; inset: 0; will-change: transform, opacity; }
  .flap > svg.shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .f-side  { filter: drop-shadow(0 0 10px rgba(20, 4, 9, .35)); }
  .f-bottom{ filter: drop-shadow(0 -6px 14px rgba(20, 4, 9, .45)); }
  .f-top   { filter: drop-shadow(0 10px 18px rgba(20, 4, 9, .55)); transform-origin: 50% 0; }
  /* клапан откидывается к зрителю; изнанку не показываем */
  .f-top { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
  .flap-cast { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20, 4, 9, .6), rgba(20, 4, 9, 0) 70%); opacity: 0; pointer-events: none; }
  /* Тексты на клапанах — тоже на своей масштабируемой сцене */
  .flap .stage { height: 100%; }
  .f-top .stage { top: 6%; }
  .f-bottom .stage { top: auto; bottom: 0; height: 140px; transform-origin: 50% 100%; }

  .seal {
    position: absolute;
    left: 50%; top: 56%;
    z-index: 6;
    width: calc(112px * var(--s));
    height: calc(112px * var(--s));
    margin: calc(-56px * var(--s)) 0 0 calc(-56px * var(--s));
    padding: 0; border: 0; background: none;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: .6;
    transition: opacity .6s var(--ease-out);
    will-change: transform, opacity;
  }
  .seal:disabled { cursor: default; }
  .seal:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; }
  .seal-breath { display: block; width: 100%; height: 100%; }
  .seal-breath svg { display: block; width: 100%; height: 100%; overflow: visible; }
  .seal-hint {
    position: absolute;
    left: 0; right: 0;
    top: calc(56% + 66px * var(--s));
    z-index: 6;
    text-align: center;
    font-family: var(--sc);
    font-weight: 600;
    font-size: calc(16px * var(--s));
    line-height: 1.5;
    padding: 0 calc(16px * var(--s));
    letter-spacing: calc(1.2px * var(--s));
    color: var(--milk);
    opacity: 0;
    transition: opacity .8s var(--ease-out);
  }
  html.env.ready .seal { opacity: 1; }
  html.env.ready .seal-hint, html.env.ready .flap-text { opacity: 1; }
  html.env.ready .seal-breath { animation: breathe 2.5s ease-in-out infinite; }
  .flap-text { opacity: 0; transition: opacity .8s var(--ease-out); }
  @keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

  /* ================= ПРИГЛАШЕНИЕ ================= */
  .cal { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; font-family: var(--serif); font-size: 19px; color: var(--milk); }
  .cal > * { height: 34px; display: grid; place-items: center; position: relative; }
  .cal .wd { height: 28px; font-family: var(--sc); font-size: 14px; letter-spacing: 1px; color: var(--milk-soft); }
  .cal .mark { color: var(--gold); font-weight: 600; }
  .cal .mark svg { position: absolute; left: 50%; top: 50%; width: 46px; height: 40px; margin: -20px 0 0 -23px; color: var(--gold); overflow: visible; }
  .count { display: flex; justify-content: center; gap: 12px; }
  .circle {
    width: 66px; height: 66px;
    border: 1px solid var(--gold-soft);
    border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  .circle b { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
  .circle span { margin-top: 4px; font-family: var(--sc); font-size: 10.5px; letter-spacing: .4px; color: var(--milk-soft); }

  /* Той тартиби */
  .prog-path { position: absolute; top: 0; left: 0; overflow: visible; color: var(--gold); }
  .traveler { position: absolute; top: 0; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; color: var(--gold); will-change: transform; }
  .traveler .tv-heart { display: none; }        /* сердце вместо звёздочки — у «Розы» (invitation-roza.css) */
  .icon { color: var(--gold); display: block; margin: 0 auto; }
  .time { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1; color: var(--gold); letter-spacing: 1px; }
  .what { margin-top: 8px; font-family: var(--serif); font-weight: 600; font-size: calc(21px * var(--k, 1)); line-height: 1.2; }

  /* Локация: бумажная карточка */
  .card {
    background: var(--paper);
    border-radius: 6px;
    box-shadow: 0 24px 48px rgba(20, 4, 9, .45), 0 2px 6px rgba(20, 4, 9, .3);
    color: var(--ink);
    overflow: hidden;
  }
  .card::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(75, 19, 32, .28); border-radius: 3px; pointer-events: none; }
  .card .grain { position: absolute; inset: 0; width: 100%; height: 100%; }
  .pill {
    display: inline-block;
    padding: 8px 24px 9px;
    border: 1px solid rgba(75, 19, 32, .55);
    border-radius: 20px;
    color: var(--ink);
    text-decoration: none;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 19px;
    line-height: 1.2;
  }
  .pill:active { background: rgba(75, 19, 32, .08); }

  /* Дресс-код */
  .sw { display: flex; justify-content: center; gap: 16px; }
  .sw i { width: 48px; height: 48px; border-radius: 50%; box-shadow: 0 0 0 1px var(--gold-soft), 0 0 0 5px var(--wine), 0 0 0 6px rgba(210, 173, 114, .3); }

  /* ================= REVEAL: медленно и плавно, как в референсе; один раз ================= */
  html.io .a {
    opacity: 0;
    transition: opacity var(--dur, 1.4s) var(--ease-out), transform var(--dur, 1.4s) var(--ease-out);
    transition-delay: var(--d, 0s);
  }
  html.io .a.up    { transform: translateY(56px); }
  html.io .a.left  { transform: translateX(-56px); }
  html.io .a.right { transform: translateX(56px); }
  html.io .a.zoom  { transform: scale(.9); }
  html.io .a.in    { opacity: 1; transform: none; }

  /* Вход обложки — после открытия конверта (или сразу, если конверта нет) */
  @keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .intro { animation: rise 1.4s var(--ease-out) both; animation-delay: var(--d, 0s); }
  .intro-fade { animation: fade 1.6s var(--ease-out) both; animation-delay: var(--d, 0s); }
  html.env-wait .intro, html.env-wait .intro-fade { animation-play-state: paused; }

  /* Кнопка звука */
  .snd {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 100;
    width: 48px; height: 48px;
    display: grid; place-items: center;
    padding: 0; border: 0; background: none;
    color: var(--gold);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .snd::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(43, 15, 22, .7); border: 1px solid var(--gold-soft); }
  .snd svg { position: relative; width: 18px; height: 18px; }
  .snd .off { display: none; }
  .snd.is-off .on { display: none; }
  .snd.is-off .off { display: block; }

  /* Переключатель языка — пара кнопке звука: такой же круг, слева; над конвертом, чтобы выбрать язык до открытия */
  .lang-switch {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 100;
    width: 48px; height: 48px;
    display: grid; place-items: center;
    color: var(--gold);
    text-decoration: none;
    font: 600 11px/1 var(--sc);
    letter-spacing: .6px;
    -webkit-tap-highlight-color: transparent;
  }
  .lang-switch::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(43, 15, 22, .7); border: 1px solid var(--gold-soft); }
  .lang-switch span { position: relative; }

  /* Подсказка «листайте дальше» внизу обложки: появляется после открытия, пропадает при первой прокрутке */
  .scroll-cue {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 90;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 10px 18px 6px;
    border: 0; background: none;
    color: var(--gold);
    font: 500 12px/1 var(--sc);
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    opacity: 0; pointer-events: none;
    transition: opacity .7s var(--ease-out);
  }
  .scroll-cue.on { opacity: 1; pointer-events: auto; }
  /* мягкая подложка — чтобы читалось и поверх фото пары */
  .scroll-cue::before { content: ""; position: absolute; inset: 0; border-radius: 999px; background: rgba(43, 15, 22, .55); border: 1px solid var(--gold-soft); z-index: -1; }
  .scroll-cue svg { width: 22px; height: 22px; animation: cueNudge 1.8s ease-in-out infinite; }
  @keyframes cueNudge { 0%, 100% { transform: translateY(-2px); opacity: .55; } 50% { transform: translateY(4px); opacity: 1; } }

  @media (prefers-reduced-motion: reduce) {
    .scroll-cue svg { animation: none; }
    html.io .a, .intro, .intro-fade { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; }
    html.env.ready .seal-breath { animation: none; }
  }

/* ================= Шёлк: процедурные webp-драпировки (см. silk.py) ================= */
.silk { position: relative; z-index: 3; pointer-events: none; }
.silk img { position: absolute; left: 0; width: 100%; height: auto; display: block; }
/* лента занимает своё место между секциями и чуть заходит на соседей волнистыми краями */
.silk.band { height: calc(72px * var(--s)); }
.silk.band img { top: calc(-22px * var(--s)); }
/* смена цвета фона между секциями спрятана под тканью */
.silk.band.to-deep { background: linear-gradient(var(--wine) 50%, var(--deep) 50%); }
.silk.band.deep { background: var(--deep); }
.silk.top img  { top: 0; }
.silk.bottom img { bottom: 0; }

/* ================= Фото пары (загружается в админке) ================= */
/* фото на обложке: сверху притемнено под подпись, снизу ровно переходит в цвет страницы — без шва */
.cover.has-photo {
  background:
    linear-gradient(to bottom, rgba(43, 15, 22, .66) 0%, rgba(43, 15, 22, .34) 28%, rgba(43, 15, 22, .5) 58%, var(--wine) 100%),
    var(--photo) var(--photo-pos, center 30%) / var(--photo-size, cover) no-repeat;
}
.cover.has-photo .script, .cover.has-photo .serif { text-shadow: 0 2px 18px rgba(0, 0, 0, .45); }
.cover.has-photo .rosette { display: none; }
.final.has-photo {
  background:
    linear-gradient(to bottom, rgba(43, 15, 22, .95) 0%, rgba(43, 15, 22, .55) 45%, rgba(43, 15, 22, .9) 100%),
    var(--photo) var(--photo-pos, center) / var(--photo-size, cover) no-repeat;
}

/* ================= Конок анкетасы ================= */
.rsvp { position: relative; background: var(--deep); padding: calc(48px * var(--s)) 24px calc(64px * var(--s)); }
/* заголовок анкеты админ может заменить своим (надпись rsvpTitle) — длинному разрешена вторая строка, без .fit */
.rsvp h2 { font-family: var(--script); font-style: var(--script-style); font-weight: var(--script-weight);
           font-size-adjust: var(--script-adjust); letter-spacing: var(--script-spacing); font-size: calc(46px * var(--s) * var(--k, 1)); line-height: 1.2; text-align: center; text-wrap: balance; }
.rsvp .note { margin-top: 12px; text-align: center; font-size: 17px; color: var(--milk-soft); }
.rsvp form { margin-top: calc(40px * var(--s)); }
.rsvp label, .rsvp .q { display: block; font-family: var(--serif); font-weight: 600; font-size: 20px; }
.rsvp input[type=text] {
  width: 100%;
  margin: 8px 0 32px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--milk-soft);
  background: none;
  color: var(--milk);
  font: 500 19px/1.3 var(--serif);
  border-radius: 0;
  outline: none;
}
.rsvp input[type=text]::placeholder { color: rgba(251, 243, 234, .4); }
.rsvp input[type=text]:focus { border-bottom-color: var(--gold); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.choice {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 243, 234, .45);
  border-radius: 12px;
  background: none;
  color: var(--milk);
  font: 500 17px/1.25 var(--serif);
  cursor: pointer;
  transition: background-color .3s, border-color .3s, color .3s;
}
.choice[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--deep); }
.submit {
  width: 100%;
  margin-top: 32px;
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--milk);
  color: var(--deep);
  font: 600 19px/1.2 var(--serif);
  cursor: pointer;
  transition: opacity .3s;
}
/* неактивная — контуром, а не полупрозрачной плашкой */
.submit:disabled { background: transparent; border-color: var(--milk-soft); color: var(--milk-soft); cursor: default; }
.rsvp .status { min-height: 24px; margin-top: 16px; text-align: center; font-size: 17px; color: var(--gold); }
.rsvp .done { text-align: center; }
.rsvp .done p { font-size: 22px; line-height: 1.4; }
.rsvp .done button { margin-top: 20px; border: 0; background: none; color: var(--milk-soft); font: 500 16px var(--serif); text-decoration: underline; cursor: pointer; }
.rsvp > .drape { position: absolute; left: 0; width: 100%; height: auto; pointer-events: none; }
.rsvp > .drape.top { top: 0; }
.rsvp > .drape.bottom { bottom: 0; }
.rsvp > :not(.drape):not(.deco) { position: relative; z-index: 1; }

/* ================= Мелкие детали, общие для всех тем =================
   Только transform / opacity; при prefers-reduced-motion — статично или скрыто. */

/* Искры: четырёхлучевые звёздочки вспыхивают по очереди. Цвет — --glint (по умолчанию золото темы) */
.glints { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* искра = мягкий ореол (сам элемент) + тонкая четырёхлучевая звёздочка (::before, обрезана clip-path).
   Раньше вся искра была одной обрезанной фигурой — на 6–9 px и с поворотом на 45° она читалась как «×», будто пыль */
.glints i {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(var(--sz) * var(--s) * 1.7); height: calc(var(--sz) * var(--s) * 1.7);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glint, var(--gold)) 45%, transparent) 0, transparent 62%);
  opacity: 0;
  animation: glint 5.2s ease-in-out var(--dl) infinite;
}
.glints i::before {
  content: ""; position: absolute; inset: 0;
  background: var(--glint, var(--gold));
  clip-path: polygon(50% 0, 54% 46%, 100% 50%, 54% 54%, 50% 100%, 46% 54%, 0 50%, 46% 46%);
}
@keyframes glint {
  0%, 100% { opacity: 0; transform: scale(.35) rotate(0deg); }
  38%      { opacity: 1; transform: scale(1) rotate(12deg); }
  60%      { opacity: 0; transform: scale(.5) rotate(20deg); }
}

/* в анкете искры только по краям — в центре они просвечивают сквозь кнопки */
.rsvp .glints i:nth-child(3n+1) { display: none; }

/* Звёзды: точки расставляет invitation.js (детерминированно по data-seed) */
.stars { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stars i {
  position: absolute; width: var(--z); height: var(--z); margin: calc(var(--z) / -2) 0 0 calc(var(--z) / -2);
  border-radius: 50%; background: #fffaf0;
  animation: twinkle var(--du) ease-in-out var(--dl) infinite alternate;
}
.stars i.b { box-shadow: 0 0 6px 1px rgba(255, 240, 210, .65); }
@keyframes twinkle { from { opacity: .15; transform: scale(.65); } to { opacity: .95; transform: scale(1); } }

/* Падающая звезда: вспыхивает раз в --du секунд */
.shoot {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(120px * var(--s)); height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, #fffaf0, rgba(255, 250, 240, 0));
  transform-origin: 0 50%; opacity: 0; pointer-events: none;
  animation: shoot var(--du) linear var(--dl) infinite;
}
@keyframes shoot {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-24deg) scaleX(.1); }
  1.5% { opacity: 1; }
  7%   { opacity: 0; transform: translate(calc(-170px * var(--s)), calc(76px * var(--s))) rotate(-24deg) scaleX(1); }
  100% { opacity: 0; transform: translate(calc(-170px * var(--s)), calc(76px * var(--s))) rotate(-24deg) scaleX(1); }
}

/* Всплеск частиц при открытии печати и после ответа в анкете (создаёт invitation.js).
   Форма частицы — в теме; по умолчанию золотая искра */
.burst {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
  width: var(--sz); height: var(--sz); margin: calc(var(--sz) / -2) 0 0 calc(var(--sz) / -2);
  background: var(--burst, #e9cd92);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  will-change: transform, opacity;
}
.burst:nth-child(3n) { background: #fff4dc; }

/* Цифры отсчёта: новая цифра мягко выезжает снизу */
.circle b { display: inline-block; }

html.env-wait .glints i, html.env-wait .shoot { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .glints, .shoot { display: none; }
  .stars i { animation: none; opacity: .6; }
}

/* ================= Фото в середине (блок «photo»): рамка 4:5, кадр — из админки ================= */
.gph { padding: 6px; background: var(--paper); box-shadow: 0 18px 36px rgba(20, 4, 9, .28), 0 2px 6px rgba(20, 4, 9, .18); }
.gph .img { width: 100%; height: 100%; background: #0000 center / cover no-repeat; }
/* тонкая золотая рамка поверх снимка */
.gph::after { content: ""; position: absolute; inset: 12px; border: 1px solid color-mix(in srgb, var(--gold) 70%, #fff); pointer-events: none; }

/* ================= Свои цвета (палитра шаблона или из админки) =================
   Классы c-… и переменные --c-… стоят на <html> (InvitationView.paletteClass/paletteStyle): печать и всплески
   рисуются вне <main>. Каждый цвет — отдельно: не задан — как в оформлении. Все правила начинаются с html.c-… —
   так они сильнее правил оформлений ([data-base=…] …), которые подключаются после этого файла.

   paper, ink, names — светлые секции ленты (приглашение, фото, программа, место, дресс-код)
   deep, deepInk      — обложка, конверт, шёлковые ленты, анкета, финал и текст на них
   accent             — золото всей страницы: подписи, иконки, рамки, линии конверта, печать, искры, кнопки */

/* --- Светлые секции --- */
html.c-paper main { background: var(--c-paper); }
html.c-paper main > :not(.cover):not(.rsvp):not(.final), html.c-paper .cover { --wine: var(--c-paper); }
html.c-paper main > section.ab:not(.final) { background: var(--c-paper); }
html.c-ink main > section.ab:not(.final) {
  --milk: var(--c-ink);
  --milk-soft: color-mix(in srgb, var(--c-ink) 70%, transparent);
  color: var(--milk);
}
/* текст свой — мелкие подписи акцентом: «чёрно-золотые» надписи */
html.c-ink main > section.ab:not(.final) .label { color: var(--gold); }
/* карточка места: чернила и рамки — цветом текста (у оформления они свои, бордовые) */
html.c-ink main > section.ab:not(.final) { --ink: var(--c-ink); }
html.c-ink .card::before { border-color: color-mix(in srgb, var(--c-ink) 28%, transparent); }
html.c-ink .pill { border-color: color-mix(in srgb, var(--c-ink) 55%, transparent); }
html.c-names main > section.ab:not(.final) .script { color: var(--c-names); }
/* на светлом поле тень рамок и карточки — мягче */
html.c-paper .gph, html.c-paper .card { box-shadow: 0 16px 34px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .08); }

/* --- Акцент: вся страница --- */
html.c-accent, html.c-accent .cover, html.c-accent .flaps {
  --glint: var(--c-accent);
  --gold: var(--c-accent);
  --gold-soft: color-mix(in srgb, var(--c-accent) 55%, transparent);
  --burst: color-mix(in oklab, var(--c-accent), white 25%);
}
html.c-accent .cover-frame::after { border-color: color-mix(in srgb, var(--c-accent) 22%, transparent); }
html.c-accent .sw i { box-shadow: 0 0 0 1px var(--gold-soft), 0 0 0 5px var(--wine), 0 0 0 6px color-mix(in srgb, var(--c-accent) 30%, transparent); }
html.c-accent .burst:nth-child(3n) { background: color-mix(in oklab, var(--c-accent), white 70%); }
/* сургуч печати: градиенты #wax/#waxIn из оформления — светлее и темнее акцента */
html.c-accent #wax stop:nth-child(1) { stop-color: color-mix(in oklab, var(--c-accent), white 60%); }
html.c-accent #wax stop:nth-child(2) { stop-color: color-mix(in oklab, var(--c-accent), white 12%); }
html.c-accent #wax stop:nth-child(3) { stop-color: color-mix(in oklab, var(--c-accent), black 32%); }
html.c-accent #wax stop:nth-child(4) { stop-color: color-mix(in oklab, var(--c-accent), black 50%); }
html.c-accent #waxIn stop:nth-child(1) { stop-color: color-mix(in oklab, var(--c-accent), black 6%); }
html.c-accent #waxIn stop:nth-child(2) { stop-color: color-mix(in oklab, var(--c-accent), black 20%); }

/* --- Тёмный цвет: обложка, конверт, анкета, финал, кнопки --- */
html.c-deep { --deep: var(--c-deep); background: var(--c-deep); }
/* обложка и конверт «Тёмного» держат свой бордо (они бывают и на странице другого оформления) — перекрашиваем и их */
html.c-deep .cover { --deep: var(--c-deep); }
html.c-deep[data-cover=dark] { --cover-end: var(--c-deep); }
html.c-deep .snd::before, html.c-deep .lang-switch::before { background: color-mix(in srgb, var(--c-deep) 70%, transparent); }
html.c-deep .scroll-cue::before { background: color-mix(in srgb, var(--c-deep) 55%, transparent); }
html.c-deep[data-cover=dark] .cover { background: radial-gradient(90% 60% at 50% 45%, color-mix(in oklab, var(--c-deep), white 12%) 0%, var(--deep) 70%); }
html.c-deep[data-cover=dark] .cover.has-photo {
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--c-deep) 66%, transparent) 0%, color-mix(in srgb, var(--c-deep) 34%, transparent) 28%,
                    color-mix(in srgb, var(--c-deep) 50%, transparent) 58%, var(--wine) 100%),
    var(--photo) var(--photo-pos, center 30%) / var(--photo-size, cover) no-repeat;
}
html.c-deep[data-base=dark] .final.has-photo {
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--c-deep) 95%, transparent) 0%, color-mix(in srgb, var(--c-deep) 55%, transparent) 45%,
                    color-mix(in srgb, var(--c-deep) 90%, transparent) 100%),
    var(--photo) var(--photo-pos, center) / var(--photo-size, cover) no-repeat;
}
/* клапаны конверта (у всех оформлений — переменные --flap-*): оттенки тёмного цвета, линии — акцентом.
   Значения по умолчанию — у каждого конверта свои (здесь «Тёмное», остальные — в invitation-{оформление}.css) */
[data-env=dark] .flaps { --flap-side: #3d141e; --flap-bottom: #4a1924; --flap-top1: #5e2231; --flap-top2: #4f1b27; --flap-line: #d2ad72; }
html.c-deep .flaps {
  /* надписи конверта: светлые на тёмном цвете, тёмные — на светлом (deep-light — InvitationView по яркости);
     «Текст на тёмном» из админки — поверх */
  --milk: #fbf3ea; --milk-soft: rgba(251, 243, 234, .72); color: var(--milk);
  --flap-side: color-mix(in oklab, var(--c-deep), white 6%);
  --flap-bottom: color-mix(in oklab, var(--c-deep), white 10%);
  --flap-top1: color-mix(in oklab, var(--c-deep), white 18%);
  --flap-top2: color-mix(in oklab, var(--c-deep), white 13%);
}
html.c-accent .flaps { --flap-line: var(--c-accent); }
/* шёлк — картинка: перекрашиваем наложением цвета по её форме (складки и блики остаются от ткани) */
html.c-deep .silk.band::after {
  content: ""; position: absolute; left: 0; width: 100%; top: calc(-22px * var(--s)); aspect-ratio: 1170 / 420;
  background: var(--c-deep);
  -webkit-mask: url("/assets/silk-band-19bfca730c81ecc67efcfec788967872.webp") 0 0 / 100% 100% no-repeat; mask: url("/assets/silk-band-19bfca730c81ecc67efcfec788967872.webp") 0 0 / 100% 100% no-repeat;
  mix-blend-mode: color; pointer-events: none;
}

/* --- Текст на тёмном --- */
/* надписи и золото на перекрашенном конверте — по яркости цвета (у каждого конверта свои были под его цвет) */
html.c-deep .flaps { --gold: #d9b873; --gold-soft: rgba(217, 184, 115, .5); }
html.c-deep.deep-light .flaps { --milk: #3b2a2c; --milk-soft: rgba(59, 42, 44, .74); --gold: #8f6a2c; --gold-soft: rgba(143, 106, 44, .42); }
/* светлый конверт: зерно бумаги (подобрано под тёмные) слабее, тёмной тени у надписей нет */
html.c-deep.deep-light .flaps path[filter] { opacity: .35; }
html.c-deep.deep-light .flaps :is(.serif, .label, .script) { text-shadow: none; }
/* «Акцент» из админки — сильнее подбора */
html.c-accent.c-deep .flaps { --gold: var(--c-accent); --gold-soft: color-mix(in srgb, var(--c-accent) 55%, transparent); }
/* светлой обложке «Ак гүл» светлый текст не подходит — у неё свой. Конверту — подходит, если его перекрасили */
html.c-deepInk:not([data-cover=light]) .cover, html.c-deepInk:not([data-env=light]) .flaps, html.c-deepInk.c-deep .flaps,
html.c-deepInk .rsvp, html.c-deepInk .final {
  --milk: var(--c-deepInk);
  --milk-soft: color-mix(in srgb, var(--c-deepInk) 72%, transparent);
  color: var(--milk);
}

/* ================= Конструктор: детали «Тёмного» на странице другого оформления =================
   Правила выше в этом файле — «Тёмное» по умолчанию. Его обложка и конверт берут цвета надписей из страницы;
   на светлой странице они стали бы бордовыми на бордовом — поэтому у детали свои. */
[data-cover=dark] .cover { --milk: #fbf3ea; --milk-soft: rgba(251, 243, 234, .72); --gold: #d2ad72; --gold-soft: rgba(210, 173, 114, .55); --deep: #2b0f16; --glint: var(--gold);  color: var(--milk); }
[data-env=dark] .flaps { --milk: #fbf3ea; --milk-soft: rgba(251, 243, 234, .72); --gold: #d2ad72; --gold-soft: rgba(210, 173, 114, .55);  color: var(--milk); }
/* низ тёмных обложек — для разделителя под обложкой (--cover-end задаёт каждая обложка) */
[data-cover=dark] { --cover-end: #2b0f16; }
/* разделитель под обложкой (div.after-cover): обложка тёмная, страница другая — фото внизу уходит в цвет обложки,
   а шов прячется под разделителем. Светлая обложка перетекает в страницу сама — её разделитель скрыт */
html.cover-band:not([data-cover=light]) .cover { --wine: var(--cover-end); }
.silk.band.from-deep { background: linear-gradient(var(--cover-end) 50%, var(--wine) 50%); }

/* ================= Шов между секциями: разделитель знает соседей =================
   У разделителя классы a-{секция сверху} b-{секция снизу} (InvitationView.seam; под обложкой — a-cover b-invite).
   Цвет секции — --bg-{секция}, если его задаёт оформление страницы (у «Розы» секции разного цвета), иначе как
   в общей раскладке: светлые — --wine, анкета и финал — --deep, обложка — --cover-end. Разделители, которым соседи
   не важны (шёлк, тасма), этих переменных просто не читают */
.a-cover   { --seam-a: var(--cover-end, var(--deep)); }
.a-invite  { --seam-a: var(--bg-invite, var(--wine)); }
.a-photo   { --seam-a: var(--bg-photo, var(--wine)); }
.a-program { --seam-a: var(--bg-program, var(--wine)); }
.a-venue   { --seam-a: var(--bg-venue, var(--wine)); }
.a-dress   { --seam-a: var(--bg-dress, var(--wine)); }
.a-rsvp    { --seam-a: var(--bg-rsvp, var(--deep)); }
.b-invite  { --seam-b: var(--bg-invite, var(--wine)); }
.b-photo   { --seam-b: var(--bg-photo, var(--wine)); }
.b-program { --seam-b: var(--bg-program, var(--wine)); }
.b-venue   { --seam-b: var(--bg-venue, var(--wine)); }
.b-dress   { --seam-b: var(--bg-dress, var(--wine)); }
.b-rsvp    { --seam-b: var(--bg-rsvp, var(--deep)); }
.b-final   { --seam-b: var(--bg-final, var(--deep)); }

/* ================= Падающие лепестки (конструктор → «Лепестки», html[data-petals]) =================
   Слой поверх ленты шириной с приглашение; лепестки — фото (assets/roza/petal1–6.webp: 1–3 красные, 4–6 белые),
   создаёт и убирает invitation.js. Только transform / opacity; при prefers-reduced-motion их нет совсем */
.petal-rain {
  position: fixed; top: 0; bottom: 0; left: 50%; z-index: 60;
  width: min(100vw, 430px); transform: translateX(-50%);
  overflow: hidden; pointer-events: none;
}
.petal-rain .petal { position: absolute; top: -50px; left: 0; will-change: transform, opacity; }
.petal-rain .petal i { display: block; width: var(--sz); height: var(--sz); animation: petalSway var(--sw) ease-in-out infinite alternate; }
.petal-rain .petal img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .18)); }
html.lite .petal-rain .petal img { filter: none; }  /* слабый телефон: без теней (invitation.js ставит lite) */
@keyframes petalSway {
  from { transform: translateX(calc(var(--a) * -1)) rotate(-30deg) rotateY(0); }
  to   { transform: translateX(var(--a)) rotate(40deg) rotateY(65deg); }
}
@media (prefers-reduced-motion: reduce) { .petal-rain { display: none; } }
