/* =============================================================
   PD Video Carousel — static perspective scaffold
   ============================================================= */

/* PD Video Slider's visible content is absolutely positioned (same as the
   carousel's slots), so it contributes no intrinsic width. Inside a flex
   parent with align-items other than stretch (e.g. a column-direction
   section with align-items:center), the widget wrapper collapses to 0px.
   Force it to always fill its column regardless of the parent's alignment. */
.elementor-widget-pdep-video-slider {
	width: 100%;
	align-self: stretch;
}

.pdep-carousel {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.pdep-carousel__track {
	position: relative;
	width: 100%;
	height: var(--pdep-carousel-height, 500px);
	perspective: 1000px;
}

/* All slots: centered by margin auto; transform drives ALL motion (no left/right changes between states) */
.pdep-carousel__slot {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	margin: auto;
	width: 50%;
	height: 100%;
	background-size: cover;
	background-position: var(--pdep-focal-d, center center);
	background-repeat: no-repeat;
	border-radius: var(--pdep-carousel-radius, 8px);
	overflow: hidden;
	transform-origin: center center;
	transform: translateX(0) rotateY(0deg);
	opacity: 0;
	will-change: transform, opacity, width;
	transition: transform 450ms cubic-bezier(0.4, 0, 0.2, 1),
	            opacity 450ms cubic-bezier(0.4, 0, 0.2, 1),
	            width 450ms cubic-bezier(0.4, 0, 0.2, 1),
	            transform-origin 450ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Center: flat, dominant, full opacity. --pdep-carousel-recenter (set by JS, px)
   is 0 unless exactly one flank is suppressed, in which case it shifts this and
   the surviving flank as a rigid group toward the vacated edge. */
.pdep-carousel__slot--center {
	width: var(--pdep-carousel-center-width, 60%);
	transform: translateX(var(--pdep-carousel-recenter, 0px)) rotateY(0deg);
	z-index: 10;
	opacity: 1;
}

/* Left flank: translateX shifts inner edge flush against center's left edge + gap.
   Formula: -(50% + W + gap) where W = center-width expressed as element-relative %
   (element = 50% track, so 1%_track = 2%_element → W_track% = W_element%). */
.pdep-carousel__slot--left {
	width: 50%;
	transform-origin: right center;
	transform: translateX(calc(var(--pdep-carousel-recenter, 0px) + -1 * (var(--pdep-carousel-center-width, 60%) + var(--pdep-carousel-gap, 16px) + 50%)))
	           rotateY(calc(-1 * var(--pdep-carousel-angle, 35deg)));
	-webkit-mask-image: linear-gradient(to right, transparent, black var(--pdep-carousel-fade, 50%));
	mask-image: linear-gradient(to right, transparent, black var(--pdep-carousel-fade, 50%));
	z-index: 5;
	opacity: 0.78;
}

/* Right flank: mirror of left */
.pdep-carousel__slot--right {
	width: 50%;
	transform-origin: left center;
	transform: translateX(calc(var(--pdep-carousel-recenter, 0px) + var(--pdep-carousel-center-width, 60%) + var(--pdep-carousel-gap, 16px) + 50%))
	           rotateY(var(--pdep-carousel-angle, 35deg));
	-webkit-mask-image: linear-gradient(to left, transparent, black var(--pdep-carousel-fade, 50%));
	mask-image: linear-gradient(to left, transparent, black var(--pdep-carousel-fade, 50%));
	z-index: 5;
	opacity: 0.78;
}

/* Off: parked off right — animates in from outside right edge when promoted to flank */
.pdep-carousel__slot--off {
	width: 50%;
	transform: translateX(calc(150% + var(--pdep-carousel-center-width, 60%) + var(--pdep-carousel-gap, 16px)))
	           rotateY(calc(1.5 * var(--pdep-carousel-angle, 35deg)));
	opacity: 0;
	z-index: 1;
	pointer-events: none;
}

/* =============================================================
   Pair mode (PD Video Slider, "Slides Per View: 2") — plain flex row,
   no coverflow transforms. Exactly 2 of N slots are ever in flow.
   ============================================================= */

.pdep-carousel--pair .pdep-carousel__track {
	display: flex;
	gap: var(--pdep-carousel-gap, 16px);
}

.pdep-carousel__slot.pdep-carousel__slot--pair-hidden {
	display: none;
}

.pdep-carousel__slot.pdep-carousel__slot--pair-active {
	position: relative;
	top: auto;
	bottom: auto;
	left: auto;
	right: auto;
	margin: 0;
	flex: 1 1 0;
	width: auto;
	opacity: 1;
	transform: none;
}

/* Pair mode — stack on mobile. Figma 607:7114 (Construction Progress
   mobile, 323 wide): the same 2-slide pair that sits side-by-side on
   desktop stacks vertically here, each slot full width. Hardcoded
   breakpoint, not a control — flex-direction is a structural layout
   switch, not something slides_per_view (a PHP render branch, see
   class-pdep-video-slider.php's render()) could ever carry responsively.
   767 matches Elementor's Mobile tier so this aligns with
   carousel_height_mobile below, not some other boundary. */
@media (max-width: 767px) {

	.pdep-carousel--pair .pdep-carousel__track {
		flex-direction: column;
		height: auto;
		/* carousel_gap is now a responsive control (class-pdep-video-slider.php)
		   writing --pdep-carousel-gap per breakpoint — the base rule above
		   already reads that var, so no literal override is needed here. */
	}

	/* --pdep-carousel-height (carousel_height's responsive value, e.g.
	   carousel_height_mobile) stops sizing the TRACK here — it's auto,
	   sized by its stacked children + gap — and instead sizes each SLOT
	   directly. Confirmed by carousel_height_mobile: 198 already saved on
	   live widget 53365e5: that only makes sense as a per-slot number —
	   Figma's two stacked blocks are 198 and 200 tall, nowhere near the
	   428 the full stacked track measures. */
	.pdep-carousel--pair .pdep-carousel__slot.pdep-carousel__slot--pair-active {
		width: 100%;
		height: var(--pdep-carousel-height, 200px);
		flex: none;
	}

}

/* Coverflow mobile: collapse to a single full-width tile, no flanks.
   This was previously pasted as per-element custom_css onto ten separate
   pdep-video-carousel instances; it is the widget's intended mobile default,
   so it belongs here.

   TWO THINGS THAT LOOK OPTIONAL AND ARE NOT:

   1. :not(.pdep-carousel--pair). Pair mode (PD Video Slider) keeps the
      PHP-rendered --center/--left/--right/--off classes: only initCarousel()
      strips them, via POS_CLASSES at pdep-video-carousel.js:140, and
      initPairCarousel() never does. An unscoped rule would therefore hide
      live pair slides on mobile. The old instance CSS never hit this because
      Elementor's `selector` confined it to those ten carousel widgets.

   2. The doubled .pdep-carousel.pdep-carousel on the var block. center_width
      and carousel_gap write --pdep-carousel-center-width/--pdep-carousel-gap
      via control selectors on {{WRAPPER}} .pdep-carousel — specificity (0,2,0)
      — and Elementor's generated stylesheet loads after this file. A single
      class here is also (0,2,0), so it would lose on source order and the
      desktop value would silently survive into mobile. Doubling makes it
      (0,3,0). Same three-layer-specificity technique as .pdep-mosaic and
      .pdep-feature-split; no !important needed.

   The explicit transform on --center is required because JS still computes
   --pdep-carousel-recenter from flank_visibility, which is unaware that CSS
   has hidden the flanks here. */
@media (max-width: 767px) {

	.pdep-carousel.pdep-carousel:not(.pdep-carousel--pair) {
		--pdep-carousel-center-width: 100%;
		--pdep-carousel-gap: 0px;
	}

	.pdep-carousel:not(.pdep-carousel--pair) .pdep-carousel__slot--center {
		width: 100%;
		transform: translateX(0) rotateY(0deg);
		opacity: 1;
	}

	.pdep-carousel:not(.pdep-carousel--pair) .pdep-carousel__slot--left,
	.pdep-carousel:not(.pdep-carousel--pair) .pdep-carousel__slot--right,
	.pdep-carousel:not(.pdep-carousel--pair) .pdep-carousel__slot--off {
		display: none;
	}

}

/* Gradient scrim: poster < scrim (::before, z:1) < text overlay (z:2) < flank label (z:3) */
.pdep-carousel__slot::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 60%);
	pointer-events: none;
}

