/*
 * ecomNinja — directorio de tiendas (área «stores»).
 *
 * Fichas de tienda, archivo /tiendas/ y páginas de sector y de plataforma.
 * Se carga sola cuando una plantilla llama a ecomninja_ds_page( 'stores' ).
 * Solo clases `nj-stores-*`; los componentes genéricos vienen de ninja.css.
 */

/* ───────────────────────── Cabecera de la ficha ───────────────────────── */

.nj-stores-head__grid {
	display: grid;
	gap: 1.75rem;
	align-items: center;
}

@media (min-width: 900px) {
	.nj-stores-head__grid.has-shot {
		grid-template-columns: minmax(0, 1fr) minmax(0, 33rem);
		gap: clamp(2rem, 1rem + 3vw, 4rem);
	}
}

.nj-stores-head__text .nj-h1 {
	overflow-wrap: anywhere;
}

/* Marco de navegador: borde fino y una barra pequeña. Sin móviles ni sombras. */
.nj-stores-browser {
	margin: 0;
	border: 1px solid var(--nj-rule-2);
	border-radius: var(--nj-radius);
	background: var(--nj-paper);
	overflow: hidden;
}

.nj-stores-browser__bar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.75rem;
	background: var(--nj-paper-2);
	border-bottom: 1px solid var(--nj-rule);
}

.nj-stores-browser__dots {
	display: flex;
	gap: 5px;
}

.nj-stores-browser__dots i {
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 50%;
	background: var(--nj-rule-2);
}

.nj-stores-browser__url {
	flex: 1;
	min-width: 0;
	padding: 0.15rem 0.8rem;
	border: 1px solid var(--nj-rule);
	border-radius: 999px;
	background: var(--nj-paper);
	font-size: var(--nj-fs-xs);
	color: var(--nj-ink-3);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* La captura es la página entera (1280×2560): se enseña su parte de arriba. */
.nj-stores-browser__view {
	aspect-ratio: 16 / 10;
	background: var(--nj-paper-2);
	overflow: hidden;
}

@media (min-width: 900px) {
	.nj-stores-browser__view {
		aspect-ratio: 4 / 3;
	}
}

.nj-stores-browser__view img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

/* ───────────────────────── Cuerpo de la ficha ───────────────────────── */

.nj-stores-body {
	padding-block: calc(var(--nj-section) * 0.5) calc(var(--nj-section) * 0.7);
}

.nj-stores-section + .nj-stores-section {
	margin-top: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
}

.nj-stores-group {
	margin-top: 2rem;
}

.nj-stores-group > h3 {
	padding-bottom: 0.6rem;
	border-bottom: 1px solid var(--nj-ink);
}

.nj-stores-group > .nj-chips {
	margin-top: 0.85rem;
}

.nj-stores-tools {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nj-stores-tool {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) minmax(7rem, 12rem);
	gap: 0.35rem 1rem;
	align-items: center;
	padding: 0.7rem 0;
	border-bottom: 1px solid var(--nj-rule);
}

.nj-stores-tool__id {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.nj-stores-tool__name {
	font-size: var(--nj-fs-sm);
	font-weight: 640;
	overflow-wrap: anywhere;
}

.nj-stores-tool__name .nj-link {
	text-decoration-color: transparent;
}

.nj-stores-tool__name .nj-link:hover {
	text-decoration-color: var(--nj-ink);
}

.nj-stores-tool__id strong {
	color: var(--nj-ink);
	font-weight: 680;
}

.nj-stores-tool__meter {
	width: 100%;
}

@media (max-width: 599px) {
	.nj-stores-tool__meter {
		grid-column: 2 / -1;
	}
}

.nj-stores-aside > * + * {
	margin-top: 1rem;
}

.nj-stores-links {
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--nj-ink);
}

.nj-stores-links li {
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--nj-rule);
	font-size: var(--nj-fs-sm);
}

.nj-stores-claim {
	margin-top: 1.5rem;
}

/* ───────────────────────── Navegación y búsqueda ───────────────────────── */

.nj-stores-search {
	max-width: 36rem;
}

.nj-chip__n {
	color: var(--nj-ink-3);
	font-weight: 500;
}

.nj-chip--on .nj-chip__n {
	color: rgba(255, 255, 255, 0.72);
}

.nj-stores-more {
	margin-top: 0.75rem;
}

.nj-stores-more summary {
	display: inline-block;
	padding: 0.35rem 0;
	font-size: var(--nj-fs-sm);
	font-weight: 620;
	color: var(--nj-ink-2);
	cursor: pointer;
}

