/*
 * Home banner slider frame (template-parts/home-banner.php, assets/js/home-banner-slider.js): the clipping
 * viewport, the flex row the script moves with transform, and the dots. The active dot fills like a
 * progress bar while auto-play counts down (.is-timing on the section). Slide layout and colours:
 * components-home-banner-slide.css. Without JS the first slide shows.
 */

.home-banner {
  padding-block: var(--space-4) 0;
}

.home-banner__viewport {
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* Horizontal drags belong to the slider; vertical swipes still scroll the page. A missed click, double
   click or drag never highlights the banner text, and taps show no grey flash on phones. */
.home-banner.is-ready .home-banner__viewport {
  cursor: grab;
  touch-action: pan-y;
}

.home-banner__viewport,
.home-banner__dots {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.home-banner__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.home-banner__track.is-dragging {
  cursor: grabbing;
  transition: none;
  user-select: none;
}

.home-banner__dots[hidden] {
  display: none;
}

/* Dots: a 24px tap area each, the visible dot drawn inside; the active one is a wider pill. */
.home-banner__dots {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.home-banner__dot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.home-banner__dot::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.home-banner__dot[aria-current='true']::before {
  width: 2rem;
  background: var(--color-sand);
}

/* Fill inside the active pill: full when still, a 5 s countdown while auto-play runs. */
.home-banner__dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  transform: translate(-50%, -50%) scaleX(1);
  transform-origin: left center;
  opacity: 0;
}

.home-banner__dot[aria-current='true']::after {
  opacity: 1;
}

.home-banner.is-timing .home-banner__dot[aria-current='true']::after {
  animation: home-banner-countdown 5s linear both;
}

@keyframes home-banner-countdown {
  from {
    transform: translate(-50%, -50%) scaleX(0);
  }

  to {
    transform: translate(-50%, -50%) scaleX(1);
  }
}

@media (max-width: 699px) {
  .home-banner__viewport {
    border-radius: var(--radius-lg);
  }
}

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