/**
 * Blog Post Image Carousel - front-end styles.
 *
 * All selectors are scoped under plugin-specific classes (.bpica-*) to
 * avoid clashing with theme CSS. The carousel fills whatever container
 * it is placed in (the theme's existing featured-image wrapper), so
 * blog card dimensions and aspect ratio are preserved.
 */

.bpica-carousel {
	--bpica-transition-speed: 400ms;
	position: relative !important;
	display: block !important;
	width: 100%;
	height: 100%;
	overflow: hidden !important;
	background-color: #f0f0f1;
	line-height: 0;
}

/* Single-image (no images added, or exactly one) rendering. */
.bpica-carousel.bpica-single {
	line-height: 0;
}

.bpica-single-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* Multi-image carousel. */
.bpica-carousel.bpica-multi {
	outline: none;
}

.bpica-track {
	display: flex;
	width: 100%;
	height: 100%;
	transition: transform var(--bpica-transition-speed) ease;
	will-change: transform;
}

.bpica-slide {
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	position: relative;
}

.bpica-slide-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	pointer-events: none;
	user-select: none;
}

/* ------------------------------------------------------------------ */
/* Hard reset for every button inside the carousel. Many themes apply
   global styling to bare <button> elements (padding, background,
   border-radius, full-width flex growth, etc.). This reset uses
   `all: unset` plus targeted !important overrides so our arrows/dots
   render correctly regardless of theme CSS specificity or load order. */
/* ------------------------------------------------------------------ */
.bpica-carousel button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
}

/* Navigation arrows. */
.bpica-prev,
.bpica-next {
	position: absolute !important;
	top: 50% !important;
	left: auto;
	right: auto;
	transform: translateY(-50%) !important;
	z-index: 3 !important;
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	max-width: 32px !important;
	flex: none !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: rgba(0, 0, 0, 0.45) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 50% !important;
	font-size: 14px !important;
	line-height: 1 !important;
	padding: 0 !important;
	margin: 0 !important;
	transition: background-color 0.2s ease, opacity 0.2s ease;
	opacity: 0;
}

.bpica-carousel.bpica-multi:hover .bpica-prev,
.bpica-carousel.bpica-multi:hover .bpica-next,
.bpica-carousel.bpica-multi:focus-within .bpica-prev,
.bpica-carousel.bpica-multi:focus-within .bpica-next {
	opacity: 1;
}

.bpica-prev:hover,
.bpica-next:hover {
	background: rgba(0, 0, 0, 0.7) !important;
}

.bpica-prev:focus-visible,
.bpica-next:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	opacity: 1;
}

.bpica-prev:disabled,
.bpica-next:disabled {
	opacity: 0.25;
	cursor: default;
}

.bpica-prev {
	left: 8px !important;
}

.bpica-next {
	right: 8px !important;
}

/* Dots / indicators. */
.bpica-dots {
	position: absolute !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 8px !important;
	z-index: 3 !important;
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	width: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.bpica-dot {
	width: 7px !important;
	height: 7px !important;
	min-width: 7px !important;
	max-width: 7px !important;
	flex: none !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 1px solid rgba(255, 255, 255, 0.9) !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.6) !important;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.bpica-dot.is-active {
	background: #fff !important;
	transform: scale(1.15);
}

.bpica-dot:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Responsive: keep arrows usable/tappable on small screens. */
@media (max-width: 480px) {
	.bpica-prev,
	.bpica-next {
		width: 28px !important;
		height: 28px !important;
		min-width: 28px !important;
		max-width: 28px !important;
		opacity: 1; /* Always visible on touch devices; no hover state exists. */
	}

	.bpica-dots {
		bottom: 6px !important;
	}
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.bpica-track {
		transition: none;
	}
}
