/* ============================================================================
   LUNAR — стилі тексту з редактора CKEditor
   (статті блогу, опис товару, SEO-текст категорії)

   Де працює:
     • на сайті — підключено в core/header.php після style.css;
     • в адмінці — це ж саме оформлення всередині редактора
       (admin/lb-ckeditor.js), тож у редакторі текст виглядає як на сайті.

   Обгортка тексту: <div class="lb-content"> (у статтях + lb-content--article).
   Готові стилі з меню «Стилі» в редакторі — класи lb-* (розділ 9 нижче).
   Кольори бренду: #8b8678 (акцент), #3c3930 (заголовки), #525252 (текст).
   ========================================================================== */

.lb-content {
  --lb-text: #525252;
  --lb-head: #3c3930;
  --lb-accent: #8b8678;
  --lb-link: #6f6a5d;
  --lb-muted: #75705f;
  --lb-line: #e6e1d6;
  --lb-line-soft: #eeeae2;
  --lb-bg-soft: #f6f4f0;
  --lb-bg-head: #f3f1ec;
  --lb-radius: 14px;
  color: var(--lb-text);
  line-height: 1.7;
  overflow-wrap: break-word;
}
.lb-content--article { font-size: 16px; line-height: 1.75; }
.lb-content::after { content: ""; display: table; clear: both; }
.lb-content > :first-child { margin-top: 0 !important; }
.lb-content > :last-child { margin-bottom: 0 !important; }

