/*
 * Butte Arts Logo Carousel — front-end styles (v1.2+)
 *
 * Layout:
 *   .balc-carousel
 *     .balc-row              — flex row: [prev arrow] [swiper viewport] [next arrow]
 *       .balc-nav.balc-nav-prev
 *       .swiper
 *         .swiper-wrapper
 *           .swiper-slide.balc-slide
 *       .balc-nav.balc-nav-next
 *     .swiper-pagination.balc-pagination  (below the row)
 *
 * Arrows sit OUTSIDE the slide viewport and are vertically centered on the
 * logo row via flex `align-items: center`. Slide widths are controlled by
 * Swiper (fixed slidesPerView), while each logo image keeps locked height
 * and its natural width via object-fit: contain.
 */

.balc-carousel {
	position: relative;
	width: 100%;
	margin: 1.25rem 0;
	/* Theme-overridable variables. */
	--balc-height: 80px;
	--balc-gap: 40px;
	--balc-arrow-size: 44px;
	--balc-arrow-color: #222;
	--balc-arrow-bg: #ffffff;
	--balc-arrow-border: #e2e2e2;
	--balc-arrow-hover-bg: #f4f4f4;
	--balc-dot-color: #222;
	box-sizing: border-box;
}

.balc-carousel *,
.balc-carousel *::before,
.balc-carousel *::after {
	box-sizing: border-box;
}

/* --- Row that holds [prev] [viewport] [next] --- */
.balc-carousel .balc-row {
	display: flex;
	align-items: center;          /* vertically centers arrows on the slide row */
	justify-content: center;      /* horizontally centers the viewport block */
	gap: 8px;
	width: 100%;
}

/* --- The Swiper viewport --- */
.balc-carousel .swiper {
	flex: 1 1 auto;
	min-width: 0;                 /* required for flex item to shrink correctly */
	padding: 0;                   /* no reserved space for arrows — they're outside */
	overflow: hidden;
}

/* Center the slide track when there aren't enough slides to fill the viewport.
 * Swiper's centerInsufficientSlides handles the transform; these rules just
 * make sure the wrapper plays nice when that option kicks in. */
.balc-carousel .swiper-wrapper {
	align-items: center;
}

/* --- Slides ---
 * Do NOT override slide width here — Swiper owns it so that slidesPerView
 * (desktop/tablet/mobile) is honored. */
.balc-carousel .balc-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: var(--balc-height);
	padding: 0 calc(var(--balc-gap) / 2);
}

.balc-carousel .balc-logo-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	height: 100%;
	text-decoration: none;
	outline: none;
}

.balc-carousel .balc-logo-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

/* The image itself: locked height, natural width, capped to cell width. */
.balc-carousel .balc-logo-img {
	display: block;
	height: var(--balc-height);
	width: auto;
	max-width: 100%;
	object-fit: contain;
	transition: transform 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.balc-carousel .balc-logo-link:hover .balc-logo-img {
	transform: scale(1.04);
}

/* Grayscale mode. */
.balc-carousel.balc-grayscale .balc-logo-img {
	filter: grayscale(100%);
	opacity: 0.85;
}
.balc-carousel.balc-grayscale .balc-logo-link:hover .balc-logo-img {
	filter: grayscale(0%);
	opacity: 1;
}

/* --- Navigation arrows (custom, OUTSIDE the swiper container) --- */
.balc-carousel .balc-nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--balc-arrow-size);
	height: var(--balc-arrow-size);
	padding: 0;
	margin: 0;
	border: 1px solid var(--balc-arrow-border);
	border-radius: 50%;
	background: var(--balc-arrow-bg);
	color: var(--balc-arrow-color);
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
	/* Sit on top of any theme layer that might intercept clicks. */
	position: relative;
	z-index: 2;
}

.balc-carousel .balc-nav:hover {
	background: var(--balc-arrow-hover-bg);
}

.balc-carousel .balc-nav:active {
	transform: scale(0.96);
}

.balc-carousel .balc-nav:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.balc-carousel .balc-nav[disabled],
.balc-carousel .balc-nav.balc-nav-disabled,
.balc-carousel .balc-nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

.balc-carousel .balc-nav-icon {
	width: 50%;
	height: 50%;
	display: block;
}

/* --- Pagination dots --- */
.balc-carousel .balc-pagination {
	position: static;
	margin-top: 14px;
	text-align: center;
}
.balc-carousel .balc-pagination .swiper-pagination-bullet {
	background: var(--balc-dot-color);
	opacity: 0.35;
	margin: 0 4px;
}
.balc-carousel .balc-pagination .swiper-pagination-bullet-active {
	opacity: 1;
}

/* --- Empty state --- */
.balc-empty {
	padding: 1rem;
	border: 1px dashed #bbb;
	color: #666;
	text-align: center;
	font-style: italic;
}

/* --- Mobile tweaks: smaller arrows to save horizontal space --- */
@media (max-width: 480px) {
	.balc-carousel {
		--balc-arrow-size: 36px;
	}
	.balc-carousel .balc-row {
		gap: 4px;
	}
}
