/* ============================================================
   Szczepienia - design system "Ochrona i natura"
   Palette: pine green ink + emerald + trust blue + amber + warm cream
   Fonts: Newsreader (display) + Hanken Grotesk (body)
   ============================================================ */

:root {
  /* Light theme */
  --ink: #0c1f17;
  --panel: #ffffff;
  --panel-2: #f6f3ec;
  --paper: #f6f3ec;
  --paper-2: #ffffff;
  --green: #166534;
  --green-bright: #1c7a3f;
  --emerald: #0f766e;
  --blue: #1e5aa8;
  --blue-bright: #2b6fc4;
  --amber: #965a03;
  --amber-bright: #c47f1a;
  --dim: #6b6154;
  --dim-2: #8a8072;
  --border: #e3ddd2;
  --border-strong: #cfc7b8;
  --text: #1c1917;
  --text-body: #292524;
  --header-bg: rgba(246, 243, 236, 0.92);
  --shadow: 0 2px 12px rgba(12, 31, 23, 0.08);
  --shadow-hover: 0 8px 28px rgba(12, 31, 23, 0.14);
  --accent-gradient: linear-gradient(135deg, #166534, #0f766e);
  --header-glow: linear-gradient(90deg, transparent, rgba(22, 101, 52, 0.35), transparent);
  --bg-glow-1: rgba(15, 118, 110, 0.10);
  --bg-glow-2: rgba(161, 98, 7, 0.08);
  --radius: 10px;
  --transition: all .2s ease-out;
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Hanken Grotesk', 'Segoe UI', sans-serif;
  --header-height: 64px;
  --sidebar-width: 300px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0a1712;
    --panel: #10201a;
    --panel-2: #122820;
    --paper: #0c1f17;
    --paper-2: #10251d;
    --green: #3f9d5f;
    --green-bright: #4fb373;
    --emerald: #34b3a8;
    --blue: #6ba3e0;
    --blue-bright: #8bbbef;
    --amber: #d99a2b;
    --amber-bright: #e8b054;
    --dim: #a89f8e;
    --dim-2: #8f8678;
    --border: #1f3529;
    --border-strong: #2c4637;
    --text: #ece6da;
    --text-body: #ddd6c8;
    --header-bg: rgba(10, 23, 18, 0.92);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.5);
    --accent-gradient: linear-gradient(135deg, #3f9d5f, #34b3a8);
    --header-glow: linear-gradient(90deg, transparent, rgba(63, 157, 95, 0.35), transparent);
    --bg-glow-1: rgba(52, 179, 168, 0.08);
    --bg-glow-2: rgba(217, 154, 43, 0.06);
    --border: #1c2f26;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: clip; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 700px 500px at -10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(ellipse 700px 500px at 110% 110%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 2000;
  background: var(--green); color: #fff; padding: 10px 18px;
  border-radius: 6px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px;
  background: var(--header-glow); opacity: .5; pointer-events: none;
}
.header-inner {
  max-width: 1400px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--text); flex-shrink: 0;
}
.brand-shield { width: 34px; height: 34px; color: var(--green); }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  letter-spacing: .01em;
}
.brand-name em { font-style: normal; color: var(--amber-bright); }

.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
#search-input {
  width: 100%; padding: 9px 16px; font-size: .95rem;
  font-family: var(--font-body); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 999px; outline: none;
  transition: var(--transition);
}
#search-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 101, 52, .15); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover);
  max-height: 380px; overflow-y: auto; display: none; z-index: 300;
}
.search-results.open { display: block; }
.search-result {
  display: block; padding: 10px 16px; text-decoration: none;
  border-bottom: 1px solid var(--border); color: var(--text-body);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--panel-2); }
.search-result small { display: block; color: var(--dim); font-size: .78rem; }

.menu-toggle {
  display: none; background: none; border: 1px solid var(--border-strong);
  border-radius: 8px; width: 42px; height: 42px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text); transition: var(--transition); }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Layout ---------- */
