/* =====================================================================
   ELENEX — HEADER (redesigned, token-driven, monochrome editorial)
   Preserves all JS hooks (header.js, cart.js, mini-carrusel.js, inline drawer):
   .mini-carrusel/.carrusel-*, .header(.scrolled), .menu-item[data-menu],
   .mega-menu#catalogo, .header-right, #search-open, .cart-btn/.cart-badge,
   #menu-overlay, #hamburger-btn, #mobile-drawer + drawer-*, #search-overlay + panel.
   ===================================================================== */

/* ---- base reset (global; was in legacy header.css) ---- */
* { margin: 0; padding: 0; }
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font-body); font-size: 17px; color: var(--ink); }
input, button, select, textarea { font: inherit; color: inherit; }

/* =====================================================================
   PROMO STRIP
   ===================================================================== */
.mini-carrusel {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--promo-h);
  overflow: hidden;
  background: var(--ink);
  display: flex;
  align-items: center;
  z-index: calc(var(--z-header) + 100);
}
.carrusel-track { display: flex; width: 300%; transition: transform 0.5s ease-in-out; }
.carrusel-item {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
}
.carrusel-item p {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1;
}

/* =====================================================================
   HEADER BAR
   ===================================================================== */
.header {
  position: fixed;
  top: var(--promo-h);
  left: 0;
  width: 100%;
  z-index: var(--z-header);
  background: var(--paper);
  border-bottom: var(--border-hair);
  transition: box-shadow var(--dur-2) var(--ease-out),
              transform var(--dur-2) var(--ease-out);
}
.header.scrolled { box-shadow: 0 6px 24px rgba(10,10,10,0.07); }

.header-container {
  display: grid;
  /* balanced sides so the nav is optically centered on the page axis */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-m);
  min-height: var(--header-h);
  max-width: var(--container);
  margin-inline: auto;
  padding: 0 var(--gutter);
}

/* ---- logo ---- */
.logo { display: flex; align-items: center; justify-self: start; }
.logo img {
  height: 38px;
  width: auto;
  display: block;
  transition: opacity var(--dur-1) var(--ease-out);
}
.logo a:hover img { opacity: 0.7; }

/* =====================================================================
   PRIMARY NAV
   ===================================================================== */
.nav { display: flex; justify-content: center; justify-self: center; }
.menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2vw, 2rem);
  list-style: none;
  flex-wrap: nowrap;
  margin: 0;          /* Bootstrap's ul margin-bottom:1rem pushed the nav 8px up */
  padding: 0;
}
.menu > li { flex: none; white-space: nowrap; }

.menu-item { position: relative; display: flex; align-items: center; }
.menu-item > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding-block: 4px;
}
/* animated underline */
.menu-item > a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--ink);
  transition: width var(--dur-2) var(--ease-out);
}
.menu-item:hover > a::after { width: 100%; }

/* caret on CATÁLOGO */
.menu-item .arrow {
  width: 6px; height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  display: inline-block;
  margin-bottom: 3px;
  transition: transform var(--dur-2) var(--ease-out);
}
.menu-item[data-menu="catalogo"]:hover .arrow { transform: rotate(-135deg); margin-bottom: -1px; }

/* ---- promo "pills" — monochrome (LIQUIDACIÓN solid, AFTER WAVE outline) ---- */
.menu-item-especial,
.menu-item-coleccion {
  display: inline-flex;
  align-items: center;
  list-style: none;
}
.menu-item-especial > a,
.menu-item-coleccion > a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 7px 16px;
  line-height: 1;
  border: 2px solid var(--ink);
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.menu-item-especial > a { background: var(--ink); color: var(--paper); }       /* sale */
.menu-item-especial > a:hover { background: transparent; color: var(--ink); }
.menu-item-coleccion > a { background: transparent; color: var(--ink); }       /* collection */
.menu-item-coleccion > a:hover { background: var(--ink); color: var(--paper); }

/* =====================================================================
   RIGHT UTILITY ICONS (search / account / cart)
   ===================================================================== */
.header-right { display: flex; align-items: center; gap: var(--space-s); justify-self: end; }

.search-btn,
.account-btn,
.cart-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out);
}
.search-btn:hover,
.account-btn:hover,
.cart-btn:hover { background: var(--paper-2); }
.search-btn svg,
.account-btn svg,
.cart-btn svg { width: 22px; height: 22px; display: block; }

/* cart count badge (cart.js writes .cart-badge) */
.cart-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  border: 2px solid var(--paper);
}

/* =====================================================================
   CATÁLOGO MEGA-MENU (dropdown)
   ===================================================================== */
.mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 240px;
  background: var(--paper);
  border: var(--border-hair);
  border-top: 3px solid var(--ink);   /* editorial accent */
  box-shadow: 0 18px 40px rgba(10,10,10,0.12);
  padding: var(--space-2xs);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--dur-2) var(--ease-out),
              transform var(--dur-2) var(--ease-out);
  z-index: var(--z-header);
}
/* slide+fade on open (opacity/visibility toggled by header.js, transform by CSS) */
.menu-item[data-menu="catalogo"]:hover .mega-menu { transform: translateY(0); }

.mega-menu .menu-col { display: flex; flex-direction: column; }
.mega-menu .menu-col a {
  display: block;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out),
              padding-left var(--dur-1) var(--ease-out);
}
.mega-menu .menu-col a:hover { background: var(--ink); color: var(--paper); padding-left: 22px; }
.mega-menu .menu-col a.activo { background: var(--ink); color: var(--paper); }

