/* header.css — Site header and navigation
 * Loaded on every page.
 */

/* ============================================================================
   Header
   ========================================================================= */

.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.header-topbar {
  background-color: var(--color-dark-2);
  color: var(--color-surface);
  padding: var(--space-2) 0;
  font-size: 14px;
}

.header-topbar .container {
  max-width: var(--container-wide);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.topbar-left {
  flex: 1;
}

.topbar-company-name {
  color: var(--color-surface);
  font-weight: 500;
  font-size: 14px;
}

.topbar-contact {
  display: flex;
  gap: var(--space-5);
  /* flex: 1; */
  justify-content: center;
}

.topbar-contact a {
  color: var(--color-surface);
  text-decoration: none;
  transition: color 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.topbar-contact a:hover {
  color: var(--color-accent);
}

.topbar-icon,
.icon.topbar-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--space-2);
  vertical-align: middle;
}

.topbar-social {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.topbar-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-surface);
  transition:
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.topbar-social a:hover {
  color: var(--color-accent);
}

.topbar-social a:active {
  transform: scale(0.93);
}

.topbar-social svg {
  width: 16px;
  height: 16px;
}

/* Topbar Responsive */
@media (max-width: 1310px) {
  .topbar-left,
  .topbar-company-name {
    display: none;
  }
}

@media (max-width: 1024px) {
  .topbar-inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .topbar-contact {
    gap: var(--space-2);
    font-size: 12px;
  }

  .topbar-phone,
  .topbar-email {
    display: flex;
    align-items: center;
  }

  .header-topbar {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .header-topbar {
    padding: var(--space-1) 0;
  }

  .topbar-contact {
    flex-direction: column;
    gap: var(--space-1);
  }

  .topbar-social {
    gap: var(--space-2);
  }
}

.header-main {
  padding: var(--space-2) 0;
}

.header-main .container {
  max-width: var(--container-wide);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
  min-height: 70px;
}

.site-branding {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.site-title a {
  color: var(--color-dark);
  text-decoration: none;
  transition: color 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.site-title a:hover {
  color: var(--color-accent);
}

.site-description {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-soft);
  font-weight: 400;
}

.custom-logo-link {
  display: block;
  max-width: 180px;
  line-height: 0;
}

.custom-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 50px;
}

/* ============================================================================
   Navigation
   ========================================================================= */

.navigation-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-left: auto;
}

.primary-navigation {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-1);
  align-items: center;
}

.nav-menu > li {
  position: relative;
}

/* Add invisible hover bridge for menu items with dropdowns */
.nav-menu > li.menu-item-has-children::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 16px;
  background: transparent;
  z-index: 999;
}

.nav-menu > li > a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  padding: var(--space-3) var(--space-4);
  display: inline-block;
  transition:
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav-menu > li > a:hover,
.nav-menu > li > a:focus {
  color: var(--color-accent);
}

.nav-menu > .current-menu-item > a,
.nav-menu > .current-menu-ancestor > a {
  color: var(--color-accent);
  font-weight: 600;
}

/* Close button hidden on desktop вЂ” only shown inside the mobile overlay */
.nav-close-button {
  display: none;
}

/* Hide desktop submenu toggle buttons */
.submenu-toggle {
  display: none;
}

/* Dropdown Indicator */
.nav-menu > li.menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  vertical-align: middle;
  opacity: 0.6;
  transition:
    opacity 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-menu > li.menu-item-has-children:hover > a::after {
  opacity: 1;
  transform: translateY(2px);
}

/* Dropdown Menu (Submenu) */
.nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  background-color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  padding: var(--space-3) 0;
  margin: 8px 0 0 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity 200ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 200ms cubic-bezier(0.23, 1, 0.32, 1),
    visibility 200ms cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 1000;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-menu .menu-item-has-children:hover > .sub-menu,
.nav-menu .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu .sub-menu li {
  position: relative;
}

.nav-menu .sub-menu a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
  padding: 12px 10px 12px 20px;
  display: block;
  transition:
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    padding-left 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-menu .sub-menu a:hover,
.nav-menu .sub-menu a:focus,
.nav-menu .sub-menu .current-menu-item > a,
.nav-menu .sub-menu .current-menu-ancestor > a,
.nav-menu .sub-menu .current-page-ancestor > a {
  background-color: rgba(255, 58, 45, 0.05);
  color: var(--color-accent);
  padding-left: 24px;
}

/* Nested Dropdown (Third Level) */
.nav-menu .sub-menu .sub-menu {
  left: 96%;
  top: -8px;
  margin: 0 0 0 4px;
}

/* Add invisible hover bridge for nested submenu items */
.nav-menu .sub-menu .menu-item-has-children {
  position: relative;
}

.nav-menu .sub-menu .menu-item-has-children::before {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: 12px;
  height: 100%;
  background: transparent;
  z-index: 999;
}

