/* nb-polish.css — NewsBox premium polish layer (2026-05-27)
   ===================================================================
   Mounted AFTER style.css + premium.css. Adds: sticky scroll-hide topbar,
   mobile drawer + hamburger, mega-menu, search box + live results,
   reading progress, back-to-top, skeleton loaders, toast notifications,
   admin sidebar collapse, mobile FIT-v3 reinforcement.
   PINKY-MOBILE-SAFE-v2 compliant. */

/* ── PINKY-MOBILE-SAFE-v2 reinforcement (top of cascade) ─────────────── */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}
main, section, header, footer, nav, article, aside { max-width: 100vw; min-width: 0; }
img, video, svg, canvas, iframe { max-width: 100%; height: auto; }

/* ── DESIGN TOKENS (modular scale 1.250 minor third) ─────────────────── */
:root {
  --nb-fs-xs: 0.72rem;
  --nb-fs-sm: 0.82rem;
  --nb-fs-md: 0.92rem;
  --nb-fs-lg: 1.05rem;
  --nb-fs-xl: 1.28rem;
  --nb-fs-2xl: 1.55rem;
  --nb-fs-3xl: 1.92rem;
  --nb-fs-4xl: 2.35rem;
  --nb-space-1: 4px;
  --nb-space-2: 8px;
  --nb-space-3: 12px;
  --nb-space-4: 16px;
  --nb-space-5: 24px;
  --nb-space-6: 32px;
  --nb-space-7: 48px;
  --nb-space-8: 64px;
  --nb-ease: cubic-bezier(.22, .61, .36, 1);
  --nb-shadow-card: 0 1px 0 rgba(255,255,255,0.04), 0 12px 32px -16px rgba(0,0,0,0.5);
  --nb-shadow-pop: 0 20px 60px -16px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
  --nb-radius-sm: 8px;
  --nb-radius-md: 12px;
  --nb-radius-lg: 16px;
}

/* ── READING PROGRESS BAR (article pages) ────────────────────────────── */
.nb-reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 99;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  transition: opacity .3s var(--nb-ease);
}
.nb-reading-progress.active { opacity: 1; }
.nb-reading-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan, #00E5FF), var(--electric, #3D8FFF));
  transition: width .12s linear;
  box-shadow: 0 0 12px rgba(0,229,255,0.6);
}

/* ── SCROLL-HIDE TOPBAR (Headroom-style) ─────────────────────────────── */
.nb-topbar {
  transition: transform .35s var(--nb-ease), background .25s var(--nb-ease), box-shadow .25s var(--nb-ease);
}
.nb-topbar.scrolled {
  background: rgba(5, 6, 10, 0.92) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px -8px rgba(0,0,0,0.5);
}
.nb-topbar.scroll-hidden {
  transform: translateY(-100%);
}

/* ── DESKTOP NAV: active underline + better spacing ──────────────────── */
.nb-nav-cat {
  position: relative;
  padding: 8px 14px !important;
  transition: color .2s var(--nb-ease), background .2s var(--nb-ease);
}
.nb-nav-cat::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--cat-color, var(--cyan, #00E5FF));
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .25s var(--nb-ease);
}
.nb-nav-cat:hover::after,
.nb-nav-cat.active::after {
  transform: scaleX(1);
}
.nb-nav-cat.active {
  color: #fff !important;
  background: rgba(255,255,255,0.06) !important;
}

