/*
 * Hudratt - where-to-buy.css (only on the "Dónde comprar" template).
 * Branch map: search tools, map of Mexico by state (grey tones by number of branches,
 * accent fill on the chosen state) and the branch list. No coloured borders.
 */

.hd-map {
	--hd-map-t1: #cfcfcf;
	--hd-map-t2: #b2b2b2;
	--hd-map-t3: #939393;
	--hd-map-t4: #747474;
	--hd-map-t5: #545454;
	display: flex;
	flex-direction: column;
	gap: var(--hd-gap-md);
	padding: clamp(1rem, 3vw, 2.5rem);
}

/* Search tools: location field (with suggestions), state select, submit */
.hd-map__tools {
	display: grid;
	gap: 0.5rem;
}

.hd-map__field {
	position: relative;
	min-width: 0;
}

.hd-map__input {
	height: var(--hd-tap);
	padding-left: 3rem;
	padding-right: 3rem;
	-webkit-appearance: none;
	appearance: none;
}

.hd-map__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.hd-map__field-icon {
	position: absolute;
	top: 50%;
	left: 1rem;
	display: inline-flex;
	transform: translateY(-50%);
	pointer-events: none;
}

.hd-map__clear {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hd-tap);
	height: var(--hd-tap);
	padding: 0;
	color: var(--hd-ink);
	background: transparent;
	border: 0;
	border-radius: var(--hd-radius);
	cursor: pointer;
}

.hd-map__select {
	height: var(--hd-tap);
	cursor: pointer;
}

.hd-map__suggest {
	position: absolute;
	top: calc(100% + 0.375rem);
	right: 0;
	left: 0;
	z-index: 20;
	max-height: 18rem;
	margin: 0;
	padding: 0.375rem;
	overflow-y: auto;
	list-style: none;
	background: var(--hd-surface-solid);
	border: var(--hd-border);
	border-radius: var(--hd-radius);
}

.hd-map__option {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6rem 0.75rem;
	border-radius: calc(var(--hd-radius) - 4px);
	cursor: pointer;
}

.hd-map__option:hover,
.hd-map__option[aria-selected="true"] {
	background: rgba(27, 27, 27, 0.08);
}

.hd-map__option small {
	flex: none;
	color: var(--hd-ink-muted);
}

/* Map + list */
.hd-map__body {
	display: grid;
	gap: var(--hd-gap-md);
}

.hd-map__figure {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin: 0;
}

.hd-map__svg {
	display: block;
	width: 100%;
	height: auto;
}

.hd-map__state path {
	stroke: var(--hd-surface-solid);
	stroke-width: 0.8;
	stroke-linejoin: round;
	transition: fill var(--hd-dur-fast) ease;
}

.hd-map__state--t0 path { fill: #e9e9e9; }
.hd-map__state--t1 path { fill: var(--hd-map-t1); }
.hd-map__state--t2 path { fill: var(--hd-map-t2); }
.hd-map__state--t3 path { fill: var(--hd-map-t3); }
.hd-map__state--t4 path { fill: var(--hd-map-t4); }
.hd-map__state--t5 path { fill: var(--hd-map-t5); }

.hd-map__state:hover path {
	fill: var(--hd-accent-deep);
}

.hd-map__state.is-on path {
	fill: var(--hd-accent);
}

.hd-map__state:focus {
	outline: none;
}

.hd-map__state:focus-visible path {
	stroke: var(--hd-ink);
	stroke-width: 2.5;
}

.hd-map__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	color: var(--hd-ink-muted);
}

.hd-map__legend span {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.hd-map__swatch {
	display: inline-block;
	width: 1.5rem;
	height: 0.625rem;
	border-radius: 2px;
}

.hd-map__swatch--on { background: var(--hd-accent); }

.hd-map__side {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.hd-map__title,
.hd-map__status {
	margin: 0;
}

.hd-map__list {
	max-height: 34rem;
	margin-top: 0.5rem;
	padding-right: 0.25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.hd-map__list:focus-visible {
	outline: 2px solid var(--hd-ink);
	outline-offset: 2px;
}

.hd-map__city {
	margin: 1rem 0 0.5rem;
}

.hd-map__city:first-child {
	margin-top: 0;
}

.hd-map__branches {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hd-map__branch {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.9rem 1rem;
	background: var(--hd-surface-solid);
	border-radius: var(--hd-radius);
}

.hd-map__branch p {
	margin: 0;
}

.hd-map__chain {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--hd-ink-muted);
}

.hd-map__name {
	font-weight: 700;
}

.hd-map__address {
	font-size: var(--hd-fs-small);
	color: var(--hd-ink-muted);
}

.hd-map__directions {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: 0.35rem;
	min-height: 2.75rem;
	font-size: var(--hd-fs-small);
	font-weight: 700;
	color: var(--hd-ink);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
}

.hd-map__directions:hover {
	text-decoration-thickness: 2px;
}

.hd-map__empty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	margin-top: 0.5rem;
}

.hd-map__empty[hidden],
.hd-map__list[hidden] {
	display: none;
}

@media (min-width: 768px) {
	.hd-map__tools {
		grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem) auto;
	}
}

@media (min-width: 992px) {
	.hd-map__body {
		grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
		align-items: start;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hd-map__state path {
		transition: none;
	}
}
