/*
 * Кнопка профілю (обліковий запис WooCommerce) в шапці сайту.
 *
 * Підключається на всіх сторінках (functions.php → nmiu-header-account) і
 * не змінює решту стилів шапки: додає лише нову кнопку та підлаштовує ширину
 * селектора мови, щоб «кошик + профіль + мови» займали стільки ж, скільки
 * нижня кнопка меню «Про музей».
 */

/* ---------- Верхній ряд шапки (десктоп) ---------- */

header.header .header-wrap .content-wrap .top-wrap .account-wrap {
	display: flex;
	width: auto;
	height: 100%;
	aspect-ratio: 1/1;
	border-left: 2px solid var(--main-black);
	transition: var(--slow);
}

header.header .header-wrap .content-wrap .top-wrap .account-wrap .account-link {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 16px;
	font-size: 1.25em;
	line-height: 150%;
	font-weight: 600;
	color: var(--main-black);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

header.header .header-wrap .content-wrap .top-wrap .account-wrap .account-link span {
	display: none;
}

header.header .header-wrap .content-wrap .top-wrap .account-wrap .account-link::before {
	content: '';
	position: relative;
	width: 26px;
	min-width: 26px;
	aspect-ratio: 1/1;
	background: transparent;
	background-image: url(../img/account-icon-black.svg);
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	margin: 0px;
}

/* ---------- Мітка кількості на кошику: менший текст, щоб вміщались 2–3 цифри ---------- */

header.header .header-wrap .content-wrap .top-wrap .cart-wrap .cart-contents span.cart-count {
	width: auto;
	min-width: 18px;
	padding: 0 4px;
	border-radius: 9px;
	font-size: 0.6em;
	font-weight: 600;
	line-height: 100%;
}

/* ---------- Ширини: «кошик + профіль + мови» = ширині «Про музей» ---------- */

@media screen and (min-width: 1440px) {
	/* Звичайна шапка: селектор мови був 12.3%, тепер віддає місце кнопці профілю (62px). */
	header.header .header-wrap .content-wrap .top-wrap:has(.account-wrap) .languages-menu {
		width: calc(12.3% - 62px);
		min-width: calc(12.3% - 62px);
	}

	/* Шапка при прокручуванні (.fixed): мови заміщені бургером, місце бере пошук. */
	header.header.fixed .header-wrap .content-wrap .top-wrap .account-wrap {
		width: 62px;
	}

	header.header.fixed .header-wrap .content-wrap .top-wrap:has(.account-wrap) .search {
		width: calc(47.47% - 124px);
	}
}

/* ---------- Мобільне меню ---------- */

header.header .mobile-menu .buttons-wrap .account-wrap {
	display: none;
	width: 100%;
	transition: var(--slow);
	order: 1;
}

header.header .mobile-menu .buttons-wrap .account-wrap .account-link {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: flex-start;
	text-align: center;
	padding: 16px 30px;
	font-size: 1.125em;
	line-height: 150%;
	font-weight: 600;
	color: var(--main-black);
	text-decoration: none;
	white-space: nowrap;
}

header.header .mobile-menu .buttons-wrap .account-wrap .account-link::before {
	content: '';
	position: relative;
	width: 26px;
	min-width: 26px;
	aspect-ratio: 1/1;
	background: var(--main-white);
	background-image: url(../img/account-icon-black.svg);
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	margin-right: 10px;
}

@media screen and (max-width: 767px) {
	/* Як і кошик: на телефоні кнопка профілю переїжджає з верхнього ряду в мобільне меню. */
	header.header .header-wrap .content-wrap .top-wrap .account-wrap {
		display: none;
	}

	header.header .mobile-menu .buttons-wrap .account-wrap {
		display: flex;
		border-bottom: 2px solid var(--main-black);
	}

	header.header .mobile-menu .buttons-wrap .account-wrap .account-link {
		padding: 15px 20px;
	}
}

/* Магазин: стрілка в меню шапки лише в пунктів із підменю */
header.header .header-wrap .content-wrap .bottom-wrap .header-menu ul.menu > li:not(.menu-item-has-children) > a::after,
header.header .mobile-menu .menus-wrap .header-menu > ul > li:not(.menu-item-has-children) > a::after {
	content: none;
}

/* ---------- Магазин: шапка в один ряд на широких екранах ----------
 * Логотип | пункти меню | пошук | доступність | кошик | кабінет.
 * Нижче 1440px шапка і так однорядкова (меню — у «бургері»).
 * Однаково для звичайної та прокрученої (.fixed) шапки.
 */
@media screen and (min-width: 1440px) {
	.site#page {
		padding-top: 70px;
	}

	header.header .header-wrap .logos-wrap,
	header.header.fixed .header-wrap .logos-wrap {
		width: 25%;
	}

	header.header .header-wrap .logos-wrap a.logos {
		padding: 10px 22px;
	}

	header.header .header-wrap .logos-wrap a.logos::before,
	header.header .header-wrap .logos-wrap a.logos .main-logo,
	header.header .header-wrap .logos-wrap a.logos .side-logo {
		height: 46px;
	}

	header.header .header-wrap .content-wrap,
	header.header.fixed .header-wrap .content-wrap {
		flex-direction: row;
		width: 75%;
	}

	header.header .header-wrap .content-wrap .bottom-wrap,
	header.header.fixed .header-wrap .content-wrap .bottom-wrap {
		order: -1;
		flex: 1 1 auto;
		width: auto;
		height: auto;
		min-height: 66px;
		border-top: 0;
		overflow: visible;
	}

	header.header .header-wrap .content-wrap .bottom-wrap .header-menu:nth-child(1),
	header.header.fixed .header-wrap .content-wrap .bottom-wrap .header-menu:nth-child(1) {
		width: 100%;
	}

	header.header .header-wrap .content-wrap .bottom-wrap .header-menu ul.menu > li {
		flex: 1 1 auto;
		width: auto;
	}

	header.header .header-wrap .content-wrap .bottom-wrap .header-menu ul.menu > li > a {
		padding: 0 20px;
		white-space: nowrap;
	}

	header.header .header-wrap .content-wrap .top-wrap,
	header.header.fixed .header-wrap .content-wrap .top-wrap {
		flex: 0 0 auto;
		width: auto;
		min-height: 66px;
	}

	/* :has(...) — щоб перебити старі правила прокрученої шапки з відсотковими ширинами */
	header.header .header-wrap .content-wrap .top-wrap .search,
	header.header.fixed .header-wrap .content-wrap .top-wrap .search,
	header.header.fixed .header-wrap .content-wrap .top-wrap:has(.account-wrap) .search {
		flex: 0 0 340px;
		width: 340px;
	}

	header.header .header-wrap .content-wrap .top-wrap .accessibility-menu,
	header.header .header-wrap .content-wrap .top-wrap .cart-wrap,
	header.header .header-wrap .content-wrap .top-wrap .account-wrap,
	header.header.fixed .header-wrap .content-wrap .top-wrap .accessibility-menu,
	header.header.fixed .header-wrap .content-wrap .top-wrap .cart-wrap,
	header.header.fixed .header-wrap .content-wrap .top-wrap .account-wrap {
		flex: 0 0 66px;
		width: 66px;
	}

	header.header .header-wrap .content-wrap .top-wrap .menu-burger,
	header.header.fixed .header-wrap .content-wrap .top-wrap .menu-burger,
	header.header.fixed .header-wrap .content-wrap .top-wrap:has(.cart-wrap) .menu-burger {
		display: none;
	}
}
