/*--------------------------------------------------------------
# AvaPartner Header v2 (Figma redesign)
#
# Self-contained, token-driven header styling scoped under
# `.site-header--v2`. Loaded after the legacy stylesheets so it
# overrides the old header layout without touching other pages.
# Background intentionally left to the existing rules (transparent
# / translucent) per design brief.
--------------------------------------------------------------*/

.site-header--v2 {
  /* Color tokens */
  --ap-color-text: #101820;
  --ap-color-muted: #5a5a5a;
  --ap-color-accent: #ff5100;
  --ap-color-accent-hover: #e64900;
  --ap-color-border: #e2e5ea;
  --ap-color-surface: #ffffff;
  --ap-color-surface-translucent: rgba(255, 255, 255, 0.79);
  --ap-color-focus: #1c6496;

  /* Spacing tokens */
  --ap-space-1: 4px;
  --ap-space-2: 8px;
  --ap-space-3: 12px;
  --ap-space-4: 16px;
  --ap-space-5: 24px;
  --ap-space-6: 32px;

  /* Typography tokens */
  --ap-font-xs: 13px;
  --ap-font-sm: 14px;
  --ap-font-md: 15px;
  --ap-font-lg: 16px;

  /* Radius + layout tokens */
  --ap-radius-pill: 999px;
  --ap-radius-md: 8px;
  --ap-container: 1200px;
  --ap-topbar-h: 34px;
  --ap-transition: 0.2s ease-in-out;
  --ap-header-blur: 24px;

  /* Frosted-glass header that overlays the hero (Figma: surface #FFFFFF at
     79% + background blur). Overrides the legacy opaque
     `header { background-color: rgba(255,255,255,.9) }` rule. */
  background-color: var(--ap-color-surface-translucent);
  -webkit-backdrop-filter: blur(var(--ap-header-blur));
  backdrop-filter: blur(var(--ap-header-blur));
  border-bottom: 0;
}

.site-header--v2 *,
.site-header--v2 *::before,
.site-header--v2 *::after {
  box-sizing: border-box;
}

.site-header--v2 .aph-container {
  width: 100%;
  max-width: var(--ap-container);
  margin: 0 auto;
  padding-left: var(--ap-space-5);
  padding-right: var(--ap-space-5);
}

/*--------------------------------------------------------------
# Top bar (help + language)
--------------------------------------------------------------*/
.site-header--v2 .aph-topbar {
  border-bottom: 1px solid var(--ap-color-border);
}

.site-header--v2 .aph-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ap-space-3);
  min-height: var(--ap-topbar-h);
}

.site-header--v2 .aph-divider {
  width: 1px;
  height: var(--ap-space-3);
  background-color: var(--ap-color-text);
  flex-shrink: 0;
}

.site-header--v2 .aph-help {
  color: var(--ap-color-text);
  font-size: var(--ap-font-xs);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--ap-transition);
  display: flex;
}

.site-header--v2 .aph-help:hover,
.site-header--v2 .aph-help:focus-visible {
  color: var(--ap-color-accent);
}

/* Static language fallback (used locally / when WPML is absent). */
.site-header--v2 .aph-lang__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--ap-space-2);
  padding: var(--ap-space-1) var(--ap-space-2);
  background: transparent;
  border: 0;
  color: var(--ap-color-muted);
  font-size: var(--ap-font-xs);
  cursor: pointer;
  border-radius: var(--ap-space-1);
  transition: color var(--ap-transition);
}

.site-header--v2 .aph-lang__toggle:hover,
.site-header--v2 .aph-lang__toggle:focus-visible {
  color: var(--ap-color-accent);
}

.site-header--v2 .aph-lang__flag {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  object-fit: cover;
}

.site-header--v2 .aph-lang__chevron {
  width: 10px;
  height: 10px;
}

/* Real WPML widget (production) sits in the top bar; strip legacy
   float / offsets so it aligns in the flex row. */
.site-header--v2 .aph-topbar aside#secondary {
  margin: 0;
}
.site-header--v2 .aph-topbar .widget {
  margin: 0;
}

/*--------------------------------------------------------------
# Main bar
--------------------------------------------------------------*/
.site-header--v2 .aph-bar {
  position: relative;
}

.site-header--v2 .aph-bar__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--ap-space-5);
  min-height: 64px;
}

/* Logo (override legacy float / padding) */
.site-header--v2 .aph-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.site-header--v2 .aph-logo .header-logo {
  float: none;
  padding: 0;
  width: 200px;
  height: auto;
  display: block;
}

/*--------------------------------------------------------------
# Navigation (desktop)
--------------------------------------------------------------*/
.site-header--v2 .aph-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ap-space-4);
  padding: 0;
  width: auto;
}

