/* ============================================================
   KUCHNIAPROSTO - design system "bistro: zioła, mąka, pomidor"
   Lora (display) + Nunito Sans (body) + IBM Plex Mono (labels)
   ============================================================ */

:root {
  /* Light (domyślne) */
  --paper: #faf4e7;
  --paper-dim: #f1e9d8;
  --paper-deep: #eae0cb;
  --ink: #171310;
  --panel: #ffffff;
  --text: #2a2118;
  --text-secondary: #665c4d;
  --herb: #42601a;
  --herb-soft: #e8eeda;
  --tomato: #b8371a;
  --tomato-soft: #f9e3d8;
  --butter: #7a5a10;
  --border: #e3d9c4;
  --accent: #b8371a;
  --accent-light: #f9e3d8;
  --accent-subtle: rgba(184, 55, 26, 0.14);
  --sidebar-bg: #f5eedd;
  --header-bg: rgba(250, 244, 231, 0.92);
  --shadow-card: 0 1px 2px rgba(23, 19, 16, 0.05), 0 4px 16px rgba(23, 19, 16, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(23, 19, 16, 0.07), 0 10px 28px rgba(23, 19, 16, 0.10);
  --shadow-drop: 0 12px 40px rgba(23, 19, 16, 0.18);

  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --header-height: 60px;
  --sidebar-width: 320px;
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s ease-out;
  --content-max: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171310;
    --paper-dim: #1d1712;
    --paper-deep: #241c15;
    --ink: #ece5d6;
    --panel: #221a13;
    --text: #ece5d6;
    --text-secondary: #b0a28e;
    --herb: #a3c850;
    --herb-soft: #232b14;
    --tomato: #e5643a;
    --tomato-soft: #33201a;
    --butter: #e8b93d;
    --border: #33291e;
    --accent: #e5643a;
    --accent-light: #33201a;
    --accent-subtle: rgba(229, 100, 58, 0.16);
    --sidebar-bg: #1b1611;
    --header-bg: rgba(23, 19, 16, 0.92);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 10px 28px rgba(0, 0, 0, 0.45);
    --shadow-drop: 0 12px 40px rgba(0, 0, 0, 0.55);
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--paper);
  background-image:
    radial-gradient(1100px 500px at 88% -5%, var(--accent-subtle), transparent 60%),
    radial-gradient(900px 480px at -10% 108%, rgba(66, 96, 26, 0.10), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background 0.3s ease;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; text-wrap: balance; color: var(--text); }
a { color: var(--herb); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--tomato); color: #fff;
  padding: 10px 16px; z-index: 300; border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-height);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-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.5; pointer-events: none;
}

.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; white-space: nowrap; }
.brand a { color: var(--text); text-decoration: none; }
.brand em { font-style: normal; color: var(--accent); }
.logo-mark { font-size: 1.3rem; line-height: 1; }

.mobile-menu-btn {
  display: none;
  background: var(--paper-dim); border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 42px; height: 42px; font-size: 1.15rem; cursor: pointer; color: var(--text);
  transition: transform var(--transition), background var(--transition);
}
.mobile-menu-btn:hover { transform: scale(1.06); background: var(--paper-deep); }

.header-search { position: relative; margin-left: auto; width: min(340px, 42vw); }
.header-search input {
  width: 100%; padding: 9px 14px 9px 38px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--text); font-size: 0.95rem; font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header-search input::placeholder { color: var(--text-secondary); }
.header-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; opacity: 0.7; pointer-events: none; }

#search-results {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 300;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-drop); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
#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);
}
#search-results a:last-child { border-bottom: none; }
#search-results a:hover { background: var(--paper-dim); }
#search-results .sr-title { display: block; font-weight: 700; font-size: 0.92rem; }
#search-results .sr-excerpt { display: block; font-size: 0.8rem; color: var(--text-secondary); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: var(--header-height); left: 0; bottom: 0; width: var(--sidebar-width);
  overflow-y: auto; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  padding: 18px 14px 60px; z-index: 150; scrollbar-width: thin;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav .nav-section {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-secondary);
  margin: 22px 0 6px; padding: 0 10px;
}
.sidebar-nav .nav-section:first-of-type { margin-top: 4px; }
.sidebar-nav a {
  display: flex; gap: 8px; align-items: center;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.9rem; line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.sidebar-nav a:hover { background: var(--paper-dim); text-decoration: none; transform: translateX(2px); }
.sidebar-nav a.active {
  background: var(--accent-light); border-left-color: var(--accent); font-weight: 700;
  color: var(--text);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,0.45);
}

