/* ============================================================
   DRONYPROSTO - design system "Niebo i sygnał"
   Paleta: granat nocy + błękit nieba + bursztyn sygnału + krem
   Typografia: Space Grotesk (display) + Source Sans 3 (body)
   ============================================================ */

:root {
  /* Paleta light */
  --ink: #0e1626;            /* głęboki granat nocy - tekst */
  --ink-soft: #3d4a5f;       /* tekst wtórny */
  --panel: #ffffff;          /* karty, sidebar */
  --paper: #f6f4ee;          /* ciepły krem - tło */
  --paper-deep: #efece3;     /* tło sekcji, hover */
  --sky: #1d4ed8;            /* błękit nieba - linki */
  --sky-soft: #3b82f6;       /* akcenty */
  --amber: #b45309;          /* bursztyn - tekst CTA */
  --amber-bg: #e8912d;       /* bursztyn - tło CTA */
  --amber-soft: #fdeed9;     /* bursztyn - tło info */
  --ok: #1a7f4b;
  --danger: #b91c1c;
  --border: #e3ded2;
  --topo: rgba(14, 22, 38, 0.05);

  /* Layout */
  --header-h: 60px;
  --sidebar-w: 280px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(14,22,38,.06), 0 4px 16px rgba(14,22,38,.05);
  --shadow-hover: 0 2px 4px rgba(14,22,38,.08), 0 10px 28px rgba(14,22,38,.10);

  /* Typografia */
  --font-display: "Space Grotesk", "Trebuchet MS", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --fs-body: 17px;
  --lh-body: 1.7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf5;
    --ink-soft: #9fb0c8;
    --panel: #121b2e;
    --paper: #0d1524;
    --paper-deep: #101a2c;
    --sky: #7cb3f5;
    --sky-soft: #60a5fa;
    --amber: #fbbf24;
    --amber-bg: #d97706;
    --amber-soft: #2a2010;
    --ok: #4ade80;
    --danger: #f87171;
    --border: #232f47;
    --topo: rgba(160, 190, 240, 0.06);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.5), 0 12px 30px rgba(0,0,0,.45);
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 60% 40% at 85% -5%, var(--topo), transparent),
    radial-gradient(ellipse 50% 35% at -10% 105%, var(--topo), transparent);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; text-wrap: balance; }
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--amber-bg); color: #1a1206; padding: 10px 16px;
  border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--amber-bg); color: #1a1206; }

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(14,22,38,.03);
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber-bg), transparent);
  opacity: .3; pointer-events: none;
}
.header-inner {
  max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: 1.22rem; color: var(--ink);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--amber-bg); display: inline-flex; }
.brand-text strong { font-weight: 700; }
.header-search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
#search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--paper-deep); border: 1px solid var(--border); border-radius: 999px;
}
#search-input:focus { outline: 3px solid var(--sky); outline-offset: 1px; background: var(--panel); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover); max-height: 380px; overflow-y: auto;
}
.search-results a {
  display: block; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--paper-deep); text-decoration: none; }
.search-results .sr-title { font-weight: 600; font-size: .95rem; }
.search-results .sr-excerpt { font-size: .82rem; color: var(--ink-soft); }
.menu-toggle {
  display: none; flex-direction: column; gap: 5px; padding: 10px;
  background: none; border: 0; cursor: pointer; margin-left: auto;
}
.menu-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease-out, opacity .2s; }
.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: calc(var(--header-h) + 24px) 20px 40px;
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: 36px;
  min-height: calc(100vh - var(--header-h));
}
.sidebar {
  position: sticky; top: calc(var(--header-h) + 20px); align-self: start;
  max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 14px;
}
.sidebar-link {
  display: block; padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: .9rem; line-height: 1.4;
}
.sidebar-link:hover { background: var(--paper-deep); text-decoration: none; }
.sidebar-link.active { background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.sidebar-home { font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 6px; border-radius: 0; }
.sidebar-section {
  margin-top: 14px; padding: 0 12px 4px;
  font-family: var(--font-display); font-size: .7rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); font-weight: 600;
}
.sidebar-foot { margin-top: 16px; padding: 12px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--ink-soft); }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(10,14,24,.5); z-index: 40;
}
.main { min-width: 0; }

/* ---------- Home ---------- */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0e1626 0%, #16233d 55%, #1d3a5f 100%);
  color: #f2f5fa; border-radius: var(--radius);
  padding: 44px 40px 40px; margin-bottom: 34px;
}
.home-hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    repeating-radial-gradient(ellipse 70% 60% at 82% 20%, transparent 0 26px, rgba(160,190,240,.14) 27px 28px),
    repeating-radial-gradient(ellipse 60% 50% at 75% 25%, transparent 0 44px, rgba(160,190,240,.10) 45px 46px);
}
.home-hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--amber-bg), transparent); opacity: .7;
}
.hero-eyebrow {
  font-family: var(--font-display); font-size: .78rem; letter-spacing: .14em;
  text-transform: uppercase; color: #fbbf24; font-weight: 600; margin-bottom: 12px;
}
.home-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: 12px; color: #fff; }
.home-hero p { max-width: 620px; color: #c9d6ea; font-size: 1.06rem; margin-bottom: 22px; }
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--amber-bg); color: #1a1206; font-weight: 700;
  padding: 11px 22px; border-radius: 999px; font-size: 1rem;
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(232,145,45,.35); text-decoration: none; }
.hero-cta .cta-arrow { transition: transform .2s ease-out; }
.hero-cta:hover .cta-arrow { transform: translateX(4px); }

