/* ==========================================================================
   HEADER & NAVIGATION COMPONENT - FIXED
   ========================================================================== */

/* Header */
.site-header {
  background: #fff;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transform: translateZ(0);
  isolation: isolate;
}

/* Account for WordPress admin bar (32px on desktop, 46px on mobile) */
.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 24px;
  position: relative;
}

.site-logo {
  z-index: 100002;
  position: relative;
  justify-self: start;
}

.site-logo img {
  max-height: 40px;
  width: auto;
}

.site-logo a {
  display: block;
  line-height: 0;
}

/* Mobile menu contact block (shown only inside the mobile menu) */
.mobile-menu-contact {
  display: none;
}

/* Get in touch CTA button */
.header-cta {
  justify-self: end;
}

.header-cta-btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  /* Ghost button: oversized gradient parked on its transparent (right) half. */
  background-image: linear-gradient(to left, transparent 50%, var(--navy) 50%);
  background-size: 200% 100%;
  background-position: right center;
  background-repeat: no-repeat;
  transition: background-position 150ms linear, color 150ms linear;
}

@media (hover: hover) {
.header-cta-btn:hover {
  /* Slide the navy half in from the left. */
  background-position: left center;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}
}

/* Fill the gap between admin bar and sticky header to prevent content showing through */
.admin-bar .site-header::before {
  content: "";
  position: absolute;
  top: -32px;
  left: 0;
  width: 100%;
  height: 32px;
  background: #fff;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header::before {
    top: -46px;
    height: 46px;
  }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 26px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 100001;
  position: relative;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #333;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: absolute;
}

.hamburger-line:first-child {
  top: 8px;
}

.hamburger-line:last-child {
  bottom: 8px;
}

.mobile-menu-toggle.active .hamburger-line:first-child {
  transform: rotate(45deg);
  top: 12px;
}

.mobile-menu-toggle.active .hamburger-line:last-child {
  transform: rotate(-45deg);
  bottom: 12px;
}

/* Navigation */
.main-nav {
  z-index: 99999;
  justify-self: center;
}

.main-nav .menu {
  display: flex;
  gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.main-nav .menu > li {
  position: relative;
}

.main-nav .menu li a {
  color: #333;
  font-size: 0.95rem;
  text-decoration: none;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  display: block;
  padding: 8px 0;
}

@media (hover: hover) {
.main-nav .menu li a:hover {
  color: var(--navy);
}
}

@media (hover: hover) {
/* Underline beneath top-level items on hover (not dropdown parents) */
.main-nav .menu > li:not(.menu-item-has-children) > a:hover {
  text-decoration: underline;
  text-underline-offset: 8px;
  text-decoration-thickness: 2px;
}
}

/* Dropdown Submenu */
.main-nav .menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 220px;
  list-style: none;
  margin: 0;
  padding: 15px 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 9999;
}

/* Desktop dropdown opens on click — see .dropdown-open below + initDropdownMenu() */
.main-nav .menu .sub-menu li {
  padding: 0;
}

.main-nav .menu .sub-menu li a {
  padding: 12px 25px;
  color: #4a5568;
  font-size: 0.9rem;
}