/* Submenu items with children indicator */
.nav-menu .sub-menu .menu-item-has-children > a {
  display: flex;
  align-items: center;
}

.nav-menu .sub-menu .menu-item-has-children > a::after {
  content: "";
  display: block;
  flex-shrink: 0;
  width: 0;
  height: 0;
  margin-left: auto;
  padding-left: 12px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  opacity: 0.6;
}

/* Header CTA Button */
.header-cta-button {
  white-space: nowrap;
  font-size: 14px;
  padding: 12px 28px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 58, 45, 0.25);
  transition:
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.header-cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 58, 45, 0.35);
}

.header-cta-button:active {
  transform: scale(0.97);
}

/* Mobile Nav CTA вЂ” hidden inside nav on desktop, shown in mobile overlay */
.mobile-nav-cta {
  display: none !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-dark);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  position: relative;
  transition:
    background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.mobile-menu-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.mobile-menu-toggle:active {
  transform: scale(0.93);
}

.mobile-menu-toggle:focus {
  outline: none;
}

/* Hide the SVG icon and screen reader text */
.mobile-menu-toggle svg,
.mobile-menu-toggle .screen-reader-text {
  display: none;
}

/* Create custom burger icon with CSS - 3 lines */
.mobile-menu-toggle::before,
.mobile-menu-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background-color: var(--color-dark);
  border-radius: 2px;
  transition:
    top 200ms cubic-bezier(0.23, 1, 0.32, 1),
    bottom 200ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 200ms cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.mobile-menu-toggle::before {
  top: 12px;
  box-shadow: 0 8px 0 var(--color-dark);
}

.mobile-menu-toggle::after {
  bottom: 12px;
}

/* Animation when menu is open */
.mobile-menu-toggle[aria-expanded="true"]::before {
  top: 50%;
  transform: translateX(-50%) translateY(-50%) rotate(45deg);
  box-shadow: none;
}

.mobile-menu-toggle[aria-expanded="true"]::after {
  bottom: 50%;
  transform: translateX(-50%) translateY(50%) rotate(-45deg);
}