/* ── MEGA MENU "Wiecej" ───────────────────────────────────────────────── */
.nb-more-wrap { position: relative; }
.nb-more-toggle { cursor: pointer; background: transparent; border: 1px solid transparent; font: inherit; color: inherit; }
.nb-more-toggle[aria-expanded="true"] {
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
.nb-mega {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 540px;
  max-width: 92vw;
  background: linear-gradient(180deg, rgba(20, 22, 32, 0.98), rgba(11, 13, 20, 0.98));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--nb-radius-lg);
  box-shadow: var(--nb-shadow-pop);
  padding: var(--nb-space-5);
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s var(--nb-ease), transform .2s var(--nb-ease);
  pointer-events: none;
}
.nb-mega:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.nb-mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--nb-space-5);
}
.nb-mega-col { display: flex; flex-direction: column; gap: 6px; }
.nb-mega-title {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: var(--nb-fs-xs);
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--muted, rgba(232,236,244,0.55));
  margin-bottom: 6px;
}
.nb-mega-col a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text, #E8ECF4);
  font-size: var(--nb-fs-sm);
  transition: background .2s var(--nb-ease), color .2s var(--nb-ease);
}
.nb-mega-col a:hover {
  background: rgba(0, 229, 255, 0.08);
  color: #fff;
}
.nb-mega-col a span:first-child { width: 18px; text-align: center; }
.nb-mega-foot {
  margin-top: var(--nb-space-4);
  padding-top: var(--nb-space-3);
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  font-size: var(--nb-fs-xs);
}
.nb-mega-foot .dim { color: var(--muted, rgba(232,236,244,0.5)); }

