/* Блог: головна, розділи, стаття. Розкладка — як у DonatMania, кольори — RONINO. */

.bl-page, .art-page {
  --bl-radius: 16px;
  --bl-card: var(--bg-2);
  --bl-soft: var(--surface);
  --bl-hover: rgba(249, 156, 0, 0.45);
  padding-top: 24px;
  padding-bottom: 72px;
}
.bl-page { max-width: calc(1200px + 64px); }
.art-page { max-width: calc(1400px + 64px); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.bl-stack > * + * { margin-top: 36px; }
.bl-page > .bl-stack { margin-top: 36px; }
.bl-mt { margin-top: 32px; }
.bl-anchor { scroll-margin-top: calc(var(--nav-h) + 20px); }
.bl-clamp-1, .bl-clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.bl-clamp-1 { -webkit-line-clamp: 1; }
.bl-clamp-2 { -webkit-line-clamp: 2; }
.bl-only-sm { display: none !important; }
@media (max-width: 639px) {
  .bl-hide-sm { display: none !important; }
  .bl-only-sm { display: block !important; }
}

.bl-chev { width: 16px; height: 16px; flex-shrink: 0; }
.bl-chev.is-flip { transform: rotate(180deg); }

.bl-crumb {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 16px; font-size: 14px; font-weight: 500; color: var(--accent);
}
.bl-crumb:hover { text-decoration: underline; }

/* ------------------------------------------------------------ банер */
.bl-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--bl-radius);
  border: 1px solid var(--line);
  padding: 40px 24px;
  text-align: center;
  background:
    radial-gradient(90% 140% at 0% 0%, rgba(249, 156, 0, 0.22), transparent 60%),
    radial-gradient(70% 120% at 100% 100%, rgba(255, 91, 31, 0.16), transparent 60%),
    linear-gradient(135deg, #1f1e1b 0%, #151412 55%, #1c1a17 100%);
}
.bl-banner__title {
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.bl-banner__title span { color: var(--accent); }
.bl-banner__lead {
  max-width: 620px;
  margin: 10px auto 0;
  color: var(--ink-2);
  line-height: 1.55;
}
.bl-banner__form { margin-top: 22px; }
@media (min-width: 640px) { .bl-banner { padding: 48px 40px; } }
@media (max-width: 639px) {
  .bl-banner { padding: 18px 14px; }
  .bl-banner__title { font-size: 19px; }
  .bl-banner__lead { display: none; }
  .bl-banner__form { margin-top: 14px; }
  .bl-banner .bl-search { padding: 10px 14px; }
}

.bl-banner--img { padding: 0; background: var(--bl-soft); }
.bl-banner__img { display: block; width: 100%; object-fit: cover; aspect-ratio: 1920 / 330; }
.bl-banner__img--m { aspect-ratio: 750 / 250; }
/* Відсотки, а не пікселі: пошук їде разом з картинкою на будь-якій ширині. */
.bl-banner__search { position: absolute; bottom: 4%; left: 6%; width: 56%; }
@media (min-width: 640px) {
  .bl-banner__search { bottom: 4%; left: 12.7%; width: 29%; }
}
/* На телефоні картинка банера замала для тексту й пошуку одразу —
   на сторінках з mobile_search_only лишаємо тільки пошук на всю ширину. */
@media (max-width: 639px) {
  .bl-banner--mobile-search { background: none; border: 0; border-radius: 0; }
  .bl-banner--mobile-search .bl-banner__img { display: none !important; }
  .bl-banner--mobile-search .bl-banner__search { position: static; width: 100%; }
}

/* ------------------------------------------------------------ пошук */
.bl-search {
  display: flex; align-items: center; gap: 10px;
  max-width: 672px; margin: 0 auto;
  padding: 14px 20px;
  border-radius: var(--bl-radius);
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s;
}
.bl-search:focus-within { border-color: var(--accent); }
.bl-search--compact { max-width: none; padding: 6px 14px; border-radius: 999px; }
.bl-search__btn, .bl-search__clear {
  flex-shrink: 0; display: grid; place-items: center;
  padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer;
}
.bl-search__btn svg { width: 20px; height: 20px; }
.bl-search--compact .bl-search__btn svg { width: 16px; height: 16px; }
.bl-search__btn:hover, .bl-search__clear:hover { color: var(--accent); }
.bl-search__clear { padding: 0 4px; font-size: 14px; }
.bl-search__clear[hidden] { display: none; }
.bl-search__input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  color: var(--ink); font: inherit; font-size: 15px;
}
.bl-search--compact .bl-search__input { font-size: 13px; }
.bl-search__input::placeholder { color: var(--muted); }
.bl-search__input::-webkit-search-cancel-button { display: none; }

