/* Domig — шапка (mega-menu). Дизайн: Figma Header 240:2431 (@1440).
   ПОЛНОСТЬЮ в vw (как hero): масштабируется пропорцией макета на любой ширине
   (1px@1440 ≈ 0.0694vw). Цвета/шрифт-семейства — токены; размеры/отступы/шрифты — vw.
   Ниже 1024px → мобильная раскладка (бургер, px). */

.dm-header {
	--dm-ink: #242424;      /* цвет пунктов навигации (из макета, только шапка) */
	position: fixed;        /* ВСЕГДА fixed: нет toggle relative↔fixed → нет реформа
	                           потока (раньше он ронял контент на высоту шапки) и нет
	                           «телепорта» шапки на пороге. sticky не годится — гасится
	                           html/body{overflow-x:clip}. Место резервирует JS-спейсер. */
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	background: var(--wp--preset--color--base);
	transform: translateY(0);
	transition: transform 0.32s ease;
}

/* Резерв места под fixed-шапку (обёртка template-part). Fallback до JS, который ставит
   точную px-высоту. Только header-part: footer тоже .wp-block-template-part — его НЕ трогаем. */
header.wp-block-template-part { min-height: 10.28vw; }

/* ── Скролл-поведение (always-fixed hide/show) ──
   Скролл ВНИЗ (не у верха) → .is-hidden: шапка плавно уезжает вверх (translateY(-100%)).
   Скролл ВВЕРХ → класс снимается, шапка так же плавно возвращается. У самого верха —
   full-шапка (contact-полоса раскрыта). Ниже — .is-condensed (только nav) + тень. */
.dm-header.is-hidden { transform: translateY(-100%); }
.dm-header.is-scrolled { box-shadow: 0 2px 16px rgba(36, 36, 36, 0.06); }
/* Админ-бар WP (только залогиненным) сдвигает страницу на 32px — сдвигаем и fixed-шапку. */
body.admin-bar .dm-header { top: 32px; }
/* Контакт-полоса схлопывается/раскрывается плавно (не display:none — его нельзя
   анимировать → раньше полный хедер «выпрыгивал» резко у верхнего края). Полоса
   стоит ПОД nav-баром → рост вниз, навигацию не дёргает. */
.dm-header.is-condensed .dm-header__contact {
	max-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
	.dm-header,
	.dm-header__contact { transition: none; }
}

/* ── Верхний ряд ── */
.dm-header__bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 6.528vw;             /* 94px */
	padding: 0 5vw;              /* 72px */
}
.dm-header__brand { flex: 0 0 auto; display: inline-flex; }
.dm-header__brand img { display: block; width: 7.847vw; height: 4.306vw; } /* 113×62 */

.dm-nav {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	gap: 1.667vw;               /* 24px */
}
.dm-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 0.556vw;               /* 8px */
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.972vw;         /* 14px */
	font-weight: 600;
	line-height: 1.55;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	color: var(--dm-ink);
	transition: color 0.18s ease;
}
.dm-nav__link:hover,
.dm-nav__link:focus-visible { color: var(--wp--preset--color--primary); }
.dm-caret { flex: 0 0 auto; width: 0.625vw; height: 0.417vw; transition: transform 0.2s ease; } /* 9×6 */
.has-mega.is-open .dm-nav__link { color: var(--wp--preset--color--primary); font-weight: 700; }
.has-mega.is-open .dm-caret { transform: rotate(180deg); }

/* ── Кнопка-пилюля (outline): CTA + кнопки панелей ── */
.dm-btn-outline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 3.333vw;            /* 48px */
	padding: 0 2.222vw;         /* 32px */
	border: 1px solid var(--wp--preset--color--primary);
	border-radius: 999px;
	background: transparent;
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.111vw;         /* 16px */
	font-weight: 500;
	line-height: 1.375;
	white-space: nowrap;
	text-decoration: none;
	color: var(--wp--preset--color--primary);
	transition: background 0.18s ease, color 0.18s ease;
}
.dm-btn-outline:hover,
.dm-btn-outline:focus-visible {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-dark);
}
.dm-cta { flex: 0 0 auto; }

/* ── Контакт-полоса (тёмно-зелёная пилюля) ── */
.dm-header__contact {
	padding: 0 1.111vw 0.278vw;   /* 16px / 4px */
	overflow: hidden;
	max-height: 5vw;              /* > реальной высоты (~46px@1440) — для плавного схлопывания */
	opacity: 1;
	transition: max-height 0.34s ease, opacity 0.28s ease, padding 0.34s ease;
}
.dm-contact {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.667vw;
	padding: 0.694vw 3.889vw;   /* 10px / 56px */
	border-radius: 999px;
	background: var(--wp--preset--color--primary-dark);
	color: #fff;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.972vw;         /* 14px */
	font-weight: 500;
	line-height: 1.528vw;       /* 22px */
}
.dm-contact__addr { position: relative; padding-left: 1.458vw; } /* 21px */
.dm-contact__addr::before {
	content: "";
	position: absolute;
	left: 0.278vw;
	top: 50%;
	transform: translateY(-50%);
	width: 0.347vw;
	height: 0.347vw;            /* 5px */
	border-radius: 50%;
	background: #fff;
}
.dm-contact__meta { display: flex; gap: 2.222vw; }  /* 32px */
.dm-contact .dm-dim { color: rgba(255, 255, 255, 0.6); } /* a11y: ≥4.5:1 на primary-dark (было .3=2.55) */