/* ---------- Main ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 28px) 34px 80px;
  min-height: 100vh;
  animation: fadeUp 0.26s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.content-article { max-width: var(--content-max); margin: 0 auto; }

/* ---------- Home hero ---------- */
.home-hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(520px 260px at 85% 0%, var(--tomato-soft), transparent 65%),
    radial-gradient(420px 240px at 0% 100%, var(--herb-soft), transparent 65%),
    linear-gradient(135deg, var(--paper-dim), var(--paper));
  border: 1px solid var(--border);
  padding: 44px 44px 36px;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; align-items: center;
  margin-bottom: 34px;
}
.home-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3rem); margin: 0 0 10px; letter-spacing: -0.01em;
}
.home-hero h1 em { font-style: italic; color: var(--accent); }
.home-hero .hero-lead { font-size: 1.06rem; color: var(--text-secondary); margin: 0 0 22px; max-width: 46ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 800; font-size: 0.98rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--tomato); color: #fff; box-shadow: 0 4px 14px rgba(184, 55, 26, 0.35); }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(184, 55, 26, 0.4); text-decoration: none; }
.btn-ghost { border: 1.5px solid var(--border); color: var(--text); background: var(--panel); }
.btn-ghost:hover { border-color: var(--herb); color: var(--herb); transform: translateY(-2px); text-decoration: none; }
@media (prefers-color-scheme: dark) {
  .btn-ghost { border-color: #4a3d2e; }
}

/* Garnek SVG */
.hero-art { display: flex; justify-content: center; align-items: center; }
.pot-svg { width: min(320px, 100%); height: auto; }
.pot-svg .pot-path, .pot-svg .lid-path, .pot-svg .handle-path, .pot-svg .tag-path {
  fill: none; stroke: var(--tomato); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 600; stroke-dashoffset: 600;
}
.pot-svg .lid-path { stroke: var(--herb); }
.pot-svg .handle-path { stroke: var(--butter); }
.pot-svg .tag-path { stroke: var(--herb); }
.pot-svg .pot-fill { fill: var(--tomato-soft); }
.pot-svg .steam {
  fill: none; stroke: var(--text-secondary); stroke-width: 4; stroke-linecap: round;
  opacity: 0; animation: steamRise 3.2s ease-in-out infinite;
}
.pot-svg .steam.s2 { animation-delay: 1.05s; }
.pot-svg .steam.s3 { animation-delay: 2.1s; }
.pot-svg .tag-text { font-family: var(--font-mono); font-size: 15px; font-weight: 600; fill: var(--herb); }
@keyframes steamRise {
  0% { opacity: 0; transform: translateY(6px) scaleX(0.9); }
  30% { opacity: 0.65; }
  100% { opacity: 0; transform: translateY(-20px) scaleX(1.15); }
}
.pot-drawn .pot-path, .pot-drawn .lid-path, .pot-drawn .handle-path, .pot-drawn .tag-path {
  animation: potDraw 1.4s ease-out forwards;
}
.pot-svg .pot-path { animation-delay: 0.05s; }
.pot-svg .lid-path { animation-delay: 0.4s; }
.pot-svg .handle-path { animation-delay: 0.7s; }
.pot-svg .tag-path { animation-delay: 0.95s; }
@keyframes potDraw { to { stroke-dashoffset: 0; } }

/* Stats strip (poza hero) */
.stats-strip {
  display: flex; gap: 14px; flex-wrap: wrap; margin: -18px 0 30px;
}
.stat-chip {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-size: 0.88rem; color: var(--text-secondary);
}
.stat-chip .num { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--accent); }

/* ---------- Home grid ---------- */
.home-section-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.35rem; margin: 34px 0 16px;
}
.accent-bar { width: 26px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--tomato), var(--herb)); flex: none; }

.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px;
}
.home-card {
  display: block; position: relative;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-decoration: none; color: var(--text);
}
.home-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); border-color: var(--accent-subtle); text-decoration: none; }
.home-card::before {
  content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--tomato), var(--herb));
  opacity: 0; transition: opacity var(--transition);
}
.home-card:hover::before { opacity: 1; }
.card-icon { font-size: 1.55rem; display: block; margin-bottom: 8px; }
.home-card h3 { font-size: 0.95rem; margin: 0 0 6px; line-height: 1.35; }
.home-card p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; line-height: 1.55; }

/* ---------- Article ---------- */
.content-article h1 { font-size: clamp(1.75rem, 3.6vw, 2.4rem); margin: 0 0 6px; }
.article-meta { color: var(--text-secondary); font-size: 0.98rem; margin-bottom: 22px; }

.article-toc {
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--herb);
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 20px 0 26px;
  display: flex; flex-direction: column; gap: 6px;
}
.article-toc h3 { margin: 0 0 6px; font-size: 1.02rem; }
.article-toc a { font-size: 0.92rem; color: var(--text); }
.article-toc a:hover { color: var(--accent); }
.article-toc .toc-h3 { padding-left: 18px; font-size: 0.85rem; color: var(--text-secondary); }

