/* ============================================
   OGRZEWANIE PROSTO - design system
   Paleta: ember (ogień) + brass (mosiądz) + grafit + krem
   Typografia: Oswald (display) + Source Sans 3 (body) + IBM Plex Mono (etykiety)
   ============================================ */

:root {
  --ink: #1a1512;
  --panel: #241d17;
  --paper: #f6efe3;
  --paper-dim: #ece1cd;
  --ember: #e05f26;
  --ember-bright: #ff8a4d;
  --ember-ink: #b3401a;
  --ember-deep: #8a2f0e;
  --brass: #d9a441;
  --brass-deep: #8a6420;
  --steel: #9aa5ad;
  --steel-deep: #5d666d;
  --text: #241c12;
  --text-secondary: #5c5240;
  --border-light: rgba(36, 28, 18, 0.12);
  --bg: var(--paper);
  --bg-card: #fffaf0;
  --accent-subtle: rgba(224, 95, 38, 0.12);
  --header-height: 60px;
  --sidebar-width: 300px;
  --radius: 10px;
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --transition: all 0.2s ease-out;
  --shadow-card: 0 1px 3px rgba(26, 21, 18, 0.08), 0 4px 16px rgba(26, 21, 18, 0.06);
  --shadow-card-hover: 0 2px 6px rgba(26, 21, 18, 0.1), 0 10px 28px rgba(26, 21, 18, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --bg-card: #201a14;
    --panel: #241d17;
    --text: #ece2d0;
    --text-secondary: #b3a68f;
    --border-light: rgba(236, 226, 208, 0.14);
    --accent-subtle: rgba(255, 138, 77, 0.14);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, 0.5), 0 10px 28px rgba(224, 95, 38, 0.12);
  }
}

/* --- RESET & BASE --- */
*, *::before, *::after { 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);
  background-image:
    radial-gradient(ellipse 600px 400px at 100% 0%, var(--accent-subtle), transparent 60%),
    radial-gradient(ellipse 500px 400px at 0% 100%, rgba(217, 164, 65, 0.1), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; text-wrap: balance; letter-spacing: 0.01em; }
p { text-wrap: pretty; }

a { color: var(--ember-ink); }
@media (prefers-color-scheme: dark) { a { color: var(--ember-bright); } }
a:hover { text-decoration-thickness: 2px; }

img, svg { max-width: 100%; height: auto; }

::selection { background: var(--accent-subtle); }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ember); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; color: #fff; }

/* --- HEADER --- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-subtle), transparent);
  opacity: 0.5; pointer-events: none;
}

.brand { display: flex; align-items: center; min-width: 0; }
.brand a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 1.3rem; }
.brand-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
}
.brand-accent { color: var(--ember-ink); }
@media (prefers-color-scheme: dark) { .brand-accent { color: var(--ember-bright); } }

.mobile-menu-btn {
  display: none; width: 40px; height: 40px; flex: 0 0 40px;
  border: 1px solid var(--border-light); border-radius: 8px;
  background: transparent; color: var(--text); font-size: 1.2rem;
  cursor: pointer; align-items: center; justify-content: center;
}
.mobile-menu-btn:hover { background: var(--accent-subtle); }

/* --- HEADER SEARCH --- */
.header-search { position: relative; margin-left: auto; width: min(340px, 40vw); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.9rem; opacity: 0.7; pointer-events: none; }
#search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-light); border-radius: 999px;
  background: var(--bg-card); color: var(--text);
  font-family: var(--font-body); font-size: 0.95rem;
  transition: var(--transition);
}
#search-input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--accent-subtle); }
#search-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 120;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: var(--shadow-card-hover); overflow: hidden;
}
#search-results a { display: flex; gap: 10px; padding: 10px 14px; align-items: flex-start; text-decoration: none; color: var(--text); font-size: 0.9rem; border-bottom: 1px solid var(--border-light); }
#search-results a:last-child { border-bottom: none; }
#search-results a:hover { background: var(--accent-subtle); }
#search-results .sr-title { font-weight: 600; display: block; }
#search-results .sr-excerpt { display: block; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.35; }

/* --- SIDEBAR --- */
.sidebar {
  position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 90;
  width: var(--sidebar-width);
  overflow-y: auto; padding: 16px 12px 24px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.sidebar-nav { list-style: none; }
.sidebar-nav li { margin: 1px 0; }
.nav-home { font-weight: 700 !important; }
.nav-section {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-secondary);
  padding: 18px 10px 6px; margin-top: 8px;
  border-top: 1px solid var(--border-light);
}
.sidebar-nav a {
  display: block; padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 0.9rem; line-height: 1.4;
  transition: var(--transition);
}
.sidebar-nav a:hover { background: var(--accent-subtle); color: var(--text); transform: translateX(2px); }
.sidebar-nav a.active { background: var(--accent-subtle); color: var(--ember-ink); font-weight: 600; }
@media (prefers-color-scheme: dark) { .sidebar-nav a.active { color: var(--ember-bright); } }

