/* ─────────────────────────────────────────────────────────────────────────
   Мартина и Стефан — 6 септември 2026

   Зелено и бежово. Интерфейсът е тих и почти безцветен, защото 1500
   телефонни снимки ще донесат всеки цвят на света — те трябва да са
   единственото наситено нещо на страницата.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --ground:      #e8ede0;
  --ground-deep: #dae1cf;
  --paper:       #fcfaf4;
  --paper-warm:  #f5f1e6;

  --ink:    #202a1d;
  --ink-2:  #58634f;
  --ink-3:  #8a9483;

  --forest:     #2b4430;
  --green:      #48684a;
  --sage:       #8ea886;
  --olive-pale: #bacdae;

  --gold:      #b3925c;
  --gold-soft: #e3d3ab;
  --sand:      #cdbd99;
  --wine:      #8e4b54;

  --shade: rgba(22, 30, 20, .96);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.045'/%3E%3C/svg%3E");

  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans:  "Manrope", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;

  --col:    min(38rem, 100% - 2.5rem);
  --ease:   cubic-bezier(.22, .61, .36, 1);
  --spring: cubic-bezier(.2, .9, .3, 1.25);

  /* Мозайката: JS смята колко такива редчета заема всеки кадър. */
  --row: 4px;
  --row-gap: 16px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* "clip" реже настрани, без да прави контейнер за скрол — така
     захващането на кадрите остава на страницата. */
  overflow-x: clip;
}

body {
  margin: 0;
  /* Растерът е на тялото, не на отделните секции — иначе на границата
     между тях се вижда рязък шев. Секциите отгоре са полупрозрачни. */
  background-color: var(--ground);
  background-image: var(--grain);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
[hidden] { display: none !important; }

/* ── Поканата ─────────────────────────────────────────────────────────── */

.opening {
  position: relative;
  padding: clamp(2.75rem, 9vw, 5rem) 1.5rem clamp(3rem, 10vw, 5rem);
  text-align: center;
  /* Свършва в прозрачно, за да продължи фонът на тялото без граница. */
  background: linear-gradient(to bottom,
    var(--paper) 0%,
    rgba(252, 250, 244, .92) 48%,
    rgba(252, 250, 244, .55) 76%,
    rgba(252, 250, 244, 0) 100%);
  overflow: hidden;
  contain: paint;
}

/* Мека светлина, която следва курсора — само там, където има курсор. */
.opening__glow {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(20rem 20rem at var(--mx, 50%) var(--my, 30%),
              rgba(255, 253, 246, .75), transparent 68%);
  transition: opacity .7s var(--ease);
}
@media (hover: hover) {
  .opening:hover .opening__glow { opacity: 1; }
}

/* Меки петна светлина, които се движат много бавно — дават дълбочина,
   без да се четат като украса. */
.aurora {
  position: absolute; inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(38% 30% at 18% 18%, rgba(142, 168, 134, .30), transparent 68%),
    radial-gradient(34% 28% at 84% 26%, rgba(205, 189, 153, .34), transparent 68%),
    radial-gradient(42% 32% at 62% 88%, rgba(142, 168, 134, .22), transparent 70%);
  filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 92%);
  animation: drift-slow 34s ease-in-out infinite alternate;
}
@keyframes drift-slow {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.opening__garden { position: absolute; inset: 0; pointer-events: none; contain: paint; clip-path: inset(0); }
.opening__inner  { position: relative; z-index: 2; }

.branch { position: absolute; opacity: .42; }
.branch--1 { top: -3%;  left: -14%; width: min(46vw, 430px); }
.branch--2 { top: 14%;  right: -14%; width: min(48vw, 450px); }
.branch--3 { bottom: 4%; left: -12%; width: min(40vw, 360px); opacity: .26; }

@media (max-width: 40rem) {
  .branch { opacity: .3; }
  .branch--3 { display: none; }
}

.medallion { position: relative; display: flex; justify-content: center; }
.medallion::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 16rem; height: 16rem; transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fffdf6 0%, rgba(255, 253, 246, 0) 68%);
}
.wreath { position: relative; width: clamp(7.5rem, 26vw, 9.5rem); height: auto; }