/* ── Mega-панель (desktop dropdown) ── */
.dm-mega {
	position: absolute;
	left: 50%;
	top: 100%;
	transform: translate(-50%, 0.556vw);
	width: 90.069vw;            /* 1297px */
	padding: 2.222vw;           /* 32px */
	border-radius: 1.667vw;     /* 24px */
	background: var(--wp--preset--color--base);
	box-shadow: 0 0.417vw 2.111vw rgba(190, 190, 190, 0.25);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	z-index: 40;
}
.dm-mega.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate(-50%, 0);
}
.dm-mega__inner {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-height: 29.861vw;       /* 430px */
	gap: 2.778vw;               /* 40px */
}
.dm-mega__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 2.222vw;
}
.dm-mega__title {
	flex: 0 0 auto;
	margin: 0;
	font-size: 2.222vw;         /* 32px */
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--primary-dark);
}
.dm-mega__cols { display: flex; gap: 6.667vw; }   /* 96px */
.dm-col { width: 10.417vw; display: flex; flex-direction: column; gap: 1.667vw; } /* 150px / 24px */
.dm-col__head { display: flex; flex-direction: column; gap: 1.111vw; min-height: 5.556vw; } /* 16 / 80 */
.dm-col__icon img { display: block; width: 3.333vw; height: 3.333vw; } /* 48px */
.dm-col__flag {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.333vw;
	height: 3.333vw;
	border-radius: 0.833vw;     /* 12px */
	background: var(--wp--preset--color--surface);
	font-size: 1.667vw;         /* 24px */
	line-height: 1;
}
.dm-col__label {
	margin: 0;
	font-size: 0.833vw;         /* 12px */
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}
.dm-col__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.111vw; }
.dm-col__links a {
	font-size: 1.25vw;          /* 18px */
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -0.02em;
	text-decoration: none;
	color: var(--wp--preset--color--primary-dark);
	transition: color 0.18s ease;
}
.dm-col__links a:hover { color: var(--wp--preset--color--primary); }

.dm-mega__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.667vw; }
.dm-mega__contact {
	display: flex;
	flex-direction: column;
	gap: 1.111vw;
	font-size: 0.972vw;         /* 14px */
	font-weight: 500;
	line-height: 1.528vw;
	color: var(--wp--preset--color--primary-dark);
}
.dm-mega__contact p { margin: 0; }
.dm-mega__contact a { color: inherit; text-decoration: none; }
.dm-mega__contact a:hover { text-decoration: underline; }
.dm-mega__addr { max-width: 14.792vw; }  /* 213px */
.dm-mega .dm-dim { color: rgba(0, 51, 27, 0.7); } /* a11y: ≥4.5:1 на белом (было .3) */
.dm-mega__actions { display: flex; gap: 1.111vw; }

/* ── Бургер (только мобилка) ── */
.dm-burger { display: none; flex: 0 0 auto; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; padding: 10px; }
.dm-burger span { display: block; height: 2px; border-radius: 2px; background: var(--dm-ink); transition: transform 0.25s ease, opacity 0.2s ease; }
.dm-burger span + span { margin-top: 5px; }
.dm-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.dm-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.dm-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Мобильный оверлей ── */
.dm-mobile { position: fixed; inset: 0; z-index: 200; background: rgba(0, 51, 27, 0.35); opacity: 0; transition: opacity 0.25s ease; }
.dm-mobile.is-open { opacity: 1; }
.dm-mobile__panel {
	position: absolute;
	top: 0;
	right: 0;
	width: min(420px, 92vw);
	height: 100%;
	padding: 88px 24px 32px;
	background: var(--wp--preset--color--base);
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform 0.28s ease;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.dm-mobile.is-open .dm-mobile__panel { transform: translateX(0); }
.dm-mobile__nav { display: flex; flex-direction: column; }
.dm-acc__head,
.dm-mobile__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 14px 0;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
	background: none;
	cursor: pointer;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--r-16);
	font-weight: 600;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--dm-ink);
}
.dm-acc__head .dm-caret { width: 12px; height: 8px; }
.dm-acc.is-open .dm-caret { transform: rotate(180deg); }
.dm-acc__body { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 16px; }
.dm-acc__group { margin: 10px 0 0; font-size: var(--wp--preset--font-size--r-12); font-weight: 600; text-transform: uppercase; color: var(--wp--preset--color--primary); }
.dm-acc__body a { font-size: var(--wp--preset--font-size--r-18); font-weight: 500; text-decoration: none; color: var(--wp--preset--color--primary-dark); }
.dm-mobile__foot { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.dm-mobile__foot .dm-btn-outline { width: 100%; height: 48px; font-size: var(--wp--preset--font-size--r-16); }
.dm-mobile__contact { margin: 8px 0 0; font-size: var(--wp--preset--font-size--r-14); line-height: 22px; color: var(--wp--preset--color--muted); }

body.dm-menu-open { overflow: hidden; }

/* ── Мобилка: шапка на px, бургер ── */
@media (max-width: 1024px) {
	header.wp-block-template-part { min-height: 72px; }  /* fallback-резерв: мобильная шапка 72px */
	.dm-header__bar { height: 72px; padding: 0 20px; }
	.dm-header__brand img { width: 96px; height: 53px; }
	.dm-nav,
	.dm-cta,
	.dm-header__contact,
	.dm-mega { display: none !important; }
	.dm-burger { display: flex; flex-direction: column; justify-content: center; }
}
