/* Header tokens (--header-bg, --text-light, --text-muted, site title
   sizes, transitions) are defined in css/theme/. */

/* === HEADER BASE === */
.header {
  background: var(--header-bg);
  color: var(--text-light);
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: all var(--transition-smooth);
}

/* One slim fixed row: wordmark left, nav + controls right. Its 4rem height sits
   inside the LOCKED 4.5rem .main-content clearance (base_styles/layout.css). */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 0 var(--space-xl);
  height: 4rem;
  background: var(--header-bg);
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.header-title {
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
}

.site-title {
  font-size: var(--font-size-site-title);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
  color: var(--text-light);
  text-decoration: none;
  white-space: nowrap;
}

/* Nav and account controls share the right side of the single row. */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.5rem;
  font-weight: var(--font-weight-regular);
  font-size: var(--font-size-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  text-decoration: none;
}

/* Hamburger + full-screen overlay menu are a phone-only affordance. On
   desktop the editorial nav row (.header-nav-wrapper) is the navigation, so
   keep both the trigger and the overlay out of the layout entirely — the
   media query in mobile.css re-enables them below --bp-phone. */
/* Hidden on desktop; mobile.css turns it on. A fixed square flex box rather
   than a text button: the ☰ glyph's line box is much taller than its ink, so
   letting the baseline place it drops the icon well below the wordmark it sits
   next to. Centring it in a known box aligns the two geometrically instead. */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  flex: none;
}

.hamburger-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

/* === NAVIGATION ===
   Now inline in the single header row rather than a separate band below it, so
   there is nothing left to collapse on scroll. */
.header-nav-wrapper {
  display: flex;
  align-items: center;
  min-width: 0;
  background: var(--header-bg);
}

.header-nav {
  padding: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.35rem;
  padding: 0;
  margin: 0;
  font-size: var(--font-size-small);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

/* === ACTIVE NAV STATE ===
   "You are here" marker, shared by the desktop nav and the mobile overlay
   (set via the {% nav_active %} tag, core/templatetags/nav.py). Reuses the
   existing .link-hover-underline::after underline mechanism so an active link
   simply reads as permanently underlined; the brighter --text-light keeps it
   distinct from the muted resting links. Both nav contexts sit on the dark
   header, so this one rule covers desktop and mobile. */
.header .link-hover-underline.is-active {
  color: var(--text-light);
}

.header .link-hover-underline.is-active::after {
  width: 100%;
}

/* === SCROLL BEHAVIOR ===
   Deliberately none. The header is a fixed 4rem at every scroll position: with
   the title and nav on one short row there is nothing left worth collapsing,
   and a header that changes height on scroll shifts the page under the reader.
   header_scroll.js still toggles .header-scrolled for anything else that wants
   to know; no size or opacity is bound to it here. */

/* === MOBILE MENU ===
   Phone-only overlay. Kept out of the layout on desktop; the .open visibility
   toggling lives entirely inside the --bp-phone media query (mobile.css), so
   toggling it open on a wide viewport never dumps the list onto the page. */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--header-bg);
  padding: 2rem 1.5rem 1rem;
  z-index: 999;
  width: 100%;
  transition: max-height var(--transition-smooth),
    opacity var(--transition-fast);
}

.mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu li {
  margin-bottom: 0.5rem;
}

.mobile-menu a {
  color: var(--text-light);
  text-decoration: none;
  font-size: var(--font-size-base);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

.mobile-menu-divider {
  border: none;
  border-top: 1px solid var(--text-muted);
  margin: 1.5rem 0 1rem;
}

.mobile-menu-secondary a {
  font-size: var(--font-size-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  font-style: italic;
  font-weight: normal;
  color: var(--text-muted);
}

.account-dropdown {
  position: relative;
}

.account-dropdown__trigger {
  background: none;
  border: none;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  cursor: pointer;
  font: inherit; /* same font/size as Newsletter */
}

.account-dropdown__trigger:hover,
.account-dropdown__trigger:focus {
  text-decoration: underline; /* same hover treatment as link-hover-underline */
}

.account-dropdown__menu {
  position: absolute;
  right: 0;
  background: var(--header-bg);
  border: 1px solid var(--text-muted);
  display: none;
  flex-direction: column;
  min-width: 12rem;
  z-index: 1001;
  box-shadow: var(--shadow-dropdown);
}

.account-dropdown__menu a {
  color: var(--text-light);
  padding: 0.75rem 1rem;
  text-decoration: none;
  display: block;
}

.account-dropdown__menu a:hover {
  background: var(--overlay-light);
}

.account-dropdown.open .account-dropdown__menu,
.account-dropdown:hover .account-dropdown__menu {
  display: flex;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Square, centred, same as .hamburger — an SVG in a text button otherwise sits
   on the baseline and rides low against the wordmark. */
.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--header-bg);
  border: 1px solid var(--text-muted);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  width: 16rem;
  z-index: 1001;
  box-shadow: var(--shadow-dropdown);
}

.search-dropdown input {
  background: var(--header-bg);
  border: 1px solid var(--text-muted);
  color: var(--text-light);
  padding: 0.4rem;
  font-size: 0.9rem;
}

.autocomplete-header {
  font-weight: var(--font-weight-medium);
  font-size: 1.2rem; /* Slightly larger */
  color: var(--text-muted);
  padding: 0.5rem 0.5rem 0.25rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  border-top: 1px solid var(--text-muted);
  cursor: default; /* Prevents pointer cursor */
  pointer-events: none; /* Disables hover/click */
  background-color: var(--header-bg);
}

.autocomplete-results li:hover:not(.autocomplete-header) {
  background-color: var(--text-muted);
}

.autocomplete-results li:first-child.autocomplete-header {
  border-top: none;
}

.autocomplete-results {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}

.autocomplete-results li {
  padding: 0.3rem 0.5rem;
  color: var(--text-light);
  cursor: pointer;
}

.autocomplete-results li:hover {
  background-color: var(--color-subtle-text);
}

.search-wrapper.open .search-dropdown {
  display: flex;
}

/* === RESPONSIVE === */
@media (max-width: 54rem) { /* --bp-phone */
  /* Still one row on phones, just tighter: hamburger + wordmark left, search
     right. The desktop nav inside .header-right is hidden by mobile.css.
     The gutter matches .genres-main / .home-main's 1rem phone padding, so the
     header's glyphs line up with the page content below (mobile.css pulls the
     square hit areas back by their own padding to make that true). */
  .header-top {
    padding: 0 1rem;
    gap: var(--space-xs);
  }

  /* .header-left / .header-right layout on phones lives in mobile.css, which
     loads after this file and owns the phone header's flex behaviour. */

  .site-title {
    font-size: 1.15rem;
  }
}
