/**
 * Gallery Slider 01 — track + translateX; .is-active para alto destacado, overlay y CTA.
 */

.mwm-gallery-slider-01 {
	--mwm-gallery-slide-compact: 292px;
	--mwm-gallery-slide-featured: 600px;
	/* Movimiento del carrusel (transform + tamaños + overlay/CTA) */
	--mwm-gallery-slider-motion-duration: 0.62s;
	--mwm-gallery-slider-motion-easing: cubic-bezier(0.22, 1, 0.36, 1);

	position: relative;
	box-sizing: border-box;
}

.mwm-gallery-slider-01__container {
	max-width: 68.75rem;
	margin: 0 auto;
}

.mwm-gallery-slider-01 *,
.mwm-gallery-slider-01 *::before,
.mwm-gallery-slider-01 *::after {
	box-sizing: inherit;
}

.mwm-gallery-slider-01__decor {
	position: absolute;
	top: 0;
	right: 0;
	width: 38.5vw;
	max-width: 493px;
	height: auto;
	object-fit: contain;
	mix-blend-mode: darken;
	pointer-events: none;
	z-index: 0;
}

.mwm-gallery-slider-01__inner {
	position: relative;
	z-index: 1;
	max-width: 1280px;
	margin-left: auto;
	margin-right: auto;
	padding: clamp(48px, 8vw, 96px) 0;
	overflow: hidden;
}

.mwm-gallery-slider-01__header {
	margin-bottom: clamp(32px, 5vw, 56px);
	max-width: 42rem;
}

.mwm-gallery-slider-01__heading {
	margin: 0 0 12px;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	line-height: 1.15;
	font-weight: 700;
}

.mwm-gallery-slider-01__subheading {
	margin: 0;
	font-size: clamp(1rem, 2vw, 1.125rem);
	line-height: 1.5;
	opacity: 0.85;
}

.mwm-gallery-slider-01__stage {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.mwm-gallery-slider-01__viewport {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	/*
	 * `clip` en vez de `hidden` para el eje X: con `hidden` el viewport SIGUE
	 * siendo un contenedor desplazable, así que al cerrar el visor de fotos el
	 * navegador hacía scrollIntoView() del slide de la última foto vista y
	 * dejaba el carrusel corrido (scrollLeft ≈ 900px) mientras el slider seguía
	 * creyendo que estaba en el primero: se perdía la foto destacada y en móvil
	 * los toques caían donde no era. Con `clip` no hay caja de scroll que mover.
	 * `overflow: hidden` se queda arriba como respaldo para navegadores viejos.
	 */
	overflow: clip;
	/*
	 * Alto fijo = slide destacado: si los compactos tweenean height, el stage no salta
	 * (antes la línea flex tomaba max(slides) y el contenedor “respiraba”).
	 */
	height: var(--mwm-gallery-slide-featured);
	min-height: var(--mwm-gallery-slide-featured);

	/*
	 * Anchos en px (--mwm-gallery-slide-*-w): los calcula view.js desde clientWidth.
	 */
	--mwm-gallery-slide-featured-w: 420px;
	--mwm-gallery-slide-compact-w: 200px;
}

.mwm-gallery-slider-01__viewport ul {
	margin: 0;
	padding: 0;
}

.mwm-gallery-slider-01__track {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	gap: 16px;
	box-sizing: border-box;
	height: 100%;
	min-height: 0;
	list-style: none;
	margin: 0;
	padding: 0;
	transition: transform var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing);
	will-change: transform;
}

/* Resize/init: sin tween (view.js añade/quita la clase en el viewport). */
.mwm-gallery-slider-01__viewport--instant-layout .mwm-gallery-slider-01__track,
.mwm-gallery-slider-01__viewport--instant-layout .mwm-gallery-slider-01__slide,
.mwm-gallery-slider-01__viewport--instant-layout .mwm-gallery-slider-01__overlay,
.mwm-gallery-slider-01__viewport--instant-layout .mwm-gallery-slider-01__cta,
.mwm-gallery-slider-01__viewport--instant-layout .mwm-gallery-slider-01__image {
	transition: none !important;
}

