/* ============================================================
   Zdrowie na co dzień - design system
   Paleta: świeża zieleń + błękit + krem (zdrowie, natura, zaufanie)
   Typografia: Spectral (display) + Figtree (body)
   ============================================================ */

:root {
  /* Paleta zdrowie */
  --accent: #1e7a4f;          /* świeża zieleń - CTA, zaufanie */
  --accent-strong: #16603c;
  --accent-light: #e3f0e8;
  --accent-2: #2b7fa0;        /* czysty błękit - spokój, medycyna */
  --accent-2-light: #e3eef4;
  --amber: #b45309;           /* ostrzeżenia */
  --amber-light: #fdf3e3;
  --red: #b3261e;             /* błędy */
  --red-light: #fdecea;

  /* Tła i tekst (light) */
  --bg: #f6f4ec;              /* ciepły krem */
  --bg-card: #ffffff;
  --bg-sidebar: #fbfaf5;
  --text: #1c2b24;
  --text-muted: #55635b;
  --border: #e2ddd0;
  --border-strong: #cfc8b6;

  /* Typografia */
  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'Figtree', 'Segoe UI', sans-serif;

  /* Layout */
  --header-h: 64px;
  --sidebar-w: 290px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(28, 43, 36, 0.05), 0 4px 16px rgba(28, 43, 36, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(28, 43, 36, 0.06), 0 10px 28px rgba(28, 43, 36, 0.12);

  --body-font-size: 17px;
  --content-max: 780px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #3cb079;
    --accent-strong: #4ec98a;
    --accent-light: #143325;
    --accent-2: #58b4d8;
    --accent-2-light: #122a36;
    --amber: #e8a24a;
    --amber-light: #33270f;
    --red: #e06a63;
    --red-light: #3a1a18;

    --bg: #0d1410;
    --bg-card: #141d17;
    --bg-sidebar: #101812;
    --text: #e8f0ea;
    --text-muted: #a8b8ae;
    --border: #243228;
    --border-strong: #33453a;

    --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.25);
    --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.3), 0 10px 28px rgba(0,0,0,0.4);
  }
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--body-font-size);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 700px 420px at 92% -4%, var(--accent-light) 0%, transparent 60%),
    radial-gradient(ellipse 600px 380px at -6% 104%, var(--accent-2-light) 0%, transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-light); }

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 300;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600; transition: top .2s ease-out;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* ============ Header ============ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .3;
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 100%; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; }
.brand-text {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  color: var(--text); letter-spacing: -0.01em;
}
.brand-text em { font-style: normal; color: var(--accent-strong); }

.header-search { position: relative; flex: 1; max-width: 480px; margin-left: auto; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
#search-input {
  width: 100%; padding: 10px 14px 10px 36px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: .95rem;
  transition: border-color .2s ease-out, box-shadow .2s ease-out;
}
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 250;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card-hover);
  max-height: 380px; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.search-result-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--accent-light); text-decoration: none; }
.search-result-item .sr-title { font-weight: 600; font-size: .92rem; display: block; }
.search-result-item .sr-section { font-size: .78rem; color: var(--text-muted); }
.search-empty { padding: 12px 14px; color: var(--text-muted); font-size: .9rem; }

.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; cursor: pointer;
}
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s ease-out, opacity .2s ease-out; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Layout ============ */
.layout { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; gap: 32px; }
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0;
  width: var(--sidebar-w); padding: 24px 20px 40px;
  overflow-y: auto; background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-nav { flex: 1; }
.sidebar-section-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-strong); margin: 22px 0 6px; padding: 0 10px;
}
.sidebar-section-title:first-child { margin-top: 0; }
.sidebar-link {
  display: block; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: .9rem; line-height: 1.4; color: var(--text);
  border-left: 3px solid transparent;
  transition: background .15s ease-out, color .15s ease-out, border-color .15s ease-out;
}
.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-foot { margin-top: 24px; padding: 12px; background: var(--accent-2-light); border-radius: var(--radius-sm); }
.sidebar-note { margin: 0; font-size: .75rem; color: var(--text-muted); line-height: 1.5; }
.sidebar-overlay { display: none; }

