/* @label.en Photo strip
   @description.en Holds galleries that would stand too tall on a phone: there all their photos become one
   row to swipe through, the next one peeking in. Wider, they're the usual galleries.

   @label.he רצועת תמונות
   @description.he עוטף גלריות שבטלפון היו תופסות גובה רב: שם כל התמונות הופכות לשורה אחת שמחליקים בה,
   והתמונה הבאה מציצה בקצה. במסך רחב אלה גלריות רגילות.

   @example
   <div class="block-style-photo-strip"><div><action-text-attachment content-type="image/jpeg" url="/block-styles/zohar/course-card.jpg" width="408" height="600" presentation="gallery"></action-text-attachment><action-text-attachment content-type="image/jpeg" url="/block-styles/zohar/related-reading.jpg" width="480" height="240" presentation="gallery"></action-text-attachment><action-text-attachment content-type="image/jpeg" url="/block-styles/zohar/course-card.jpg" width="408" height="600" presentation="gallery"></action-text-attachment></div></div> */
@layer components {
  .lexxy-content div.block-style-photo-strip { margin-block: var(--block-space); }

  /* The gallery's own phone width (lexxy.css). Every gallery in the block flows into the one row, which
     runs the way the page reads, unlike a gallery's pinned left-to-right one. */
  @container prose (width < 560px) {
    .lexxy-content div.block-style-photo-strip {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: max-content;
      justify-content: start;
      gap: var(--inline-space);
      overflow-x: auto;
      overscroll-behavior-inline: contain;
      scroll-snap-type: inline mandatory;
      scrollbar-width: thin;
      > .attachment-gallery { display: contents; }
      > .attachment-gallery > * { scroll-snap-align: start; }
      figure { inline-size: auto; }
      figure > img {
        block-size: 16rem;
        inline-size: auto;
        /* Room left for the next photo to show. */
        max-inline-size: 85cqi;
        object-fit: cover;
      }
    }
  }

  /* Its arrows and dots (photo_strips_controller), there only while the row scrolls. A theme sets the
     --photo-strip-* look in its own blocks/photo-strip.css. */
  .photo-strip-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-block: calc(var(--block-space) * -0.5) var(--block-space);
    &[hidden] { display: none; }
  }
  .photo-strip-nav__arrow {
    display: grid;
    place-items: center;
    inline-size: 2.25rem;
    block-size: 2.25rem;
    padding: 0;
    border: 1px solid var(--photo-strip-arrow-border, var(--color-border));
    border-radius: 50%;
    background: var(--photo-strip-arrow-background, var(--color-surface));
    color: var(--photo-strip-arrow-color, var(--color-text));
    cursor: pointer;
    transition: opacity var(--transition);
    &:disabled { opacity: 0.35; cursor: default; }
    /* A chevron drawn, not a character: ‹ › are mirrored by the text direction on their own. */
    &::before {
      content: "";
      inline-size: 0.5rem;
      block-size: 0.5rem;
      border-top: 2px solid currentColor;
      border-right: 2px solid currentColor;
    }
    /* Points the way the row moves, so a right-to-left page turns it round. */
    &:dir(rtl) { scale: -1 1; }
  }
  .photo-strip-nav__arrow--next::before { rotate: 45deg; translate: -0.1rem 0; }
  .photo-strip-nav__arrow--previous::before { rotate: -135deg; translate: 0.1rem 0; }
  .photo-strip-nav__dots { display: flex; flex-wrap: wrap; justify-content: center; }
  /* A tap target larger than the dot it draws. */
  .photo-strip-nav__dot {
    padding: 0.3rem;
    border: 0;
    background: none;
    cursor: pointer;
    &::before {
      content: "";
      display: block;
      inline-size: 0.5rem;
      block-size: 0.5rem;
      border-radius: 999px;
      background: var(--photo-strip-dot, var(--color-border-strong));
      transition: inline-size var(--transition), background var(--transition);
    }
    &[aria-current]::before { inline-size: 1.25rem; background: var(--photo-strip-dot-current, var(--color-brand)); }
  }
}