.site-header--v2 .aph-menu {
  display: flex;
  align-items: center;
  gap: var(--ap-space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: visible;
}

.site-header--v2 .aph-menu li {
  float: none;
  border: 0;
  padding: 0;
  margin: 0;
  position: relative;
}

.site-header--v2 .aph-menu a {
  display: flex;
  padding: var(--ap-space-2) 0;
  color: var(--ap-color-text);
  font-size: var(--ap-font-md);
  font-weight: 400;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--ap-transition);
}

.site-header--v2 .aph-menu a::after {
  content: '';
  display: block;
  height: 2px;
  width: 0;
  margin-top: 4px;
  background: var(--ap-color-accent);
  transition: width var(--ap-transition);
}

.site-header--v2 .aph-menu a:hover,
.site-header--v2 .aph-menu a:focus-visible,
.site-header--v2 .aph-menu .current-menu-item > a {
  color: var(--ap-color-accent);
}

.site-header--v2 .aph-menu a:hover::after,
.site-header--v2 .aph-menu a:focus-visible::after,
.site-header--v2 .aph-menu .current-menu-item > a::after {
  width: 100%;
}

/*--------------------------------------------------------------
# Actions (search + login + CTA)
--------------------------------------------------------------*/
.site-header--v2 .aph-actions {
  display: flex;
  align-items: center;
  gap: var(--ap-space-4);
  flex: 0 0 auto;
  margin: 0;
}

.site-header--v2 .aph-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--ap-radius-pill);
  background: transparent;
  color: var(--ap-color-text);
  cursor: pointer;
  transition: color var(--ap-transition), background var(--ap-transition);
  position: inherit;
}
.site-header--v2 .aph-search-btn svg {
  width: 18px;
  height: 18px;
}
.site-header--v2 .aph-search-btn:hover,
.site-header--v2 .aph-search-btn:focus-visible {
  color: var(--ap-color-accent);
  background: rgba(255, 81, 0, 0.08);
}

/* Login: text link style */
.site-header--v2 .aph-login {
  color: var(--ap-color-text);
  font-size: var(--ap-font-sm);
  font-weight: normal;
  text-decoration: none;
  padding: var(--ap-space-2) var(--ap-space-3);
  transition: color var(--ap-transition);
}
.site-header--v2 .aph-login:hover,
.site-header--v2 .aph-login:focus-visible {
  color: var(--ap-color-accent);
}

/* CTA: orange rounded-rectangle button (Figma) */
.site-header--v2 .aph-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 var(--ap-space-5);
  border: 1px solid var(--ap-color-accent);
  border-radius: var(--ap-radius-md);
  background: var(--ap-color-accent);
  color: #ffffff;
  font-size: var(--ap-font-lg);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--ap-transition), border-color var(--ap-transition), transform var(--ap-transition);
}
.site-header--v2 .aph-cta:hover,
.site-header--v2 .aph-cta:focus-visible {
  background: var(--ap-color-accent-hover);
  border-color: var(--ap-color-accent-hover);
  color: #ffffff;
}
.site-header--v2 .aph-cta:active {
  transform: translateY(1px);
}

/* Shared visible focus ring for accessibility */
.site-header--v2 a:focus-visible,
.site-header--v2 button:focus-visible {
  outline: 2px solid var(--ap-color-focus);
  outline-offset: 2px;
}

/*--------------------------------------------------------------
# Hamburger (mobile) - reuses #nav-icon1 markup
--------------------------------------------------------------*/
/* !important is used deliberately here to defeat stubborn legacy
   id/element rules for #nav-icon1 / button.menu-toggle that live in
   style.css and media.css and would otherwise reposition/recolor the
   burger. Scoped to the redesigned header only. */
.site-header--v2 #nav-icon1.aph-burger {
  display: none;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 32px !important;
  height: 26px;
  margin: 0 !important;
  padding: 0;
  border: 0;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none;
  transform: none !important;
  cursor: pointer;
}
.site-header--v2 #nav-icon1.aph-burger span {
  position: absolute;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--ap-color-text) !important;
  border-radius: 3px;
  opacity: 1;
  transform: none;
  transition: transform var(--ap-transition), opacity var(--ap-transition), top var(--ap-transition);
}
.site-header--v2 #nav-icon1.aph-burger span:nth-child(1) { top: 2px; }
.site-header--v2 #nav-icon1.aph-burger span:nth-child(2) { top: 11px; }
.site-header--v2 #nav-icon1.aph-burger span:nth-child(3) { top: 20px; }

/* Toggled -> X (state driven by navigation.js adding .toggled) */
.site-header--v2 #site-navigation.toggled #nav-icon1.aph-burger span:nth-child(1) {
  top: 11px;
  transform: rotate(45deg);
}
.site-header--v2 #site-navigation.toggled #nav-icon1.aph-burger span:nth-child(2) {
  opacity: 0;
}
.site-header--v2 #site-navigation.toggled #nav-icon1.aph-burger span:nth-child(3) {
  top: 11px;
  transform: rotate(-45deg);
}

