/* ==========================================================================
   La Heroica Toolkit — Galerías Flickr
   ========================================================================== */

.lht-flickr-gallery {
	display: grid;
	/* Miniaturas compactas: cada columna se topa en --lht-tile (no crece más),
	   pero puede encoger si el contenedor es estrecho (nunca desborda).
	   --lht-cols sigue marcando el máximo de columnas. */
	grid-template-columns: repeat(var(--lht-cols, 4), minmax(0, var(--lht-tile, 160px)));
	justify-content: center;
	gap: 8px;
	margin: 1.5rem 0;
}
.lht-flickr-item {
	display: block;
	overflow: hidden;
	border-radius: 4px;
	background: #6e1d08;
	line-height: 0;
	box-shadow: 0 4px 12px rgba(63, 12, 17, 0.12);
}
.lht-flickr-item img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease, opacity 0.2s ease;
}
.lht-flickr-gallery.is-lightbox .lht-flickr-item {
	cursor: zoom-in;
}
.lht-flickr-item:hover img {
	transform: scale(1.06);
}

/* Botón «Cargar más» */
.lht-flickr-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 1.5rem;
}
.lht-flickr-more__btn {
	appearance: none;
	border: 0;
	cursor: pointer;
	padding: 0.65rem 1.6rem;
	border-radius: 999px;
	background: #6e1d08;
	color: #FFFFFF;
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.02em;
	box-shadow: 0 4px 12px rgba(63, 12, 17, 0.18);
	transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}
.lht-flickr-more__btn:hover {
	background: #8a2a0d;
	transform: translateY(-1px);
}
.lht-flickr-more__btn:disabled {
	opacity: 0.6;
	cursor: progress;
	transform: none;
}
.lht-flickr-more__msg {
	margin: 0;
	font-size: 0.9rem;
	color: #6e1d08;
	opacity: 0.75;
	text-align: center;
}

/* Índice de álbumes */
.lht-flickr-albums {
	display: grid;
	/* Cada columna se topa en --lht-album-tile (no se estira sin límite) pero puede
	   encoger en contenedores estrechos. --lht-cols marca el máximo de columnas. */
	grid-template-columns: repeat(var(--lht-cols, 4), minmax(0, var(--lht-album-tile, 240px)));
	justify-content: center;
	gap: 1.2rem;
	margin: 1.5rem 0;
}
.lht-flickr-album {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 6px 18px rgba(63, 12, 17, 0.1);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lht-flickr-album:hover {
	transform: translateY(-4px);
	box-shadow: 0 16px 32px rgba(63, 12, 17, 0.18);
}
.lht-flickr-album[data-lht-album] {
	cursor: zoom-in;
}
/* Mientras se piden las fotos del álbum para el lightbox. */
.lht-flickr-album.is-loading {
	pointer-events: none;
	opacity: 0.75;
}
.lht-flickr-album.is-loading .lht-flickr-album__img {
	position: relative;
}
.lht-flickr-album.is-loading .lht-flickr-album__img::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	animation: lht-flickr-spin 0.7s linear infinite;
}
@keyframes lht-flickr-spin {
	to {
		transform: rotate(360deg);
	}
}
.lht-flickr-album__img {
	display: block;
	line-height: 0;
	background: #6e1d08;
}
.lht-flickr-album__img img {
	width: 100%;
	/* Altura: por defecto la marca la proporción 4/3; si se define --lht-cover-h
	   (config «altura de portada»), esa altura fija manda. */
	height: var(--lht-cover-h, auto);
	aspect-ratio: 4 / 3;
	object-fit: cover;
	display: block;
}
.lht-flickr-album__title {
	font-weight: 700;
	padding: 0.7rem 0.9rem 0.2rem;
	line-height: 1.25;
}
.lht-flickr-album__count {
	padding: 0 0.9rem 0.9rem;
	font-size: 0.85rem;
	opacity: 0.65;
}