/* =====================================================================
   HAMBURGER (mobile)
   ===================================================================== */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: calc(var(--z-header) + 200);
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-2) var(--ease-out);
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================================
   MOBILE DRAWER
   ===================================================================== */
.drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: calc(var(--z-header) + 100);
}
.drawer-overlay.active { display: block; }

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: min(86vw, 320px);
  height: 100dvh;
  background: var(--paper);
  z-index: calc(var(--z-header) + 150);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--dur-2) var(--ease-inout);
  flex-direction: column;
}
.mobile-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-s);
  border-bottom: var(--border-hair);
}
.drawer-header img { height: 34px; }
.drawer-close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--smoke);
  padding: 4px;
}

.drawer-menu { list-style: none; padding: var(--space-2xs) 0; }
.drawer-menu > li { border-bottom: var(--border-hair); }
.drawer-menu > li > a,
.drawer-menu > li > span,
.drawer-menu > li > form > button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px var(--space-s);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), padding-left var(--dur-1) var(--ease-out);
}
.drawer-menu > li > a:hover,
.drawer-menu > li > span:hover { background: var(--paper-2); padding-left: calc(var(--space-s) + 6px); }

.drawer-menu .item-especial > a { background: var(--ink); color: var(--paper); }
.drawer-menu .item-especial-coleccion > a { border-top: 2px solid var(--ink); }

.drawer-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px var(--space-s);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.drawer-toggle:hover { background: var(--paper-2); }
.drawer-toggle .arrow {
  width: 7px; height: 7px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  transition: transform var(--dur-2) var(--ease-out);
}
.drawer-toggle.open .arrow { transform: rotate(-135deg); }

.drawer-submenu { list-style: none; background: var(--paper-2); display: none; }
.drawer-submenu.open { display: block; }
.drawer-submenu li a {
  display: block;
  padding: 12px var(--space-l);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 500;
  color: var(--smoke);
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.drawer-submenu li a:hover,
.drawer-submenu li a.activo { background: var(--ink); color: var(--paper); }

/* dim overlay used by the catalogo mega-menu (header.js) */
#menu-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-2) var(--ease-out);
  z-index: 900;
}
#menu-overlay.active { opacity: 1; visibility: visible; }

/* =====================================================================
   SEARCH PANEL (slide-over) — monochrome
   ===================================================================== */
.search-panel-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-2) var(--ease-out);
  z-index: var(--z-overlay);
}
.search-panel-overlay.active { opacity: 1; visibility: visible; }

.search-panel {
  position: absolute;
  right: 0; top: 0;
  width: min(100%, 480px);
  height: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: var(--space-m);
  transform: translateX(100%);
  opacity: 0;
  transition: transform var(--dur-2) var(--ease-inout), opacity var(--dur-2) var(--ease-out);
}
.search-panel.opening { transform: translateX(0); opacity: 1; }
.search-panel.closing { transform: translateX(100%); opacity: 0; }

.search-panel-header { display: flex; align-items: center; gap: var(--space-2xs); margin-bottom: var(--space-s); }
.search-panel-header .search-icon { width: 22px; height: 22px; }
.search-input-wrapper { position: relative; flex: 1; display: flex; align-items: center; }
.search-input-wrapper input {
  width: 100%;
  padding: 10px 38px 10px 0;
  font-size: var(--step-1);
  border: none;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  outline: none;
}
#clear-search {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%) scale(0.85);
  background: none; border: none;
  font-size: var(--step--1);
  color: var(--ash);
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-out);
}
#clear-search.show { opacity: 1; pointer-events: auto; }
#search-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--ink); padding: 4px; }

#search-info {
  display: none;
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--smoke);
  margin-bottom: var(--space-xs);
}

.search-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-s);
  overflow-y: auto;
  max-height: calc(100% - 140px);
  padding-right: 4px;
}
.search-item {
  background: var(--paper-2);
  padding: var(--space-s);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-2) var(--ease-out);
}
.search-item.show { opacity: 1; }
.search-item:hover { transform: translateY(-3px); }
.search-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; margin-bottom: var(--space-2xs); }
.search-item .name { font-family: var(--font-display); font-size: var(--step-0); color: var(--ink); margin-bottom: 4px; }
.search-item .price { font-family: var(--font-body); font-weight: 700; font-size: var(--step--1); color: var(--ink); }

.search-more-btn {
  width: 100%;
  margin-top: var(--space-s);
  padding: 14px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--step-0);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  display: none;
}
.search-more-btn:hover { background: var(--ink-soft); }
.search-results::-webkit-scrollbar { width: 5px; }
.search-results::-webkit-scrollbar-thumb { background: var(--ash); border-radius: 3px; }

/* =====================================================================
   RESPONSIVE — collapse to hamburger at <=1024 (busy nav needs room)
   ===================================================================== */
@media (max-width: 1024px) {
  .nav { display: none; }
  .hamburger { display: flex; }
  /* mobile bar: hamburger · centered logo · icons */
  .header-container { grid-template-columns: auto 1fr auto; }
  .hamburger { grid-column: 1; justify-self: start; }
  .logo { grid-column: 2; justify-self: center; }
  .header-right { grid-column: 3; justify-self: end; }
  #catalogo { display: none; }
  /* the drawer panel must be rendered (off-canvas) so .open can slide it in.
     This line was missing → the mobile menu opened but showed nothing. */
  .mobile-drawer { display: flex; }
}

@media (max-width: 768px) {
  .header-container { gap: var(--space-2xs); padding-inline: var(--space-s); }
  .logo img { height: 32px; }
  .header-right { gap: var(--space-2xs); }
  .search-btn, .account-btn, .cart-btn { width: 38px; height: 38px; }
  body { overflow-x: hidden; }
}
