/* Homiture Gallery — mosaico MASONRY equilibrado + scroll REST + CTA post-it.
   2026-08-20: se quitó la barra de filtros. El mosaico se puebla por FORMATO:
   cada casilla se pinta horizontal (3:2), vertical (2:3) o cuadrada (1:1) según
   data-orient, y la foto se encaja con object-fit:cover. */

.hg-wrap,
.hg-style-card {
	--hg-gap: 10px;
	--hg-primary: var(--wp--preset--color--primary, #30877c);
	--hg-primary-dark: #266b62;
	--hg-accent: var(--wp--preset--color--accent, #eba607);
	--hg-border: var(--wp--preset--color--border, #e3e0d8);
	--hg-text: var(--wp--preset--color--text, #222826);
	--hg-muted: var(--wp--preset--color--muted, #6b736f);
	--hg-dark: #1f2a28;
}
.hg-wrap { width: 100%; }

/* ============================================================
   MOSAICO masonry por columnas equilibradas (JS)
   ============================================================ */
.hg-mosaic.is-balanced {
	display: flex;
	gap: var(--hg-gap);
	align-items: flex-start;
	position: relative; z-index: 1;
}
.hg-col {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--hg-gap);
}

/* Fallback SIN JS: columnas CSS */
.hg-mosaic:not(.is-balanced) {
	column-count: 3;
	column-gap: var(--hg-gap);
	position: relative; z-index: 1;
}
@media (min-width: 1600px) { .hg-mosaic:not(.is-balanced) { column-count: 4; } }
@media (max-width: 768px)  { .hg-mosaic:not(.is-balanced) { column-count: 2; } }
@media (max-width: 430px)  { .hg-mosaic:not(.is-balanced) { column-count: 1; } }

.hg-item {
	display: block;
	width: 100%;
	margin: 0 0 var(--hg-gap);       /* fallback; en flex manda el gap */
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	overflow: hidden;
	border-radius: 10px;
	background: var(--hg-border);
	cursor: pointer;
	line-height: 0;
	position: relative;
}
.hg-mosaic.is-balanced .hg-item { margin: 0; }

/* ============================================================
   FORMATOS. Los tres valores de data-orient que manda el servidor.
   Cambiar aquí una proporción obliga a cambiarla también en
   homiture_orient_formats() (PHP) y en FORMAT_RATIO (gallery.js):
   el JS necesita el mismo número para equilibrar las columnas.
   ============================================================ */
.hg-item--h { aspect-ratio: 3 / 2; }
.hg-item--v { aspect-ratio: 2 / 3; }
.hg-item--s { aspect-ratio: 1 / 1; }

.hg-img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: center;
	transition: transform .45s ease, filter .3s ease;
}
/* Sin formato (por si llegara un item viejo sin data-orient): proporción real. */
.hg-item:not([data-orient]) .hg-img { height: auto; object-fit: fill; }

.hg-item:hover .hg-img { transform: scale(1.05); }

.hg-item::after {
	content: "";
	position: absolute; inset: 0;
	background: linear-gradient(180deg, rgba(31,42,40,0) 55%, rgba(31,42,40,.28) 100%);
	opacity: 0; transition: opacity .3s ease;
	pointer-events: none;
}
.hg-item:hover::after { opacity: 1; }

.hg-empty { text-align: center; color: var(--hg-muted); padding: 48px 0; font-size: 16px; }
.hg-item:focus-visible { outline: 2px solid var(--hg-accent); outline-offset: 2px; }

@media (max-width: 768px) {
	.hg-wrap { --hg-gap: 8px; }
	.hg-item:hover .hg-img { transform: none; }
	.hg-item:hover::after { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.hg-img { transition: none; }
	.hg-item:hover .hg-img { transform: none; }
}

/* ============================================================
   Scroll infinito: centinela / spinner (solo gira con petición en curso)
   ============================================================ */
.hg-sentinel {
	width: 100%; min-height: 56px; margin-top: var(--hg-gap);
	display: flex; justify-content: center; align-items: center;
}
.hg-sentinel[hidden] { display: none; }
.hg-spinner {
	width: 26px; height: 26px; margin: 14px 0;
	border: 3px solid var(--hg-border);
	border-top-color: var(--hg-primary);
	border-radius: 50%;
	opacity: 0;
	animation: none;
}
.hg-sentinel.is-loading .hg-spinner {
	opacity: 1;
	animation: hg-spin .8s linear infinite;
}
@keyframes hg-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Lightbox (Spotlight): fondo negro al 90% — se entrevé la página
   ============================================================ */
#spotlight {
	background-color: rgba(0, 0, 0, 0.9) !important;
}

/* ============================================================
   Tarjeta "Find Your Style"
   Desktop: tarjeta flotante con foto (abajo-izquierda).
   Móvil: pestaña POST-IT compacta pegada al borde izquierdo.
   (El JS la cuelga de <body>; las vars --hg-* están definidas arriba
   también para .hg-style-card por esa razón.)
   ============================================================ */
.hg-style-card {
	display: block;
	position: fixed; z-index: 95;
	background: #fff; border-radius: 16px; overflow: hidden;
	box-shadow: 0 16px 40px rgba(31,42,40,.28);
	border: 1px solid var(--hg-border);
	animation: hg-card-in .35s cubic-bezier(.2,.8,.2,1) both;
}
.hg-style-card.is-closed { display: none !important; }
@keyframes hg-card-in {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}
.hg-style-card__media { height: 130px; background-size: cover; background-position: center; }
.hg-style-card__body { padding: 16px 18px 18px; }
.hg-style-card__title { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--hg-text); line-height: 1.25; }
.hg-style-card__sub { margin: 0 0 14px; font-size: 13px; color: var(--hg-muted); line-height: 1.45; }

/* Boton BLINDADO: colores forzados en todos los estados */
a.hg-style-card__btn,
a.hg-style-card__btn:link,
a.hg-style-card__btn:visited,
a.hg-style-card__btn:hover,
a.hg-style-card__btn:focus,
a.hg-style-card__btn:active {
	display: inline-block; text-decoration: none !important;
	background-color: var(--hg-primary) !important; color: #fff !important;
	font-size: 14px; font-weight: 600;
	padding: 10px 22px; border-radius: 999px; border: 0 !important;
	box-shadow: none !important;
	transition: background-color .2s ease;
}
a.hg-style-card__btn:hover { background-color: var(--hg-primary-dark) !important; }

.hg-style-card__close {
	position: absolute; top: 8px; right: 8px; z-index: 2;
	width: 32px; height: 32px; border: 0; border-radius: 50%;
	background: rgba(31,42,40,.55); color: #fff; font-size: 20px; line-height: 1;
	cursor: pointer; display: flex; align-items: center; justify-content: center;
	transition: background .2s ease;
}
.hg-style-card__close:hover { background: rgba(31,42,40,.8); }

/* Desktop: tarjeta completa abajo-izquierda */
@media (min-width: 769px) {
	.hg-style-card { left: 24px; bottom: 24px; width: 300px; }
}

/* Móvil: PESTAÑA POST-IT pegada al borde izquierdo */
@media (max-width: 768px) {
	.hg-style-card {
		left: 0; right: auto; bottom: 104px;   /* despegada del borde inferior, como pestaña */
		width: auto; max-width: 240px;
		background: var(--hg-primary);
		border: 0; border-radius: 0 14px 14px 0;
		box-shadow: 0 10px 26px rgba(31,42,40,.35);
	}
	.hg-style-card__media { display: none; }
	.hg-style-card__sub { display: none; }
	.hg-style-card__body { padding: 12px 14px 14px; }
	.hg-style-card__title { color: #fff; font-size: 14px; margin-bottom: 10px; padding-right: 20px; }
	a.hg-style-card__btn,
	a.hg-style-card__btn:link,
	a.hg-style-card__btn:visited,
	a.hg-style-card__btn:hover,
	a.hg-style-card__btn:focus,
	a.hg-style-card__btn:active {
		background-color: var(--hg-accent) !important; color: var(--hg-dark) !important;
		font-size: 13px; padding: 8px 16px;
	}
	.hg-style-card__close {
		top: 4px; right: 4px; width: 26px; height: 26px; font-size: 16px;
		background: rgba(255,255,255,.22);
	}
	.hg-style-card__close:hover { background: rgba(255,255,255,.35); }
}