/* -------------------------------------------------------- заголовки */
.bl-h2 {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
  font-size: clamp(20px, 2.2vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.bl-h2__icon {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(249, 156, 0, 0.12);
  color: var(--accent);
  font-family: var(--mono); font-size: 15px;
}

/* ---------------------------------------------------------- картки */
.bl-card {
  overflow: hidden;
  border-radius: var(--bl-radius);
  border: 1px solid var(--line);
  background: var(--bl-card);
  color: var(--ink);
  transition: border-color 0.18s, background 0.18s;
}
.bl-card:hover { border-color: var(--bl-hover); }
.bl-card:hover .bl-card__title { color: var(--accent); }
.bl-card__title {
  font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em;
  transition: color 0.18s;
}
.bl-card__excerpt { font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.bl-card__date { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--muted); }

.bl-cover {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bl-soft);
}
.bl-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s;
}
.bl-card:hover .bl-cover img { transform: scale(1.05); }
.bl-cover__empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(249, 156, 0, 0.4);
  background:
    radial-gradient(60% 80% at 30% 20%, rgba(249, 156, 0, 0.12), transparent 70%),
    var(--bl-soft);
}
.bl-cover__empty .robot-icon { width: 30%; max-width: 64px; height: auto; }

.bl-featured-grid { display: grid; gap: 20px; }
@media (min-width: 1024px) { .bl-featured-grid.has-side { grid-template-columns: 1fr 1fr; } }
.bl-featured { display: flex; flex-direction: column; }
.bl-featured__body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 16px; }
.bl-featured .bl-card__title { font-size: 16px; }
@media (min-width: 640px) {
  .bl-featured__body { padding: 20px; }
  .bl-featured .bl-card__title { font-size: 18px; }
}

.bl-side { display: flex; flex-direction: column; gap: 20px; }

.bl-row { display: flex; }
.bl-row__cover { width: 132px; flex-shrink: 0; align-self: flex-start; }
.bl-row__body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; padding: 12px; }
.bl-row .bl-card__title { font-size: 14px; }
@media (min-width: 640px) {
  .bl-row__cover { width: 256px; }
  .bl-row__body { padding: 16px; }
  .bl-row .bl-card__title { font-size: 16px; }
}

.bl-tile { display: flex; flex-direction: column; }
.bl-tile__body { display: flex; flex: 1; flex-direction: column; padding: 12px; }
.bl-tile .bl-card__date { padding-top: 8px; }

.bl-grid-2 { display: grid; gap: 20px; }
@media (min-width: 1024px) { .bl-grid-2 { grid-template-columns: 1fr 1fr; } }
.bl-grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (min-width: 1024px) { .bl-grid-4 { grid-template-columns: repeat(4, 1fr); gap: 20px; } }
@media (max-width: 380px) { .bl-grid-4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- хаби */
.bl-hubs > * + * { margin-top: 32px; }
.bl-hub__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.bl-hub__name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bl-hub__name h3 {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
}
.bl-hub__icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; object-fit: cover; }
.bl-more {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: color 0.15s;
}
.bl-more:hover { color: var(--accent); }
.bl-more--sm { font-size: 12px; font-weight: 500; color: var(--accent); }
.bl-more--sm .bl-chev { width: 12px; height: 12px; }
.bl-more--sm:hover { text-decoration: underline; }

