/* ============================================================
   SENIORPROSTO - "Błękit zaufania i srebro mądrości" design system
   Palette: teal trust + deep navy + warm cream + coral CTA
   Typography: Source Serif 4 (display) + Atkinson Hyperlegible (body)
   ============================================================ */

:root {
  --bg: #f6f4ef;
  --bg-alt: #edeae1;
  --panel: #ffffff;
  --text: #1f2a33;
  --muted: #54636e;
  --accent: #0f766e;
  --accent-hi: #0b5f59;
  --blue: #1e5f8a;
  --coral: #bf4626;
  --coral-hi: #a83d1f;
  --amber: #b0761f;
  --red: #b3261e;
  --border: #ddd7ca;
  --border-strong: #c9c2b2;
  --header-bg: #0f1a1e;
  --header-text: #e8eeea;
  --header-dim: #9db0b4;
  --sidebar-bg: #f1eee6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(31,42,51,.08), 0 4px 14px rgba(31,42,51,.05);
  --shadow-hover: 0 6px 22px rgba(31,42,51,.12);
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', sans-serif;
  --header-height: 60px;
  --sidebar-w: 300px;
  --transition: .2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a1e;
    --bg-alt: #101d22;
    --panel: #142329;
    --text: #e2e8e6;
    --muted: #93a5ad;
    --accent: #2dd4bf;
    --accent-hi: #5eead4;
    --blue: #7fb2e2;
    --coral: #f2a08a;
    --coral-hi: #f6b6a4;
    --amber: #e0b34a;
    --red: #f88379;
    --border: #26383d;
    --border-strong: #33494f;
    --header-bg: #0a1316;
    --header-text: #e8eeea;
    --header-dim: #9db0b4;
    --sidebar-bg: #0e1a1e;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    --shadow-hover: 0 6px 22px rgba(0,0,0,.5);
  }
}

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

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

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  text-wrap: pretty;
}

/* ============ HEADER ============ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45,212,191,.35), transparent);
  opacity: .3; pointer-events: none;
}
.header .inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 18px; padding: 0 20px;
}
.mark {
  color: var(--header-text); text-decoration: none; font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap;
}
.mark b { color: #2dd4bf; font-weight: 800; }
.mark small { display: block; font-family: var(--font-body); font-size: .7rem; font-weight: 400; color: var(--header-dim); letter-spacing: .08em; text-transform: uppercase; margin-top: -2px; }
.searchbox {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px; padding: 7px 14px; width: min(340px, 40vw); color: var(--header-dim);
}
.searchbox input {
  background: transparent; border: 0; outline: 0; color: var(--header-text);
  font-family: var(--font-body); font-size: .92rem; width: 100%;
}
.searchbox input::placeholder { color: var(--header-dim); }
.searchbox:focus-within { border-color: rgba(45,212,191,.5); }

.burger { display: none; background: none; border: 0; cursor: pointer; padding: 8px; margin-left: auto; }
.burger span { display: block; width: 22px; height: 2px; background: var(--header-text); margin: 5px 0; transition: var(--transition); }
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ LAYOUT ============ */
.page-wrap { display: flex; max-width: 1280px; margin: 0 auto; padding-top: var(--header-height); }

.sidebar {
  position: fixed; top: var(--header-height); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 22px 14px 60px; background: var(--sidebar-bg);
  border-right: 1px solid var(--border); z-index: 90;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.main-inner { max-width: 860px; margin: 0 auto; padding: 34px 32px 90px; }

/* ============ SIDEBAR LINKS ============ */
.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--text); text-decoration: none; font-size: .9rem; line-height: 1.35;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link .ic { flex: 0 0 auto; font-size: .95rem; opacity: .8; }
.sidebar-link:hover { background: var(--bg-alt); color: var(--accent-hi); }
.sidebar-link.active { background: var(--accent); color: #fff; font-weight: 700; }
.sidebar-link.active .ic { opacity: 1; }
.sidebar-sec {
  font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 20px 10px 6px;
  display: flex; align-items: center; gap: 6px;
}
.sidebar-sec .n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px;
  background: var(--accent); color: #fff; font-size: .65rem;
}

