/*
 * Site header (includes/aa-header.php). Everything is scoped to #aa-header so the theme's resets
 * (Hello styles every button and link) and the page styles never reach it, and it never reaches them.
 * Looks match the Elementor header it replaces: black bar, white Roboto menu, orange hover, cyan
 * current-page underline, cart amount + orange count badge, cyan MY ACCOUNT.
 */
#aa-header {
  --hd-bg: #000;
  --hd-text: #fff;
  --hd-hover: #ff6000;
  --hd-active: #30e8fd;
  --hd-badge: #f16127;
  --hd-panel: #111;
  --hd-line: #262626;
  --hd-h: 116px;
  position: sticky; top: 0; z-index: 1000;
  background: var(--hd-bg); color: var(--hd-text);
  font-family: Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* logged in: sit under the WordPress admin bar (it scrolls away on phones) */
.admin-bar #aa-header { top: 32px; }
@media (max-width: 782px) { .admin-bar #aa-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar #aa-header { top: 0; } }

#aa-header *, #aa-header *::before, #aa-header *::after { box-sizing: border-box; }
#aa-header a { text-decoration: none; }
#aa-header button {
  margin: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit;
  line-height: 1; text-transform: none; letter-spacing: normal; box-shadow: none; cursor: pointer;
}
#aa-header a:focus-visible, #aa-header button:focus-visible { outline: 2px solid var(--hd-active); outline-offset: 3px; border-radius: 3px; }
#aa-header ul { margin: 0; padding: 0; list-style: none; }

#aa-header .aa-hd-in {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  max-width: 1366px; min-height: var(--hd-h); margin: 0 auto; padding: 0 34px;
}
#aa-header .aa-hd-logo { display: block; line-height: 0; }
#aa-header .aa-hd-logo img { display: block; width: 268px; height: auto; max-width: none; }

/* menu */
#aa-header .aa-hd-menu { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 22px; }
#aa-header .aa-hd-menu > li { position: relative; display: flex; align-items: center; }
#aa-header .aa-hd-menu > li > a {
  position: relative; display: block; padding: 13px 0; color: var(--hd-text);
  font-weight: 500; font-size: 17px; line-height: 20px; white-space: nowrap; cursor: pointer; transition: color .15s;
}
#aa-header .aa-hd-menu > li > a::after {   /* the current-page underline */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--hd-active);
  opacity: 0; transition: opacity .15s;
}
#aa-header .aa-hd-menu > li > a:hover, #aa-header .aa-hd-menu > li:hover > a { color: var(--hd-hover); }
#aa-header .aa-hd-menu > .current-menu-item > a, #aa-header .aa-hd-menu > .current-menu-ancestor > a { color: var(--hd-active); }
#aa-header .aa-hd-menu > .current-menu-item > a::after, #aa-header .aa-hd-menu > .current-menu-ancestor > a::after { opacity: 1; }
#aa-header .aa-hd-sub { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 2px; color: var(--hd-text); }
#aa-header .aa-hd-sub svg { transition: transform .15s; }
#aa-header li.is-open > .aa-hd-sub svg { transform: rotate(180deg); }
#aa-header li:hover > .aa-hd-sub { color: var(--hd-hover); }

/* desktop dropdown: hover, keyboard focus, or the chevron */
#aa-header .sub-menu {
  position: absolute; top: 100%; right: -12px; min-width: 250px; padding: 6px 0;
  background: #252525; box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
}
#aa-header .aa-hd-menu > li:hover > .sub-menu, #aa-header .aa-hd-menu > li:focus-within > .sub-menu, #aa-header .aa-hd-menu > li.is-open > .sub-menu {
  opacity: 1; visibility: visible; transform: none;
}
#aa-header .sub-menu a { display: block; padding: 11px 18px; color: var(--hd-text); font-weight: 600; font-size: 15px; line-height: 1.3; transition: background .15s; }
#aa-header .sub-menu a:hover, #aa-header .sub-menu a:focus-visible { background: var(--hd-badge); color: #fff; outline: none; }
#aa-header .sub-menu .current-menu-item > a { color: var(--hd-active); }
#aa-header .sub-menu .current-menu-item > a:hover { color: #fff; }

