/* ============================================================
   PRAWO PRACY PROSTO - design system
   Paleta: granat (zaufanie) + burgund (powaga) + złoto (prestiż)
   na kremowym papierze. Typografia: Spectral / Work Sans / IBM Plex Mono.
   ============================================================ */

:root {
  /* Paleta świetlna */
  --paper: #f7f3ec;            /* kremowy papier */
  --paper-2: #efe9dd;          /* karty */
  --ink: #1e2430;              /* grafitowy tekst */
  --ink-soft: #454c5c;         /* tekst drugorzędny */
  --ink-faint: #6b7280;        /* tekst trzeciorzędny */
  --navy: #141c2b;             /* granat atramentowy */
  --navy-2: #1c2740;           /* granat paneli */
  --navy-3: #243250;           /* granat hover */
  --burgundy: #7f1d2e;         /* burgund - akcent główny */
  --burgundy-hover: #931f33;
  --gold: #c9a05e;             /* złoto - akcent 2 */
  --gold-ink: #9a7428;         /* złoto jako tekst na jasnym tle */
  --border: #e0d8c8;
  --border-strong: #cbbfa8;

  /* Elementy */
  --radius: 14px;
  --radius-sm: 8px;
  --header-height: 62px;
  --sidebar-width: 300px;
  --transition: all .2s ease-out;

  --accent: var(--burgundy);
  --accent-gradient: linear-gradient(135deg, #7f1d2e, #a02639);
  --accent-subtle: rgba(127, 29, 46, 0.09);
  --accent-light: rgba(201, 160, 94, 0.55);

  --text: var(--ink);
  --text-secondary: var(--ink-soft);
  --bg: var(--paper);

  --shadow-card: 0 1px 3px rgba(20, 28, 43, 0.06), 0 4px 16px rgba(20, 28, 43, 0.05);
  --shadow-card-hover: 0 4px 12px rgba(20, 28, 43, 0.10), 0 10px 28px rgba(20, 28, 43, 0.10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --paper: #0f1420;
    --paper-2: #161d2e;
    --ink: #e8e4da;
    --ink-soft: #b9bcc6;
    --ink-faint: #8f94a1;
    --navy: #141c2b;
    --navy-2: #1a2336;
    --navy-3: #22304a;
    --burgundy: #b03046;
    --burgundy-hover: #c23a52;
    --gold: #d4ab66;
    --gold-ink: #d4ab66;
    --border: #26304a;
    --border-strong: #33405e;
    --accent-subtle: rgba(176, 48, 70, 0.16);
    --accent-light: rgba(212, 171, 102, 0.35);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Work Sans', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--accent-light) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 0% 100%, var(--accent-light) 0%, transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--burgundy); text-decoration: none; }
a:hover { color: var(--burgundy-hover); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-family: 'Spectral', Georgia, serif; line-height: 1.25; text-wrap: balance; }

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

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

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: var(--navy);
  border-bottom: 1px solid rgba(201, 160, 94, 0.25);
  backdrop-filter: blur(8px);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  opacity: .35; pointer-events: none;
}

.brand { display: flex; align-items: center; }
.brand a { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand-mark { font-size: 1.35rem; line-height: 1; }
.brand-name {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 600; font-size: 1.2rem; letter-spacing: .3px; white-space: nowrap;
}
.brand-accent { color: var(--gold); font-weight: 700; }

.header-search {
  position: relative; flex: 1; max-width: 460px; margin-left: auto;
}
.header-search .search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: .95rem; opacity: .8; }
#search-input {
  width: 100%; padding: 10px 14px 10px 38px;
  font-family: inherit; font-size: .95rem; color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 999px;
  transition: var(--transition);
}
#search-input::placeholder { color: rgba(255, 255, 255, 0.55); }
#search-input:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, 0.13); }

#search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 120;
  background: var(--paper-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover); overflow: hidden; display: none;
}
#search-results a {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border); transition: background .15s;
}
#search-results a:last-child { border-bottom: none; }
#search-results a:hover { background: var(--accent-subtle); }
.sr-title { display: block; font-weight: 600; font-size: .92rem; }
.sr-excerpt { display: block; font-size: .8rem; color: var(--text-secondary); }

.mobile-menu-btn {
  display: none;
  background: none; border: 1px solid rgba(255, 255, 255, 0.2); color: #fff;
  font-size: 1.15rem; width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
  transition: var(--transition);
}
.mobile-menu-btn:hover { border-color: var(--gold); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 90;
  width: var(--sidebar-width);
  background: var(--navy);
  overflow-y: auto; padding: 18px 0 30px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }

.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 20px 7px 22px;
  font-size: .9rem; line-height: 1.35; color: #c9cdd6;
  border-left: 3px solid transparent;
  transition: var(--transition); text-decoration: none;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; text-decoration: none; border-left-color: var(--gold); }