.opening__date {
  margin: 1.125rem 0 clamp(1rem, 4vw, 1.5rem);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--gold);
}

.names {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.25rem, 15vw, 5.75rem);
  line-height: .96;
  color: var(--ink);
}
.names__one { display: block; }
.names__and {
  display: block;
  font-style: italic;
  font-size: .33em;
  line-height: 2.1;
  color: var(--gold);
}

/* Двойна линийка със златно листче — и с бавен отблясък по нея. */
.flourish {
  display: flex; align-items: center; justify-content: center; gap: .875rem;
  width: min(21rem, 82%);
  margin: clamp(1.25rem, 5vw, 2rem) auto 0;
}
.flourish__rule {
  position: relative;
  flex: 1; height: 4px;
  border-top: 1px solid var(--gold-soft);
  border-bottom: 1px solid var(--gold-soft);
  overflow: hidden;
}
.flourish__rule::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(179, 146, 92, .85), transparent);
  transform: translateX(-120%);
  animation: sheen 7s var(--ease) 3s infinite;
}
.flourish__rule:last-child::after { animation-delay: 3.4s; }
@keyframes sheen {
  0%   { transform: translateX(-120%); }
  35%  { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.opening__lede {
  margin: clamp(1.5rem, 5vw, 2rem) auto 0;
  max-width: 26rem;
  font-family: var(--serif);
  font-size: clamp(1.1875rem, 4.4vw, 1.4375rem);
  line-height: 1.5;
  color: var(--ink-2);
}

/* ── Листенцата ───────────────────────────────────────────────────────── */

.petals { position: absolute; inset: 0; overflow: hidden; contain: paint; pointer-events: none; }

.petal {
  position: absolute;
  top: -10%;
  display: block;
  color: var(--sage);
  opacity: 0;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}
.petal svg {
  display: block; width: 100%; height: auto;
  animation: spin linear infinite;
}
@keyframes fall {
  0%   { opacity: 0; transform: translate3d(0, 0, 0); }
  10%  { opacity: calc(.42 * var(--depth, 1)); }
  90%  { opacity: calc(.42 * var(--depth, 1)); }
  100% { opacity: 0; transform: translate3d(var(--drift), 118vh, 0); }
}
@keyframes spin {
  0%   { transform: rotate(0deg) rotateX(0deg); }
  50%  { transform: rotate(180deg) rotateX(180deg); }
  100% { transform: rotate(360deg) rotateX(360deg); }
}

/* ── Колоната с действията ────────────────────────────────────────────── */

.column { width: var(--col); margin-inline: auto; padding: 1.5rem 0 2rem; }

.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(252, 250, 244, .92), rgba(245, 241, 230, .88));
  backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(227, 211, 171, .8);
  border-radius: 20px;
  padding: 1.625rem 1.5rem;
  margin-top: 1.25rem;
  box-shadow: 0 1px 2px rgba(43, 68, 48, .04), 0 12px 30px -14px rgba(43, 68, 48, .22);
}

.panel__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1.2; }
.panel__note  { margin: .4375rem 0 1.25rem; font-size: .875rem; color: var(--ink-2); }

.field { display: flex; flex-direction: column; gap: .625rem; }

