/* ==========================================================================
   Dotacje - design system
   Paleta: głęboka zieleń sosnowa + mosiądz + pieczęć na chłodnym papierze.
   Typografia: Bricolage Grotesque (display) + Instrument Sans (tekst)
               + IBM Plex Mono (liczby, terminy, etykiety danych).
   ========================================================================== */

:root {
  --bg:         oklch(0.974 0.004 160);
  --bg-2:       oklch(0.947 0.006 160);
  --surface:    oklch(1 0 0);
  --ink:        oklch(0.235 0.015 170);
  --ink-2:      oklch(0.345 0.014 170);
  --muted:      oklch(0.452 0.012 168);
  --rule:       oklch(0.884 0.008 160);
  --rule-soft:  oklch(0.928 0.006 160);

  --pine:       oklch(0.305 0.042 168);
  --pine-deep:  oklch(0.228 0.034 168);
  --brass:      oklch(0.735 0.110 82);
  --brass-ink:  oklch(0.505 0.098 76);
  --seal:       oklch(0.492 0.155 27);

  --info-bg:    oklch(0.955 0.014 220);
  --info-br:    oklch(0.862 0.028 220);
  --tip-bg:     oklch(0.958 0.018 155);
  --tip-br:     oklch(0.868 0.032 155);
  --warn-bg:    oklch(0.958 0.020 78);
  --warn-br:    oklch(0.868 0.044 78);
  --bad-bg:     oklch(0.953 0.017 28);
  --bad-br:     oklch(0.858 0.040 28);

  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --header-h: 64px;
  --sidebar-w: 302px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         oklch(0.178 0.010 168);
    --bg-2:       oklch(0.208 0.011 168);
    --surface:    oklch(0.228 0.013 168);
    --ink:        oklch(0.932 0.008 150);
    --ink-2:      oklch(0.822 0.010 150);
    --muted:      oklch(0.722 0.012 155);
    --rule:       oklch(0.318 0.014 168);
    --rule-soft:  oklch(0.268 0.012 168);

    --pine:       oklch(0.252 0.032 168);
    --pine-deep:  oklch(0.196 0.024 168);
    --brass:      oklch(0.790 0.098 84);
    --brass-ink:  oklch(0.808 0.092 84);
    --seal:       oklch(0.720 0.130 28);

    --info-bg:    oklch(0.258 0.026 220);
    --info-br:    oklch(0.360 0.034 220);
    --tip-bg:     oklch(0.256 0.028 155);
    --tip-br:     oklch(0.356 0.036 155);
    --warn-bg:    oklch(0.262 0.030 74);
    --warn-br:    oklch(0.372 0.042 74);
    --bad-bg:     oklch(0.262 0.038 28);
    --bad-br:     oklch(0.376 0.050 28);
  }
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
button, input { font: inherit; color: inherit; }
::selection { background: oklch(0.735 0.110 82 / 0.28); }
:focus-visible { outline: 2px solid var(--brass-ink); outline-offset: 3px; }

/* --- Typografia bazowa --------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.12;
  text-wrap: balance;
  margin: 0;
}
p { text-wrap: pretty; }
a { color: var(--brass-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 400;
  background: var(--pine); color: #fff; padding: 10px 16px;
  font-size: 0.9rem; text-decoration: none; transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* --- Przyciski ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border: 1px solid transparent; border-radius: 2px;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.005em; text-decoration: none; cursor: pointer;
  transition: transform .16s var(--ease-out), background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn:active { transform: scale(0.975); }
.btn-primary { background: var(--pine); color: #fff; border-color: var(--pine); }
.btn-primary:hover { background: var(--pine-deep); border-color: var(--pine-deep); }
.btn-brass { background: var(--brass); color: oklch(0.205 0.030 168); border-color: var(--brass); }
.btn-brass:hover { background: oklch(0.800 0.105 84); border-color: oklch(0.800 0.105 84); }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--rule); }
.btn-quiet:hover { background: var(--bg-2); border-color: var(--ink-2); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.95rem; font-weight: 500; color: var(--ink-2);
  text-decoration: none; border-bottom: 1px solid var(--rule);
  padding-bottom: 3px; transition: color .18s ease, border-color .18s ease, gap .18s var(--ease-out);
}
.link-arrow::after { content: "→"; font-size: 0.95em; transition: transform .18s var(--ease-out); }
.link-arrow:hover { color: var(--brass-ink); border-color: var(--brass-ink); }
.link-arrow:hover::after { transform: translateX(3px); }

/* --- Header -------------------------------------------------------------- */
.app-header {
  position: fixed; inset: 0 0 auto 0; z-index: 200;
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  opacity: 0.45; pointer-events: none;
}
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: -6px;
  background: transparent; border: 1px solid var(--rule); border-radius: 2px;
  cursor: pointer; color: var(--ink);
}
.menu-btn:hover { background: var(--bg-2); }

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--brass); color: var(--brass-ink);
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
  letter-spacing: 0; line-height: 1; padding-bottom: 1px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem; letter-spacing: -0.02em; }
