/* ==========================================================================
   film: the PASHA Real Estate film before the footer.
   A short silent loop plays in a rounded window that opens to the full
   screen as you scroll (js/modules/film.js). "Watch the film" opens the
   full film with sound in a window (film__dialog).
   Nothing heavy loads with the page: the loop is requested only near the
   section, the full film only after the click.
   ========================================================================== */

.film {
  /* the window opens from these insets to 0 (film.js changes them on scroll) */
  --film-inset-x: 0px;
  --film-inset-y: 0px;
  --film-radius: 0px;
  position: relative;
  height: 100svh;
  min-height: 34rem;
  /* same colour as the FAQ above: the window looks like it grows out of it */
  background-color: var(--bg-soft);
  color: var(--text-on-dark);
}

.film__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--bg-darker);
  -webkit-clip-path: inset(var(--film-inset-y) var(--film-inset-x) round var(--film-radius));
  clip-path: inset(var(--film-inset-y) var(--film-inset-x) round var(--film-radius));
}

.film__poster,
.film__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the loop appears over the poster only when it really plays */
.film__video {
  opacity: 0;
  transition: opacity 800ms var(--ease-out);
}

.film__video--ready {
  opacity: 1;
}

/* light veil at the top only: keeps the small button (and the header
   above it) readable, the film itself stays clean */
.film__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 28, 30, 0.55) 0%, rgba(0, 28, 30, 0) 35%);
}

.film__content {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: flex-end; /* the button sits in the top right corner, */
  padding-top: calc(var(--header-h) + var(--space-sm)); /* under the header */
}

/* "Watch the film": thin circle with a play sign and a small label */
.film__open {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--color-ivory);
  cursor: pointer;
}

.film__open-circle {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(246, 245, 242, 0.55);
  border-radius: 50%;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background-color 400ms var(--ease-out), border-color 400ms var(--ease-out), color 400ms var(--ease-out);
}

.film__play-icon {
  width: 0.95rem;
  height: 0.95rem;
  margin-left: 0.15rem; /* the triangle looks centred */
}

.film__open-text {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 400ms var(--ease-out);
}

@media (hover: hover) {
  .film__open:hover .film__open-circle {
    border-color: var(--color-ivory);
    background-color: var(--color-ivory);
    color: var(--color-teal);
  }

  .film__open:hover .film__open-text {
    opacity: 1;
  }
}

.film__open:focus-visible {
  outline: none;
}

.film__open:focus-visible .film__open-circle {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ----- window with the full film ----- */
.film__dialog {
  width: min(78rem, calc(100% - var(--gutter) * 2));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.film__dialog::backdrop {
  background-color: rgba(0, 20, 22, 0.92);
}

.film__dialog[open] {
  animation: film-dialog-in 500ms var(--ease-out);
}

@keyframes film-dialog-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

.film__player {
  display: block;
  width: 100%;
  max-height: calc(100svh - 7rem);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background-color: #000;
}

/* close: two lines forming a cross, above the video */
.film__close {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line-on-dark);
  border-radius: 50%;
  color: var(--color-ivory);
  transition: background-color 300ms var(--ease-out);
}

.film__close-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1.5px;
  background-color: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.film__close-line + .film__close-line {
  transform: translate(-50%, -50%) rotate(-45deg);
}

@media (hover: hover) {
  .film__close:hover {
    background-color: rgba(246, 245, 242, 0.12);
  }
}

.film__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .film__video {
    transition: none;
  }

  .film__dialog[open] {
    animation: none;
  }
}