/* Un solo ancho base + featured solo ≥1024px */
.mwm-gallery-slider-01__viewport:not(.mwm-gallery-slider-01__viewport--editor) .mwm-gallery-slider-01__slide {
	transition:
		height var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing),
		width var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing);
}

.mwm-gallery-slider-01__slide {
	position: relative;
	flex-shrink: 0;
	width: var(--mwm-gallery-slide-compact-w);
	height: var(--mwm-gallery-slide-compact);
	border-radius: 16px;
	overflow: hidden;
	list-style: none;
	margin: 0;
}

@media (min-width: 1024px) {
	.mwm-gallery-slider-01__slide.is-active {
		width: var(--mwm-gallery-slide-featured-w);
	}
}

.mwm-gallery-slider-01__slide.is-active {
	height: var(--mwm-gallery-slide-featured);
}

.mwm-gallery-slider-01__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;

	img {
		height: 100%;
		width: 100%;
		object-fit: cover;
		object-position: center;
	}
}

/* Zoom suave al pasar a destacado (refuerzo visual junto al tween de width). */
.mwm-gallery-slider-01__viewport:not(.mwm-gallery-slider-01__viewport--editor) .mwm-gallery-slider-01__slide:not(.is-active) .mwm-gallery-slider-01__image {
	transform: scale(1.07);
	transform-origin: center center;
}

.mwm-gallery-slider-01__viewport:not(.mwm-gallery-slider-01__viewport--editor) .mwm-gallery-slider-01__slide .mwm-gallery-slider-01__image {
	transition: transform var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing);
}

.mwm-gallery-slider-01__viewport:not(.mwm-gallery-slider-01__viewport--editor) .mwm-gallery-slider-01__slide.is-active .mwm-gallery-slider-01__image {
	transform: scale(1);
	transform-origin: center center;
}

.mwm-gallery-slider-01__image-placeholder {
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.06);
}

.mwm-gallery-slider-01__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.3);
	opacity: 0;
	transition: opacity var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing);
	pointer-events: none;
}

.mwm-gallery-slider-01__slide.is-active .mwm-gallery-slider-01__overlay {
	opacity: 1;
}

.mwm-gallery-slider-01__cta {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 0;
	text-decoration: none;
	color: #fff;
	z-index: 2;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		opacity var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing),
		visibility 0s linear var(--mwm-gallery-slider-motion-duration);
}

.mwm-gallery-slider-01__slide.is-active .mwm-gallery-slider-01__cta {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition:
		opacity var(--mwm-gallery-slider-motion-duration) var(--mwm-gallery-slider-motion-easing),
		visibility 0s;
}

.mwm-gallery-slider-01__cta-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	border: 1px solid #fff;
	background: rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

/*
 * El rótulo no tenía fondo propio: su contraste dependía de la foto que tocara.
 * Medido sobre las diez primeras fotos del Alcazaba, el blanco quedaba entre
 * 2,12 y 3,33:1 — ninguna llegaba al 4,5:1 exigido. Encima, el `a:hover`
 * general del tema lo volvía NEGRO justo al pasar el cursor, que es cuando se
 * lee, y ahí caía a 1,08:1 en las fotos oscuras. Ahora el texto va sobre su
 * propia píldora, así que el contraste ya no depende de la imagen: con el velo
 * del slide (0.3) más este 0.55, el peor caso posible —foto blanca pura— deja
 * el fondo en 80/255 y el blanco en 7,8:1.
 */
.mwm-gallery-slider-01__cta-label {
	font-size: 0.9375rem;
	font-weight: 600;
	text-align: center;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
	max-width: 12rem;
	padding: 0.375rem 0.875rem;
	background: rgba(0, 0, 0, 0.55);
	border-radius: 624.9375rem;
}

/* El color del rótulo lo fija el bloque, no el `a:hover` del tema. */
.mwm-gallery-slider-01__cta,
.mwm-gallery-slider-01__cta:hover,
.mwm-gallery-slider-01__cta:focus,
.mwm-gallery-slider-01__cta:focus-visible {
	color: #fff;
}