/* --- MAIN LAYOUT --- */
.main {
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 28px) 32px 60px;
  max-width: 980px;
  min-height: calc(100vh - 260px);
  animation: fadeUp 0.25s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- HOME HERO --- */
.home-hero {
  position: relative; overflow: hidden;
  border-radius: 16px;
  padding: 40px 40px 36px;
  margin-bottom: 36px;
  background:
    radial-gradient(ellipse 500px 300px at 85% 10%, rgba(255, 138, 77, 0.25), transparent 65%),
    linear-gradient(135deg, var(--ink) 0%, #2a2018 100%);
  color: #f2e8d8;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-card-hover);
}
.home-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  color: #fbf4e8; margin-bottom: 10px; text-transform: uppercase;
}
.home-hero .hero-sub { font-size: 1.08rem; color: #d8cbb4; max-width: 56ch; margin-bottom: 8px; }
.home-hero .hero-accent { color: var(--ember-bright); }
.home-hero .hero-tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ember-bright);
  border: 1px solid rgba(255, 138, 77, 0.4); border-radius: 999px;
  padding: 4px 12px; margin-bottom: 16px;
}
.stats-row { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.stat-card {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px; padding: 12px 20px; text-align: center; min-width: 110px;
}
.stat-card .num { display: block; font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; color: var(--ember-bright); line-height: 1.1; }
.stat-card .label { font-size: 0.78rem; color: #c9bda6; }

/* --- HOME HERO: instalacja CO (SVG signature) --- */
.hero-installation { margin-top: 28px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); padding: 14px 10px 6px; border: 1px solid rgba(255, 255, 255, 0.07); }
.hero-installation svg { display: block; width: 100%; height: auto; }
.pipe-flow { stroke-dasharray: 10 14; animation: pipeFlow 1.6s linear infinite; }
@keyframes pipeFlow { to { stroke-dashoffset: -24; } }
.flame-flick { animation: flameFlick 0.9s ease-in-out infinite alternate; transform-origin: center; }
@keyframes flameFlick { from { transform: scaleY(1); opacity: 0.85; } to { transform: scaleY(1.18); opacity: 1; } }
.heat-rise { animation: heatRise 2.2s ease-in-out infinite; opacity: 0; }
@keyframes heatRise { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-10px); } }
.draw-path { stroke-dasharray: 600; stroke-dashoffset: 600; animation: drawPath 2.4s ease-out forwards; }
@keyframes drawPath { to { stroke-dashoffset: 0; } }
.draw-path.d2 { animation-delay: 0.4s; }
.draw-path.d3 { animation-delay: 0.8s; }
.draw-path.d4 { animation-delay: 1.2s; }
.draw-path.d5 { animation-delay: 1.6s; }

/* --- HOME SECTIONS & CARDS --- */
.home-section-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.35rem; text-transform: uppercase; letter-spacing: 0.03em;
  margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light);
}
.accent-bar { display: inline-block; width: 6px; height: 22px; border-radius: 3px; background: linear-gradient(180deg, var(--ember), var(--brass)); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.home-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-card); transition: var(--transition); position: relative;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--brass));
  opacity: 0; transition: var(--transition); border-radius: 0 0 2px 2px;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: rgba(224, 95, 38, 0.35); }
.home-card:hover::before { opacity: 1; }
.home-card h3 { font-size: 0.9rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.home-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.card-icon { font-size: 1.3rem; margin-bottom: 4px; }
.card-arrow { position: absolute; right: 14px; top: 14px; opacity: 0; transform: translateX(-6px); transition: var(--transition); color: var(--ember-ink); font-weight: 700; }
@media (prefers-color-scheme: dark) { .card-arrow { color: var(--ember-bright); } }
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* --- ARTICLE --- */
.content-article { padding-bottom: 40px; }
.content-article h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.01em; }
.content-article h2 { font-size: 1.45rem; margin: 34px 0 12px; padding-top: 8px; text-transform: uppercase; letter-spacing: 0.02em; }
.content-article h2::before { content: ''; display: inline-block; width: 22px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ember), var(--brass)); margin-right: 10px; vertical-align: middle; }
.content-article h3 { font-size: 1.12rem; margin: 24px 0 8px; }
.content-article p { margin: 0 0 14px; }
.content-article ul, .content-article ol { margin: 0 0 16px 22px; }
.content-article li { margin-bottom: 6px; }
.content-article li::marker { color: var(--ember-ink); }
@media (prefers-color-scheme: dark) { .content-article li::marker { color: var(--ember-bright); } }
.content-article strong { font-weight: 700; }

.article-meta { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 18px; font-style: italic; }

