/* Video gallery above "Small on purpose", after Apple's product galleries:
   16:9 cards in a row that scrolls sideways across the whole window. A card
   snaps to the centre with its neighbours peeking in either side; the page
   opens on the middle one (the laptop). Round previous/next buttons sit
   centred below. */

.civic-gallery {
  --gallery-card: min(900px, 64vw);
  --gallery-gap: 24px;
}

.civic-gallery-track {
  display: flex;
  gap: var(--gallery-gap);
  margin: 0;
  padding: 0 calc((100% - var(--gallery-card)) / 2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
}

.civic-gallery-track::-webkit-scrollbar { display: none; }

.civic-gallery-item {
  flex: 0 0 var(--gallery-card);
  min-width: 0;
  scroll-snap-align: center;
}

.civic-gallery-item > figure {
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 28px;
}

/* A hairline edge, as on the reference's cards, so light pictures (the tour's
   poster) still read as a card on the light page. */
.civic-gallery-item > figure::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(23, 23, 25, 0.07);
  pointer-events: none;
  content: "";
}

.civic-page.site-dark .civic-gallery-item > figure::after {
  box-shadow: inset 0 0 0 1px rgba(231, 228, 222, 0.1);
}

/* The buttons appear only when the script is running and the row is wider
   than the window. */
.civic-gallery-nav {
  display: none;
  justify-content: center;
  gap: 14px;
  margin: 28px 0 0;
}

.civic-gallery[data-scrollable] .civic-gallery-nav { display: flex; }

.civic-gallery-paddle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 23, 25, 0.08);
  color: var(--civic-ink);
  cursor: pointer;
  transition: background 200ms ease, opacity 200ms ease;
}

.civic-gallery-paddle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .civic-gallery-paddle:not(:disabled):hover { background: rgba(23, 23, 25, 0.14); }
}

.civic-gallery-paddle:disabled {
  opacity: 0.36;
  cursor: default;
}

.civic-gallery-paddle:focus-visible {
  outline: 2px solid var(--civic-ink);
  outline-offset: 3px;
}

.civic-page.site-dark .civic-gallery-paddle { background: rgba(231, 228, 222, 0.12); }

@media (hover: hover) {
  .civic-page.site-dark .civic-gallery-paddle:not(:disabled):hover { background: rgba(231, 228, 222, 0.2); }
}

@media (max-width: 940px) {
  .civic-gallery {
    --gallery-card: 78vw;
    --gallery-gap: 16px;
  }
}

@media (max-width: 620px) {
  .civic-gallery {
    --gallery-card: calc(100vw - 56px);
    --gallery-gap: 12px;
  }

  .civic-gallery-item > figure { border-radius: 22px; }

  .civic-gallery-nav { margin-top: 22px; }
}
