/**
 * AlVilla Galleries – estilos compartidos: elementos, capas, filtros, botón
 * "Cargar más", play y lightbox.
 *
 * Nota Hello Elementor: su reset pinta todos los <button> en #c36 (borde, texto
 * y fondo al pasar el cursor). Por eso cada botón del plugin define aquí borde,
 * fondo y color explícitos, también en :hover y :focus.
 */

/* ------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------- */
.alg-gallery,
.alg-carousel {
	--alg-ink: #111827;
	--alg-muted: #6b7280;
	--alg-line: rgba(17, 24, 39, 0.14);
	--alg-surface: rgba(17, 24, 39, 0.06);
	--alg-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------------
 * Elemento
 * ---------------------------------------------------------------- */
.alg-item {
	margin: 0;
	min-width: 0;
}

.alg-item.is-filtered-out,
.alg-item.is-paged-out {
	display: none;
}

.alg-media {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--alg-radius, 0);
	background: var(--alg-surface);
	color: inherit;
	text-decoration: none;
	isolation: isolate;
	transition: transform 0.35s var(--alg-ease), box-shadow 0.35s var(--alg-ease), opacity 0.3s ease;
}

a.alg-media {
	cursor: zoom-in;
}

a.alg-media--video,
.alg-media[data-alg-play] {
	cursor: pointer;
}

.alg-media:focus-visible {
	outline: 2px solid var(--alg-ink);
	outline-offset: 3px;
}

.alg-media .alg-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: transform 0.6s var(--alg-ease), filter 0.4s ease;
}

/* Capa con texto sobre la imagen */
.alg-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: flex-end;
	background: linear-gradient(to top, var(--alg-overlay, rgba(0, 0, 0, 0.62)), transparent 65%);
	color: #fff;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.alg-caption-hover .alg-overlay {
	opacity: 0;
}

.alg-caption-hover .alg-media:hover .alg-overlay,
.alg-caption-hover .alg-media:focus-visible .alg-overlay {
	opacity: 1;
}

/* En pantallas táctiles no hay "hover": el texto se muestra siempre. */
@media (hover: none) {
	.alg-caption-hover .alg-overlay {
		opacity: 1;
	}
}

.alg-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	padding: 14px 16px;
	box-sizing: border-box;
}

.alg-overlay .alg-text {
	transform: translateY(6px);
	transition: transform 0.35s var(--alg-ease);
}

.alg-media:hover .alg-overlay .alg-text,
.alg-caption-always .alg-overlay .alg-text {
	transform: none;
}

figcaption.alg-text,
.alg-slide > .alg-text {
	padding: 10px 2px 0;
}

.alg-title {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.35;
}

.alg-desc {
	font-size: 13px;
	line-height: 1.45;
	opacity: 0.8;
}

figcaption.alg-text .alg-desc,
.alg-slide > .alg-text .alg-desc {
	color: var(--alg-muted);
	opacity: 1;
}

/* ------------------------------------------------------------------
 * Efectos al pasar el cursor (clase en el widget: alg-hover-*)
 * ---------------------------------------------------------------- */
@media (hover: hover) {
	.alg-hover-zoom .alg-media:hover .alg-img {
		transform: scale(1.06);
	}

	.alg-hover-lift .alg-media:hover {
		transform: translateY(-4px);
		box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.35);
	}

	.alg-hover-grayscale .alg-media .alg-img {
		filter: grayscale(1);
	}

	.alg-hover-grayscale .alg-media:hover .alg-img {
		filter: none;
	}

	.alg-hover-dim .alg-items:hover .alg-media:not(:hover),
	.alg-hover-dim .swiper-wrapper:hover .alg-media:not(:hover) {
		opacity: 0.45;
	}
}

/* ------------------------------------------------------------------
 * Botón de play y reproductor en el sitio
 * ---------------------------------------------------------------- */
.alg-play {
	--size: var(--alg-play-size, 64px);
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: var(--size);
	height: var(--size);
	margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--alg-play-bg, rgba(0, 0, 0, 0.55));
	color: var(--alg-play-color, #fff);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
	transition: transform 0.25s var(--alg-ease), background-color 0.25s ease;
	pointer-events: none;
}

.alg-play svg {
	width: 42%;
	height: 42%;
	margin-left: 6%; /* Centrado óptico del triángulo */
}

.alg-media:hover .alg-play {
	transform: scale(1.08);
}

.alg-media.is-playing {
	cursor: default;
}

