/*
 * Мобільне меню на весь екран — стилі компонента (components/mobile-menu/).
 *
 * Кольори й шрифти — з глобальних налаштувань Elementor (Site Settings),
 * у дужках — запасні значення на випадок, якщо змінних немає.
 * Відкриття: фон заповнює екран згори вниз (clip-path), потім по черзі
 * з'являються блоки (--i — порядковий номер блоку з overlay.php).
 */

.ergo-mm,
.ergo-mm-toggle {
	--ergo-mm-bg: var(--e-global-color-vamtam_accent_3, #f2f0ec);
	--ergo-mm-text: var(--e-global-color-vamtam_accent_6, #070807e6);
	--ergo-mm-brand: var(--e-global-color-vamtam_accent_1, #6b7356);
	--ergo-mm-soft: var(--e-global-color-vamtam_accent_2, #dde3cd);
	--ergo-mm-card: var(--e-global-color-vamtam_accent_5, #fff);
	--ergo-mm-line: var(--e-global-color-vamtam_accent_7, #00000026);
	--ergo-mm-font: var(--e-global-typography-vamtam_primary_font-font-family, "Manrope"), sans-serif;
	--ergo-mm-font-title: var(--e-global-typography-vamtam_h3-font-family, "Ovo"), serif;
	--ergo-mm-open: 0.42s cubic-bezier(0.22, 1, 0.36, 1);
	--ergo-mm-close: 0.28s cubic-bezier(0.55, 0, 0.7, 0.2);
}

/* ── Кнопки-квадрати: бургер у хедері й хрестик у меню ─────────────────── */

html body .ergo-mm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 33px;
	height: 33px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: var(--ergo-mm-soft);
	color: var(--ergo-mm-text);
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
	-webkit-tap-highlight-color: transparent;
}

/* Kit Elementor фарбує будь-яку кнопку в бренд при :hover і :focus (.elementor-kit-5 button:focus) —
   після тапу й програмного фокусу кнопка лишалась би оливковою. Скидаємо, стани нижче — свої. */
html body .ergo-mm-btn:is(:hover, :focus) {
	background: var(--ergo-mm-soft);
	color: var(--ergo-mm-text);
}

/* Наведення — лише там, де є миша: на сенсорних екранах :hover «прилипає» після тапу. */
@media (hover: hover) {
	html body .ergo-mm-btn:hover {
		background: var(--ergo-mm-brand);
		color: var(--ergo-mm-card);
	}
}

html body .ergo-mm-btn:focus-visible {
	background: var(--ergo-mm-brand);
	color: var(--ergo-mm-card);
	outline: 2px solid var(--ergo-mm-brand);
	outline-offset: 2px;
}

html body .ergo-mm-btn__icon {
	width: 22px;
	height: 22px;
}

/* ── Екран ──────────────────────────────────────────────────────────────── */

.ergo-mm {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	background: var(--ergo-mm-bg);
	color: var(--ergo-mm-text);
	font-family: var(--ergo-mm-font);
	visibility: hidden;
	clip-path: inset(0 0 100% 0);
	transition: clip-path var(--ergo-mm-close), visibility 0s linear 0.28s;
}

.ergo-mm:focus {
	outline: none; /* фокус на самому діалозі після тапу — без рамки */
}

.ergo-mm.is-open {
	visibility: visible;
	clip-path: inset(0 0 0 0);
	transition: clip-path var(--ergo-mm-open), visibility 0s;
}

@media (min-width: 1025px) {
	.ergo-mm {
		display: none;
	}
}

/* Поки меню відкрите, сторінка під ним не прокручується. */
html.ergo-mm-open,
html.ergo-mm-open body {
	overflow: hidden;
}

/* Блоки з'являються по черзі після того, як фон уже поїхав униз. */
.ergo-mm .ergo-mm__bar,
.ergo-mm .ergo-mm__group,
.ergo-mm .ergo-mm__contact {
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.ergo-mm.is-open :is(.ergo-mm__bar, .ergo-mm__group, .ergo-mm__contact) {
	opacity: 1;
	transform: none;
	transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: calc(0.1s + var(--i, 0) * 0.05s);
}

/* ── Верхній рядок: лого й хрестик на тих самих місцях, що в хедері ─────── */

.ergo-mm .ergo-mm__bar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	/* Значення за замовчуванням = мобільний хедер; при відкритті скрипт підставляє
	   фактичні з хедера (syncBar у mobile-menu.js). */
	height: var(--ergo-mm-bar-h, 60px);
	padding: 0 var(--ergo-mm-bar-pr, 20px) 0 var(--ergo-mm-bar-pl, 20px);
	transform: none; /* рядок не їде — лише проявляється, як продовження хедера */
}

.ergo-mm .ergo-mm__logo {
	display: block;
	line-height: 0;
}

.ergo-mm .ergo-mm__logo img {
	width: auto;
	max-width: none;
	height: var(--ergo-mm-logo-h, 38px);
}

/* ── Прокручувана частина ───────────────────────────────────────────────── */

.ergo-mm .ergo-mm__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 4px 20px calc(28px + env(safe-area-inset-bottom));
}

.ergo-mm .ergo-mm__nav {
	margin-bottom: 24px;
}

.ergo-mm .ergo-mm__group {
	margin: 0;
	padding: 22px 0 18px;
	border-top: 1px solid var(--ergo-mm-line);
	list-style: none;
}

.ergo-mm .ergo-mm__group:first-child {
	border-top: 0;
	padding-top: 12px;
}

/* Заголовок категорії й одиночні пункти — один рівень, одна подача. */
.ergo-mm .ergo-mm__title,
.ergo-mm .ergo-mm__single {
	margin: 0;
	font-family: var(--ergo-mm-font-title);
	font-size: 26px;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0;
	color: var(--ergo-mm-brand);
}

.ergo-mm .ergo-mm__title {
	margin-bottom: 6px;
}

.ergo-mm .ergo-mm__title a {
	color: inherit;
	text-decoration: none;
}

.ergo-mm .ergo-mm__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ergo-mm .ergo-mm__link,
.ergo-mm .ergo-mm__single {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 44px;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}

.ergo-mm .ergo-mm__link {
	font-size: 17px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--ergo-mm-text);
}

.ergo-mm .ergo-mm__singles {
	padding-top: 14px;
}

.ergo-mm .ergo-mm__singles li + li {
	margin-top: 2px;
}

/* Натиск і фокус: текст лишається темним (контраст), з'являється риска бренду. */
.ergo-mm .ergo-mm__link::before,
.ergo-mm .ergo-mm__single::before {
	content: "";
	position: absolute;
	left: -20px;
	top: 50%;
	width: 3px;
	height: 0;
	border-radius: 0 3px 3px 0;
	background: var(--ergo-mm-brand);
	transform: translateY(-50%);
	transition: height 0.2s ease;
}

.ergo-mm .ergo-mm__link:is(:active, :focus-visible, [aria-current="page"])::before,
.ergo-mm .ergo-mm__single:is(:active, :focus-visible, [aria-current="page"])::before {
	height: 24px;
}

@media (hover: hover) {
	.ergo-mm .ergo-mm__link:hover::before,
	.ergo-mm .ergo-mm__single:hover::before {
		height: 24px;
	}
}

/* Kit Elementor перефарбовує всі посилання при наведенні (.elementor-kit-5 a:hover) —
   у меню кольори лишаються свої, стан показує риска. */
.ergo-mm :is(.ergo-mm__link, .ergo-mm__contact-link):is(:hover, :focus, :active) {
	color: var(--ergo-mm-text);
}

.ergo-mm :is(.ergo-mm__single, .ergo-mm__title a):is(:hover, :focus, :active) {
	color: var(--ergo-mm-brand);
}

.ergo-mm :is(a, button):focus-visible {
	outline: 2px solid var(--ergo-mm-brand);
	outline-offset: 3px;
	border-radius: 4px;
}

/* ── Контакти й запис ──────────────────────────────────────────────────── */

.ergo-mm .ergo-mm__contact {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px;
	border-radius: 16px;
	background: var(--ergo-mm-card);
}

.ergo-mm .ergo-mm__contact-link {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 56px;
	color: var(--ergo-mm-text);
	text-decoration: none;
}

.ergo-mm .ergo-mm__contact-icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--ergo-mm-bg);
	color: var(--ergo-mm-brand);
}

.ergo-mm .ergo-mm__contact-icon svg {
	width: 20px;
	height: 20px;
}

.ergo-mm .ergo-mm__contact-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ergo-mm .ergo-mm__contact-label {
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.7;
}

.ergo-mm .ergo-mm__contact-value {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

/* Кнопка — як «Jetzt anmelden» у хедері: пігулка Accent 2, значок у білому колі. */
.ergo-mm .ergo-mm__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	margin-top: 10px;
	padding: 8px 20px 8px 8px;
	border-radius: 999px;
	background: var(--ergo-mm-soft);
	color: var(--ergo-mm-text);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.ergo-mm .ergo-mm__cta:active,
.ergo-mm .ergo-mm__cta:focus-visible {
	background: var(--ergo-mm-brand);
	color: var(--ergo-mm-card);
}

@media (hover: hover) {
	.ergo-mm .ergo-mm__cta:hover {
		background: var(--ergo-mm-brand);
		color: var(--ergo-mm-card);
	}
}

.ergo-mm .ergo-mm__cta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--ergo-mm-card);
	color: var(--ergo-mm-brand);
}

