/* ==========================================================================
   Kamala — localizador de ópticas. Título grande con línea, búsqueda con una
   raya debajo y mapa amplio en gris. Al elegir un lugar, la lista de ópticas
   queda a la izquierda del mapa (363 de ancho en el boceto).
   ========================================================================== */

.locator {
	--map-height: clamp(380px, 56vh, 620px);
	padding-block: clamp(26px, 3.2vw, 48px) clamp(28px, 3vw, 44px);
}

.locator__title {
	padding-bottom: clamp(8px, 1vw, 14px);
	border-bottom: 1px solid var(--muted);
	/* El 7vw hace que "Encontrar una óptica" quepa en una línea en móvil. */
	font-size: clamp(1.375rem, min(7vw, 1.4rem + 3vw), 3.75rem);
	font-weight: 200;
	letter-spacing: 0.01em;
	line-height: 1.1;
	text-transform: uppercase;
}

.locator__lead {
	margin: clamp(10px, 1.1vw, 16px) 0 0;
	font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
}

/* Sin título encima, la frase va arriba del todo. */
.locator__lead--first {
	margin-top: 0;
}

/* Búsqueda ----------------------------------------------------------------- */

.locator-search {
	position: relative;
	z-index: 2;
	margin-top: clamp(20px, 2.2vw, 32px);
}

.locator-search__label {
	display: block;
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

.locator-search__row {
	display: flex;
	align-items: center;
	border-bottom: 1px solid var(--muted);
}

.locator-search__input {
	flex: 1;
	min-width: 0;
	height: 48px;
	padding: 0 6px;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--ink);
	font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
	font-weight: 300;
	appearance: none;
}

.locator-search__input:focus {
	outline: 0;
}

.locator-search__row:focus-within {
	border-bottom-color: var(--ink);
	box-shadow: 0 1px 0 var(--ink);
}

.locator-search__input::-webkit-search-cancel-button {
	display: none;
}

.locator-search__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--tap);
	height: var(--tap);
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	cursor: pointer;
}

.locator-search__submit .icon {
	width: 26px;
	height: 26px;
}

.locator-search__suggest {
	position: absolute;
	top: 100%;
	right: 0;
	left: 0;
	max-height: 340px;
	margin: 0;
	padding: 6px 0;
	overflow-y: auto;
	border: 1px solid var(--grey);
	border-top: 0;
	background: var(--paper);
	list-style: none;
}

.locator-search__option {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	min-height: var(--tap);
	padding: 10px 14px;
	font-size: 1rem;
	cursor: pointer;
}

/* Al escribir, las filas nuevas suben y aparecen una detrás de otra (Judith,
   22/10: "que vayan apareciendo por debajo las ópticas"). */
.locator-search__option.is-new {
	animation: locator-option-in 0.42s var(--ease) backwards;
	animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes locator-option-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.locator-search__option.is-new {
		animation: none;
	}
}

.locator-search__option:hover,
.locator-search__option[aria-selected="true"] {
	background: var(--surface);
}

.locator-search__kind {
	flex: none;
	font-size: 0.75rem;
	color: var(--muted);
}

/* Lista y mapa -------------------------------------------------------------- */

.locator__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	margin-top: clamp(20px, 2.4vw, 36px);
}

.locator[data-state="place"] .locator__layout {
	grid-template-columns: minmax(260px, 363fr) minmax(0, 1077fr);
	gap: 0 32px;
}

.locator__results {
	display: flex;
	flex-direction: column;
	height: var(--map-height);
	padding-right: 20px;
	border-right: 1px solid var(--line);
}

.locator__results[hidden] {
	display: none;
}

.locator__place {
	margin-top: 6px;
	font-size: 0.8125rem;
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

.locator__count {
	margin: 8px 0 0;
	font-size: 0.9375rem;
	color: var(--muted);
}

.locator__list {
	flex: 1;
	margin: clamp(14px, 1.8vw, 26px) 0 0;
	padding: 0;
	overflow-y: auto;
	list-style: none;
}

.locator-item {
	display: grid;
	grid-template-columns: 50px minmax(0, 1fr);
	padding: 22px 0 26px;
	font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1.0625rem);
	line-height: 1.5;
}

.locator-item + .locator-item {
	border-top: 1px solid var(--line);
}

.locator-item:first-child {
	padding-top: 6px;
}

.locator-item__number {
	font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
}

.locator-item__name {
	margin-bottom: 4px;
	font-size: clamp(0.9375rem, 0.9rem + 0.25vw, 1.125rem);
	font-weight: 400;
	letter-spacing: 0.06em;
	line-height: 1.35;
	text-transform: uppercase;
}

.locator-item.is-selected .locator-item__name {
	font-weight: 600;
}

.locator-item p {
	margin: 0;
}