.alg-media.is-playing .alg-play,
.alg-media.is-playing .alg-overlay {
	display: none;
}

.alg-media .alg-player {
	position: absolute;
	inset: 0;
	z-index: 3;
	width: 100%;
	height: 100%;
	border: 0;
	background: #000;
}

/* ------------------------------------------------------------------
 * Filtros
 * ---------------------------------------------------------------- */
.alg-gallery .alg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 24px;
}

.alg-gallery .alg-filter,
.alg-gallery .alg-filter:focus {
	appearance: none;
	margin: 0;
	padding: 8px 16px;
	border: 1px solid var(--alg-line);
	border-radius: 999px;
	background: transparent;
	color: var(--alg-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.alg-gallery .alg-filter:hover {
	background: var(--alg-surface);
	color: var(--alg-ink);
	border-color: var(--alg-line);
}

.alg-gallery .alg-filter.is-active {
	background: var(--alg-ink);
	color: #fff;
	border-color: var(--alg-ink);
}

.alg-gallery .alg-filter:focus-visible {
	outline: 2px solid var(--alg-ink);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------
 * Cargar más
 * ---------------------------------------------------------------- */
.alg-more {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

.alg-more[hidden] {
	display: none;
}

.alg-gallery .alg-more__btn,
.alg-gallery .alg-more__btn:focus,
.alg-gallery .alg-more__btn:hover {
	appearance: none;
	margin: 0;
	padding: 12px 28px;
	border: 1px solid var(--alg-ink);
	border-radius: 999px;
	background: var(--alg-ink);
	color: #fff;
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: transform 0.15s ease, opacity 0.2s ease;
}

.alg-gallery .alg-more__btn:hover {
	opacity: 0.88;
}

.alg-gallery .alg-more__btn:active {
	transform: scale(0.97);
}

.alg-gallery .alg-more__btn:focus-visible {
	outline: 2px solid var(--alg-ink);
	outline-offset: 3px;
}

/* Entrada de elementos al filtrar o cargar más */
@keyframes alg-enter {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
}

.alg-item.alg-enter {
	animation: alg-enter 0.45s var(--alg-ease) both;
}

/* Aviso en el editor cuando el widget está vacío */
.alg-empty {
	padding: 24px;
	border: 1px dashed var(--alg-line, rgba(0, 0, 0, 0.2));
	border-radius: 8px;
	color: #6b7280;
	font-size: 14px;
	text-align: center;
}

/* ------------------------------------------------------------------
 * Lightbox
 * ---------------------------------------------------------------- */
html.alg-lb-open {
	overflow: hidden;
}

html.alg-lb-open body {
	padding-right: var(--alg-scrollbar, 0);
}

.alg-lb {
	--lb-bg: rgba(10, 10, 12, 0.94);
	--lb-fg: #f5f5f5;
	--lb-btn-hover: rgba(255, 255, 255, 0.12);
	--lb-nav-bg: rgba(0, 0, 0, 0.35);
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	background: var(--lb-bg);
	color: var(--lb-fg);
	font-family: inherit;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.alg-lb--light {
	--lb-bg: rgba(250, 250, 250, 0.97);
	--lb-fg: #111827;
	--lb-btn-hover: rgba(0, 0, 0, 0.07);
	--lb-nav-bg: rgba(255, 255, 255, 0.7);
}

.alg-lb[hidden] {
	display: none;
}

.alg-lb.is-open {
	opacity: 1;
}

.alg-lb__top {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 10px 0 18px;
}

.alg-lb__counter {
	flex: 1;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	opacity: 0.75;
}

.alg-lb .alg-lb__btn,
.alg-lb .alg-lb__btn:focus,
.alg-lb .alg-lb__btn:hover {
	appearance: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--lb-fg);
	cursor: pointer;
	opacity: 0.85;
	text-decoration: none;
	transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.alg-lb .alg-lb__btn:hover {
	opacity: 1;
	background: var(--lb-btn-hover);
}

.alg-lb .alg-lb__btn:active {
	transform: scale(0.94);
}

.alg-lb .alg-lb__btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.alg-lb .alg-lb__btn[hidden] {
	display: none;
}

.alg-lb .alg-lb__nav,
.alg-lb .alg-lb__nav:focus,
.alg-lb .alg-lb__nav:hover {
	position: absolute;
	top: 50%;
	width: 52px;
	height: 52px;
	margin-top: -26px;
	background: var(--lb-nav-bg);
}

.alg-lb__nav--prev {
	left: 12px;
}

.alg-lb__nav--next {
	right: 12px;
}

.alg-lb__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 12px 80px;
	touch-action: pan-y pinch-zoom;
}

.alg-lb__stage > * {
	transition: transform 0.25s var(--alg-ease, ease), opacity 0.2s ease;
}

.alg-lb__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	animation: alg-lb-in 0.3s ease both;
}

.alg-lb__stage.is-loading .alg-lb__img {
	opacity: 0;
}

.alg-lb__stage.is-loading::after {
	content: "";
	position: absolute;
	width: 32px;
	height: 32px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0.6;
	animation: alg-spin 0.8s linear infinite;
}

.alg-lb__video {
	width: min(100%, calc((100vh - 170px) * 16 / 9));
	aspect-ratio: 16 / 9;
	background: #000;
	animation: alg-lb-in 0.3s ease both;
}

.alg-lb__video--file {
	width: auto;
	aspect-ratio: auto;
	background: transparent;
}

.alg-lb__video .alg-player {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.alg-lb__video--file .alg-player {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 170px);
}

.alg-lb__caption {
	max-width: 820px;
	margin: 0 auto;
	padding: 10px 20px 22px;
	font-size: 15px;
	line-height: 1.5;
	text-align: center;
	opacity: 0.9;
}

.alg-lb__caption[hidden] {
	display: block;
	visibility: hidden;
	min-height: 1.5em;
}

@keyframes alg-lb-in {
	from {
		opacity: 0;
		transform: scale(0.98);
	}
}

@keyframes alg-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 767px) {
	.alg-lb__stage {
		padding: 8px;
	}

	.alg-lb .alg-lb__nav,
	.alg-lb .alg-lb__nav:focus,
	.alg-lb .alg-lb__nav:hover {
		top: auto;
		bottom: 14px;
		margin-top: 0;
		width: 44px;
		height: 44px;
	}

	.alg-lb__caption {
		padding: 10px 64px 22px;
		font-size: 14px;
	}
}

/* ------------------------------------------------------------------
 * Movimiento reducido
 * ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.alg-media,
	.alg-media .alg-img,
	.alg-overlay,
	.alg-overlay .alg-text,
	.alg-play,
	.alg-lb,
	.alg-lb__stage > * {
		transition: none;
	}

	.alg-item.alg-enter,
	.alg-lb__img,
	.alg-lb__video {
		animation: none;
	}

	.alg-hover-zoom .alg-media:hover .alg-img,
	.alg-hover-lift .alg-media:hover {
		transform: none;
	}
}

/* ==================================================================
 * Efectos al pasar el cursor (nuevos)
 * ================================================================== */
@media (hover: hover) {
	/* Desenfocar el resto */
	.alg-hover-blur .alg-media .alg-img {
		transition: filter 0.4s ease, transform 0.6s var(--alg-ease);
	}

	.alg-hover-blur .alg-items:hover .alg-media:not(:hover) .alg-img,
	.alg-hover-blur .swiper-wrapper:hover .alg-media:not(:hover) .alg-img {
		filter: blur(3px) saturate(0.7);
	}

	/* Zoom con giro */
	.alg-hover-zoomrot .alg-media:hover .alg-img {
		transform: scale(1.12) rotate(2deg);
	}

	/* Destello que cruza la imagen */
	.alg-hover-shine .alg-media::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 2;
		pointer-events: none;
		background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
		transform: translateX(-120%);
	}

	.alg-hover-shine .alg-media:hover::after {
		transform: translateX(120%);
		transition: transform 0.9s var(--alg-ease);
	}

	/* El texto sube desde abajo */
	.alg-hover-slide.alg-caption-hover .alg-overlay {
		opacity: 1;
		transform: translateY(101%);
		transition: transform 0.45s var(--alg-ease);
	}

	.alg-hover-slide.alg-caption-hover .alg-media:hover .alg-overlay,
	.alg-hover-slide.alg-caption-hover .alg-media:focus-visible .alg-overlay {
		transform: none;
	}

	/* Máscara circular: la capa con el texto se abre desde el centro */
	.alg-hover-mask .alg-overlay {
		align-items: center;
		justify-content: center;
		background: var(--alg-overlay, rgba(0, 0, 0, 0.62));
		text-align: center;
		opacity: 1;
		clip-path: circle(0% at 50% 50%);
		transition: clip-path 0.55s var(--alg-ease);
	}

	.alg-hover-mask .alg-media:hover .alg-overlay,
	.alg-hover-mask .alg-media:focus-visible .alg-overlay {
		clip-path: circle(75% at 50% 50%);
	}

	.alg-hover-mask .alg-media:hover .alg-img {
		transform: scale(1.05);
	}

	/* Inclinación 3D (el JS escribe --alg-rx / --alg-ry) */
	.alg-hover-tilt .alg-media {
		transform: perspective(900px) rotateX(var(--alg-rx, 0deg)) rotateY(var(--alg-ry, 0deg));
		transition: transform 0.25s ease-out, box-shadow 0.3s ease;
		will-change: transform;
	}

	.alg-hover-tilt .alg-media:hover {
		box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.4);
	}
}