.field__input {
  width: 100%; height: 3.375rem; padding: 0 1.0625rem;
  font: 400 1rem/1 var(--sans);          /* 16px пази iOS от автоматичен зуум */
  color: var(--ink); background: #fff;
  border: 1px solid var(--sand); border-radius: 13px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field__input::placeholder { color: var(--ink-3); }
.field__input:focus {
  border-color: var(--green); outline: none;
  box-shadow: 0 0 0 3px rgba(72, 104, 74, .13);
}

.field__error { margin: .75rem 0 0; font-size: .8125rem; color: var(--wine); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 3.375rem; padding: 0 1.625rem;
  font: 600 .9375rem/1 var(--sans);
  border: 0; border-radius: 999px; cursor: pointer;
  transition: background-color .2s var(--ease), transform .12s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: scale(.985); }
.btn--primary {
  color: var(--paper);
  background: linear-gradient(160deg, var(--green), var(--forest));
  box-shadow: 0 2px 4px rgba(43, 68, 48, .16), 0 10px 22px -10px rgba(43, 68, 48, .55);
}
.btn--primary:hover { background: linear-gradient(160deg, #52754f, #33502f); }
.btn[disabled] { opacity: .5; cursor: default; }

.linkish {
  padding: 0; font: inherit; color: var(--green);
  background: none; border: 0; border-bottom: 1px solid var(--gold-soft); cursor: pointer;
}
.linkish:hover { border-bottom-color: var(--gold); }

/* ── Зоната за качване ────────────────────────────────────────────────── */

.greeting {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
  margin: 0 0 1.25rem;
  font-family: var(--serif); font-size: 1.375rem; color: var(--ink);
}
.greeting .linkish { font-family: var(--sans); font-size: .75rem; color: var(--ink-3); }
.greeting .linkish:hover { color: var(--green); }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1.875rem 1.25rem;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--sand);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
}
.drop:hover, .panel--drop.is-dragging .drop {
  border-color: var(--green);
  border-style: solid;
  background: var(--paper-warm);
  transform: translateY(-2px);
}
.drop__mark  { color: var(--gold); margin-bottom: .25rem; }
.drop__title { font-weight: 600; font-size: 1.0625rem; }
.drop__hint  { font-size: .8125rem; color: var(--ink-2); max-width: 17rem; }

.drop__alt { margin: .9375rem 0 0; text-align: center; font-size: .875rem; color: var(--ink-2); }

/* ── Опашката ─────────────────────────────────────────────────────────── */

.queue { margin-top: 1.25rem; }
.queue__head { margin: 0 0 .625rem; font: 500 .8125rem/1.4 var(--sans); color: var(--ink-2); }
.queue__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }

.row {
  display: grid; grid-template-columns: 2.75rem 1fr auto;
  align-items: center; gap: .8125rem;
  padding: .5rem .875rem .5rem .5rem;
  background: rgba(252, 250, 244, .9);
  border: 1px solid rgba(227, 211, 171, .7);
  border-radius: 14px;
}
.row__chip  { width: 2.75rem; height: 2.75rem; border-radius: 8px; background: var(--ground-deep) center/cover no-repeat; }
.row__name  { font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__track { height: 3px; margin-top: .4375rem; background: var(--ground-deep); border-radius: 2px; overflow: hidden; }
.row__fill  { height: 100%; width: 0; background: linear-gradient(90deg, var(--sage), var(--green)); border-radius: 2px; transition: width .3s var(--ease); }
.row__state { font-size: .75rem; color: var(--ink-2); white-space: nowrap; }
.row.is-done   .row__state { color: var(--green); }
.row.is-failed .row__state { color: var(--wine); }
.row__retry {
  font: 500 .75rem/1 var(--sans); color: var(--green);
  background: none; border: 0; border-bottom: 1px solid var(--gold-soft);
  padding: 0 0 1px; cursor: pointer;
}

/* ── Галерията ────────────────────────────────────────────────────────── */

.gallery {
  position: relative;
  overflow-x: clip;
  padding: clamp(2.5rem, 8vw, 4rem) 0 clamp(3rem, 9vw, 4.5rem);
  background: linear-gradient(to bottom,
    rgba(245, 241, 230, 0) 0%,
    rgba(245, 241, 230, .45) 40%,
    var(--paper-warm) 100%);
}

.gallery__crown {
  position: absolute; top: -1.5rem; left: 50%;
  width: min(80vw, 30rem); transform: translateX(-50%);
  opacity: .26; pointer-events: none;
  contain: paint;
}
.gallery__crown .branch { position: static; width: 100%; opacity: 1; }

.gallery__head > * { max-width: 100%; }

.gallery__head {
  position: relative;
  text-align: center;
  padding-inline: 1.25rem;
  margin-bottom: clamp(1.5rem, 5vw, 2.25rem);
}

.gallery__title {
  margin: 0;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.875rem, 6.5vw, 2.75rem);
  color: var(--forest);
}

.tally {
  margin: .5rem 0 0;
  font-size: .8125rem; letter-spacing: .05em; color: var(--gold);
}

.hint {
  margin: .875rem auto 0;
  max-width: 30rem; padding: 0 1.25rem;
  font-size: .875rem; line-height: 1.55; color: var(--ink-2);
}

