/* ============================================================
   Zwierzak - design system
   Koncepcja: "Psia radosc i kocia natura"
   terakota (energia psa) + butelkowa zielen (natura kota) + krem
   Typografia: Zilla Slab (display) + Work Sans (body)
   ============================================================ */

:root {
  /* Light */
  --bg: #faf6ef;
  --bg-panel: #f3ede1;
  --bg-card: #fffdf8;
  --text: #26221c;
  --muted: #6b6357;
  --accent: #b4501f;
  --accent-hover: #9c4317;
  --accent-soft: rgba(180, 80, 31, 0.1);
  --accent-subtle: rgba(180, 80, 31, 0.28);
  --green: #3f6b4f;
  --green-soft: rgba(63, 107, 79, 0.1);
  --green-subtle: rgba(63, 107, 79, 0.28);
  --border: #e3dac8;
  --border-strong: #d5c9b0;
  --header-bg: rgba(250, 246, 239, 0.92);
  --shadow-card: 0 1px 2px rgba(38, 34, 28, 0.05), 0 4px 14px rgba(38, 34, 28, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(38, 34, 28, 0.07), 0 10px 26px rgba(38, 34, 28, 0.1);
  --warn-bg: #fdf1e3;
  --warn-border: #e0a458;
  --warn-text: #7a4a12;
  --tip-bg: #e9f0ec;
  --tip-border: #7fa88c;
  --tip-text: #2c4d38;
  --danger-text: #a03a1e;
  --radius: 14px;
  --radius-sm: 8px;
  --header-height: 60px;
  --sidebar-width: 288px;
  --transition: 0.2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171310;
    --bg-panel: #201b15;
    --bg-card: #241e17;
    --text: #ece5d8;
    --muted: #b5aa97;
    --accent: #e07b45;
    --accent-hover: #e98e5d;
    --accent-soft: rgba(224, 123, 69, 0.14);
    --accent-subtle: rgba(224, 123, 69, 0.32);
    --green: #8fb598;
    --green-soft: rgba(143, 181, 152, 0.12);
    --green-subtle: rgba(143, 181, 152, 0.3);
    --border: #33291e;
    --border-strong: #453828;
    --header-bg: rgba(23, 19, 16, 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.35), 0 10px 26px rgba(0, 0, 0, 0.4);
    --warn-bg: #2e2316;
    --warn-border: #b57f3a;
    --warn-text: #e8c088;
    --tip-bg: #1c2a21;
    --tip-border: #5d8069;
    --tip-text: #b9d4c2;
    --danger-text: #f09a7c;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  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(900px 500px at -10% -5%, var(--accent-soft), transparent 60%),
    radial-gradient(800px 480px at 110% 105%, var(--green-soft), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: "Zilla Slab", Georgia, serif;
  line-height: 1.22;
  text-wrap: balance;
  margin: 0 0 0.5em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

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

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 100;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  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-subtle), transparent);
  opacity: 0.3;
  pointer-events: none;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
}

.menu-btn {
  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: var(--radius-sm);
  cursor: pointer;
}
.menu-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity 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); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand-mark {
  font-size: 1.5rem;
  line-height: 1;
}
.brand-name {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.brand-name em {
  font-style: normal;
  color: var(--accent);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-left: auto;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input::placeholder { color: var(--muted); }
.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;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover);
  padding: 6px;
  display: none;
  max-height: 380px;
  overflow-y: auto;
  z-index: 120;
}
.search-results.open { display: block; }
.search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
}
.search-item:hover { background: var(--accent-soft); color: var(--text); }
.si-title { font-weight: 600; font-size: 0.92rem; }
.si-section { font-size: 0.75rem; color: var(--muted); }
.search-empty { padding: 12px; font-size: 0.9rem; color: var(--muted); }

.header-tagline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 8px) 20px 40px;
  gap: 28px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  align-self: flex-start;
  width: var(--sidebar-width);
  flex-shrink: 0;
  max-height: calc(100vh - var(--header-height) - 32px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  scrollbar-width: thin;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.side-group { border-bottom: 1px solid var(--border); }
.side-group:last-child { border-bottom: none; }
.side-group-title {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 8px 6px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}
.side-group-title::-webkit-details-marker { display: none; }
.side-group-title::after {
  content: "▾";
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform var(--transition);
}
.side-group:not([open]) .side-group-title::after { transform: rotate(-90deg); }
.side-group-items { padding: 2px 0 8px; }

.sidebar-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.sidebar-link .s-icon { font-size: 0.85rem; }
.sidebar-link:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(2px); }
.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

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

.main-content {
  flex: 1;
  min-width: 0;
  max-width: 860px;
}
.app-content { animation: fadeUp 0.25s ease-out; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #8f3c12 0%, #a84819 50%, var(--accent) 100%);
  color: #fff;
  padding: 48px 44px 40px;
  margin-bottom: 34px;
  box-shadow: var(--shadow-card-hover);
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 420px at 18% 25%, rgba(56, 23, 8, 0.42), transparent 65%),
    radial-gradient(520px 300px at 88% 0%, rgba(255, 255, 255, 0.1), transparent 55%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 2; max-width: 640px; }