/* ==================================================================
 * Animación de entrada al hacer scroll (el JS añade .alg-js y .is-inview)
 * Sin JS no se oculta nada.
 * ================================================================== */
.alg-js[class*="alg-entrance-"] .alg-item,
.alg-entrance-fadeup .alg-js .alg-item,
.alg-entrance-zoom .alg-js .alg-item,
.alg-entrance-blur .alg-js .alg-item,
.alg-entrance-mask .alg-js .alg-item {
	transition:
		opacity 0.7s ease,
		transform 0.8s var(--alg-ease),
		filter 0.7s ease,
		clip-path 0.9s var(--alg-ease);
	transition-delay: calc(var(--alg-order, 0) * var(--alg-stagger, 70ms));
}

.alg-entrance-fadeup .alg-js .alg-item:not(.is-inview) {
	opacity: 0;
	transform: translate3d(0, 34px, 0);
}

.alg-entrance-zoom .alg-js .alg-item:not(.is-inview) {
	opacity: 0;
	transform: scale(0.9);
}

.alg-entrance-blur .alg-js .alg-item:not(.is-inview) {
	opacity: 0;
	filter: blur(14px);
}

.alg-entrance-mask .alg-js .alg-item:not(.is-inview) {
	clip-path: inset(100% 0 0 0);
	transform: translate3d(0, 20px, 0);
}

