/* ============================================================
   Alergia - design system "Świeże powietrze"
   Paleta dopasowana do tematu (alergie, astma, drogi oddechowe):
   - świeża zieleń: natura, zdrowie, ulga, zaufanie medyczne
   - błękit nieba: powietrze, oddech, czystość, spokój
   - złoto pyłku: słońce, wiosna, energia (akcenty CTA)
   - czysta biel z zielonym odcieniem: higiena, "świeżo po deszczu"
   - głęboki teal-slate: tekst (kontrast >= 7:1)
   Typografia: Newsreader (display) + Sora (body)
   ============================================================ */

:root {
  --accent: #0f7b5f;
  --accent-strong: #0b6249;
  --accent-light: #e3f2ec;
  --accent-subtle: #c6e4d6;
  --sky: #2f7fb5;
  --sky-light: #e7f1f8;
  --pollen: #d9822b;
  --pollen-ink: #9a4a08;
  --pollen-light: #fdf1e2;
  --bg: #f7f9f6;
  --bg-alt: #eef2ec;
  --surface: #ffffff;
  --text: #15282b;
  --muted: #52645f;
  --border: #dde6e0;
  --header-bg: rgba(247, 249, 246, 0.92);
  --shadow-card: 0 1px 2px rgba(21, 40, 43, 0.05), 0 4px 16px rgba(21, 40, 43, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(21, 40, 43, 0.07), 0 10px 28px rgba(15, 123, 95, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --header-height: 64px;
  --sidebar-width: 272px;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --transition: all 0.2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #3fbf96;
    --accent-strong: #55d1a8;
    --accent-light: #123028;
    --accent-subtle: #1b4437;
    --sky: #5ea8d9;
    --sky-light: #16283a;
    --pollen: #eaa04d;
    --pollen-ink: #eaa04d;
    --pollen-light: #2e2313;
    --bg: #0c1412;
    --bg-alt: #101a17;
    --surface: #15211d;
    --text: #e6ece8;
    --muted: #9db0a9;
    --border: #24362f;
    --header-bg: rgba(12, 20, 18, 0.92);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(63, 191, 150, 0.16);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60vw 40vh at -10% -5%, var(--accent-light) 0%, transparent 60%),
    radial-gradient(ellipse 50vw 35vh at 110% 105%, var(--sky-light) 0%, transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-subtle), transparent);
  opacity: 0.5;
  pointer-events: none;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; color: var(--accent-strong); }
.brand-mark {
  display: inline-flex;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 123, 95, 0.3);
}
.brand-mark svg { width: 20px; height: 20px; }

.search-box { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--muted);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 9px 14px 9px 36px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: var(--transition);
}
#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover);
  max-height: 380px;
  overflow-y: auto;
  z-index: 200;
}
.search-results a {
  display: block;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--accent-light); text-decoration: none; }
.search-results .sr-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 14px 2px; }
.search-empty { padding: 12px 14px; font-size: 0.88rem; color: var(--muted); }

.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 2px;
  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 {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 24px) 20px 60px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.nav-section { margin-bottom: 14px; }
.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 6px 12px 4px;
}
.sidebar-link {
  display: block;
  padding: 6px 12px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text);
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--accent-light); text-decoration: none; color: var(--accent-strong); }
.sidebar-link.active {
  background: var(--accent-light);
  border-left-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
}

/* ---------- Main / Article ---------- */
.main { min-width: 0; }

.page-enter { animation: fadeUp 0.28s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-header { margin-bottom: 28px; }
.article-header .breadcrumbs {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.article-header .breadcrumbs a { color: var(--accent-strong); }
.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
  color: var(--text);
  margin-bottom: 12px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-light);
  border: 1px solid var(--accent-subtle);
  border-radius: 999px;
}
.trust-badge svg { width: 14px; height: 14px; }

.content-article { font-size: 17px; line-height: 1.7; }
.content-article h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  margin: 40px 0 14px;
  padding-top: 8px;
  text-wrap: balance;
  color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.content-article h3 {
  font-size: 1.18rem;
  font-weight: 700;
  margin: 28px 0 10px;
  text-wrap: balance;
  color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.content-article p { margin: 0 0 16px; }
.content-article ul, .content-article ol { margin: 0 0 18px; padding-left: 24px; }
.content-article li { margin-bottom: 8px; }
.content-article li::marker { color: var(--accent); }
.content-article strong { color: var(--text); }
.content-article a { text-decoration: underline; text-underline-offset: 2px; }

/* TOC */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 8px 0 28px;
  font-size: 0.92rem;
}
.toc-title {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc ol { list-style: none; padding-left: 0; margin: 0; counter-reset: toc; }
.toc li { margin-bottom: 6px; counter-increment: toc; }
.toc li::before {
  content: counter(toc) ".";
  color: var(--accent);
  font-weight: 600;
  margin-right: 8px;
}
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent-strong); text-decoration: underline; }

/* Info box */
.info-box {
  background: var(--accent-light);
  border: 1px solid var(--accent-subtle);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 0.95rem;
}
.info-box strong { color: var(--accent-strong); }

