/*
 * Silent Heroes — Navbar
 * Sticky two-row header: primary (dark) + subnav (light).
 */

.sh-navbar {
  position: sticky;
  top: 0;
  z-index: var(--sh-z-navbar);
  background: #000; /* User request 2026-05-31: czyste #000 dla header (nie token #111) */
  color: var(--sh-offwhite);
  border-bottom: 1px solid rgba(248, 247, 244, 0.08);
}

.sh-navbar-inner {
  max-width: var(--sh-container-wide);
  margin-inline: auto;
  padding: 0 var(--sh-gutter);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sh-space-8);
}

/* Logo */
.sh-navbar-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  max-height: 40px;
}
.sh-navbar-logo a,
.sh-navbar-logo .custom-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.sh-navbar-logo img,
.sh-navbar-logo svg,
.sh-navbar-logo .custom-logo {
  max-height: 40px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}
.sh-navbar-logo--text span {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.02em;
  font-size: 1.2rem;
  color: var(--sh-offwhite);
}

/* Primary links */
.sh-nav-primary {
  display: flex;
  align-items: center;
  gap: var(--sh-space-8);
  list-style: none;
  padding: 0;
  margin: 0 0 0 auto; /* push nav + CTA to the right */
}
.sh-nav-primary > li {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.sh-nav-primary > li { position: relative; }

.sh-nav-primary > li > a {
  display: inline-flex;
  align-items: center;
  height: 64px;
  padding: 0 2px;
  font-size: var(--sh-fs-xs);
  font-weight: var(--sh-fw-bold);
  letter-spacing: var(--sh-tracking-wide);
  text-transform: uppercase;
  color: var(--sh-offwhite);
  text-decoration: none;
  position: relative;
  transition: color var(--sh-duration) var(--sh-ease);
}

.sh-nav-primary > li > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  height: 2px;
  background: var(--sh-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--sh-duration) var(--sh-ease);
}

.sh-nav-primary > li.is-active > a::after,
.sh-nav-primary > li:hover > a::after,
.sh-nav-primary > li:focus-within > a::after { transform: scaleX(1); }

/* Nazwy zakładek ZAWSZE białe — hover dodaje tylko podkreślenie (::after powyżej).
   !important bo globalny `a:hover` (base.css) ma wysoką specyfikę przez łańcuch :not(). */
.sh-nav-primary > li > a:hover,
.sh-nav-primary > li > a:focus { color: var(--sh-offwhite) !important; }

/* Right side (CTA button) */
.sh-navbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.sh-navbar-cta > a {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  margin: 0 !important;
}
.sh-navbar-cta .sh-btn {
  padding: 10px 18px;
  font-size: var(--sh-fs-xs);
}

/* Mobile toggle */
.sh-navbar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--sh-offwhite);
  cursor: pointer;
}
.sh-navbar-toggle svg { width: 24px; height: 24px; }

/* Universal navbar icon button (search, account) */
.sh-navbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  width: 36px;
  height: 36px;
  color: var(--sh-offwhite);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--sh-duration) var(--sh-ease);
}
.sh-navbar-icon:hover { color: var(--sh-red); }
.sh-navbar-icon svg { width: 20px; height: 20px; }

/* Search dropdown panel */
.sh-navbar-search-panel {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--sh-black);
  padding: 12px 16px;
  border-top: 1px solid rgba(248, 247, 244, 0.08);
  z-index: 99;
  min-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.sh-navbar-search-panel input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(248, 247, 244, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sh-offwhite);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  border-radius: 4px;
}
.sh-navbar-search-panel input[type="search"]::placeholder { color: rgba(248, 247, 244, 0.5); }
.sh-navbar-search-panel input[type="search"]:focus {
  outline: 0;
  border-color: var(--sh-red);
}

