/* ============================================================
   Sprzedaż - design system
   E-commerce / handel: zieleń pieniądza + złoto + granat + krem
   Typografia: Zilla Slab (display) + Work Sans (body)
   ============================================================ */

:root {
  /* Paleta: pieniądze i zaufanie */
  --bg: #faf6ef;              /* kremowe tło */
  --bg-alt: #f2ecdf;          /* krem ciemniejszy (sekcje, karty alt) */
  --card-bg: #fffdf8;         /* karty */
  --ink: #14211b;             /* głęboka zieleń-ink (tekst) */
  --ink-soft: #2c3a33;
  --muted: #5d6b63;           /* tekst drugorzędny (kontrast ~5:1) */
  --accent: #0b6e4f;          /* zieleń pieniądza (akcent główny) */
  --accent-strong: #085c41;
  --accent-soft: #e3efe8;     /* tło pod akcentem */
  --gold: #b07d10;            /* złoto handlu (akcent 2) */
  --gold-soft: #f5ecd7;
  --navy: #0f2a43;            /* granat (ciemne sekcje) */
  --border: #e4dccb;
  --border-strong: #d3c8b0;
  --header-bg: rgba(250, 246, 239, 0.94);
  --header-border: #e4dccb;
  --sidebar-bg: #f6f1e7;
  --shadow-card: 0 1px 2px rgba(20, 33, 27, 0.05), 0 4px 16px rgba(20, 33, 27, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(20, 33, 27, 0.07), 0 10px 28px rgba(11, 110, 79, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all .2s ease-out;
  --font-display: 'Zilla Slab', Georgia, serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --header-height: 60px;
  --maxw: 1280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1410;             /* ciemna zieleń-ink, nie odwrócone kolory */
    --bg-alt: #101b15;
    --card-bg: #14211a;
    --ink: #e9efe9;
    --ink-soft: #c9d4cc;
    --muted: #9db0a3;          /* ~7:1 na ciemnym */
    --accent: #34c98d;
    --accent-strong: #4adba0;
    --accent-soft: #123228;
    --gold: #e0b23e;
    --gold-soft: #2a2413;
    --navy: #0a1826;
    --border: #22342a;
    --border-strong: #33503f;
    --header-bg: rgba(12, 20, 16, 0.94);
    --header-border: #22342a;
    --sidebar-bg: #0f1a14;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.25);
    --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.4), 0 10px 28px rgba(52, 201, 141, 0.1);
  }
}

/* ============ Reset + base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  /* Subtelne gradienty w rogach viewportu */
  background-image:
    radial-gradient(900px 500px at -10% -10%, rgba(11, 110, 79, 0.07), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(176, 125, 16, 0.08), transparent 60%);
  background-attachment: fixed;
  transition: background-color .3s ease, color .3s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 6px;
}
.skip-link:focus { left: 8px; }

/* ============ Header ============ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
}
.app-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), transparent);
  opacity: .3;
  pointer-events: none;
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.menu-btn {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; padding: 8px; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.menu-btn span { display: block; height: 2px; width: 100%; background: var(--ink); border-radius: 2px; transition: var(--transition); }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu-btn:hover { border-color: var(--accent); }

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 22px; line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.brand-name em { font-style: normal; color: var(--accent); }

.search-wrap { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search-input {
  width: 100%; padding: 9px 14px; font-size: .92rem; font-family: var(--font-body);
  color: var(--ink); background: var(--card-bg);
  border: 1px solid var(--border-strong); border-radius: 999px;
  transition: var(--transition);
}
.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% + 6px); left: 0; right: 0; z-index: 120;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover); max-height: 380px; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.search-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--accent-soft); text-decoration: none; }
.search-item .si-title { font-weight: 600; font-size: .92rem; }
.search-item .si-section { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.search-empty { padding: 12px 14px; color: var(--muted); font-size: .9rem; }

.header-tagline {
  font-size: .8rem; color: var(--muted); font-style: italic; white-space: nowrap;
  font-family: var(--font-display);
}
@media (max-width: 760px) { .header-tagline { display: none; } }

/* ============ Layout ============ */
.layout { display: flex; max-width: var(--maxw); margin: 0 auto; padding-top: calc(var(--header-height) + 8px); }

