/* .ap-topbar — thin affiliate-disclosure strip above the header. */

.ap-topbar {
  background: var(--ap-topbar-bg);
  color: var(--ap-topbar-text);
  font-size: var(--ap-fs-sm);
  text-align: center;
  padding: var(--ap-space-xs) var(--ap-space-lg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.ap-topbar a {
  color: var(--ap-topbar-link);
  text-decoration: underline;
  font-weight: 600;
  margin-left: var(--ap-space-xs);
  white-space: nowrap;
}

/* .ap-header / .ap-nav — main site navigation, search, CTA, mobile toggle. */

.ap-header {
  background: var(--ap-header-bg);
  border-bottom: 1px solid var(--ap-header-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* .ap-nav below relies on height:100% to vertically center its children
   (logo, search, actions) — that only resolves correctly if this ancestor
   has an explicit height instead of auto. */
.ap-header .ap-container {
  height: 100%;
}

/* Three-zone layout: logo hugs the left, search sits dead-center in the
   remaining space, actions (CTA + mobile toggle) pin to the right edge. */
.ap-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 100%;
  gap: var(--ap-space-lg);
}

.ap-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--ap-space-md);
  justify-self: end;
}

.ap-nav__logo {
  display: flex;
  align-items: center;
  height: 100%;
  font-family: var(--ap-font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ap-header-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.ap-nav__logo img {
  height: calc(var(--ap-header-height) - 32px);
  width: auto;
  vertical-align: middle;
}

/* .ap-subnav — secondary row below the header (Top Deals/Categories/Stores/
   Seasonal Sales/Blog). Desktop-only, same breakpoint as the rest of the
   expanded nav; on mobile these links live in .ap-nav__mobile instead. */
.ap-subnav {
  display: none;
  position: fixed;
  top: calc(var(--ap-topbar-height) + var(--ap-topbar-gap) + var(--ap-header-height));
  left: 0;
  right: 0;
  z-index: 450;
  height: var(--ap-subnav-height);
  background: var(--ap-header-bg);
  border-bottom: 1px solid var(--ap-header-border);
}

@media (min-width: 1024px) {
  .ap-subnav { display: block; }
}

.ap-subnav .ap-container {
  height: 100%;
}

.ap-nav__list {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--ap-space-lg);
}

.ap-nav__list li {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.ap-nav__link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-weight: 600;
  font-size: var(--ap-fs-sm);
  line-height: 1;
  color: var(--ap-header-text);
  padding: var(--ap-space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: opacity var(--ap-transition), border-color var(--ap-transition);
}

.ap-nav__link:hover { opacity: 0.85; }
.ap-nav__link[aria-current="page"] { border-color: var(--ap-header-text); }
.ap-nav__link:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ap-header-text); border-radius: var(--ap-radius-sm); }

/* Dropdown nav items — built on <details> for zero-JS accessibility. */
.ap-nav__dropdown {
  position: relative;
}

.ap-nav__dropdown summary {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--ap-fs-sm);
  line-height: 1;
  color: var(--ap-header-text);
  list-style: none;
}

.ap-nav__dropdown summary::-webkit-details-marker { display: none; }
.ap-nav__dropdown summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform var(--ap-transition);
}
.ap-nav__dropdown[open] summary::after { transform: rotate(-135deg); margin-top: 2px; }
.ap-nav__dropdown summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ap-header-text); border-radius: var(--ap-radius-sm); }
.ap-nav__dropdown summary:hover { opacity: 0.85; }

.ap-nav__dropdown-panel {
  position: absolute;
  top: calc(100% + var(--ap-space-sm));
  left: 0;
  min-width: 220px;
  background: var(--ap-surface);
  color: var(--ap-text);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-md);
  box-shadow: var(--ap-shadow-md);
  padding: var(--ap-space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}

.ap-nav__dropdown-panel a {
  padding: var(--ap-space-xs) var(--ap-space-sm);
  border-radius: var(--ap-radius-sm);
  font-size: var(--ap-fs-sm);
  color: var(--ap-text);
}

.ap-nav__dropdown-panel a:hover { background: var(--ap-surface-alt); color: var(--ap-primary); }

.ap-nav__toggle {
  display: inline-flex;
  padding: var(--ap-space-xs);
  border-radius: var(--ap-radius-sm);
  color: var(--ap-header-text);
  margin-left: auto;
}

@media (min-width: 1024px) {
  .ap-nav__toggle { display: none; margin-left: 0; }
}

.ap-nav__toggle:hover { background: rgba(255, 255, 255, 0.12); }
.ap-nav__toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ap-header-text); }

.ap-nav__mobile {
  display: none;
  position: fixed;
  inset: calc(var(--ap-topbar-height) + var(--ap-topbar-gap) + var(--ap-header-height) + var(--ap-subnav-height)) 0 0 0;
  background: var(--ap-surface);
  padding: var(--ap-space-lg);
  overflow-y: auto;
  z-index: 400;
}

.ap-nav__mobile[data-open="true"] {
  display: flex;
  flex-direction: column;
  gap: var(--ap-space-md);
}

.ap-nav__mobile a { color: var(--ap-text); font-weight: 600; }

.ap-nav__mobile-search {
  margin-bottom: var(--ap-space-xs);
}

/* Hidden below tablet width — the header row (logo + CTA + hamburger, with
   nav links/search already hidden) doesn't have room for it
   on phone-width screens, and Top Deals is still reachable via the mobile
   menu, so it's not lost, just decluttered. */
.ap-nav__cta {
  display: none;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .ap-nav__cta {
    display: inline-flex;
  }
}

/* Search pill always reads as a light input against the fixed-dark header, in
   either theme. Centered in its own grid column via justify-self, capped by
   max-width so it doesn't stretch edge-to-edge on wide screens. */
.ap-header .ap-search {
  width: 100%;
  max-width: 320px;
  justify-self: center;
  display: none;
}

@media (min-width: 768px) {
  .ap-header .ap-search { display: flex; }
}

.ap-header .ap-search__input {
  background: var(--ap-header-search-bg);
  color: var(--ap-header-search-text);
  border-color: transparent;
}

.ap-header .ap-search__input::placeholder {
  color: var(--ap-header-search-muted);
}

.ap-header .ap-search__button {
  color: var(--ap-header-search-muted);
}

.ap-header .ap-search__button:hover {
  color: var(--ap-overlay-text);
}

.ap-header .ap-search__clear {
  color: var(--ap-header-search-muted);
}

.ap-header .ap-search__clear:hover {
  background: var(--ap-header-search-hover-bg);
}
