/*
 * Burcat Power: capa de movimiento (16 nov 2026; segunda ronda, 17 nov 2026).
 *
 * Solo agrega movimiento. No cambia colores, tipografía, medidas, textos ni el encabezado.
 * Todo depende de la clase html.bp-anim: sin ella (dispositivo que pide menos movimiento,
 * visitante que apagó las animaciones o JavaScript desactivado) la página se ve exactamente
 * como antes.
 *
 * Firma: "corte láser". Los títulos aparecen detrás de una línea encendida, la bodega se
 * construye desde su plano con esa misma línea y el borde del encabezado marca el avance
 * de la página (rojo en Burcat, amarillo en RUWA).
 *
 * Segunda ronda: los efectos siguen al scroll (avanzan y retroceden con él). Donde el
 * navegador lo permite se usan animaciones ligadas al scroll de CSS (animation-timeline),
 * que corren fuera del hilo principal; donde no, quedan las entradas de la primera ronda.
 *
 * Tercera ronda (18 nov 2026), pulido: las líneas láser se mueven con translate (sin recalcular
 * la página en cada cuadro), las fotos aparecen con un fundido al llegar, la galería cambia de
 * foto con un fundido y tiene lupa con el ratón, y las tarjetas del catálogo se acomodan al
 * cambiar de familia u orden.
 */

@property --bp-a {
	syntax: '<number>';
	inherits: false;
	initial-value: 0;
}

@property --bp-laser {
	syntax: '<color>';
	inherits: true;
	initial-value: #ff2b3f;
}

html.bp-anim {
	--bp-ease: cubic-bezier(.2, .75, .15, 1);
	--bp-cut-ease: cubic-bezier(.55, .05, .25, 1);
	--bp-laser: #ff2b3f;
}

.bp-anim .modern-ruwa,
.bp-anim .ruwa-page-heading,
.bp-anim .bp-ruwa-more,
.bp-anim .bp-ruwa-exhibitor,
.bp-anim .ruwa-photo-references,
.bp-anim .site-header.bp-zone-ruwa {
	--bp-laser: #feb70d;
}

.bp-anim .bp-wergen-heading,
.bp-anim .bp-coming-soon {
	--bp-laser: #e9e9ec;
}

.bp-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Mientras carga la capa, los títulos y la foto de la bodega esperan para no verse un
   instante antes de animarse. El script del <head> quita esta espera a los 2,5 s pase lo que pase. */
html.bp-anim.bp-pending main :is(h1, h2, .modern-year):not(.campaign-copy *),
html.bp-anim.bp-pending .home-company-warehouse img {
	opacity: 0;
}

/* ---------- Corte láser de títulos ---------- */
.bp-anim .bp-cut {
	position: relative;
}

.bp-anim .bp-cut-text {
	display: block;
	clip-path: inset(-20% calc(100% - var(--bp-x0, 0px)) -20% -6%);
}

.bp-anim .bp-cut::after {
	content: "";
	position: absolute;
	top: var(--bp-y0, -6%);
	height: var(--bp-yh, 112%);
	left: var(--bp-x0, 0px);
	width: 2px;
	margin-left: -1px;
	border-radius: 2px;
	background: #fff;
	box-shadow: 0 0 3px 1px var(--bp-laser), 0 0 14px 3px var(--bp-laser), 0 0 36px 8px color-mix(in srgb, var(--bp-laser) 40%, transparent);
	opacity: 0;
	pointer-events: none;
}

.bp-anim .bp-cut.is-in .bp-cut-text {
	animation:
		bp-cut-text var(--bp-cut-d, .9s) var(--bp-cut-ease) var(--bp-delay, 0s) both,
		bp-heat 1.8s ease-out var(--bp-delay, 0s) both;
}

.bp-anim .bp-cut.is-in::after {
	animation: bp-cut-line var(--bp-cut-d, .9s) var(--bp-cut-ease) var(--bp-delay, 0s) both;
}

.bp-anim .bp-cut.is-done .bp-cut-text {
	clip-path: none;
	animation: none;
}

.bp-anim .bp-cut.is-done::after {
	content: none;
}

@keyframes bp-cut-text {
	from { clip-path: inset(-20% calc(100% - var(--bp-x0, 0px)) -20% -6%); }
	to { clip-path: inset(-20% calc(100% - var(--bp-x1, 100%) - 10px) -20% -6%); }
}