/* Превключвател между всички кадри и своите харесани (на широк екран). */
.switch {
  display: inline-flex; gap: .25rem;
  max-width: calc(100% - 2rem);
  margin-top: 1.25rem; padding: .3125rem;
  background: rgba(252, 250, 244, .9);
  border: 1px solid rgba(227, 211, 171, .8);
  border-radius: 999px;
  box-shadow: 0 6px 18px -12px rgba(43, 68, 48, .5);
}
.switch button {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .5625rem 1.125rem;
  font: 500 .8125rem/1 var(--sans); color: var(--ink-2);
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  transition: background-color .22s var(--ease), color .22s var(--ease);
}
.switch button.is-on {
  color: var(--paper);
  background: linear-gradient(160deg, var(--green), var(--forest));
}
.switch span:not(:empty)::before { content: " "; }

.grab { margin: 1rem 0 0; padding: 0 1.25rem; }
.btn--sm { height: 2.875rem; padding: 0 1.375rem; font-size: .875rem; text-decoration: none; }

/* ─────────────────────────────────────────────────────────────────────────
   Галерията има две лица.

   На телефон: по един кадър на екран, скролът щраква на следващия — както
   в Reels. На по-широк екран: мозайка от 2–4 колони, в която всяка снимка
   пази своите пропорции.
   ───────────────────────────────────────────────────────────────────── */

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 auto;
  width: 100%;
  max-width: 92rem;
}

.card {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: paint;
}

.card__wash { display: none; }

.frame {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: var(--ar, 4 / 5);
  padding: 0;
  overflow: hidden;
  background: var(--ground-deep);
  border: 0;
  cursor: pointer;
}

.frame__media { position: absolute; inset: 0; display: block; overflow: hidden; }
.frame__media img,
.frame__media video {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(10px);
  transform: scale(1.04);
  transition: opacity .5s var(--ease), filter .7s var(--ease), transform .7s var(--ease);
}
.frame__media img.is-in,
.frame__media video.is-in { opacity: 1; filter: none; transform: none; }

.frame__time {
  position: absolute; right: .625rem; top: .625rem;
  padding: .1875rem .4375rem;
  font-size: .75rem; font-variant-numeric: tabular-nums;
  color: #fff; background: rgba(22, 30, 20, .45); border-radius: 6px;
  backdrop-filter: blur(6px);
}
.frame__play {
  position: absolute; right: .625rem; top: .625rem;
  display: grid; place-items: center;
  width: 1.875rem; height: 1.875rem;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
  transition: opacity .25s var(--ease);
}
.card.is-playing .frame__play { opacity: 0; }

/* Звукът тръгва само след докосване — така иска браузърът, така е и редно. */
.frame__sound {
  position: absolute; right: .625rem; bottom: 3.25rem;
  display: none; place-items: center;
  width: 2.625rem; height: 2.625rem;
  color: #fff; background: rgba(22, 30, 20, .4);
  border: 0; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(6px);
}
.card.is-playing .frame__sound { display: grid; }

.frame__wait {
  position: absolute; inset: 0;
  display: grid; place-items: center; padding: 1rem;
  text-align: center; font-size: .8125rem; line-height: 1.5;
  color: var(--ink-2);
  background: radial-gradient(120% 120% at 50% 40%, var(--paper) 0%, var(--ground-deep) 100%);
}

/* Кой е качил кадъра. */
.frame__label {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem;
  padding: 3rem .625rem .625rem .9375rem;
  background: linear-gradient(to top, rgba(18, 24, 16, .62) 0%, rgba(18, 24, 16, .2) 45%, rgba(18, 24, 16, 0) 100%);
  color: #fbf8f0;
  pointer-events: none;
}

