/* ============================================================
   BankProsto - design system
   Paleta: głęboka zieleń (pieniądze, zaufanie) + złoto (wartość)
   + granatowa czerń (stabilność) + krem (ciepło)
   Typografia: Cormorant Garamond (display) + Outfit (body)
   ============================================================ */

:root {
  /* Light theme */
  --bg: #f6f4ec;
  --surface: #ffffff;
  --surface-2: #fbfaf4;
  --text: #1d2b23;
  --muted: #55655c;
  --accent: #166534;
  --accent-strong: #14532d;
  --accent-soft: #e6efe7;
  --accent-soft-2: #dceade;
  --gold: #a16207;
  --gold-soft: #f3e9d2;
  --border: #e3dfd2;
  --header-bg: rgba(246, 244, 236, 0.92);
  --shadow-card: 0 1px 2px rgba(29, 43, 35, 0.05), 0 4px 14px rgba(29, 43, 35, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(29, 43, 35, 0.06), 0 10px 26px rgba(29, 43, 35, 0.10);
  --shadow-drop: 0 8px 28px rgba(29, 43, 35, 0.14);
  --radius: 14px;
  --header-h: 64px;
  --sidebar-w: 280px;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --transition: 0.2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1512;
    --surface: #131d19;
    --surface-2: #101915;
    --text: #e6e4da;
    --muted: #9aa8a0;
    --accent: #4ade80;
    --accent-strong: #34d399;
    --accent-soft: #15241c;
    --accent-soft-2: #1b2f23;
    --gold: #e8b93d;
    --gold-soft: #2a2413;
    --border: #24332c;
    --header-bg: rgba(13, 21, 18, 0.92);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
    --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(0, 0, 0, 0.4);
    --shadow-drop: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at -10% -10%, var(--accent-soft-2) 0%, transparent 55%),
    radial-gradient(800px 480px at 110% 105%, var(--gold-soft) 0%, transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; line-height: 1.2; color: var(--text); margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent-soft-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 200;
  background: var(--accent-strong); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.app-header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 100;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-soft-2), transparent);
  opacity: 0.5; pointer-events: none;
}
.header-inner {
  max-width: 1440px; margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; align-items: center; gap: 20px;
}
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.01em;
  color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none !important;
}
.wm-accent { color: var(--accent); }
.wm-coin {
  width: 0.52em; height: 0.52em; border-radius: 50%; display: inline-block;
  background: radial-gradient(circle at 32% 28%, #f5d78a 0%, var(--gold) 55%, #7c4a05 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
}
.wm-coin::after {
  content: ''; position: absolute; width: 0.16em; height: 0.16em; border-radius: 50%;
  background: rgba(255, 255, 255, 0.65); transform: translate(-50%, -50%);
}
.wm-coin { position: relative; }

/* ---------- Search (header) ---------- */
.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
#search-input {
  width: 100%; padding: 9px 14px 9px 38px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input::placeholder { color: var(--muted); opacity: 0.85; }
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 150;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-drop); max-height: 380px; overflow-y: auto; padding: 6px;
}
.search-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 15px;
}
.search-item:hover { background: var(--accent-soft); text-decoration: none; }
.search-item .si-icon { font-size: 17px; }
.search-item .si-title { font-weight: 600; }
.search-item .si-section { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.search-empty { padding: 12px; color: var(--muted); font-size: 14.5px; }

/* ---------- Layout ---------- */
.layout { display: flex; padding-top: var(--header-h); max-width: 1440px; margin: 0 auto; min-height: calc(100vh - var(--header-h)); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 22px 18px 48px; z-index: 90;
  background: var(--surface-2); border-right: 1px solid var(--border);
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin: 0 0 6px; padding: 0 10px;
}
.sidebar-section-title::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f5d78a, var(--gold));
  flex: none;
}
.sidebar-link {
  display: block; padding: 5px 10px; font-size: 0.9rem; line-height: 1.45;
  color: var(--text); border-radius: 7px; text-decoration: none;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.sidebar-link:hover { background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; transform: translateX(2px); }
.sidebar-link.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.sidebar-overlay {
  display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 80;
  background: rgba(10, 15, 12, 0.5);
}

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
#app { max-width: 1080px; margin: 0 auto; padding: 40px 40px 90px; }

/* ---------- Hero ---------- */
.home-hero {
  padding: 56px 8px 40px; text-align: center; position: relative;
}
.home-hero .eyebrow {
  display: inline-block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 14px;
}
.home-hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.1rem); font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.home-hero .hero-sub {
  font-size: 1.12rem; color: var(--muted); max-width: 620px; margin: 0 auto 26px;
}
.hero-search {
  position: relative; max-width: 560px; margin: 0 auto;
}
.hero-search .search-icon { width: 20px; height: 20px; left: 18px; }
#hero-search {
  width: 100%; padding: 15px 20px 15px 48px; font: inherit; font-size: 16.5px;
  color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-card); transition: border-color var(--transition), box-shadow var(--transition);
}
#hero-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero-search .search-results { top: calc(100% + 8px); text-align: left; }

