/**
 * Card carousel (gloorst_render_carousel(): gloorst-post-carousel widget).
 * Swiper base styles: library stylesheet "swiper" (dependency).
 *
 * Slides per view / gap come from the widget controls as CSS variables
 * (--swiper-slides-to-display, --swiper-slides-gap) on the widget wrapper.
 * Arrows: Elementor icon font (eicons, dependency "elementor-icons").
 */

.gloorst-carousel {
	--swiper-theme-color: #000;
	--swiper-pagination-bullet-size: 6px;
	--swiper-pagination-bullet-horizontal-gap: 6px;
	--gloorst-carousel-dots-size: 0px;
	--gloorst-carousel-dots-spacing: 10px;
	--gloorst-carousel-arrow-size: 25px;
	--gloorst-carousel-arrow-color: rgba(238, 238, 238, 0.9);
	--gloorst-carousel-dir: 1;
	position: relative;
	height: fit-content;
}

.rtl .gloorst-carousel {
	--gloorst-carousel-dir: -1;
}

.gloorst-carousel--dots {
	--gloorst-carousel-dots-size: 6px;
}

.gloorst-carousel .gloorst-carousel__swiper {
	display: grid;
}

.gloorst-carousel--dots-outside .gloorst-carousel__swiper {
	padding-bottom: calc(var(--gloorst-carousel-dots-size) + var(--gloorst-carousel-dots-spacing));
}

/* Before Swiper initialises: show the first slides side by side. */
.gloorst-carousel .gloorst-carousel__swiper:not(.swiper-initialized) > .swiper-wrapper {
	gap: var(--swiper-slides-gap, 10px);
	overflow: hidden;
}

.gloorst-carousel .gloorst-carousel__swiper:not(.swiper-initialized) > .swiper-wrapper > .swiper-slide {
	--gloorst-gaps: calc(max(calc(var(--swiper-slides-to-display, 1) - 1), 0) * var(--swiper-slides-gap, 10px));
	max-width: calc((100% - var(--gloorst-gaps)) / var(--swiper-slides-to-display, 1));
}

/* Arrows: vertically centred on the slides (15px above the middle), inside. */
.gloorst-carousel .gloorst-carousel__arrow {
	position: absolute;
	top: calc(50% - 15px);
	z-index: 2;
	display: inline-flex;
	font-size: var(--gloorst-carousel-arrow-size);
	color: var(--gloorst-carousel-arrow-color);
	cursor: pointer;
	transform: translateY(-50%);
	transition-duration: 0.25s;
}

.gloorst-carousel .gloorst-carousel__arrow--prev {
	left: 0;
}

.gloorst-carousel .gloorst-carousel__arrow--next {
	right: 0;
}

.gloorst-carousel .gloorst-carousel__arrow.swiper-button-disabled {
	opacity: 0.3;
}

/* Pagination bullets: centred under the slides. */
.gloorst-carousel .gloorst-carousel__dots {
	top: 100%;
	bottom: 5px;
	inset-inline-start: 50%;
	z-index: 3;
	width: max-content;
	height: max-content;
	font-size: var(--gloorst-carousel-dots-size);
	line-height: var(--gloorst-carousel-dots-size);
	transform: translate(calc(-50% * var(--gloorst-carousel-dir)), -100%);
}

.gloorst-carousel .gloorst-carousel__dots .swiper-pagination-bullet {
	width: var(--gloorst-carousel-dots-size);
	height: var(--gloorst-carousel-dots-size);
	margin: 0 var(--swiper-pagination-bullet-horizontal-gap);
	background: #000;
	vertical-align: top;
}

.gloorst-carousel .gloorst-carousel__dots .swiper-pagination-bullet:hover {
	background: #000;
	opacity: 1;
}
