/* ATAVUS · živá vrstva sdílená všemi plochami (atavus.cz, invest, sales).
 * Kopie pro sales leží v subdomains/sales.atavus.cz/brand/ a musí zůstat bajtově shodná.
 *
 * 1. Úvodní opona: jen první stránka v relaci, kreslí ji body::before/::after,
 *    takže do HTML nepřibude žádný uzel. Třídu av-intro nastaví js/loader.js;
 *    bez JS a při omezeném pohybu se opona nekreslí vůbec. Zavírá se sama
 *    animací, i kdyby skript dál nic neudělal.
 * 2. Hvězdné nebe: plátno od js/stars.js leží pod obsahem sekce (z-index -1
 *    v izolovaném kontextu hostitele).
 * 3. Živé fotky: video od js/video-enhance.js leží přesně nad <img> a objeví se
 *    až ve chvíli, kdy opravdu hraje. Obrázek zůstává LCP i záloha.
 */

html.av-intro body::before,
html.av-intro body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
html.av-intro body::before {
  z-index: 2147483000;
  background: #0C1A15;
  animation: av-intro-lift .62s cubic-bezier(.76, 0, .24, 1) 1.02s both;
}
html.av-intro body::after {
  z-index: 2147483001;
  background:
    url(logos/wordmark-cream-tight.svg) center calc(50% - 12px) / 172px auto no-repeat,
    linear-gradient(#C6A24B, #C6A24B) center calc(50% + 22px) / 0 1px no-repeat;
  animation:
    av-intro-mark 1s cubic-bezier(.22, .61, .36, 1) both,
    av-intro-fade .34s ease-in .98s forwards;
}
@keyframes av-intro-mark {
  0% { opacity: 0; background-position: center calc(50% - 4px), center calc(50% + 22px); background-size: 172px auto, 0 1px; }
  38% { opacity: 1; }
  100% { opacity: 1; background-position: center calc(50% - 12px), center calc(50% + 22px); background-size: 172px auto, 128px 1px; }
}
@keyframes av-intro-fade { to { opacity: 0; visibility: hidden; } }
@keyframes av-intro-lift {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 0 100% 0); visibility: hidden; }
}

/* Plátno nesmí vstoupit do toku: pravidla typu „.sekce > * { position: relative }"
   by ho jinak natáhla s hostitelem a ResizeObserver by sekci nafukoval dál. */
[data-stars] > canvas.av-stars {
  position: absolute !important;
  inset: 0;
  z-index: -1 !important;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.av-live-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity .9s cubic-bezier(.22, .61, .36, 1);
}
.av-live-video.is-live { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html.av-intro body::before,
  html.av-intro body::after { display: none; }
  .av-live-video { display: none; }
}
