/**
 * WT Carousel — front-end + shared styles.
 * Colors default to brand tokens (with safe fallbacks) so each site's Global
 * Styles palette themes the controls without touching this file.
 */

.wt-carousel {
	position: relative;
}

/* Content-first fallback: before JS (no .is-enhanced), slides simply stack. */
.wt-carousel:not( .is-enhanced ) .wt-carousel__slide + .wt-carousel__slide {
	margin-top: var( --wp--style--block-gap, 1.5rem );
}

/* Enhanced: only the active slide is shown; the rest carry [hidden]. */
.wt-carousel.is-enhanced .wt-carousel__track {
	position: relative;
}

.wt-carousel__slide {
	display: block;
}

/* Enhanced: only the active slide shows. This selector deliberately outranks the
   rule above so the [hidden] attribute view.js sets actually hides slides —
   without it the slides stack instead of behaving as a carousel. */
.wt-carousel.is-enhanced .wt-carousel__slide[hidden] {
	display: none;
}

/* Previous / next arrows */
.wt-carousel__btn {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	font-size: 1.75rem;
	line-height: 1;
	color: #fff;
	background: rgba( 0, 0, 0, 0.55 );
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transform: translateY( -50% );
}

.wt-carousel__btn--prev {
	left: 0.75rem;
}

.wt-carousel__btn--next {
	right: 0.75rem;
}

.wt-carousel__btn:hover {
	background: rgba( 0, 0, 0, 0.75 );
}

.wt-carousel__btn[disabled] {
	opacity: 0.4;
	cursor: default;
}

/* Controls row (dots + play/pause) */
.wt-carousel__controls {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	justify-content: center;
	margin-top: 0.75rem;
}

.wt-carousel__dots {
	display: flex;
	gap: 0.5rem;
}

.wt-carousel__dot {
	position: relative;
	width: 14px;
	height: 14px;
	padding: 0;
	background: transparent;
	border: 2px solid currentColor;
	border-radius: 50%;
	cursor: pointer;
}

/* Enlarge the touch/click target to 44px without changing the visual (WCAG 2.5.5). */
.wt-carousel__dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	transform: translate( -50%, -50% );
}

.wt-carousel__dot.is-active {
	background: currentColor;
}

.wt-carousel__play {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	background: transparent;
	border: 2px solid currentColor;
	border-radius: 50%;
	cursor: pointer;
}

.wt-carousel__play-icon {
	display: inline-block;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 7px 0 7px 12px;
	border-color: transparent transparent transparent currentColor;
}

.wt-carousel__play.is-playing .wt-carousel__play-icon {
	width: 12px;
	height: 14px;
	border: 0;
	background:
		linear-gradient( currentColor, currentColor ) left / 4px 100% no-repeat,
		linear-gradient( currentColor, currentColor ) right / 4px 100% no-repeat;
}

/* Visible focus — reuse the site's branded focus ring where present. */
.wt-carousel__btn:focus-visible,
.wt-carousel__dot:focus-visible,
.wt-carousel__play:focus-visible {
	outline: 3px solid var( --wp--preset--color--primary, #1a3a8f );
	outline-offset: 2px;
}

@media ( prefers-reduced-motion: reduce ) {
	.wt-carousel__slide {
		transition: none !important;
	}
}
