/*
 * header.css
 * Header sticky, nav, logo, CTA, hamburger, mobile overlay.
 */

.cl-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  transition: background var(--t-slow), border-color var(--t-slow);
  border-bottom: 1px solid transparent;
}

.cl-header.is-scrolled {
  background: rgba(8, 8, 8, 0.96);
  border-bottom-color: var(--c-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cl-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: var(--space-8);
}

/* ── LÍNEA ROJA ──────────────────────────────────────── */
.cl-header__redline {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: var(--red-line-h);
  background: var(--red-line-c);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-slow);
}
.cl-header.is-scrolled .cl-header__redline {
  transform: scaleX(1);
}

/* ── LOGO ────────────────────────────────────────────── */
.cl-header__logo { flex-shrink: 0; }
.cl-header__logo .custom-logo-link { display: flex; align-items: center; }
.cl-header__logo .custom-logo      { height: 32px; width: auto; }

.cl-header__wordmark {
  font-family: var(--font-primary);
  font-size: var(--size-base);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--c-white);
  text-decoration: none;
}
.cl-header__wordmark:hover { color: var(--c-white); }

/* ── NAV ─────────────────────────────────────────────── */
.cl-header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.cl-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.cl-nav__list li a {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-white-dim);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color var(--t-base);
}

.cl-nav__list li a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--c-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base);
}

.cl-nav__list li a:hover                     { color: var(--c-white); }
.cl-nav__list li a:hover::after              { transform: scaleX(1); }
.cl-nav__list li.current-menu-item > a       { color: var(--c-white); }
.cl-nav__list li.current-menu-item > a::after,
.cl-nav__list li.current_page_item > a::after { transform: scaleX(1); }

/* Sub-menus */
.cl-nav__list .sub-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  background: rgba(8, 8, 8, 0.98);
  border: 1px solid var(--c-border);
  border-top: 2px solid var(--c-red);
  min-width: 180px;
  padding: var(--space-2) 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
  z-index: 100;
  list-style: none;
}
.cl-nav__list li:hover > .sub-menu {
  opacity: 1;
  pointer-events: all;
}
.cl-nav__list .sub-menu li a {
  display: block;
  padding: var(--space-2) var(--space-5);
  font-size: var(--size-xs);
}
.cl-nav__list li { position: relative; }

/* ── ACCIONES ────────────────────────────────────────── */
.cl-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.cl-header__cart {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--c-white-dim);
  transition: color var(--t-base);
}
.cl-header__cart:hover { color: var(--c-white); }

.cl-header__cart-count {
  position: absolute;
  top: -6px;
  right: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-red);
  color: var(--c-white);
  font-size: 9px;
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--font-mono);
}

.cl-header__cta {
  font-size: var(--size-xs) !important;
  padding: var(--space-2) var(--space-4) !important;
}

/* ── HAMBURGER ───────────────────────────────────────── */
.cl-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: var(--space-2);
}

.cl-hamburger__bar {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--c-white);
  transform-origin: center;
  transition: transform var(--t-base), opacity var(--t-base);
}

.cl-hamburger.is-active .cl-hamburger__bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.cl-hamburger.is-active .cl-hamburger__bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.cl-hamburger.is-active .cl-hamburger__bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── MOBILE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .cl-hamburger    { display: flex; }
  .cl-header__cta  { display: none; }

  .cl-header__nav {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 8, 0.98);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-slow);
    z-index: 999;
  }
  .cl-header__nav.is-open {
    opacity: 1;
    pointer-events: all;
  }
  .cl-nav__list {
    flex-direction: column;
    gap: var(--space-8);
    text-align: center;
  }
  .cl-nav__list li a {
    font-size: var(--size-xl);
    letter-spacing: var(--tracking-tight);
    color: var(--c-white-dim);
  }
  .cl-nav__list .sub-menu {
    position: static;
    opacity: 1;
    pointer-events: all;
    background: transparent;
    border: none;
    padding: var(--space-3) 0 0;
  }
}
/* FIX MOBILE MENU OVERLAY */
@media (max-width: 900px) {

  body.menu-open {
    overflow: hidden !important;
  }

  .cl-header__nav {
    position: fixed !important;
    inset: 0 !important;
    top: 76px !important;
    width: 100vw !important;
    height: calc(100vh - 76px) !important;
    background: rgba(0, 0, 0, 0.96) !important;
    backdrop-filter: blur(10px) !important;
    z-index: 9998 !important;

    display: none !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;

    padding: 48px 24px !important;
    gap: 28px !important;
  }

  .cl-header__nav.is-open,
  .cl-header.is-open .cl-header__nav,
  body.menu-open .cl-header__nav {
    display: flex !important;
  }

  .cl-header__nav a {
    font-size: 2.1rem !important;
    line-height: 1 !important;
    font-weight: 800 !important;
    letter-spacing: .04em !important;
    color: rgba(255,255,255,.88) !important;
    text-transform: uppercase !important;
  }

  .cl-header__nav a:hover {
    color: #fff !important;
  }

  .cl-header {
    z-index: 9999 !important;
  }
}