/* ==========================================================================
   Francis Davis Millet Institute - Videos page
   Requires tokens.css, base.css and lists.css (the shared list rows,
   fdm-listing), in that order. Template: page-videos.php.
   Figma: file wo9RmPUccR2OeLvr749rXQ, frame 267:508.

   A video is a 16:9 poster that plays the video in place, with the tag,
   title, source and description. Parts 1 to 4 lay a video out as one row
   (poster left, text right), as in the Figma frame; part 6 turns the list
   into two videos side by side, poster on top (client feedback, 3 Nov 2026:
   "two up" like the old site, rather than one up).

   From build/videos/videos.css. What differs is marked "theme": the poster
   can also be a link (a video on another site), and a row can have no
   poster at all. Parts 5 and 6 are the theme's own: the page's two sections
   (client feedback, 22 Oct 2026) and the two-up grid (3 Nov 2026), which the
   static build does not have.

   Contents
    1. Page values     3. Poster and player     5. Sections (theme)
    2. Row             4. Tablet and phone      6. Two up (theme)
   ========================================================================== */

/* 1. Page values ----------------------------------------------------------- */

/* Drawn only on this page and missing from tokens.css; move them there if
   another page needs them. */
.fdm-videos {
  --fdm-videos-poster-width: calc(464 / 1216 * 100%);  /* 464 x 261 at 1440 */
  --fdm-videos-play-size: 72px;                        /* round play button */
  --fdm-videos-play-color: #fff5d8;                    /* its ring and triangle */
  --fdm-videos-tint: 0.62;                             /* green over the thumbnail */
  --fdm-videos-tint-hover: 0.45;
}

/* 2. Row ------------------------------------------------------------------- */

/* fdm-listing__item gives the rules above and below. Here: poster and text
   side by side, 40px apart, 40px above and below. */
.fdm-videos__item {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--fdm-space-40);
  padding-block: var(--fdm-space-40);
}

/* Tag, title, source, description: 10px apart. Theme: in a row without a
   poster this is the only column, so it takes the full width. */
.fdm-videos__text {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--fdm-space-10);
  min-width: 0;
}

/* 3. Poster and player ----------------------------------------------------- */

/* The 16:9 box. It holds the poster, then the player. It is a <form> for a
   video that plays here and (theme) a <div> around a link for one that
   plays on another site. */
.fdm-videos__player {
  flex: none;
  width: var(--fdm-videos-poster-width);
  aspect-ratio: 16 / 9;
  margin: 0;
  border-radius: var(--fdm-radius-4);
  background: var(--fdm-green-900);
}

/* Poster: thumbnail, green tint, play button in the middle. A <button>, or
   (theme) an <a>. */
.fdm-videos__poster {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: var(--fdm-green-900);
  color: var(--fdm-videos-play-color);
}

/* YouTube thumbnails are 4:3 with black bars; cover trims the bars. */
.fdm-videos__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fdm-videos__poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fdm-green-900);
  opacity: var(--fdm-videos-tint);
  transition: opacity var(--fdm-duration) var(--fdm-ease);
}

.fdm-videos__poster:hover::after {
  opacity: var(--fdm-videos-tint-hover);
}

.fdm-videos__play {
  position: relative;
  z-index: 1;
  flex: none;
  width: var(--fdm-videos-play-size);
  height: var(--fdm-videos-play-size);
}

/* The player that replaces the poster: a YouTube <iframe>, or a <video>
   element for a file from the media library. */
.fdm-videos__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  background: var(--fdm-green-900);
}

/* 4. Tablet and phone ------------------------------------------------------ */

@media (max-width: 1023.98px) {
  .fdm-videos {
    --fdm-videos-poster-width: 42%;
  }

  .fdm-videos__item {
    gap: var(--fdm-space-28);
    padding-block: var(--fdm-space-32);
  }
}

/* Phone: poster across the full width, text under it */
@media (max-width: 599.98px) {
  .fdm-videos {
    --fdm-videos-poster-width: 100%;
    --fdm-videos-play-size: 64px;
  }

  .fdm-videos__item {
    flex-direction: column;
    gap: var(--fdm-space-16);
    padding-block: var(--fdm-space-24);
  }

  .fdm-videos__text {
    flex: none;
    gap: var(--fdm-space-8);
    width: 100%;
  }
}

/* 5. Sections (theme) ------------------------------------------------------ */

/* "Videos Produced by the Francis Davis Millet Institute", then "External
   Videos - Not Produced by the Francis Davis Millet Institute*". Each is an
   h2 above its videos, which keep their rules (fdm-listing__item; the first
   row of a list has the rule above it). The heading is 32/115% (26 on
   phones): Michael asked on 3 Nov 2026 for smaller headers that don't
   dominate (it was 40), and it still reads above the 24px video titles of
   part 6; 20px between heading and the first rule, 56px between the two
   sections, as on the Affiliated Websites page. */
.fdm-videos__section + .fdm-videos__section {
  margin-top: var(--fdm-space-56);
}

.fdm-videos__heading {
  max-width: var(--fdm-listing-title-max);
  padding-bottom: var(--fdm-space-20);
  font-size: var(--fdm-fs-32);
  line-height: var(--fdm-lh-32);
}

/* The line under the external videos that explains the star: small, italic,
   muted, as wide as a row's text. */
.fdm-videos__disclaimer {
  max-width: var(--fdm-listing-text-max);
  padding-top: var(--fdm-space-24);
  font-size: var(--fdm-fs-15);
  line-height: var(--fdm-lh-15);
  font-style: italic;
  color: var(--fdm-color-text-muted);
}

@media (max-width: 599.98px) {
  .fdm-videos__section + .fdm-videos__section {
    margin-top: var(--fdm-space-40);
  }

  .fdm-videos__heading {
    padding-bottom: var(--fdm-space-14);
    font-size: var(--fdm-fs-26);
    line-height: var(--fdm-lh-26);
  }

  .fdm-videos__disclaimer {
    padding-top: var(--fdm-space-20);
  }
}

/* 6. Two up (theme) -------------------------------------------------------- */

/* Client feedback, 3 Nov 2026: two videos side by side, as on the old site.
   Each video becomes a card: the poster across the card's width, then the
   tag, title, source and description under it. Cards in one grid row stretch
   to the same height, so their bottom rules line up; the second card gets
   the top rule that lists.css gives the first. One video per row on phones. */
.fdm-videos__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--fdm-space-40);
}

.fdm-videos {
  --fdm-videos-poster-width: 100%;
}

.fdm-videos__item {
  flex-direction: column;
  align-items: stretch;
  gap: var(--fdm-space-16);
  padding-block: var(--fdm-space-32);
}

.fdm-videos__list > .fdm-videos__item:nth-child(2) {
  border-top: var(--fdm-border);
}

.fdm-videos__text {
  flex: none;
  width: 100%;
}

/* Video titles: 24/115% in a half-width card (they were 32 in a full row). */
.fdm-videos__item .fdm-listing__title {
  font-size: var(--fdm-fs-24);
  line-height: var(--fdm-lh-24-heading);
}

@media (max-width: 1023.98px) {
  .fdm-videos {
    --fdm-videos-poster-width: 100%;
  }

  .fdm-videos__list {
    column-gap: var(--fdm-space-28);
  }

  .fdm-videos__item {
    gap: var(--fdm-space-16);
    padding-block: var(--fdm-space-28);
  }
}

@media (max-width: 599.98px) {
  .fdm-videos__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .fdm-videos__list > .fdm-videos__item:nth-child(2) {
    border-top: 0;
  }

  .fdm-videos__item {
    padding-block: var(--fdm-space-24);
  }
}
