/* ============================================================
   azgorator — интро: портал с видео на весь экран
   Видео играет БЕЗ звука и без кнопки звука — так и задумано.
   ============================================================ */

.intro {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: var(--black);
  overflow: hidden;
}

.intro[hidden] { display: none; }

/* --- Размытая копия видео на фоне: убирает чёрные поля на широком экране --- */
.intro__bg {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(26px) saturate(140%) brightness(0.26);
  will-change: opacity;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}

.intro.is-lit .intro__bg { opacity: 0.6; }

/* --- Портал: вращающиеся кольца мандалы вокруг видео --- */
.intro__rings {
  position: absolute;
  width: min(128vh, 155vw);
  aspect-ratio: 1;
  color: var(--cyan);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 1.5s var(--ease), transform 1.8s var(--ease);
  pointer-events: none;
}

.intro.is-lit .intro__rings { opacity: 0.5; transform: scale(1); }

.intro__rings svg { width: 100%; height: 100%; }

.intro__rings--outer { color: var(--violet); }

/* Внутреннее кольцо меньше внешнего — получается вложенный портал */
.intro__rings:not(.intro__rings--outer) {
  width: min(82vh, 104vw);
  color: var(--cyan);
}

/* --- Створка портала с самим видео --- */
.intro__gate {
  position: relative;
  height: min(80dvh, 148vw);
  aspect-ratio: 9 / 16;
  border-radius: 34px;
  overflow: hidden;
  background: #000;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease-back);
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--cyan) 45%, transparent),
    0 0 90px -12px color-mix(in oklab, var(--cyan) 60%, transparent),
    0 0 180px -30px color-mix(in oklab, var(--magenta) 55%, transparent);
}

.intro.is-lit .intro__gate { opacity: 1; transform: scale(1); }

.intro__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Пока видео грузится, в портале живёт пульсирующая мандала --- */
.intro__loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--lime);
  transition: opacity 0.6s var(--ease);
}

.intro__loader svg {
  width: 44%;
  animation: loader-pulse 2.6s var(--ease) infinite, mandala-spin 30s linear infinite;
}

.intro.is-playing .intro__loader { opacity: 0; }

@keyframes loader-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

/* --- Кнопка входа в галерею ---
   Лежит поверх играющего видео, поэтому у неё плотная тёмная подложка:
   полупрозрачной заливки не хватало, надпись растворялась в кадре. */
.intro__skip {
  position: absolute;
  left: 50%;
  bottom: clamp(1.2rem, 4vh, 3rem);
  transform: translateX(-50%);
  --btn-color: var(--cyan);
  padding: 0.85em 1.9em;
  border-width: 1.5px;
  border-color: var(--cyan);
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
  box-shadow:
    0 0 30px -6px color-mix(in oklab, var(--cyan) 85%, transparent),
    inset 0 0 22px -14px var(--cyan);
  /* Видна с первого кадра, вместе с видео: раньше она выцветала
     только через полторы секунды, и по ней не успевали нажать. */
  opacity: 1;
}

.intro__skip:hover,
.intro__skip:focus-visible {
  background: color-mix(in oklab, var(--cyan) 26%, rgba(0, 0, 0, 0.6));
  transform: translateX(-50%) translateY(-1px);
}


/* --- Полоска времени до раскрытия --- */
.intro__progress {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.intro__progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--lime), var(--cyan), var(--magenta));
  box-shadow: 0 0 14px color-mix(in oklab, var(--cyan) 80%, transparent);
}

/* --- Раскрытие: портал уходит в глубину --- */
.intro.is-opening { pointer-events: none; }

.intro.is-opening .intro__gate {
  animation: gate-dive 1s var(--ease) forwards;
}

.intro.is-opening .intro__rings {
  animation: rings-expand 1s var(--ease) forwards;
}

.intro.is-opening .intro__bg,
.intro.is-opening .intro__skip,
.intro.is-opening .intro__progress {
  animation: fade-out 0.5s var(--ease) forwards;
}

/* Размытие убрано намеренно: оно применялось к играющему видео и совпадало
   по времени с появлением карточек — именно в этот момент и дёргалось. */
@keyframes gate-dive {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(0.14); opacity: 0; }
}

@keyframes rings-expand {
  to { transform: scale(2.6); opacity: 0; }
}

@keyframes fade-out {
  to { opacity: 0; }
}

/* --- Телефон: видео разворачивается на весь экран --- */
@media (max-width: 780px) {
  .intro__gate {
    height: 100dvh;
    width: 100vw;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
  }
  .intro__rings { opacity: 0; }
  .intro.is-lit .intro__rings { opacity: 0.22; }
  .intro__bg { display: none; }
}

/* --- Меньше анимации: просто показать видео и убрать его --- */
@media (prefers-reduced-motion: reduce) {
  .intro__gate,
  .intro__rings,
  .intro__bg { transition: opacity 0.3s linear; transform: none !important; }
  .intro.is-opening .intro__gate,
  .intro.is-opening .intro__rings { animation: fade-out 0.4s linear forwards; }
  .intro__loader svg { animation: none; }
}