.locator-item__view,
.locator-card__route {
	display: inline-block;
	margin-top: 18px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
	text-decoration: none; /* subrayado solo al pasar el cursor (Luca, 17/10) */
	text-transform: uppercase;
	text-underline-offset: 0.4em;
	cursor: pointer;
}

.locator-item__view:hover,
.locator-card__route:hover {
	text-decoration: underline;
}

.locator__hint {
	margin: 12px 0 0;
	font-size: 0.75rem;
	color: var(--muted);
}

.locator__map-wrap {
	position: relative;
	z-index: 0;
	isolation: isolate;
	min-width: 0;
}

.locator__map {
	height: var(--map-height);
	background: #f1f2f1;
	font: inherit;
}

.locator__empty {
	margin: 18px 0 0;
	font-size: 0.9375rem;
}

/* Mapa: gris, con los botones del boceto ----------------------------------- */

.locator .leaflet-tile-pane {
	filter: grayscale(1) brightness(1.1) contrast(0.84);
	opacity: 0.92;
}

.locator .leaflet-container {
	font-family: inherit;
}

.locator .leaflet-bar {
	margin: 20px 0 0 20px;
	border: 1px solid var(--grey);
	border-radius: 0;
	box-shadow: none;
}

.locator .leaflet-bar a {
	width: 36px;
	height: 36px;
	border-radius: 0;
	border-bottom-color: var(--grey);
	color: var(--ink);
	font-size: 20px;
	font-weight: 300;
	line-height: 34px;
}

.locator .leaflet-control-attribution {
	padding: 2px 6px;
	background: rgb(255 255 255 / 0.8);
	font-size: 0.625rem;
	color: var(--muted);
}

.locator .leaflet-control-attribution a {
	color: inherit;
}

.locator-pin,
.locator-cluster {
	border: 0;
	background: none;
}

.locator-pin svg {
	display: block;
	overflow: visible;
}

.locator-pin text {
	font-family: inherit;
}

/* La óptica elegida lleva un halo blanco, como en el boceto. */
.locator-pin.is-selected::before {
	content: "";
	position: absolute;
	top: -8px;
	left: -9px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--paper);
	box-shadow: 0 0 0 7px rgb(16 24 32 / 0.1);
}

.locator-pin.is-selected svg {
	position: relative;
}

.locator-cluster span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--ink);
	color: var(--paper);
	font-size: 0.8125rem;
	font-weight: 600;
}

/* Ficha -------------------------------------------------------------------- */

.locator-card {
	position: absolute;
	bottom: 20px;
	left: 20px;
	z-index: 1000;
	width: min(388px, calc(100% - 40px));
	padding: 26px 56px 30px 22px;
	border: 1px solid var(--grey);
	background: var(--paper);
	font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1.0625rem);
	line-height: 1.5;
}

.locator-card[hidden] {
	display: none;
}

.locator-card__close {
	position: absolute;
	top: 6px;
	right: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--tap);
	height: var(--tap);
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	cursor: pointer;
}

.locator-card__name {
	font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
	font-weight: 400;
	letter-spacing: 0.14em;
	line-height: 1.35;
	text-transform: uppercase;
}

.locator-card__name:focus {
	outline: 0;
}

.locator-card p {
	margin: 0;
}

.locator-card__city {
	margin-top: 4px;
}

.locator-card__data {
	margin-top: 8px;
}

.locator-card__data a {
	text-underline-offset: 0.3em;
}

.locator-card__route {
	margin-top: 22px;
}

/* Móvil -------------------------------------------------------------------- */

@media (max-width: 899px) {
	.locator {
		--map-height: clamp(290px, 74vw, 440px);
	}

	.locator__layout,
	.locator[data-state="place"] .locator__layout {
		display: flex;
		flex-direction: column;
	}

	/* El rótulo y el recuento van encima del mapa; la lista, debajo. */
	.locator__results {
		display: contents;
	}

	.locator__place {
		order: 1;
		margin-top: 0;
	}

	.locator__count {
		order: 2;
		margin-bottom: 16px;
	}

	.locator__map-wrap {
		order: 3;
		margin-inline: calc(var(--gutter) * -1);
	}

	.locator__list {
		order: 4;
		flex: none;
		margin-top: 8px;
		overflow: visible;
	}

	.locator__hint {
		order: 5;
	}

	.locator-item {
		grid-template-columns: 52px minmax(0, 1fr);
		padding: 20px 0 22px;
	}

	.locator-item:first-child {
		padding-top: 20px;
	}

	.locator .leaflet-bar {
		margin: 14px 0 0 14px;
	}

	/* La ficha va debajo del mapa para no tapar las ópticas. */
	.locator-card {
		position: static;
		width: auto;
		margin-inline: var(--gutter);
		padding: 22px 48px 24px 4px;
		border-width: 0 0 1px;
	}

	.locator-card__close {
		right: calc(var(--gutter) - 8px);
		top: auto;
		margin-top: -8px;
	}
}
