/*
 * Swivo Carousel – Frontend Styles
 * Item sizing is handled by JS reading the original block layout.
 * CSS only handles visual chrome: arrows, dots, marquee wrapper, hidden states.
 */

/* 1. Main wrapper */
.swv-carousel {
  position: relative;
}

/* 2. Marquee: clip the max-content track to the viewport width. */
.swv-carousel[data-swv-animation="marquee"] {
  overflow: clip;
}

/* 3. Track: hide scrollbar, override WP overflow (layout set by JS) */
.swv-track {
  scrollbar-width: none; /* Firefox */
}
.swv-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

/* Slide: ensure track has no extra spacing */
.swv-carousel[data-swv-animation="slide"] .swv-track {
  padding: 0 !important;
  margin: 0 !important;
}

/* Peek: clip the carousel wrapper so peeking cards don't bleed outside */
.swv-carousel[data-swv-animation="slide"][data-swv-peek="true"] {
  overflow: hidden !important;
}

/* Prevent alignwide/alignfull children from bleeding outside their card */
.swv-carousel[data-swv-animation="slide"] .swv-track li,
.swv-carousel[data-swv-animation="slide"] .swv-track .wp-block-post {
  overflow: hidden;
}

/* Prevent alignwide/alignfull margins from pushing outside the card boundary */
.swv-carousel[data-swv-animation="slide"] .swv-track li > *,
.swv-carousel[data-swv-animation="slide"] .swv-track .wp-block-post > *,
.swv-carousel[data-swv-animation="ticker"] .swv-marquee-track li > *,
.swv-carousel[data-swv-animation="ticker"] .swv-marquee-track .wp-block-post > * {
  margin-inline: 0 !important;
}

/* Override WP query/group block overflow that may clip the track */
.swv-carousel.wp-block-query,
.swv-carousel.wp-block-group {
  overflow: visible;
}

/* Reset list padding/margin on wp-block-post-template when used as track */
.swv-carousel .swv-track.wp-block-post-template {
  padding: 0;
  margin: 0;
  list-style: none;
}

/* 4. Navigation wrapper (arrows) */
.swv-nav {
  position: absolute;
  inset-block-start: 50%;
  inset-inline: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  padding-inline: 8px;
  z-index: 2;
}

/* 5. Arrow buttons */
.swv-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 36px;
  block-size: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  color: inherit;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.swv-arrow:hover {
  background: rgba(255, 255, 255, 1);
}

.swv-arrow svg {
  inline-size: 18px;
  block-size: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 6. Flip arrow icons in RTL */
[dir="rtl"] .swv-arrow svg {
  transform: scaleX(-1);
}

/* 8. Dots container */
.swv-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-block: 12px;
}

.swv-dots[data-swv-dots-position="top"] { order: -1; }

.swv-dots[data-swv-dots-position="inside"] {
  position: absolute;
  inset-block-end: 12px;
  inset-inline: 0;
  z-index: 2;
}

/* 9. Individual dot */
.swv-dot {
  inline-size: 8px;
  block-size: 8px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  padding: 0;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.swv-dot.swv-active {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.3);
}

/* 10. Hidden states */
.swv-carousel[data-swv-animation="marquee"] .swv-nav,
.swv-carousel[data-swv-animation="marquee"] .swv-dots,
.swv-carousel[data-swv-arrows="false"] .swv-nav,
.swv-carousel[data-swv-dots="false"] .swv-dots {
  display: none;
}

/* 11. Responsive arrows */
@media (min-width: 600px) {
  .swv-arrow {
    inline-size: 40px;
    block-size: 40px;
  }
  .swv-arrow svg {
    inline-size: 20px;
    block-size: 20px;
  }
}

/* Ticker fade edges — pseudo-elements overlay the scrolling track */
.swv-ticker--faded {
  position: relative;
}

.swv-ticker--faded::before,
.swv-ticker--faded::after {
  content: '';
  position: absolute;
  inset-block: 0;
  width: var(--swv-ticker-fade-width, 60px);
  z-index: 2;
  pointer-events: none;
}

.swv-ticker--faded::before {
  inset-inline-start: 0;
  background: linear-gradient(to right, var(--swv-ticker-fade-color, #ffffff), transparent);
}

.swv-ticker--faded::after {
  inset-inline-end: 0;
  background: linear-gradient(to left, var(--swv-ticker-fade-color, #ffffff), transparent);
}

/* RTL: flip gradient directions */
[dir="rtl"] .swv-ticker--faded::before {
  background: linear-gradient(to left, var(--swv-ticker-fade-color, #ffffff), transparent);
}

[dir="rtl"] .swv-ticker--faded::after {
  background: linear-gradient(to right, var(--swv-ticker-fade-color, #ffffff), transparent);
}