.brand-sub {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin-top: 3px;
}

.search { position: relative; flex: 1 1 auto; max-width: 420px; }
.search input {
  width: 100%; height: 40px;
  padding: 0 14px 0 38px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 2px;
  font-size: 0.92rem;
  transition: border-color .18s ease, background-color .18s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--brass-ink); background: var(--surface); box-shadow: 0 0 0 3px oklch(0.735 0.110 82 / 0.16); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.header-links { display: flex; gap: 20px; margin-left: auto; }
.header-links a {
  font-size: 0.86rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.header-links a:hover { color: var(--brass-ink); border-color: var(--brass-ink); }

/* --- Wyniki wyszukiwania ------------------------------------------------- */
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 300;
  background: var(--surface); border: 1px solid var(--rule);
  box-shadow: 0 14px 34px oklch(0.20 0.02 168 / 0.13);
  max-height: 62vh; overflow-y: auto;
}
.search-result { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; text-decoration: none; border-bottom: 1px solid var(--rule-soft); }
.search-result:last-child { border-bottom: 0; }
.search-result b { font-family: var(--font-body); font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.search-result span { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.search-result:hover { background: var(--bg-2); }
.search-result:hover b { color: var(--brass-ink); }
.search-empty { padding: 14px; font-size: 0.88rem; color: var(--muted); }

/* --- Shell + sidebar ----------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1500px; margin: 0 auto;
  padding-top: var(--header-h);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--rule);
  background: var(--bg);
  scrollbar-width: thin;
}
.sidebar-inner { padding: 26px 20px 40px 24px; }
.sidebar-search { display: none; position: relative; margin-bottom: 18px; }
.sidebar-search input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 2px; font-size: 0.9rem;
}
.sidebar-search input:focus { outline: none; border-color: var(--brass-ink); }
.sidebar-label {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 16px;
}
.sidebar-section { margin-bottom: 22px; }
.sidebar-head {
  display: block; padding-bottom: 7px; margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brass-ink); font-weight: 500;
}
.sidebar-link {
  display: block; padding: 6px 10px 6px 0; margin-left: -2px;
  font-size: 0.95rem; line-height: 1.42; color: var(--ink-2); text-decoration: none;
  border-left: 2px solid transparent; padding-left: 10px;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.sidebar-link:hover { color: var(--ink); background: var(--bg-2); }
.sidebar-link.is-active { color: var(--brass-ink); border-left-color: var(--brass); font-weight: 600; background: var(--bg-2); }
.sidebar-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule); }
.sidebar-foot p { margin: 0 0 6px; font-size: 0.82rem; color: var(--muted); }
.sidebar-foot a { font-size: 0.88rem; font-weight: 600; color: var(--brass-ink); }
.sidebar-close { display: none; }

.overlay { position: fixed; inset: var(--header-h) 0 0 0; z-index: 150; background: oklch(0.2 0.02 168 / 0.45); }

/* --- Main ---------------------------------------------------------------- */
.main { position: relative; min-width: 0; padding: 0 clamp(20px, 4vw, 54px) 0; }
.main > .view { max-width: 900px; margin: 0 auto; }
.reading-progress {
  position: fixed; top: var(--header-h); left: 0; right: 0; height: 2px; z-index: 190;
  background: var(--brass); transform: scaleX(0); transform-origin: 0 50%;
  display: none; pointer-events: none;
}
.view > .view { animation: fadeUp .28s var(--ease-out) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 26px 0 44px;
  padding: clamp(30px, 4.4vw, 56px) clamp(24px, 3.6vw, 50px) clamp(26px, 3vw, 38px);
  background: var(--pine);
  color: oklch(0.975 0.006 150);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid oklch(0.735 0.110 82 / 0.32);
  pointer-events: none;
}
.hero-copy { position: relative; max-width: 620px; }
.hero h1 {
  font-size: clamp(2.55rem, 6.2vw, 4.35rem);
  line-height: 0.99; letter-spacing: -0.032em; font-weight: 600;
  color: oklch(0.985 0.004 150);
}
.hero h1 em { display: block; font-style: normal; color: var(--brass); font-weight: 500; }
.hero-lede {
  margin: 18px 0 0; max-width: 46ch;
  font-size: clamp(1rem, 1.35vw, 1.1rem); line-height: 1.6;
  color: oklch(0.895 0.010 155);
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 26px; }
.hero .btn-brass { padding: 15px 27px; font-size: 1rem; }
.hero .link-arrow { color: oklch(0.895 0.010 155); border-color: oklch(0.735 0.110 82 / 0.5); }
.hero .link-arrow:hover { color: var(--brass); border-color: var(--brass); }

.hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(248px, 312px);
  gap: clamp(28px, 4vw, 56px); align-items: start;
}

/* Ścieżka wniosku - sygnaturowy element strony */
.rail {
  position: relative; list-style: none; margin: 4px 0 0; padding: 2px 0 2px 22px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  border-left: 1px solid oklch(0.735 0.110 82 / 0.38);
}
.rail::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 1px;
  background: linear-gradient(180deg, oklch(0.735 0.110 82 / 0.55), oklch(0.735 0.110 82 / 0.12));
  transform-origin: 50% 0; animation: railGrow 1.1s var(--ease-out) .15s both;
}
@keyframes railGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.rail li {
  position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 10px; align-items: baseline;
  font-size: 0.82rem; line-height: 1.35; color: oklch(0.845 0.010 155);
  animation: riseIn .5s var(--ease-out) both;
}
.rail li::before {
  content: ""; position: absolute; left: -25px; top: 7px; width: 5px; height: 5px;
  background: var(--pine); border: 1px solid oklch(0.735 0.110 82 / 0.8); border-radius: 50%;
}
.rail li:nth-child(1) { animation-delay: .18s; }
.rail li:nth-child(2) { animation-delay: .26s; }
.rail li:nth-child(3) { animation-delay: .34s; }
.rail li:nth-child(4) { animation-delay: .42s; }
.rail li:nth-child(5) { animation-delay: .50s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rail-num {
  grid-row: 1 / span 2; font-family: var(--font-mono); font-size: 0.75rem;
  letter-spacing: 0.06em; color: var(--brass);
}
.rail b { grid-column: 2; font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; color: oklch(0.975 0.004 150); }
.rail-note { grid-column: 2; font-size: 0.78rem; color: oklch(0.795 0.010 155); }

/* --- Indeks na stronie głównej ------------------------------------------- */
.intro-note {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
  padding: 0 0 26px; border-bottom: 1px solid var(--rule);
}
.intro-note p { margin: 0; max-width: 64ch; color: var(--ink-2); font-size: 1rem; }
.intro-note strong { color: var(--ink); font-weight: 600; }

.index-section { padding: 34px 0 8px; border-bottom: 1px solid var(--rule); }
.index-section:last-of-type { border-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.section-head h2 { font-size: clamp(1.28rem, 2vw, 1.6rem); letter-spacing: -0.025em; }
.section-head span {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.section-desc { margin: 2px 0 14px; font-size: 0.92rem; color: var(--muted); max-width: 62ch; }

.index-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: 2px 14px; align-items: baseline;
  padding: 13px 8px 13px 0; text-decoration: none;
  border-top: 1px solid var(--rule-soft);
  transition: background-color .16s ease, transform .18s var(--ease-out);
}
.index-item:hover { background: var(--bg-2); transform: translateX(3px); }
.index-num { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; }
.index-title {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  color: var(--ink); letter-spacing: -0.012em; line-height: 1.35;
  border-bottom: 1px solid transparent; justify-self: start;
  transition: color .16s ease, border-color .16s ease;
}
.index-item:hover .index-title { color: var(--brass-ink); border-color: var(--brass); }
.index-excerpt { grid-column: 2; font-size: 0.875rem; line-height: 1.5; color: var(--muted); margin-top: 2px; }

/* --- Artykuł ------------------------------------------------------------- */
.article { padding: 30px 0 40px; }
.crumb { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 18px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--brass-ink); }
.article-head { padding-bottom: 22px; border-bottom: 1px solid var(--rule); }
.article-head h1 { font-size: clamp(1.85rem, 3.9vw, 2.75rem); letter-spacing: -0.03em; line-height: 1.06; }
.article-deck { margin: 14px 0 0; font-size: 1.06rem; line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--brass); }

