/* Executive Puzzles — walkthrough reels
   The watch page grid and the lightbox opened from the home page cards.
   Built from the site's own tokens (navy, copper, cream) in style.css. */

/* ---------- Masthead ---------- */

/* The menu gained Watch (and the home page also carries the Void Defenders link),
   which no longer fits one line on a phone. Without wrapping, the page grew wider
   than the screen and mobile Safari shrank everything to fit, so the layout looked
   off-centre. Wrap onto a second line instead. */
.masthead nav { flex-wrap: wrap; row-gap: 8px; }

/* ---------- Lightbox ---------- */

.ep-lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  overflow: visible;
}

.ep-lightbox::backdrop { background: rgba(10, 47, 82, 0.9); }

.ep-lightbox__inner {
  position: relative;
  display: flex;
}

.ep-lightbox video {
  /* A fixed portrait box, so the "coming soon" state has something to fill
     before any file has loaded, and the lightbox never resizes under you. */
  width: min(88vw, calc(82dvh * 480 / 973));
  aspect-ratio: 480 / 973;
  object-fit: contain;
  display: block;
  border-radius: 18px;
  background: var(--navy);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.ep-lightbox__close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(241, 239, 232, 0.5);
  background: rgba(10, 47, 82, 0.7);
  color: var(--cream);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.ep-lightbox__close:hover,
.ep-lightbox__close:focus-visible { background: var(--copper); }

.ep-lightbox__caption {
  margin: 14px 0 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--cream);
}

/* ---------- Shared: replay, and the "not uploaded yet" state ---------- */

.ep-reel__replay {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 9px 22px;
  border-radius: 999px;
  border: 0;
  background: var(--copper);
  color: var(--cream);
  font-family: var(--rounded);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.is-finished .ep-reel__replay { display: block; }

.ep-reel__soon {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(10, 47, 82, 0.9);
  border-radius: 18px;
  color: var(--cream);
  font-family: var(--rounded);
}

.ep-reel__soon p { margin: 0; font-size: 16px; }

.ep-reel__yt {
  color: var(--cream);
  font-size: 14px;
  border-bottom: 1px solid var(--copper);
  cursor: pointer;
}

.ep-reel__yt[hidden] { display: none; }

.is-soon .ep-reel__soon { display: flex; }

/* ---------- Watch page ---------- */

.wrap-reels { max-width: 1040px; }

.ep-reels {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 30px 0 40px;
}

@media (max-width: 560px) {
  .ep-reels { grid-template-columns: minmax(0, 300px); justify-content: center; }
}

.ep-reel {
  margin: 0;
  scroll-margin-top: 24px;
  position: relative;
}

.ep-reel__stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 1px 3px rgba(10, 47, 82, 0.07), 0 8px 24px rgba(10, 47, 82, 0.10);
}

.ep-reel video {
  display: block;
  width: 100%;
  height: auto;
  /* Declared on the element too (width/height attributes), so the box is
     portrait from first paint and nothing jumps when the file arrives. */
  aspect-ratio: 480 / 973;
  object-fit: contain;
  background: var(--navy);
}

.ep-reel figcaption { margin-top: 14px; text-align: center; }

.ep-reel figcaption strong {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  color: var(--navy);
  line-height: 1.2;
}

.ep-reel figcaption span {
  display: block;
  margin-top: 2px;
  font-family: var(--rounded);
  font-size: 14px;
  color: var(--ink-soft);
}

.ep-reel figcaption p {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.ep-back { text-align: center; margin: 0 0 40px; }

@media (prefers-reduced-motion: reduce) {
  .ep-lightbox video { box-shadow: none; }
}