/* ── SEARCH BOX (desktop) ─────────────────────────────────────────────── */
.nb-search { position: relative; }
.nb-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text, #E8ECF4);
  cursor: pointer;
  transition: background .2s var(--nb-ease), border-color .2s var(--nb-ease);
}
.nb-search-toggle:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--cyan, #00E5FF);
}
.nb-search-box {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-width: 92vw;
  background: rgba(11, 13, 20, 0.98);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--nb-radius-md);
  box-shadow: var(--nb-shadow-pop);
  padding: var(--nb-space-3);
  z-index: 60;
}
.nb-search-box input {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--text, #E8ECF4);
  padding: 10px 12px;
  font-family: 'Inter', sans-serif;
  font-size: var(--nb-fs-md);
  outline: none;
  transition: border-color .2s var(--nb-ease);
}
.nb-search-box input:focus {
  border-color: var(--cyan, #00E5FF);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}
.nb-search-results {
  margin-top: var(--nb-space-2);
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nb-search-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text, #E8ECF4);
  background: rgba(255,255,255,0.02);
  transition: background .15s var(--nb-ease);
}
.nb-search-result:hover { background: rgba(0, 229, 255, 0.08); color: #fff; }
.nb-search-result .nb-sr-meta {
  display: flex; gap: 8px; align-items: center;
  font-size: var(--nb-fs-xs);
  color: var(--muted, rgba(232,236,244,0.6));
}
.nb-search-result .nb-sr-title {
  font-weight: 600;
  font-size: var(--nb-fs-sm);
  line-height: 1.3;
}
.nb-search-empty {
  padding: var(--nb-space-3);
  text-align: center;
  color: var(--muted, rgba(232,236,244,0.55));
  font-size: var(--nb-fs-sm);
}

/* ── HAMBURGER (mobile only) ──────────────────────────────────────────── */
.nb-hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text, #E8ECF4);
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  flex: 0 0 auto;
}
.nb-hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .3s var(--nb-ease), opacity .3s var(--nb-ease);
}
.nb-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nb-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nb-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── DRAWER POLISH (search + sections) ────────────────────────────────── */
.nb-drawer-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--nb-space-2) 0 var(--nb-space-3);
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--muted, rgba(232,236,244,0.55));
}
.nb-drawer-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text, #E8ECF4);
  font: inherit;
  font-size: var(--nb-fs-md);
}
.nb-drawer-search-results {
  margin: 0 0 var(--nb-space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 40vh;
  overflow-y: auto;
}

/* ── BREAKPOINTS: <900px desktop nav hidden, hamburger shown ─────────── */
@media (max-width: 900px) {
  .nb-nav-cats,
  .nb-search,
  .nb-topbar-inner .lang-switcher { display: none !important; }
  .nb-hamburger { display: inline-flex !important; }
  .nb-topbar-inner { gap: var(--nb-space-3); }
}

/* Desktop: hide hamburger */
@media (min-width: 901px) {
  .nb-hamburger { display: none !important; }
}

/* ── BACK TO TOP FAB ──────────────────────────────────────────────────── */
.nb-back-to-top {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan, #00E5FF);
  display: flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 90;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s var(--nb-ease), transform .3s var(--nb-ease), background .2s var(--nb-ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.nb-back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.nb-back-to-top:hover {
  background: rgba(0, 229, 255, 0.25);
  transform: translateY(-2px);
}
@media (max-width: 640px) {
  .nb-back-to-top { bottom: 14px; right: 14px; width: 42px; height: 42px; }
}

/* ── SKELETON LOADERS ─────────────────────────────────────────────────── */
.nb-skeleton {
  display: block;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: nb-shimmer 1.4s infinite var(--nb-ease);
  border-radius: 6px;
}
.nb-skeleton-card {
  background: var(--card-bg, rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--nb-radius-md);
  padding: var(--nb-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--nb-space-2);
}
.nb-skeleton-line { height: 12px; }
.nb-skeleton-line.short { width: 60%; }
.nb-skeleton-line.title { height: 18px; width: 90%; margin-bottom: 4px; }
.nb-skeleton-img { aspect-ratio: 16 / 9; }
@keyframes nb-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────────── */
.nb-toast-host {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.nb-toast {
  background: rgba(11, 13, 20, 0.95);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: var(--nb-fs-sm);
  box-shadow: var(--nb-shadow-pop);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: nb-toast-in .25s var(--nb-ease);
}
.nb-toast.ok { border-color: rgba(0, 214, 122, 0.4); }
.nb-toast.err { border-color: rgba(255, 59, 92, 0.4); color: #FF96A8; }
.nb-toast.fade { animation: nb-toast-out .3s var(--nb-ease) forwards; }
@keyframes nb-toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes nb-toast-out { to { transform: translateY(20px); opacity: 0; } }

/* ── LAZY-LOADING IMAGES (smooth reveal) ──────────────────────────────── */
img.nb-lazy {
  opacity: 0;
  transition: opacity .4s var(--nb-ease);
}
img.nb-lazy.loaded { opacity: 1; }

/* ── MATRIX RAIN EASTER EGG (3x logo click) ───────────────────────────── */
.nb-matrix-rain {
  position: fixed;
  inset: 0;
  z-index: 99998;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  transition: opacity .5s ease;
}
.nb-matrix-rain.active { opacity: 1; pointer-events: auto; }
.nb-matrix-rain canvas { width: 100%; height: 100%; display: block; }
.nb-matrix-hint {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  color: #00FF66;
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 13px;
  text-shadow: 0 0 8px #00FF66;
  letter-spacing: .3em;
}

/* ── MOBILE FIT-V3 (reinforced) ───────────────────────────────────────── */
@media (max-width: 640px) {
  .container, .nav-inner, .topbar-inner, .nb-topbar-inner {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  h1, h2, h3, h4 {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
  }
  p, li, a, span, label, button {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  .hero h1, .hero-home h1 {
    font-size: clamp(1.6rem, 6.8vw, 2.4rem) !important;
    line-height: 1.2 !important;
  }
  section, header, footer, main, .hero, .stats, .cta { min-width: 0; }
  [style*="letter-spacing"][style*="uppercase"], .kicker, .hero-badge {
    white-space: normal !important;
    font-size: .6rem !important;
    letter-spacing: .4px !important;
  }
  .price-card, .folio-card, .review-card, .svc-card { max-width: 100%; min-width: 0; }
  table, pre, code { max-width: 100%; overflow-x: auto; }
  .nb-mega { right: -16px; min-width: 0; width: calc(100vw - 32px); }
  .nb-mega-grid { grid-template-columns: 1fr; gap: var(--nb-space-3); }
  .nb-search-box { right: -16px; width: calc(100vw - 32px); }
}

/* ── REDUCED MOTION ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .nb-topbar.scroll-hidden { transform: none; }
}

/* ── PRINT ────────────────────────────────────────────────────────────── */
@media print {
  .nb-topbar, .nb-back-to-top, .nb-reading-progress, .nb-drawer, .mobile-nav-drawer,
  .nb-toast-host, .nb-matrix-rain, .newsletter-widget, .pf-loader, .pf-progress {
    display: none !important;
  }
}
