:root{--kk-accent:#e9dcc5;--kk-border:#e5e7eb;--kk-text:#111827;--kk-muted:#6b7280;--kk-bg:#fff;--kk-secbg:#fff}
.kb-hero{max-width:86ch;margin:12px auto 8px;padding:12px 16px;text-align:center}
.kb-hero .title{font-family:ui-serif,Georgia,'Times New Roman',Times,serif;font-size:clamp(24px,3.4vw,40px);font-weight:700;color:var(--kk-text)}
.kb-hero .subtitle{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,Noto Sans,'Helvetica Neue';color:var(--kk-muted);margin-top:4px;font-size:clamp(13px,1.9vw,18px)}
.kb-toolbar{max-width:86ch;margin:0 auto;padding:0 16px 8px;display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}
#kk-search{flex:1;min-width:220px;border:1px solid var(--kk-border);border-radius:12px;padding:8px 12px}
.kk-tools{display:flex;gap:8px;flex-wrap:wrap}
.kk-btn{border:1px solid var(--kk-border);border-radius:12px;background:var(--kk-bg);padding:8px 12px;cursor:pointer;white-space:nowrap}
.kk-btn:hover{background:var(--kk-accent)}
.kb-toc{position:sticky;top:0;background:var(--kk-bg);border-bottom:1px solid var(--kk-border);z-index:2}
.kb-toc .toc-toggle{display:none;margin:8px 12px;padding:8px 12px;border:1px solid var(--kk-border);border-radius:12px;background:var(--kk-accent)}
.kb-toc ul{list-style:none;margin:8px 12px;padding-left:0}
.kb-toc .toc{margin:0}
.kb-toc .toc li{margin:4px 0}
.kb-toc .toc a{text-decoration:none;padding:4px 8px;border-radius:8px;border:1px solid var(--kk-border);display:inline-block}
.kb-toc .toc a:hover{background:var(--kk-accent)}
.kb-toc .toc-l2{padding-left:16px}
.kb-toc .toc-l3{padding-left:32px}
.kb-article{max-width:78ch;margin:0 auto;padding:12px 16px;line-height:1.7;color:var(--kk-text);word-break:break-word}
.kb-article img{max-width:100%;height:auto;border-radius:12px}
.kb-article details.kb-section{border:1px solid var(--kk-border);border-radius:14px;padding:8px 12px;margin:14px 0;background:var(--kk-secbg)}
.kb-article summary{cursor:pointer;font-weight:700;outline:none}
.kb-article table{width:100%;border-collapse:collapse;margin:12px 0;word-break:break-word}
.kb-article th,.kb-article td{border:1px solid var(--kk-border);padding:8px 10px;text-align:left}
.kb-article th{background:#f8f8f8}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:10px;border:1px solid var(--kk-border);background:#fff}
.table-scroll table{min-width:0}
.kk-video iframe{width:100%;height:360px;border:0;border-radius:12px}
@media(max-width:600px){.kk-video iframe{height:220px}}
.kb-toc.mode-compact .toc.toc-l2,.kb-toc.mode-compact .toc.toc-l3{display:none}
@media(min-width:821px){.kb-toc.mode-hidden_desktop{display:none}}
.kb-toc.theme-contrast{background:#111;border-color:#000}
.kb-toc.theme-contrast .toc-toggle{background:#222;color:#fff;border-color:#333}
.kb-toc.theme-contrast a{color:#fff;border-color:#333}
.kb-toc.theme-contrast a:hover{background:#333}
.btn-print{display:inline-block;padding:10px 14px;border-radius:10px;border:1px solid var(--kk-border);text-decoration:none}
.btn-print:hover{background:var(--kk-accent)}
/* PRZEPIS */
.kk-recipe{max-width:86ch;margin:0 auto;padding:8px 0}
.kk-recipe-head h1{margin:0 0 4px;font-size:clamp(20px,3vw,28px)}
.kk-recipe-head .muted{color:var(--kk-muted);margin-bottom:8px}
.kk-recipe-grid{display:grid;grid-template-columns:1fr;gap:12px}
.kk-table{width:100%;border-collapse:collapse;table-layout:auto}
.kk-table td,.kk-table th{border:1px solid var(--kk-border);padding:8px 10px;vertical-align:top;word-break:break-word}
.kk-recipe-notes{margin-top:12px}
.kk-recipe-list{display:grid;gap:8px}
.kk-recipe-item{padding:8px 10px;border:1px solid var(--kk-border);border-radius:10px}
@media(max-width:820px){.kb-toc .toc-toggle{display:inline-block}.kb-toc ul{display:none}.kb-toc.open ul{display:block}}
@media print{.kb-hero,.kb-toolbar,.kb-toc,.site-header,.site-footer,nav,.widget,.menu,.btn-print{display:none !important}.kb-article,.recipe-print{max-width:none;padding:0}details.kb-section{border:0;padding:0;margin:0}summary{font-weight:700}img{page-break-inside:avoid}.kk-recipe-grid{grid-template-columns:1fr}}
.kk-factor-badge{display:inline-block;border:1px dashed var(--kk-border);border-radius:10px;padding:2px 8px;margin-left:6px;color:var(--kk-muted)}

/* Multiplier UX improvements */
.kk-scale{padding-left:8px}
.kk-sbtn{min-width:44px}
.kk-sbtn.active{background:#fee2e2;border-color:#ef4444;color:#b91c1c;font-weight:700}
.kk-factor-badge.alert{background:#fee2e2;border-color:#ef4444;color:#b91c1c}

/* 1.8.8 mobile paddings */
.kk-recipe-grid, .kk-recipe-grid h2, .kk-recipe-grid h3{padding-left:10px;padding-right:10px}
.kk-table{margin-left:8px;margin-right:8px}
@media (max-width:480px){ .kk-scale{padding-left:10px;padding-right:10px} }
.kk-audit-details{margin-top:6px;display:block}
.kk-audit-grid{display:grid;grid-template-columns:repeat(12,auto);gap:6px;align-items:center}
.kk-audit-grid input{max-width:80px}
.kk-summary{margin:10px 8px 20px;padding:10px;border:1px solid var(--kk-border);border-radius:12px;background:var(--kk-bg)}
.kk-summary table{width:100%}
.kk-summary th,.kk-summary td{padding:6px;border-bottom:1px solid var(--kk-border)}


/* KKC 1.9.3-hotfix — mobile margins & table wrapping */
.kkc-wrap, .kompendium-kota, .entry-content .kompendium-kota { padding-inline: clamp(12px, 3vw, 28px); }
.kkc-header, .kkc-notes, .kkc-audit, .kkc-print-buttons { padding-inline: clamp(12px, 3vw, 28px); }
.kkc-print-buttons { display:flex; flex-wrap:wrap; gap:8px }
table { table-layout: fixed; width:100%; border-collapse: collapse; }
table th, table td { word-break: break-word; vertical-align: top; }
@media (max-width: 430px){
  table th, table td { padding: 8px 6px; }
  .kkc-header, .kkc-notes, .kkc-audit { padding-inline: clamp(12px, 4vw, 22px); }
}



/* KKC 1.9.3-hotfix5 — scope to single kk_recipe (correct selectors) */
body.single-kk_recipe .kk-recipe { padding-inline: clamp(14px, 3.5vw, 28px); box-sizing: border-box; }
body.single-kk_recipe .kk-recipe-head,
body.single-kk_recipe .kk-scale,
body.single-kk_recipe .kk-audit,
body.single-kk_recipe .kk-recipe-notes,
body.single-kk_recipe .kk-printbar { padding-inline: clamp(14px, 3.5vw, 28px); }

/* Tables in recipe: full-width, wrap text, no horizontal scroll */
body.single-kk_recipe .table-scroll { overflow-x: visible !important; }
body.single-kk_recipe .kk-table { width: 100% !important; table-layout: fixed !important; }
body.single-kk_recipe .kk-table th,
body.single-kk_recipe .kk-table td { word-break: break-word; white-space: normal !important; }

@media (max-width: 430px){
  body.single-kk_recipe .kk-recipe,
  body.single-kk_recipe .kk-recipe-head,
  body.single-kk_recipe .kk-scale,
  body.single-kk_recipe .kk-audit,
  body.single-kk_recipe .kk-recipe-notes,
  body.single-kk_recipe .kk-printbar {
    padding-inline: clamp(12px, 5vw, 22px);
  }
}

/* Multiplier UX — keep within kk_recipe only */
body.single-kk_recipe .kk-scale .kk-scale-btns { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 6px 0; }
body.single-kk_recipe .kk-scale .kk-sbtn { min-width: 44px; border-radius: 999px; }
body.single-kk_recipe .kk-scale .kk-sbtn.active { background: var(--kk-accent, #ed9cc5); border-color: var(--kk-accent, #ed9cc5); color: #fff; font-weight: 700; }




body.single-kk_recipe .kk-printbar .kkc-print-extra { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; }
body.single-kk_recipe .kk-printbar .kkc-btn {
  border: 1px solid rgba(0,0,0,.15); background:#fff; border-radius: 8px; padding: 6px 10px;
  cursor:pointer; font-size: 13px; line-height: 1;
}
body.single-kk_recipe .kk-printbar .kkc-btn:hover { background:#f6f6f6; }



/* KKC 1.9.3-hotfix7 — simple Back button + print filters */
body.single-kk_recipe .kkc-fab{
  position: fixed; left: 12px; bottom: 16px; z-index: 1000;
  display:inline-block; padding:8px 12px; border-radius:999px;
  background:#222; color:#fff; text-decoration:none; font-size:13px; line-height:1;
}
body.single-kk_recipe .kkc-fab:hover{ background:#000; }

@media print { .kkc-fab{ display:none !important; } }

/* Print filters */
@media print {
  body.kkc-print-ingredients .kk-supplements,
  body.kkc-print-ingredients .kk-audit,
  body.kkc-print-ingredients .kk-recipe-notes,
  body.kkc-print-ingredients .kk-printbar { display: none !important; }

  body.kkc-print-shopping .kk-supplements,
  body.kkc-print-shopping .kk-audit,
  body.kkc-print-shopping .kk-recipe-notes,
  body.kkc-print-shopping .kk-printbar { display: none !important; }
  body.kkc-print-shopping .kk-ingredients .col-action,
  body.kkc-print-shopping .col-action { display: none !important; }

  body.kkc-print-supplements .kk-ingredients,
  body.kkc-print-supplements .kk-audit,
  body.kkc-print-supplements .kk-recipe-notes,
  body.kkc-print-supplements .kk-printbar { display: none !important; }
}

body.single-kk_recipe .kk-printbar .kkc-print-extra { display:inline-flex; gap:6px; flex-wrap:wrap; margin-left:8px; }
body.single-kk_recipe .kk-printbar .kkc-btn{
  border:1px solid rgba(0,0,0,.15); background:#fff; border-radius:8px;
  padding:6px 10px; cursor:pointer; font-size:13px; line-height:1;
}
body.single-kk_recipe .kk-printbar .kkc-btn:hover{ background:#f6f6f6; }



/* KKC 1.9.3-hotfix11-stable — lightbox for Kompendium */
.kkc-lightbox{ position:fixed; inset:0; background:rgba(0,0,0,.92); display:none; align-items:center; justify-content:center; z-index:9999; }
.kkc-lightbox.open{ display:flex; }
.kkc-lightbox img{ max-width:95vw; max-height:90vh; }
.kkc-lightbox .kkc-close{ position:absolute; top:12px; right:14px; color:#fff; font-size:28px; cursor:pointer; }
@media print{ .kkc-lightbox{ display:none !important; } }



/* KKC 1.9.3-hotfix12 — Kompendium images (responsive + optional sizes) */
.kb-article img{
  max-width: 100% !important;
  height: auto !important;
  width: auto;
  display: block;
  margin: 10px auto;
}
.kb-article figure{ margin: 12px 0; }
.kb-article .kkc-img-sm{ max-width: 280px; }
.kb-article .kkc-img-md{ max-width: 420px; }
.kb-article .kkc-img-lg{ max-width: 640px; }
@media (max-width: 430px){
  .kb-article img{ max-height: 60vh; object-fit: contain; }
}



/* KKC 1.9.3-hotfix14 — mobile UX tweaks */
@media (max-width: 430px){
  .kk-scale{ display:flex; flex-wrap:wrap; gap:6px; }
  .kk-scale .kk-sbtn{ padding:8px 10px; min-width: 42px; min-height: 36px; border-radius: 8px; }
  .kk-printbar{ position: sticky; bottom: 0; background: #fff; padding: 8px 6px; border-top: 1px solid rgba(0,0,0,.08); z-index: 5; }
}
/* Accent for active multiplier from CSS var (fallback to accent color) */
.kk-scale .kk-sbtn.active{ background: var(--kkc-accent, #e9dcc5); }



/* KKC 1.9.3-hotfix15 — Anti-FOUC + Print refinements */

/* Anti-FOUC: start with sections collapsed until JS marks enhanced.
   Extremely conservative selectors to avoid breaking other pages. */
html:not(.kkc-enhanced) .kk-accordion .kk-panel,
html:not(.kkc-enhanced) .kkc-acc .acc-body,
html:not(.kkc-enhanced) .kk-sections .section-body { display:none; }

/* Print modes */
@media print{
  /* Common cleanup */
  .kk-printbar{ display:none !important; }
  header, nav, footer{ display:none !important; }
}

/* INGREDIENTS ONLY */
@media print{
  body.kkc-print-ingredients .kk-recipe-grid{ display:block !important; }
  body.kkc-print-ingredients .kk-recipe-grid > div:nth-child(2),
  body.kkc-print-ingredients .kk-recipe-audit,
  body.kkc-print-ingredients .kk-recipe-notes{ display:none !important; }
  /* hide Akcja col */
  body.kkc-print-ingredients .kk-table thead th:nth-child(3),
  body.kkc-print-ingredients .kk-table tbody td:nth-child(3){ display:none !important; }
}

/* SHOPPING (names only) */
@media print{
  body.kkc-print-shopping .kk-recipe-grid{ display:block !important; }
  body.kkc-print-shopping .kk-recipe-grid > div:nth-child(2),
  body.kkc-print-shopping .kk-recipe-audit,
  body.kkc-print-shopping .kk-recipe-notes{ display:none !important; }
  /* keep only 1st column (Nazwa) */
  body.kkc-print-shopping .kk-table thead th:nth-child(2),
  body.kkc-print-shopping .kk-table thead th:nth-child(3),
  body.kkc-print-shopping .kk-table tbody td:nth-child(2),
  body.kkc-print-shopping .kk-table tbody td:nth-child(3){ display:none !important; }
}

/* SUPPLEMENTS ONLY */
@media print{
  body.kkc-print-supplements .kk-recipe-grid{ display:block !important; }
  body.kkc-print-supplements .kk-recipe-grid > div:nth-child(1),
  body.kkc-print-supplements .kk-recipe-audit,
  body.kkc-print-supplements .kk-recipe-notes{ display:none !important; }
  /* hide Akcja for clean list */
  body.kkc-print-supplements .kk-table thead th:nth-child(3),
  body.kkc-print-supplements .kk-table tbody td:nth-child(3){ display:none !important; }
}



/* KKC 1.9.3-hotfix16 — color tags */
.kkc-tag.kkc-red{ color:#c0392b !important; }
.kkc-tag.kkc-green{ color:#2e7d32 !important; }
.kkc-tag.kkc-blue{ color:#1565c0 !important; }
.kkc-tag.kkc-orange{ color:#ef6c00 !important; }
@media print{
  .kkc-tag.kkc-red{ color:#b71c1c !important; }
  .kkc-tag.kkc-green{ color:#1b5e20 !important; }
  .kkc-tag.kkc-blue{ color:#0d47a1 !important; }
  .kkc-tag.kkc-orange{ color:#e65100 !important; }
  /* Ensure Akcja and Notatki stay visible by default */
  body:not(.kkc-print-shopping) .kk-recipe-notes{ display: block !important; }
}





/* KKC 1.9.3-hotfix19 — remove lightbox; responsive images */
.kkc-content img, .entry-content img{
  max-width:100%;
  height:auto;
}
/* remove zoom cursor leftovers */
.kkc-content img{ cursor: default; }


/* KKC 1.9.3-hotfix20 — robust image containment */
.kkc-content, .entry-content{
  overflow-x: hidden;
}
/* contain images coming from classic editor, Gutenberg, lists, tables */
.kkc-content img,
.entry-content img,
.kkc-content .wp-block-image img,
.entry-content .wp-block-image img,
.kkc-content p > img,
.entry-content p > img,
.kkc-content li img,
.entry-content li img,
.kkc-content table img,
.entry-content table img{
  display:block;
  width:100% !important;
  max-width:100% !important;
  height:auto !important;
  margin:0 auto 1rem;
  float:none !important;
  object-fit:contain;
}
.kkc-content figure, .entry-content figure{
  max-width:100%;
  margin-left:0; margin-right:0;
}
/* prevent any container from stretching beyond layout */
.kkc-section, .kkc-card, .kkc-accordion, .kkc-accordion .kkc-panel, .kkc-accordion .kkc-panel-content{
  max-width:100%;
  overflow-x:hidden;
}
/* cursor normalization */
.kkc-content img{ cursor: default !important; }



/* === KKC 1.9.4: Image sizing & print color === */
/* Respect image's natural size; shrink to fit container; no forced upscaling */
.kb-article img,
.kb-article .wp-block-image img,
.kb-article p > img,
.kb-article figure img,
.kkc-content img,
.kkc-content .wp-block-image img,
.kkc-content p > img,
.kkc-content figure img {
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto 1rem;
}

/* Common wrappers – avoid overflow into following sections/menus */
.kb-article .wp-block-image,
.kb-article figure,
.kkc-content .wp-block-image,
.kkc-content figure { 
  display: block;
  max-width: 100%;
  overflow: hidden;
}

/* Disable any zoom/lightbox cursors that external plugins may inject */
.kb-article img, .kkc-content img { cursor: default !important; }

/* Safety: contain layout & clip overflow when supported */
.kb-article, .kkc-content { contain: content; }
@supports (overflow-clip-margin: 1px) {
  .kb-article, .kkc-content { overflow: clip; overflow-clip-margin: 1px; }
}

/* Print: ask browser to keep colors when printing */
@media print {
  :root { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* === /KKC 1.9.4 === */

