/* BIP – strona publiczna. Kolory spełniają kontrast WCAG 2.1 AA. */
:root {
  --red: #b0102a;
  --red-dark: #8a0c21;
  --ink: #1d1d1f;
  --muted: #555b61;
  --line: #d8dbe0;
  --bg: #ffffff;
  --bg-soft: #f4f5f7;
  --link: #0b4fa3;
  --focus: #ffbf00;
  --radius: 6px;
}
html { font-size: 100%; }
html[data-font="1"] { font-size: 115%; }
html[data-font="2"] { font-size: 132%; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* linki pomijania */
.skip-links { list-style: none; margin: 0; padding: 0; }
.skip-links a { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ink); color: #fff; padding: .6rem 1rem; }
.skip-links a:focus { left: 8px; top: 8px; }

/* pasek górny */
.topbar { background: var(--bg-soft); border-bottom: 1px solid var(--line); font-size: .875rem; }
.topbar-inner { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: center; padding-top: .35rem; padding-bottom: .35rem; }
.toplinks { display: flex; flex-wrap: wrap; gap: 1rem; }
.a11y-tools { display: flex; gap: .3rem; }
.a11y-tools button {
  font: inherit; font-size: .8rem; padding: .2rem .55rem; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 4px; cursor: pointer;
}
.a11y-tools button[data-font="1"] { font-size: .9rem; }
.a11y-tools button[data-font="2"] { font-size: 1rem; }
.a11y-tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* nagłówek */
.site-header { border-bottom: 4px solid var(--red); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }
.bip-logo img { display: block; width: 120px; height: auto; }
.entity { flex: 1 1 280px; }
.entity-name { font-size: 1.4rem; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.2; }
.entity-name:hover { color: var(--red); }
.entity-sub { color: var(--muted); font-size: .9rem; }
.search { display: flex; flex: 0 1 340px; }
.search input { flex: 1; min-width: 0; font: inherit; padding: .5rem .7rem; border: 2px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.search button, .search-adv button, .print-btn {
  font: inherit; font-weight: 600; padding: .5rem 1rem; border: 0; background: var(--red); color: #fff; cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.search button:hover, .search-adv button:hover { background: var(--red-dark); }

/* układ */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 2rem; padding-top: 1.5rem; padding-bottom: 2.5rem; }
.sidebar nav + nav { margin-top: 1.5rem; }
.nav-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .4rem; }
.menu, .menu ul { list-style: none; margin: 0; padding: 0; }
.menu ul { padding-left: .9rem; border-left: 2px solid var(--line); margin: .15rem 0 .3rem .6rem; }
.menu a { display: block; padding: .38rem .6rem; text-decoration: none; color: var(--ink); border-radius: 4px; }
.menu a:hover { background: var(--bg-soft); color: var(--red); }
.menu a.active { background: var(--red); color: #fff; font-weight: 600; }
.menu > li { border-bottom: 1px solid var(--line); }
.menu > li:last-child { border-bottom: 0; }
.content:focus { outline: none; }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0 0 1rem; font-size: .875rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 .35rem; }

/* treści */
.article-body { overflow-wrap: anywhere; }
.article-body table, .table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; }
.article-body th, .article-body td, .table th, .table td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.article-body th, .table th { background: var(--bg-soft); }
.article-body caption { text-align: left; font-weight: 600; padding-bottom: .3rem; }
.article-body blockquote { margin: 1rem 0; padding: .5rem 1rem; border-left: 4px solid var(--line); color: var(--muted); }
.table-wrap { overflow-x: auto; }

.entity-card { background: var(--bg-soft); border-radius: var(--radius); padding: 1rem 1.25rem; }
.entity-card h2 { margin-top: 0; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.25rem; margin: 0; }
.dl-grid dt { font-weight: 600; color: var(--muted); }
.dl-grid dd { margin: 0; }

