/*
 * =============================================================================
 * @summary Шапка по варианту 1 (задача Б24 570970): тёмная, цвета первого экрана
 *
 * @remarks Подключается на всех страницах из inc/assets.php после Tailwind. Всё внутри .hd1 —
 *          ссылки меню (.nav-link), мега-меню и мобильное меню выводятся прежней разметкой
 *          (inc/nav.php, parts/header/), здесь только их вид в тёмной шапке.
 *          Сетка — как у .dh-wrap главной: ширина 1440 px, поля 60 px.
 * =============================================================================
 */

.hd1 {
  --hd-ink: #182628;
  --hd-green: #1a6b4a;
  --hd-green-h: #14583c;
  --hd-leaf: #7fc4a3;
  --hd-silver: #a9b6b4;
  --hd-soft: #c9d3d1;
  --hd-hair: rgba(255, 255, 255, .09);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--hd-ink);
  color: #fff;
  font: 400 15px/1.4 Lato, Arial, sans-serif;
  transition: transform .3s ease;
}
.hd1 a { text-decoration: none; }
.hd1-wrap { max-width: 1440px; margin: 0 auto; padding: 0 60px; }

/* Строка контактов: филиалы, часы, мессенджеры */
.hd1-util { border-bottom: 1px solid var(--hd-hair); font-size: 13px; color: var(--hd-silver); }
.hd1-util .hd1-wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 40px; }
.hd1-branches, .hd1-aside { display: flex; align-items: center; gap: 28px; min-width: 0; }
.hd1-branch { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.hd1-branch svg { width: 14px; height: 14px; flex: none; color: var(--hd-leaf); }
.hd1-branch a { font-weight: 700; color: #fff; letter-spacing: .01em; transition: color .2s; }
.hd1-branch a:hover { color: var(--hd-leaf); }
.hd1-status-line { display: inline-flex; align-items: center; gap: 6px; }
.hd1-status:not([hidden]) + .hd1-hours::before { content: "· "; }
.hd1-status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.hd1-status[hidden] { display: none; }
.hd1-dot { width: 7px; height: 7px; border-radius: 50%; background: #4fd08a; box-shadow: 0 0 0 3px rgba(79, 208, 138, .18); }
.hd1-status.is-closed .hd1-dot { background: #e0a458; box-shadow: 0 0 0 3px rgba(224, 164, 88, .18); }
.hd1-status b { font-weight: 400; color: #fff; }
.hd1-hours { white-space: nowrap; }
.hd1-sep { width: 1px; height: 14px; background: var(--hd-hair); }
.hd1-msg { display: inline-flex; align-items: center; gap: 6px; color: var(--hd-soft); transition: color .2s; }
.hd1-msg svg { width: 15px; height: 15px; }
.hd1-msg:hover { color: #fff; }

/* Основная строка: логотип, меню, запись */
.hd1-main { position: relative; }
.hd1-main > .hd1-wrap { display: flex; align-items: center; justify-content: space-between; gap: 32px; height: 80px; }
.hd1-logo { display: flex; align-items: center; gap: 16px; flex: none; transition: opacity .2s; }
.hd1-logo:hover { opacity: .9; }
.hd1-logo small { font: 700 11px/1 Lato, Arial, sans-serif; letter-spacing: .3em; text-transform: uppercase; color: var(--hd-silver); padding-top: 3px; }
.hd1-logo i { width: 1px; height: 30px; background: rgba(255, 255, 255, .16); }
.hd1-logo span { font: 400 32px/1 Lora, Georgia, serif; letter-spacing: -.01em; color: #fff; }
.hd1-nav { display: flex; align-items: center; gap: 34px; }
.hd1 .nav-link { position: relative; color: var(--hd-soft); font-weight: 400; padding: 8px 0; }
.hd1 .nav-link:hover, .hd1 .nav-link.active { color: #fff; }
.hd1 .nav-link.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--hd-leaf); }
.hd1 .nav-link svg { width: 14px; height: 14px; opacity: .7; }

/* Мега-меню «Услуги» (parts/header/mega-menu.php): светлая панель под шапкой —
   слева разделы, в центре услуги раздела под курсором, справа запись */
.hd1-svc { height: 80px; display: flex; align-items: center; }
.hd1-svc > .nav-link { display: inline-flex; align-items: center; gap: 6px; }
.hd1-svc > .nav-link svg { transition: transform .2s; }
.hd1-svc:hover > .nav-link, .hd1-svc:focus-within > .nav-link { color: #fff; }
.hd1-svc:hover > .nav-link svg, .hd1-svc:focus-within > .nav-link svg { transform: rotate(180deg); }
.hd1-mega {
  --mg-ink: #182628; --mg-text: #2c2c2c; --mg-muted: #5b6672; --mg-line: #e5e7eb; --mg-pale: #f4f8f6; --mg-mint: #e8f4ed;
  position: absolute; left: 0; right: 0; top: 100%;
  background: #fff; color: var(--mg-text);
  box-shadow: 0 0 0 100vmax rgba(12, 22, 23, .4); clip-path: inset(0 -100vmax -100vmax -100vmax);
  max-height: calc(100vh - 120px); overflow-y: auto;
  opacity: 0; visibility: hidden; transition: opacity .18s ease .08s, visibility 0s linear .26s;
}
.hd1-svc:hover > .hd1-mega, .hd1-svc:focus-within > .hd1-mega { opacity: 1; visibility: visible; transition-delay: .06s, 0s; }
.hd1-mega > .hd1-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; min-height: 440px; }
.hd1-mega-cats { list-style: none; margin: 0; padding: 28px 24px 28px 0; border-right: 1px solid var(--mg-line); display: flex; flex-direction: column; gap: 2px; }
.hd1 .hd1-cat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 0; border-radius: 10px; color: var(--mg-ink); background: transparent; transition: background-color .15s; }
.hd1 .hd1-cat span { display: flex; flex-direction: column; gap: 2px; font: 400 19px/1.25 Lora, Georgia, serif; }
.hd1 .hd1-cat small { font: 400 13px/1.3 Lato, Arial, sans-serif; color: var(--mg-muted); }
.hd1 .hd1-cat svg { width: 18px; height: 18px; flex: none; color: var(--hd-green); transition: opacity .15s; }
.hd1 .hd1-cat:hover, .hd1 .hd1-cat.active { background: var(--mg-mint); color: var(--mg-ink); }
.hd1-pane { padding: 32px 48px 40px; }
.hd1-pane.hidden { display: none; }
.hd1-pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.hd1-pane-head p { margin: 0; font: 400 28px/1.2 Lora, Georgia, serif; color: var(--mg-ink); letter-spacing: -.01em; }
.hd1-pane-head a { flex: none; font-size: 15px; font-weight: 700; color: var(--hd-green); }
.hd1-pane-head a:hover { color: var(--hd-green-h); }
.hd1-pane-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
.hd1-pane-list a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--mg-line); font-size: 16px; line-height: 1.4; color: var(--mg-text); transition: color .15s; }
.hd1-pane-list a svg { width: 16px; height: 16px; flex: none; color: var(--hd-green); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.hd1-pane-list a:hover { color: var(--hd-green); }
.hd1-pane-list a:hover svg { opacity: 1; transform: none; }
.hd1-mega-card { align-self: start; margin: 28px 0 28px; padding: 26px 24px; border-radius: 16px; background: var(--mg-pale); display: flex; flex-direction: column; gap: 12px; }
.hd1-mega-card-title { margin: 0; font: 400 22px/1.25 Lora, Georgia, serif; color: var(--mg-ink); }
.hd1-mega-card-text { margin: 0 0 4px; font-size: 15px; line-height: 1.5; color: var(--mg-muted); }
.hd1-mega-card .hd1-cta { justify-content: center; }
.hd1-mega-card-phone { display: flex; flex-direction: column; gap: 1px; padding-top: 10px; border-top: 1px solid var(--mg-line); font-size: 13px; color: var(--mg-muted); }
.hd1-mega-card-phone + .hd1-mega-card-phone { border-top: 0; padding-top: 0; }
.hd1-mega-card-phone a { font-size: 16px; font-weight: 700; color: var(--mg-ink); }
.hd1-mega-links { display: flex; gap: 20px; margin-top: 6px; font-size: 14px; }
.hd1-mega-links a { color: var(--hd-green); border-bottom: 1px solid rgba(26, 107, 74, .3); padding-bottom: 1px; }
.hd1-mega-empty { grid-column: 1 / -1; padding: 40px 0; }
.hd1-mega a:focus-visible, .hd1 .nav-link:focus-visible { outline: 2px solid var(--hd-leaf); outline-offset: 3px; border-radius: 4px; }
.hd1-cta { flex: none; display: inline-flex; align-items: center; height: 46px; padding: 0 22px; border-radius: 8px; background: var(--hd-green); color: #fff; font-weight: 700; font-size: 15px; white-space: nowrap; transition: background-color .2s; }
.hd1-cta:hover { background: var(--hd-green-h); color: #fff; }
.hd1-cta-short { display: none; }
.hd1-actions { display: none; }

/* Мобильное меню (parts/header/mobile-menu.php, mobile-services.php): светлая панель под тёмной строкой */
.hd1 #mobile-menu { position: relative; z-index: 1; margin: 0; padding: 4px 24px 28px; border-top: 0; background: #fff; color: #2c2c2c; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; }
.hd1 #mobile-menu.hidden { display: none; }
body:has(.dh-mbar) .hd1 #mobile-menu { padding-bottom: 100px; }
.hd1-mm-nav { display: flex; flex-direction: column; }
.hd1 .nav-link-mobile { display: block; padding: 14px 0; color: #182628; font: 400 20px/1.3 Lora, Georgia, serif; border-bottom: 1px solid #e5e7eb; }
.hd1 .nav-link-mobile:hover { color: #182628; }
.hd1 .nav-link-mobile.active { color: var(--hd-green); }
.hd1-msvc-row { display: flex; align-items: stretch; border-bottom: 1px solid #e5e7eb; }
.hd1-msvc-row .nav-link-mobile { flex: 1; border-bottom: 0; }
.hd1 #mobile-services-toggle { width: 52px; display: inline-flex; align-items: center; justify-content: flex-end; padding: 0; background: none; border: 0; color: #5b6672; cursor: pointer; }
.hd1 #mobile-services-toggle svg { width: 22px; height: 22px; transition: transform .2s; }
.hd1 #mobile-services-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.hd1-msvc-list { display: flex; flex-direction: column; padding: 8px 0 12px; border-bottom: 1px solid #e5e7eb; }
.hd1-msvc-list.hidden { display: none; }
.hd1-msvc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #2c2c2c; font-size: 17px; }
.hd1-msvc-head:active { background: #e8f4ed; }
.hd1-msvc-head small { min-width: 26px; padding: 2px 8px; border-radius: 999px; background: #f4f8f6; font-size: 13px; color: #5b6672; text-align: center; }
.hd1-msvc-all { padding: 11px 14px; font-size: 16px; font-weight: 700; color: var(--hd-green); }
.hd1 .hd1-mm-cta { display: flex; justify-content: center; width: 100%; height: 52px; margin-top: 24px; }
.hd1-mm-branches { display: grid; gap: 14px; margin-top: 24px; }
.hd1-mm-branch { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: #5b6672; }
.hd1-mm-branch a { color: #182628; font-size: 18px; font-weight: 700; }
.hd1-mm-socials { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.hd1-mm-socials a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 8px; border: 1px solid #d5dbd9; color: #182628; font-size: 15px; }
.hd1-mm-socials svg { width: 18px; height: 18px; color: var(--hd-green); }

@media (max-width: 1279px) {
  .hd1-mega > .hd1-wrap { grid-template-columns: 270px minmax(0, 1fr) 240px; }
  .hd1 .hd1-cat span { font-size: 18px; }
  .hd1-mega-cats { padding-right: 16px; }
  .hd1-pane { padding: 28px 32px 36px; }
  .hd1-pane-list { grid-template-columns: 1fr; }
  .hd1-nav { gap: 20px; }
  .hd1-cta { padding: 0 18px; }
  .hd1-logo small, .hd1-logo i, .hd1-hours, .hd1-msg span { display: none; }
  .hd1-logo span { font-size: 28px; }
  .hd1-cta-full { display: none; }
  .hd1-cta-short { display: inline; }
}

/* Поля — как у .dh-wrap главной: 24 px до 1024 px, 16 px до 640 px */
@media (max-width: 1024px) {
  .hd1-wrap { padding: 0 24px; }
  .hd1-mega > .hd1-wrap { grid-template-columns: 240px minmax(0, 1fr); }
  .hd1-mega-card { display: none; }
}

@media (max-width: 1023px) {
  .hd1-util, .hd1-nav, .hd1-cta { display: none; }
  .hd1-main > .hd1-wrap { height: 64px; gap: 12px; }
  .hd1-logo { gap: 12px; }
  .hd1-logo small, .hd1-logo i { display: inline-block; }
  .hd1-logo small { font-size: 9px; letter-spacing: .26em; }
  .hd1-logo i { height: 24px; }
  .hd1-logo span { font-size: 24px; }
  .hd1-actions { display: flex; align-items: center; gap: 8px; flex: none; }
  .hd1-ibtn { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: #fff; }
  .hd1-ibtn svg { width: 20px; height: 20px; }
  /* main.css задаёт кнопке меню тёмный цвет, display: block !important и отступы */
  .hd1 #mobile-menu-button { display: inline-flex !important; padding: 0; border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: #fff; }
  .hd1 #mobile-menu-button:hover, .hd1 #mobile-menu-button[aria-expanded="true"] { color: #fff; border-color: rgba(255, 255, 255, .32); }
}

@media (max-width: 640px) {
  .hd1-wrap { padding: 0 16px; }
  .hd1 #mobile-menu { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 399px) {
  .hd1-logo small, .hd1-logo i { display: none; }
}
