/* The campaign carousel (./campaignCarousel.js): one 16:9 slide per view, with
   a peek of the slides either side. */

.campaign-carousel {
  --slide-gap: 0.5rem;
  --slide-peek: 1rem;
  position: relative;
  padding: 0.75rem 0 0;
}

/* a phone-wide page: a narrower peek, so the slide gets the width */
@container app-page (width < 576px) {
  .campaign-carousel {
    --slide-gap: 0.375rem;
    --slide-peek: 0.5rem;
    padding-top: 0.5rem;
  }

  .campaign-carousel__counter {
    top: calc(0.5rem + 0.625rem);
  }
}

/* "2 / 7" over the slide's top-right corner while the member scrolls (the
   bar's segments say the same for screen readers) */
.campaign-carousel__counter {
  position: absolute;
  top: calc(0.75rem + 0.625rem);
  right: calc(var(--slide-peek) + var(--slide-gap) + 0.625rem);
  z-index: 2;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.campaign-carousel__counter.is-visible {
  opacity: 1;
}

/* the padding is the peek plus a gap; scroll-padding the same, so flux snaps
   each slide there (centred) rather than flush left */
.campaign-carousel__track {
  gap: var(--slide-gap);
  padding-inline: calc(var(--slide-peek) + var(--slide-gap));
  scroll-padding-inline: calc(var(--slide-peek) + var(--slide-gap));
}

/* undo flux-core's demo card look; one slide fills the view, less the peeks */
.campaign-slide.flux-card {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  display: block;
  background: none;
  color: inherit;
  font-weight: inherit;
  border-radius: var(--media-radius);
  overflow: hidden;
  --flux-skeleton-radius: var(--media-radius);
}

.campaign-slide__media {
  position: absolute;
  inset: 0;
  --flux-skeleton-radius: var(--media-radius);
}

.campaign-slide__media img,
.campaign-slide__media video,
.campaign-slide__media iframe {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.campaign-slide__play {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-slide__play:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* The owning app's picture over a featured campaign's poster, bottom right (the
   page app's own avatar is 59px: .app-info__photo). The brand ring sets it off
   from any poster. */
.campaign-slide__owner {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  display: block;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px var(--brand-primary), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.campaign-slide__owner img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* The scroller's arrows, over the slide's edges (flux places them at the
   wrapper's, over the peeks) */
.campaign-carousel .flux-arrow-left {
  left: calc(var(--slide-peek) + var(--slide-gap) + 0.375rem);
}

.campaign-carousel .flux-arrow-right {
  right: calc(var(--slide-peek) + var(--slide-gap) + 0.375rem);
}

.campaign-carousel .flux-arrow {
  width: 2.75rem;
  height: 2.75rem;
  background: var(--brand-primary);
  box-shadow: var(--bs-box-shadow-sm);
}

/* The scroller's dots as a segmented progress bar: one segment per campaign,
   the one on show filled, the ones seen tinted (campaignCarousel.js count) */
.campaign-carousel .flux-page-controls {
  margin-top: 0.75rem;
  padding-inline: calc(var(--slide-peek) + var(--slide-gap));
}

.campaign-carousel .flux-pagination {
  flex: 1;
  gap: 4px;
  min-height: 6px;
}

.campaign-carousel .flux-page-indicator {
  position: relative;
  flex: 1 1 0;
  width: auto;
  height: 6px;
  border-radius: 3px;
  background: var(--progress-track);
}

/* a taller tap target than the 6px it draws */
.campaign-carousel .flux-page-indicator::after {
  content: "";
  position: absolute;
  inset: -8px 0;
}

.campaign-carousel .flux-page-indicator.is-seen {
  background: rgba(var(--brand-primary-rgb), 0.35);
}

.campaign-carousel .flux-page-indicator.flux-active {
  background: var(--brand-primary);
  transform: none;
}
