/* ============================================================
   Koochoi — Header Rebuild (header-v2.css)
   Fresh, isolated namespace: every selector here starts with
   "kcnb" (Koochoi Nav Bar) — a class never used anywhere else
   in this theme, so nothing in patch.css/header.css/style.css
   can ever collide with or override these rules.

   Enqueued last with explicit deps, so it always wins load order
   too — but the namespace isolation is what actually guarantees
   correctness, not the order.
   ============================================================ */

/* The header element keeps its legacy classes (kc-header) only
   for the unrelated background/transparency/admin-bar rules that
   already work correctly — combined selector below beats those
   on anything actually contested (sticky position). */
.kc-header.kcnb {
  position: sticky !important;
  z-index: 1070 !important;
}

.kcnb__inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
}

/* Logo */
.kcnb__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  order: 1;
  text-decoration: none;
}

/* Mobile hamburger toggle — hidden on desktop.
   Tap target is 44x44 (touch-friendly), bars stay visually small. */
.kcnb__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}
.kcnb__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #fff;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.kcnb__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.kcnb__toggle.is-open span:nth-child(2) { opacity: 0; }
.kcnb__toggle.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Primary nav — desktop: inline, pushed to the right */
.kcnb__nav {
  order: 2;
  display: flex;
  align-items: center;
  margin-left: auto;
}
.kcnb__nav-close { display: none; }

/* Right cluster: auth icon + cart */
.kcnb__right {
  order: 3;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 28px;
  flex-shrink: 0;
}

/* Full-screen dark overlay behind the mobile drawer */
.kcnb__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1050;
}
.kcnb__overlay.is-open { display: block; }

/* ============================================================
   MOBILE (≤768px)
   Layout: [hamburger] —— [logo centred] —— [profile/cart]
   ============================================================ */
@media (max-width: 768px) {
  .kcnb__inner {
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    padding: 0 16px;
    height: 64px;
  }

  .kcnb__toggle {
    display: flex;
    grid-column: 1;
    justify-self: start;
  }

  .kcnb__logo {
    grid-column: 2;
    justify-self: center;
    margin: 0;
  }

  .kcnb__right {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
    gap: 14px;
  }

  /* Off-canvas nav drawer */
  .kcnb__nav {
    position: fixed;
    top: 0;
    right: -300px;
    width: min(80vw, 300px);
    height: 100vh;
    background: #050f0d;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    padding: 72px 28px 40px;
    z-index: 1060;
    overflow-y: auto;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .kcnb__nav.is-open { right: 0; }

  .kcnb__nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
  }

  .kcnb__nav .kc-nav__list {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0 !important;
    width: 100% !important;
  }
}

/* ============================================================
   Homepage hero sits behind the transparent header.
   .kc-header is sticky, so it still reserves its own height in
   the page flow — pull the hero up under it so the hero image
   shows through the transparent header before scrolling.
   ============================================================ */
.home .kc-hero-v2 {
  margin-top: -72px;
}
@media (max-width: 768px) {
  .home .kc-hero-v2 {
    margin-top: -64px;
  }
}