/* ---------- Home sections & cards ---------- */
.home-section { margin-top: 44px; animation: fadeUp 0.28s ease-out; }
.home-section-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.home-section-head h2 { font-size: 1.75rem; font-weight: 700; margin: 0; }
.home-section-head .sec-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px;
}
.home-card {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); color: var(--text); text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--accent); text-decoration: none; }
.card-icon {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: var(--gold-soft); margin-bottom: 8px; flex: none;
  transition: transform var(--transition);
}
.home-card:hover .card-icon { transform: scale(1.08); }
.home-card h3 { font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; line-height: 1.35; margin: 0; }
.home-card p { font-size: 0.85rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* ---------- Article page ---------- */
.content-article { animation: fadeUp 0.28s ease-out; }
.content-article h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); font-weight: 700; margin-bottom: 8px; }
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px;
  font-size: 0.8rem; color: var(--muted);
}
.article-meta .tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: 0.75rem;
}
.content-article h2 {
  font-size: 1.55rem; font-weight: 700; margin: 2rem 0 0.6em; padding-bottom: 0.35em;
  border-bottom: 1px solid var(--border);
}
.content-article h3 { font-family: var(--font-body); font-size: 1.12rem; font-weight: 600; color: var(--accent-strong); margin: 1.5rem 0 0.4em; }
.content-article ul, .content-article ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.content-article li { margin-bottom: 0.35em; }
.content-article ul li::marker { color: var(--accent); }
.content-article strong { font-weight: 600; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted); margin-bottom: 14px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span[aria-hidden] { color: var(--border); }

/* TOC */
.toc {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin: 18px 0 26px; font-size: 15px;
}
.toc-title { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; }
.toc a { display: inline-block; color: var(--text); padding: 2.5px 0; }
.toc a:hover { color: var(--accent); }
.toc a.active { color: var(--accent-strong); font-weight: 600; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li::marker { color: var(--gold); }

/* Info box */
.info-box {
  background: var(--accent-soft); border: 1px solid var(--accent-soft-2); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 14px 18px; margin: 1.2em 0; font-size: 15.5px;
}
.info-box strong { color: var(--accent-strong); }

/* Checklist */
.checklist { list-style: none; padding-left: 0.2em !important; }
.checklist li { padding-left: 1.9em; position: relative; margin-bottom: 0.5em; }
.checklist li::before {
  content: '✓'; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--accent);
}

/* Data table (comparisons, errors) */
.table-responsive { overflow-x: auto; margin: 1.2em 0; border-radius: 10px; border: 1px solid var(--border); }
table.data-table, table.error-table {
  width: 100%; border-collapse: collapse; font-size: 15px; min-width: 480px;
}
.data-table th, .error-table th {
  background: var(--accent-soft); color: var(--accent-strong); text-align: left;
  padding: 11px 14px; font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table td, .error-table td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.data-table tr:nth-child(even) td, .error-table tr:nth-child(even) td { background: var(--surface-2); }
.table-caption { font-size: 0.8rem; color: var(--muted); margin-top: -0.8em; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 12px;
  background: var(--surface); box-shadow: var(--shadow-card);
}
.faq-item h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.faq-item h3::before { content: 'P: '; color: var(--accent); font-weight: 700; }
.faq-item p { margin: 0; }
.faq-item p::first-letter { }

/* Glossary */
.slownik dt {
  font-weight: 600; color: var(--accent-strong); margin-top: 14px; font-size: 16px;
}
.slownik dt::before { content: '◆ '; color: var(--gold); font-size: 0.7em; vertical-align: 1px; }
.slownik dd { margin: 2px 0 0; color: var(--text); font-size: 15.5px; }

/* Steps */
.steps { counter-reset: step; list-style: none; padding-left: 0.2em !important; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6em; margin-bottom: 0.7em; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 1.7em; height: 1.7em; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 0.85em;
}

/* Related */
.related-box {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
}
.related-box h2 { font-size: 1.3rem; margin: 0 0 12px; }
.related-links { display: flex; flex-wrap: wrap; gap: 8px; }
.related-links a {
  font-size: 14.5px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}
.related-links a:hover { border-color: var(--accent); color: var(--accent-strong); transform: translateY(-1px); text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer {
  margin-left: var(--sidebar-w); border-top: 1px solid var(--border); background: var(--surface-2);
}
.footer-inner { max-width: 1080px; margin: 0 auto; padding: 34px 40px 40px; }
.footer-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin-bottom: 8px; }
.footer-disclaimer { font-size: 14px; color: var(--muted); max-width: 760px; }
.footer-copy { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* ---------- Menu toggle (mobile) ---------- */
.menu-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 10px; background: none; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
}
.menu-toggle span { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; transition: transform 0.25s ease-out, opacity 0.2s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Motion ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; margin: 0 0 10px; }
  .header-inner { flex-wrap: wrap; padding: 0 16px; height: auto; min-height: var(--header-h); padding-top: 12px; }
  .app-header { height: auto; }
  .layout { padding-top: calc(var(--header-h) + 12px); display: block; }
  .sidebar {
    transform: translateX(-100%); transition: transform 0.28s ease-out;
    box-shadow: var(--shadow-drop); z-index: 95; top: 0; width: 290px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  #app { padding: 28px 18px 70px; }
  .home-hero { padding: 44px 4px 26px; }
  .site-footer { margin-left: 0; }
  .footer-inner { padding: 28px 18px 34px; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .card-grid { grid-template-columns: 1fr; }
  .home-section-head h2 { font-size: 1.5rem; }
  .content-article h1 { font-size: 1.9rem; }
  #app { padding: 22px 14px 60px; }
  .home-hero h1 { font-size: 2.2rem; }
  .wordmark { font-size: 1.3rem; }
}