/* La línea se desplaza con translate (lo mueve la tarjeta gráfica): antes cambiaba "left" y
   el navegador volvía a calcular la página en cada cuadro (18 nov 2026). Mismo recorrido. */
@keyframes bp-cut-line {
	0% { translate: 0 0; opacity: 0; }
	6% { opacity: 1; }
	90% { opacity: 1; }
	100% { translate: calc(var(--bp-x1, 0px) - var(--bp-x0, 0px)) 0; opacity: 0; }
}

/* El texto recién cortado queda "caliente" y se enfría. */
@keyframes bp-heat {
	0%, 35% { text-shadow: 0 0 16px color-mix(in srgb, var(--bp-laser) 75%, transparent), 0 0 2px color-mix(in srgb, var(--bp-laser) 60%, transparent); }
	100% { text-shadow: 0 0 0 transparent; }
}

/* ---------- Entradas en cascada ---------- */
.bp-anim .bp-rise {
	opacity: 0;
	translate: 0 26px;
	transition: opacity .7s var(--bp-ease) var(--bp-delay, 0s), translate .85s var(--bp-ease) var(--bp-delay, 0s);
}

.bp-anim .bp-rise.is-in {
	opacity: 1;
	translate: none;
}

/* ---------- Del plano a la bodega: la foto se construye con el scroll ---------- */
/* Debajo va un plano de líneas calculado de la misma foto; una línea láser sube y deja
   la foto original a su paso. Al terminar queda la foto aprobada, sin nada encima. */
.bp-anim .bp-build {
	position: relative;
}

.bp-anim .bp-build .bp-built {
	position: relative;
	z-index: 1;
	clip-path: inset(calc((1 - var(--bp-b, 1)) * 100%) 0 0 0);
}

/* Con las animaciones apagadas, el plano y la línea no existen para la página.
   Lleva !important porque la regla del sitio para la foto de la bodega
   (.home-company-warehouse img) pesa más que una clase sola. */
html:not(.bp-anim) .bp-plan,
html:not(.bp-anim) .bp-build-line {
	display: none !important;
}

.bp-anim .bp-plan {
	display: block;
	position: absolute;
	left: 0;
	top: 0;
	z-index: 0;
	width: 100%;
	max-width: 1280px;
	height: auto;
	aspect-ratio: 1280 / 828;
	object-fit: contain;
	opacity: 0;
	transition: opacity .45s linear;
	pointer-events: none;
}

.bp-anim .bp-plan.is-ready {
	opacity: clamp(0, (1 - var(--bp-b, 1)) * 30, 1);
}

.bp-anim .bp-build-line {
	display: block;
	position: absolute;
	left: 0;
	top: -1px;
	translate: 0 calc((1 - var(--bp-b, 1)) * var(--bp-ph, 0px));
	z-index: 2;
	width: 100%;
	max-width: 1280px;
	height: 2px;
	background: #fff;
	box-shadow: 0 0 3px 1px var(--bp-laser), 0 0 16px 4px var(--bp-laser), 0 0 44px 10px color-mix(in srgb, var(--bp-laser) 38%, transparent);
	opacity: clamp(0, min(var(--bp-b, 1), 1 - var(--bp-b, 1)) * 28, 1);
	pointer-events: none;
}

/* ---------- Portada (la composición aprobada no cambia) ---------- */

/* Cada foto se acerca muy despacio mientras está en pantalla (3,6 s, hasta 3,5 %). */
.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-photo img {
	animation: bp-drift 3.6s cubic-bezier(.25, .1, .35, 1) both;
}

.bp-anim .power-stage .campaign-outgoing .campaign-photo img {
	scale: 1.035;
}

@keyframes bp-drift {
	from { scale: 1; }
	to { scale: 1.035; }
}

/* Los textos de cada escena entran por partes, justo después del fundido de 240 ms. */
.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-copy > * {
	animation: bp-copy-in .7s var(--bp-ease) both;
}

.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-copy > :nth-child(1) { animation-delay: .06s; }
.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-copy > :nth-child(2) { animation-delay: .13s; }
.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-copy > :nth-child(3) { animation-delay: .2s; }
.bp-anim .power-stage .campaign-scene:not(.campaign-outgoing) .campaign-copy > :nth-child(4) { animation-delay: .27s; }

@keyframes bp-copy-in {
	from { opacity: 0; translate: 0 18px; }
}