.warning-box {
  background: var(--pollen-light);
  border: 1px solid #eecfa0;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 0.95rem;
}
.warning-box strong { color: var(--pollen-ink); }
@media (prefers-color-scheme: dark) {
  .warning-box { border-color: #4a3a1c; }
}

/* Key takeaways ("W skrócie") */
.takeaways {
  background: var(--sky-light);
  border: 1px solid var(--accent-subtle);
  border-left: 3px solid var(--sky);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 8px 0 24px;
  font-size: 0.95rem;
}
.takeaways-title {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sky);
  margin-bottom: 10px;
}
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin-bottom: 6px; }
.takeaways li::marker { color: var(--sky); }

/* Tables */
.table-responsive { overflow-x: auto; margin: 20px 0; }
.error-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.error-table th {
  background: var(--accent);
  color: #fff;
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 0.88rem;
}
.error-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.error-table tr:nth-child(even) td { background: var(--bg-alt); }

/* FAQ */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 12px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  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;
  font-weight: 400;
  color: var(--accent);
  transition: var(--transition);
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { margin-top: 12px; font-size: 0.95rem; }

/* Glossary */
.glossary dl { margin: 0; }
.glossary dt {
  font-weight: 700;
  color: var(--accent-strong);
  margin-top: 18px;
}
.glossary dd { margin: 4px 0 0 0; font-size: 0.95rem; }

/* Compare table checkmarks */
.yes { color: var(--accent-strong); font-weight: 700; }
.no { color: #b3261e; font-weight: 700; }

/* Article nav (prev/next) */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.article-nav a {
  display: inline-block;
  max-width: 48%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: var(--transition);
}
.article-nav a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
  transform: translateY(-2px);
}
.article-nav .nav-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 2px; }

/* ---------- Home ---------- */
.home-hero {
  position: relative;
  background:
    radial-gradient(ellipse 70% 100% at 85% 0%, rgba(217, 130, 43, 0.16), transparent 55%),
    linear-gradient(135deg, var(--accent-strong), var(--accent) 55%, var(--sky));
  border-radius: var(--radius);
  padding: 44px 40px;
  margin-bottom: 40px;
  color: #fff;
  overflow: hidden;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.35;
  pointer-events: none;
}
.home-hero h1 {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.6vw, 3.2rem);
  font-weight: 700;
  line-height: 1.12;
  text-wrap: balance;
  max-width: 640px;
  margin-bottom: 14px;
}
.home-hero p {
  position: relative;
  font-size: 1.08rem;
  opacity: 0.94;
  max-width: 560px;
  margin-bottom: 24px;
}
.hero-cta {
  display: inline-block;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: var(--transition);
  text-decoration: none;
}
.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
  text-decoration: none;
}
.hero-stats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.hero-stat .num {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
}
.hero-stat .lbl { font-size: 0.78rem; opacity: 0.85; }

/* Signature: mniszek lekarski (dandelion) z odlatującymi pyłkami */
.hero-dandelion {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  height: 240px;
  opacity: 0.9;
  pointer-events: none;
}
.hero-dandelion svg { width: 100%; height: 100%; }
.hero-dandelion .stem { stroke: rgba(255, 255, 255, 0.75); }
.hero-dandelion .head { fill: rgba(255, 255, 255, 0.92); }
.dand-seed {
  animation: seedDrift 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.dand-seed.s1 { animation-delay: 0s; }
.dand-seed.s2 { animation-delay: 1.4s; }
.dand-seed.s3 { animation-delay: 2.8s; }
.dand-seed.s4 { animation-delay: 4.2s; }
.dand-seed.s5 { animation-delay: 5.6s; }
@keyframes seedDrift {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate(46px, -88px) rotate(160deg); opacity: 0; }
}
@media (max-width: 900px) {
  .hero-dandelion { width: 150px; height: 150px; right: 12px; opacity: 0.55; }
  .home-hero h1 { max-width: 100%; }
}
@media (max-width: 600px) {
  .hero-dandelion { display: none; }
}

.home-section { margin-bottom: 44px; }
.home-section h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  text-wrap: balance;
}
.section-line {
  width: 52px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--sky), var(--pollen));
  border-radius: 2px;
  margin: 8px 0 18px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}
.home-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  overflow: hidden;
}
.home-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--sky), var(--pollen));
  opacity: 0;
  transition: var(--transition);
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
  border-color: var(--accent-subtle);
}
.home-card:hover::before { opacity: 1; }
.home-card .card-icon { font-size: 1.5rem; line-height: 1; margin-bottom: 8px; display: block; }
.home-card h3 {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 6px;
  text-wrap: balance;
}
.home-card p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 36px;
  font-size: 0.88rem;
  color: var(--muted);
}
.footer-inner p { margin-bottom: 8px; }
.footer-note { font-size: 0.8rem; }
.footer-links a { color: var(--accent-strong); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: calc(var(--header-height) + 16px);
  }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0; bottom: 0;
    width: 300px;
    max-height: none;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 16px;
    transform: translateX(-105%);
    transition: transform 0.25s ease-out;
    z-index: 95;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .search-box { max-width: none; }
  .brand-text { font-size: 1.3rem; }
  .home-hero { padding: 32px 24px; }
}
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .header-inner { gap: 12px; padding: 0 14px; }
  .search-box { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
}

/* ---------- Motion: reduced ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 300;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