/* right side: cart over MY ACCOUNT */
#aa-header .aa-hd-tools { display: grid; justify-items: center; gap: 6px; }
#aa-header .aa-hd-cart { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; color: var(--hd-text); font-weight: 600; font-size: 15px; line-height: 1; }
#aa-header .aa-hd-cart:hover .aa-hd-cart-icon { color: var(--hd-text); }
#aa-header .aa-hd-cart-icon { position: relative; display: block; color: var(--hd-active); line-height: 0; transition: color .15s; }
#aa-header .aa-hd-qty {
  position: absolute; top: -9px; right: -9px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--hd-badge); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
#aa-header .aa-hd-acct { color: var(--hd-active); font-weight: 800; font-size: 14px; line-height: 20px; letter-spacing: .02em; text-transform: uppercase; transition: color .15s; }
#aa-header .aa-hd-acct:hover { color: #1f99a7; }
#aa-header .aa-hd-acct-panel, #aa-header .aa-hd-toggle { display: none; }

@media (max-width: 1240px) {
  #aa-header .aa-hd-in { gap: 18px; padding: 0 20px; }
  #aa-header .aa-hd-logo img { width: 210px; }
  #aa-header .aa-hd-menu { gap: 0 16px; }
  #aa-header .aa-hd-menu > li > a { font-size: 16px; }
}

/* tablets + phones: logo, cart, menu button; the menu drops down as a panel */
@media (max-width: 1080px) {
  #aa-header { --hd-h: 80px; }
  #aa-header .aa-hd-in { grid-template-columns: 1fr auto; padding: 0 16px 0 20px; }
  #aa-header .aa-hd-logo img { width: 170px; }
  #aa-header .aa-hd-tools { grid-auto-flow: column; align-items: center; gap: 6px; }
  #aa-header .aa-hd-acct-bar { display: none; }
  #aa-header .aa-hd-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--hd-text); }
  #aa-header .aa-hd-toggle path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  #aa-header .aa-hd-x { display: none; }
  #aa-header.is-open .aa-hd-x { display: inline; }
  #aa-header.is-open .aa-hd-burger { display: none; }

  #aa-header .aa-hd-nav {
    position: absolute; top: 100%; left: 0; right: 0; display: none;
    max-height: calc(100vh - var(--hd-h)); max-height: calc(100dvh - var(--hd-h)); overflow-y: auto; overscroll-behavior: contain;
    padding: 6px 0 18px; background: var(--hd-panel); border-top: 1px solid var(--hd-line); box-shadow: 0 18px 30px rgba(0, 0, 0, .6);
  }
  #aa-header.is-open .aa-hd-nav { display: block; }
  #aa-header .aa-hd-menu { display: block; }
  #aa-header .aa-hd-menu > li { flex-wrap: wrap; border-bottom: 1px solid var(--hd-line); }
  #aa-header .aa-hd-menu > li > a { flex: 1; padding: 15px 20px; font-size: 17px; }
  #aa-header .aa-hd-menu > li > a::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; }
  #aa-header .aa-hd-sub { width: 52px; height: 50px; margin: 0; }
  #aa-header .sub-menu {
    position: static; flex-basis: 100%; display: none; min-width: 0; padding: 0 0 8px; background: none; box-shadow: none;
    opacity: 1; visibility: visible; transform: none; transition: none;
  }
  #aa-header .aa-hd-menu > li:hover > .sub-menu, #aa-header .aa-hd-menu > li:focus-within > .sub-menu { display: none; }
  #aa-header .aa-hd-menu > li.is-open > .sub-menu { display: block; }
  #aa-header .sub-menu a { padding: 10px 20px 10px 36px; font-weight: 500; font-size: 15px; color: #cfcfcf; }
  #aa-header .aa-hd-acct-panel { display: block; padding: 18px 20px 4px; }
}
@media (max-width: 400px) {
  #aa-header .aa-hd-in { padding: 0 8px 0 16px; gap: 10px; }
  #aa-header .aa-hd-logo img { width: 150px; }
  #aa-header .aa-hd-cart { padding: 5px 6px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { #aa-header * { transition: none !important; } }
