/*
 * Многоуровневое меню верхней синей плашки.
 *
 * Уровень 1: горизонтально в топбаре.
 * Уровень 2: раскрывается вниз.
 * Уровни 3 и 4: раскрываются вправо.
 */

.custom-top-bar {
	--topbar-height: 38px;

	position: relative;
	z-index: 10050;
	min-height: var(--topbar-height);
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	overflow: visible;
}

.custom-top-bar__inner,
.custom-top-bar__menu,
.custom-top-bar__menu-list,
.custom-top-bar__menu-list li {
	overflow: visible;
}

.custom-top-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--topbar-height);
	min-height: var(--topbar-height);
	max-height: var(--topbar-height);
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.custom-top-bar__menu {
	display: flex;
	align-self: stretch;
	min-width: 0;
}

.custom-top-bar__menu-list,
.custom-top-bar__menu-list .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.custom-top-bar__menu-list {
	display: flex;
	align-items: stretch;
	gap: 2px;
	height: var(--topbar-height);
}

.custom-top-bar__menu-list > li {
	position: relative;
	display: flex;
	align-items: stretch;
	margin: 0;
	padding: 0;
}

.custom-top-bar__menu-list a {
	font-family: inherit;
	text-decoration: none;
}

.custom-top-bar__menu-list > li > a {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	height: var(--topbar-height);
	min-height: var(--topbar-height);
	padding: 0 12px;
	color: #ffffff;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
	transition:
		background-color 0.18s ease,
		color 0.18s ease;
}

.custom-top-bar__menu-list > li:first-child > a {
	padding-left: 0;
}

.custom-top-bar__menu-list > li > a:hover,
.custom-top-bar__menu-list > li > a:focus-visible,
.custom-top-bar__menu-list > li.current-menu-item > a,
.custom-top-bar__menu-list > li.current-menu-ancestor > a {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.09);
	outline: none;
}

/*
 * Стрелка вниз у пунктов первого уровня.
 */
.custom-top-bar__menu-list > li.menu-item-has-children > a {
	padding-right: 30px;
}

.custom-top-bar__menu-list > li.menu-item-has-children > a::after {
	content: "";
	position: absolute;
	right: 13px;
	top: 50%;
	width: 6px;
	height: 6px;
	margin-top: -5px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.18s ease;
}

.custom-top-bar__menu-list > li.menu-item-has-children:hover > a::after,
.custom-top-bar__menu-list > li.menu-item-has-children:focus-within > a::after {
	margin-top: -1px;
	transform: rotate(225deg);
}

/*
 * Общая панель подменю.
 */
.custom-top-bar__menu-list .sub-menu {
	position: absolute;
	z-index: 10070;
	display: block;
	width: 290px;
	min-width: 290px;
	padding: 8px;

	background:
		radial-gradient(circle at 100% 0%, rgba(26, 154, 199, 0.09), transparent 42%),
		linear-gradient(145deg, #ffffff 0%, #fbfdff 64%, #fffaf1 100%);
	border: 1px solid rgba(6, 36, 82, 0.12);
	border-radius: 12px;
	box-shadow:
		0 20px 45px rgba(5, 32, 74, 0.18),
		0 6px 16px rgba(5, 32, 74, 0.08);

	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(8px);
	transition:
		opacity 0.18s ease,
		visibility 0.18s ease,
		transform 0.18s ease;
}

/*
 * Второй уровень раскрывается вниз.
 */
.custom-top-bar__menu-list > li > .sub-menu {
	top: 100%;
	left: 0;
}

/*
 * Третий и четвёртый уровни раскрываются вправо.
 */
.custom-top-bar__menu-list .sub-menu .sub-menu {
	top: -8px;
	left: 100%;
	transform: translateX(8px);
}

/*
 * Открытие только прямого дочернего подменю.
 */
.custom-top-bar__menu-list li:hover > .sub-menu,
.custom-top-bar__menu-list li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate(0, 0);
}

.custom-top-bar__menu-list .sub-menu li {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
}

.custom-top-bar__menu-list .sub-menu li + li {
	margin-top: 2px;
}

.custom-top-bar__menu-list .sub-menu a {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 42px;
	padding: 10px 38px 10px 13px;

	color: #17233d;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 8px;

	font-size: 13px;
	font-weight: 400;
	line-height: 1.35;
	text-transform: none;
	white-space: normal;

	transition:
		color 0.18s ease,
		background 0.18s ease,
		border-color 0.18s ease,
		transform 0.18s ease;
}

.custom-top-bar__menu-list .sub-menu a:hover,
.custom-top-bar__menu-list .sub-menu a:focus-visible,
.custom-top-bar__menu-list .sub-menu li.current-menu-item > a,
.custom-top-bar__menu-list .sub-menu li.current-menu-ancestor > a {
	color: #073f75;
	background:
		linear-gradient(100deg, rgba(230, 246, 252, 0.92), rgba(255, 249, 236, 0.76));
	border-color: rgba(12, 135, 179, 0.12);
	transform: translateX(2px);
	outline: none;
}

/*
 * Стрелка вправо у пунктов второго и следующих уровней.
 */
.custom-top-bar__menu-list .sub-menu li.menu-item-has-children > a::after {
	content: "";
	position: absolute;
	right: 14px;
	top: 50%;
	width: 7px;
	height: 7px;
	border-top: 1.5px solid #9b782e;
	border-right: 1.5px solid #9b782e;
	transform: translateY(-50%) rotate(45deg);
	transition: right 0.18s ease;
}

.custom-top-bar__menu-list .sub-menu li.menu-item-has-children:hover > a::after,
.custom-top-bar__menu-list .sub-menu li.menu-item-has-children:focus-within > a::after {
	right: 11px;
}

/*
 * Не даём тексту справа увеличивать высоту topbar.
 */
.custom-top-bar__text {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	height: var(--topbar-height);
	margin-left: 24px;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	line-height: 1;
	white-space: nowrap;
}

/*
 * При уменьшенной анимации меню открывается без движения.
 */
@media (prefers-reduced-motion: reduce) {
	.custom-top-bar__menu-list a,
	.custom-top-bar__menu-list .sub-menu,
	.custom-top-bar__menu-list li.menu-item-has-children > a::after {
		transition: none;
	}
}

/*
 * На узких экранах длинные многоуровневые цепочки неудобны.
 * Если ваш topbar уже скрывается мобильными стилями, этот блок не мешает.
 */
@media (max-width: 1024px) {
	.custom-top-bar__menu-list .sub-menu {
		width: 260px;
		min-width: 260px;
	}
}