/* ============================================================
   Приглашение «Герои и злодеи» — 31.10.2026
   ============================================================ */

/* ---------- Шрифты ---------- */
@font-face {
  font-family: 'Playfair Display';
  src: url('../assets/fonts/playfair-display-v40-cyrillic_latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../assets/fonts/playfair-display-v40-cyrillic_latin-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../assets/fonts/playfair-display-v40-cyrillic_latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../assets/fonts/playfair-display-v40-cyrillic_latin-700italic.woff2') format('woff2');
  font-weight: 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('../assets/fonts/lora-v37-cyrillic_latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('../assets/fonts/lora-v37-cyrillic_latin-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('../assets/fonts/lora-v37-cyrillic_latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  --ink:        #0b0708;
  --velvet:     #2a0a10;
  --velvet-dp:  #14060a;
  --gold:       #d8b26a;
  --gold-soft:  #b99a5e;
  --cream:      #efe3d0;
  --cream-dim:  rgba(239, 227, 208, .72);
  --cream-faint:rgba(239, 227, 208, .45);
  --hearts:     #a3202c;

  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-slow:  cubic-bezier(0.76, 0, 0.24, 1);

  --stage-pad:  clamp(20px, 6vw, 40px);
  /* Ширина «карточки» на десктопе: вертикаль 9:16 по высоте экрана */
  --card-w:     min(100%, calc(100dvh * 0.5625));
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  overflow-x: hidden;
}

body {
  font-family: 'Lora', Georgia, serif;
  font-synthesis: none;
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

img, video { display: block; max-width: 100%; }

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

p { margin: 0; }

/* Фон-подложка вокруг вертикальной карточки на широких экранах */
.page {
  position: relative;
  min-height: 100dvh;
  background:
    radial-gradient(90% 70% at 50% 8%, #23080d 0%, #120508 42%, #060304 100%);
}

/* ---------- Медиа-слой (постер + видео) ---------- */
.media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--ink);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.media.is-playing video { opacity: 1; }

/* Затемнение под текст */
.veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom,
      rgba(11, 7, 8, .55) 0%,
      rgba(11, 7, 8, .10) 28%,
      rgba(11, 7, 8, .30) 58%,
      rgba(11, 7, 8, .88) 100%);
}

/* ---------- Экран ---------- */
.screen {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: var(--stage-pad);
  padding-bottom: max(var(--stage-pad), env(safe-area-inset-bottom));
}

/* ---------- Типографика ---------- */
.overline {
  font-family: 'Lora', serif;
  font-size: clamp(10px, 2.9vw, 12px);
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1em;
}

.display {
  font-size: clamp(2.6rem, 13vw, 4.4rem);
  line-height: .96;
  text-shadow: 0 2px 24px rgba(11, 7, 8, .75);
}

.display em {
  font-style: italic;
  color: var(--gold);
}

.lede {
  font-size: clamp(.95rem, 4vw, 1.06rem);
  line-height: 1.65;
  color: var(--cream-dim);
}

.section-title {
  font-size: clamp(1.7rem, 8vw, 2.4rem);
  margin-bottom: .7em;
}

.whisper {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.35rem, 6.5vw, 2rem);
  line-height: 1.3;
  color: var(--cream);
  text-align: center;
  text-shadow: 0 2px 22px rgba(11, 7, 8, .8);
}

/* Тонкая линия-разделитель со ромбом */
.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2.6rem 0;
}
.rule::before, .rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(216, 178, 106, .45), transparent);
}
.rule span {
  color: var(--gold);
  font-size: 9px;
  letter-spacing: .2em;
}

/* ---------- Ворота (первый экран) ---------- */
.gate .stage { padding-bottom: clamp(28px, 8vw, 52px); }

.gate__head { margin-bottom: clamp(28px, 8vw, 44px); }

.gate__meta {
  margin-top: 1.2rem;
  font-size: clamp(.85rem, 3.6vw, .95rem);
  letter-spacing: .06em;
  color: var(--cream-dim);
}

/* ---------- Форма ---------- */
.form-note {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.05rem, 4.6vw, 1.25rem);
  color: var(--cream);
  margin-bottom: 1.3rem;
}

