/* Reels. Mobile-first: a horizontal scroll-snap row by default, a 4-column grid once the module itself is wide
   enough. It queries the module's own width (container query), not the viewport, so a blog post's narrow
   content column scrolls even on a desktop screen. */
.section__reels { --reels-bleed: 40px; --reels-gap: var(--space-3); position: relative; container-name: reels; container-type: inline-size; color: var(--color-black); }
/* Same horizontal padding as .container, so the scroll row can bleed to the edge of whatever it sits in */
@media screen and (max-width: 768px) { .section__reels { --reels-bleed: 20px; } }

/* bg-color-beige / bg-color-yellow aren't global utility classes: same hex values as image-copy, media-gallery, home-plan */
.section__reels.bg-color-beige { background: #b5ac9c; }
.section__reels.bg-color-yellow { background: #ffd400; }
/* Text contrast: white on the dark backgrounds, black on everything else (incl. grey and the yellows) */
.section__reels.bg-color-s,
.section__reels.bg-color-black { color: var(--color-white); }

.section__reels__header { margin-bottom: var(--space-4); }
/* Selectors are doubled up (.section__reels .x) so they beat the blog post body's own h2/p/ul rules */
.section__reels .section__reels__tagline { display: block; margin-bottom: var(--space-2); color: inherit; }
.section__reels .section__reels__title { margin: 0; color: inherit; }

.section__reels .section__reels__scroller { margin: 0 calc(var(--reels-bleed) * -1); }
.section__reels .section__reels__track { display: flex; gap: var(--reels-gap); margin: 0; padding: 0 var(--reels-bleed) var(--space-2); list-style: none; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--reels-bleed); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
/* Touch devices swipe, so hide the bar there; with a mouse it stays (thin) or the row couldn't be scrolled */
@media (hover: none), (pointer: coarse) {
  .section__reels .section__reels__track { padding-bottom: 0; scrollbar-width: none; }
  .section__reels .section__reels__track::-webkit-scrollbar { display: none; }
}
.section__reels .section__reels__item { flex: 0 0 clamp(210px, 62%, 300px); min-width: 0; margin: 0; padding: 0; list-style: none; scroll-snap-align: start; }

.section__reels__card { display: block; }
.section__reels__media { position: relative; aspect-ratio: 9 / 16; overflow: hidden; background: var(--color-black); }
.section__reels .section__reels__poster,
.section__reels .section__reels__video,
.section__reels .section__reels__frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; margin: 0; border: 0; }
.section__reels .section__reels__poster,
.section__reels .section__reels__video { object-fit: cover; }
.section__reels .section__reels__video { background: var(--color-black); }
.section__reels .section__reels__frame { background: var(--color-black); }
/* Playing: the real player replaces the poster and play button, and the whole video is shown uncropped */
.section__reels__card.is-playing .section__reels__poster,
.section__reels__card.is-playing .section__reels__play { display: none; }
.section__reels__card.is-playing .section__reels__video { object-fit: contain; }

/* The whole poster is the button. Overrides the site's global button styles (flex, max-width, padding, caps). */
.section__reels .section__reels__play { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; width: 100%; max-width: none; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--color-white); cursor: pointer; line-height: 1; }
.section__reels__playIcon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: rgba(0, 0, 0, .55); transition: transform .2s ease, background-color .2s ease; }
.section__reels__playIcon svg { display: block; margin-left: 3px; }
@media (hover: hover) {
  .section__reels__play:hover .section__reels__playIcon { transform: scale(1.1); background: rgba(0, 0, 0, .75); }
}
/* White ring over a black ring: visible on any poster, whatever the section background */
.section__reels .section__reels__play:focus { outline: none; }
.section__reels .section__reels__play:focus-visible { outline: 3px solid var(--color-white); outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--color-black); }

.section__reels__caption { margin-top: var(--space-3); overflow-wrap: anywhere; } /* a long unbroken title (e.g. a pasted URL) wraps instead of stretching the row */
.section__reels .section__reels__itemTitle { margin: 0 0 var(--space-1); color: inherit; }
.section__reels .section__reels__itemCopy { margin: 0; color: inherit; white-space: pre-line; }

/* Tablet-width row: wider cards so about 2.5 show */
@container reels (min-width: 576px) {
  .section__reels .section__reels__item { flex-basis: clamp(220px, 34%, 300px); }
}

/* Wide enough for all 4 side by side */
@container reels (min-width: 992px) {
  .section__reels__header { margin-bottom: var(--space-5); }
  .section__reels .section__reels__scroller { margin: 0; }
  .section__reels .section__reels__track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(var(--space-3), 2.5cqw, var(--space-5)); padding: 0; overflow: visible; scroll-snap-type: none; }
}
/* Browsers without container queries: size by viewport instead */
@supports not (container-type: inline-size) {
  @media screen and (min-width: 992px) {
    .section__reels__header { margin-bottom: var(--space-5); }
    .section__reels .section__reels__scroller { margin: 0; }
    .section__reels .section__reels__track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); padding: 0; overflow: visible; scroll-snap-type: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .section__reels__playIcon { transition: none; }
}
