/* Responsive shared site header. These scoped rules intentionally override
   legacy page-level header styles without affecting the rest of each page. */
.site-header {
  max-width: 100%;
}

.site-header .header-inner {
  position: relative;
  width: min(100% - 2rem, var(--max-width));
  max-width: 100%;
  gap: clamp(12px, 1.6vw, 28px);
}

.site-header .brand {
  flex: 0 1 auto;
  min-width: 0;
}

.site-header .brand img {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.site-header .nav {
  margin-left: auto;
  gap: clamp(10px, 1.35vw, 20px);
}

.site-header .nav a:not(.btn) {
  white-space: nowrap;
  font-size: clamp(0.74rem, 1.05vw, 0.95rem);
}

.site-header .nav .btn {
  width: auto;
  white-space: nowrap;
}

.site-header .nav-toggle {
  display: none;
}

.header-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.header-cart {
  display: grid;
  flex: 0 0 48px;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: visible;
}

.header-cart .ec-cart-widget,
.header-cart .ec-cart-widget > div {
  display: block !important;
  min-width: 44px;
  min-height: 44px;
}

/* The complete desktop navigation cannot fit reliably below this breakpoint. */
@media (max-width: 900px) {
  .site-header .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 48px;
    gap: 8px;
    min-height: 74px;
  }

  .site-header .brand {
    grid-column: 1;
    max-width: 100%;
    overflow: hidden;
  }

  .site-header .brand img {
    width: auto;
    height: clamp(48px, 15vw, 64px);
    max-width: 100%;
  }

  .site-header .header-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .site-header .nav-toggle {
    display: inline-grid;
    grid-column: 3;
    grid-row: 1;
    place-items: center;
    margin: 0;
  }

  .site-header .nav {
    position: absolute;
    z-index: 2;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-width: 100%;
    max-height: calc(100svh - 90px);
    margin: 0;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    background: rgba(8, 22, 44, 0.98);
    border: 1px solid rgba(250, 249, 246, 0.08);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }

  .site-header .nav.open {
    display: flex;
  }

  .site-header .nav a,
  .site-header .nav .btn {
    width: 100%;
    font-size: 0.95rem;
  }
}

@media (max-width: 359px) {
  .site-header .header-inner {
    width: min(100% - 1rem, var(--max-width));
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 6px;
  }

  .site-header .header-cart,
  .site-header .nav-toggle {
    width: 44px;
    height: 44px;
  }
}