/* ============ HOME HERO ============ */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f1a1e 0%, #12333a 55%, #0f766e 130%);
  border-radius: 16px; padding: 42px 40px 38px; margin-bottom: 40px;
  color: #eef4f1;
}
.home-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(45,212,191,.22), transparent 60%),
    radial-gradient(500px 260px at -10% 110%, rgba(242,160,138,.14), transparent 60%);
}
.home-hero .label {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: #7fd9cc; font-weight: 700; margin-bottom: 12px;
}
.home-hero h1 {
  font-family: var(--font-display); font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  line-height: 1.15; font-weight: 800; margin-bottom: 14px; text-wrap: balance;
}
.home-hero h1 em { font-style: normal; color: #ffb4a0; }
.home-hero .lead { font-size: 1.08rem; color: #c7d6d4; max-width: 56ch; margin-bottom: 24px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-block; padding: 11px 20px; border-radius: 9px;
  font-family: var(--font-body); font-size: .95rem; font-weight: 700;
  text-decoration: none; transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 4px 14px rgba(216,96,60,.35); }
.btn-primary:hover { background: var(--coral-hi); transform: translateY(-2px); }
.btn-teal { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(15,118,110,.35); }
.btn-teal:hover { background: var(--accent-hi); transform: translateY(-2px); }
.btn-ghost { background: rgba(255,255,255,.08); color: #eef4f1; border: 1px solid rgba(255,255,255,.22); }
.btn-ghost:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }

/* ============ CARE SIGNATURE (checklista) ============ */
.care-sig {
  margin-top: 26px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
}
.care-list { display: flex; flex-direction: column; gap: 7px; }
.care-list .li {
  display: flex; align-items: center; gap: 10px; font-size: .92rem; color: #dbe7e4;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: 8px 12px;
}
.care-list .li .ck {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
}
.care-list .li .ck.warm { background: var(--coral); }
.care-badge {
  text-align: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px; padding: 16px 18px; min-width: 150px;
}
.care-badge .big { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; color: #ffb4a0; line-height: 1; }
.care-badge .cap { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #9db0b4; margin-top: 4px; }

/* ============ HOME SECTIONS ============ */
.home-sec { margin-bottom: 42px; }
.home-sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.home-sec-head h2 {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px; text-wrap: balance;
}
.home-sec-head .sec-no {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px;
  background: var(--accent); color: #fff; border-radius: 8px; font-family: var(--font-body);
  font-size: .85rem; font-weight: 700;
}
.home-sec-head .count { font-size: .82rem; color: var(--muted); margin-left: auto; white-space: nowrap; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.home-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 14px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.home-card .ico { font-size: 1.5rem; line-height: 1; }
.home-card h3 { font-size: .95rem; font-weight: 700; line-height: 1.35; text-wrap: balance; }
.home-card p { font-size: .85rem; color: var(--muted); line-height: 1.55; flex: 1; }
.home-card .go { font-size: .82rem; font-weight: 700; color: var(--accent-hi); display: inline-flex; align-items: center; gap: 4px; }

.home-note {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-alt); border: 1px solid var(--border); border-left: 4px solid var(--amber);
  border-radius: 10px; padding: 14px 18px; font-size: .95rem; color: var(--text); margin-top: 10px;
}

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

.crumbs { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--accent-hi); text-decoration: none; font-weight: 700; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { opacity: .7; }

.article .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 14px; }
.article .meta .tag {
  background: var(--accent); color: #fff; font-weight: 700; font-size: .75rem;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .03em;
}
.article h1 {
  font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.18; font-weight: 800; margin-bottom: 24px; text-wrap: balance;
}
.article h2 {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 700;
  margin: 38px 0 14px; padding-top: 8px; scroll-margin-top: 76px; text-wrap: balance;
}
.article h3 { font-size: 1.12rem; font-weight: 700; margin: 26px 0 10px; text-wrap: balance; }
.article p { margin-bottom: 14px; }
.article ul, .article ol { margin: 0 0 16px 22px; }
.article li { margin-bottom: 6px; }
.article a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.article a:hover { color: var(--accent-hi); }
.article strong { font-weight: 700; }
.article blockquote {
  border-left: 4px solid var(--accent); background: var(--bg-alt);
  padding: 12px 18px; border-radius: 0 10px 10px 0; margin: 18px 0; font-style: italic; color: var(--text);
}

/* TOC */
.toc {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 30px;
}
.toc h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 5px; }
.toc li::before { content: counter(toc) ". "; color: var(--accent-hi); font-weight: 700; font-size: .85rem; }
.toc a { color: var(--text); text-decoration: none; font-size: .92rem; }
.toc a:hover { color: var(--accent-hi); }

/* ============ COMPONENTS ============ */
.info-box {
  display: flex; gap: 12px; align-items: flex-start;
  background: #e8f4f2; border: 1px solid #bfe0db; border-radius: 10px; padding: 14px 18px; margin: 18px 0;
  font-size: .97rem;
}
.info-box .ib-ic { font-size: 1.25rem; line-height: 1.3; }
.dark .info-box { background: #122a2c; border-color: #1d4344; }
.info-box.warn { background: #fdf0e6; border-color: #f0cfae; }
.dark .info-box.warn { background: #2e2118; border-color: #4a3524; }
.info-box.danger { background: #fdecea; border-color: #f0b8b0; }
.dark .info-box.danger { background: #331b1a; border-color: #552b27; }
.info-box.tip { background: #f3f6e8; border-color: #d5dfae; }
.dark .info-box.tip { background: #232b18; border-color: #3c4827; }

.error-table, .compare-table {
  width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .93rem;
}
.error-table th, .compare-table th {
  background: var(--accent); color: #fff; text-align: left; font-weight: 700;
  padding: 10px 14px; border: 1px solid var(--accent-hi);
}
.error-table td, .compare-table td { padding: 10px 14px; border: 1px solid var(--border); vertical-align: top; }
.error-table tr:nth-child(even) td, .compare-table tr:nth-child(even) td { background: var(--bg-alt); }
.compare-table .yes { color: var(--accent-hi); font-weight: 700; }
.compare-table .no { color: var(--red); font-weight: 700; }
.table-responsive { overflow-x: auto; margin: 18px 0; }
.table-responsive table { margin: 0; }

.faq-item { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 12px 0; background: var(--panel); }
.faq-item h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--accent-hi); }
.faq-item p { margin-bottom: 0; }

.glossary { margin: 18px 0; }
.glossary dt { font-weight: 700; color: var(--accent-hi); margin-top: 14px; font-size: 1.02rem; }
.glossary dd { margin: 3px 0 0; color: var(--text); }

.article .footer {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--muted);
}

/* ============ 404 ============ */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-family: var(--font-display); font-size: 4rem; color: var(--accent); }
.error-page p { margin: 12px 0 24px; color: var(--muted); }
.error-page a { color: var(--accent-hi); font-weight: 700; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease-out; width: 290px; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .burger { display: block; }
  .searchbox { width: auto; flex: 1; max-width: none; }
  .care-sig { grid-template-columns: 1fr; }
  .home-hero { padding: 32px 24px; }
  .main-inner { padding: 24px 18px 70px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .mark { font-size: 1.15rem; }
  .mark small { font-size: .62rem; }
  .home-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { text-align: center; }
  .home-sec-head { flex-wrap: wrap; }
  .home-sec-head .count { margin-left: 0; width: 100%; }
}

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