/* AVENU — header
   Sticky white header with logo, linklist nav, action icons, mobile drawer. */

.av-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition-fast);
}
.av-header.is-stuck {
  box-shadow: 0 1px 0 rgba(15,15,15,0.04), 0 4px 12px rgba(15,15,15,0.04);
}

.av-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 72px;
  gap: var(--space-5);
  padding: 0 var(--container-pad-desktop);
}

/* ── Logo ────────────────────────────────────────────────────────────── */
.av-header__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
/* Logo is capped to fit the fixed 72px header — max-height wins over the
   merchant's max-width so a tall/square logo can never grow the header.
   width:auto + object-fit:contain preserve aspect ratio inside the box. */
.av-header__logo img {
  display: block;
  width: auto;
  height: auto;
  max-height: 32px;
  object-fit: contain;
}
.av-header__wordmark {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: inherit;
  white-space: nowrap;       /* long store names stay single-line, never grow the header */
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

/* ── Burger (mobile only) ────────────────────────────────────────────── */
.av-header__burger {
  display: none;
  width: 36px; height: 36px;
  border: 0; background: transparent; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  padding: 0;
}
.av-header__burger span {
  width: 18px; height: 1.5px; background: currentColor; display: block; border-radius: 1px;
  transition: transform var(--transition-fast);
}

/* ── Desktop nav ─────────────────────────────────────────────────────── */
.av-header__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}
.av-header__nav-link {
  position: relative;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}
.av-header__nav-link:hover { color: var(--color-accent); }
.av-header__nav-link--highlight { font-weight: 600; }
.av-header__nav-badge {
  display: inline-flex; align-items: center;
  padding: 2px 6px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: var(--radius-xs);
  line-height: 1.4;
}

/* Nested-menu dropdown — shown on hover/focus of a nav item that has
   children (link.links from the platform menu loader). Anchored to the
   nav item via .av-header__nav-item position:relative. */
.av-header__nav-item {
  position: relative;
}
.av-header__nav-caret {
  opacity: 0.6;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.av-header__nav-item.has-dropdown:hover .av-header__nav-caret,
.av-header__nav-item.has-dropdown:focus-within .av-header__nav-caret {
  opacity: 1;
  transform: rotate(180deg);
}
.av-header__dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 200px;
  background: var(--color-bg, #FFFFFF);
  border: 1px solid var(--color-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-sm, 4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  padding: var(--space-2) 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.av-header__nav-item.has-dropdown:hover .av-header__dropdown,
.av-header__nav-item.has-dropdown:focus-within .av-header__dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Invisible bridge so the dropdown doesn't dismiss when the cursor crosses
   the gap between nav link and panel. */
.av-header__dropdown::before {
  content: '';
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 8px;
}
.av-header__dropdown-link {
  display: block;
  padding: 8px var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text, inherit);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast);
}
.av-header__dropdown-link:hover {
  background: var(--color-ink-25, rgba(0,0,0,0.04));
}

/* ── Action icons ────────────────────────────────────────────────────── */
.av-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.av-header__icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: inherit;
  background: transparent; border: 0; padding: 0;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
.av-header__icon:hover { opacity: 0.7; }
.av-header__cart-badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--color-accent);
  color: #FFF;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Mobile drawer ───────────────────────────────────────────────────── */
.av-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.av-drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(15,15,15,0.45);
  opacity: 0;
  transition: opacity 240ms ease;
}
.av-drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 320px; max-width: 86vw;
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: -16px 0 32px rgba(15,15,15,0.16);
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex; flex-direction: column;
}
.av-drawer.is-open .av-drawer__backdrop { opacity: 1; }
.av-drawer.is-open .av-drawer__panel    { transform: translateX(0); }

.av-drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}
.av-drawer__title {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.av-drawer__close {
  width: 32px; height: 32px;
  background: transparent; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: inherit;
}

.av-drawer__nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.av-drawer__link {
  display: block;
  padding: 14px 22px;
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border-soft);
}
.av-drawer__link:hover { background: var(--color-surface); }
.av-drawer__sublist {
  padding: 0 22px 8px 38px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-soft);
}
.av-drawer__sublink {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.av-drawer__sublink:hover { color: var(--color-text); }

.av-drawer__actions {
  display: flex; gap: var(--space-3);
  padding: 18px 22px;
  border-top: 1px solid var(--color-border);
}
.av-drawer__action {
  flex: 1;
  padding: 10px 14px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  color: var(--color-text);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .av-header__inner {
    grid-template-columns: auto 1fr auto;
    height: var(--header-height-mobile);
    gap: var(--space-3);
    padding: 0 var(--container-pad-mobile);
  }
  .av-header__burger { display: inline-flex; }
  .av-header__nav    { display: none; }
  .av-header__logo   { justify-self: center; }
  .av-header__logo img { max-height: 30px; }   /* fit the 56px mobile header */
  .av-header__actions { gap: var(--space-3); }
  .av-header__wordmark { font-size: 18px; }
}

@media (max-width: 480px) {
  .av-header__actions .av-header__icon:not(.av-header__cart) { display: none; }
  /* Keep search if you want — toggle via setting if needed. */
}