.mwm-gallery-slider-01__nav {
	flex-shrink: 0;
	height: 1.5rem;
	padding: 0;
	border: none;
	border-radius: 0;
	background: transparent;
	color: #111;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
	z-index: 3;
}

.mwm-gallery-slider-01__nav:not(:disabled):hover {
	background: #fff;
	transform: scale(1.04);
}

.mwm-gallery-slider-01__nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

.mwm-gallery-slider-01__nav:disabled:hover {
	transform: none;
	background: transparent;
}

.mwm-gallery-slider-01__nav:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (max-width: 768px) {
	.mwm-gallery-slider-01 {
		--mwm-gallery-slide-compact: 240px;
		--mwm-gallery-slide-featured: 360px;
	}

	.mwm-gallery-slider-01__decor {
		display: none;
	}

	.mwm-gallery-slider-01__stage {
		gap: 4px;
	}

	.mwm-gallery-slider-01__nav {
		width: 24px;
		height: 24px;
	}

	.mwm-gallery-slider-01__inner {
		padding-top: 40px;
		padding-bottom: 48px;
	}
}

/* Editor: slide activo primero a la izquierda; proporciones ~frontend (+ gaps). */
.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__track {
	transform: none !important;
	width: 100% !important;
	transition: none !important;
}

.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide {
	flex-shrink: 0;
	cursor: default;
	flex: 0 0 82%;
	max-width: 82%;
	width: auto;
}

.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide.is-active {
	flex: 0 0 82%;
	max-width: 82%;
}

@media (min-width: 768px) and (max-width: 1023px) {

	.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide,
	.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide.is-active {
		flex: 0 0 calc((100% - 16px) / 2);
		max-width: calc((100% - 16px) / 2);
	}
}

@media (min-width: 1024px) {
	.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide {
		flex: 0 0 calc((100% - 32px) * 0.2354);
		max-width: calc((100% - 32px) * 0.2354);
	}

	.mwm-gallery-slider-01__viewport--editor .mwm-gallery-slider-01__slide.is-active {
		flex: 0 0 calc((100% - 32px) * 0.49);
		max-width: calc((100% - 32px) * 0.49);
		width: auto;
	}
}

/*
 * Solo editor (clase añadida en edit.js): Gutenberg inyecta reglas globales para img
 * que rompen height:100% + object-fit en los slides.
 */
.mwm-gallery-slider-01--editor .mwm-gallery-slider-01__slide>.mwm-gallery-slider-01__image {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
}

.mwm-gallery-slider-01--editor .mwm-gallery-slider-01__cta-icon svg {
	display: block;
	width: 25px;
	height: 17px;
	flex-shrink: 0;
}

.mwm-gallery-slider-01--editor .mwm-gallery-slider-01__nav {
	min-width: 40px;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.mwm-gallery-slider-01--editor .mwm-gallery-slider-01__nav svg {
	display: block;
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}
/*
 * Vista 360 (K29). Se pinta solo cuando el espacio tiene URL de tour, debajo
 * del carrusel y dentro del mismo ancho, para que se lea como parte de la
 * galería y no como una sección suelta. El iframe va en un contenedor con
 * proporción fija: Google sirve el visor sin alto propio, así que sin esto
 * colapsa a 150px.
 */
.mwm-gallery-slider-01__tour {
	margin-top: clamp(40px, 6vw, 72px);
}

.mwm-gallery-slider-01__tour-heading {
	margin: 0 0 clamp(16px, 2.5vw, 24px);
	font-size: clamp(1.25rem, 2.5vw, 1.75rem);
	line-height: 1.2;
	font-weight: 700;
}

.mwm-gallery-slider-01__tour-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	min-height: 320px;
	border-radius: 16px;
	overflow: hidden;
	background: #1a1a1a;
}

.mwm-gallery-slider-01__tour-iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

@media (max-width: 768px) {
	.mwm-gallery-slider-01__tour-frame {
		aspect-ratio: 4 / 3;
		border-radius: 12px;
	}
}