.field { position: relative; margin-bottom: 1.35rem; }

/* Только собственная подпись поля: варианты ответа - тоже label, их не трогаем */
.field > label {
  display: block;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cream-faint);
  margin-bottom: .5rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: .72rem .1rem;
  font-family: 'Lora', serif;
  font-size: 1rem;
  color: var(--cream);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(239, 227, 208, .28);
  border-radius: 0;
  outline: none;
  transition: border-color .35s var(--ease);
  -webkit-appearance: none;
}

.field textarea { resize: vertical; min-height: 4.6rem; line-height: 1.55; }

.field input::placeholder,
.field textarea::placeholder { color: rgba(239, 227, 208, .3); }

.field input:focus,
.field textarea:focus { border-bottom-color: var(--gold); }

.field.has-error input { border-bottom-color: var(--hearts); }

.field__err {
  display: none;
  margin-top: .4rem;
  font-size: 12px;
  color: #d98a92;
}
.field.has-error .field__err { display: block; }

/* Кнопка: срезанные углы как у игральной карты */
.btn {
  --cut: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: 1.05rem 1.4rem;
  font-family: 'Lora', serif;
  font-size: .95rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--cream);
  border: 0;
  cursor: pointer;
  transition: background-color .35s var(--ease), opacity .35s var(--ease);
  clip-path: polygon(
    var(--cut) 0%, calc(100% - var(--cut)) 0%, 100% var(--cut),
    100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%,
    var(--cut) 100%, 0% calc(100% - var(--cut)), 0% var(--cut));
}

.btn:hover { background: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

/* Обводка рисуется подложкой: clip-path срезает обычный border и box-shadow */
.btn--ghost {
  position: relative;
  color: var(--cream);
  background: rgba(216, 178, 106, .5);
  text-decoration: none;
}
.btn--ghost::before {
  content: '';
  position: absolute;
  inset: 1px;
  background: rgba(11, 7, 8, .9);
  clip-path: polygon(
    9px 0%, calc(100% - 9px) 0%, 100% 9px,
    100% calc(100% - 9px), calc(100% - 9px) 100%,
    9px 100%, 0% calc(100% - 9px), 0% 9px);
  transition: background-color .35s var(--ease);
}
.btn--ghost > span { position: relative; z-index: 1; }
.btn--ghost:hover { background: var(--gold); }
.btn--ghost:hover::before { background: rgba(42, 10, 16, .9); }

/* ---------- Пролёт ---------- */
.flythrough {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s var(--ease);
}
.flythrough.is-on { opacity: 1; pointer-events: auto; }
.flythrough video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Запасной переход, если видео недоступно */
.flash {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: radial-gradient(circle at 50% 62%, #f6e3b8 0%, #d8b26a 30%, rgba(11,7,8,0) 72%);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Зал ---------- */
.hall { position: relative; display: none; }
.hall.is-on { display: block; }

.hall__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* Зал живёт фоном под всем текстом, поэтому гасим его сильнее,
   плюс отдельная виньетка гасит пятно свечей в центре */
.hall__bg .veil {
  background:
    radial-gradient(65% 38% at 50% 52%, rgba(11, 7, 8, .48) 0%, rgba(11, 7, 8, 0) 100%),
    linear-gradient(to bottom,
      rgba(11, 7, 8, .62) 0%,
      rgba(11, 7, 8, .46) 35%,
      rgba(11, 7, 8, .56) 70%,
      rgba(11, 7, 8, .85) 100%);
}

.hall__content { position: relative; z-index: 2; }

.section {
  padding: clamp(64px, 17vw, 120px) var(--stage-pad);
}

.section--tall { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

/* Приветствие: собственная затемняющая подложка, текста тут много и он без панели */
.welcome { text-align: center; position: relative; }
.welcome::before {
  content: '';
  position: absolute;
  inset: -10% -20%;
  background: radial-gradient(58% 42% at 50% 50%, rgba(11, 7, 8, .72) 0%, rgba(11, 7, 8, 0) 100%);
  pointer-events: none;
}
.welcome > * { position: relative; }
.welcome .display { margin-bottom: .5em; }
.welcome .lede { text-shadow: 0 1px 16px rgba(11, 7, 8, .9); }
.welcome__name { display: block; font-style: italic; color: var(--gold); }

/* Карточка блока */
/* Блок-«карта», положенная на стол: почти непрозрачная, с золотой волосяной рамкой */
.panel {
  position: relative;
  background: rgba(13, 6, 9, .88);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, .22),
              0 24px 60px rgba(0, 0, 0, .55);
  padding: clamp(24px, 7vw, 38px);
}

/* Детали: строки */
.facts { display: grid; gap: 1.5rem; margin-top: 1.6rem; }

.fact__key {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .45rem;
}
.fact__val { font-size: clamp(1rem, 4.4vw, 1.12rem); line-height: 1.5; }
.fact__val small { display: block; margin-top: .3rem; font-size: .85em; color: var(--cream-dim); }

.map-links { display: flex; gap: .7rem; margin-top: 1.6rem; flex-wrap: wrap; }
.map-links .btn { width: auto; flex: 1 1 auto; padding: .85rem 1.1rem; font-size: .8rem; }

/* Таймер */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-top: 2rem;
  text-align: center;
}
.countdown__cell { padding: .8rem .2rem; box-shadow: inset 0 0 0 1px rgba(216, 178, 106, .2); }
.countdown__num {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 7vw, 2rem);
  color: var(--gold);
  line-height: 1;
}
.countdown__lbl {
  margin-top: .4rem;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cream-faint);
}

