/* =============================================================================
   CE Theme — Site Header (dark)
   ========================================================================== */

:root {
  --header-h:          70px;
  --header-bg:         #1a1a1a;
  --header-bg-scroll:  rgba(26, 26, 26, 0.97);
  --header-border:     rgba(255, 255, 255, 0.08);
  --header-transition: .3s cubic-bezier(.4, 0, .2, 1);
}

/* ---- Base ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  transition: height var(--header-transition), box-shadow var(--header-transition), background var(--header-transition);
}

.admin-bar .site-header { top: 32px; }

/* Компактний при скролі */
.site-header.is-scrolled {
  height: 60px;
  background: var(--header-bg-scroll);
  box-shadow: 0 4px 24px rgb(0 0 0 / .35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: transparent;
}

/* ---- Inner layout ---- */
.header-inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  justify-content:space-between;
}

/* ---- Logo ---- */
.header-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.header-logo__img {
  height: 42px;
  width: auto;
  display: block;
  transition: opacity var(--header-transition);
}
.site-header.is-scrolled .header-logo__img { height: 36px; }
.header-logo:hover .header-logo__img { opacity: .85; }

/* ---- Navigation ---- */
.header-nav { flex: 1; }

.header-nav__list {
  display: flex;
  align-items: center;
  gap: .1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav__list > li > a {
  display: block;
  padding: .5rem .85rem;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  transition: color var(--header-transition), background var(--header-transition);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .01em;
}

.header-nav__list > li > a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.header-nav__list > li.current-menu-item > a,
.header-nav__list > li.current-page-ancestor > a {
  color: var(--color-primary);
  background: rgba(90, 186, 40, 0.12);
  font-weight: 600;
}

/* ---- Dropdown submenu ---- */
.header-nav__list > li {
  position: relative;
}

/* Arrow indicator on parent items that have a submenu */
.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.5);
  margin-left: .4rem;
  vertical-align: middle;
  transition: transform var(--header-transition), border-top-color var(--header-transition);
}
.menu-item-has-children:hover > a::after {
  border-top-color: #fff;
  transform: rotate(180deg);
}

.sub-menu {
  list-style: none;
  margin: 0;
  /* padding-top bridges the gap so hover is not lost when moving cursor down */
  padding: 8px 0 .5rem;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #242424;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--color-primary);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity .2s ease,
    visibility .2s ease,
    transform .2s ease;
  z-index: 200;
  pointer-events: none;
}

/* Transparent bridge between <a> and .sub-menu to prevent hover gap */
.sub-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background: transparent;
}

.header-nav__list > li:hover > .sub-menu,
.header-nav__list > li:focus-within > .sub-menu,
.header-nav__list > li.is-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.sub-menu li {
  list-style: none;
}

.sub-menu li a {
  display: block;
  padding: .65rem 1.1rem;
  font-size: .825rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, padding-left .2s ease;
}
.sub-menu li a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  padding-left: 1.4rem;
}
.sub-menu li.current-menu-item > a {
  color: var(--color-primary);
  background: rgba(90, 186, 40, 0.1);
}

/* ---- Actions ---- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-shrink: 0;
}

.header-phone {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--header-transition);
}
.header-phone:hover { color: var(--color-primary); }
.header-phone__icon { flex-shrink: 0; color: var(--color-primary); }

/* Separator */
.header-actions::before {
  content: '';
  width: 1px;
  height: 28px;
  background: var(--header-border);
}

.header-cta {
  font-size: .85rem;
  padding: .5rem 1.2rem;
  border-radius: var(--radius);
}

/* ---- Burger ---- */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 17px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.menu-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  transition: transform .3s ease, opacity .25s ease, width .3s ease;
  transform-origin: center;
}
.menu-toggle__bar:nth-child(2) { width: 75%; }

/* Open state → X */
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---- Mobile Drawer Overlay (окремий елемент для кліку поза меню) ---- */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 790;
  opacity: 0;
  transition: opacity .35s ease;
}
.mobile-drawer-overlay.is-visible {
  display: block;
}
.mobile-drawer-overlay.is-active {
  opacity: 1;
}

/* ---- Mobile Drawer ---- */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 100vw);
  background: var(--header-bg);
  border-left: 1px solid var(--header-border);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  z-index: 800;
  overflow-y: auto;
}
.mobile-drawer[aria-hidden="false"] { transform: translateX(0); }

.mobile-drawer__inner {
  padding: 0 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-height: 100%;
}

/* ---- Drawer header: brand + close button ---- */
.mobile-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0 1rem;
  border-bottom: 1px solid var(--header-border);
  margin-bottom: .5rem;
  position: sticky;
  top: 0;
  background: var(--header-bg);
  z-index: 1;
}

.mobile-drawer__brand {
  font-size: .8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.mobile-drawer__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background var(--header-transition), color var(--header-transition), transform .2s ease;
  flex-shrink: 0;
}
.mobile-drawer__close:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  transform: rotate(90deg);
}

.mobile-nav__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.mobile-nav__list a {
  display: block;
  padding: .9rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid var(--header-border);
  text-decoration: none;
  transition: color var(--header-transition), padding-left var(--header-transition);
}
.mobile-nav__list a:hover,
.mobile-nav__list .current-menu-item > a {
  color: var(--color-primary);
  padding-left: .5rem;
}

/* Mobile submenu — скидаємо всі десктопні стилі */
.mobile-nav__list .sub-menu {
  position: static;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;   /* ← головний фікс: прибираємо none від десктопу */
  transform: none;
  box-shadow: none;
  border: none;
  background: transparent;
  padding: 0 0 .25rem 1.1rem;
  z-index: auto;
}
.mobile-nav__list .sub-menu li a {
  padding: .55rem 0;
  font-size: .9rem;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: none;
  white-space: normal;
}
.mobile-nav__list .sub-menu li a::before {
  content: '— ';
  color: var(--color-primary);
  opacity: .7;
}
.mobile-nav__list .sub-menu li a:hover,
.mobile-nav__list .sub-menu li a:active {
  color: var(--color-primary);
  padding-left: .3rem;
}

.mobile-drawer__phone {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--header-border);
}
.mobile-drawer__phone:hover { color: var(--color-primary); }

.mobile-drawer__cta {
  text-align: center;
  margin-top: .75rem;
  width: 100%;
  justify-content: center;
}

/* ---- Page offset ---- */
body { padding-top: var(--header-h); }
.hero { margin-top: calc(-1 * var(--header-h)); padding-top: var(--header-h); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .header-nav,
  .header-actions { display: none; }
  .menu-toggle { display: flex; }
}

@media (max-width: 600px) {
  :root { --header-h: 60px; }
  .site-header.is-scrolled { height: 54px; }
}