.sidebar {
  width: 268px; flex-shrink: 0; padding: 20px 16px 40px;
  position: sticky; top: calc(var(--header-height) + 8px); height: calc(100vh - var(--header-height) - 8px);
  overflow-y: auto; border-right: 1px solid var(--border);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 16px 0 4px; padding: 0 10px;
}
.sidebar-section-label:first-child { margin-top: 0; }
.sidebar-link {
  display: flex; align-items: baseline; gap: 8px;
  font-size: .9rem; line-height: 1.35; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--ink-soft); text-decoration: none; border-left: 2px solid transparent;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.sidebar-link.active { background: var(--accent-soft); color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }
.sidebar-link .sl-icon { font-size: .85em; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10, 20, 15, 0.5); z-index: 90;
}

.main-content { flex: 1; min-width: 0; padding: 24px 32px 60px; }

/* ============ Home / hero ============ */
.home-hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius); padding: 48px 44px;
  background: linear-gradient(135deg, var(--navy) 0%, #0d3a2a 55%, var(--accent-strong) 100%);
  color: #f4f7f4; margin-bottom: 36px;
}
.home-hero::after {
  content: ''; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px;
  border-radius: 50%; background: radial-gradient(circle, rgba(224, 178, 62, 0.25), transparent 65%);
  pointer-events: none;
}
.home-hero .hero-eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold); background: rgba(224, 178, 62, 0.12); border: 1px solid rgba(224, 178, 62, 0.35);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 16px;
}
.home-hero h1 {
  font-family: var(--font-display); font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.15;
  margin: 0 0 12px; text-wrap: balance; color: #fff;
}
.home-hero p.hero-sub { font-size: 1.08rem; color: #d6e4da; max-width: 560px; margin: 0 0 20px; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.cta-primary {
  display: inline-block; padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  background: var(--gold); color: #1d1503; text-decoration: none; transition: var(--transition);
  box-shadow: 0 2px 10px rgba(224, 178, 62, 0.35);
}
.cta-primary:hover { background: #eec457; transform: translateY(-1px); text-decoration: none; box-shadow: 0 4px 16px rgba(224, 178, 62, 0.45); }
.cta-secondary {
  display: inline-block; padding: 11px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid rgba(255, 255, 255, 0.35); color: #eef4ef; text-decoration: none; transition: var(--transition);
}
.cta-secondary:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.hero-stat .hs-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: #fff; }
.hero-stat .hs-label { font-size: .78rem; color: #b9cdbf; }

.section-heading {
  font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; color: var(--ink);
  margin: 36px 0 6px; text-wrap: balance; display: flex; align-items: center; gap: 10px;
}
.section-heading .sh-icon { font-size: 1.2em; }
.section-heading::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.section-desc { color: var(--muted); font-size: .95rem; margin: 0 0 18px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.home-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-card); transition: var(--transition);
  position: relative; overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  opacity: 0; transition: var(--transition);
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); text-decoration: none; border-color: var(--border-strong); }
.home-card:hover::before { opacity: 1; }
.home-card .hc-icon { font-size: 1.35rem; line-height: 1; }
.home-card h3 { font-size: .92rem; font-weight: 600; margin: 0; line-height: 1.4; text-wrap: balance; font-family: var(--font-body); }
.home-card p { font-size: .85rem; color: var(--muted); margin: 0; line-height: 1.55; flex: 1; }
.home-card .hc-arrow { font-size: .85rem; color: var(--accent); opacity: 0; transform: translateX(-6px); transition: var(--transition); font-weight: 700; }
.home-card:hover .hc-arrow { opacity: 1; transform: translateX(0); }