.hero-stats {
  display: flex; gap: 34px; margin-top: 28px; flex-wrap: wrap;
  border-top: 1px solid rgba(160,190,240,.18); padding-top: 20px;
}
.hero-stat b { font-family: var(--font-display); font-size: 1.5rem; color: #fff; display: block; }
.hero-stat span { font-size: .85rem; color: #9fb0c8; }

.section-heading {
  display: flex; align-items: baseline; gap: 12px;
  margin: 36px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.section-heading h2 { font-size: 1.35rem; }
.section-heading .sec-count { font-family: var(--font-display); font-size: .8rem; color: var(--amber); font-weight: 700; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px;
}
.home-card {
  display: block; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .2s ease-out, box-shadow .2s ease-out, border-color .2s;
  position: relative; overflow: hidden;
}
.home-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber-bg), var(--sky-soft)); opacity: 0;
  transition: opacity .2s ease-out;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); text-decoration: none; }
.home-card:hover::before { opacity: 1; }
.home-card .card-icon { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.home-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 5px; line-height: 1.35; }
.home-card p { font-size: .85rem; color: var(--ink-soft); line-height: 1.5; }
.card-arrow { position: absolute; right: 14px; top: 16px; color: var(--amber); opacity: 0; transform: translateX(-6px); transition: all .2s ease-out; }
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Article ---------- */
.content-article { animation: fadeUp .28s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
.article-head { margin-bottom: 26px; }
.article-head .article-section {
  font-family: var(--font-display); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--amber); font-weight: 700; margin-bottom: 8px;
}
.article-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px; }
.article-head .article-excerpt { font-size: 1.08rem; color: var(--ink-soft); max-width: 720px; }
.article-meta { margin-top: 12px; font-size: .82rem; color: var(--ink-soft); }

.article-body h2 {
  font-size: 1.35rem; margin: 34px 0 12px; padding-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-body h3 { font-size: 1.08rem; margin: 24px 0 8px; }
.article-body p { margin-bottom: 14px; max-width: 72ch; }
.article-body ul, .article-body ol { margin: 0 0 14px 22px; }
.article-body li { margin-bottom: 6px; }
.article-body a { text-decoration: underline; text-underline-offset: 3px; }

.info-box {
  background: var(--amber-soft); border-left: 4px solid var(--amber-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px; margin: 18px 0; font-size: .97rem;
}
.info-box p { margin: 0; }
.info-box strong { color: var(--amber); }

table.compare-table, table.error-table {
  width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .95rem;
  background: var(--panel); border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.compare-table th, .error-table th {
  background: var(--paper-deep); font-family: var(--font-display); font-size: .88rem;
  text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--amber-bg);
}
.compare-table td, .error-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.compare-table tr:last-child td, .error-table tr:last-child td { border-bottom: 0; }
.compare-table tr:hover td, .error-table tr:hover td { background: var(--paper-deep); }
.table-responsive { overflow-x: auto; }

.faq-item { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.faq-item h3 { margin: 0; font-size: 1rem; }
.faq-item h3 button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--ink); padding: 13px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq-item h3 button::after { content: "+"; font-family: var(--font-display); font-size: 1.1rem; color: var(--amber); transition: transform .2s; }
.faq-item.open h3 button::after { transform: rotate(45deg); }
.faq-item .faq-a { display: none; padding: 0 16px 14px; }
.faq-item.open .faq-a { display: block; }
.faq-item .faq-a p { margin: 0 0 8px; }
.faq-item .faq-a p:last-child { margin: 0; }

dl.glossary { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 20px; }
dl.glossary dt { font-weight: 700; font-family: var(--font-display); margin-top: 16px; color: var(--amber); }
dl.glossary dd { margin: 2px 0 0; }

.checklist { list-style: none; margin-left: 0 !important; }
.checklist li { padding-left: 30px; position: relative; margin-bottom: 9px; }
.checklist li::before {
  content: ""; position: absolute; left: 2px; top: 4px; width: 16px; height: 16px;
  border: 2px solid var(--amber-bg); border-radius: 4px;
}
.checklist li.done::after {
  content: "✓"; position: absolute; left: 3px; top: 1px; color: var(--ok); font-weight: 700; font-size: 13px;
}

.toc-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 0 0 24px; font-size: .92rem;
}
.toc-box strong { font-family: var(--font-display); display: block; margin-bottom: 6px; }
.toc-box ol { margin-left: 20px; }
.toc-box a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--border); }
.toc-box a:hover { color: var(--amber); }

.article-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.article-nav a { max-width: 48%; font-size: .92rem; }
.article-nav .nav-label { display: block; font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Footer ---------- */
.app-footer { border-top: 1px solid var(--border); background: var(--panel); margin-top: 30px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 26px 20px; }
.footer-note { font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: calc(var(--header-h) + 18px); }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: min(300px, 84vw);
    border-radius: 0; max-height: none; z-index: 45;
    transform: translateX(-105%); transition: transform .25s ease-out;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .header-search { max-width: none; }
}
@media (max-width: 600px) {
  :root { --header-h: 56px; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand-text { font-size: 1.02rem; }
  .home-hero { padding: 32px 22px; }
  .hero-stats { gap: 20px; }
  .card-grid { grid-template-columns: 1fr; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
  .search-results { max-height: 320px; }
}

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