/* otwarteAPI.pl — wspólny arkusz stylów dla index.html i wszystkich podstron per-API.
   Wydzielone z dawnego inline <style> w index.html, bez zmian wizualnych, plus
   nowe klasy pod podstrony (nav, content/prose, faq-item, try-it). */

:root {
  --ink: #111827;
  --muted: #5b6472;
  --line: #e3e6ea;
  --bg-card: #f7f9f9;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --chip-bg: #eef2f2;
  --chip-active-bg: #0f766e;
  --chip-active-ink: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.5;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 48px 20px 64px; }
header.hero { text-align: center; margin-bottom: 32px; }
h1 { font-size: clamp(26px, 4vw, 34px); margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 16px; max-width: 620px; margin: 0 auto; }

.search-bar { margin: 32px 0 8px; }
#q {
  width: 100%; font-size: 16px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 10px; outline: none;
}
#q:focus { border-color: var(--accent); }
.chip-group { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; }
.chip-label { font-size: 12px; color: var(--muted); flex-shrink: 0; padding-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip-bg); color: var(--ink); cursor: pointer; user-select: none;
}
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-ink); border-color: var(--chip-active-bg); }

#count { color: var(--muted); font-size: 13.5px; margin: 16px 0; min-height: 1.2em; }

/* min-height rezerwuje miejsce zanim catalog.js dogra karty z ai-catalog.json —
   bez tego strona robi duży skok layoutu (CLS) po wczytaniu danych. Wartości
   zmierzone realnie (18 wpisów, 2026-07-18) dla każdego układu kolumn siatki
   auto-fill(280px): 1 kolumna ≈ 6840px, 2 kolumny ≈ 3565px, 3 kolumny ≈ 2620px
   — jeśli katalog mocno urośnie, ponownie zmierzyć i podbić. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  min-height: 2400px; /* 3 kolumny, ≥900px szerokości .wrap */
}
@media (max-width: 899px) {
  .grid { min-height: 3200px; } /* 2 kolumny */
}
@media (max-width: 640px) {
  .grid { min-height: 6200px; } /* 1 kolumna */
}
.card {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px;
  background: var(--bg-card); display: flex; flex-direction: column; gap: 8px;
}
.card .name { font-size: 16px; font-weight: 600; }
.card a.name-link { color: var(--ink); text-decoration: none; }
.card a.name-link:hover .name { color: var(--accent); text-decoration: underline; }
.card .desc { font-size: 13.5px; color: var(--muted); flex-grow: 1; }
.card .meta-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; }
.badge {
  padding: 3px 8px; border-radius: 6px; background: #ffffff; border: 1px solid var(--line); color: var(--muted);
  display: inline-block;
}
.badge.free { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.badge.mcp { color: #7c3aed; border-color: #ddd6fe; background: #f5f3ff; }
.badge.jurisdiction { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; font-weight: 600; }
.card .queries { font-size: 12px; color: var(--muted); font-style: italic; }
a.cta {
  display: inline-block; align-self: flex-start; font-size: 13.5px; font-weight: 600;
  text-decoration: none; padding: 7px 12px; border-radius: 8px; margin-top: 4px;
  background: var(--accent); color: var(--accent-ink);
}
a.cta:hover { background: #0c5c56; }
a.cta.secondary {
  background: #ffffff; color: var(--accent); border: 1px solid var(--line);
}
a.cta.secondary:hover { border-color: var(--accent); background: var(--chip-bg); }

.pk-empty { color: var(--muted); font-size: 14px; }

footer { margin-top: 56px; text-align: center; color: var(--muted); font-size: 13.5px; }
footer p { margin: 4px 0; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- Podstrony per-API ---------- */

.nav { padding: 20px 0 0; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13.5px; }
.nav a:hover { color: var(--accent); text-decoration: underline; }

.detail-hero { padding: 24px 0 8px; }
.detail-hero h1 { text-align: left; font-size: clamp(22px, 3.4vw, 28px); }
.detail-hero .lead { text-align: left; margin: 0; max-width: none; }
.detail-hero .meta-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; margin-top: 14px; }

.try-it {
  margin-top: 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-card);
}
.try-it .note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.try-it button {
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: none;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.try-it button:hover { background: #0c5c56; }
.try-it button:disabled { opacity: 0.6; cursor: default; }
.try-it pre {
  margin: 12px 0 0; padding: 12px 14px; background: #0b1620; color: #d7e3ea; border-radius: 8px;
  font-size: 12px; line-height: 1.5; overflow-x: auto; max-height: 360px; white-space: pre-wrap; word-break: break-word;
}
.try-it .err { color: #b91c1c; font-size: 13px; margin-top: 10px; }

.content { padding-top: 8px; }
.content .wrap.prose { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.prose h2 { font-size: 19px; margin: 40px 0 14px; }
.prose p { color: var(--ink); font-size: 15px; }
.prose ul { color: var(--ink); font-size: 15px; padding-left: 20px; margin: 0; }
.prose ul li { margin: 8px 0; }

/* ---------- Pasek dostępności (zawsze widoczny, u góry strony) ---------- */

/* Rezerwuje miejsce na pasek a11y (wstawiany przez JS) zanim się załaduje,
   żeby nie powodować CLS. Wysokości zmierzone empirycznie (2 wiersze paska:
   a11y + language switcher). Usuwane, gdy JS realnie wstawi pasek. */
body { padding-top: 70.5px; }
@media (max-width: 410px) { body { padding-top: 107.25px; } }
html.a11y-loaded body { padding-top: 0; }

.a11y-bar { background: var(--bg-card); border-bottom: 1px solid var(--line); }
.a11y-bar-inner {
  max-width: 980px; margin: 0 auto; padding: 6px 20px; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; font-size: 12.5px;
}
.a11y-bar-label { color: var(--muted); font-weight: 600; }
.a11y-bar-group { display: flex; gap: 4px; }
.a11y-bar button {
  font: inherit; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-weight: 700;
}
.a11y-bar button:hover { background: var(--chip-bg); }
.a11y-bar button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.a11y-bar button.a11y-yellow-btn[aria-pressed="true"] { background: #ffeb00; color: #000; border-color: #ffeb00; }

.a11y-lang-bar { border-top: 1px solid var(--line); }
.a11y-lang-bar .a11y-bar-inner { gap: 16px; padding-top: 5px; padding-bottom: 5px; }
.a11y-lang-bar a { color: var(--accent); text-decoration: none; font-weight: 700; letter-spacing: .2px; }
.a11y-lang-bar a:hover { text-decoration: underline; }
.a11y-lang-current { color: var(--ink); font-weight: 700; letter-spacing: .2px; }

/* Kontrast: czarne tło, biały tekst, wszędzie, niezależnie od kolorów komponentu */
html.a11y-contrast, html.a11y-contrast body { background: #000 !important; color: #fff !important; }
html.a11y-contrast * { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
html.a11y-contrast a, html.a11y-contrast a:visited { color: #ffeb00 !important; text-decoration: underline !important; }
html.a11y-contrast img, html.a11y-contrast svg { filter: grayscale(1) contrast(1.3); }
html.a11y-contrast .a11y-bar button[aria-pressed="true"] { background: #fff !important; color: #000 !important; }

/* Żółty: żółte tło, czarny tekst, wszędzie */
html.a11y-yellow, html.a11y-yellow body { background: #ffeb00 !important; color: #000 !important; }
html.a11y-yellow * { background-color: #ffeb00 !important; color: #000 !important; border-color: #000 !important; }
html.a11y-yellow a, html.a11y-yellow a:visited { color: #000 !important; text-decoration: underline !important; }
html.a11y-yellow img, html.a11y-yellow svg { filter: grayscale(1) contrast(1.2); }
html.a11y-yellow .a11y-bar button[aria-pressed="true"] { background: #000 !important; color: #ffeb00 !important; }
.faq-item { margin-top: 18px; }
.faq-item h3 { font-size: 15.5px; margin: 0 0 6px; }
.faq-item p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Odznaka (/badge) ---------- */

.badge-preview {
  margin: 24px 0; padding: 28px 20px; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 12px; text-align: center;
}
.code-box { position: relative; margin: 14px 0 28px; }
.code-box pre {
  margin: 0; padding: 14px 16px; padding-right: 96px; background: #0b1620; color: #d7e3ea; border-radius: 8px;
  font-size: 12.5px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.code-box .copy-btn {
  position: absolute; top: 8px; right: 8px; font-size: 12px; font-weight: 600; padding: 5px 10px;
  border-radius: 6px; border: none; background: var(--accent); color: #fff; cursor: pointer;
}
.code-box .copy-btn:hover { background: #0c5c56; }
.code-box .copy-btn.copied { background: #166534; }
