/* ============================================================
   BAZA WIEDZY — osobna podstrona (baza-wiedzy.html)
   Zwykły, swobodny scroll (BEZ scroll-snap): NIE dołączamy
   layout.css/cards.css/animations.css (tam żyje body{overflow:hidden}
   + snap). Ten arkusz jest samodzielny; korzysta tylko z tokenów
   z css/tokens.css (paleta, typografia, odstępy, ruch).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Subtelny motyw „warstwy" w tle całej strony — ledwo widoczne poziome linie. */
  background-image: repeating-linear-gradient(0deg, transparent 0 7px, rgba(255, 255, 255, 0.014) 7px 8px);
}

/* Dostępność: widoczny focus (spójnie z globalną regułą strony głównej). */
:focus-visible { outline: 2px solid var(--accent-eng); outline-offset: 3px; }

a { color: inherit; }

/* --- Strażnik reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Nagłówek (sticky) — marka + spis sekcji + powrót/CTA
   ============================================================ */
.kb-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(21, 23, 27, 0.82);            /* --bg z przezroczystością */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.kb-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.kb-brand::before {                              /* akcent „gorącej dyszy" */
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-hot);
  align-self: center;
}
.kb-brand span { font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 500; color: var(--text-dim); letter-spacing: 0.04em; }

.kb-nav { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.5rem); }
.kb-nav__links { display: flex; gap: clamp(0.75rem, 1.6vw, 1.4rem); }
.kb-nav__links a {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.03em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.18s ease;
}
.kb-nav__links a:hover { color: var(--text); }

/* Na węższych ekranach chowamy wewnętrzny spis sekcji (zostaje marka + CTA). */
@media (max-width: 720px) { .kb-nav__links { display: none; } }

/* ============================================================
   Kontener treści + sekcje
   ============================================================ */
.kb-main {
  max-width: min(960px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

.kb-hero { padding-block: clamp(2.5rem, 8vh, 5rem) clamp(1.25rem, 4vh, 2.5rem); }
.kb-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-eng);
  margin: 0 0 0.9rem;
}
.kb-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.kb-hero h1 .accent {
  background: linear-gradient(120deg, var(--accent-hot-2), var(--accent-hot));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kb-hero__lead { font-size: var(--fs-body); color: var(--text-dim); max-width: 60ch; margin: 0; }

.kb-section { padding-block: clamp(2.5rem, 7vh, 4.5rem); border-top: 1px solid var(--line-soft); }
.kb-section__head { margin: 0 0 clamp(1.25rem, 3vh, 2rem); }
.kb-section__kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-hot);
  margin: 0 0 0.6rem;
}
.kb-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.kb-section__intro { color: var(--text-dim); max-width: 65ch; margin: 0; }

.kb-prose p { color: var(--text-dim); margin: 0 0 1rem; }
.kb-prose p:last-child { margin-bottom: 0; }
.kb-prose strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Komponenty wielokrotnego użytku (karty, siatka, tagi)
   ============================================================ */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: clamp(0.9rem, 2vw, 1.4rem); }

.kb-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: clamp(1rem, 2vw, 1.4rem);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-deep));
  transition: border-color 0.25s ease, transform 0.25s var(--ease-out);
}
.kb-card:hover { border-color: rgba(255, 106, 43, 0.45); transform: translateY(-3px); }
/* Karty informacyjne bez linku („kiedy wybrać materiał") — bez uniesienia na hover. */
.kb-card--plain:hover { transform: none; border-color: var(--line); }
/* Blok „kiedy wybrać" — odstęp od tabeli materiałów. */
.kb-when { margin-top: clamp(1.75rem, 4vh, 2.5rem); }
.kb-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 0; }
.kb-card__desc { color: var(--text-dim); font-size: 0.95rem; margin: 0; flex: 1; }
.kb-card__link {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--accent-eng);
  text-decoration: none;
  margin-top: 0.25rem;
}
.kb-card__link:hover { color: var(--accent-hot); }
.kb-card__link::after { content: " \2197"; }     /* ↗ */

.kb-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.kb-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: 0.03em;
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 99px;
}
.kb-tag--free { color: var(--accent-eng-2); border-color: rgba(61, 139, 255, 0.4); }
.kb-tag--paid { color: var(--accent-hot-2); border-color: rgba(255, 106, 43, 0.4); }

