/* Intro film on the front page (inc/intro-film.php + js/intro-film.js)
   State on <html>: data-ml-intro="play" (film) → "leave" (film slides up, page reveals) → removed */
:root {
  --ml-intro-ease: cubic-bezier(0.76, 0, 0.24, 1);
  --ml-intro-reveal-ease: cubic-bezier(0.625, 0.05, 0, 1);
}
.ml-intro {
  display: none;
}
html[data-ml-intro] .ml-intro {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above burger, menu, logo and "Book samtale" */
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  will-change: transform;
}
.ml-intro video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* No scrolling while the film plays */
html[data-ml-intro="play"],
html[data-ml-intro="play"] body {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

/* ---------- The film slides up out of the top ---------- */
html[data-ml-intro="leave"] .ml-intro {
  transform: translateY(-100%);
  transition: transform 1.4s var(--ml-intro-ease);
}
html[data-ml-intro="leave"] .ml-intro video {
  transform: translateY(35%); /* parallax: the picture lags behind its frame */
  transition: transform 1.4s var(--ml-intro-ease);
}

/* ---------- The page behind ---------- */
/* Hero: settles from a slight zoom and darkness */
html[data-ml-intro] #front .et-pb-background-video,
html[data-ml-intro] #front {
  transform-origin: 50% 0;
}
html[data-ml-intro="play"] #front {
  transform: scale(1.12);
  filter: brightness(0.4);
}
#front {
  transition: transform 2s var(--ml-intro-reveal-ease) 0.25s, filter 1.6s ease 0.25s;
}

/* Logo: unveils from the top down, after the film has passed */
.ml-logo {
  transition: clip-path 1.6s var(--ml-intro-reveal-ease) 0.8s, opacity 0.6s var(--ml-ease) 0.4s, visibility 0s linear 0.4s, height 0.9s var(--ml-ease), top 0.9s var(--ml-ease), left 0.9s var(--ml-ease);
}
html[data-ml-intro="play"] .ml-logo {
  clip-path: inset(0 0 100% 0);
}
html:not([data-ml-intro="play"]) .ml-logo {
  clip-path: inset(0 0 0 0);
}

/* Burger: drops in */
html[data-ml-intro="play"] .ml-burger {
  opacity: 0;
  translate: 0 -1.5rem;
  visibility: hidden;
}
.ml-burger {
  transition: scale 0.15s cubic-bezier(0.4, 0, 0.2, 1), color 0.5s var(--ml-ease), opacity 1s ease 1s, translate 1.4s var(--ml-intro-reveal-ease) 1s;
}

/* "Book samtale": hidden, its own entrance animation runs when the page appears */
html[data-ml-intro="play"] .ml-book {
  visibility: hidden;
  animation: none;
}

/* The actual front page: the film is gone from the hero.
   With a background image on #front (set in Divi) the video is hidden; without one, its last frame stays as a still */
html.ml-front-still #front .et-pb-background-video,
html[data-ml-front-still] #front .et-pb-background-video {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ml-intro] .ml-intro,
  html[data-ml-intro] .ml-intro video,
  #front,
  .ml-logo,
  .ml-burger {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
}