/* ============ Artykuł ============ */
.article-wrap { max-width: 780px; }
.article-header { margin-bottom: 26px; }
.article-breadcrumb { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.article-breadcrumb a { color: var(--muted); }
.article-breadcrumb a:hover { color: var(--accent); }
.article-header h1 {
  font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.2;
  margin: 0 0 10px; color: var(--ink); text-wrap: balance;
}
.article-excerpt { font-size: 1.08rem; color: var(--muted); line-height: 1.6; margin: 0; }
.article-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.article-meta .am-chip {
  font-size: .75rem; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600;
}
.article-meta .am-chip.gold { background: var(--gold-soft); color: var(--gold); }

.content-article { font-size: 17px; line-height: 1.7; color: var(--ink); }
.content-article h2 {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: var(--ink);
  margin: 34px 0 12px; text-wrap: balance;
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.content-article h3 { font-size: 1.12rem; font-weight: 600; margin: 26px 0 8px; text-wrap: balance; }
.content-article p { margin: 0 0 14px; }
.content-article ul, .content-article ol { margin: 0 0 16px; padding-left: 24px; }
.content-article li { margin-bottom: 6px; }
.content-article strong { font-weight: 600; }
.content-article a { text-decoration: underline; text-underline-offset: 3px; }

/* TOC */
.toc-box {
  background: var(--bg-alt); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 24px; font-size: .92rem;
}
.toc-box strong { display: block; margin-bottom: 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc-box ol { margin: 0; padding-left: 20px; }
.toc-box li { margin-bottom: 3px; }
.toc-box a { color: var(--ink-soft); text-decoration: none; }
.toc-box a:hover { color: var(--accent); }

/* Info box, tabele, FAQ, słownik */
.info-box {
  background: var(--accent-soft); border: 1px solid rgba(11, 110, 79, 0.25);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 18px 0; font-size: .95rem;
}
.info-box strong { color: var(--accent-strong); }
.warn-box {
  background: var(--gold-soft); border: 1px solid rgba(176, 125, 16, 0.3);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 18px 0; font-size: .95rem;
}
.warn-box strong { color: var(--gold); }

.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius-sm); }
table.error-table {
  width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
table.error-table th {
  background: var(--navy); color: #eef4ef; text-align: left; padding: 10px 14px; font-weight: 600;
  font-size: .88rem; white-space: nowrap;
}
table.error-table td { padding: 9px 14px; border-top: 1px solid var(--border); vertical-align: top; }
table.error-table tr:nth-child(even) td { background: var(--bg-alt); }
table.error-table td:first-child { font-weight: 600; white-space: nowrap; }

.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; margin: 10px 0; background: var(--card-bg); }
.faq-item h3 { margin: 0 0 6px; font-size: 1.02rem; }
.faq-item p { margin: 0; font-size: .95rem; }

.glossary dl { margin: 0; }
.glossary dt { font-weight: 600; margin-top: 14px; color: var(--ink); font-size: 1rem; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0; color: var(--ink-soft); font-size: .95rem; }

/* ============ 404 / brak wyników ============ */
.not-found { text-align: center; padding: 60px 20px; }
.not-found .nf-icon { font-size: 3rem; }
.not-found h1 { font-family: var(--font-display); }

/* ============ Footer ============ */
.app-footer {
  border-top: 1px solid var(--border); background: var(--bg-alt); margin-top: 20px;
}
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 32px; font-size: .9rem; color: var(--ink-soft); }
.footer-inner p { margin: 0 0 10px; max-width: 760px; }
.footer-note { font-size: .8rem; color: var(--muted); }
.footer-copy { font-size: .8rem; color: var(--muted); }

/* ============ Responsywność ============ */
@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 110;
    width: 290px; max-width: 85vw; height: 100vh;
    background: var(--sidebar-bg); border-right: 1px solid var(--border);
    transform: translateX(-105%); transition: transform .25s ease-out;
    padding-top: calc(var(--header-height) + 12px);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.15); }
  .sidebar-overlay.show { display: block; }
  .main-content { padding: 20px 18px 48px; }
  .search-wrap { max-width: none; }
}
@media (max-width: 600px) {
  .home-hero { padding: 34px 22px; }
  .home-hero h1 { font-size: 1.7rem; }
  .card-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 1.05rem; }
  .hero-stats { gap: 16px; }
}

/* ============ Animacje ============ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-enter { animation: fadeUp .25s ease-out; }
.home-card { animation: fadeUp .25s ease-out both; }
.home-card:nth-child(2) { animation-delay: .03s; }
.home-card:nth-child(3) { animation-delay: .06s; }
.home-card:nth-child(4) { animation-delay: .09s; }

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

/* Focus visible */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