/* Чекбоксы и радио */
.choices { display: grid; gap: .1rem; }

.choice {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem .2rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(239, 227, 208, .1);
}

.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice__box {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  box-shadow: inset 0 0 0 1px rgba(239, 227, 208, .4);
  position: relative;
  transition: box-shadow .3s var(--ease);
}
.choice__box--round { border-radius: 50%; }

.choice__box::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--gold);
  opacity: 0;
  transform: scale(.5);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.choice__box--round::after { border-radius: 50%; }

.choice input:checked + .choice__box { box-shadow: inset 0 0 0 1px var(--gold); }
.choice input:checked + .choice__box::after { opacity: 1; transform: scale(1); }

.choice input:focus-visible + .choice__box { box-shadow: inset 0 0 0 2px var(--gold); }

.choice__label { font-size: clamp(.95rem, 4vw, 1.02rem); }

/* Условный блок «с кем придёте» */
.reveal-block {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .5s var(--ease), opacity .4s var(--ease);
}
.reveal-block > div { overflow: hidden; }
.reveal-block.is-open { grid-template-rows: 1fr; opacity: 1; }

/* Статус отправки */
.form-status {
  margin-top: 1.2rem;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--cream-dim);
  min-height: 1.4em;
}
.form-status a { color: var(--gold); }

/* Финал */
.finale { text-align: center; }

.credit {
  padding: clamp(40px, 10vw, 64px) var(--stage-pad) calc(clamp(32px, 8vw, 48px) + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--cream-faint);
}
.credit a { color: var(--gold-soft, #b99a5e); text-decoration: none; border-bottom: 1px solid rgba(216,178,106,.3); }

/* Атрибуция трека: обязательна по CC BY, но держим её тихой */
.credit__music {
  display: block;
  margin-top: .7rem;
  font-size: 10px;
  line-height: 1.6;
  color: rgba(239, 227, 208, .3);
}
.credit__music a { color: rgba(216, 178, 106, .55); border-bottom-color: rgba(216, 178, 106, .2); }

/* ---------- Карта с контактом ведущего ---------- */
.host {
  margin-top: 1.8rem;
  perspective: 1100px;
}

.host__card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1.72 / 1;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .95s var(--ease);
}

.host.is-open .host__card { transform: rotateY(180deg); }

.host__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Подстраховка: на старых WebView backface-visibility иногда не срабатывает */
  transition: opacity .45s var(--ease);
}