/* Mobile Menu Styles */
@media (max-width: 1024px) {
  .header-main {
    padding: var(--space-3) 0;
  }

  .header-main .container {
    max-width: 100%;
  }

  .header-inner {
    gap: var(--space-3);
    min-height: 60px;
  }

  .site-branding {
    flex: 1;
  }

  .custom-logo {
    max-height: 40px;
  }

  /* Hide desktop dropdown indicators on mobile */
  .nav-menu > li.menu-item-has-children > a::after,
  .nav-menu .sub-menu .menu-item-has-children > a::after {
    display: none;
  }

  .site-title {
    font-size: 20px;
  }

  .navigation-wrapper {
    margin-left: 0;
    gap: var(--space-3);
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .navigation-wrapper {
    position: static;
  }

  /* Hide desktop CTA on mobile */
  .header-cta-button {
    display: none !important;
  }

  /*
   * When the mobile menu is open, the .site-header stacking context
   * (position: sticky; z-index: 100) limits all children — including the
   * fixed nav overlay — to an effective z-index of 100 vs the outside world.
   * Floating widgets (floating-call 9996, floating-video 9990,
   * reviews-sidebar 9997/99990) are outside this context and thus paint above
   * the menu. Raising site-header's z-index while menu-open makes the whole
   * stacking context win above every float.
   */
  body.menu-open .site-header {
    z-index: 100000;
  }

  /* Show mobile CTA fixed at bottom when menu overlay is open */
  .primary-navigation.is-open .mobile-nav-cta {
    display: block !important;
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--space-10));
    max-width: 400px;
    padding: var(--space-4) var(--space-6);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    z-index: 10000;
    box-shadow: none;
    white-space: nowrap;
  }

  .primary-navigation.is-open .mobile-nav-cta:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: none;
  }

  .primary-navigation {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-bg);
    z-index: 9999;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 80px var(--space-5) 120px;
    animation: slideIn 200ms cubic-bezier(0.23, 1, 0.32, 1);
    -webkit-overflow-scrolling: touch;
  }

  .primary-navigation.is-open {
    display: block;
  }

  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: 500px;
    margin: 0 auto;
  }

  .nav-menu > li {
    border-bottom: 1px solid var(--color-border);
  }

  .nav-menu > li:last-child {
    border-bottom: none;
  }

  .nav-menu > li > a {
    padding: var(--space-4) var(--space-5);
    font-size: 17px;
    font-weight: 600;
    color: var(--color-dark);
    display: block;
    transition:
      color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      background-color 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .nav-menu > li > a:hover {
    background-color: var(--color-surface);
    color: var(--color-accent);
  }

  /* Mobile Dropdown Styling */
  .nav-menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background-color: transparent;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  /* Disable hover-based dropdown on mobile */
  .nav-menu .menu-item-has-children:hover > .sub-menu,
  .nav-menu .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
  }

  .nav-menu .menu-item-has-children.is-open > .sub-menu {
    max-height: 2000px;
    transition: max-height 600ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .nav-menu .sub-menu li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .nav-menu .sub-menu li:last-child {
    border-bottom: none;
  }

  .nav-menu .sub-menu a {
    padding: var(--space-3) var(--space-5) var(--space-3) var(--space-7);
    font-size: 15px;
    font-weight: 400;
    color: var(--color-text);
    display: block;
    background-color: var(--color-surface);
    transition:
      background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      padding-left 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .nav-menu .sub-menu a:hover {
    background-color: rgba(255, 58, 45, 0.08);
    color: var(--color-accent);
    padding-left: calc(var(--space-7) + 4px);
  }

  .nav-menu .sub-menu .sub-menu {
    margin: 0;
    background-color: transparent;
  }

  .nav-menu .sub-menu .sub-menu a {
    padding-left: var(--space-9);
    background-color: rgba(0, 0, 0, 0.02);
  }

  .nav-menu .sub-menu .sub-menu a:hover {
    padding-left: calc(var(--space-9) + 4px);
  }

  /*
   * Mobile menu items with children use flexbox:
   * [ <a href> (flex: 1, navigable)  |  <button> (56px, toggle) ]
   * [ <ul class="sub-menu"> (100% width, second row)            ]
   *
   * The button is a normal flex item вЂ” it never moves when the
   * submenu expands, fixing the "disappears when opened" bug.
   */
  .menu-item-has-children {
    display: flex !important;
    flex-wrap: wrap;
    align-items: stretch;
  }

  /* Link fills the row; clicking it navigates to the page */
  .menu-item-has-children > a {
    flex: 1;
    min-width: 0;
  }

  /* Submenu drops below the link+button row */
  .menu-item-has-children > .sub-menu {
    flex-basis: 100%;
    width: 100%;
  }

  /* Chevron toggle вЂ” sits to the right of the link, fixed width */
  .submenu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--color-border);
    padding: 0;
    cursor: pointer;
    color: var(--color-text-soft);
    transition:
      background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .submenu-toggle:hover {
    background-color: var(--color-surface);
    color: var(--color-dark);
  }

  .submenu-toggle:active {
    transform: scale(0.93);
  }

  .submenu-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 250ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .menu-item-has-children.is-open > .submenu-toggle {
    color: var(--color-accent);
    background-color: rgba(255, 58, 45, 0.04);
  }

  .menu-item-has-children.is-open > .submenu-toggle svg {
    transform: rotate(180deg);
  }

  /* Real close button (replaces pseudo-element) */
  .nav-close-button {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-dark);
    border: none;
    border-radius: 50%;
    z-index: 10001;
    cursor: pointer;
    color: var(--color-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    transition:
      background-color 160ms cubic-bezier(0.23, 1, 0.32, 1),
      transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .nav-close-button:hover {
    background-color: var(--color-accent);
    transform: rotate(90deg);
  }

  .nav-close-button:active {
    transform: rotate(90deg) scale(0.93);
  }

  .nav-close-button svg {
    width: 20px;
    height: 20px;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Extra Compact for 1400-1600px */
@media (max-width: 1600px) and (min-width: 1401px) {
  .header-inner {
    gap: var(--space-4);
  }

  .navigation-wrapper {
    gap: var(--space-4);
  }

  .nav-menu {
    gap: 0;
  }

  .nav-menu > li > a {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
  }

  .header-cta-button {
    padding: 10px 18px;
    font-size: 13px;
  }

  .custom-logo {
    max-height: 48px;
  }
}

/* Navigation Adjustments for Narrow Desktops */
@media (max-width: 1400px) and (min-width: 1201px) {
  .header-inner {
    gap: var(--space-3);
  }

  .navigation-wrapper {
    gap: var(--space-3);
  }

  .nav-menu {
    gap: 0;
  }

  .nav-menu > li > a {
    padding: var(--space-2) 10px;
    font-size: 12.5px;
  }

  .header-cta-button {
    padding: 9px 16px;
    font-size: 12.5px;
  }

  .custom-logo {
    max-height: 45px;
  }
}

/* Tablet Adjustments */
@media (max-width: 1200px) and (min-width: 1025px) {
  .navigation-wrapper {
    gap: var(--space-3);
  }

  .nav-menu {
    gap: 0;
  }

  .nav-menu > li > a {
    padding: var(--space-2) var(--space-2);
    font-size: 12px;
  }

  .header-cta-button {
    padding: 8px 16px;
    font-size: 12px;
  }

  .custom-logo {
    max-height: 45px;
  }
}
