/**
 * Propague Carrossel 3D
 *
 * Scoped styles for the "Propague Carrossel 3D" Elementor widget: a
 * perspective carousel where the slides sit on a shallow arc, the centre slide
 * is sharp and the neighbours are scaled, rotated and dimmed.
 *
 * Every selector lives under .pcs3d so the Tool can be dropped into any
 * theme/Elementor section without leaking styles. Colours, sizes and the 3D
 * geometry exposed in the Elementor panel are driven by CSS custom properties;
 * the values below are the reference defaults.
 */

.pcs3d {
	--pcs3d-card-w: 280px;
	--pcs3d-stage-h: 560px;
	--pcs3d-perspective: 900px;
	--pcs3d-radius: 18px;
	--pcs3d-card-bg: #0d0d10;
	--pcs3d-shadow-color: rgba(0, 0, 0, 0.55);
	--pcs3d-shadow-blur: 70px;
	--pcs3d-shift-1: 150px;
	--pcs3d-shift-2: 250px;
	--pcs3d-shift-3: 320px;
	--pcs3d-scale-1: 0.9;
	--pcs3d-scale-2: 0.8;
	--pcs3d-scale-3: 0.7;
	--pcs3d-rot-1: 15deg;
	--pcs3d-rot-2: 25deg;
	--pcs3d-rot-3: 32deg;
	--pcs3d-dim: 50%;
	--pcs3d-gray: 100%;
	/* Transparency applied to the out-of-focus slides. 0 = fully opaque;
	   the farther a slide is from the centre, the more transparent it gets
	   (see the per-position opacity rules below). */
	--pcs3d-alpha: 0;
	--pcs3d-arrow-size: 52px;
	--pcs3d-arrow-color: #fff;
	--pcs3d-arrow-border: rgba(255, 255, 255, 0.55);
	--pcs3d-arrow-bg: rgba(0, 0, 0, 0);
	--pcs3d-arrow-hover-color: #1a1204;
	--pcs3d-arrow-hover-bg: #f0ac32;
	--pcs3d-arrow-hover-border: #f0ac32;
	--pcs3d-arrow-offset: 24px;
	--pcs3d-sound-size: 52px;
	--pcs3d-sound-color: #1a1204;
	--pcs3d-sound-bg: #fff;
	--pcs3d-sound-active-color: #fff;
	--pcs3d-sound-active-bg: #f0ac32;
	--pcs3d-caption-color: #a8a199;
	--pcs3d-caption-gap: 24px;
	--pcs3d-caption-width: 720px;
	--pcs3d-reflect-h: 120px;
	--pcs3d-slide-y: -50%;
	--pcs3d-floor: 0px;
	--pcs3d-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--pcs3d-duration: 0.7s;

	position: relative;
	isolation: isolate;
	overflow: hidden;
	width: 100%;
	margin: 0;
	padding: 32px 16px;
	/* Transparent by default: the section inherits the page/Elementor section
	   background. Use the "Fundo da seção" control to paint it when needed. */
	background-color: transparent;
	color: #fffaf3;
	font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.pcs3d,
.pcs3d *,
.pcs3d *::before,
.pcs3d *::after {
	box-sizing: border-box;
}

.pcs3d--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	padding: 32px 16px;
	color: #a8a199;
	font-size: 0.95rem;
	text-align: center;
}

.pcs3d-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ stage */
.pcs3d-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: var(--pcs3d-stage-h);
	perspective: var(--pcs3d-perspective);
	perspective-origin: 50% 50%;
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	outline: none;
}

.pcs3d-stage:focus-visible {
	outline: 2px solid var(--pcs3d-arrow-hover-bg);
	outline-offset: 6px;
	border-radius: 12px;
}

.pcs3d-track {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
}