.ergo-mm .ergo-mm__cta-icon svg {
	width: 14px;
	height: 14px;
}

/* ── Планшет: списки у дві колонки, телефон і пошта поруч ─────────────── */

@media (min-width: 600px) {
	.ergo-mm .ergo-mm__list {
		columns: 2;
		column-gap: 32px;
	}

	.ergo-mm .ergo-mm__list li {
		break-inside: avoid;
	}

	.ergo-mm .ergo-mm__contact {
		display: grid;
		grid-template-columns: 1fr 1fr;
		column-gap: 24px;
	}

	.ergo-mm .ergo-mm__cta {
		grid-column: 1 / -1;
	}
}

/* ── Без анімацій, якщо користувач їх вимкнув у системі ─────────────────── */

@media (prefers-reduced-motion: reduce) {
	.ergo-mm,
	.ergo-mm.is-open {
		clip-path: none;
		opacity: 0;
		transition: opacity 0.15s, visibility 0s linear 0.15s;
	}

	.ergo-mm.is-open {
		opacity: 1;
		transition: opacity 0.15s, visibility 0s;
	}

	.ergo-mm :is(.ergo-mm__bar, .ergo-mm__group, .ergo-mm__contact),
	.ergo-mm.is-open :is(.ergo-mm__bar, .ergo-mm__group, .ergo-mm__contact) {
		opacity: 1;
		transform: none;
		transition: none;
	}
}
