/*
 * Homepage film (home-film.js). Same language as the rest of the homepage: a statement
 * heading with a muted continuation over a square media well, a pill CTA.
 */
.of-film {
  align-self: stretch;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.of-statement {
  max-width: 670px;
  margin: 0;
  color: rgba(0, 0, 0, 0.3);
  font: 500 32px/1.1 "SF Pro Display Medium", -apple-system, sans-serif;
}

.of-statement span {
  color: rgba(0, 0, 0, 0.8);
}

/* The well is the film's own background, so the poster and the video sit in it seamlessly */
.of-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: rgb(238, 239, 237);
  transform-origin: 50% 0;
  will-change: transform;
}

.of-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.of-frame button {
  appearance: none;
  border: 0;
  margin: 0;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.of-frame button:focus-visible {
  outline: 2px solid rgb(0, 122, 255);
  outline-offset: 3px;
}

.of-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* One row of controls at the bottom left, clear of the site's floating theme switch */
.of-bar {
  position: absolute;
  left: 28px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.of-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 22px 0 16px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  font: 600 17px/1 "SF Pro Display Semibold", -apple-system, sans-serif;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 180ms ease, background-color 150ms ease;
}

.of-cta:hover {
  background: #000;
  transform: scale(1.03);
}

.of-cta-icon {
  width: 22px;
  height: 22px;
}

.of-cta small {
  font: 500 15px/1 "SF Pro Display Medium", -apple-system, sans-serif;
  opacity: 0.55;
}

.of-cta small[hidden] {
  display: none;
}

.of-toggle,
.of-mute {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background-color 150ms ease, opacity 300ms ease;
}

.of-toggle:hover,
.of-mute:hover {
  background: rgba(17, 17, 17, 0.9);
}

.of-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  transition: opacity 300ms ease;
}

.of-progress i {
  display: block;
  height: 100%;
  background: rgba(17, 17, 17, 0.6);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ambient: Watch with sound · watching: pause + mute · paused: Resume + mute · ended: Replay */
.of-frame[data-state="ambient"] .of-toggle,
.of-frame[data-state="ambient"] .of-mute,
.of-frame[data-state="ambient"] .of-progress,
.of-frame[data-state="watching"] .of-cta,
.of-frame[data-state="paused"] .of-toggle,
.of-frame[data-state="ended"] .of-toggle,
.of-frame[data-state="ended"] .of-mute,
.of-frame[data-state="ended"] .of-progress {
  display: none;
}

/* While the film plays with sound the controls step back until the pointer moves over it */
@media (hover: hover) {
  .of-frame[data-state="watching"] .of-toggle,
  .of-frame[data-state="watching"] .of-mute {
    opacity: 0;
    transition-delay: 0ms, 600ms;
  }

  .of-frame[data-state="watching"]:hover .of-toggle,
  .of-frame[data-state="watching"]:hover .of-mute,
  .of-frame[data-state="watching"]:focus-within .of-toggle,
  .of-frame[data-state="watching"]:focus-within .of-mute {
    opacity: 1;
    transition-delay: 0ms;
  }
}

html[data-orvia-resolved-theme="dark"] .of-statement {
  color: rgba(245, 247, 250, 0.46);
}

html[data-orvia-resolved-theme="dark"] .of-statement span {
  color: rgba(245, 247, 250, 0.9);
}

@media (min-width: 1920px) {
  .of-statement {
    font-size: 42px;
  }
}

/* Phones: the film is too small to cover, so the controls sit under it */
@media (max-width: 809px) {
  .of-statement {
    font-size: 26px;
  }

  .of-frame {
    overflow: visible;
    margin-bottom: 52px;
  }

  .of-bar {
    left: 0;
    top: calc(100% + 12px);
    bottom: auto;
    gap: 8px;
  }

  .of-cta {
    height: 40px;
    gap: 7px;
    padding: 0 16px 0 12px;
    box-shadow: none;
    font-size: 15px;
  }

  .of-cta-icon {
    width: 18px;
    height: 18px;
  }

  .of-cta small {
    font-size: 13px;
  }

  .of-toggle,
  .of-mute {
    width: 40px;
    height: 40px;
    padding: 10px;
  }
}

@media (max-width: 809px) {
  html[data-orvia-resolved-theme="dark"] .of-frame .of-cta,
  html[data-orvia-resolved-theme="dark"] .of-frame .of-toggle,
  html[data-orvia-resolved-theme="dark"] .of-frame .of-mute {
    background: #f5f7fa;
    color: #111;
  }
}