/* ------------------------------------------------------------------ slide */
.pcs3d-slide {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	flex-direction: column;
	width: var(--pcs3d-card-w);
	max-width: 92%;
	margin: 0;
	background-color: var(--pcs3d-card-bg);
	border-radius: var(--pcs3d-radius);
	box-shadow: 0 0 var(--pcs3d-shadow-blur) var(--pcs3d-shadow-color);
	overflow: hidden;
	transform-style: preserve-3d;
	transform-origin: center center;
	/* NOTE: no `will-change` here on purpose. Promoting the slide to its own
	   compositing layer makes Chromium drop the `-webkit-box-reflect` while
	   the transform transition runs, so the reflection flickers off and back
	   on every move. The 3D transform already keeps the animation on the
	   compositor without it. */
	transition:
		transform var(--pcs3d-duration) var(--pcs3d-ease),
		opacity var(--pcs3d-duration) var(--pcs3d-ease),
		filter var(--pcs3d-duration) var(--pcs3d-ease);
	opacity: 0;
	pointer-events: none;
	z-index: 0;
	/* translate(-50%, var(--pcs3d-slide-y)) is repeated in every position rule
	   below; --pcs3d-slide-y flips to 0 when the carousel is bottom-aligned. */
}

/* Bottom alignment (the reference look): every card stands on the same floor
   line and scaling/rotation happen around the bottom edge, so neighbours
   shrink towards the floor instead of towards their centre. */
.pcs3d--bottom .pcs3d-slide {
	top: auto;
	bottom: var(--pcs3d-floor);
	--pcs3d-slide-y: 0;
	transform-origin: bottom center;
}

/* Reflection under the cards (WebKit/Blink). The gradient mask keeps only a
   faint slice of the flipped copy visible, fading with distance from the
   floor. The reserved floor space keeps it inside the stage. */
.pcs3d--reflect .pcs3d-slide {
	-webkit-box-reflect: below 0 linear-gradient(transparent 55%, rgba(0, 0, 0, 0.28));
}

.pcs3d--bottom.pcs3d--reflect .pcs3d-slide {
	--pcs3d-floor: var(--pcs3d-reflect-h);
}

/* Centre slide: sharp, full size, on top. */
.pcs3d-slide[data-pos="0"] {
	transform: translate3d(-50%, var(--pcs3d-slide-y), 0) scale(1) rotateY(0deg);
	opacity: 1;
	pointer-events: auto;
	z-index: 10;
	filter: none;
}

/* Left neighbours (negative positions) rotate towards the viewer. They stay
   clickable so a click can bring them to the front. */