.layout {
  display: flex; max-width: 1400px; margin: 0 auto;
  padding-top: var(--header-height); min-height: calc(100vh - var(--header-height));
}
.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 12px 40px; position: sticky; top: var(--header-height);
  height: calc(100vh - var(--header-height)); overflow-y: auto;
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--dim); padding: 0 12px; margin-bottom: 6px;
}
.sidebar-link {
  display: block; font-size: .9rem; line-height: 1.35;
  padding: 6px 12px; border-radius: 6px; text-decoration: none;
  color: var(--text-body); transition: var(--transition);
  border-left: 2px solid transparent;
}
.sidebar-link:hover { background: var(--panel-2); color: var(--green); }
.sidebar-link.active {
  background: rgba(22, 101, 52, .10);
  color: var(--green); border-left-color: var(--green);
  font-weight: 600;
}
.sidebar-overlay { display: none; }

.main-content {
  flex: 1; min-width: 0; padding: 32px 44px 60px;
}

/* ---------- Home ---------- */
.home-hero {
  border-radius: var(--radius);
  background: var(--accent-gradient);
  background-image:
    linear-gradient(135deg, #0c1f17, #14532d 45%, #0f766e),
    radial-gradient(ellipse 400px 300px at 85% 20%, rgba(217, 154, 43, .25), transparent 70%);
  color: #f6f3ec; padding: 44px 44px 40px; margin-bottom: 36px;
  position: relative; overflow: hidden;
}
.home-hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.15;
  margin-bottom: 12px; text-wrap: balance;
}
.home-hero p.lead { font-size: 1.08rem; max-width: 620px; margin-bottom: 20px; color: #d8e6da; }
.home-hero .hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 8px; }
.home-hero .stat strong { display: block; font-family: var(--font-display); font-size: 1.5rem; }
.home-hero .stat span { font-size: .85rem; color: #c3d8ca; }

/* Hero shield signature */
.hero-shield { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); width: 190px; height: 190px; opacity: .9; }
.hero-shield path, .hero-shield circle { fill: none; stroke: rgba(246, 243, 236, .8); stroke-width: 2; }
.hero-shield .ring { transform-origin: center; animation: ringSpin 14s linear infinite; }
@keyframes ringSpin { to { transform: rotate(360deg); } }

.home-section { margin-bottom: 34px; }
.home-section h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 1.45rem;
  color: var(--text); margin-bottom: 4px; text-wrap: balance;
  display: flex; align-items: center; gap: 10px;
}
.home-section h2::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.home-section .section-desc { color: var(--dim); font-size: .92rem; margin-bottom: 14px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.home-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-gradient); opacity: 0; transition: opacity var(--transition);
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.home-card:hover::before { opacity: 1; }
.home-card h3 { font-size: .95rem; font-weight: 600; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.home-card .card-icon { font-size: 1.15rem; }
.home-card p { font-size: .85rem; color: var(--dim); line-height: 1.5; }

/* ---------- Article ---------- */
.article { animation: fadeUp .25s ease-out; max-width: 860px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

.article .breadcrumbs { font-size: .8rem; color: var(--dim); margin-bottom: 14px; }
.article .breadcrumbs a { color: var(--green); text-decoration: none; }
.article .breadcrumbs a:hover { text-decoration: underline; }

.article-header { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.article-section-label {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--green); margin-bottom: 8px;
}
.article h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.18;
  color: var(--text); margin-bottom: 8px; text-wrap: balance;
}
.article .article-excerpt { font-size: 1.05rem; color: var(--dim); }

.toc {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 26px;
}
.toc-title { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: 8px; }
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 4px; }
.toc a {
  color: var(--text-body); text-decoration: none; font-size: .92rem;
  display: inline-flex; gap: 8px;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-size: .75rem; color: var(--amber-bright); font-weight: 600; }
.toc a:hover { color: var(--green); text-decoration: underline; }