/*--------------------------------------------------------------
# Mobile menu (#mobile-header) - hidden on desktop
# NOTE: target the #mobile-header id, not the .aph-mobile-menu class:
# legacy navigation.js mangles the <ul> className on toggle, so the
# class is unreliable while the id is stable.
--------------------------------------------------------------*/
.site-header--v2 #mobile-header {
  display: none;
}

/*--------------------------------------------------------------
# Responsive
--------------------------------------------------------------*/
@media (max-width: 980px) {
  .site-header--v2 .aph-container {
    padding-left: var(--ap-space-4);
    padding-right: var(--ap-space-4);
  }

  /* Show hamburger (absolutely anchored right for deterministic
     placement, independent of legacy flow rules), hide desktop menu */
  .site-header--v2 #nav-icon1.aph-burger {
    display: block;
    position: absolute !important;
    top: 50% !important;
    right: var(--ap-space-4) !important;
    left: auto !important;
    transform: translateY(-50%) !important;
  }
  .site-header--v2 .aph-nav {
    order: 3;
    flex: 0 0 auto;
    width: auto;
    /* Force static so the absolute burger/drawer anchor to
       .aph-bar__inner, not to this collapsed nav (legacy made it
       positioned, which pushed the burger off-screen) */
    position: static !important;
  }
  .site-header--v2 .aph-menu {
    display: none;
  }
  .site-header--v2 .aph-bar__inner {
    flex-wrap: nowrap;
    gap: var(--ap-space-3);
    min-height: 56px;
    /* Reserve room so content never sits under the burger */
    padding-right: 60px;
  }
  .site-header--v2 .aph-logo {
    order: 1;
    margin-right: auto;
  }
  .site-header--v2 .aph-actions {
    order: 2;
    gap: var(--ap-space-3);
  }
  /* Collapse secondary actions into the drawer; keep the CTA */
  .site-header--v2 .aph-actions .aph-login,
  .site-header--v2 .aph-nav .aph-search-btn {
    display: none;
  }
  .site-header--v2 .aph-cta {
    height: 40px;
    padding: 0 var(--ap-space-4);
    font-size: var(--ap-font-md);
  }

  /* Drawer: absolute dropdown built from the existing #mobile-header list */
  .site-header--v2 #mobile-header {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--ap-color-surface);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    transition: max-height 0.3s ease-in-out;
    z-index: 20;
  }
  .site-header--v2 #site-navigation.toggled #mobile-header {
    max-height: 80vh;
    overflow-y: auto;
    border-top: 1px solid var(--ap-color-border);
  }
  .site-header--v2 #mobile-header li {
    float: none;
    border: 0;
    border-bottom: 1px solid var(--ap-color-border);
    padding: 0;
    margin: 0;
    background: transparent !important;
    /* Neutralize legacy JS opacity/transform toggle classes */
    opacity: 1 !important;
    transform: none !important;
  }
  .site-header--v2 #mobile-header a {
    display: block;
    padding: var(--ap-space-4);
    background: transparent !important;
    color: var(--ap-color-text) !important;
    font-size: var(--ap-font-lg);
    font-weight: 500;
    text-decoration: none;
    text-transform: none;
  }
  .site-header--v2 #mobile-header a:hover,
  .site-header--v2 #mobile-header a:focus-visible {
    color: var(--ap-color-accent) !important;
    background: rgba(255, 81, 0, 0.06) !important;
  }
}

@media (max-width: 480px) {
  .site-header--v2 .aph-logo .header-logo {
    width: 140px;
  }
  .site-header--v2 .aph-topbar__inner {
    gap: var(--ap-space-3);
  }
  .site-header--v2 .aph-cta {
    height: 38px;
    padding: 0 var(--ap-space-3);
    font-size: var(--ap-font-xs);
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .site-header--v2 * {
    transition: none !important;
  }
}

@media (max-width: 768px) {
  .site-header--v2 a#registerBtn { 
    display: none !important;
  }
  .site-header--v2 .social-box.mobile-only.language-mobile {
    display: none;
  }
  img.header-logo-toggle.header-logo-toggle-active {
    display: none;
  }
  .site-header--v2 .aph-topbar__inner {
    justify-content: center;
  }
  .site-header--v2 .aph-lang .wpml-ls-legacy-dropdown a.wpml-ls-item-toggle {
    padding-right: 0 !important;
  }
  .site-header--v2 .wpml-ls-legacy-dropdown a.wpml-ls-item-toggle:after {
    display: none !important;
  }
}