.prose { max-width: 70ch; padding-top: 26px; font-size: 1.0625rem; line-height: 1.72; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.56rem); margin-top: 2em; padding-top: 0.15em;
  letter-spacing: -0.022em;
}
.prose h2 + * { margin-top: 0.7em; }
.prose h3 { font-size: 1.1rem; margin-top: 1.6em; letter-spacing: -0.014em; }
.prose h3 + * { margin-top: 0.55em; }
.prose p { margin: 0; }
.prose > p.lead:first-of-type::first-letter {
  float: left; font-family: var(--font-display); font-weight: 500;
  font-size: 3.1em; line-height: 0.78; padding: 0.06em 0.12em 0 0; color: var(--brass-ink);
}
.prose ul, .prose ol { margin: 0; padding-left: 1.25em; }
.prose li { margin-top: 0.4em; }
.prose li::marker { color: var(--brass-ink); }
.prose a { color: var(--brass-ink); text-decoration: underline; text-decoration-color: oklch(0.735 0.110 82 / 0.45); }
.prose a:hover { text-decoration-color: var(--brass-ink); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose blockquote {
  margin: 1.4em 0; padding: 2px 0 2px 20px;
  border-left: 1px solid var(--brass);
  font-family: var(--font-display); font-size: 1.12rem; line-height: 1.5; color: var(--ink-2);
}
.prose blockquote p + p { margin-top: 0.6em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose .lead { font-size: 1.14rem; line-height: 1.62; color: var(--ink-2); }

/* Tabele */
.prose .table-responsive { overflow-x: auto; margin: 1.5em 0; -webkit-overflow-scrolling: touch; }
.prose table {
  width: 100%; border-collapse: collapse; font-size: 0.925rem; line-height: 1.45;
  background: var(--surface);
}
.prose table caption {
  caption-side: top; text-align: left; padding-bottom: 8px;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
}
.prose th {
  text-align: left; padding: 10px 12px; background: var(--bg-2);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.prose td { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.prose tbody tr:hover td { background: var(--bg-2); }
.prose .num { font-family: var(--font-mono); font-size: 0.88rem; white-space: nowrap; }
.prose .compare-table th:first-child, .prose .compare-table td:first-child { font-weight: 500; }

/* Ramki informacyjne */
.prose .info-box, .prose .tip-box, .prose .warning-box {
  padding: 16px 18px; margin: 1.6em 0; font-size: 0.975rem; line-height: 1.6;
  border: 1px solid; border-radius: 2px;
}
.prose .info-box { background: var(--info-bg); border-color: var(--info-br); }
.prose .tip-box { background: var(--tip-bg); border-color: var(--tip-br); }
.prose .warning-box { background: var(--bad-bg); border-color: var(--bad-br); }
.prose .warning-box strong { color: var(--seal); }
.prose .info-box > :first-child, .prose .tip-box > :first-child, .prose .warning-box > :first-child { margin-top: 0; }
.prose .info-box > :last-child, .prose .tip-box > :last-child, .prose .warning-box > :last-child { margin-bottom: 0; }
.prose .box-title {
  display: block; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: 5px;
}

/* W skrócie */
.prose .key-takeaways {
  margin: 1.6em 0; padding: 18px 20px;
  background: var(--bg-2); border-top: 2px solid var(--pine); border-bottom: 1px solid var(--rule);
}
.prose .kt-title {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brass-ink); margin: 0 0 8px;
}
.prose .key-takeaways ul { margin: 0; padding-left: 1.05em; }
.prose .key-takeaways li { margin-top: 6px; font-size: 0.95rem; }

/* Kroki */
.prose .steps-list { counter-reset: step; list-style: none; padding: 0; margin: 1.6em 0; }
.prose .steps-list > li {
  counter-increment: step; position: relative;
  padding: 2px 0 14px 40px; border-left: 1px solid var(--rule); margin-left: 11px;
}
.prose .steps-list > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.prose .steps-list > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: -13px; top: 0;
  width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--brass); border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--brass-ink);
}
.prose .steps-list b { display: block; margin-bottom: 2px; }

