/* Mapa Zdrowia – one stylesheet, no frameworks. Layout: CSS grid + flexbox. */
:root {
  --bg: #fff;
  --text: #16232b;
  --muted: #55656f;
  --line: #dfe6ea;
  --soft: #f3f7f6;
  --accent: #0b7a5c;
  --accent-dark: #075c45;
  --accent-soft: #e4f3ee;
  --cat: var(--accent);            /* per-section colour, overridden inline */
  --max: 1200px;
  --measure: 46rem;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(16, 36, 31, .08);
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { max-width: 100%; height: auto; border-radius: var(--radius); }
a { color: var(--accent-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.22; margin: 1.8em 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.7rem); margin-top: .3em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.04rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

.wrap { width: min(100% - 36px, var(--max)); margin-inline: auto; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.meta { color: var(--muted); font-size: .88rem; }
.lead { font-size: 1.16rem; color: var(--muted); max-width: var(--measure); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
.logo { display: inline-flex; flex: none; }
.logo img { border-radius: 0; display: block; }
.search { position: relative; flex: 1 1 auto; max-width: 420px; margin-left: auto; }
.search input { width: 100%; padding: 9px 14px 9px 38px; border: 1px solid var(--line); border-radius: 99px; background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355656f' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.500-3.500'/%3E%3C/svg%3E") no-repeat 12px 50% / 18px; font: inherit; font-size: .95rem; color: var(--text); }
.search input:focus { background-color: #fff; border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; }
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); line-height: 1.35; }
.search-results a:hover, .search-results [aria-selected="true"] a { background: var(--accent-soft); }
.search-results small { display: block; color: var(--muted); font-size: .78rem; }
.search-results .empty { padding: 8px 10px; color: var(--muted); font-size: .9rem; }
.langs ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.langs a { display: block; padding: 2px 8px; border-radius: 6px; text-decoration: none; color: var(--muted); }
.langs a[aria-current] { background: var(--soft); color: var(--accent-dark); font-weight: 700; }
.nav-toggle { display: none; flex: none; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font: inherit; font-size: .9rem; font-weight: 600; color: var(--text); cursor: pointer; }
.nav-toggle span { width: 16px; height: 2px; background: currentColor; box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor; }

.main-nav { border-top: 1px solid var(--line); }
.main-nav ul { display: flex; flex-wrap: wrap; gap: 0 4px; list-style: none; margin-block: 0; padding: 0; }
.main-nav a { display: block; padding: 9px 10px; text-decoration: none; color: var(--text); font-size: .93rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.main-nav a:hover { color: var(--cat); border-color: var(--cat); }
.main-nav a[aria-current] { color: var(--cat); border-color: var(--cat); font-weight: 700; }
.main-nav .featured a { font-weight: 700; color: var(--cat); }

@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0 0 10px; }
  .bar { flex-wrap: wrap; justify-content: space-between; }
  .main-nav { display: none; max-height: calc(100vh - 130px); overflow: auto; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 6px 0 12px; }
  .main-nav a { padding: 10px 4px; border-bottom: 1px solid var(--line); white-space: normal; }
}

/* ---------- Reading progress ---------- */
.progress { position: fixed; top: 0; left: 0; z-index: 60; height: 3px; width: 100%; transform: scaleX(0); transform-origin: 0 50%; background: var(--cat); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 20px 0 0; padding: 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 8px; }
.breadcrumbs a { color: var(--muted); }

/* ---------- Home ---------- */
.hero { margin: 24px 0 8px; padding: clamp(28px, 5vw, 56px); border-radius: calc(var(--radius) * 2); background: linear-gradient(135deg, #e7f5f0 0%, #fdeef3 100%); }
.hero h1 { max-width: 20ch; margin: 0 0 .4em; }
.hero .lead { color: #3d4d57; margin: 0; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn { display: inline-block; padding: 10px 20px; border-radius: 99px; background: var(--cat); color: #fff; font-weight: 700; text-decoration: none; }
.btn:hover { color: #fff; filter: brightness(1.08); }

.featured-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; margin: 28px 0; }
.feature { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-top: 5px solid var(--cat); border-radius: var(--radius); background: #fff; }
.feature h2 { margin: 0 0 4px; }
.feature h2 a { text-decoration: none; color: var(--text); }
.feature > p { margin: 0 0 12px; color: var(--muted); }
.feature ul { display: grid; gap: 2px; list-style: none; margin: 0 0 16px; padding: 0; }
.feature li a { display: block; padding: 7px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; line-height: 1.4; }
.feature li a:hover { color: var(--cat); }
.feature .more { margin-top: auto; font-weight: 700; color: var(--cat); text-decoration: none; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.topic-grid a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 4px solid var(--cat); text-decoration: none; color: var(--text); line-height: 1.35; transition: box-shadow .15s, transform .15s; }
.topic-grid a:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.topic-grid span { font-size: .82rem; color: var(--muted); }
.section-title { margin-top: 2.4em; }
.home-cat { margin-top: 2.6em; padding-top: .2em; border-top: 1px solid var(--line); }
.home-cat h2 { margin-bottom: .2em; }
.home-cat h2 a { text-decoration: none; color: var(--text); }
.home-cat h2 a:hover { color: var(--cat); }
.home-cat > p { color: var(--muted); max-width: var(--measure); margin: 0; }
.more-list { columns: 2 320px; column-gap: 32px; padding-left: 1.1em; font-size: .95rem; }
.more-list li { break-inside: avoid; margin-bottom: .3em; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; margin: 18px 0; }
.card { display: flex; flex-direction: column; position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { border-color: var(--cat); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-img { display: block; width: calc(100% + 40px); max-width: none; margin: -18px -20px 14px; border-radius: var(--radius) var(--radius) 0 0; aspect-ratio: 16 / 9; object-fit: cover; }
.card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.card h3 a { text-decoration: none; color: var(--text); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }   /* whole card is clickable */
.card:hover h3 a { color: var(--cat); }
.card p { margin: 0 0 10px; font-size: .92rem; color: var(--muted); line-height: 1.55; }
.card .meta { margin: auto 0 0; font-size: .8rem; }

.page-head { margin-top: 8px; padding-left: 18px; border-left: 5px solid var(--cat); }

/* ---------- Article ---------- */
.layout { display: grid; gap: 40px; align-items: start; }
@media (min-width: 1040px) { .layout { grid-template-columns: minmax(0, var(--measure)) minmax(260px, 1fr); gap: 56px; } }
.article { min-width: 0; max-width: var(--measure); }
.pill { display: inline-block; margin-right: 8px; padding: 2px 12px; border-radius: 99px; background: color-mix(in srgb, var(--cat) 12%, #fff); color: var(--cat); text-decoration: none; font-weight: 700; }
.cover { margin: 1.2em 0 1.6em; }
.cover img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.cover figcaption { margin-top: 6px; font-size: .78rem; color: var(--muted); text-align: right; }
.content { font-size: 1.07rem; }
.content > p:first-child { font-size: 1.16rem; color: #2b3a43; }
.content p, .content ul, .content ol { margin: 0 0 1.15em; }
.content li { margin-bottom: .4em; }
.content li::marker { color: var(--cat); }
.content h2 { margin-top: 2.2em; padding-top: .8em; border-top: 1px solid var(--line); }
.content h2 + p { font-weight: 500; }
.content .table-wrap { overflow-x: auto; margin: 0 0 1.3em; border: 1px solid var(--line); border-radius: var(--radius); }
.content table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.content th, .content td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.content tr:last-child td { border-bottom: 0; }
.content th { background: var(--soft); font-weight: 700; }
.content blockquote { margin: 1.2em 0; padding: .2em 1em; border-left: 4px solid var(--cat); background: var(--soft); }
.content img { display: block; margin: 0 auto; }

.toc { background: var(--soft); border-radius: var(--radius); padding: 14px 20px; margin: 1.2em 0 1.8em; }
.toc summary { font-weight: 700; cursor: pointer; }
.toc ol { margin: 8px 0 0; padding-left: 1.3em; font-size: .95rem; }
.toc li { margin: .25em 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.faq { margin-top: 2.6em; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin-bottom: 8px; }
.faq details[open] { border-color: var(--cat); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.faq details > div { padding-bottom: 6px; }
.note { margin-top: 2em; padding: 12px 16px; border-radius: var(--radius); background: var(--soft); font-size: .88rem; color: var(--muted); }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 1.5em; }
.prev-next a { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-weight: 600; line-height: 1.35; }
.prev-next a:hover { border-color: var(--cat); }
.prev-next span { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.prev-next [rel=next] { text-align: right; grid-column: 2; }

.sidebar { display: grid; gap: 20px; font-size: .92rem; }
@media (min-width: 1040px) { .sidebar { position: sticky; top: calc(var(--header-h) + 60px); max-height: calc(100vh - var(--header-h) - 80px); overflow: auto; } }
.sidebar nav { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.sidebar h2 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sidebar h2 a { text-decoration: none; color: inherit; }
.sidebar ul, .sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar li { line-height: 1.4; }
.sidebar a, .sidebar span { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); text-decoration: none; color: var(--muted); }
.sidebar a:hover { color: var(--cat); }
.sidebar a.active, .sidebar [aria-current] { border-color: var(--cat); color: var(--text); font-weight: 700; }
.side-toc { display: none; }
@media (min-width: 1040px) { .side-toc { display: block; } .article .toc { display: none; } }

.related, .topics { margin-top: 3em; padding-top: .4em; border-top: 1px solid var(--line); }
.topics ul, .cat-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.topics a, .cat-list a { display: block; padding: 5px 14px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; font-size: .92rem; }
.topics a:hover, .cat-list a:hover { border-color: var(--cat); color: var(--cat); }
.sitemap-cat ul { columns: 2 320px; padding-left: 1.2em; }

.to-top { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 4.5em; background: #10241f; color: #cfe0db; font-size: .9rem; }
.site-footer a { color: #e9f5f1; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 40px; padding-top: 32px; padding-bottom: 12px; }
.site-footer h2 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #8fb3a8; }
.site-footer ul { list-style: none; margin: 0 0 16px; padding: 0; }
.site-footer li { padding: 3px 0; line-height: 1.45; }
.footer-note { border-top: 1px solid #24403a; padding-top: 16px; padding-bottom: 24px; }
.disclaimer { max-width: 860px; margin: 0 0 8px; color: #a9c2bb; }
.copy { margin: 0; color: #8fb3a8; }

@media print {
  .site-header, .site-footer, .sidebar, .related, .topics, .prev-next, .to-top, .progress, .toc { display: none !important; }
  .layout { display: block; }
  a { color: inherit; text-decoration: none; }
}