/* Colecciones (cada una con su grilla de álbumes) */
.lht-flickr-collection {
	margin: 2rem 0;
}
.lht-flickr-collection .lht-flickr-collection {
	margin: 1.4rem 0 1.4rem 0;
}
.lht-flickr-collection__title {
	margin: 0 0 0.3rem;
	color: #6e1d08;
	line-height: 1.2;
	/* Tamaño propio (no hereda el h2/h3 del tema, que suele ser enorme);
	   ajustable con --lht-collection-title. */
	font-size: var(--lht-collection-title, 1.4rem);
	font-weight: 700;
}
.lht-flickr-collection .lht-flickr-collection .lht-flickr-collection__title {
	font-size: calc(var(--lht-collection-title, 1.4rem) * 0.8);
	opacity: 0.9;
}
.lht-flickr-collection__desc {
	margin: 0 0 0.8rem;
	opacity: 0.75;
	font-size: 0.92rem;
}
.lht-flickr-collection .lht-flickr-albums {
	margin: 0.6rem 0 1rem;
}

/* Vista de un álbum abierto en el sitio (?lht_album=ID) */
.lht-flickr-albumview__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 1rem 0 0.2rem;
}
.lht-flickr-back {
	display: inline-block;
	text-decoration: none;
	font-weight: 700;
	color: #6e1d08;
	transition: opacity 0.15s ease;
}
.lht-flickr-back:hover {
	opacity: 0.7;
}
.lht-flickr-extlink {
	font-size: 0.85rem;
	text-decoration: none;
	color: #6e1d08;
	opacity: 0.7;
}
.lht-flickr-extlink:hover {
	opacity: 1;
}
.lht-flickr-albumview__title {
	margin: 0.2rem 0 0;
	color: #6e1d08;
}

.lht-flickr-notice {
	padding: 0.6rem 0.9rem;
	background: #EFEFEF;
	border-left: 3px solid #c3360e;
	color: #6e1d08;
	font-size: 0.9rem;
}

@media (max-width: 782px) {
	.lht-flickr-gallery {
		grid-template-columns: repeat(min(var(--lht-cols, 4), 3), minmax(0, var(--lht-tile, 160px)));
	}
	.lht-flickr-albums {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (max-width: 480px) {
	.lht-flickr-gallery {
		grid-template-columns: repeat(2, 1fr);
	}
	.lht-flickr-albums {
		grid-template-columns: 1fr;
	}
}

/* --------------------------------------------------------------------------
   Lightbox propio
   -------------------------------------------------------------------------- */
.lht-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(18, 5, 3, 0.92);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.28s ease, visibility 0.28s ease;
}
.lht-lb.is-open {
	opacity: 1;
	visibility: visible;
}
.lht-lb__stage {
	position: relative;
	max-width: 92vw;
	max-height: 84vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.9rem;
}
.lht-lb__img {
	max-width: 92vw;
	max-height: 78vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
	background: #2e0c04;
	opacity: 0;
	transform: scale(0.985);
	transition: opacity 0.35s ease, transform 0.35s ease;
}
.lht-lb__img.is-loaded {
	opacity: 1;
	transform: none;
}
/* Spinner mientras carga la imagen grande. */
.lht-lb.is-loading .lht-lb__stage::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #FFFFFF;
	animation: lht-flickr-spin 0.7s linear infinite;
	pointer-events: none;
}
.lht-lb__caption {
	color: #FFFFFF;
	font-size: 0.95rem;
	text-align: center;
	max-width: 80vw;
	min-height: 1.2em;
	opacity: 0.92;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.lht-lb__btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 3rem;
	height: 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.7rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}
.lht-lb__btn:hover {
	background: var(--lht-gold, #BA9E60);
	color: #2e0c04;
}
.lht-lb__prev {
	left: 1.2rem;
}
.lht-lb__next {
	right: 1.2rem;
}
.lht-lb__close {
	position: absolute;
	top: 1rem;
	right: 1.2rem;
	width: 2.6rem;
	height: 2.6rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}
.lht-lb__close:hover {
	background: var(--lht-gold, #BA9E60);
	color: #2e0c04;
}
.lht-lb__counter {
	position: absolute;
	top: 1.2rem;
	left: 1.4rem;
	padding: 0.25rem 0.7rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.9);
	font-size: 0.8rem;
	letter-spacing: 0.5px;
	font-variant-numeric: tabular-nums;
}
.lht-lb.is-single .lht-lb__prev,
.lht-lb.is-single .lht-lb__next,
.lht-lb.is-single .lht-lb__counter {
	display: none;
}
@media (max-width: 600px) {
	.lht-lb__prev {
		left: 0.4rem;
	}
	.lht-lb__next {
		right: 0.4rem;
	}
	.lht-lb__btn {
		width: 2.6rem;
		height: 2.6rem;
		font-size: 1.4rem;
	}
}