.article h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--text); margin: 30px 0 12px;
  text-wrap: balance; scroll-margin-top: calc(var(--header-height) + 16px);
}
.article h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.18rem; color: var(--text); margin: 22px 0 8px;
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.article p { margin-bottom: 14px; }
.article ul, .article ol { margin: 0 0 16px 22px; }
.article li { margin-bottom: 6px; }
.article a { color: var(--green); }
.article strong { color: var(--text); font-weight: 600; }

.info-box, .warning-box, .help-box {
  border-radius: var(--radius); padding: 14px 18px; margin: 18px 0;
  font-size: .95rem; border-left: 4px solid;
}
.info-box { background: rgba(15, 118, 110, .08); border-left-color: var(--emerald); }
.warning-box { background: rgba(161, 98, 7, .10); border-left-color: var(--amber); }
.help-box { background: rgba(30, 90, 168, .08); border-left-color: var(--blue); }
.info-box strong, .warning-box strong, .help-box strong { display: block; margin-bottom: 4px; }

.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius); border: 1px solid var(--border); }
table.compare-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--panel); }
table.compare-table th, table.compare-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.compare-table th { background: var(--panel-2); font-weight: 700; color: var(--text); }
table.compare-table tr:last-child td { border-bottom: none; }
table.compare-table td:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }

.error-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 18px 0; }
.error-table th, .error-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.error-table th { background: var(--panel-2); color: var(--text); }

/* FAQ */
.faq-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; background: var(--panel); }
.faq-item summary {
  cursor: pointer; padding: 13px 16px; font-weight: 600; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; font-size: 1.3rem; color: var(--green); font-weight: 400; transition: var(--transition); flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 16px 14px; color: var(--text-body); }

/* Glossary */
.glossary { margin: 18px 0; }
.glossary dt { font-weight: 700; color: var(--text); margin-top: 14px; }
.glossary dd { margin: 2px 0 0 0; color: var(--text-body); font-size: .95rem; }

/* Steps checklist */
ol.steps { list-style: none; counter-reset: step; margin: 18px 0; }
ol.steps li {
  counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 12px;
}
ol.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px;
  background: var(--accent-gradient); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}

.key-takeaways {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 16px 20px; margin: 18px 0;
  border-left: 4px solid var(--green);
}
.key-takeaways strong { color: var(--text); display: block; margin-bottom: 6px; }
.key-takeaways ul { margin: 0 0 0 20px; }
.key-takeaways li { margin-bottom: 4px; }

.related-articles { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }
.related-articles h3 { font-size: 1rem; margin-bottom: 10px; }
.related-list { display: flex; flex-wrap: wrap; gap: 10px; }
.related-list a {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; font-size: .85rem;
  color: var(--green); text-decoration: none; transition: var(--transition);
}
.related-list a:hover { border-color: var(--green); background: rgba(22, 101, 52, .08); }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border); background: var(--panel-2);
  padding: 28px 20px 40px; margin-top: 40px;
}
.footer-inner { max-width: 1400px; margin: 0 auto; }
.footer-brand { font-family: var(--font-display); font-weight: 700; color: var(--text); margin-bottom: 6px; }
.footer-brand em { font-style: normal; color: var(--amber-bright); }
.footer-note { font-size: .85rem; color: var(--dim); max-width: 720px; margin-bottom: 10px; }
.footer-bottom { font-size: .78rem; color: var(--dim-2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0;
    width: 300px; z-index: 150; background: var(--paper);
    transform: translateX(-100%); transition: transform .25s ease-out;
    box-shadow: 2px 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: var(--header-height) 0 0 0;
    background: rgba(12, 31, 23, .5); z-index: 140; opacity: 0;
    pointer-events: none; transition: opacity .25s;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: flex; }
  .main-content { padding: 24px 20px 50px; }
  .search-wrap { max-width: none; }
  .hero-shield { display: none; }
}
@media (max-width: 600px) {
  .home-hero { padding: 32px 24px; }
  .home-hero .hero-stats { gap: 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
