/* ==================================================================
   SEO FOR LAW - warstwa czytelności artykułów bazy wiedzy
   Ładowana wyłącznie na stronach /baza-wiedzy/ (panel/article.php).
   Nie zmienia nic poza artykułami. Wycofanie: usunąć <link> w article.php.
   ================================================================== */

:root {
  --gold-dark: var(--gold-text);
}

/* ------------------------------------------------------------------
   1. RYTM SEKCJI
   Każda sekcja dostaje numer zgodny ze spisem treści, mniejszy nagłówek,
   akapit otwierający i linię oddzielającą. Zamiast ciągu identycznych
   "slajdów" czytelnik widzi rozdziały z wyraźnym początkiem.
   ------------------------------------------------------------------ */
.article .article-content {
  counter-reset: sfl-section;
}

.article .article-content > section[id^="sekcja-"] {
  position: relative;
  padding-top: 44px;
  margin-bottom: 44px;
  border-top: 1px solid var(--line);
  counter-increment: sfl-section;
}

.article .article-content > section[id^="sekcja-"]::before {
  display: block;
  margin-bottom: 14px;
  color: var(--gold-text);
  content: counter(sfl-section, decimal-leading-zero);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.article .article-content > section[id^="sekcja-"] > h2 {
  margin-bottom: 20px;
  font-size: clamp(1.72rem, 2.45vw, 2.3rem);
  letter-spacing: -0.03em;
  line-height: 1.14;
}

/* Pierwszy akapit sekcji pełni rolę wejścia: odrobinę większy i ciemniejszy. */
.article .article-content > section[id^="sekcja-"] > h2 + p {
  color: var(--ink);
  font-size: 1.13rem;
  line-height: 1.72;
}

/* Akapity domykające sekcję po tabeli, infoboksie albo przykładach. */
.article .article-content > section > .article-section__after {
  margin-top: 28px;
}

/* ------------------------------------------------------------------
   2. LISTY
   Lista w sekcji to zwykle sedno - punkty do sprawdzenia albo zakazy.
   Wyróżniona panelem przestaje ginąć między akapitami.
   ------------------------------------------------------------------ */
.article .article-content > section[id^="sekcja-"] > ul {
  display: grid;
  padding: 22px 26px;
  margin: 26px 0;
  background: var(--ivory);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  list-style: none;
  gap: 10px;
}

.article .article-content > section[id^="sekcja-"] > ul > li {
  position: relative;
  padding-left: 24px;
  font-size: 1rem;
  line-height: 1.6;
}

.article .article-content > section[id^="sekcja-"] > ul > li::before {
  position: absolute;
  top: 0.8em;
  left: 0;
  width: 11px;
  height: 2px;
  background: var(--gold);
  content: "";
}

/* ------------------------------------------------------------------
   3. SPIS TREŚCI
   Numeracja sekcji zgodna z numerami w treści. Pozycje poza treścią
   (autor, FAQ, źródła) oddzielone linią, bez numerów.
   ------------------------------------------------------------------ */
.article-toc__extras {
  padding: 14px 0 0 20px;
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  list-style: none;
}

.article-toc__extras li + li {
  margin-top: 10px;
}

.article-toc__toggle {
  display: none;
}

/* ------------------------------------------------------------------
   4. TABELE
   ------------------------------------------------------------------ */
.article-table--compact th,
.article-table--compact td {
  padding: 12px 14px;
  font-size: 0.95rem;
}

.article-table--compact {
  min-width: 560px;
}

/* ------------------------------------------------------------------
   5. DIAGNOZA - wiersze "objaw / sprawdź / priorytet"
   ------------------------------------------------------------------ */
.article-diagnosis {
  display: grid;
  margin-top: 30px;
  gap: 16px;
}

.article-diagnosis__row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
}

.article-diagnosis__row > header {
  display: flex;
  align-items: baseline;
  padding: 20px 24px 0;
  gap: 14px;
}