/* FAQ */
.prose .faq-item {
  border-bottom: 1px solid var(--rule); padding: 0;
}
.prose .faq-item summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 15px 34px 15px 0;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--ink);
  transition: color .15s ease;
}
.prose .faq-item summary::-webkit-details-marker { display: none; }
.prose .faq-item summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 1.05rem; color: var(--brass-ink); line-height: 1;
}
.prose .faq-item[open] summary::after { content: "–"; }
.prose .faq-item summary:hover { color: var(--brass-ink); }
.prose .faq-a { padding: 0 0 16px; font-size: 0.985rem; color: var(--ink-2); }
.prose .faq-a > :first-child { margin-top: 0; }

/* Słownik */
.prose .glossary { margin: 1.6em 0; }
.prose .glossary dt {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  color: var(--ink); padding-top: 14px; border-top: 1px solid var(--rule-soft);
}
.prose .glossary dt:first-child { border-top: 0; padding-top: 0; }
.prose .glossary dd { margin: 4px 0 14px; font-size: 0.95rem; color: var(--ink-2); line-height: 1.6; }

/* Checklist */
.prose .checklist { list-style: none; padding: 0; margin: 1.5em 0; }
.prose .checklist li { position: relative; padding-left: 26px; margin-top: 7px; }
.prose .checklist li::before {
  content: ""; position: absolute; left: 2px; top: 0.5em;
  width: 10px; height: 10px; border: 1px solid var(--brass); background: transparent;
}

