/* ============================================================
   Shared horizontal carousel (public/js/ftm-carousel.js)
   Pages set --carousel-gap and their item width.
   ============================================================ */
.ftm-carousel { position: relative; --carousel-gap: 20px; }

.ftm-carousel__track {
  display: flex;
  gap: var(--carousel-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* room for card shadows, hover lift and ribbons above the cards */
  padding: 16px 4px 26px;
  margin: -16px -4px -26px;
  scroll-padding-inline: 4px;   /* snap to the padding edge, so the first card sits at scrollLeft 0 */
}
.ftm-carousel__track::-webkit-scrollbar { display: none; }
.ftm-carousel__track > * { scroll-snap-align: start; flex-shrink: 0; }

/* Centre the cards when they all fit. Auto margins (unlike justify-content:center)
   collapse to 0 when the track overflows, so the first card is never cut off. */
.ftm-carousel__track > :first-child { margin-left: auto; }
.ftm-carousel__track > :last-child  { margin-right: auto; }

.ftm-carousel__nav {
  position: absolute; top: 50%; z-index: 3;
  width: 44px; height: 44px; margin-top: -22px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #E1E6F0; border-radius: 50%;
  background: #fff; color: #1B2A4A; font-size: 18px; line-height: 1;
  box-shadow: 0 6px 18px rgba(27, 42, 74, .14);
  cursor: pointer;
  transition: opacity .2s, transform .15s, color .15s, border-color .15s;
}
.ftm-carousel__nav[hidden] { display: none; }
.ftm-carousel__nav:hover:not(:disabled) { color: #D62828; border-color: #F3B4B4; transform: scale(1.05); }
.ftm-carousel__nav:focus-visible { outline: 3px solid rgba(31, 58, 125, .35); outline-offset: 2px; }
.ftm-carousel__nav:disabled { opacity: 0; pointer-events: none; }
.ftm-carousel__nav--prev { left: -22px; }
.ftm-carousel__nav--next { right: -22px; }

/* fading edge hints there is more to scroll */
.ftm-carousel::before, .ftm-carousel::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 28px; z-index: 2;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.ftm-carousel::before { left: 0;  background: linear-gradient(90deg, var(--carousel-fade, #fff), transparent); }
.ftm-carousel::after  { right: 0; background: linear-gradient(-90deg, var(--carousel-fade, #fff), transparent); }
.ftm-carousel.is-overflowing:not(.at-start)::before,
.ftm-carousel.is-overflowing:not(.at-end)::after { opacity: 1; }

@media (max-width: 767.98px) {
  .ftm-carousel__nav { width: 38px; height: 38px; margin-top: -19px; font-size: 16px; }
  .ftm-carousel__nav--prev { left: -6px; }
  .ftm-carousel__nav--next { right: -6px; }
}
