/**
 * Odtwarzacz filmow - warstwa nad strona.
 *
 * Warstwa ma robic to, co sala kinowa: zgasic wszystko poza obrazem. Strona
 * pod spodem zostaje widoczna tylko jako cien, bo widz ma pamietac, gdzie
 * jest, ale nie ma na co patrzec poza kadrem.
 */

.ax-player {
  position: fixed;
  inset: 0;
  /* Nad paskiem nawigacji (100) i nad menu pelnoekranowym (120). */
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vh, 64px) var(--ax-gutter);
  color: var(--ax-paper);
}

.ax-player[hidden] {
  display: none;
}

.ax-player__scrim {
  position: absolute;
  inset: 0;
  /*
   * Gasimy mocno, ale nie do czerni: pod warstwa ma zostac cien strony, zeby
   * widz wiedzial, ze film jest przystankiem, nie osobnym adresem.
   */
  background:
    radial-gradient(130% 120% at 50% 0%, rgba(20, 24, 51, 0.74), rgba(6, 8, 20, 0.93) 70%);
  backdrop-filter: blur(26px) saturate(120%) brightness(0.42);
  -webkit-backdrop-filter: blur(26px) saturate(120%) brightness(0.42);
  opacity: 0;
  transition: opacity 320ms ease;
}

.ax-player.is-open .ax-player__scrim {
  opacity: 1;
}

.ax-player__dialog {
  position: relative;
  z-index: 1;
  /*
   * Szerokosc liczona takze z wysokosci okna: kadr trzyma 16:9, wiec o tym,
   * czy zmiesci sie z belkami, decyduje krotsza os. Rezerwa 250 px to belka
   * z tytulem, stopka i oddech warstwy.
   */
  width: min(1180px, 100%, calc((100svh - 250px) * 16 / 9));
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 20px);
  opacity: 0;
  transform: translateY(18px) scale(0.986);
  transition: opacity 520ms cubic-bezier(0.16, 1, 0.3, 1), transform 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ax-player.is-open .ax-player__dialog {
  opacity: 1;
  transform: none;
}

/* --- Belka nad kadrem: metryka filmu po lewej, wyjscie po prawej --- */
.ax-player__rail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.ax-player__meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.ax-player__eyebrow {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(200, 216, 240, 0.62);
}

.ax-player__eyebrow:empty {
  display: none;
}

.ax-player__title {
  font-family: 'Gopher Display', var(--ax-font);
  font-weight: 600;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.06;
  letter-spacing: -0.028em;
}

.ax-player__title:empty {
  display: none;
}

/* Akcent marki: druga czesc naglowka lzejsza i pochylona. */
.ax-player__title em {
  font-style: italic;
  font-weight: 300;
}

.ax-player__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ax-paper);
  transition: color 320ms ease;
}

.ax-player__close-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(244, 241, 235, 0.28);
  transition: box-shadow 320ms ease, background-color 320ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .ax-player__close:hover .ax-player__close-x {
    background: rgba(244, 241, 235, 0.14);
    box-shadow: inset 0 0 0 1px rgba(244, 241, 235, 0.5);
  }
}

.ax-player__close:focus-visible .ax-player__close-x {
  background: rgba(244, 241, 235, 0.14);
  box-shadow: inset 0 0 0 1px rgba(244, 241, 235, 0.62);
}

.ax-player__close:focus-visible {
  outline: none;
}

/* --- Kadr --- */
.ax-player__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--ax-radius-lg);
  overflow: hidden;
  background: var(--ax-ink-deep);
  box-shadow:
    inset 0 0 0 1px rgba(244, 241, 235, 0.14),
    0 60px 120px -46px rgba(0, 0, 0, 0.86);
}

.ax-player__poster {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  /* Plakat tylko sygnalizuje, co sie zaraz stanie - stad rozmycie. */
  filter: blur(18px) saturate(120%) brightness(0.52);
  transform: scale(1.08);
  opacity: 0;
  transition: opacity 420ms ease;
}

.ax-player__poster.is-on {
  opacity: 1;
}

.ax-player__loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transition: opacity 320ms ease;
  pointer-events: none;
}

.ax-player__loader.is-on {
  opacity: 1;
}

.ax-player__spin {
  display: block;
  animation: ax-player-spin 1.4s linear infinite;
}

.ax-player__loader-txt {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 241, 235, 0.62);
}

@keyframes ax-player-spin {
  to {
    transform: rotate(360deg);
  }
}

.ax-player__slot {
  position: absolute;
  inset: 0;
  display: block;
}

.ax-player__slot iframe,
.ax-player__slot video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
  opacity: 0;
  transition: opacity 520ms ease;
}

.ax-player__slot.is-ready iframe,
.ax-player__slot.is-ready video {
  opacity: 1;
}

/* --- Belka pod kadrem --- */
.ax-player__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: rgba(244, 241, 235, 0.42);
}

/* Blokada przewijania strony pod warstwa. */
html.ax-player-open,
html.ax-player-open body {
  overflow: hidden;
}

@media (max-width: 900px) {
  /*
   * Telefon: kadr na cala szerokosc, jak pas filmowy. Przy 390 px rynna
   * zabierala 36 px z 16:9, czyli dziesiata czesc obrazu - a sterowanie
   * YouTube ma stala wielkosc i przy waskim kadrze zjada polowe kompozycji.
   */
  .ax-player {
    padding: 0;
  }

  .ax-player__dialog {
    width: 100%;
  }

  .ax-player__rail,
  .ax-player__foot {
    padding: 0 var(--ax-gutter);
  }

  .ax-player__frame {
    border-radius: 0;
    box-shadow:
      inset 0 1px 0 rgba(244, 241, 235, 0.14),
      inset 0 -1px 0 rgba(244, 241, 235, 0.14);
  }

  .ax-player__close-txt {
    /* Na telefonie liczy sie sam krzyzyk - napis zabiera miejsce tytulowi. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .ax-player__title {
    font-size: 18px;
  }

  .ax-player__hint {
    display: none;
  }

  .ax-player__foot {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ax-player__dialog {
    transform: none;
    transition-duration: 0.001ms;
  }

  .ax-player__spin {
    animation-duration: 4s;
  }
}