.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.article-list h3 { margin: 0 0 .2rem; font-size: 1.08rem; }
.article-list p { margin: .2rem 0; }
.meta { font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-size: .75rem; padding: 0 .4rem; border-radius: 3px; background: var(--muted); color: #fff; }
.subcats ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.subcats a { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.subcats a:hover { border-color: var(--red); }

.notice { background: #fff6dc; border-left: 4px solid #c48b00; padding: .6rem .9rem; }

.attachments ul { list-style: none; padding: 0; }
.attachments li { padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.ext { display: inline-block; min-width: 3.2em; text-align: center; font-size: .7rem; font-weight: 700; background: var(--red); color: #fff; border-radius: 3px; padding: .1rem .3rem; margin-right: .3rem; }

.metryczka { margin-top: 2rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1.25rem; background: var(--bg-soft); font-size: .9rem; }
.metryczka h2 { font-size: 1rem; margin: .2rem 0 .6rem; }
.metryczka dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0; }
.metryczka dt { color: var(--muted); }
.metryczka dd { margin: 0; font-weight: 600; }

.editors { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.editors li { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }

.tools { margin-top: 1rem; }
.search-adv { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.search-adv input[type=search] { font: inherit; padding: .45rem .6rem; border: 2px solid var(--line); border-radius: var(--radius); min-width: 0; flex: 1 1 220px; }
.search-adv button { border-radius: var(--radius); }
.search-adv .inline { font-size: .9rem; }

.pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; }
.pagination a, .pagination span { display: inline-block; min-width: 2.2rem; text-align: center; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.pagination span[aria-current] { background: var(--red); color: #fff; border-color: var(--red); }

/* stopka */
.site-footer { background: #24262b; color: #e8e9eb; padding: 1.5rem 0; font-size: .9rem; }
.site-footer a { color: #fff; }
.site-footer h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: #c3c6cc; margin: 0 0 .4rem; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }

/* wysoki kontrast */
html.contrast body, html.contrast .topbar, html.contrast .entity-card, html.contrast .metryczka,
html.contrast .site-footer, html.contrast .article-body th, html.contrast .table th { background: #000 !important; color: #fff !important; }
html.contrast a, html.contrast .entity-name, html.contrast .menu a { color: #ffff00 !important; }
html.contrast .menu a.active, html.contrast .pagination span[aria-current] { background: #ffff00 !important; color: #000 !important; }
html.contrast .muted, html.contrast .meta, html.contrast .metryczka dt, html.contrast .dl-grid dt, html.contrast .entity-sub { color: #fff !important; }
html.contrast .search button, html.contrast .search-adv button, html.contrast .ext { background: #ffff00; color: #000; }
html.contrast .notice { background: #000; color: #fff; border-color: #ffff00; }
html.contrast .a11y-tools button { background: #000; color: #ffff00; border-color: #ffff00; }

/* urządzenia mobilne */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 1rem; }
  .sidebar { order: 0; }
  .search { flex: 1 1 100%; }
  .dl-grid, .metryczka dl { grid-template-columns: 1fr; }
  .dl-grid dd, .metryczka dd { margin-bottom: .35rem; }
}

/* wydruk – treści nie są blokowane przed drukowaniem (§ 7 ust. 2 pkt 2) */
.print-head { display: flex; gap: 1rem; align-items: center; border-bottom: 2px solid #000; padding: 1rem 0; margin: 0 16px 1rem; }
.print-version .content { padding: 0 16px 2rem; max-width: 900px; }
.print-btn { position: fixed; top: 1rem; right: 1rem; border-radius: var(--radius); }
.print-foot { font-size: .8rem; color: #555; border-top: 1px solid #999; padding-top: .5rem; margin-top: 2rem; }
@media print {
  .topbar, .skip-links, .sidebar, .search, .site-footer, .breadcrumbs, .no-print, .tools { display: none !important; }
  .layout { display: block; padding: 0; }
  body { font-size: 11pt; color: #000; }
  a { color: #000; }
  .article-body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; }
  .metryczka { break-inside: avoid; background: none; }
}