/* ---------- 1. Абзаци, виділення ---------- */
.lb-content p { margin: 0 0 1em; }
.lb-content strong,
.lb-content b { font-weight: 600; color: var(--lb-head); }
.lb-content small { font-size: .85em; }
.lb-content s,
.lb-content del { color: #8a857a; }
.lb-content mark,
.lb-content .lb-mark {
  padding: 0 .12em; color: inherit; border-radius: 2px;
  background: linear-gradient(180deg, transparent 42%, #f2dfae 42%);
}

/* ---------- 2. Посилання (у темі вони без підкреслення й зливалися з текстом) ---------- */
.lb-content a {
  color: var(--lb-link);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: #c5bca9;
  text-underline-offset: .2em;
  transition: color .2s, text-decoration-color .2s;
}
.lb-content a:hover { color: var(--lb-head); text-decoration-color: currentColor; }
.lb-content a:focus-visible { outline: 2px solid var(--lb-accent); outline-offset: 2px; border-radius: 3px; }

/* ---------- 3. Заголовки ---------- */
.lb-content h1, .lb-content h2, .lb-content h3,
.lb-content h4, .lb-content h5, .lb-content h6 {
  color: var(--lb-head);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.005em;
  clear: both;
  scroll-margin-top: 130px;          /* при переході зі «Змісту» заголовок не ховається під шапкою */
}
.lb-content h1,
.lb-content h2 { font-size: 1.75em; margin: 1.6em 0 .6em; }
.lb-content h2::after {
  content: ""; display: block; width: 44px; height: 2px; margin-top: .45em;
  background: #d6cdbb; border-radius: 2px;
}
.lb-content h2[style*="center"]::after { margin-left: auto; margin-right: auto; }
.lb-content h3 { font-size: 1.3em; margin: 1.5em 0 .5em; }
.lb-content h4 { font-size: 1.12em; margin: 1.4em 0 .45em; }
.lb-content h5 { font-size: 1em; margin: 1.3em 0 .4em; }
.lb-content h6 { font-size: .82em; margin: 1.3em 0 .4em; text-transform: uppercase; letter-spacing: .07em; color: var(--lb-accent); }
.lb-content h2 + h3,
.lb-content h3 + h4 { margin-top: .5em; }

/* ---------- 4. Списки (тема обнуляє маркери у всіх ul — тут повертаємо) ---------- */
.lb-content ul,
.lb-content ol { margin: 0 0 1.1em; padding: 0 0 0 1.45em; }
.lb-content ul { list-style: disc; }
.lb-content ol { list-style: decimal; }
.lb-content ul ul { list-style: circle; }
.lb-content li { margin: 0 0 .45em; padding-left: .25em; }
.lb-content li::marker { color: var(--lb-accent); }
.lb-content ol > li::marker { font-weight: 600; }
.lb-content li > ul,
.lb-content li > ol { margin: .45em 0 .2em; }
.lb-content li > p { margin: 0 0 .4em; }

/* ---------- 5. Таблиці ---------- */
.lb-content .lb-table-wrap {              /* обгортку додає PHP (core/content.php) */
  margin: 1.5em 0 1.8em;
  overflow-x: auto;
  clear: both;
}
.lb-content table {
  width: 100% !important;                 /* перебиває style="width:500px" зі старого діалогу */
  height: auto !important;
  margin: 1.5em 0 1.8em;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--lb-line);
  border-radius: var(--lb-radius);
  overflow: hidden;
  background: #fff;
  font-size: .94em;
  line-height: 1.5;
  clear: both;
}
.lb-content .lb-table-wrap > table { margin: 0; }
.lb-content table:has(tr > :nth-child(4)) { min-width: 560px; }   /* 4+ колонки: на телефоні гортається */
.lb-content caption {
  caption-side: top; text-align: left; padding: 0 0 .6em;
  font-weight: 600; color: var(--lb-head);
}
.lb-content th,
.lb-content td {
  padding: .8em 1em;
  text-align: left;
  vertical-align: top;
  border: 0;
  border-bottom: 1px solid var(--lb-line-soft);
}
.lb-content tr > * + * { border-left: 1px solid var(--lb-line-soft); }
.lb-content tbody > tr:last-child > *,
.lb-content table > tr:last-child > * { border-bottom: 0; }
.lb-content thead th,
.lb-content thead td {
  background: var(--lb-bg-head);
  color: var(--lb-head);
  font-weight: 600;
  border-bottom: 1px solid var(--lb-line);
}
.lb-content tbody th { background: #f8f6f1; color: var(--lb-head); font-weight: 600; }
.lb-content tbody tr:nth-child(even) > td { background: #fbfaf7; }
.lb-content tbody tr:hover > td { background: #f6f3ed; }
.lb-content th > p:last-child,
.lb-content td > p:last-child { margin-bottom: 0; }
/* заокруглені кути */
.lb-content table > :first-child > tr:first-child > :first-child { border-top-left-radius: calc(var(--lb-radius) - 1px); }
.lb-content table > :first-child > tr:first-child > :last-child  { border-top-right-radius: calc(var(--lb-radius) - 1px); }
.lb-content table > :last-child > tr:last-child > :first-child   { border-bottom-left-radius: calc(var(--lb-radius) - 1px); }
.lb-content table > :last-child > tr:last-child > :last-child    { border-bottom-right-radius: calc(var(--lb-radius) - 1px); }

/* ---------- 6. Цитата (у темі — зелена плашка з картинкою по центру) ---------- */
.lb-content blockquote {
  position: relative;
  margin: 1.8em 0;
  padding: 1.15em 1.4em 1.15em 3.3em;
  background: var(--lb-bg-soft);
  border: 0;
  border-radius: var(--lb-radius);
  color: var(--lb-head);
  text-align: left;
  font-size: 1.05em;
  font-style: italic;
  line-height: 1.65;
  clear: both;
}
.lb-content blockquote::before {
  content: "\201C";
  position: absolute; top: .12em; left: .32em;
  -webkit-transform: none; transform: none;
  font: italic 400 3.4em/1 Georgia, "Times New Roman", serif;
  color: #cfc6b4;
}
.lb-content blockquote p {
  color: inherit; font-size: inherit; font-style: inherit; line-height: inherit;
  margin: 0 0 .6em;
}
.lb-content blockquote p:last-child { margin-bottom: 0; }
.lb-content blockquote cite,
.lb-content blockquote footer { display: block; margin-top: .6em; font-size: .85em; font-style: normal; color: var(--lb-muted); }

/* ---------- 7. Фото, підписи, відео ---------- */
.lb-content img {
  max-width: 100%;
  height: auto !important;               /* фото не сплющується, навіть якщо в редакторі задали висоту */
  border-radius: 12px;
  vertical-align: middle;
}
/* фото окремим абзацом — по центру (клас lb-figure ставить PHP, core/content.php) */
.lb-content p.lb-figure { margin: 1.6em 0; text-align: center; }
/* Висоту фото в статтях (до 620px) обмежує PHP через width/height — так фото не
   сплющується і місце під нього резервується ще до завантаження.
   Тут — лише запасний варіант для фото з невідомим розміром (з чужих сайтів). */
.lb-content--article img:not([width]):not([style^="width"]):not([style*=" width"]):not([style*=";width"]) { max-height: 620px; }
.lb-content img[style*="float:left"],
.lb-content img[style*="float: left"],
.lb-content img[align="left"]  { max-width: 48%; margin: .3em 1.5em 1em 0 !important; }
.lb-content img[style*="float:right"],
.lb-content img[style*="float: right"],
.lb-content img[align="right"] { max-width: 48%; margin: .3em 0 1em 1.5em !important; }
.lb-content figure { margin: 1.6em 0; }
.lb-content figure img { display: block; margin: 0 auto; }
.lb-content figcaption {
  margin-top: .6em; font-size: .86em; line-height: 1.5;
  color: var(--lb-muted); text-align: center;
}
.lb-content iframe { max-width: 100%; border: 0; }
.lb-content iframe[src*="youtube"],
.lb-content iframe[src*="youtu.be"],
.lb-content iframe[src*="vimeo"] {
  display: block; width: 100% !important; height: auto !important;
  aspect-ratio: 16 / 9; margin: 1.6em 0;
  border-radius: var(--lb-radius); background: #000;
}

/* ---------- 8. Лінія, код ---------- */
.lb-content hr {
  clear: both;
  height: 1px !important;
  margin: 2em 0;
  border: 0;
  background: var(--lb-line);
  opacity: 1;
}
.lb-content code,
.lb-content kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; padding: .12em .4em; border-radius: 6px;
  background: var(--lb-bg-head); color: var(--lb-head);
}
.lb-content pre {
  margin: 1.4em 0; padding: 1em 1.2em; border-radius: 12px;
  background: var(--lb-bg-soft); overflow: auto; white-space: pre-wrap; font-size: .9em;
}
.lb-content pre code { padding: 0; background: none; }

/* ============================================================================
   9. ГОТОВІ СТИЛІ — меню «Стилі» в редакторі
   ========================================================================== */

/* 9.1 Вступ — перший абзац статті, трохи більший */
.lb-content p.lb-lead { font-size: 1.13em; line-height: 1.65; color: var(--lb-head); margin-bottom: 1.2em; }

/* 9.2 Блоки: Порада / Важливо / Рамка-підсумок / Темний блок-заклик */
.lb-content .lb-tip,
.lb-content .lb-warn,
.lb-content .lb-box,
.lb-content .lb-cta {
  position: relative;
  margin: 1.6em 0;
  padding: 1em 1.25em;
  border-radius: var(--lb-radius);
  clear: both;
}
.lb-content .lb-tip,
.lb-content .lb-warn { padding-left: 3.4em; }
.lb-content .lb-tip::before,
.lb-content .lb-warn::before {
  content: ""; position: absolute; left: 1.05em; top: 1.05em;
  width: 1.5em; height: 1.5em;
  background: center / contain no-repeat;
}
.lb-content .lb-tip { background: #f4f1ea; color: #4a463d; }
.lb-content .lb-tip::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8678' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.6 10.8c.6.5 1.1 1.3 1.1 2.2h5c0-.9.5-1.7 1.1-2.2A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
}
.lb-content .lb-warn { background: #fbf1e0; color: #4a3f2b; }
.lb-content .lb-warn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b07d2b' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.01'/%3E%3C/svg%3E");
}
.lb-content .lb-box { background: #fff; border: 1.5px solid var(--lb-line); }
.lb-content .lb-cta { background: #3c3930; color: #f3f1ec; padding: 1.15em 1.4em; }
.lb-content .lb-cta strong,
.lb-content .lb-cta b { color: #fff; }
.lb-content .lb-cta a { color: #fff; text-decoration-color: rgba(255, 255, 255, .55); }
.lb-content .lb-cta a:hover { color: #fff; text-decoration-color: #fff; }

/* 9.3 Примітка дрібним / Текст по центру */
.lb-content p.lb-muted { font-size: .88em; line-height: 1.6; color: var(--lb-muted); }
.lb-content .lb-center { text-align: center; }

/* 9.4 Бейдж у тексті: «Хіт», «Новинка», «від 85 грн» */
.lb-content .lb-badge {
  display: inline-block; padding: .1em .6em; border-radius: 999px;
  background: #efeae0; color: #5a5446;
  font-size: .82em; font-weight: 600; line-height: 1.6;
  vertical-align: .08em; white-space: nowrap;
}

/* 9.5 Кнопка (стиль для посилання) */
.lb-content a.lb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 46px; padding: .7em 1.45em; margin: .2em .4em .2em 0;
  border: 1.5px solid #2f2c26; border-radius: 14px;
  background: #2f2c26; color: #fff;
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(47, 44, 38, .16);
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}
.lb-content a.lb-btn:hover { background: #8b8678; border-color: #8b8678; color: #fff; transform: translateY(-1px); }
.lb-content a.lb-btn.lb-btn--light { background: transparent; color: var(--lb-head); border-color: #cfc7b6; box-shadow: none; }
.lb-content a.lb-btn.lb-btn--light:hover { background: #f4f2ec; border-color: var(--lb-accent); color: var(--lb-head); }
.lb-content .lb-cta a.lb-btn { background: #fff; border-color: #fff; color: #3c3930; box-shadow: none; margin-top: .6em; }
.lb-content .lb-cta a.lb-btn:hover { background: #f3f1ec; border-color: #f3f1ec; color: #3c3930; }

/* 9.6 Списки: галочки / у 2 колонки / кроки з кружечками */
.lb-content ul.lb-check { list-style: none; padding-left: 0; }
.lb-content ul.lb-check > li { position: relative; padding-left: 2em; }
.lb-content ul.lb-check > li::before {
  content: ""; position: absolute; left: 0; top: .22em;
  width: 1.3em; height: 1.3em; border-radius: 50%;
  background: #ebe5d8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f5a4c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 62% no-repeat;
}
.lb-content ul.lb-cols { columns: 2; column-gap: 2.4em; }
.lb-content ul.lb-cols > li { break-inside: avoid; }
.lb-content ol.lb-steps { list-style: none; padding-left: 0; counter-reset: lb-step; }
.lb-content ol.lb-steps > li {
  position: relative; counter-increment: lb-step;
  min-height: 1.9em; margin-bottom: .9em; padding-left: 2.6em;
}
.lb-content ol.lb-steps > li::before {
  content: counter(lb-step);
  position: absolute; left: 0; top: 0;
  width: 1.85em; height: 1.85em; border-radius: 50%;
  background: #3c3930; color: #fff;
  font-size: .9em; font-weight: 600; line-height: 1.85em; text-align: center;
}

/* 9.7 Таблиці: компактна / мінімал / 1-ша колонка жирна / порівняння ✓/✗ (= first-col + center) */
.lb-content table.lb-table--compact { font-size: .9em; }
.lb-content table.lb-table--compact th,
.lb-content table.lb-table--compact td { padding: .5em .75em; }
.lb-content table.lb-table--plain { border: 0; border-radius: 0; background: transparent; }
.lb-content table.lb-table--plain th,
.lb-content table.lb-table--plain td { border-left: 0; border-radius: 0 !important; padding-left: 0; }
.lb-content table.lb-table--plain thead th,
.lb-content table.lb-table--plain thead td { background: transparent; border-bottom: 2px solid var(--lb-line); }
.lb-content table.lb-table--plain tbody tr > td { background: transparent; }
.lb-content table.lb-table--plain tbody > tr:last-child > * { border-bottom: 1px solid var(--lb-line-soft); }
.lb-content table.lb-table--first-col tbody td:first-child { font-weight: 600; color: var(--lb-head); }
.lb-content table.lb-table--center th,
.lb-content table.lb-table--center td { text-align: center; }
.lb-content table.lb-table--center th:first-child,
.lb-content table.lb-table--center td:first-child { text-align: left; }

/* 9.8 Фото: на всю ширину / по центру / по центру з тінню / зліва / справа */
.lb-content img.lb-img--wide   { display: block; width: 100% !important; max-height: none; float: none !important; margin: 1.6em 0 !important; }
.lb-content img.lb-img--center { display: block; float: none !important; margin: 1.6em auto !important; }
.lb-content img.lb-img--left   { float: left;  max-width: 46%; margin: .35em 1.6em 1em 0 !important; }
.lb-content img.lb-img--right  { float: right; max-width: 46%; margin: .35em 0 1em 1.6em !important; }
.lb-content img.lb-img--shadow { display: block; float: none !important; margin: 1.8em auto !important; box-shadow: 0 12px 32px rgba(60, 57, 48, .16); }

/* ---------- 10. «Зміст статті» (генерується автоматично, core/content.php) ---------- */
.lb-content .lb-toc {
  margin: 1.4em 0 2em;
  padding: 1em 1.3em;
  background: var(--lb-bg-soft);
  border: 1px solid var(--lb-line-soft);
  border-radius: var(--lb-radius);
}
.lb-content .lb-toc > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1em;
  cursor: pointer; list-style: none;
  font-weight: 600; color: var(--lb-head);
}
.lb-content .lb-toc > summary::-webkit-details-marker { display: none; }
.lb-content .lb-toc > summary::after {
  content: ""; flex: 0 0 auto; width: .5em; height: .5em; margin-right: .2em;
  border-right: 2px solid var(--lb-accent); border-bottom: 2px solid var(--lb-accent);
  transform: translateY(-.15em) rotate(45deg); transition: transform .2s;
}
.lb-content .lb-toc[open] > summary::after { transform: translateY(.1em) rotate(-135deg); }
.lb-content .lb-toc ol { list-style: none; counter-reset: lb-toc; margin: .8em 0 0; padding: 0; }
.lb-content .lb-toc li {
  position: relative; counter-increment: lb-toc;
  margin: 0 0 .45em; padding-left: 1.9em; line-height: 1.45; break-inside: avoid;
}
.lb-content .lb-toc li::before {
  content: counter(lb-toc);
  position: absolute; left: 0; top: .08em; min-width: 1.4em;
  color: var(--lb-accent); font-size: .9em; font-weight: 600;
}
.lb-content .lb-toc a { color: var(--lb-text); font-weight: 400; text-decoration: none; }
.lb-content .lb-toc a:hover { color: var(--lb-head); text-decoration: underline; text-decoration-color: #c5bca9; }
@media (min-width: 992px) {
  .lb-content .lb-toc--cols ol { columns: 2; column-gap: 2.4em; }
}

/* ---------- 11. Телефони ---------- */
@media (max-width: 767px) {
  .lb-content h1,
  .lb-content h2 { font-size: 1.45em; }
  .lb-content h3 { font-size: 1.2em; }
  .lb-content h4 { font-size: 1.06em; }
}
@media (max-width: 575px) {
  .lb-content table { font-size: .9em; }
  .lb-content th,
  .lb-content td { padding: .65em .75em; }
  .lb-content blockquote { padding: 1em 1.1em 1em 2.7em; }
  .lb-content blockquote::before { font-size: 2.8em; left: .25em; }
  .lb-content .lb-tip,
  .lb-content .lb-warn { padding: .9em 1em .9em 2.9em; }
  .lb-content .lb-tip::before,
  .lb-content .lb-warn::before { left: .85em; top: .95em; width: 1.35em; height: 1.35em; }
  .lb-content ul.lb-cols { columns: 1; }
  .lb-content a.lb-btn { display: flex; width: 100%; margin-right: 0; }
  .lb-content img.lb-img--left,
  .lb-content img.lb-img--right,
  .lb-content img[style*="float"],
  .lb-content img[align] {
    float: none !important; display: block; max-width: 100%;
    margin: 1.2em auto !important;
  }
}