/* Wishlist icon (shop) */
.sh-navbar-wishlist {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--sh-offwhite);
  text-decoration: none;
  transition: color var(--sh-duration) var(--sh-ease);
}
.sh-navbar-wishlist:hover { color: var(--sh-red); }
.sh-navbar-wishlist svg { width: 20px; height: 20px; }
.sh-navbar-wishlist .sh-wishlist-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--sh-red);
  color: var(--sh-white);
  font-size: 10px;
  font-weight: var(--sh-fw-bold);
  border-radius: var(--sh-radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sh-navbar-wishlist .sh-wishlist-count[data-count="0"] { display: none; }

/* Cart icon (shop) — spójny z wishlist: 36×36, licznik jako indeks górny */
.sh-navbar-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--sh-offwhite);
  text-decoration: none;
  transition: color var(--sh-duration) var(--sh-ease);
}
.sh-navbar-cart:hover { color: var(--sh-red); }
.sh-navbar-cart svg { width: 20px; height: 20px; }
.sh-cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--sh-red);
  color: var(--sh-white);
  font-size: 10px;
  font-weight: var(--sh-fw-bold);
  border-radius: var(--sh-radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sh-cart-count[data-count="0"] { display: none; }

/* -------- SUBNAV -------- */
.sh-subnav {
  position: sticky;
  top: 64px;
  z-index: var(--sh-z-subnav);
  background: var(--sh-offwhite);
  border-bottom: 1px solid var(--sh-red);
}

/* Belka promo (.sh-announce, ~40px) jest częścią sticky topbara (łącznie ~105px).
   Gdy belka jest aktywna, subnav musi pinować się pod całym topbarem — bez tego
   pinuje się za wysoko (top:64) i chowa pod headerem (z-index). Po wygaśnięciu
   belki reguła sama przestaje obowiązywać i wraca top:64px. */
body:has(.sh-announce) .sh-subnav { top: 105px; }

.sh-subnav-inner {
  max-width: var(--sh-container-wide);
  margin-inline: auto;
  padding: 0 var(--sh-gutter);
  /* 13 kalkulatorów w „Przygotowaniu" — na węższych desktopach (1025–1550px)
     belka nie mieści się w jednej linii; przewijanie zamiast rozjechania. */
  overflow-x: auto;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.sh-subnav-list {
  display: flex;
  align-items: center;
  gap: var(--sh-space-8);
  list-style: none;
  padding: 0;
  margin: 0;
}
/* HTML5 hidden attribute na liście — wymuś żeby działało (nadpisuje display:flex) */
.sh-subnav-list[hidden] { display: none !important; }
/* W .sh-subnav-inner mamy stack subnavów dla każdego top-level (tylko 1 visible w jednej chwili) */
.sh-subnav-inner { position: relative; }
/* Gdy wszystkie subnav-list są ukryte — chowamy całą sekcję subnav (nie zostawia pustego paska). */
.sh-subnav:not(:has(.sh-subnav-list:not([hidden]))) {
  display: none;
}
.sh-subnav-list > li {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.sh-subnav-list a {
  display: inline-flex;
  align-items: center;
  height: 48px;
  font-size: var(--sh-fs-xs);
  font-weight: var(--sh-fw-semibold);
  letter-spacing: var(--sh-tracking-wide);
  text-transform: uppercase;
  color: var(--sh-gray-500);
  text-decoration: none;
  position: relative;
  transition: color var(--sh-duration) var(--sh-ease);
}

.sh-subnav-list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  height: 2px;
  background: var(--sh-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--sh-duration) var(--sh-ease);
}

.sh-subnav-list li.is-active a,
.sh-subnav-list a:hover { color: var(--sh-black); }

.sh-subnav-list li.is-active a::after,
.sh-subnav-list a:hover::after { transform: scaleX(1); }

/* Mobile accordion (DOM wstrzykiwany przez navbar.js) — ukryty na desktopie */
.sh-mobile-subnav,
.sh-mobile-subnav-toggle { display: none; }

/* -------- MOBILE -------- */
@media (max-width: 1024px) {
  .sh-navbar-toggle {
    display: inline-flex;
    position: relative;
    z-index: 10010; /* nad fullscreen menu, żeby zamykał klik X/hamburger */
  }
  .sh-nav-primary { display: none; }
  /* CTA zostaje widoczne — koszyk + konto MUSZĄ być w pasku na mobile.
     Search też zostaje (lupka + dropdown panel). Wishlist chowamy żeby nie zatłoczyć paska. */
  .sh-navbar-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px; /* odstęp od hamburgera */
    min-width: 0;      /* wolno się kurczyć — ale nie kosztem hamburgera (niżej) */
  }
  .sh-navbar-cta .sh-navbar-wishlist { display: none; }

  /* ⛔ Hamburger NIE MOŻE się kurczyć. Zmierzone 12.09.2026 na 375 px: po dodaniu ikony
     konta w kontekście info pasek zrobił się ciasny i `flex-shrink: 1` zapadł przycisk
     menu z 44 px do 12 px — cel dotykowy poniżej progu dostępności. Ikony CTA też
     blokujemy przed zgnieceniem; jeśli zabraknie miejsca, ustąpić ma odstęp, nie przycisk. */
  .sh-navbar-toggle { flex-shrink: 0; }
  .sh-navbar-cta .sh-navbar-icon,
  .sh-navbar-cta .sh-navbar-cart,
  .sh-navbar-cta .sh-btn { flex-shrink: 0; }

  /* Search panel na mobile: full-width od krawędzi do krawędzi (zamiast dropdown 320px) */
  .sh-navbar-cta .sh-navbar-search-panel {
    position: fixed;
    top: var(--sh-navbar-height, 64px);
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
    padding: 12px;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  }

  /* Fullscreen overlay menu */
  .sh-nav-primary.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* lepsze na iOS Safari (uwzględnia bottom URL bar) */
    flex-direction: column;
    justify-content: flex-start; /* flex-start (nie center) — center przycina górę przy rozwiniętych akordeonach + overflow */
    align-items: center;
    gap: 0;
    background: var(--sh-black);
    padding: 80px 24px 40px;
    margin: 0;
    z-index: 10000;
    overflow-y: auto;
    animation: sh-menu-fade-in .2s ease-out;
  }
  .sh-nav-primary.is-open > li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(248, 247, 244, 0.08);
  }
  .sh-nav-primary.is-open > li:last-child { border-bottom: 0; }
  .sh-nav-primary.is-open > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* rozciągnij link na całą szerokość — inaczej justify-content:center nie centruje (link kurczy się do szerokości tekstu i ląduje przy lewej) */
    height: auto;
    padding: 18px 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }
  .sh-nav-primary.is-open > li > a::after { display: none; }

  /* ----- Mobilny akordeon podmenu ----- */
  /* Rodzic z podmenu: chevron-toggle absolutnie po prawej (etykieta zostaje wycentrowana). */
  .sh-nav-primary.is-open > li.sh-has-mobile-subnav {
    position: relative;
    flex-direction: column; /* link w wierszu 1, podmenu pod nim (li dziedziczy flex-row z bazy) */
    align-items: stretch;
  }
  .sh-nav-primary.is-open .sh-mobile-subnav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 0;
    width: 64px;
    height: 60px; /* wysokość wiersza rodzica (padding 18 + ~font) */
    background: transparent;
    border: 0;
    color: var(--sh-offwhite);
    cursor: pointer;
    z-index: 1; /* nad linkiem rodzica — prawy obszar tapa chevron */
  }
  .sh-nav-primary.is-open .sh-mobile-subnav-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform var(--sh-duration) var(--sh-ease);
  }
  .sh-nav-primary.is-open > li.is-expanded > .sh-mobile-subnav-toggle svg {
    transform: rotate(180deg);
  }

  /* Lista children — domyślnie zwinięta, rozwijana po is-expanded. */
  .sh-nav-primary.is-open .sh-mobile-subnav {
    display: none;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0 0 12px;
  }
  .sh-nav-primary.is-open > li.is-expanded > .sh-mobile-subnav { display: block; }
  .sh-nav-primary.is-open .sh-mobile-subnav > li {
    width: 100%;
    text-align: center;
    border: 0;
  }
  .sh-nav-primary.is-open .sh-mobile-subnav > li > a {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none; /* children normalnym krojem, nie UPPERCASE */
    color: rgba(248, 247, 244, 0.65);
    text-decoration: none;
  }
  .sh-nav-primary.is-open .sh-mobile-subnav > li > a:hover,
  .sh-nav-primary.is-open .sh-mobile-subnav > li > a:focus {
    color: var(--sh-offwhite) !important;
  }

  /* Logo wyśrodkowane na górze nakładki menu (nad overlay z-index:10000,
     pod przyciskiem X z-index:10010). .sh-navbar-logo jest rodzeństwem
     .sh-nav-primary w .sh-navbar-inner, więc podnosimy je ponad overlay. */
  body.sh-menu-open .sh-navbar-logo {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
  }

  /* X przypięty do prawego górnego rogu viewportu, w linii z logo (top 12px, wys. 40px).
     Bez tego X zostaje w pasku, który belka promo (.sh-announce, na mobile 2 linie)
     spycha w dół — i X wpadał na chevron akordeonu pierwszej pozycji (Suplementy),
     więc tapnięcie w chevron zamykało menu. Lista overlaya zaczyna się od 80px. */
  body.sh-menu-open .sh-navbar-toggle {
    position: fixed;
    top: 10px;
    right: var(--sh-gutter, 24px);
  }

  /* Hamburger → X gdy menu open */
  .sh-navbar-toggle[aria-expanded="true"] svg { display: none; }
  .sh-navbar-toggle[aria-expanded="true"]::before {
    content: "×";
    color: var(--sh-offwhite);
    font-size: 32px;
    line-height: 1;
    font-weight: 300;
  }

  /* Body scroll lock gdy menu open */
  body.sh-menu-open { overflow: hidden; }

  /* Subnav-bar ukryty na mobile — children są teraz w akordeonie overlaya
     (osobny pasek i tak leżał pod overlayem). */
  .sh-subnav,
  .sh-subnav.is-open { display: none; }
}

@keyframes sh-menu-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