.alg-entrance-mask .alg-js .alg-item.is-inview {
	clip-path: inset(0 0 0 0);
}

/* ==================================================================
 * Lightbox: miniaturas, zoom, presentación
 * ================================================================== */
.alg-lb.has-thumbs {
	grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.alg-lb__thumbs {
	display: flex;
	gap: 8px;
	justify-content: safe center;
	padding: 6px 16px 14px;
	overflow-x: auto;
	scrollbar-width: none;
}

.alg-lb__thumbs::-webkit-scrollbar {
	display: none;
}

.alg-lb__thumbs[hidden] {
	display: none;
}

.alg-lb .alg-lb__thumb {
	flex: 0 0 64px;
	width: 64px;
	height: 64px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: 8px;
	background: rgba(127, 127, 127, 0.2);
	cursor: pointer;
	opacity: 0.5;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.alg-lb .alg-lb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.alg-lb .alg-lb__thumb:hover {
	opacity: 0.85;
}

.alg-lb .alg-lb__thumb.is-active {
	border-color: var(--lb-fg);
	opacity: 1;
}

.alg-lb .alg-lb__thumb:focus-visible {
	outline: 2px solid var(--lb-fg);
	outline-offset: 2px;
}

.alg-lb__stage.can-zoom .alg-lb__img {
	cursor: zoom-in;
}

.alg-lb__stage.is-zoomed {
	overflow: hidden;
}

.alg-lb__stage.is-zoomed .alg-lb__img {
	cursor: zoom-out;
	transform: scale(2.2);
	transition: transform 0.35s var(--alg-ease, ease);
}

.alg-lb__progress {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 3px;
	background: rgba(127, 127, 127, 0.25);
}

.alg-lb__progress[hidden] {
	display: none;
}

.alg-lb__progress span {
	display: block;
	height: 100%;
	background: var(--lb-fg);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

.alg-lb__progress.is-running span {
	animation: alg-lb-progress var(--alg-lb-ms, 3500ms) linear forwards;
}

@keyframes alg-lb-progress {
	to {
		transform: scaleX(1);
	}
}

@media (max-width: 767px) {
	.alg-lb .alg-lb__thumb {
		flex-basis: 48px;
		width: 48px;
		height: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.alg-js .alg-item {
		opacity: 1 !important;
		transform: none !important;
		filter: none !important;
		clip-path: none !important;
		transition: none !important;
	}

	.alg-hover-tilt .alg-media,
	.alg-hover-shine .alg-media::after {
		transform: none !important;
	}
}