/* --- TOC --- */
.article-toc {
  background: var(--bg-card); border: 1px solid var(--border-light); border-left: 3px solid var(--ember);
  border-radius: 0 10px 10px 0; padding: 16px 20px; margin: 0 0 24px;
  position: sticky; top: calc(var(--header-height) + 14px);
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.article-toc h3 { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-secondary); margin: 0 0 10px; }
.article-toc a { display: block; text-decoration: none; padding: 3px 0; font-size: 0.92rem; color: var(--text); transition: var(--transition); }
.article-toc a:hover { color: var(--ember-ink); transform: translateX(3px); }
@media (prefers-color-scheme: dark) { .article-toc a:hover { color: var(--ember-bright); } }
.article-toc a.active { color: var(--ember-ink); font-weight: 700; }
@media (prefers-color-scheme: dark) { .article-toc a.active { color: var(--ember-bright); } }
.article-toc .toc-h3 { padding-left: 16px; font-size: 0.86rem; }

/* --- INFO BOX --- */
.info-box {
  background: var(--accent-subtle); border: 1px solid rgba(224, 95, 38, 0.3);
  border-radius: 10px; padding: 14px 18px; margin: 18px 0; font-size: 0.97rem;
}
.info-box::before { content: '💡 '; }
.info-box strong { color: var(--ember-ink); }
@media (prefers-color-scheme: dark) { .info-box strong { color: var(--ember-bright); } }

/* --- TABLES --- */
.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: 10px; border: 1px solid var(--border-light); }
table.compare-table, table.error-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
.compare-table th, .error-table th {
  background: var(--ink); color: #f2e8d8; text-align: left;
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 11px 14px; font-size: 0.85rem; border-bottom: 2px solid var(--ember);
}
.compare-table td, .error-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.compare-table tr:nth-child(even) td, .error-table tr:nth-child(even) td { background: var(--accent-subtle); }
.compare-table tr:last-child td, .error-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child, .error-table td:first-child { font-weight: 600; white-space: nowrap; }

/* --- FAQ --- */
.faq-item { margin: 0 0 12px; border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; background: var(--bg-card); }
.faq-item h3 { margin: 0; padding: 13px 18px; font-size: 1rem; cursor: default; background: var(--accent-subtle); border-bottom: 1px solid var(--border-light); }
.faq-item p { margin: 0; padding: 12px 18px; font-size: 0.97rem; }

/* --- GLOSSARY --- */
.glossary-list dl { margin: 0; }
.glossary-list dt {
  font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--ember-ink);
  padding: 14px 0 2px; border-top: 1px solid var(--border-light);
}
@media (prefers-color-scheme: dark) { .glossary-list dt { color: var(--ember-bright); } }
.glossary-list dt:first-child { border-top: none; }
.glossary-list dd { margin: 0 0 6px; font-size: 0.97rem; }

/* --- AD PLACEHOLDERS --- */
/* Placeholdery reklam siedza w index.html. Domyślnie ukryte, żeby nie psuć
   podglądu - po wklejeniu kodu AdSense usuń 'display:none' lub dodaj klasę .active. */
.ad-leaderboard { display: none; }
.sidebar-ad { display: none; }
.ad-leaderboard.ad-active { display: flex; }
.sidebar-ad.ad-active { display: block; }
.ad-leaderboard {
  position: fixed; top: var(--header-height); right: 0; z-index: 80;
  width: calc(100% - var(--sidebar-width)); display: flex; justify-content: center;
  pointer-events: none;
}
.ad-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px dashed var(--border-light); border-radius: 8px;
  color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase; text-align: center;
}
.ad-leaderboard .ad-placeholder { width: 970px; max-width: 100%; height: 90px; margin-top: 8px; }
.sidebar-ad { padding: 12px; }
.sidebar-ad .ad-placeholder { width: 100%; height: 250px; }

/* --- FOOTER --- */
.app-footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  padding: 28px 32px 34px;
}
.footer-inner { max-width: 980px; }
.footer-brand { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; font-size: 1.05rem; margin-bottom: 6px; }
.app-footer p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 6px; max-width: 70ch; }
.footer-note { font-size: 0.8rem !important; font-style: italic; }
.footer-copy { font-size: 0.78rem !important; margin-top: 10px; opacity: 0.8; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .mobile-menu-btn { display: flex; }
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.28s ease-out;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    width: min(320px, 86vw);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 85;
    background: rgba(0, 0, 0, 0.45);
  }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; padding: calc(var(--header-height) + 20px) 18px 50px; }
  .app-footer { margin-left: 0; padding: 24px 18px 30px; }
  .ad-leaderboard { width: 100%; }
  .header-search { width: auto; flex: 1; min-width: 0; }
  .brand-name { font-size: 1rem; }
  .home-hero { padding: 30px 22px 28px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .stat-card { min-width: 90px; padding: 10px 14px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .content-article h1 { font-size: 1.6rem; }
  .content-article h2 { font-size: 1.25rem; }
  .home-grid { grid-template-columns: 1fr; }
  .app-header { padding: 0 12px; gap: 10px; }
  .hero-installation { padding: 10px 6px 4px; }
  .sidebar-ad { display: none; }
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .pipe-flow { animation: none; }
  .flame-flick { animation: none; }
  .heat-rise { animation: none; opacity: 0.6; }
  .draw-path { stroke-dashoffset: 0; }
  .home-card:hover { transform: none; }
}



