/* ═══════════════════════════════════════════════
   NAV — Navbar + Hamburger Drawer
   Mobile-first (375px base)
═══════════════════════════════════════════════ */

/* ─── Sticky Navbar ─────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 88px;
  background-color: var(--fm-beige-light);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 0 var(--fm-margin-mobile);
  transition: box-shadow 0.25s var(--fm-ease-hover);
}

.nav--scrolled {
  box-shadow: 0 1px 0 var(--fm-gray-light);
}

/* ─── Left / Right groups ───────────────────── */
.nav__left {
  display: flex;
  align-items: center;
  gap: var(--fm-space-xs);
  min-width: 0;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: var(--fm-space-xs);
  justify-content: flex-end;
  min-width: 0;
}

/* ─── Logo ──────────────────────────────────── */
.nav__logo {
  text-decoration: none;
  color: var(--fm-black);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav__logo-svg {
  height: 16px;
  width: auto;
  display: block;
}

/* ─── Icon buttons ──────────────────────────── */
.nav__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fm-black);
  text-decoration: none;
  transition: opacity 0.25s var(--fm-ease-hover),
              transform 0.2s var(--fm-ease-hover);
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.nav__icon-btn:active {
  transform: scale(0.88);
}

@media (hover: hover) and (pointer: fine) {
  .nav__icon-btn:hover,
  .nav__icon-btn:focus-visible {
    opacity: 0.6;
  }
}

/* ─── Cart badge ────────────────────────────── */
.nav__cart {
  position: relative;
}

.nav__cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background-color: var(--fm-black);
  color: var(--fm-white);
  font-family: var(--fm-font-body);
  font-size: 9px;
  font-weight: 400;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.nav__cart-badge[data-hidden] {
  display: none;
}

/* ═══════════════════════════════════════════════
   NAV DRAWER (hamburger slide-in)
═══════════════════════════════════════════════ */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.nav-drawer[aria-hidden="false"] {
  pointer-events: auto;
}

/* Overlay */
.nav-drawer__overlay {
  position: absolute;
  inset: 0;
  background-color: transparent;
  transition: background-color 0.35s var(--fm-ease-drawer);
}

.nav-drawer[aria-hidden="false"] .nav-drawer__overlay {
  background-color: rgba(20, 18, 16, 0.5);
}

/* Panel */
.nav-drawer__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background-color: var(--fm-white);
  padding: var(--fm-space-2xl) var(--fm-space-xl) var(--fm-space-xl);
  transform: translateX(-100%);
  transition: transform 0.35s var(--fm-ease-drawer);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-drawer[aria-hidden="false"] .nav-drawer__panel {
  transform: translateX(0);
}

/* Close button */
.nav-drawer__close {
  position: absolute;
  top: var(--fm-space-lg);
  right: var(--fm-space-lg);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fm-black);
  -webkit-tap-highlight-color: transparent;
}

/* Primary nav links */
.nav-drawer__list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--fm-space-2xl);
}

.nav-drawer__list li {
  border-bottom: 1px solid var(--fm-gray-light);
}

.nav-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fm-space-lg) 0;
  font-family: var(--fm-font-display);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--fm-black);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: opacity 0.25s var(--fm-ease-hover);
}

.nav-drawer__link:hover {
  opacity: 0.6;
}

.nav-drawer__link--accent {
  color: var(--fm-borgona);
}

/* Secondary nav links */
.nav-drawer__secondary {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--fm-space-md);
}

.nav-drawer__secondary a {
  font-family: var(--fm-font-body);
  font-size: 0.8125rem;
  color: var(--fm-gray-warm);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.25s var(--fm-ease-hover);
}

.nav-drawer__secondary a:hover {
  color: var(--fm-black);
}

/* ═══════════════════════════════════════════════
   SEARCH BAR — Slide down from header
═══════════════════════════════════════════════ */
.search-bar {
  position: sticky;
  top: 88px;
  z-index: 99;
  background-color: var(--fm-beige-light);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--fm-ease-out);
}

.search-bar[aria-hidden="false"] {
  max-height: 72px;
  border-bottom: 1px solid var(--fm-gray-light);
}

.search-bar[aria-hidden="false"].search-bar--open-results {
  max-height: 480px;
}

.search-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--fm-space-sm);
  padding: 0 var(--fm-margin-mobile);
  height: 72px;
}

.search-bar__input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid var(--fm-black);
  outline: none;
  font-family: var(--fm-font-body);
  font-size: 0.9375rem;
  color: var(--fm-black);
  padding: 8px 0;
}

.search-bar__input:focus-visible {
  border-bottom-width: 2px;
  border-bottom-color: var(--fm-terracota);
}

.search-bar__input::placeholder {
  color: color-mix(in srgb, var(--fm-gray-warm) 45%, transparent);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.search-bar__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fm-black);
  opacity: 0.5;
  transition: opacity 0.25s var(--fm-ease-hover);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.search-bar__close:hover {
  opacity: 1;
}

.search-bar__results {
  max-height: 408px;
  overflow-y: auto;
  padding: 0 var(--fm-margin-mobile) var(--fm-space-md);
}

.search-bar__empty {
  font-family: var(--fm-font-body);
  font-size: 0.875rem;
  color: var(--fm-gray-warm);
  padding: var(--fm-space-md) 0;
}

.search-bar__result {
  display: flex;
  align-items: center;
  gap: var(--fm-space-sm);
  padding: var(--fm-space-sm) 0;
  border-top: 1px solid var(--fm-gray-light);
  text-decoration: none;
  color: var(--fm-black);
}

.search-bar__result:first-child {
  border-top: none;
}

.search-bar__result-img {
  width: 48px;
  height: 60px;
  object-fit: cover;
  background-color: var(--fm-gray-surface);
  flex-shrink: 0;
}

.search-bar__result-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.search-bar__result-name {
  font-family: var(--fm-font-body);
  font-size: 0.875rem;
  color: var(--fm-black);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-bar__result-price {
  font-family: var(--fm-font-body);
  font-size: 0.8125rem;
  color: var(--fm-gray-warm);
}

.search-bar__see-all {
  display: block;
  text-align: center;
  font-family: var(--fm-font-narrow);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fm-black);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: var(--fm-space-md) 0 var(--fm-space-sm);
  border-top: 1px solid var(--fm-gray-light);
  margin-top: var(--fm-space-sm);
}

/* ─── Tablet+ ───────────────────────────────── */
@media (min-width: 768px) {
  .search-bar__results {
    padding: 0 var(--fm-margin-tablet) var(--fm-space-md);
  }
}

/* ─── Tablet+ ───────────────────────────────── */
@media (min-width: 768px) {
  .nav {
    padding: 0 var(--fm-margin-tablet);
  }

  .nav__logo-svg {
    height: 18px;
  }

  .nav__icon-btn {
    width: 40px;
    height: 40px;
  }

  .search-bar__inner {
    padding: 0 var(--fm-margin-tablet);
  }
}

@media (min-width: 1280px) {
  .nav {
    padding: 0 var(--fm-margin-desktop);
    height: 96px;
  }

  .nav__logo-svg {
    height: 20px;
  }

  .search-bar {
    top: 96px;
  }

  .search-bar__inner {
    padding: 0 var(--fm-margin-desktop);
  }
}
