/* The video homepage (layouts/homevideo.njk). The video box fills the window
   with the same side margin as the galleries, and the same rounded corners.
   The header stays free above it, and the project gallery follows below. */

.page-homevideo {
  /* Height of the header (its padding plus the logo height), so the video
     can fill exactly the rest of the screen. Keep in step with style.css. */
  --hv-header: 3.5rem;
  /* Space between the video and the gallery under it. */
  --hv-gap: 0.5rem;
}

@media (max-width: 640px) {
  .page-homevideo {
    --hv-header: 3rem;
  }
}

.hv {
  position: relative;
  height: calc(100vh - var(--hv-header) - var(--page-inset));
  height: calc(100svh - var(--hv-header) - var(--page-inset));
  min-height: 16rem;
  margin: 0 var(--page-inset) var(--hv-gap);
  overflow: hidden;
  border-radius: var(--radius-image);
  background: #000;
  /* Lets the picture be sized from the box, whatever shape the window is. */
  container-type: size;
}

/* The video is 16:9. "cover" scales it up until it fills the box, cropping
   whatever sticks out, exactly like a background photo. */
.hv__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 100cqh * 16 / 9);
  height: max(100cqh, 100cqw * 9 / 16);
  transform: translate(-50%, -50%);
  border: 0;
}

.hv[data-fit="contain"] .hv__frame {
  width: min(100cqw, 100cqh * 16 / 9);
  height: min(100cqh, 100cqw * 9 / 16);
}

.hv__shield {
  position: absolute;
  inset: 0;
}

/* The sound button reuses the gallery video button, just a little larger. */
.hv__sound {
  right: 1rem;
  bottom: 1rem;
  width: 2.75rem;
  height: 2.75rem;
}

.hv__sound[hidden] {
  display: none;
}

.hv--empty {
  display: grid;
  place-items: center;
  background: #f2f2f2;
  color: var(--color-ink-soft);
  text-align: center;
  padding: var(--space-3);
}

@media (max-width: 640px) {
  .hv__sound {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}

/* About page: the video leaves a strip of this height at the bottom of the
   window, so the start of the information peeks out underneath it. */
.page-about {
  --about-peek: 6rem;
}

.page-about .hv {
  height: calc(100vh - var(--hv-header) - var(--about-peek));
  height: calc(100svh - var(--hv-header) - var(--about-peek));
}

.page-about .about {
  padding-top: var(--space-4);
}

/* About page video: the full width of the window, square corners, and zoomed
   in a little so YouTube's title and channel name sit outside the picture.
   Raise the 1.3 to crop in more. */
.page-about .hv {
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
}

.page-about .hv__frame {
  transform: translate(-50%, -50%) scale(1.3);
}
