/* FMC section-separator primitives: opt-in only; no global element reset. */
@layer fmcSeparators {
  :root {
    --fmc-separator-line: var(--line, #d2d2d7);
    --fmc-separator-surface: var(--card, #f5f5f7);
    --fmc-section-gap: clamp(2rem, 5vw, 4rem);
    --fmc-list-gap: clamp(.9rem, 2vw, 1.35rem);
    --fmc-control-focus: var(--berry, #0071e3);
  }

  /* A chapter changes by space, not by a decorative rule. */
  .fmc-section-stack > .fmc-section + .fmc-section {
    margin-block-start: var(--fmc-section-gap);
  }

  /* Dense, same-level records may opt into one quiet separator. */
  .fmc-dense-list > .fmc-list-item + .fmc-list-item {
    border-block-start: 1px solid var(--fmc-separator-line);
  }

  /* Real templates: deliberately scoped, and loaded after editorial-spacing. */
  .fmc-separators-home .hero {
    border-block-end: 0;
  }
  .fmc-separators-home .home-links {
    padding-block-start: clamp(1.75rem, 4vw, 3rem);
  }


  /* TV days remain chapters by spacing; episode rows intentionally have no rule. */
  .fmc-separators-tv .agenda > .day + .day {
    margin-block-start: var(--fmc-list-gap);
  }
  .fmc-separators-tv .shows > .row,
  .fmc-separators-tv .shows > .row + .row {
    border-block: 0 !important;
  }

  /* Archive index and FAQ are established rule-free reading lists. */
  .fmc-separators-archive .archive-directory > li,
  .fmc-separators-faq main.reader > section[id^="q"] {
    border-block: 0 !important;
  }
  .fmc-separators-archive .archive-directory > li + li {
    margin-block-start: var(--fmc-list-gap);
  }

  /* Neutral podcast cards separate only by surface colour. */
  .fmc-separators-podcast section#podcasts > article.fmc-podcast-card,
  .fmc-neutral-card {
    background: var(--fmc-separator-surface) !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  /* Optional controls; not coupled to chapter/list separators. */
  .fmc-control-return,
  .fmc-control-play {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    color: inherit;
    text-decoration: none;
  }
  .fmc-control-return:focus-visible,
  .fmc-control-play:focus-visible {
    outline: 2px solid var(--fmc-control-focus);
    outline-offset: 3px;
  }
}

/* editorial-spacing uses !important in this established layer. Re-entering the
   same layer keeps the exception local instead of creating a global reset. */
@layer systemReading {
  .fmc-separators-directory .film-index > article.event-card + article.event-card {
    border-block-start: 1px solid var(--fmc-separator-line) !important;
  }
  .fmc-separators-directory .film-index > article.event-card {
    border-block-end: 0 !important;
  }
  /* discovery-edition switches the all-films catalogue to two columns above
     700px. Its second article is still in the first visual row. */
  @media (min-width: 701px) {
    .fmc-separators-directory .film-index:has(> article.event-card .current-label) > article.event-card:first-of-type + article.event-card {
      border-block-start: 0 !important;
    }
  }
}