/* ----------------------------------------------------------- вкладки */
.bl-tabs { display: flex; justify-content: center; }
.bl-tabs__inner {
  display: inline-flex; gap: 4px; max-width: 100%;
  padding: 4px; border-radius: var(--bl-radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  overflow-x: auto; scrollbar-width: none;
}
.bl-tabs__inner::-webkit-scrollbar { display: none; }
.bl-tab {
  white-space: nowrap;
  padding: 10px 16px; border-radius: 12px;
  font-size: 16px; font-weight: 600; color: var(--ink);
  transition: background 0.15s, color 0.15s;
}
.bl-tab:hover { background: rgba(255, 255, 255, 0.06); }
.bl-tab.is-active { background: var(--accent); color: #111; }
@media (min-width: 640px) {
  .bl-tabs__inner { gap: 26px; }
  .bl-tab { padding: 11px 20px; font-size: 17px; }
}

/* --------------------------------------------------------- пагінація */
.bl-pager-wrap { margin-top: 32px; }
.bl-pager { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.bl-pager__arrow, .bl-pager__num {
  display: flex; align-items: center; justify-content: center;
  height: 32px; min-width: 32px; padding: 0 6px; border-radius: 8px;
  font-size: 14px; color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.bl-pager__arrow:hover, .bl-pager__num:hover { background: var(--bl-soft); color: var(--ink); }
.bl-pager__num.is-active { background: var(--accent); color: #111; font-weight: 600; }
.bl-pager__arrow.is-disabled { color: var(--muted); opacity: 0.45; pointer-events: none; }
.bl-pager__gap { padding: 0 4px; color: var(--muted); }

/* ------------------------------------------------------------- пошук */
.bl-results__title { margin-bottom: 4px; font-size: clamp(20px, 2.2vw, 24px); font-weight: 700; letter-spacing: -0.02em; }
.bl-results__title span { color: var(--accent); }
.bl-results__count { margin-bottom: 20px; font-size: 14px; color: var(--ink-2); }
.bl-results__cats { margin-bottom: 24px; }
.bl-results__label { margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.bl-chips { display: flex; flex-wrap: wrap; gap: 12px; }
.bl-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--bl-radius);
  border: 1px solid var(--line); background: var(--bl-card); color: var(--ink);
  transition: border-color 0.15s;
}
.bl-chip:hover { border-color: var(--bl-hover); }
.bl-chip img { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; }
.bl-chip__name { font-weight: 600; }
.bl-chip__count { font-size: 14px; color: var(--muted); }

.bl-empty {
  padding: 40px 20px; text-align: center; color: var(--ink-2);
  border-radius: var(--bl-radius); border: 1px solid var(--line); background: var(--bl-card);
}

[data-blog-body].is-loading { opacity: 0.55; transition: opacity 0.15s; }

/* ============================================================ стаття */
.art-back { display: inline-flex; }
@media (min-width: 1024px) { .art-back { display: none; } }

@media (min-width: 1024px) {
  .art-layout { display: flex; align-items: flex-start; gap: 36px; }
}

.art-col__head {
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.art-col__head--split { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.art-toc { display: none; }
@media (min-width: 1024px) {
  .art-toc {
    display: block; position: sticky; top: calc(var(--nav-h) + 20px);
    width: 260px; flex-shrink: 0;
  }
}
.art-toc__list {
  max-height: calc(100dvh - var(--nav-h) - 120px);
  overflow-y: auto; padding-right: 4px; scrollbar-width: none;
}
.art-toc__list::-webkit-scrollbar { display: none; }
.art-toc__item {
  display: block; padding: 12px 0;
  font-size: 15px; line-height: 1.35; color: var(--ink-2);
  transition: color 0.15s;
}
.art-toc__item + .art-toc__item { border-top: 1px solid var(--line-2); }
.art-toc__item.is-sub { padding-left: 16px; }
.art-toc__item:hover { color: var(--ink); }
.art-toc__item.is-active { color: var(--accent); font-weight: 600; }

.art-main { flex: 1; min-width: 0; }
@media (min-width: 1024px) { .art-main { max-width: 732px; } }
.art-main > * + * { margin-top: 20px; }
.art-title { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: -0.025em; }
.art-meta { font-size: 14px; color: var(--muted); }
.art-meta a { color: var(--ink-2); }
.art-meta a:hover { color: var(--accent); }
.art-lead { font-size: 18px; color: var(--ink-2); line-height: 1.6; }

.art-cta {
  margin-top: 40px !important;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px; border-radius: var(--bl-radius);
  border: 1px solid rgba(249, 156, 0, 0.3);
  background: linear-gradient(135deg, rgba(249, 156, 0, 0.1), rgba(249, 156, 0, 0.02));
}
.art-cta__text { flex: 1 1 280px; font-size: 15px; color: var(--ink); line-height: 1.5; }

.art-related { margin-top: 40px; }
.art-related--empty { display: none; }
@media (min-width: 1024px) {
  .art-related {
    position: sticky; top: calc(var(--nav-h) + 20px);
    width: 300px; flex-shrink: 0; margin-top: 0;
  }
  .art-related--empty { display: block; }
}
.art-rel { display: flex; gap: 12px; padding: 12px 0; color: var(--ink); }
.art-rel:first-child { padding-top: 0; }
.art-rel + .art-rel { border-top: 1px solid var(--line-2); }
.art-rel__thumb { width: 80px; height: 56px; flex-shrink: 0; overflow: hidden; border-radius: 8px; background: var(--surface); }
.art-rel__thumb img { width: 100%; height: 100%; object-fit: cover; }
.art-rel__body { flex: 1; min-width: 0; }
.art-rel__title { font-size: 13px; font-weight: 500; line-height: 1.35; transition: color 0.15s; }
.art-rel:hover .art-rel__title { color: var(--accent); }
.art-rel__date { margin-top: 4px; font-size: 11px; color: var(--muted); }

/* ================================================ текст статті (+ редактор) */
.post-content {
  font-size: 17px; line-height: 1.75; color: var(--ink);
  overflow-wrap: break-word;
}
.post-content::after { content: ""; display: table; clear: both; }
.post-content h2, .post-content h3, .post-content h4 {
  scroll-margin-top: calc(var(--nav-h) + 20px);
  letter-spacing: -0.02em; line-height: 1.25;
}
.post-content h2 { margin: 32px 0 12px; font-size: 24px; font-weight: 700; }
.post-content h3 { margin: 24px 0 8px; font-size: 20px; font-weight: 700; }
.post-content h4 { margin: 20px 0 8px; font-size: 18px; font-weight: 700; }
.post-content > :first-child { margin-top: 0; }
.post-content p { margin: 0 0 20px; }
.post-content ul, .post-content ol { margin: 0 0 20px; padding-left: 24px; }
.post-content li { margin-bottom: 6px; }
.post-content li::marker { color: var(--accent); }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content strong, .post-content b { font-weight: 700; color: var(--ink); }
.post-content blockquote {
  margin: 24px 0; padding: 14px 20px;
  border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0;
  background: var(--bg-2); color: var(--ink-2);
}
.post-content code { font-family: var(--mono); font-size: 14px; padding: 2px 6px; border-radius: 4px; background: var(--bg-2); }
.post-content pre { margin: 24px 0; padding: 16px 20px; overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.post-content pre code { padding: 0; background: none; }
.post-content hr { margin: 32px 0; border: 0; border-top: 1px solid var(--line); }

.post-content img {
  display: block; max-width: 100%; height: auto;
  margin: 16px 0; border-radius: var(--bl-radius, 16px);
  cursor: zoom-in;
}
.post-content img.img-center { margin-inline: auto; }
.post-content img.img-left { float: left; max-width: 50%; margin: 4px 16px 8px 0; }
.post-content img.img-right { float: right; max-width: 50%; margin: 4px 0 8px 16px; }
.post-content img.img-w10 { width: 10%; }
.post-content img.img-w15 { width: 15%; }
.post-content img.img-w20 { width: 20%; }
.post-content img.img-w25 { width: 25%; }
.post-content img.img-w30 { width: 30%; }
.post-content img.img-w35 { width: 35%; }
.post-content img.img-w40 { width: 40%; }
.post-content img.img-w45 { width: 45%; }
.post-content img.img-w50 { width: 50%; }
.post-content img.img-w55 { width: 55%; }
.post-content img.img-w60 { width: 60%; }
.post-content img.img-w65 { width: 65%; }
.post-content img.img-w70 { width: 70%; }
.post-content img.img-w75 { width: 75%; }
.post-content img.img-w80 { width: 80%; }
.post-content img.img-w85 { width: 85%; }
.post-content img.img-w90 { width: 90%; }
.post-content img.img-w95 { width: 95%; }
.post-content img.img-w100 { width: 100%; max-width: 100%; }
@media (max-width: 639px) {
  .post-content img.img-left, .post-content img.img-right { float: none; max-width: 100%; margin: 16px 0; }
}
.post-content .img-row { display: grid; gap: 8px; margin: 16px 0; }
.post-content .img-row-2 { grid-template-columns: repeat(2, 1fr); }
.post-content .img-row-3 { grid-template-columns: repeat(3, 1fr); }
.post-content .img-row img { width: 100%; height: 100%; margin: 0; object-fit: cover; border-radius: 8px; }
/* Ширина й вирівнювання — на самому ряді, а не на картинках у ньому. */
.post-content .img-row.img-w10 { width: 10%; }
.post-content .img-row.img-w15 { width: 15%; }
.post-content .img-row.img-w20 { width: 20%; }
.post-content .img-row.img-w25 { width: 25%; }
.post-content .img-row.img-w30 { width: 30%; }
.post-content .img-row.img-w35 { width: 35%; }
.post-content .img-row.img-w40 { width: 40%; }
.post-content .img-row.img-w45 { width: 45%; }
.post-content .img-row.img-w50 { width: 50%; }
.post-content .img-row.img-w55 { width: 55%; }
.post-content .img-row.img-w60 { width: 60%; }
.post-content .img-row.img-w65 { width: 65%; }
.post-content .img-row.img-w70 { width: 70%; }
.post-content .img-row.img-w75 { width: 75%; }
.post-content .img-row.img-w80 { width: 80%; }
.post-content .img-row.img-w85 { width: 85%; }
.post-content .img-row.img-w90 { width: 90%; }
.post-content .img-row.img-w95 { width: 95%; }
.post-content .img-row.img-w100 { width: 100%; }
.post-content .img-row.img-center { margin-inline: auto; }
.post-content .img-row.img-left { margin-right: auto; }
.post-content .img-row.img-right { margin-left: auto; }
@media (max-width: 639px) {
  /* На телефоні вузький ряд стає мініатюрним — розтягуємо на всю ширину. */
  .post-content .img-row[class*="img-w"] { width: 100%; }
}

.post-content .tc-accent { color: var(--accent); }
.post-content .tc-red { color: #ff5b5b; }
.post-content .tc-green { color: #0ac970; }
.post-content .tc-blue { color: #4ea1ff; }
.post-content .tc-gray { color: var(--muted); }
.post-content .tc-white { color: #fff; }
.post-content .fs-12 { font-size: 12px; }
.post-content .fs-14 { font-size: 14px; }
.post-content .fs-16 { font-size: 16px; }
.post-content .fs-18 { font-size: 18px; }
.post-content .fs-20 { font-size: 20px; }
.post-content .fs-24 { font-size: 24px; }
.post-content .fs-28 { font-size: 28px; }
.post-content .fs-32 { font-size: 32px; line-height: 1.3; }

.post-content .article-table {
  margin: 16px 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 8px;
}
.post-content table { width: 100%; border-collapse: collapse; }
.post-content th, .post-content td {
  padding: 10px 12px; border: 1px solid var(--line);
  text-align: center; vertical-align: middle;
}
.post-content th { background: var(--bg-2); font-weight: 700; }
@media (max-width: 639px) {
  .post-content table { font-size: 13px; line-height: 1.4; }
  .post-content th, .post-content td { padding: 8px; }
}

/* ------------------------------------------------------------ лайтбокс */
/* Поки лайтбокс відкрито — сторінка позаду не скролиться (iOS теж). */
html.bl-scroll-lock, html.bl-scroll-lock body { overflow: hidden; overscroll-behavior: none; }

.bl-lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
  overscroll-behavior: contain;
  touch-action: none; /* жести обробляє наш JS (пінч/пан/свайп), не браузер */
}
.bl-lightbox img {
  max-width: 94vw; max-height: 88vh; border-radius: 12px; object-fit: contain;
  will-change: transform; user-select: none; -webkit-user-drag: none;
  touch-action: none;
}
.bl-lightbox__close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
  font-size: 18px; cursor: pointer;
  z-index: 1;
}
.bl-lightbox__close:hover { color: var(--accent); border-color: var(--accent); }