.content-article h2 { font-size: 1.5rem; margin: 38px 0 12px; padding-top: 8px; }
.content-article h3 { font-size: 1.18rem; margin: 26px 0 10px; }
.content-article p { margin: 0 0 16px; }
.content-article ul, .content-article ol { margin: 0 0 18px; padding-left: 24px; }
.content-article li { margin-bottom: 7px; }
.content-article strong { color: var(--text); }
.content-article blockquote {
  margin: 18px 0; padding: 14px 20px; border-left: 4px solid var(--butter);
  background: var(--paper-dim); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary); font-style: italic;
}

/* Info box */
.info-box {
  background: var(--herb-soft); border: 1px solid color-mix(in srgb, var(--herb) 30%, transparent);
  border-left: 4px solid var(--herb); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 18px 0; font-size: 0.97rem;
}
.info-box strong { color: var(--herb); }
.warn-box {
  background: var(--tomato-soft); border: 1px solid color-mix(in srgb, var(--tomato) 30%, transparent);
  border-left: 4px solid var(--tomato); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 18px 0; font-size: 0.97rem;
}
.warn-box strong { color: var(--tomato); }

/* Tables */
.table-responsive { overflow-x: auto; margin: 18px 0; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; background: var(--panel); }
.compare-table th, .compare-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.compare-table th { background: var(--paper-dim); font-family: var(--font-display); font-size: 0.98rem; font-weight: 700; }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: var(--paper-dim); }
.compare-table td:first-child { font-weight: 700; white-space: nowrap; }

/* FAQ */
.faq-item { margin: 0 0 14px; }
.faq-item details {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 16px; transition: border-color var(--transition);
}
.faq-item details:hover { border-color: var(--accent-subtle); }
.faq-item summary {
  cursor: pointer; font-weight: 800; font-size: 1.02rem; padding: 12px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.3rem; color: var(--accent); transition: transform var(--transition); }
.faq-item details[open] summary::after { transform: rotate(45deg); }
.faq-item details[open] { border-color: var(--accent); }
.faq-item .faq-a { padding: 0 0 14px; color: var(--text-secondary); font-size: 0.97rem; }

/* Glossary */
.glossary dl { margin: 0; }
.glossary dt {
  font-weight: 800; font-family: var(--font-display); font-size: 1.08rem;
  margin: 20px 0 4px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.glossary dt:first-child { border-top: none; padding-top: 0; }
.glossary dd { margin: 0 0 6px; color: var(--text-secondary); font-size: 0.97rem; }

/* Checklist */
.checklist { list-style: none; padding-left: 0; }
.checklist li { padding-left: 32px; position: relative; margin-bottom: 10px; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--herb-soft); color: var(--herb);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8rem; border: 1px solid color-mix(in srgb, var(--herb) 35%, transparent);
}

/* Prev/next */
.article-nav {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 44px;
  padding-top: 20px; border-top: 1px solid var(--border);
}
.article-nav a {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 0.9rem; color: var(--text); max-width: 46%;
  transition: border-color var(--transition), transform var(--transition);
}
.article-nav a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.article-nav .nav-label { display: block; font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 2px; }

/* Loading */
.loading { display: flex; justify-content: center; padding: 80px 0; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.site-footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--border);
  padding: 22px 34px; text-align: center;
  color: var(--text-secondary); font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .mobile-menu-btn { display: block; }
  .sidebar {
    transform: translateX(-100%); transition: transform 0.26s ease-out;
    box-shadow: var(--shadow-drop); width: min(320px, 84vw);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; padding: calc(var(--header-height) + 20px) 18px 60px; }
  .site-footer { margin-left: 0; padding: 18px; }
  .home-hero { grid-template-columns: 1fr; padding: 30px 24px 24px; }
  .hero-art { order: -1; }
  .pot-svg { width: min(220px, 70%); }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 11px; }
  .header-search { width: 44vw; }
}

@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .home-card { padding: 14px 12px 12px; }
  .home-card p { font-size: 0.8rem; }
  .hero-cta .btn-primary, .hero-cta .btn-ghost { width: 100%; justify-content: center; }
  .stats-strip { gap: 8px; }
  .stat-chip { padding: 6px 12px; font-size: 0.8rem; }
  .header-search { width: auto; flex: 1; }
  .brand { font-size: 1.15rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pot-svg .pot-path, .pot-svg .lid-path, .pot-svg .handle-path, .pot-svg .tag-path {
    stroke-dashoffset: 0;
  }
  .pot-svg .steam { opacity: 0.5; }
  html { scroll-behavior: auto; }
}
