/* Site header — desktop & mobile */

.site-header {
  position: sticky;
  top: 0;
  z-index: 180;
  color: var(--color-on-dark);
  pointer-events: none;
}

.site-header__bar,
.site-header .header-search {
  pointer-events: auto;
}

.site-header__bar {
  background: var(--color-bg-dark);
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header--overlay .site-header__bar {
  background: transparent;
}

.site-header--overlay.is-scrolled .site-header__bar,
.site-header.is-scrolled .site-header__bar {
  background: rgb(18 18 18 / 96%);
  backdrop-filter: blur(10px);
  border-bottom-color: rgb(255 255 255 / 8%);
  box-shadow: var(--shadow-soft);
}

.site-header__inner {
  display: grid;
  grid-template-columns: minmax(44px, auto) 1fr minmax(44px, auto);
  grid-template-areas: "toggle brand actions";
  align-items: center;
  gap: 0.75rem 1rem;
  min-height: var(--header-height);
}

.site-branding {
  grid-area: brand;
  justify-self: center;
  min-width: 0;
}

.site-branding a,
.site-branding .custom-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.25rem 0.5rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease, background 0.2s ease;
}

.site-branding a:hover,
.site-branding .custom-logo-link:hover {
  color: inherit;
  opacity: 1;
  background: rgb(255 255 255 / 6%);
}

.site-branding img,
.site-branding .custom-logo {
  max-height: 42px;
  width: auto;
  pointer-events: none;
}

.nav-toggle {
  grid-area: toggle;
  justify-self: start;
}

.header-actions {
  grid-area: actions;
  justify-self: end;
}

/* Announcement link */
.announcement__link {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  margin: -0.15rem -0.5rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}

.announcement__link:hover {
  color: var(--color-accent);
  background: rgb(149 81 29 / 8%);
}

/* Primary navigation — desktop */
.primary-nav {
  display: none;
}

@media (min-width: 961px) {
  .site-header__inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav actions";
    gap: 1.5rem 2rem;
  }

  .nav-toggle {
    display: none;
  }

  .site-branding {
    justify-self: start;
  }

  .primary-nav {
    display: block;
    grid-area: nav;
    justify-self: center;
    min-width: 0;
  }

  .primary-nav__panel-head,
  .primary-nav__panel-foot {
    display: none;
  }

  .primary-nav__panel {
    display: contents;
  }

  .primary-nav__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .primary-nav__list > li {
    position: relative;
  }

  .primary-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0.15rem;
    color: inherit;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    position: relative;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, background 0.2s ease;
  }

  .primary-nav a::after {
    content: "";
    position: absolute;
    left: 0.15rem;
    right: 0.15rem;
    bottom: 6px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s var(--ease-out);
    pointer-events: none;
  }

  .primary-nav a:hover,
  .primary-nav a:focus-visible {
    color: #cfe2d0;
    background: rgb(255 255 255 / 5%);
  }

  .primary-nav a:hover::after,
  .primary-nav .current-menu-item > a::after,
  .primary-nav .current-menu-ancestor > a::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  .primary-nav .sub-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;
    background: rgb(18 18 18 / 98%);
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
  }

  .primary-nav .menu-item-has-children:hover > .sub-menu,
  .primary-nav .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .primary-nav .sub-menu a {
    display: flex;
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0.02em;
  }

  .primary-nav .sub-menu a::after {
    display: none;
  }
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  position: relative;
  z-index: 2;
}

.header-actions__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  box-sizing: border-box;
}

a.header-actions__btn:hover,
a.header-actions__btn:focus-visible {
  color: inherit;
}

.header-actions__btn:hover,
.header-actions__btn.is-active {
  background: rgb(255 255 255 / 10%);
}

.header-actions__icon {
  pointer-events: none;
}

.header-cart__count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.header-cart__count.is-empty {
  display: none;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover,
.nav-toggle.is-active {
  background: rgb(255 255 255 / 10%);
}

.nav-toggle__icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease-out), opacity 0.2s ease;
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgb(6 20 6 / 50%);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

/* Mobile drawer */
@media (max-width: 960px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-header--overlay .site-header__bar {
    background: var(--color-bg-dark);
  }

  .primary-nav {
    display: block;
    position: fixed;
    z-index: 170;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    height: 100dvh;
    padding: 0;
    background: var(--color-bg-dark);
    box-shadow: var(--shadow-soft);
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease-out);
    overflow: hidden;
    pointer-events: auto;
  }

  .primary-nav.is-open {
    transform: translateX(0);
  }

  .primary-nav__panel {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .primary-nav__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
    min-height: var(--header-height);
  }

  .primary-nav__panel-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-on-dark);
  }

  .primary-nav__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .primary-nav__close:hover {
    background: rgb(255 255 255 / 10%);
  }

  .primary-nav__list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
  }

  .primary-nav__list > li {
    border-bottom: 1px solid rgb(255 255 255 / 8%);
  }

  .primary-nav a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0.85rem 1.25rem;
    color: inherit;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .primary-nav a:active {
    background: rgb(255 255 255 / 6%);
  }

  .primary-nav .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0.5rem;
    background: rgb(0 0 0 / 20%);
  }

  .primary-nav .sub-menu a {
    min-height: 44px;
    padding-left: 2rem;
    font-size: 0.88rem;
    text-transform: none;
    letter-spacing: 0.02em;
  }

  .primary-nav__panel-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem 1.25rem 1.5rem;
    border-top: 1px solid rgb(255 255 255 / 10%);
  }

  .primary-nav__foot-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.75rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgb(255 255 255 / 20%);
    color: inherit;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .primary-nav__foot-link:hover {
    color: inherit;
    background: rgb(255 255 255 / 8%);
  }
}

/* Search panel */
.header-search {
  padding: 0.75rem 0 1rem;
  background: var(--color-bg-dark);
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.header-search__inner .search-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.header-search__inner .search-form__input {
  flex: 1;
  min-height: 44px;
}

.header-search__inner .search-form__submit {
  min-height: 44px;
  flex-shrink: 0;
}

/* Homepage: header over hero only (not over announcements) */
@media (min-width: 961px) {
  .home .hero {
    margin-top: calc(var(--header-height) * -1);
  }

  .home .hero__content {
    padding-top: calc(var(--header-height) + 2rem);
  }
}
