/* Scroll row: a row of items that swipes sideways, with Previous and Next
   when it holds more than fits. */
scroll-row {
  display: block;

  > figure {
    display: grid;
    gap: var(--space-s);

    > ul {
      display: flex;
      gap: var(--space-s);
      overflow-x: auto;
      overscroll-behavior-x: contain;
      scroll-snap-type: x mandatory;
      scroll-padding-inline: var(--space-3xs);
      scrollbar-width: none;
      list-style: none;
      padding: var(--space-3xs);

      > li {
        flex: 0 0 auto;
        scroll-snap-align: start;

        &:last-child {
          scroll-snap-align: end;
        }
      }
    }

    > nav {
      display: flex;
      justify-content: flex-end;
      gap: var(--space-2xs);

      &[hidden] {
        display: none;
      }

      > button > svg {
        width: 1rem;
        height: 1rem;
      }
    }
  }

  /* the row reaches out to the edges of its container (a page sets
     container-type on the element that spans the page): at rest its first
     item lines up with the column's start, scrolled to the end its last
     item with the column's end */
  &.bleed > figure > ul {
    margin-inline: calc((100% - 100cqi) / 2);
    padding-inline: calc((100cqi - 100%) / 2);
    /* in scroll padding 100% is the row's own width, the container's, so the
       column is the grid's standard width taken from it */
    scroll-padding-inline: calc((100% - var(--standard)) / 2);
  }
}
