/*
 * «Салоны» (page-shops.php). Данные — inc/shops.php, поведение — assets/js/shops.js.
 * h1 и указатель: сетка 5fr / 7fr, зазор 24px — слева плашка со списком (у всех салонов всё видно сразу; активный — тёмный
 * блок var(--c-green)), справа плашка с картой на высоту экрана; с 900px карта прилипает под шапкой. До 899px — одна колонка,
 * карта сверху (4:3).
 * Пустая плашка карты (нет ключа или API не загрузился) — цвета земли на карте.
 * Логотип, копирайт и «Открыть в Картах» Яндекса ничем не перекрыты (условие бесплатного использования API).
 */
.shops {
	--sh-side: clamp(14px, 1.6vw, 28px);               /* боковой отступ строки салона */
	--sh-head: calc(64px + var(--wp-admin--admin-bar--height, 0px)); /* липкая шапка: 64, с 1024 — 72 (+ админ-панель) */
	color: var(--c-green);
}

@media (min-width: 1024px) {
	.shops {
		--sh-head: calc(72px + var(--wp-admin--admin-bar--height, 0px));
	}
}

.shops a:focus-visible,
.shops button:focus-visible {
	outline: 2px solid var(--c-gold-text);
	outline-offset: 2px;
}

.shops .shops__title {
	margin: 0 0 var(--sp-4);   /* до указателя — как на «Контактах» (.partners__head, partners.css) */
}

/* Указатель */
.shops__idx {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	align-items: start;
	gap: 24px;
}

.shops__plaque {
	border-radius: var(--r-card);
	background: var(--c-plaque);
}

.shops__list {
	padding: 12px;
}

.shops__items {
	display: grid;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Строка салона: номер | всё остальное; линия между строками — внутри боковых отступов, у активной и следующей за ней — нет */
.shops__item {
	position: relative;
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr);
	column-gap: 10px;
	padding: 22px var(--sh-side);
	border-radius: 12px;
	cursor: pointer;
	transition: background-color .3s, color .3s;
}

.shops__item + .shops__item::before {
	position: absolute;
	top: 0;
	right: var(--sh-side);
	left: var(--sh-side);
	height: 1px;
	background: var(--c-line);
	content: "";
	transition: opacity .3s;
}

.shops__item.is-on::before,
.shops__item.is-on + .shops__item::before {
	opacity: 0;
}

.shops__n {
	padding-top: 9px;
	color: var(--c-sub);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	transition: color .3s;
}

.shops__what {
	min-width: 0;
}

.shops__name {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(24px, 2vw, 30px);
	font-weight: 500;
	line-height: 1.1;
}

/* Фото салона (не у всех): только у активного, вверху строки на всю её ширину (10px от краёв тёмного блока), 16:8, cover */
.shops__photo {
	display: none;
	grid-column: 1 / -1;
	aspect-ratio: 16 / 8;
	margin: -12px calc(10px - var(--sh-side)) 18px;
	overflow: hidden;
	border-radius: 8px;
	background: rgb(var(--c-light-rgb) / .08);
}

.shops__item.is-on .shops__photo {
	display: block;
}

.shops__photo-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Название — кнопка (клавиатура); выглядит как текст */
.shops__pick {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	text-align: left;
	cursor: pointer;
	transition: color .3s;
}

.shops__item:not(.is-on):hover .shops__pick {
	color: var(--c-gold-text);
}

.shops__addr {
	margin: 6px 0 0;
	color: var(--c-sub);
	font-size: 14px;
	line-height: 1.45;
	transition: color .3s;
}

/* Номера павильонов и слова с дефисом в адресе («3-А25», «C-16», «66-й») не переносятся (inc/shops.php, migliore_shop_addr_html) */
.shops__nw {
	white-space: nowrap;
}

.shops__det {
	display: grid;
	justify-items: start;
	gap: 8px;
	margin-top: 14px;
}

.shops__tel {
	color: inherit;
	font-family: var(--font-display);
	font-size: clamp(22px, 1.7vw, 26px);
	font-variant-numeric: lining-nums;
	font-weight: 500;
	line-height: 1.05;
	text-decoration: none;
	white-space: nowrap;
}

/* Статус · часы · почта */
.shops__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 18px;
	color: var(--c-sub);
	font-size: 14px;
	transition: color .3s;
}

.shops__hours {
	display: grid;
}