.sidebar-nav a.active { background: rgba(201, 160, 94, 0.12); color: #fff; border-left-color: var(--gold); font-weight: 600; }
.sidebar-nav a.nav-home { font-weight: 600; color: #fff; }

.nav-section {
  padding: 16px 20px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--gold); font-weight: 500;
}

.sidebar-ad { padding: 20px 20px 0; }

.ad-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; aspect-ratio: 3 / 2; max-height: 260px;
  background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 10px, var(--border) 10px, var(--border) 20px);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--ink-faint); font-size: .8rem; font-weight: 600;
}
.ad-placeholder span { font-family: 'IBM Plex Mono', monospace; font-size: .72rem; font-weight: 400; }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 30px) 36px 60px;
  max-width: 980px;
}

.content-article { animation: fadeUp .28s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Hero (home) ---------- */
.home-hero {
  position: relative;
  background: var(--navy);
  background-image:
    radial-gradient(ellipse 70% 90% at 85% 10%, rgba(201, 160, 94, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 80% at 10% 100%, rgba(127, 29, 46, 0.35), transparent 60%);
  border-radius: var(--radius);
  border: 1px solid rgba(201, 160, 94, 0.2);
  padding: 42px 42px 34px;
  color: #fff;
  overflow: hidden;
}

.hero-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .75rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(201, 160, 94, 0.4);
  border-radius: 999px; padding: 4px 12px; margin-bottom: 18px;
}

.home-hero h1 {
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 700; color: #fff !important; margin-bottom: 10px;
}
.hero-accent { color: var(--gold); }

.hero-sub {
  font-size: 1.05rem; line-height: 1.6; color: #c9cdd6 !important;
  max-width: 560px; margin-bottom: 22px;
}

.stats-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm); padding: 12px 20px;
  display: flex; flex-direction: column; align-items: center; min-width: 110px;
  transition: var(--transition);
}
.stat-card:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.stat-card .num { font-family: 'Spectral', Georgia, serif; font-size: 1.7rem; font-weight: 700; color: var(--gold); line-height: 1.1; }
.stat-card .label { font-size: .78rem; color: #aeb3bf; text-transform: uppercase; letter-spacing: .8px; }

/* Signature: paragraf + pieczęć */
.hero-seal { margin-top: 26px; }
.hero-seal svg { width: 100%; max-width: 620px; height: auto; display: block; }

.paragraf-symbol { transform-origin: center; transform-box: fill-box; animation: stampIn .5s cubic-bezier(.2, 1.4, .4, 1) .15s both; }
@keyframes stampIn { 0% { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.doc-line { stroke-dasharray: 220; stroke-dashoffset: 220; animation: drawLine .8s ease-out forwards; }
.doc-line.l2 { animation-delay: .25s; }
.doc-line.l3 { animation-delay: .5s; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

.seal-glow { animation: sealGlow 2.6s ease-in-out .8s infinite; }
@keyframes sealGlow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- Section labels + grid ---------- */
.home-section-label {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.45rem; font-weight: 600;
  margin: 44px 0 18px; color: var(--text);
}
.accent-bar { width: 6px; height: 26px; border-radius: 3px; background: var(--accent-gradient); flex-shrink: 0; }

.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}

.home-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  color: var(--text); text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-gradient); opacity: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: opacity var(--transition);
}
.home-card:hover::before { opacity: 1; }

.card-icon { font-size: 1.35rem; line-height: 1; }
.home-card h3 { font-size: .95rem; font-weight: 600; color: var(--text); font-family: 'Work Sans', sans-serif; line-height: 1.35; }
.home-card p { font-size: .85rem; line-height: 1.5; color: var(--text-secondary); }
.card-arrow {
  position: absolute; right: 14px; top: 16px;
  font-size: 1rem; color: var(--gold-ink);
  opacity: 0; transform: translateX(-6px);
  transition: var(--transition);
}
.home-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Article page ---------- */
.content-article h1 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700; margin-bottom: 10px; color: var(--text);
}

.article-meta {
  font-size: .98rem; color: var(--text-secondary);
  border-left: 3px solid var(--gold);
  padding-left: 14px; margin-bottom: 26px; line-height: 1.55;
}

.article-toc {
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 28px;
}
.article-toc h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .75rem; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold-ink); margin-bottom: 12px;
}
.article-toc a {
  display: block; padding: 3px 0;
  font-size: .9rem; color: var(--text-secondary); text-decoration: none;
  border-left: 2px solid transparent; padding-left: 10px;
  transition: var(--transition);
}
.article-toc a:hover { color: var(--burgundy); border-left-color: var(--gold); }
.article-toc a.toc-h3 { padding-left: 24px; font-size: .85rem; }
.article-toc a.active { color: var(--burgundy); border-left-color: var(--burgundy); font-weight: 600; }

