/* Films and Shorts: the click-to-load player, the Videos page and the Shorts a
   story or Data Byte shows. Every page that shows a video loads this file and
   video-player.js; the build stops a page that forgets either. */

/* The player keeps its frame while the poster is swapped for YouTube's. */
.video-player {
  position: relative;
  overflow: hidden;
  background: var(--ink);
}
.video-player--wide {
  aspect-ratio: 16 / 9;
}
.video-player--tall {
  aspect-ratio: 9 / 16;
}
.video-player__start,
.video-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.video-player__start {
  display: block;
  color: var(--ink);
}
.video-player__start img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-player iframe {
  border: 0;
}
/* The frame clips anything outside it, so the focus ring sits inside. */
.video-player__start:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: -3px;
}

/* A centred play mark and the running time. */
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: rgb(247 246 242 / 92%);
  color: var(--ink);
  box-shadow: 0 8px 24px rgb(0 0 0 / 28%);
  transform: translate(-50%, -50%);
  transition: background-color var(--motion-medium) ease, transform var(--motion-medium) var(--ease-emphasized);
}
/* A triangle's visual centre sits right of its box. */
.video-play svg {
  width: 26px;
  height: 26px;
  margin-left: 3px;
}
.video-player--tall .video-play {
  width: 52px;
  height: 52px;
}
.video-player--tall .video-play svg {
  width: 21px;
  height: 21px;
}
.video-player__start:is(:hover, :focus-visible) .video-play {
  background: var(--brass);
  transform: translate(-50%, -50%) scale(1.06);
}
.video-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgb(23 26 28 / 84%);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.video-note {
  margin-top: 10px;
  color: var(--graphite);
  font-size: 12px;
  line-height: 1.5;
}

/* Videos page: two films side by side, each playing in its card. The copy
   takes the story cards' type from scene.css; the frame matches the archive's. */
.video-index {
  padding-block: 40px 72px;
}
.video-index__films {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: #fff8;
}
.video-card .scene-card__copy {
  padding: 24px;
}
.video-card .scene-card__deck {
  margin-bottom: 0;
}
.video-index__note {
  margin-top: 24px;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.6;
}
.video-index__note a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* The Shorts on a story or Data Byte page, on its reading measure. */
.video-shorts {
  max-width: 740px;
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
  container-type: inline-size;
}
.video-shorts h2 {
  font-family: var(--font-headline);
  font-size: clamp(24px, 2.2vw, 28px);
  line-height: 1.2;
}
.video-shorts__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px 16px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
/* A Short: its vertical player, then its title and date. */
.video-short {
  display: flex;
  min-width: 0;
  max-width: 220px;
  flex-direction: column;
  gap: 12px;
}
.video-short__title {
  font-family: var(--font-headline);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.video-short__date {
  margin-top: 6px;
  color: var(--graphite);
  font-size: 12px;
}
/* One Short sits beside its title where there is room (the block measures its
   own width, so the page's layout decides). */
.video-shorts--single .video-shorts__list {
  grid-template-columns: minmax(0, 1fr);
}
@container (min-width: 400px) {
  .video-shorts--single .video-short {
    display: grid;
    max-width: none;
    grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
  }
  .video-shorts--single .video-short__title {
    font-size: 22px;
  }
}

/* A jump from a page's header to its Shorts. */
.video-jump {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 15px 0 11px;
  border: 1px solid rgb(177 154 124 / 70%);
  border-radius: 999px;
  color: var(--brass);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}
.video-jump svg {
  width: 14px;
  height: 14px;
}
.video-jump:hover {
  background: var(--brass);
  color: var(--ink);
}

@media (max-width: 1024px) {
  .video-index__films {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .video-play {
    width: 56px;
    height: 56px;
  }
  .video-shorts {
    margin-top: 40px;
  }
}

/* Phone sizes follow the archive's cards. */
@media (max-width: 700px) {
  .video-index {
    padding-block: 28px 42px;
  }
  .video-index__films {
    gap: 26px;
  }
  .video-card h3 {
    font-size: 28px;
  }
}

@media (max-width: 420px) {
  .video-player--tall .video-play {
    width: 44px;
    height: 44px;
  }
  .video-player--tall .video-play svg {
    width: 18px;
    height: 18px;
  }
}
