/* ==========================================
   HEADER COMPONENT
   Depends on: master.css (variables, .container, .btn, .divider)
   Enqueued after master.css.
   Header is static (scrolls with page) — confirmed, no sticky positioning.
   ========================================== */

/* ------------------------------------------
   Announcement Bar
   ------------------------------------------ */
.announcement-bar {
  background-color: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2) var(--space-4);
  text-align: center;
}

.announcement-bar__text {
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gray);
  margin: 0;
}

/* ------------------------------------------
   Header Main Row
   ------------------------------------------ */
.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: var(--z-sticky);
}

.site-header__main {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.site-header__logo {
  display: block;
  flex-shrink: 0;
  width: 75px;
  height: 75px;
}

.site-header__logo img {
  width: 75px;
  height: 75px;
  object-fit: contain;
}

.site-header__nav {
  flex: 1;
}

/* ------------------------------------------
   Desktop Nav — Main List
   ------------------------------------------ */
.nav-main {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-main__item {
  position: relative;
}

.nav-main__link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-main);
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-white);
  background: none;
  border: none;
  padding: var(--space-2) 0;
  cursor: pointer;
  transition: color var(--t-base);
}

.nav-main__link:hover {
  color: var(--color-primary);
}

.nav-main__item.has-dropdown > .nav-main__link::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: var(--space-2);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--t-base);
}

.nav-main__item.has-dropdown[data-dropdown-open="true"] > .nav-main__link::after {
  transform: rotate(225deg) translateY(2px);
}

/* ------------------------------------------
   Desktop Nav — Dropdown (shared: lock + hover types)
   ------------------------------------------ */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  /* Small negative margin closes the gap so moving the mouse from the
     trigger into the dropdown doesn't cross a dead zone that closes it. */
  margin-top: var(--space-1);
  min-width: 220px;
  background-color: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  z-index: var(--z-dropdown);

  /* Hidden by default; JS toggles visibility via [data-dropdown-open] on the parent li. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity var(--t-base),
    transform var(--t-base),
    visibility var(--t-base);
}

.nav-main__item[data-dropdown-open="true"] > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Nested sub-dropdowns open to the right of their parent item */
.nav-dropdown__item.has-children {
  position: relative;
}

.nav-dropdown__item.has-children > .nav-dropdown {
  top: 0;
  left: 100%;
  margin-top: 0;
  margin-left: var(--space-1);
}

.nav-dropdown__item.has-children[data-dropdown-open="true"] > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown__item.has-children > .nav-dropdown__link::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: var(--space-2);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

.nav-dropdown__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-main);
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--color-gray);
  padding: var(--space-2) var(--space-4);
  white-space: nowrap;
  transition:
    color var(--t-base),
    background-color var(--t-base);
}

.nav-dropdown__link:hover {
  color: var(--color-white);
  background-color: var(--color-surface-2);
}

/* ------------------------------------------
   Site Controls (search / account / cart)
   ------------------------------------------ */
.site-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.site-controls__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--color-white);
  border-radius: var(--radius-base);
  transition: color var(--t-base), background-color var(--t-base);
}

.site-controls__btn:hover {
  color: var(--color-primary);
  background-color: var(--color-surface-2);
}

.site-controls__btn svg {
  width: 20px;
  height: 20px;
}

.account-status-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--color-bg);
}

.account-status-dot.is-logged-in {
  background-color: var(--color-success-text);
}

.account-status-dot.is-logged-out {
  background-color: var(--color-danger-text);
}

.cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background-color: var(--color-primary);
  color: var(--color-bg);
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.cart-count:empty,
.cart-count[data-count="0"] {
  display: none;
}

/* ------------------------------------------
   Hamburger Trigger (mobile/tablet only)
   ------------------------------------------ */
.hamburger-trigger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.hamburger-trigger__bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-white);
  transition: transform var(--t-base), opacity var(--t-base);
}

.hamburger-trigger[aria-expanded="true"] .hamburger-trigger__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-trigger[aria-expanded="true"] .hamburger-trigger__bar:nth-child(2) {
  opacity: 0;
}
.hamburger-trigger[aria-expanded="true"] .hamburger-trigger__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ------------------------------------------
   Mobile Nav Overlay (full-screen takeover)
   ------------------------------------------ */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background-color: var(--color-bg);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--t-base), visibility var(--t-base);
}

.mobile-nav-overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.mobile-nav-overlay__header {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-4) var(--space-5);
}

.mobile-nav-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--color-white);
}

.mobile-nav-overlay__close svg {
  width: 24px;
  height: 24px;
}

.mobile-nav {
  padding: 0 var(--space-5) var(--space-7);
}

.mobile-nav__list {
  display: flex;
  flex-direction: column;
}

.mobile-nav__item {
  border-bottom: 1px solid var(--color-border-soft);
}

.mobile-nav__link {
  display: block;
  font-family: var(--font-main);
  font-size: var(--text-h5);
  color: var(--color-white);
  padding: var(--space-4) 0;
}

.mobile-nav__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-main);
  font-size: var(--text-h5);
  color: var(--color-white);
  padding: var(--space-4) 0;
}

.mobile-nav__chevron {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--color-gray);
  border-bottom: 1.5px solid var(--color-gray);
  transform: rotate(45deg);
  transition: transform var(--t-base);
}

.mobile-nav__toggle[aria-expanded="true"] .mobile-nav__chevron {
  transform: rotate(225deg);
}

.mobile-nav__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--t-slow);
  padding-left: var(--space-4);
}

.mobile-nav__item.is-expanded > .mobile-nav__panel {
  /* JS sets an explicit inline max-height (scrollHeight) when expanding,
     since CSS alone can't animate to "auto" height. This class only
     marks state for styling hooks (e.g. icon rotation above). */
}

.mobile-nav__panel .mobile-nav__link {
  font-size: var(--text-small);
  color: var(--color-gray);
  padding: var(--space-3) 0;
}

/* ==========================================
   RESPONSIVE — breakpoint matches master.css container steps (999px)
   ========================================== */
@media (max-width: 999px) {
  .site-header__nav {
    display: none;
  }

  .hamburger-trigger {
    display: flex;
  }

  .site-header__main {
    gap: var(--space-4);
  }
}