.content-article h2 {
  font-size: 1.5rem; font-weight: 600;
  margin: 38px 0 14px; padding-top: 6px; color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.content-article h2::before { content: '§ '; color: var(--gold-ink); font-weight: 700; }
.content-article h3 {
  font-size: 1.18rem; font-weight: 600;
  margin: 26px 0 10px; color: var(--text);
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.content-article p { margin-bottom: 14px; color: var(--text); }
.content-article strong { font-weight: 600; }
.content-article ul, .content-article ol { margin: 0 0 16px 24px; color: var(--text); }
.content-article li { margin-bottom: 6px; }
.content-article li::marker { color: var(--burgundy); }

/* ---------- Info box ---------- */
.info-box {
  background: var(--accent-subtle);
  border: 1px solid rgba(127, 29, 46, 0.25);
  border-left: 4px solid var(--burgundy);
  border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 18px 0;
  font-size: .95rem; color: var(--text);
}
.info-box strong { color: var(--burgundy); }
.info-box p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius-sm); }

table.compare-table, table.error-table {
  width: 100%; border-collapse: collapse;
  font-size: .92rem; background: var(--paper-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.compare-table th, .error-table th {
  background: var(--navy); color: #fff;
  font-family: 'Work Sans', sans-serif; font-weight: 600;
  text-align: left; padding: 11px 14px; font-size: .9rem;
}
.compare-table td, .error-table td {
  padding: 10px 14px; border-top: 1px solid var(--border);
  color: var(--text); vertical-align: top;
}
.compare-table tr:nth-child(even) td, .error-table tr:nth-child(even) td { background: rgba(0, 0, 0, 0.02); }
.compare-table tr:hover td, .error-table tr:hover td { background: var(--accent-subtle); }
.compare-table td:first-child { font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .compare-table tr:nth-child(even) td, .error-table tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }
}

/* ---------- FAQ ---------- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 12px; overflow: hidden;
  transition: var(--transition);
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-q {
  font-weight: 600; font-size: .98rem; color: var(--text);
  padding: 14px 18px; cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-q::after { content: '+'; font-size: 1.3rem; color: var(--gold-ink); transition: var(--transition); flex-shrink: 0; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a { display: none; padding: 0 18px 16px; font-size: .95rem; color: var(--text-secondary); line-height: 1.65; }
.faq-item.open .faq-a { display: block; animation: fadeUp .2s ease-out; }
.faq-a p { margin-bottom: 8px; }

/* ---------- Glossary ---------- */
.glossary-list { background: var(--paper-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 20px; }
.glossary-list dl { margin: 0; }
.glossary-list dt {
  font-weight: 600; color: var(--burgundy);
  font-size: 1rem; padding: 14px 0 2px;
  border-bottom: 1px dashed var(--border);
}
.glossary-list dt:first-child { padding-top: 14px; }
.glossary-list dd { padding: 4px 0 12px; color: var(--text-secondary); font-size: .93rem; }

/* ---------- Footer ---------- */
.app-footer {
  margin-left: var(--sidebar-width);
  background: var(--navy);
  color: #aeb3bf;
  padding: 34px 36px 40px;
}
.footer-inner { max-width: 900px; }
.footer-brand { font-family: 'Spectral', Georgia, serif; font-size: 1.15rem; font-weight: 600; color: #fff; margin-bottom: 8px; }
.footer-desc { font-size: .88rem; line-height: 1.6; max-width: 640px; margin-bottom: 10px; }
.footer-note { font-size: .82rem; color: #8f94a1; }
.footer-note a { color: var(--gold); }

/* ---------- Ad leaderboard ---------- */
.ad-leaderboard {
  margin-left: var(--sidebar-width);
  padding: 16px 36px 0; max-width: 980px;
}
.ad-leaderboard .ad-placeholder { aspect-ratio: auto; height: 90px; max-height: 90px; }

/* ---------- 404 ---------- */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 h1 { font-size: 4rem; color: var(--burgundy); margin-bottom: 6px; }
.error-404 p { color: var(--text-secondary); margin-bottom: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .main { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 900px) {
  .mobile-menu-btn { display: block; }
  .brand-name { font-size: 1.05rem; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed; inset: var(--header-height) 0 0 0; z-index: 85;
    background: rgba(10, 14, 22, 0.55);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  .main { margin-left: 0; padding: calc(var(--header-height) + 22px) 18px 50px; }
  .app-footer { margin-left: 0; padding: 28px 18px 34px; }
  .ad-leaderboard { margin-left: 0; padding: 12px 18px 0; }

  .home-hero { padding: 30px 24px 26px; }
  .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .header-search { max-width: none; }
  .brand-name { font-size: .98rem; }
  .home-hero h1 { font-size: 1.8rem; }
  .stats-row { gap: 10px; }
  .stat-card { min-width: 90px; padding: 10px 14px; }
  .stat-card .num { font-size: 1.4rem; }
  .home-section-label { font-size: 1.25rem; }
  .content-article h2 { font-size: 1.3rem; }
  .content-article h1 { font-size: 1.6rem; }
}

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