.main-nav .menu-item-has-children > a::after {
  content: "\f107";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: 6px;
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

/* Desktop click-to-open dropdown: panel reveal + green arrow that slides in */
@media (min-width: 769px) {
  .main-nav .menu-item-has-children.dropdown-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .main-nav .menu-item-has-children.dropdown-open > a::after {
    transform: rotate(180deg);
  }

  .main-nav .menu .sub-menu li a {
    position: relative;
    white-space: nowrap;
    transition: color 0.2s ease, padding 0.2s ease;
  }

  .main-nav .menu .sub-menu li a::before {
    content: "\2192"; /* → */
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translate(-6px, -50%);
    color: var(--accent);
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
  }

  .main-nav .menu .sub-menu li a:hover {
    color: var(--accent);
    padding-left: 34px;
  }

  .main-nav .menu .sub-menu li a:hover::before {
    opacity: 1;
    transform: translate(0, -50%);
  }

  /* "View all services" overview link, set apart from the specific services */
  .main-nav .sub-menu .menu-item-view-all {
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
    padding-bottom: 4px;
  }

  .main-nav .sub-menu .menu-item-view-all > a {
    font-weight: 600;
    color: #1a1a1a;
  }

  /* "More services" group label / divider */
  .main-nav .sub-menu .menu-item-services-divider {
    border-top: 1px solid #eee;
    margin-top: 6px;
    padding-top: 8px;
  }

  .main-nav .sub-menu .menu-item-services-divider > a::before {
    display: none;
  }
}

/* "More services" is a non-clickable group label (desktop + mobile) */
.main-nav .sub-menu .menu-item-services-divider > a {
  pointer-events: none;
  cursor: default;
  color: #9aa0a6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

/* Header Scroll Effects */
.site-header.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.site-header.header-hidden {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

/* On the blog listing / category archives, keep the header pinned so the
   sticky category tabs sit cleanly beneath it (no image bleed on scroll). */
.blog-archive-page .site-header.header-hidden {
  transform: none;
}

/* ==========================================================================
   RESPONSIVE NAVIGATION
   ========================================================================== */

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex !important;
  }

  .main-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* account for mobile browser chrome so the bottom is reachable */
    background: #fff;
    transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100000;
    padding-top: 80px;
    overflow-y: auto;
  }

  .main-nav.active {
    left: 0;
  }

  .main-nav .menu {
    flex-direction: column;
    gap: 0;
    padding: 10px 30px 20px !important;
    height: auto;
    align-items: stretch;
  }

  .main-nav .menu > li {
    width: 100%;
    border-bottom: 1px solid #ececec;
  }

  .main-nav .menu li:last-child {
    border-bottom: none;
  }

  .main-nav .menu > li > a {
    position: relative;
    display: block;
    padding: 22px 0 !important;
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #1a1a1a;
  }

  /* Parent items: boxed chevron toggle + underline when open */
  .main-nav .menu-item-has-children > a {
    padding-right: 56px !important;
  }

  .main-nav .menu-item-has-children > a::after {
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 0;
    top: 50%;
    margin: -20px 0 0 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f2;
    border-radius: 8px;
    color: #333;
    font-size: 0.85rem;
    float: none;
    transition: transform 0.3s ease;
  }

  .main-nav .menu-item-has-children.submenu-open > a {
    text-decoration: underline;
    text-decoration-color: var(--navy);
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
  }

  .main-nav .menu-item-has-children.submenu-open > a::after {
    transform: rotate(180deg);
  }

  /* Submenu */
  .main-nav .menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    padding: 0 0 12px;
    margin-left: 0;
    display: none;
  }

  .main-nav .menu-item-has-children.submenu-open > .sub-menu {
    display: block;
  }

  .main-nav .menu .sub-menu li {
    border-bottom: none;
  }

  .main-nav .menu .sub-menu li a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0 !important;
    font-size: 1.1rem;
    color: #333;
  }

  .main-nav .menu .sub-menu li a::after {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--navy);
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  /* Contact block at the bottom of the mobile menu */
  .mobile-menu-contact {
    display: block;
    padding: 36px 30px 60px;
  }

  .mmc-heading {
    font-size: 1.9rem;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 26px;
  }

  .mmc-dot {
    color: var(--accent);
  }

  .mmc-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 18px;
  }

  .mmc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .mmc-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1rem;
    color: #333;
  }

  .mmc-list li i {
    color: #1a1a1a;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
  }

  .mmc-list li a {
    color: var(--accent);
    text-decoration: none;
  }

  .header-inner {
    display: flex;
    justify-content: space-between;
    padding: 14px 20px;
  }

  .header-cta {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 12px 15px;
  }

  .main-nav .menu {
    padding: 8px 24px 16px !important;
  }

  .main-nav .menu > li > a {
    padding: 20px 0 !important;
    font-size: 1.45rem;
  }

  .mobile-menu-contact {
    padding: 30px 24px 60px;
  }
}