/* Al bajar, la foto se aleja y se oscurece, y el texto sube y se desvanece. */
.bp-anim .power-stage .campaign-photo {
	scale: calc(1 + var(--bp-hero, 0) * .07);
	filter: brightness(calc(1 - var(--bp-hero, 0) * .5));
}

.bp-anim .power-stage .campaign-copy {
	translate: 0 calc(var(--bp-hero, 0) * -70px);
	opacity: calc(1 - var(--bp-hero, 0) * .9);
}

/* Telón: la portada baja más despacio que la página y la sección siguiente pasa por encima. */
.bp-anim .power-stage {
	position: relative;
	z-index: 0;
}

.bp-anim .power-stage ~ * {
	position: relative;
	z-index: 1;
}

@supports (animation-timeline: view()) {
	.bp-anim .power-stage {
		animation: bp-hero-away linear both;
		animation-timeline: view(block 80px 0px);
		animation-range: exit 0% exit 100%;
	}
}

@keyframes bp-hero-away {
	to { translate: 0 40%; }
}

/* Anillo en el punto activo: marca los 3,5 s de cada escena. */
.bp-anim .power-stage .power-slide-selectors button span {
	position: relative;
}

.bp-anim .power-stage .power-slideshow[data-running="true"] .power-slide-selectors button[aria-pressed="true"] span::after {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	background: conic-gradient(#fff calc(var(--bp-a) * 1turn), #ffffff38 0);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
	animation: bp-ring 3.5s linear both;
	pointer-events: none;
}

@keyframes bp-ring {
	from { --bp-a: 0; }
	to { --bp-a: 1; }
}

/* ---------- Profundidad con el scroll ---------- */
@supports (animation-timeline: view()) {
	.bp-anim .home-company-warehouse {
		animation: bp-depth-a linear both;
		animation-timeline: view();
		animation-range: cover 0% cover 100%;
	}

	.bp-anim .home-company-copy {
		animation: bp-depth-b linear both;
		animation-timeline: view();
		animation-range: cover 0% cover 100%;
	}
}

@keyframes bp-depth-a {
	from { translate: 0 30px; }
	to { translate: 0 -30px; }
}

@keyframes bp-depth-b {
	from { translate: 0 -12px; }
	to { translate: 0 12px; }
}

/* Kit RUWA: gira en 3D hacia el frente mientras entra y un reflejo lo recorre.
   Al terminar queda en su inclinación de siempre. */
.bp-anim .modern-ruwa-grid {
	perspective: 1300px;
}

.bp-anim .modern-ruwa-display {
	overflow: hidden;
	rotate: y calc(var(--bp-rt, 0) * 1deg);
	translate: 0 calc(var(--bp-ty, 0) * 1px);
	scale: calc(1 - var(--bp-ty, 0) * .0012);
}

.bp-anim .modern-ruwa-display::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(102deg, transparent 36%, #ffffff30 50%, transparent 64%);
	translate: calc((var(--bp-gl, 1) * 2 - 1) * 115%) 0;
	pointer-events: none;
}

/* ---------- Texto que se enciende al leerlo (sigue al scroll) ---------- */
.bp-anim .bp-read .bp-w {
	opacity: clamp(.38, (var(--bp-read, 1) * (var(--bp-n, 1) + 5) - var(--i, 0)) / 5, 1);
	transition: opacity .22s linear;
}

/* ---------- Año: los dígitos ruedan como un contador ---------- */
.bp-anim .bp-odo {
	opacity: 0;
}

.bp-anim .bp-odo.is-in {
	opacity: 1;
	animation: bp-heat 2.8s ease-out both;
}

.bp-anim .bp-odo-digit {
	position: relative;
	display: inline-block;
	vertical-align: top;
	clip-path: inset(0 -.5em);
}

.bp-anim .bp-odo-digit > i {
	font-style: normal;
	visibility: hidden;
}

.bp-anim .bp-odo-col {
	position: absolute;
	left: 0;
	top: 0;
	display: block;
	animation: bp-odo var(--bp-odo-d, 1.4s) cubic-bezier(.16, .84, .24, 1) both;
}

.bp-anim .bp-odo-col > b {
	display: block;
	height: 1em;
	font-weight: inherit;
	line-height: 1;
}

@keyframes bp-odo {
	from { translate: 0 0; }
	to { translate: 0 calc((var(--bp-odo-n, 1) - 1) * -1em); }
}

/* ---------- Tarjetas y familias: se acomodan siguiendo el scroll ---------- */
@supports (animation-timeline: view()) {
	.bp-anim .bp-deal {
		animation: bp-deal linear both;
		animation-timeline: view();
		animation-range: entry 0% cover 24%;
	}

	.bp-anim .bp-deal:nth-child(even) {
		animation-name: bp-deal-b;
		animation-range: entry 8% cover 29%;
	}

	.bp-anim .campaign-families {
		overflow-x: clip;
	}

	.bp-anim .bp-lineup {
		animation: bp-lineup linear both;
		animation-timeline: view();
		animation-range: entry 0% cover 22%;
	}

	.bp-anim .bp-lineup:nth-child(2) { animation-range: entry 14% cover 25%; }
	.bp-anim .bp-lineup:nth-child(3) { animation-range: entry 28% cover 28%; }
	.bp-anim .bp-lineup:nth-child(4) { animation-range: entry 42% cover 31%; }
	.bp-anim .bp-lineup:nth-child(5) { animation-range: entry 56% cover 34%; }
	.bp-anim .bp-lineup:nth-child(6) { animation-range: entry 70% cover 37%; }
}

@keyframes bp-deal {
	from { opacity: 0; translate: 0 72px; rotate: -1.6deg; scale: .93; }
}

@keyframes bp-deal-b {
	from { opacity: 0; translate: 0 72px; rotate: 1.6deg; scale: .93; }
}

@keyframes bp-lineup {
	from { opacity: 0; translate: 110px 0; scale: .88; }
}

/* ---------- Tarjetas: inclinación 3D y brillo de acero (solo con ratón) ---------- */
@media (hover: hover) and (pointer: fine) {
	.bp-anim .bp-tilt {
		transform: perspective(900px) rotateX(var(--bp-rx, 0deg)) rotateY(var(--bp-ry, 0deg));
		transition: transform .6s var(--bp-ease), box-shadow .2s, border-color .2s;
	}

	.bp-anim .bp-tilt.is-tilting {
		transition: transform .12s linear, box-shadow .2s, border-color .2s;
	}

	.bp-anim .bp-glint {
		position: absolute;
		inset: 0;
		z-index: 3;
		border-radius: inherit;
		background: radial-gradient(380px circle at var(--bp-mx, 50%) var(--bp-my, 50%), #ffffff24, transparent 60%);
		opacity: 0;
		transition: opacity .35s;
		pointer-events: none;
	}

	.bp-anim .bp-tilt:hover .bp-glint {
		opacity: 1;
	}

	/* Destello que cruza los botones principales al pasar el cursor. */
	.bp-anim :is(.button:not(.secondary):not(.light), .home-company-primary) {
		background-image: linear-gradient(105deg, transparent 38%, #ffffff42 50%, transparent 62%);
		background-size: 260% 100%;
		background-repeat: no-repeat;
		background-position: 130% 0;
		transition: background-color .18s, border-color .18s, transform .18s, background-position 0s;
	}

	.bp-anim :is(.button:not(.secondary):not(.light), .home-company-primary):hover {
		background-position: -30% 0;
		transition: background-color .18s, border-color .18s, transform .18s, background-position .8s var(--bp-ease);
	}
}

/* ---------- Encabezado: su borde inferior marca el avance de la página ---------- */
/* El encabezado no cambia; solo se enciende su borde, de izquierda a derecha. */
.bp-anim .site-header {
	transition: --bp-laser .5s linear;
}

.bp-anim .site-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	transform-origin: 0 50%;
	scale: var(--bp-page, 0) 1;
	background: linear-gradient(90deg, transparent, var(--bp-laser) 55%, #fff 99.6%);
	box-shadow: 0 0 9px 0 color-mix(in srgb, var(--bp-laser) 75%, transparent);
	opacity: min(1, var(--bp-page, 0) * 60);
	pointer-events: none;
}

/* ---------- Cambio de página (navegadores con View Transitions) ---------- */
@media (prefers-reduced-motion: no-preference) {
	@view-transition {
		navigation: auto;
	}
}

.site-header {
	view-transition-name: bp-header;
}

::view-transition-group(bp-header),
::view-transition-old(bp-header),
::view-transition-new(bp-header) {
	animation: none;
}

::view-transition-old(bp-header) {
	display: none;
}

::view-transition-old(root) {
	animation: bp-vt-out .26s cubic-bezier(.4, 0, 1, 1) both;
}

::view-transition-new(root) {
	animation: bp-vt-in .46s var(--bp-ease, ease-out) both;
}

@keyframes bp-vt-out {
	to { opacity: 0; scale: .985; }
}

@keyframes bp-vt-in {
	from { opacity: 0; translate: 0 22px; }
}

/* La foto del producto viaja de la tarjeta a su ficha. */
.bp-anim main .detail-layout:not(.bp-kit-detail, .bp-ruwa-exhibitor) > .product-gallery > .detail-image img {
	view-transition-name: bp-photo;
}

.bp-vt-off {
	view-transition-name: none !important;
}

::view-transition-group(bp-photo) {
	animation-duration: .55s;
	animation-timing-function: cubic-bezier(.2, .75, .15, 1);
}

::view-transition-old(bp-photo),
::view-transition-new(bp-photo) {
	height: 100%;
	object-fit: contain;
}

/* ---------- Botón para activar las animaciones ---------- */
/* Solo aparece en dispositivos que piden menos movimiento (el script lo crea). */
.bp-motion-toggle {
	position: fixed;
	left: max(16px, env(safe-area-inset-left));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 39;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 40px;
	padding: 9px 15px 9px 12px;
	border: 1px solid #3a3b40;
	border-radius: 999px;
	background: #111214eb;
	color: #f4f4f5;
	font: 700 13px/1.2 Arial, Helvetica, sans-serif;
	letter-spacing: 0;
	cursor: pointer;
	box-shadow: 0 8px 24px #0008;
}

.bp-motion-toggle::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #cc0d26;
	box-shadow: 0 0 0 3px #cc0d2638;
}

.bp-motion-toggle[aria-pressed="true"]::before {
	background: #f4f4f5;
	box-shadow: 0 0 0 3px #f4f4f526;
}

.bp-motion-toggle:hover {
	border-color: #61626a;
}

.bp-motion-toggle:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* ---------- Tercera ronda (18 nov 2026): pulido ---------- */

/* Fotos que llegan de la red: aparecen con un fundido corto en lugar de "saltar". */
.bp-anim img.bp-wait {
	opacity: 0;
}

/* Galería: lupa al pasar el cursor (solo con ratón y si la foto tiene detalle de sobra).
   La capa queda encima de la foto, del mismo tamaño, y no recibe clics. */
.bp-zoomable {
	position: relative;
	cursor: zoom-in;
}

.bp-zoom {
	position: absolute;
	z-index: 2;
	background-color: #fff;
	background-repeat: no-repeat;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
}

.bp-zoom.is-on {
	opacity: 1;
}

html:not(.bp-anim) .bp-zoom {
	transition: none;
}

/* Catálogo: al cambiar de familia u orden, las tarjetas se acomodan en su nuevo lugar
   (View Transitions). La página alrededor cambia sin fundido. */
html.bp-vt-cards::view-transition-old(root),
html.bp-vt-cards::view-transition-new(root) {
	animation: none;
}

html.bp-vt-cards::view-transition-group(*) {
	animation-duration: .5s;
	animation-timing-function: cubic-bezier(.2, .75, .15, 1);
}

html.bp-vt-cards::view-transition-old(*):only-child {
	animation: bp-card-out .22s ease-in both;
}

html.bp-vt-cards::view-transition-new(*):only-child {
	animation: bp-card-in .42s cubic-bezier(.2, .75, .15, 1) .08s both;
}

@keyframes bp-card-out {
	to { opacity: 0; scale: .94; }
}

@keyframes bp-card-in {
	from { opacity: 0; scale: .94; }
}

/* El desplazamiento suave de las anclas solo con las animaciones encendidas
   (antes también corría en dispositivos que piden menos movimiento). */
html:not(.bp-anim) {
	scroll-behavior: auto;
}

@media print {
	.bp-motion-toggle,
	.bp-zoom,
	.bp-cut::after,
	.bp-plan,
	.bp-build-line,
	.site-header::after {
		display: none !important;
	}

	.bp-rise,
	.bp-cut-text,
	.bp-built,
	.bp-deal,
	.bp-lineup,
	.bp-odo,
	.bp-wait,
	.bp-w {
		opacity: 1 !important;
		translate: none !important;
		clip-path: none !important;
		animation: none !important;
	}
}