.article-diagnosis__row > header span {
  color: var(--gold-text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
}

.article .article-content .article-diagnosis__row h3 {
  margin: 0;
  font-size: clamp(1.2rem, 1.7vw, 1.42rem);
}

.article-diagnosis__row dl {
  display: grid;
  padding: 18px 24px 22px;
  margin: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.article-diagnosis__row dl > div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.article-diagnosis__row dt {
  margin-bottom: 6px;
  color: var(--gold-text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article-diagnosis__row dd {
  margin: 0;
  color: #34414a;
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-diagnosis__row dl > div:last-child dt {
  color: var(--burgundy);
}

.article-diagnosis__row dl > div:last-child dd {
  color: var(--navy);
  font-weight: 600;
}

/* ------------------------------------------------------------------
   6. LISTA KONTROLNA - pola do odhaczenia
   ------------------------------------------------------------------ */
.article-checklist {
  display: grid;
  margin-top: 28px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.article-checklist fieldset {
  min-width: 0;
  padding: 18px 20px 10px;
  margin: 0;
  background: var(--ivory);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
}

.article-checklist legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.article-checklist label {
  display: flex;
  align-items: flex-start;
  clear: both;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  gap: 11px;
}

.article-checklist input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--burgundy);
  cursor: pointer;
}

.article-checklist label span {
  color: #34414a;
  font-size: 0.95rem;
  line-height: 1.5;
}

.article-checklist input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(123, 52, 57, 0.45);
}

.article-checklist input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
   7. MATERIAŁ DO POBRANIA - dwa przyciski obok siebie
   ------------------------------------------------------------------ */
.article-download__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.article-download .button--ghost {
  color: var(--white);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
}

.article-download .button--ghost:hover,
.article-download .button--ghost:focus-visible {
  color: var(--navy);
  background: var(--white);
  border-color: var(--white);
}

/* ------------------------------------------------------------------
   8. PRZYKŁADY - etykieta korzystała z niezdefiniowanego koloru
   ------------------------------------------------------------------ */
/* Nieparzysta liczba kart w siatce 2-kolumnowej: ostatnia zajmuje całą
   szerokość, zamiast zostawać sama w połowie rzędu. */
.mail-example-grid > .mail-example:last-child:nth-child(odd),
.article-checklist > fieldset:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.mail-example > div {
  color: var(--gold-text);
}

/* ------------------------------------------------------------------
   9. TABLET I TELEFON
   ------------------------------------------------------------------ */
@media (max-width: 850px) {
  /* Spis treści zwijany - na telefonie zajmował cały pierwszy ekran. */
  .article-toc.is-collapsible {
    padding: 0;
    background: var(--ivory);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
  }

  .article-toc.is-collapsible > p {
    display: none;
  }

  .article-toc__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 18px;
    color: var(--navy);
    background: none;
    border: 0;
    cursor: pointer;
    font: 800 0.74rem/1.2 var(--font-sans);
    letter-spacing: 0.13em;
    text-align: left;
    text-transform: uppercase;
    gap: 12px;
  }

  .article-toc__toggle small {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
  }

  .article-toc__toggle::after {
    flex: 0 0 auto;
    color: var(--burgundy);
    content: "+";
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0;
  }

  .article-toc.is-open .article-toc__toggle::after {
    content: "−";
  }

  .article-toc.is-collapsible:not(.is-open) > ol,
  .article-toc.is-collapsible:not(.is-open) > ul {
    display: none;
  }

  .article-toc.is-collapsible > ol {
    padding: 0 18px 4px 38px;
    margin: 0;
  }

  .article-toc.is-collapsible > .article-toc__extras {
    margin: 12px 18px 0;
    padding: 12px 0 16px 20px;
  }
}

@media (max-width: 760px) {
  .article-checklist {
    grid-template-columns: 1fr;
  }

  .article-diagnosis__row dl {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .article-download__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .article .article-content > section[id^="sekcja-"] {
    padding-top: 34px;
    margin-bottom: 34px;
  }

  .article .article-content > section[id^="sekcja-"] > h2 {
    font-size: 1.62rem;
  }

  .article .article-content > section[id^="sekcja-"] > h2 + p {
    font-size: 1.06rem;
  }

  .article .article-content > section[id^="sekcja-"] > ul {
    padding: 18px 18px 18px 20px;
  }

  /* Tabele jako karty - na telefonie trzecia kolumna była niewidoczna,
     a pasek przewijania miał dwa piksele. Klasę --stack dodaje renderer. */
  .article-table-wrap:has(.article-table--stack) {
    overflow: visible;
    border: 0;
  }

  .article-table--stack {
    min-width: 0;
    background: transparent;
  }

  .article-table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .article-table--stack tbody,
  .article-table--stack tr,
  .article-table--stack th,
  .article-table--stack td {
    display: block;
  }

  .article-table--stack tr {
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--ivory);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
  }

  .article-table--stack th,
  .article-table--stack td {
    width: auto;
    padding: 0;
    border: 0;
  }

  .article-table--stack tbody th {
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    font-size: 1.08rem;
  }

  .article-table--stack td {
    padding-top: 10px;
    font-size: 0.97rem;
    line-height: 1.6;
  }

  .article-table--stack td[data-label]::before {
    display: block;
    margin-bottom: 3px;
    color: var(--gold-text);
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* Box autora wyśrodkowany i bez ściśniętej kolumny tekstu. */
  .article-author {
    padding: 28px 22px;
    text-align: center;
    justify-items: center;
    gap: 16px;
  }

  .article-author h2 {
    font-size: 1.75rem;
  }

  /* Pytania FAQ - duży szeryf łamał jedno pytanie na trzy wiersze. */
  .faq summary {
    padding: 18px 40px 18px 0;
    font-size: 1.12rem;
    line-height: 1.35;
  }

  .faq summary::after {
    top: 18px;
  }

  .faq details > div {
    padding-right: 0;
  }
}