.pcs3d-slide[data-pos="-1"] {
	transform: translate3d(calc(-50% - var(--pcs3d-shift-1)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-1)) rotateY(var(--pcs3d-rot-1));
	opacity: calc(1 - var(--pcs3d-alpha) * 0.33);
	pointer-events: auto;
	z-index: 8;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

.pcs3d-slide[data-pos="-2"] {
	transform: translate3d(calc(-50% - var(--pcs3d-shift-2)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-2)) rotateY(var(--pcs3d-rot-2));
	opacity: calc(1 - var(--pcs3d-alpha) * 0.66);
	pointer-events: auto;
	z-index: 6;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

.pcs3d-slide[data-pos="-3"] {
	transform: translate3d(calc(-50% - var(--pcs3d-shift-3)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-3)) rotateY(var(--pcs3d-rot-3));
	opacity: calc(1 - var(--pcs3d-alpha));
	pointer-events: auto;
	z-index: 4;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

/* Right neighbours mirror the rotation. */
.pcs3d-slide[data-pos="1"] {
	transform: translate3d(calc(-50% + var(--pcs3d-shift-1)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-1)) rotateY(calc(-1 * var(--pcs3d-rot-1)));
	opacity: calc(1 - var(--pcs3d-alpha) * 0.33);
	pointer-events: auto;
	z-index: 8;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

.pcs3d-slide[data-pos="2"] {
	transform: translate3d(calc(-50% + var(--pcs3d-shift-2)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-2)) rotateY(calc(-1 * var(--pcs3d-rot-2)));
	opacity: calc(1 - var(--pcs3d-alpha) * 0.66);
	pointer-events: auto;
	z-index: 6;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

.pcs3d-slide[data-pos="3"] {
	transform: translate3d(calc(-50% + var(--pcs3d-shift-3)), var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-3)) rotateY(calc(-1 * var(--pcs3d-rot-3)));
	opacity: calc(1 - var(--pcs3d-alpha));
	pointer-events: auto;
	z-index: 4;
	filter: grayscale(var(--pcs3d-gray)) brightness(var(--pcs3d-dim));
}

/* Slides parked outside the visible window stay hidden but keep their slot. */
.pcs3d-slide[data-pos="4"],
.pcs3d-slide[data-pos="-4"],
.pcs3d-slide[data-pos="5"],
.pcs3d-slide[data-pos="-5"],
.pcs3d-slide[data-pos="6"],
.pcs3d-slide[data-pos="-6"] {
	transform: translate3d(-50%, var(--pcs3d-slide-y), 0) scale(var(--pcs3d-scale-3)) rotateY(0deg);
	opacity: 0;
	z-index: 1;
}

.pcs3d--no-dim .pcs3d-slide {
	filter: none;
}

/* Grayscale off: side slides keep their colours (only the brightness dim
   applies, when enabled). */
.pcs3d--no-gray .pcs3d-slide {
	filter: brightness(var(--pcs3d-dim));
}

.pcs3d--no-gray.pcs3d--no-dim .pcs3d-slide {
	filter: none;
}

/* While dragging, the transition must not fight the pointer. */
.pcs3d.is-dragging .pcs3d-slide {
	transition: none;
}

.pcs3d.is-dragging .pcs3d-stage {
	cursor: grabbing;
}

/* ------------------------------------------------------------------ media */
.pcs3d-media {
	position: relative;
	width: 100%;
	aspect-ratio: var(--pcs3d-ratio, 9 / 16);
	background-color: #000;
	overflow: hidden;
}

.pcs3d-image,
.pcs3d-poster {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	border: 0;
	pointer-events: none;
}

.pcs3d-poster {
	transition: opacity 0.4s ease;
}

.pcs3d-slide.is-playing .pcs3d-poster {
	opacity: 0;
}

.pcs3d-mount {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.pcs3d-slide.is-playing .pcs3d-mount {
	opacity: 1;
}

/* Default: the player keeps its own aspect ratio inside the iframe, so a
   matching orientation fills the card and a mismatched one is letterboxed
   instead of being cropped or distorted. */
.pcs3d-mount iframe {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	border: 0;
}

/* "Fill the card": the player letterboxes the video inside its own iframe, so
   the iframe is scaled up until those bars fall outside the card. The scale is
   computed per slide by the script (--pcs3d-cover-scale) from the media box and
   the video's aspect ratio; the overflow is clipped by .pcs3d-media. */
.pcs3d--cover .pcs3d-mount iframe {
	transform: scale(var(--pcs3d-cover-scale, 1));
	transform-origin: center center;
}

/* Transparent layer that keeps click-and-drag working over the iframe. */
.pcs3d-shield {
	position: absolute;
	inset: 0;
	display: block;
	z-index: 3;
	cursor: grab;
	background: transparent;
	-webkit-tap-highlight-color: transparent;
}

.pcs3d-slide[data-pos="0"] .pcs3d-shield {
	cursor: grab;
}

/* With native player controls on, the centre video must receive the clicks. */
.pcs3d--controls .pcs3d-slide[data-pos="0"][data-type="video"] .pcs3d-shield {
	pointer-events: none;
}

/* ---------------------------------------------------------------- caption */
.pcs3d-slide-caption {
	margin: 0;
	padding: var(--pcs3d-caption-gap) 16px;
	color: var(--pcs3d-caption-color);
	font-size: 0.9rem;
	line-height: 1.5;
	text-align: center;
	background-color: var(--pcs3d-card-bg);
}

.pcs3d-caption {
	width: 100%;
	max-width: var(--pcs3d-caption-width);
	margin: var(--pcs3d-caption-gap) auto 0;
	padding: 0 8px;
	color: var(--pcs3d-caption-color);
	font-size: 0.95rem;
	line-height: 1.6;
	text-align: center;
	transition: opacity 0.3s ease;
}

/* The controls row already adds its own gap; the caption should not double it. */
.pcs3d-controls + .pcs3d-caption {
	margin-top: var(--pcs3d-caption-gap);
}

.pcs3d-caption:empty {
	display: none;
}

/* --------------------------------------------------------------- controls */
/* Arrows and the speaker live in a row under the stage so they never cover
   the slides. The speaker sits on the left, the arrows stay centred. */
.pcs3d-controls {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	width: 100%;
	margin-top: var(--pcs3d-arrow-offset);
	min-height: var(--pcs3d-arrow-size);
}

.pcs3d-arrows {
	display: flex;
	gap: 16px;
}

/* The `.pcs3d` prefix is deliberate: themes and the Elementor kit often paint
   every `<button>` (e.g. `.elementor-kit-N button { background-color: … }`),
   and that selector (0,1,1) would beat a bare `.pcs3d-arrow` (0,1,0). Scoping
   the controls under `.pcs3d` keeps their own look everywhere. */
.pcs3d .pcs3d-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--pcs3d-arrow-size);
	height: var(--pcs3d-arrow-size);
	padding: 0;
	color: var(--pcs3d-arrow-color);
	font-size: calc(var(--pcs3d-arrow-size) * 0.42);
	line-height: 1;
	background-color: var(--pcs3d-arrow-bg);
	border: 2px solid var(--pcs3d-arrow-border);
	border-radius: 50%;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}

.pcs3d .pcs3d-arrow:hover,
.pcs3d .pcs3d-arrow:focus-visible {
	color: var(--pcs3d-arrow-hover-color);
	background-color: var(--pcs3d-arrow-hover-bg);
	border-color: var(--pcs3d-arrow-hover-border);
	opacity: 1;
	outline: none;
}

.pcs3d .pcs3d-arrow:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.pcs3d .pcs3d-arrow svg {
	display: block;
}

/* Arrows on the sides of the stage (overlay mode). */
.pcs3d--arrows-sides .pcs3d-stage > .pcs3d-arrows {
	position: absolute;
	top: 50%;
	right: 0;
	left: 0;
	z-index: 20;
	justify-content: space-between;
	padding: 0 var(--pcs3d-arrow-offset);
	transform: translateY(-50%);
	pointer-events: none;
}

.pcs3d--arrows-sides .pcs3d-stage > .pcs3d-arrows .pcs3d-arrow {
	pointer-events: auto;
}

/* ------------------------------------------------------------------ sound */
.pcs3d .pcs3d-sound {
	position: absolute;
	left: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--pcs3d-sound-size);
	height: var(--pcs3d-sound-size);
	padding: 0;
	color: var(--pcs3d-sound-color);
	font-size: calc(var(--pcs3d-sound-size) * 0.42);
	line-height: 1;
	background-color: var(--pcs3d-sound-bg);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}

.pcs3d .pcs3d-sound:hover {
	transform: scale(1.06);
}

.pcs3d .pcs3d-sound:focus-visible {
	outline: 2px solid var(--pcs3d-sound-active-bg);
	outline-offset: 3px;
}

.pcs3d .pcs3d-sound[data-muted="0"] {
	color: var(--pcs3d-sound-active-color);
	background-color: var(--pcs3d-sound-active-bg);
}

.pcs3d-sound-icon {
	display: none;
	align-items: center;
	justify-content: center;
}

.pcs3d-sound[data-muted="1"] .pcs3d-sound-icon--off,
.pcs3d-sound[data-muted="0"] .pcs3d-sound-icon--on {
	display: inline-flex;
}

.pcs3d-sound svg {
	display: block;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
	.pcs3d {
		--pcs3d-card-w: 240px;
		--pcs3d-stage-h: 480px;
		--pcs3d-shift-1: 130px;
		--pcs3d-shift-2: 210px;
		--pcs3d-shift-3: 270px;
	}
}

@media (max-width: 767px) {
	.pcs3d {
		--pcs3d-card-w: 200px;
		--pcs3d-stage-h: 420px;
		--pcs3d-shift-1: 105px;
		--pcs3d-shift-2: 165px;
		--pcs3d-shift-3: 210px;
		--pcs3d-arrow-size: 44px;
		--pcs3d-sound-size: 44px;
		--pcs3d-arrow-offset: 12px;
	}

	/* On narrow screens the 3rd neighbour would sit off-canvas. */
	.pcs3d-slide[data-pos="3"],
	.pcs3d-slide[data-pos="-3"] {
		opacity: 0;
	}
}

@media (max-width: 480px) {
	.pcs3d {
		--pcs3d-card-w: 168px;
		--pcs3d-stage-h: 380px;
		--pcs3d-shift-1: 88px;
		--pcs3d-shift-2: 140px;
	}

	.pcs3d-slide[data-pos="2"],
	.pcs3d-slide[data-pos="-2"] {
		opacity: 0;
	}
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
	.pcs3d-slide,
	.pcs3d-caption,
	.pcs3d-poster,
	.pcs3d-mount,
	.pcs3d-arrow,
	.pcs3d-sound {
		transition-duration: 0.01ms;
	}
}