/* Статус: точка 8px — «Открыто до…» зелёная (--c-open), «Откроется в…» / «Закрыто до завтра…» — красная: на светлой плашке
   --c-red, на зелёном (активная строка, карточка развёрнутой карты) — --c-red-light. Пишет JS; без JS пусто */
.shops__st {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	white-space: nowrap;
}

.shops__st:empty {
	display: none;
}

.shops__st::before {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--c-red);
	content: "";
}

/* На зелёном (активная строка, карточка в развёрнутой карте) «закрыто» — светлее: --c-red там почти не видна */
.shops__item.is-on .shops__st:not(.is-open)::before,
.shops__card .shops__st:not(.is-open)::before {
	background: var(--c-red-light);
}

.shops__st.is-open::before {
	background: var(--c-open);
}

.shops__mail {
	color: var(--c-gold-text);
	text-decoration: none;
	transition: color .3s;
}

.shops__mail:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* «Маршрут» — стрелка через 14px, вытягивается при наведении */
.shops__route {
	display: inline-flex;
	align-items: center;
	margin-top: 4px;
	color: var(--c-gold-text);
	font-family: var(--font-display);
	font-size: 21px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	transition: color .3s;
}

.shops__route .arr {
	margin-left: 14px;
}

.shops__route:hover .arr,
.shops__route:focus-visible .arr {
	width: 96px;
}

/* Активный салон — тёмный блок */
.shops__item.is-on {
	background: var(--c-green);
	color: var(--c-light);
}

.shops__item.is-on .shops__n,
.shops__item.is-on .shops__mail,
.shops__item.is-on .shops__route {
	color: var(--c-gold-light);
}

.shops__item.is-on .shops__addr,
.shops__item.is-on .shops__meta {
	color: rgb(var(--c-light-rgb) / .72);
}

.shops__item.is-on a:focus-visible,
.shops__item.is-on button:focus-visible {
	outline-color: var(--c-gold-light);
}

/* Карта: на высоту экрана (без шапки и двух отступов по 24px), с 900px — липкая под шапкой */
.shops__map {
	position: sticky;
	top: calc(var(--sh-head) + 24px);
	overflow: hidden;
	height: clamp(520px, calc(100svh - var(--sh-head) - 48px), 900px);
	background: var(--map-land);
}

.shops__canvas {
	position: absolute;
	inset: 0;
}

/* Метки: круг 42px var(--c-gold), кольцо 3px var(--c-surface), тень; цифра Open Sans 600 15px var(--c-green); «4·5» — пилюля
   той же высоты. Наведение — фон var(--c-gold-text), цифры var(--c-surface). Активная — var(--c-green) с цифрами
   var(--c-surface), поверх остальных (zIndex маркера — shops.js) и с подписью: короткое название салона справа от метки, нет
   места — слева, закрывает знаки Яндекса — над меткой (классы is-left / is-up ставит shops.js). */
.shops__pin {
	position: relative;
	display: grid;
	place-items: center;
	box-sizing: border-box;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border: 3px solid var(--c-surface);
	border-radius: var(--r-pill);
	background: var(--c-gold);
	box-shadow: 0 3px 5px rgb(var(--c-green-rgb) / .28);
	color: var(--c-green);
	font-family: var(--font-body);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transform: translate(-50%, -50%);
	transition: background-color .25s, color .25s;
}

.shops__pin:hover {
	background: var(--c-gold-text);
	color: var(--c-surface);
}

.shops__pin.is-on {
	background: var(--c-green);
	color: var(--c-surface);
}

.shops__pin:focus {
	outline: none;
}

.shops__pin:focus-visible {
	border-color: var(--c-gold-text);
	box-shadow: 0 0 0 1px var(--c-gold-text), 0 3px 5px rgb(var(--c-green-rgb) / .28);
}

.shops__pin-lab {
	position: absolute;
	top: 50%;
	left: calc(100% + 8px);
	display: none;
	align-items: center;
	height: 38px;
	padding: 0 18px;
	border-radius: 19px;
	background: var(--c-surface);
	box-shadow: 0 3px 6px rgb(var(--c-green-rgb) / .2);
	color: var(--c-green);
	font-family: var(--font-display);
	font-size: 19px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	pointer-events: none;
	transform: translateY(-50%);
}

.shops__pin.is-on .shops__pin-lab {
	display: flex;
}

.shops__pin.is-left .shops__pin-lab {
	right: calc(100% + 8px);
	left: auto;
}