/* Center slot content overlay */
.pdep-carousel__slot-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 1.6em;
	z-index: 2;
}

.pdep-carousel__slot-overlay span {
	display: inline-block;
	color: var(--pdep-carousel-category-color, #fff);
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	margin-bottom: 0.5em;
}

.pdep-carousel__slot-overlay h2 {
	margin: 0 0 0.5em;
	color: var(--pdep-carousel-title-color, #fff);
	font-weight: 900;
	line-height: 1.2;
}

.pdep-carousel__slot-overlay p {
	margin: 0;
	color: var(--pdep-carousel-excerpt-color, #fff);
	opacity: 0.9;
}

/* Side slots: poster thumbnail only, no overlay */
.pdep-carousel__slot--left .pdep-carousel__slot-overlay,
.pdep-carousel__slot--right .pdep-carousel__slot-overlay {
	display: none;
}

/* =============================================================
   Arrows
   ============================================================= */

.pdep-carousel__arrows {
	position: absolute;
	left: 1.2em;
	right: 1.2em;
	display: flex;
	align-items: center;
	z-index: 20;
	pointer-events: none;
}

/* Vertical */
.pdep-carousel__arrows--v-top    { top: 1.2em; }
.pdep-carousel__arrows--v-bottom { bottom: 1.2em; }

/* Below track — normal flow, sits under the carousel instead of overlaid on it */
.pdep-carousel__arrows--v-below {
	position: static;
	margin-top: 1.2em;
	padding: 0 1.2em;
}

/* Horizontal */
.pdep-carousel__arrows--h-center { justify-content: center; gap: 0.75em; }
.pdep-carousel__arrows--h-split  { justify-content: space-between; }
.pdep-carousel__arrows--h-left   { justify-content: flex-start; gap: 0.75em; }
.pdep-carousel__arrows--h-right  { justify-content: flex-end; gap: 0.75em; }

.pdep-carousel__arrow {
	pointer-events: auto;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.8);
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.pdep-carousel__arrow i {
	display: block;
}

.pdep-carousel__arrow svg {
	fill: currentColor;
	display: block;
}

.pdep-carousel__arrow:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* =============================================================
   Inline player — Stage 2
   z-index stack: scrim(1) < overlay(2) < player(4) < play-btn(5)
   ============================================================= */

.pdep-carousel__player {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 4;
	background: #000;
}

.pdep-carousel__slot--playing .pdep-carousel__player {
	display: block;
}

.pdep-carousel__player video,
.pdep-carousel__player iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.pdep-carousel__play-btn {
	display: none;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 5;
	width: 4.5em;
	height: 4.5em;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.9);
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, transform 0.2s ease;
}

.pdep-carousel__play-btn:hover {
	background: rgba(0, 0, 0, 0.78);
	transform: translate(-50%, -50%) scale(1.08);
}

.pdep-carousel__play-btn i {
	font-size: 1.8em; /* fallback; overridden by play_btn_icon_size control */
	display: block;
}

.pdep-carousel__play-btn svg {
	width: 1.8em;
	height: 1.8em;
	margin-left: 0.15em; /* optical center for triangle path */
	display: block;
}

/* Visible only on the "big and browsable" tile(s) that have inline video —
   coverflow's --center, or pair mode's --pair-active. Deliberately excludes
   --left/--right/--off: those stay decorative, non-interactive previews. */
.pdep-carousel__slot--center.pdep-carousel__slot--has-inline .pdep-carousel__play-btn,
.pdep-carousel__slot--pair-active.pdep-carousel__slot--has-inline .pdep-carousel__play-btn {
	display: flex;
}

/* Hide play button and text overlay while video is active.
   !important beats the center+has-inline show rule (0,3,0 specificity).
   pointer-events:none ensures nothing intercepts clicks on the player. */
.pdep-carousel__slot--playing .pdep-carousel__play-btn,
.pdep-carousel__slot--playing .pdep-carousel__slot-overlay {
	display: none !important;
	pointer-events: none;
}


/* =============================================================
   Per-item focal point
   -------------------------------------------------------------
   Tiles crop their image to the tile box, so a subject that is not
   centred gets cut. render() emits --pdep-focal-d/t/m inline on the
   element from the per-item Image Focal Point control; these rules
   feed them to background-position.

   The nested var() fallbacks ARE the responsive cascade: mobile falls
   back to tablet, tablet falls back to desktop, desktop falls back to
   center center. That is why the control can live inside a repeater,
   where Elementor refuses add_responsive_control() and would otherwise
   give no way to vary framing per breakpoint. Unset breakpoints emit
   no custom property at all, so they inherit rather than override.

   Breakpoints match Elementor tiers: tablet <=1024, mobile <=767.
   ============================================================= */

@media (max-width: 1024px) {
	.pdep-carousel__slot {
		background-position: var(--pdep-focal-t, var(--pdep-focal-d, center center));
	}
}

@media (max-width: 767px) {
	.pdep-carousel__slot {
		background-position: var(--pdep-focal-m, var(--pdep-focal-t, var(--pdep-focal-d, center center)));
	}
}
