/* Шапка: мегаменю «Услуги», выбор способа связи, запасные контакты в окне записи */
:root {
	--header_menu-text: #131313;
	--header_menu-muted: #555;
	--header_menu-faint: #888;
	--header_menu-hover: #f4f4f4;
	--header_menu-line: #e6e6e6;
	--header_menu-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
	--header_menu-whatsapp: #25d366;
	--header_menu-telegram: #2aabee;
	--header_menu-max: #5b3df5;
	--header_menu-dark_muted: #bdbdbd;
	--header_menu-dark_line: #3a3a3a;
	--header_menu-fallback: 68px;
}

/* окно формы (z-index: 11) остаётся выше шапки */
.header {
	position: relative;
	z-index: 10;
}

/* Мегаменю */
.mega_menu-item {
	/* мост от пункта к панели, чтобы меню не закрывалось на пути мыши */
	padding-bottom: 30px;
	margin-bottom: -30px;
}

.mega_menu {
	position: absolute;
	top: calc(100% - 4px);
	left: 50%;
	transform: translateX(-50%);
	width: min(1180px, calc(100% - 40px));
	max-height: calc(100vh - 110px);
	overflow-y: auto;
	padding: 32px 36px;
	background: #fff;
	border-radius: 20px;
	box-shadow: var(--header_menu-shadow);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.mega_menu-item:hover .mega_menu,
.mega_menu-item:focus-within .mega_menu {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

.mega_menu-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 26px 32px;
}

/* анимация ссылок шапки панели не нужна */
.mega_menu a::before,
.mega_menu a::after {
	content: none;
}

.header__list .mega_menu-head {
	font-size: 16px;
	font-weight: 600;
	color: var(--header_menu-text);
}

.mega_menu-list {
	margin-top: 8px;
}

.mega_menu-list li {
	padding: 3px 0;
	line-height: 1.35;
}

.header__list .mega_menu-list a {
	font-size: 14px;
	font-weight: 400;
	color: var(--header_menu-muted);
}

.mega_menu-extra,
.mega_menu-list_open .mega_menu-more_row {
	display: none;
}

.mega_menu-list_open .mega_menu-extra {
	display: list-item;
}

.mega_menu-more {
	padding: 0;
	border: 0;
	background: none;
	color: var(--header_menu-faint);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

.mega_menu-more:hover {
	color: var(--header_menu-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.header__list .mega_menu-head:hover,
.header__list .mega_menu-list a:hover {
	color: var(--header_menu-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.header__list .mega_menu-all {
	display: block;
	margin-top: 22px;
	padding-top: 16px;
	border-top: 1px solid var(--header_menu-line);
	color: var(--header_menu-text);
	font-weight: 400;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Выбор способа связи */
.booking_menu {
	position: relative;
}

.booking_menu-panel {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	width: 300px;
	padding: 10px;
	background: #fff;
	border-radius: 16px;
	box-shadow: var(--header_menu-shadow);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

/* мост от кнопки к панели */
.booking_menu-panel::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -14px;
	height: 14px;
}

/* наведение открывает, клик фиксирует (booking_menu-open) */
.booking_menu-open .booking_menu-panel {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

.header .booking_menu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 40px;
}

.booking_menu-arrow {
	flex: none;
	transition: transform 0.15s ease;
}

.booking_menu-open .booking_menu-arrow {
	transform: rotate(180deg);
}

@media (hover: hover) {
	.booking_menu:hover .booking_menu-panel {
		opacity: 1;
		visibility: visible;
		transition-delay: 0s;
	}

	.booking_menu:hover .booking_menu-arrow {
		transform: rotate(180deg);
	}
}

.booking_menu-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 10px;
	color: var(--header_menu-text);
	font-size: 15px;
}

.booking_menu-link:hover,
.booking_menu-link:focus-visible {
	background: var(--header_menu-hover);
}

.booking_menu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--header_menu-text);
}

.booking_menu-icon img {
	width: 18px;
	height: 18px;
	object-fit: contain;
}

.booking_menu-icon_whatsapp { background: var(--header_menu-whatsapp); }
.booking_menu-icon_telegram { background: var(--header_menu-telegram); }
.booking_menu-icon_max { background: var(--header_menu-max); }

.booking_menu-text small {
	display: block;
	color: var(--header_menu-faint);
	font-size: 12px;
}

/* Мобильное меню: экран услуг */
.mobile_services {
	display: none;
}

.mobile-menu__inner_services > :not(.mobile-menu__head):not(.mobile_services) {
	display: none;
}

.mobile-menu__inner_services .mobile_services {
	display: block;
	animation: mobile_services-forward 0.2s ease;
}

.mobile-menu__inner_back > :not(.mobile-menu__head):not(.mobile_services) {
	animation: mobile_services-backward 0.2s ease;
}

@keyframes mobile_services-forward {
	from { opacity: 0; transform: translateX(32px); }
}

@keyframes mobile_services-backward {
	from { opacity: 0; transform: translateX(-32px); }
}

@media (prefers-reduced-motion: reduce) {
	.mobile-menu__inner_services .mobile_services,
	.mobile-menu__inner_back > :not(.mobile-menu__head):not(.mobile_services) {
		animation: none;
	}
}

.mobile_services-open,
.mobile_services-back {
	display: inline-flex;
	align-items: center;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.mobile_services-open {
	gap: 10px;
}

.mobile_services-back {
	gap: 8px;
	min-height: 44px;
	color: var(--header_menu-dark_muted);
	font-size: 16px;
}

.mobile_services-title {
	margin: 4px 0 24px;
	font-size: 24px;
	font-weight: 600;
}

.mobile_services-group {
	margin-bottom: 26px;
}

.mobile_services-head {
	color: #fff;
	font-size: 18px;
	font-weight: 600;
}

.mobile_services-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 12px;
}

.mobile_services-list a {
	color: var(--header_menu-dark_muted);
	font-size: 16px;
	line-height: 1.35;
}

.mobile_services-all {
	display: block;
	padding-top: 20px;
	border-top: 1px solid var(--header_menu-dark_line);
	color: #fff;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Мобильное меню: способы связи */
.mobile_contacts {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 20px;
}

.mobile_contacts-link {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	color: #fff;
	font-size: 16px;
}

.mobile_contacts-phone {
	background: var(--header_menu-dark_line);
}

/*
 * Запасные контакты под окном записи Medflex. Внутрь виджета класть нельзя:
 * после загрузки он пересоздаёт содержимое. Поэтому строка своя, под уменьшенным окном.
 */
.medflex-round-widget__iframe-wrapper .medflex-round-widget__iframe {
	height: calc(100% - var(--header_menu-fallback));
	border-radius: 4px 4px 0 0;
}

.medflex_fallback {
	display: none;
	position: fixed;
	z-index: 2147483000;
	left: 50%;
	bottom: 40px;
	transform: translateX(-50%);
	box-sizing: border-box;
	width: 100%;
	max-width: 650px;
	height: var(--header_menu-fallback);
	padding: 12px 16px;
	border-top: 1px solid var(--header_menu-line);
	border-radius: 0 0 4px 4px;
	background: #fff;
	color: var(--header_menu-muted);
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
}

body:has(.medflex-round-widget__iframe-wrapper_show) .medflex_fallback {
	display: block;
}

.medflex_fallback a {
	color: var(--header_menu-text);
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

/* с этой ширины окно Medflex занимает весь экран */
@media (max-width: 650.98px) {
	:root {
		--header_menu-fallback: 90px;
	}

	.medflex-round-widget__iframe-wrapper .medflex-round-widget__iframe {
		border-radius: 0;
	}

	.medflex_fallback {
		bottom: 0;
		border-radius: 0;
	}
}

@media (max-width: 360px) {
	.medflex_fallback {
		font-size: 13px;
	}
}