.main {
  flex: 1; min-width: 0;
  margin-left: calc(var(--sidebar-w) + 32px);
  padding: calc(var(--header-h) + 28px) 12px 60px;
}
.app-content { max-width: var(--content-max); margin: 0 auto; }

/* ============ Home ============ */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1e7a4f 0%, #16603c 55%, #14452f 100%);
  border-radius: var(--radius); color: #fff;
  padding: 44px 40px 40px; margin-bottom: 36px;
  box-shadow: var(--shadow-card-hover);
}
.home-hero::before {
  content: ''; position: absolute; inset: 0; opacity: .14;
  background-image: radial-gradient(#fff 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  pointer-events: none;
}
.home-hero::after {
  content: ''; position: absolute; bottom: -70px; right: -50px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  padding: 6px 14px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; letter-spacing: .04em;
  margin-bottom: 18px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #9fe3bd; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.home-hero h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 700; line-height: 1.15; margin: 0 0 14px;
  text-wrap: balance; letter-spacing: -0.01em;
}
.home-hero p.hero-lead { font-size: 1.08rem; line-height: 1.6; margin: 0 0 24px; max-width: 560px; opacity: .94; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.hero-stat span { font-size: .8rem; opacity: .85; }

.home-section { margin-bottom: 34px; }
.home-section-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2px solid var(--border); padding-bottom: 8px; margin-bottom: 16px;
}
.home-section-head h2 {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 600;
  margin: 0; text-wrap: balance;
}
.home-section-head .count { font-size: .78rem; color: var(--text-muted); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.home-card {
  position: relative; display: block;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 16px 14px;
  box-shadow: var(--shadow-card);
  transition: transform .2s ease-out, box-shadow .2s ease-out, border-color .2s ease-out;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--accent); text-decoration: none; }
.home-card .card-icon { font-size: 1.4rem; display: block; margin-bottom: 8px; }
.home-card h3 { font-size: .9rem; font-weight: 600; margin: 0 0 6px; color: var(--text); line-height: 1.35; text-wrap: balance; }
.home-card p { font-size: .85rem; color: var(--text-muted); margin: 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ Artykuł ============ */
.article { animation: fadeUp .28s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.article-header { margin-bottom: 22px; }
.article-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.article-section-tag {
  display: inline-block; background: var(--accent-light); color: var(--accent-strong);
  font-size: .75rem; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  letter-spacing: .03em;
}
.badge-trust {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--accent); color: var(--accent-strong);
  font-size: .75rem; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-card);
}
.badge-trust svg { flex-shrink: 0; }
.article h1 {
  font-family: var(--font-display); font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  font-weight: 700; line-height: 1.18; margin: 0 0 10px;
  text-wrap: balance; letter-spacing: -0.01em;
}
.article-excerpt { font-size: 1.05rem; color: var(--text-muted); line-height: 1.6; margin: 0; }

/* TOC */
.article-toc {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
  padding: 16px 20px; margin: 20px 0 28px;
}
.article-toc summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.article-toc ol { margin: 10px 0 0; padding-left: 20px; }
.article-toc li { margin: 4px 0; font-size: .88rem; }
.article-toc a { color: var(--text); }
.article-toc a:hover { color: var(--accent-strong); }

/* Treść */
.article-body h2 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  margin: 38px 0 14px; padding-top: 8px; text-wrap: balance;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
  margin: 26px 0 10px; text-wrap: balance;
}
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 24px; }
.article-body li { margin: 6px 0; }
.article-body strong { font-weight: 600; }