/* ============================================================
   Tabela porównawcza materiałów — układ PIERWOTNY (materiały = KOLUMNY).
   Cel: zmieścić 8 kolumn w kolumnie treści (~878px) BEZ poziomego scrolla.
   Techniki (łącznie): table-layout:fixed + colgroup z jawnymi % (label 13% +
   7×12.43%); czcionka komórek 0.8rem / etykiet 0.75rem; padding poziomy 0.4rem;
   overflow-wrap:break-word + hyphens:auto na KAŻDEJ komórce (żadne słowo nie
   wystaje poza kolumnę) oraz ZERO white-space:nowrap. Dzięki fixed+width:100%
   tabela ma dokładnie szerokość kontenera, a break-word gwarantuje brak overflow
   → poziomy scroll strukturalnie niemożliwy. min-width tylko na mobile (patrz media).
   ============================================================ */
.kb-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0.8rem; }
.kb-table { width: 100%; border-collapse: collapse; }
.kb-table--materials { table-layout: fixed; }   /* deterministyczny podział wg colgroup, bez zgadywania */
.kb-col-label { width: 13%; }
.kb-col-mat   { width: 12.4286%; }               /* 7 × 12.4286% = 87% → +13% label = 100% */

.kb-table th, .kb-table td {
  padding: 0.55rem 0.4rem;                       /* poziomy padding mocno zmniejszony (6.4px/stronę) */
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  overflow-wrap: break-word;                     /* siatka bezpieczeństwa: długie słowo się łamie, nie wystaje */
  hyphens: auto;
}
.kb-table thead th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;                            /* mniejsza etykieta kolumny (to tylko nagłówek, nie treść) */
  letter-spacing: 0.02em;
  color: var(--text);                            /* nazwy materiałów nadpisane inline kolorem akcentu */
  background: var(--bg-elev);
  position: sticky; top: 0;
}
.kb-prop-label {                                 /* etykiety właściwości (nagłówki wierszy) */
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-dim);
}
.kb-cell-text { font-size: 0.8rem; color: var(--text-dim); line-height: 1.3; }
.kb-cell-num  { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); }
.kb-table tr:last-child td, .kb-table tr:last-child th { border-bottom: none; }

/* „Zastosowania" jako kompaktowe chipy (styl jak .mat__use / bloki „kiedy wybrać") —
   zawijają się ciaśniej niż zdanie ciągłe, więc kolumna potrzebuje mniej szerokości. */
.kb-usechips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.kb-usechip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--text-dim);
  max-width: 100%;
  overflow-wrap: break-word;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  background: var(--bg-elev);
}

/* Pasek właściwości 0–100 — pomarańczowy (jak w pierwotnej tabeli). */
.kb-bar { display: block; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.kb-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent-hot); }

/* Mobile: 8 kolumn nie zmieści się czytelnie < ~640px → tabela dostaje min-width
   i .kb-tablewrap przewija ją w poziomie (body strony pozostaje bez rozjazdu). */
@media (max-width: 640px) {
  .kb-table--materials { min-width: 560px; }
}

/* ============================================================
   CTA domykające (konwersja) + stopka
   ============================================================ */
.kb-cta {
  margin: clamp(2.5rem, 7vh, 4.5rem) 0 0;
  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 106, 43, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg-elev), var(--bg-deep));
  text-align: center;
}
.kb-cta h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h3); margin: 0 0 0.6rem; }
.kb-cta p { color: var(--text-dim); margin: 0 0 1.5rem; }

.kb-footer {
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
  border-top: 1px solid var(--line);
  padding: 1.75rem clamp(1rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  color: var(--text-faint);
  font-size: var(--fs-small);
}
.kb-footer a { color: var(--text-dim); text-decoration: none; }
.kb-footer a:hover { color: var(--accent-hot); }
.kb-footer__info { display: flex; flex-direction: column; gap: 0.2rem; }
.kb-footer__copy { font-family: var(--font-mono); color: var(--text-faint); }
.kb-footer__links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }

/* ============================================================
   Przyciski (kopia .btn z cards.css — izoluje podstronę)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.01em;
  padding: 0.85rem 1.5rem; border-radius: 0.6rem; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform 0.18s var(--ease-out), background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.btn:active { transform: translateY(1px); }
.btn--hot { background: linear-gradient(180deg, var(--accent-hot-2), var(--accent-hot)); color: #1a0e05; box-shadow: 0 8px 22px rgba(255, 106, 43, 0.28); }
.btn--hot:hover { box-shadow: 0 10px 28px rgba(255, 106, 43, 0.42); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent-eng); color: #fff; }

/* --- Responsywność --- */
@media (max-width: 560px) {
  .kb-footer { flex-direction: column; align-items: flex-start; }
}