.nj-stores-more summary:hover {
	color: var(--nj-ink);
}

.nj-stores-more .nj-chips {
	margin-top: 0.5rem;
}

/* Leyenda del reparto de plataformas: enlace si la plataforma tiene página. */
.nj-stores-legend__item {
	--dot: var(--nj-other);
	display: inline-flex;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.45rem 0.7rem 0.45rem 0.6rem;
	border: 1px solid transparent;
	border-radius: 8px;
	color: var(--nj-ink);
	text-decoration: none;
	transition: border-color 0.15s, background-color 0.15s;
}

a.nj-stores-legend__item:hover {
	border-color: var(--nj-rule-2);
	background: var(--nj-paper);
}

.nj-stores-strong .nj-rank__row {
	grid-template-columns: 1.75rem minmax(0, 1fr) 4.5rem;
}

/* ───────────────────────── Tarjetas ───────────────────────── */

.nj-stores-grid {
	display: grid;
	gap: var(--nj-gutter);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
}

@media (min-width: 900px) {
	.nj-stores-grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.nj-stores-card {
	position: relative;
}

.nj-stores-card:hover {
	border-color: var(--nj-ink);
}

.nj-stores-card:focus-within {
	outline: 2px solid var(--nj-ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--nj-signal);
}

/* Todo el cuadro es el enlace del título. */
.nj-stores-card__link {
	color: inherit;
	text-decoration: none;
}

.nj-stores-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.nj-stores-card__link:focus-visible {
	outline: none;
	box-shadow: none;
}

.nj-stores-card:hover .nj-stores-card__link {
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.2em;
}

.nj-stores-card__initial {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 3rem;
	font-weight: 750;
	font-stretch: var(--nj-wide);
	color: var(--nj-ink-3);
}

.nj-stores-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.4rem 0.75rem;
}

/* ───────────────────────── Ajustes de área ───────────────────────── */

/* Sin la hoja base de Tailwind, los <p> traen el margen del navegador: aquí se
   separa con las utilidades nj-mt-*. Con :where() no gana a ninguna de ellas. */
:where(.nj-ds main p) {
	margin-block: 0;
}

/* La cabecera de la ficha termina en las cifras clave, que traen su propia regla. */
.nj-stores-head {
	border-bottom: 0;
	padding-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.nj-stores-head + .nj-section {
	padding-block: 0;
}

/* Capturas que no cargan: el texto alternativo, pequeño y discreto. */
.nj-stores-card__media img,
.nj-stores-browser__view img {
	font-size: var(--nj-fs-xs);
	color: var(--nj-ink-3);
}

/* «Ver más» plegable: que parezca pulsable. */
.nj-stores-more summary {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.85rem;
	border: 1px dashed var(--nj-rule-2);
	border-radius: 999px;
	list-style: none;
}

.nj-stores-more summary::-webkit-details-marker {
	display: none;
}

.nj-stores-more summary::after {
	content: "+";
	font-weight: 500;
	font-size: 1.1rem;
	line-height: 1;
	color: var(--nj-ink-3);
	transition: transform 0.2s var(--nj-ease);
}

.nj-stores-more[open] summary::after {
	transform: rotate(45deg);
}

.nj-stores-more summary:hover {
	border-color: var(--nj-ink);
}

@media (max-width: 599px) {
	.nj-stores-tool {
		grid-template-columns: auto minmax(0, 1fr);
	}
}

/* En el móvil las tarjetas pasan a fila (captura a la izquierda): 24 tiendas
   caben en una pantalla y media en vez de en cinco. */
@media (max-width: 599px) {
	.nj-stores-grid {
		gap: 0.75rem;
	}

	.nj-stores-grid .nj-stores-card {
		flex-direction: row;
	}

	.nj-stores-grid .nj-card__media {
		position: relative;
		flex: 0 0 8.75rem;
		aspect-ratio: auto;
		min-height: 7.5rem;
		border-bottom: 0;
		border-right: 1px solid var(--nj-rule);
	}

	/* La captura mide el alto de la tarjeta, no al revés. */
	.nj-stores-grid .nj-card__media img {
		position: absolute;
		inset: 0;
	}

	.nj-stores-grid .nj-card__body {
		min-width: 0;
		padding: 0.85rem 0.9rem;
		gap: 0.25rem;
	}

	.nj-stores-grid .nj-card__foot {
		padding-top: 0.35rem;
	}

	.nj-stores-card__initial {
		font-size: 2rem;
	}
}