.prose .source-note {
  margin-top: 2.4em; padding-top: 14px; border-top: 1px solid var(--rule);
  font-size: 0.82rem; line-height: 1.55; color: var(--muted);
}
.prose .source-note a { color: var(--muted); }

/* --- Stopka artykułu ----------------------------------------------------- */
.article-foot { margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--rule); }
.related-title {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.related-list { display: grid; gap: 0; margin-bottom: 30px; }
.related-list a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 0; border-top: 1px solid var(--rule-soft);
  font-family: var(--font-display); font-size: 0.98rem; font-weight: 600;
  color: var(--ink); text-decoration: none;
  transition: color .15s ease, padding-left .18s var(--ease-out);
}
.related-list a span {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); font-weight: 400;
}
.related-list a:hover { color: var(--brass-ink); padding-left: 5px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--rule); text-decoration: none; transition: border-color .16s ease, background-color .16s ease; }
.pager a:hover { border-color: var(--brass); background: var(--bg-2); }
.pager small {
  display: block; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.pager b { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.pager .next { text-align: right; }

/* --- Stopka serwisu ------------------------------------------------------ */
.site-footer { margin-top: 40px; border-top: 1px solid var(--rule); padding: 40px 0 34px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 32px; }
.footer-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; margin: 0 0 8px; }
.footer-note { margin: 0; max-width: 40ch; font-size: 0.87rem; line-height: 1.55; color: var(--muted); }
.footer-mail { margin: 12px 0 0; font-family: var(--font-mono); font-size: 0.8rem; }
.footer-mail a { color: var(--brass-ink); }
.footer-head {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.footer-col a { display: block; font-size: 0.89rem; color: var(--ink-2); text-decoration: none; padding: 4px 0; }
.footer-col a:hover { color: var(--brass-ink); }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule-soft);
}
.footer-bottom p { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* --- Cookies ------------------------------------------------------------- */
.cookie-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 250;
  background: var(--surface); border-top: 1px solid var(--rule);
  box-shadow: 0 -8px 26px oklch(0.2 0.02 168 / 0.1);
}
.cookie-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  max-width: 1100px; margin: 0 auto; padding: 14px 22px;
}
.cookie-inner p { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--ink-2); max-width: 62ch; }
.cookie-actions { display: flex; gap: 10px; }
.cookie-actions .btn { min-height: 40px; font-size: 0.86rem; padding: 0 16px; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1180px) {
  :root { --sidebar-w: 280px; }
  .header-links { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) 252px; gap: 30px; }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .rail { max-width: 460px; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    width: min(88vw, 330px); height: calc(100dvh - var(--header-h)); max-height: calc(100dvh - var(--header-h));
    z-index: 160;
    transform: translateX(-102%);
    transition: transform .32s var(--ease-drawer);
    box-shadow: 0 0 40px oklch(0.2 0.02 168 / 0.22);
    border-right: 1px solid var(--rule);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-inner { padding-top: 18px; }
  .sidebar-search { display: block; }
  .sidebar-close {
    display: block; position: absolute; right: 14px; top: 10px;
    width: 34px; height: 34px; background: transparent; border: 1px solid var(--rule);
    border-radius: 2px; font-size: 1.2rem; line-height: 1; color: var(--ink-2); cursor: pointer;
  }
  .main { padding: 0 20px; }
  .hero { margin-top: 18px; }
  .brand-sub { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 1.125rem; }
  .app-header { gap: 10px; padding: 0 14px; }
  .brand-mark { width: 30px; height: 30px; font-size: 0.95rem; }
  .brand-name { font-size: 1rem; }
  .search { display: none; }
  .main { padding: 0 16px; }
  .hero { padding: 26px 20px 24px; margin-bottom: 32px; }
  .hero::before { inset: 7px; }
  .hero h1 { font-size: clamp(2.1rem, 10vw, 2.9rem); }
  .hero-actions { gap: 14px; margin-top: 22px; }
  .hero-actions .btn { width: 100%; }
  .rail { gap: 10px; padding: 14px 0 0 0; border-left: 0; border-top: 1px solid oklch(0.735 0.110 82 / 0.3); }
  .rail::before { display: none; }
  .rail li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; padding: 8px 0 0; border-top: 0; }
  .rail li::before { display: none; }
  .rail li:first-child { border-top: 0; }
  .rail-num { grid-row: 1 / span 2; padding: 0; }
  .rail-note { margin-left: 0; text-align: left; }
  .section-head { flex-direction: column; gap: 2px; }
  .index-item { grid-template-columns: 28px minmax(0, 1fr); padding-right: 0; }
  .article { padding-top: 22px; }
  .prose { font-size: 1.125rem; }
  .prose th, .prose td { padding: 9px 10px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .cookie-inner { padding: 12px 16px 16px; }
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1; }
}

/* --- Dostępność ruchu ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  .view > .view, .rail li { animation: none !important; opacity: 1 !important; transform: none !important; }
  .rail::before { animation: none !important; transform: none !important; }
}

@media print {
  .app-header, .sidebar, .overlay, .cookie-bar, .reading-progress, .article-foot, .site-footer { display: none !important; }
  .shell { display: block; padding-top: 0; }
  .main { padding: 0; }
  .prose { max-width: none; }
  body { background: #fff; color: #000; }
}