.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.home-hero h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  color: #fff;
  margin-bottom: 0.35em;
}
.home-hero h1 .accent-word {
  color: #ffe3c9;
  font-style: italic;
  font-weight: 500;
}
.hero-sub {
  font-size: 1.08rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.94);
  margin: 0 0 26px;
  max-width: 560px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover { background: #fff7ef; color: var(--accent-hover); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Paw trail - signature */
.hero-visual {
  position: absolute;
  right: 24px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 22px;
  opacity: 0.85;
  z-index: 1;
  pointer-events: none;
}
.paw {
  width: 46px;
  height: 46px;
  color: rgba(255, 255, 255, 0.55);
  animation: pawBounce 3.2s ease-in-out infinite;
}
.paw svg { width: 100%; height: 100%; display: block; }
.paw:nth-child(1) { animation-delay: 0s; }
.paw:nth-child(2) { animation-delay: 0.4s; }
.paw:nth-child(3) { animation-delay: 0.8s; }
.paw:nth-child(4) { animation-delay: 1.2s; }
.paw:nth-child(5) { animation-delay: 1.6s; }

@keyframes pawBounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); opacity: 0.35; }
  50% { transform: translateY(-12px) rotate(4deg); opacity: 0.85; }
}

/* ---------- Home sections & cards ---------- */
.home-section { margin-bottom: 38px; }
.home-section h2 {
  font-size: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.sec-count {
  font-family: "Work Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  border: 1.5px solid var(--accent-subtle);
  border-radius: 6px;
  padding: 1px 7px;
  letter-spacing: 0.05em;
}
.sec-desc { color: var(--muted); margin: 4px 0 18px; font-size: 0.98rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.home-card {
  position: relative;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
}
.home-card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease-out;
}
.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.home-card:hover::after { transform: scaleX(1); }
.hc-icon { font-size: 1.5rem; display: block; margin-bottom: 10px; }
.home-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.35;
}
.home-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
}
.hc-more {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hc-more .arrow { transition: transform var(--transition); }
.home-card:hover .hc-more .arrow { transform: translateX(4px); }

/* ---------- Article ---------- */
.article-header { margin-bottom: 26px; }
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--border-strong); }

.article-header h1 {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.18;
  margin-bottom: 12px;
}
.article-excerpt {
  font-size: 1.08rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
  max-width: 720px;
}
.article-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.tag {
  display: inline-block;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--green-subtle);
}

.article-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 38px;
  box-shadow: var(--shadow-card);
}
.article-body h2 {
  font-size: 1.42rem;
  margin-top: 1.7em;
  padding-top: 0.4em;
  border-top: 1px solid var(--border);
}
.article-body h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.article-body h3 { font-size: 1.13rem; margin-top: 1.3em; }
.article-body p { margin: 0 0 1.1em; }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.article-body li { margin-bottom: 0.4em; }
.article-body strong { font-weight: 600; }
.article-body img { max-width: 100%; border-radius: var(--radius-sm); height: auto; }

/* TOC */
.article-toc {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 26px;
}
.article-toc summary {
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 600;
  font-size: 1.02rem;
  cursor: pointer;
  color: var(--text);
}
.article-toc ol { margin: 10px 0 2px; padding-left: 1.4em; }
.article-toc li { margin-bottom: 5px; font-size: 0.92rem; }
.article-toc a { color: var(--text); }
.article-toc a:hover { color: var(--accent); text-decoration: underline; }

/* Info boxes */
.info-box {
  background: var(--green-soft);
  border: 1px solid var(--green-subtle);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 0 1.2em;
  color: var(--text);
  font-size: 0.97rem;
}
.info-box.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn-border);
  color: var(--warn-text);
}
.info-box.tip {
  background: var(--tip-bg);
  border-color: var(--tip-border);
  border-left-color: var(--tip-border);
  color: var(--tip-text);
}
.info-box strong { font-weight: 600; }

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin: 0 0 1.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  min-width: 520px;
}
.compare-table th {
  background: var(--bg-panel);
  font-family: "Zilla Slab", Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-strong);
}
.compare-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tbody tr:hover { background: var(--accent-soft); }
.compare-table td:first-child { font-weight: 600; color: var(--green); white-space: nowrap; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--bg-panel);
}
.faq-item h3 {
  font-size: 1.04rem;
  margin: 0 0 8px;
  color: var(--accent);
}
.faq-item p { margin: 0; font-size: 0.97rem; }

/* Glossary */
.glossary dl {
  margin: 0;
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0;
}
.glossary dt {
  font-weight: 600;
  color: var(--accent);
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--border);
}
.glossary dd {
  margin: 0;
  padding: 10px 0 10px 14px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.glossary dl > div:last-child dt,
.glossary dl > div:last-child dd { border-bottom: none; }

/* Article prev/next nav */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.article-nav a {
  flex: 1;
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition);
  max-width: 48%;
}
.article-nav a:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.article-nav .an-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; }
.article-nav .an-title { font-weight: 600; font-size: 0.93rem; line-height: 1.4; }
.article-nav .next { text-align: right; margin-left: auto; }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  margin-top: 20px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 26px 20px 34px;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner strong { color: var(--text); }
.footer-note { font-size: 0.82rem; max-width: 760px; }
.footer-copy { font-size: 0.8rem; margin-top: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .header-tagline { display: none; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: min(320px, 84vw);
    max-height: none;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    transform: translateX(-102%);
    transition: transform 0.25s ease-out;
    z-index: 95;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .layout { padding-left: 16px; padding-right: 16px; gap: 0; }
  .main-content { max-width: 100%; }
  .home-hero { padding: 36px 26px 30px; }
  .hero-visual { right: 12px; bottom: 10px; gap: 12px; }
  .paw { width: 30px; height: 30px; }
  .article-body { padding: 24px 20px; }
  .glossary dl { grid-template-columns: 1fr; }
  .glossary dd { border-left: none; padding-left: 0; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .header-inner { gap: 10px; padding: 0 12px; }
  .brand-name { font-size: 1.12rem; }
  .search-input { font-size: 0.9rem; }
  .card-grid { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 1.85rem; }
  .hero-sub { font-size: 1rem; }
  .hero-cta .btn { width: 100%; text-align: center; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
  .article-nav .next { text-align: left; }
}

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