/* Boxy */
.info-box, .warning-box {
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 20px 0;
  font-size: .95rem; line-height: 1.6;
}
.info-box { background: var(--accent-light); border-left: 4px solid var(--accent); }
.warning-box { background: var(--amber-light); border-left: 4px solid var(--amber); }
.info-box strong, .warning-box strong { display: block; margin-bottom: 4px; }
.info-box p, .warning-box p { margin: 0 0 8px; }
.info-box p:last-child, .warning-box p:last-child { margin-bottom: 0; }

/* Tabele */
.table-responsive { overflow-x: auto; margin: 20px 0; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table-responsive table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--bg-card); }
.table-responsive th {
  background: var(--accent); color: #fff; text-align: left;
  padding: 10px 14px; font-weight: 600; white-space: nowrap;
}
.table-responsive td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.table-responsive tr:nth-child(even) td { background: rgba(0,0,0,.02); }
@media (prefers-color-scheme: dark) { .table-responsive tr:nth-child(even) td { background: rgba(255,255,255,.03); } }
.table-responsive .yes { color: var(--accent-strong); font-weight: 600; }
.table-responsive .no { color: var(--red); font-weight: 600; }

/* FAQ */
.faq-list { margin: 20px 0; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); margin-bottom: 10px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: .98rem;
  list-style: none; position: relative; padding-right: 44px;
  transition: background .15s ease-out;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--accent-light); }
.faq-item summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 1.3rem; color: var(--accent); font-weight: 400; transition: transform .2s ease-out;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item .faq-a { padding: 0 18px 14px; font-size: .95rem; line-height: 1.65; }
.faq-item .faq-a p { margin: 0 0 10px; }
.faq-item .faq-a p:last-child { margin-bottom: 0; }

/* Słownik */
.glossary { margin: 20px 0; }
.glossary dt {
  font-weight: 600; font-size: 1rem; margin: 18px 0 4px;
  display: flex; align-items: baseline; gap: 8px;
}
.glossary dt::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; transform: translateY(-2px); }
.glossary dd { margin: 0 0 6px 15px; font-size: .95rem; color: var(--text-muted); line-height: 1.6; }

/* Notka edukacyjna */
.medical-note {
  margin-top: 32px; padding: 14px 18px;
  background: var(--accent-2-light); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text-muted); line-height: 1.55;
}

/* Reklama */
.ad-slot {
  margin: 28px 0; padding: 22px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .8rem;
  background: var(--bg-card);
}

/* Breadcrumbs / nawigacja między artykułami */
.article-nav {
  display: flex; justify-content: space-between; gap: 14px;
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: .88rem;
}
.article-nav a { color: var(--text-muted); }
.article-nav a:hover { color: var(--accent-strong); }
.article-nav .next { text-align: right; }

/* ============ Footer ============ */
.app-footer {
  border-top: 1px solid var(--border); background: var(--bg-card);
  margin-top: 20px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 32px 20px; }
.footer-inner p { margin: 0 0 8px; font-size: .9rem; }
.footer-note { color: var(--text-muted); font-size: .8rem !important; max-width: 720px; }
.footer-copy { color: var(--text-muted); font-size: .78rem !important; margin-top: 14px !important; }

/* ============ Responsywność ============ */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .header-inner { gap: 12px; }
  .header-search { max-width: none; }
  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease-out;
    z-index: 210; width: min(320px, 86vw);
    box-shadow: 4px 0 30px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 205;
    background: rgba(0,0,0,.4); opacity: 0; pointer-events: none;
    transition: opacity .25s ease-out;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding-top: calc(var(--header-h) + 20px); }
  .layout { padding: 0 14px; }
}
@media (max-width: 600px) {
  .brand-text { font-size: 1.1rem; }
  .home-hero { padding: 32px 22px; }
  .home-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-card h3 { font-size: .88rem; }
  .hero-stats { gap: 18px; }
  #search-input { padding-left: 34px; font-size: .9rem; }
}
@media (max-width: 420px) {
  .home-grid { grid-template-columns: 1fr; }
}

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