.shops__pin.is-up .shops__pin-lab {
	top: auto;
	right: auto;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
}

/* ===== Развернуть карту. Кнопка 40×40 справа вверху, отступ от краёв — как у кнопок масштаба Яндекса (12px); на узкой карте
   копирайт и логотип Яндекса стоят вверху справа — кнопка и карточка ниже них (--map-top ставит shops.js).
   Развёрнутая карта — свой режим (не Fullscreen API): position: fixed на весь экран поверх шапки и уведомления о cookie,
   прокрутка страницы заблокирована (html.is-map-full); на месте карты — заглушка её высоты, страница не прыгает. */
.shops__map {
	--map-top: 12px;
}

.shops__expand {
	position: absolute;
	top: var(--map-top);
	right: 12px;
	z-index: 3;
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--c-surface);
	box-shadow: 0 2px 6px rgb(var(--c-shade-rgb) / .2);
	color: var(--c-green);
	cursor: pointer;
}

.shops__expand[hidden],
.shops__expand-close,
.shops__map.is-full .shops__expand-open {
	display: none;
}

.shops__map.is-full .shops__expand-close {
	display: block;
}

.shops__map.is-full {
	position: fixed;
	inset: 0;
	z-index: 1000;
	height: 100vh;
	height: 100dvh;
	border-radius: 0;
	aspect-ratio: auto;
}

.shops__map.is-full .shops__expand {
	top: calc(var(--map-top) + env(safe-area-inset-top, 0px));
	right: calc(12px + env(safe-area-inset-right, 0px));
}

html.is-map-full,
html.is-map-full body {
	overflow: hidden;
	overflow-anchor: none;   /* смена активного салона меняет высоту списка под картой — страница не должна сдвигаться */
}

/* Карточка активного салона — только в развёрнутой карте: слева вверху, как активная строка списка (без фото и почты);
   до 420px, на телефоне — от края до кнопки «свернуть» с отступами 16px */
.shops__card {
	display: none;
}

.shops__map.is-full .shops__card {
	position: absolute;
	top: calc(var(--map-top) + env(safe-area-inset-top, 0px));
	left: calc(16px + env(safe-area-inset-left, 0px));
	z-index: 3;
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr);
	column-gap: 10px;
	box-sizing: border-box;
	width: min(420px, calc(100% - 16px - 16px - 40px - 12px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
	max-height: calc(100% - var(--map-top) - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
	overflow: auto;
	padding: 18px 20px 20px 16px;
	border-radius: 12px;
	background: var(--c-green);
	box-shadow: 0 6px 18px rgb(var(--c-shade-rgb) / .25);
	color: var(--c-light);
}

.shops__card:empty {
	display: none !important;
}

.shops__card-n {
	padding-top: 7px;
	color: var(--c-gold-light);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.shops__card-body {
	display: grid;
	justify-items: start;
	min-width: 0;
}

.shops__card-name {
	margin: 0;
	font-family: var(--font-display);
	font-size: 24px;
	font-weight: 500;
	line-height: 1.1;
}

.shops__card-addr {
	margin: 6px 0 0;
	color: rgb(var(--c-light-rgb) / .72);
	font-size: 14px;
	line-height: 1.45;
}

.shops__card .shops__tel {
	margin-top: 12px;
	color: var(--c-light);
	font-size: 22px;
}

.shops__card .shops__st {
	margin-top: 8px;
	color: rgb(var(--c-light-rgb) / .72);
	font-size: 14px;
}

.shops__card .shops__route {
	margin-top: 10px;
	color: var(--c-gold-light);
}

.shops__card a:focus-visible,
.shops__expand:focus-visible {
	outline: 2px solid var(--c-gold-text);
	outline-offset: 2px;
}

.shops__card a:focus-visible {
	outline-color: var(--c-gold-light);
}

@media (max-width: 899.98px) {
	.shops__map-ph {
		order: -1;
	}

	.shops__idx {
		grid-template-columns: minmax(0, 1fr);
	}

	.shops__list {
		padding: 8px;
	}

	.shops__map {
		position: relative;
		top: 0;
		order: -1;
		height: auto;
		aspect-ratio: 4 / 3;
	}
}

@media (prefers-reduced-motion: reduce) {
	.shops__item,
	.shops__item::before,
	.shops__n,
	.shops__pick,
	.shops__addr,
	.shops__meta,
	.shops__mail,
	.shops__route,
	.shops__pin {
		transition: none;
	}
}