/* Рубашка */
.host__face--front {
  color: var(--gold);
  background:
    repeating-linear-gradient(45deg,
      rgba(216, 178, 106, .07) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #4a1119 0%, #2a0a10 60%, #1c060b 100%);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, .45),
              inset 0 0 0 6px rgba(216, 178, 106, .08),
              0 18px 40px rgba(0, 0, 0, .5);
}
.host.is-open .host__face--front { opacity: 0; }

.host__pip { font-size: 1.9rem; line-height: 1; }

.host__role {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--cream);
}

.host__hint {
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(239, 227, 208, .45);
}

/* Лицо карты */
.host__face--back {
  transform: rotateY(180deg);
  opacity: 0;
  color: var(--ink);
  background: linear-gradient(165deg, #fbf3e4 0%, var(--cream) 55%, #ded0b8 100%);
  box-shadow: inset 0 0 0 1px rgba(11, 7, 8, .18),
              0 18px 40px rgba(0, 0, 0, .5);
}
.host.is-open .host__face--back { opacity: 1; }

.host__corner {
  position: absolute;
  font-size: 1rem;
  color: var(--hearts);
  line-height: 1;
}
.host__corner--tl { top: 12px; left: 14px; }
.host__corner--br { bottom: 12px; right: 14px; transform: rotate(180deg); }

.host__name {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: var(--ink);
}

.host__phone {
  font-family: 'Lora', serif;
  font-size: 1.05rem;
  letter-spacing: .04em;
  color: #4a1119;
}

.host__links {
  display: flex;
  gap: .7rem;
  margin-top: 1.1rem;
  max-width: 320px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .5s var(--ease) .35s, transform .5s var(--ease) .35s;
}
.host.is-open .host__links { opacity: 1; transform: none; pointer-events: auto; }
.host__links .btn { flex: 1 1 0; padding: .8rem .9rem; font-size: .78rem; }

@media (prefers-reduced-motion: reduce) {
  .host__card { transition: none; }
}

/* ---------- Подсказка «листайте вниз» ---------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  color: var(--cream-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .8s var(--ease);
}
.scroll-hint.is-on { opacity: 1; }
.scroll-hint.is-gone { opacity: 0; pointer-events: none; }

.scroll-hint__txt {
  font-family: 'Lora', serif;
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.scroll-hint svg {
  width: 20px;
  height: 20px;
  color: var(--gold);
  animation: nudge 2.4s var(--ease) infinite;
}

@keyframes nudge {
  0%, 62%, 100% { transform: translateY(0); opacity: .75; }
  78%           { transform: translateY(7px); opacity: 1; }
}

/* ---------- Пылинки ---------- */
#dust {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Звук ---------- */
.sound {
  position: fixed;
  z-index: 60;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  width: 42px; height: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  background: rgba(11, 7, 8, .5);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(239, 227, 208, .2);
  cursor: pointer;
}
.sound.is-on { display: flex; }
.sound svg { width: 17px; height: 17px; }
.sound .icon-off { display: none; }
.sound.is-muted .icon-on { display: none; }
.sound.is-muted .icon-off { display: block; }

/* ---------- Появление по скроллу ---------- */
.rise { opacity: 0; transform: translateY(24px); }
.is-ready .rise { will-change: opacity, transform; }

/* ---------- Десктоп: вертикальная карточка по центру ---------- */
@media (min-width: 900px) {
  .screen,
  .flythrough video {
    width: var(--card-w);
    margin-inline: auto;
  }

  .flythrough { display: flex; align-items: center; justify-content: center; }

  /* Слой fixed: центруем только через left+transform.
     margin-inline: auto здесь сложился бы со сдвигом и увёл фон вбок. */
  .hall__bg {
    width: var(--card-w);
    left: 50%;
    right: auto;
    margin-inline: 0;
    transform: translateX(-50%);
  }

  .hall__content {
    width: var(--card-w);
    margin-inline: auto;
  }

  .screen { box-shadow: 0 0 90px rgba(0, 0, 0, .8); }

  /* Пылинки живут внутри карточки, а не по всему экрану */
  #dust {
    width: var(--card-w);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  :root { --stage-pad: 44px; }
}

/* ---------- Меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .rise { opacity: 1; transform: none; }
  #dust { display: none; }
}