.card__by {
  margin: 0; min-width: 0;
  font-family: var(--serif); font-style: italic;
  font-size: 1.25rem; line-height: 1.25; font-weight: 500;
  text-shadow: 0 1px 5px rgba(0, 0, 0, .5);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── На телефон: един кадър на екран ──────────────────────────────────── */

@media (max-width: 47.99rem) {
  html { scroll-snap-type: y proximity; }

  .card {
    display: flex; align-items: center; justify-content: center;
    min-height: 88svh;
    padding-bottom: 4.25rem;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  /* Кутията е точно колкото кадъра — нищо не стърчи извън екрана.
     Уголеменият размит слой живее вътре в нея и се реже два пъти. */
  .card__wash {
    display: block;
    position: absolute; inset: 0;
    overflow: hidden;
    contain: paint;
  }
  .card__wash::after {
    content: "";
    position: absolute; inset: -14%;
    background-image: var(--src);
    background-size: cover;
    background-position: center;
    filter: blur(34px) brightness(.6) saturate(1.2);
  }

  .frame {
    position: relative; z-index: 1;
    max-height: 74svh;
    border-radius: 4px;
    box-shadow: 0 14px 48px rgba(0, 0, 0, .42);
  }
}

/* ── По-широк екран: мозайка с едри кадри ─────────────────────────────── */

@media (min-width: 48rem) {
  .frame { aspect-ratio: var(--ar-cap, 4 / 5); }

  .sheet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: .75rem;
    row-gap: var(--row-gap);
    grid-auto-rows: var(--row);
    padding: 0 .75rem;
  }
  .card { align-self: start; }
  .frame {
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(43, 68, 48, .06), 0 14px 34px -18px rgba(43, 68, 48, .5);
    transition: box-shadow .3s var(--ease), transform .3s var(--ease);
  }
  .frame:hover {
    box-shadow: 0 6px 12px rgba(43, 68, 48, .1), 0 26px 48px -20px rgba(43, 68, 48, .6);
    transform: translateY(-4px);
  }
}
@media (min-width: 64rem) { .sheet { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 1rem; padding: 0 1.25rem; } }
@media (min-width: 96rem) { .sheet { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── Сърцата ──────────────────────────────────────────────────────────── */

.heart {
  display: inline-flex; align-items: center; gap: .3125rem;
  flex: 0 0 auto; padding: .5rem .375rem;      /* удобно за пръст */
  font: 600 .9375rem/1 var(--sans); font-variant-numeric: tabular-nums;
  color: #fbf8f0; background: none; border: 0; cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.heart svg { width: 1.375rem; height: 1.25rem; fill: none; stroke: currentColor;
             stroke-width: 1.7; stroke-linejoin: round; }
.heart:hover { color: #f0b4b9; transform: scale(1.08); }
.heart.is-on { color: #ef9ba3; }
.heart.is-on svg { fill: #ef9ba3; stroke: #ef9ba3; }
.heart.is-on.just-on svg { animation: beat .45s var(--ease); }
.heart__count:empty { display: none; }

@keyframes beat {
  0% { transform: scale(1); } 40% { transform: scale(1.45); }
  70% { transform: scale(.9); } 100% { transform: scale(1); }
}

/* ── Празно, още, край ────────────────────────────────────────────────── */

.empty {
  margin: 4rem auto; max-width: 20rem; text-align: center;
  font-family: var(--serif); font-size: 1.375rem; line-height: 1.5; color: var(--ink-3);
}

/* Три листчета, които се редуват, докато долитат следващите кадри. */
.tail {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  height: 3.5rem; margin-top: 1.5rem;
  opacity: 0; transition: opacity .3s var(--ease);
}
.tail.is-on { opacity: 1; }
.tail__leaf {
  width: .625rem; height: .625rem;
  background: var(--sage);
  border-radius: 50% 0;
  animation: hop 1.1s var(--ease) infinite;
}
.tail__leaf:nth-child(2) { animation-delay: .14s; background: var(--gold); }
.tail__leaf:nth-child(3) { animation-delay: .28s; }
@keyframes hop {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: .4; }
  50%      { transform: translateY(-.4rem) rotate(45deg); opacity: 1; }
}

.more {
  display: block; margin: 2.5rem auto 0; padding: .8125rem 1.875rem;
  font: 500 .875rem/1 var(--sans); color: var(--forest);
  background: var(--paper); border: 1px solid var(--gold-soft); border-radius: 999px;
  cursor: pointer; transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.more:hover { border-color: var(--gold); transform: translateY(-1px); }

.closing {
  position: relative;
  padding: clamp(3rem, 9vw, 4.5rem) 1.25rem calc(6rem + env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(to bottom, var(--paper-warm) 0%, #4a6b4c 34%, var(--forest) 100%);
  color: #dbe3d4;
  font-family: var(--serif); font-size: 1.25rem;
}
.closing::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--grain); opacity: .6;
}
.closing p { position: relative; margin: 1.25rem 0 0; }
.closing .flourish { position: relative; }
.closing .flourish__rule { border-color: rgba(227, 211, 171, .28); }
.closing .flourish__rule::after { display: none; }

/* ── Плаващият бутон ──────────────────────────────────────────────────── */

.fab {
  position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: .4375rem;
  height: 3.25rem; padding: 0 1.375rem;
  font: 600 .875rem/1 var(--sans);
  color: var(--paper);
  background: linear-gradient(160deg, var(--green), var(--forest));
  border: 0; border-radius: 999px;
  box-shadow: 0 10px 28px -10px rgba(31, 42, 28, .75);
  cursor: pointer;
  transition: transform .2s var(--ease);
}
.fab:hover { transform: translateY(-2px); }

/* ── Прегледът ────────────────────────────────────────────────────────── */

.viewer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-rows: 1fr auto;
  background: var(--shade);
  color: var(--paper);
  animation: fade-in .25s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }

.viewer__stage { display: grid; place-items: center; padding: 3.5rem 1rem 0; min-height: 0; }
.viewer__stage img, .viewer__stage video {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px;
  animation: zoom-in .3s var(--ease);
}
@keyframes zoom-in { from { opacity: 0; transform: scale(.97); } }
.viewer__stage iframe {
  width: min(100%, 68rem); aspect-ratio: 16 / 9; max-height: 100%;
  border: 0; border-radius: 4px; background: #000;
}
.viewer__wait {
  max-width: 22rem; text-align: center;
  font-family: var(--serif); font-size: 1.25rem; line-height: 1.5;
  color: rgba(251, 248, 240, .85);
}

.viewer__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
}
.viewer__meta { min-width: 0; }
.viewer__by { display: block; font-family: var(--serif); font-style: italic; font-size: 1.125rem; }
.viewer__hearts {
  display: block; margin-top: .125rem;
  font-size: .75rem; color: rgba(251, 248, 240, .6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viewer__acts { display: flex; align-items: center; gap: .875rem; flex: 0 0 auto; }
.viewer__note { font-size: .8125rem; opacity: .6; }

.heart--big { color: rgba(251, 248, 240, .75); }

.viewer__save {
  font: 500 .8125rem/1 var(--sans); color: var(--paper); text-decoration: none;
  padding: .6875rem 1.1875rem; border: 1px solid rgba(227, 211, 171, .4); border-radius: 999px;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.viewer__save:hover { border-color: var(--gold-soft); background: rgba(251, 248, 240, .08); }

.viewer__close, .viewer__nav {
  position: absolute; z-index: 2;
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  color: var(--paper); background: rgba(251, 248, 240, .1);
  border: 0; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(8px);
}
.viewer__close { top: calc(.75rem + env(safe-area-inset-top)); right: .875rem; }
.viewer__nav { top: 50%; transform: translateY(-50%); }
.viewer__nav--prev { left: .625rem; }
.viewer__nav--next { right: .625rem; }
.viewer__close:hover, .viewer__nav:hover { background: rgba(251, 248, 240, .2); }

@media (max-width: 34rem) { .viewer__nav { display: none; } }

/* ── Долна лента на телефон ───────────────────────────────────────────── */

.dock { display: none; }

@media (max-width: 47.99rem) {
  .fab { display: none; }
  .switch { display: none; }

  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: .5rem .25rem calc(.4375rem + env(safe-area-inset-bottom));
    background: rgba(252, 250, 244, .88);
    backdrop-filter: blur(20px) saturate(1.6);
    border-top: 1px solid rgba(227, 211, 171, .8);
    box-shadow: 0 -4px 24px -12px rgba(43, 68, 48, .5);
  }

  .dock__tab {
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    padding: .1875rem .25rem;
    color: var(--ink-3); background: none; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s var(--ease), transform .15s var(--ease);
  }
  .dock__icon {
    position: relative;
    display: grid; place-items: center;
    width: 2.375rem; height: 1.75rem;
  }
  .dock__icon svg { width: 1.5rem; height: 1.5rem; display: block; }

  .dock__label {
    font: 500 .6875rem/1 var(--sans);
    letter-spacing: .01em;
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .dock__tab.is-on { color: var(--forest); }
  .dock__tab.is-on .dock__label { font-weight: 700; }
  .dock__tab.is-on svg { stroke-width: 2; }
  .dock__tab:active { transform: scale(.92); }

  /* Броят стои върху сърцето, както е в приложенията. */
  .dock__badge {
    position: absolute; top: -.125rem; right: .0625rem;
    min-width: 1.0625rem; padding: 0 .25rem;
    font: 700 .625rem/1.0625rem var(--sans); font-variant-numeric: tabular-nums;
    color: #fff; background: var(--wine);
    border: 1.5px solid var(--paper); border-radius: 999px;
  }
  .dock__badge:empty { display: none; }

  /* Качването е основното действие — плътен кръг. */
  .dock__tab--go { color: var(--forest); }
  .dock__icon--filled {
    width: 2.5rem; height: 2.5rem;
    margin-top: -.375rem; margin-bottom: -.3125rem;
    color: var(--paper);
    background: linear-gradient(160deg, var(--green), var(--forest));
    border-radius: 999px;
    box-shadow: 0 6px 16px -6px rgba(43, 68, 48, .8);
  }
  .dock__icon--filled svg { width: 1.125rem; height: 1.125rem; }
  .dock__tab--go .dock__label { font-weight: 700; }

  .closing { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
}

/* Малкото листче с името: смяна или излизане. */
.sheetlet {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 1rem;
  background: rgba(22, 30, 20, .45);
  animation: fade-in .2s var(--ease);
}
.sheetlet__card {
  width: min(24rem, 100%);
  display: grid; gap: .625rem;
  padding: 1.625rem 1.375rem calc(1.625rem + env(safe-area-inset-bottom));
  background: var(--paper);
  border: 1px solid var(--gold-soft);
  border-radius: 22px;
  animation: liftIn .28s var(--spring);
}
.sheetlet__who { margin: 0 0 .5rem; font-size: .9375rem; color: var(--ink-2); text-align: center; }
.sheetlet__who b { color: var(--ink); }
.sheetlet .more { margin: 0; width: 100%; }
@keyframes liftIn { from { opacity: 0; transform: translateY(18px); } }

@media (min-width: 48rem) { .sheetlet { align-items: center; } }

/* ─────────────────────────────────────────────────────────────────────────
   Движение

   Един път при отваряне: венецът се изплита, имената влизат буква по буква,
   линийките се разтеглят от центъра. После страницата само диша.

   Всички анимации за влизане са с "backwards", а не "both" — ако браузърът
   не ги пусне (спрян таб, стар телефон), елементът си остава видим.
   ───────────────────────────────────────────────────────────────────── */

/* Венецът: листата се плетат от двата края навътре. */
.is-opening .wreath .lf ellipse {
  transform-box: fill-box;
  transform-origin: center;
  animation: weave .6s var(--spring) backwards;
  animation-delay: calc(.1s + var(--i) * 42ms);
}
@keyframes weave {
  from { opacity: 0; transform: scale(.15) rotate(-25deg); }
  to   { opacity: 1; transform: none; }
}

.is-opening .wreath .berry {
  transform-box: fill-box; transform-origin: center;
  animation: weave .5s var(--spring) backwards;
  animation-delay: calc(.58s + var(--i) * 60ms);
}
.is-opening .wreath .monogram { animation: riseIn .8s var(--ease) backwards; animation-delay: .72s; }

/* Клонките разлистват: първо се изтегля стъблото, после излизат листата. */
.is-opening .branch .stem {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 1.6s var(--ease) backwards; animation-delay: .1s;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.is-opening .branch .lf ellipse {
  transform-box: fill-box; transform-origin: center;
  animation: weave .55s var(--spring) backwards;
  animation-delay: calc(.35s + var(--i) * 55ms);
}

/* И после клонките дишат — едва забележимо. */
.branch {
  animation: sway 15s ease-in-out infinite alternate;
  transform-origin: 20% 20%;
}
.branch--2 { animation-duration: 19s; animation-delay: -4s; transform-origin: 80% 20%; }
.branch--3 { animation-duration: 23s; animation-delay: -9s; }
@keyframes sway {
  from { transform: rotate(var(--rot, 0deg)); }
  to   { transform: rotate(calc(var(--rot, 0deg) + 1.4deg)); }
}
.branch--1 { --rot: -6deg; }
.branch--3 { --rot: 9deg; }

/* Датата, буквите, линийките и подканата — една след друга. */
.is-opening .opening__date { animation: riseIn .7s var(--ease) backwards; animation-delay: .8s; }

.is-opening .names .ch {
  display: inline-block;
  animation: letterIn .75s var(--ease) backwards;
  animation-delay: calc(.88s + var(--i) * 48ms);
}
@keyframes letterIn {
  from { opacity: 0; transform: translateY(.35em); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.names .ch { display: inline-block; }

.is-opening .names__and { animation: riseIn .7s var(--ease) backwards; animation-delay: 1.12s; }

.is-opening .flourish__rule {
  transform: scaleX(0);
  animation: stretch .9s var(--ease) backwards;
  animation-delay: 1.42s;
}
.flourish__rule:first-child { transform-origin: right center; }
.flourish__rule:last-child  { transform-origin: left center; }
@keyframes stretch { to { transform: scaleX(1); } }

.is-opening .flourish__mark {
  transform-box: fill-box; transform-origin: center;
  animation: weave .6s var(--spring) backwards;
  animation-delay: 1.62s;
}

.is-opening .opening__lede { animation: riseIn .8s var(--ease) backwards; animation-delay: 1.7s; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Ореолът зад венеца диша. */
.medallion::before { animation: glow 7s ease-in-out infinite alternate; }
@keyframes glow {
  from { opacity: .75; transform: translate(-50%, -50%) scale(.94); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
}

/* Панелите долитат меко след поканата. */
.is-opening .panel  { animation: riseIn .8s var(--ease) backwards; animation-delay: 1.8s; }
.is-opening .gallery__head { animation: riseIn .8s var(--ease) backwards; animation-delay: 1.95s; }

/* Панелите се сменят мигновено; влизането отгоре важи само при отваряне. */
.panel.just-shown { animation: showQuick .22s var(--ease); }
@keyframes showQuick {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Кадрите изплуват при скролване — само в мозайката, на телефон всеки
   кадър и без това заема целия екран. */
@media (min-width: 48rem) {
  .card.reveal { opacity: 0; transform: translateY(18px); }
  .card.reveal.is-seen {
    opacity: 1; transform: none;
    transition: opacity .65s var(--ease), transform .65s var(--ease);
  }
}

/* Броячът примигва в злато, когато дойде нов кадър. */
.tally { position: relative; display: inline-block; padding: .125rem .625rem; border-radius: 999px; }
.tally.is-fresh { animation: tally-pulse 1.6s var(--ease); }
@keyframes tally-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(179, 146, 92, .45); color: var(--gold); }
  35%  { box-shadow: 0 0 0 .5rem rgba(179, 146, 92, 0); color: var(--forest); }
  100% { box-shadow: 0 0 0 0 rgba(179, 146, 92, 0); color: var(--gold); }
}

/* Поканата се отдалечава при скролване — дава дълбочина на страницата. */
.opening__inner, .opening__garden, .petals { will-change: transform; }

/* Нов кадър влиза в галерията. */
@keyframes settle {
  from { opacity: 0; transform: translateY(-12px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.card.is-new { animation: settle .6s var(--spring) backwards; }

/* Сърчицата, които изхвърчат при харесване. */
.spark {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  color: var(--wine);
  animation: spark .9s var(--ease) forwards;
}
@keyframes spark {
  0%   { opacity: 0;  transform: translate(-50%, -50%) scale(.4); }
  18%  { opacity: .9; }
  100% { opacity: 0;  transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(var(--s, 1)) rotate(var(--r, 0deg)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .petals, .aurora, .opening__glow { display: none; }
  .card.reveal { opacity: 1 !important; transform: none !important; }
}
