/* Blog: article typography, category chips, FAQ and comments.
   Scoped to kb-* classes so the theme's own blog styles are untouched. */

.kb-lead { font-size: 1.125rem; opacity: .85; line-height: 2; margin-top: 1rem; }
.kb-excerpt { opacity: .75; font-size: .95rem; line-height: 1.9; margin: .5rem 0 .75rem; }

.kb-breadcrumb { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .9rem; opacity: .7; margin-bottom: 1.5rem; }
.kb-breadcrumb a { color: inherit; }
.kb-breadcrumb a:hover { opacity: 1; text-decoration: underline; }

.kb-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1rem; opacity: .8; font-size: .95rem; }
.kb-meta a.cat { color: inherit; text-decoration: underline; text-underline-offset: 4px; }

/* Category chips */
.kb-cats { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 2.5rem; }
.kb-cat { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18); color: inherit; font-size: .9rem; transition: background .2s, border-color .2s; }
.kb-cat span { opacity: .6; font-size: .8rem; }
.kb-cat:hover, .kb-cat.is-active { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .45); }

/* Article body */
.kb-article { max-width: 820px; margin-inline: auto; margin-top: 3rem; }
.kb-prose { font-size: 1.0625rem; line-height: 2.05; }
.kb-prose > * + * { margin-top: 1.1em; }
.kb-prose h2 { font-size: 1.6rem; margin-top: 2.2em; line-height: 1.6; }
.kb-prose h3 { font-size: 1.3rem; margin-top: 1.8em; line-height: 1.6; }
.kb-prose h4 { font-size: 1.1rem; margin-top: 1.5em; }
.kb-prose a { text-decoration: underline; text-underline-offset: 4px; }
.kb-prose ul, .kb-prose ol { padding-inline-start: 1.5rem; }
.kb-prose ul { list-style: disc; }
.kb-prose ol { list-style: decimal; }
.kb-prose li + li { margin-top: .4em; }
.kb-prose img { max-width: 100%; height: auto; border-radius: 12px; }
.kb-prose figure.kb-ai-figure { margin: 2.5rem 0; }
.kb-prose figure.kb-ai-figure img { display: block; width: 100%; }
.kb-prose figure figcaption { font-size: .85rem; opacity: .7; text-align: center; margin-top: .5rem; }
.kb-prose blockquote { border-inline-start: 3px solid rgba(255, 255, 255, .35); padding: .25rem 1rem; opacity: .9; }
.kb-prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.kb-prose th, .kb-prose td { border: 1px solid rgba(255, 255, 255, .15); padding: .6rem .8rem; text-align: start; }
.kb-prose th { background: rgba(255, 255, 255, .06); }
.kb-prose pre { direction: ltr; text-align: left; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px; padding: 1rem 1.25rem; overflow-x: auto; font-size: .875rem; line-height: 1.7; }
.kb-prose code { direction: ltr; unicode-bidi: embed; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.kb-prose :not(pre) > code { background: rgba(255, 255, 255, .08); padding: .1em .35em; border-radius: 6px; }

/* FAQ */
.kb-faq { margin-top: 3.5rem; }
.kb-faq h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.kb-faq__item { border: 1px solid rgba(255, 255, 255, .15); border-radius: 12px; padding: .9rem 1.2rem; }
.kb-faq__item + .kb-faq__item { margin-top: .75rem; }
.kb-faq__item summary { cursor: pointer; font-weight: 600; line-height: 1.8; }
.kb-faq__item p { margin-top: .6rem; opacity: .85; line-height: 1.9; }

/* Comments */
.kb-comments { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid rgba(255, 255, 255, .12); }
.kb-comments__title { font-size: 1.5rem; margin-bottom: 1.5rem; }
.kb-comments__title span { opacity: .6; font-size: 1rem; }
.kb-comments__empty { opacity: .65; }
.kb-comments__list, .kb-comments__replies { list-style: none; padding: 0; margin: 0; }
.kb-comments__replies { margin-top: 1rem; padding-inline-start: 1.5rem; border-inline-start: 2px solid rgba(255, 255, 255, .12); }
.kb-comment { padding: 1rem 1.2rem; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.kb-comment + .kb-comment { margin-top: 1rem; }
.kb-comment__head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: .9rem; }
.kb-comment__head time { opacity: .6; }
.kb-comment__badge { font-size: .75rem; padding: .1rem .55rem; border-radius: 999px; background: rgba(255, 193, 7, .2); color: #ffc107; }
.kb-comment__body { margin-top: .5rem; line-height: 1.9; white-space: normal; overflow-wrap: anywhere; }
.kb-comment__reply { margin-top: .5rem; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; font-size: .85rem; padding: 0; }
.kb-comment__reply:hover { opacity: 1; text-decoration: underline; }

.kb-comment-form { margin-top: 2.5rem; display: grid; gap: 1rem; }
.kb-comment-form__title { font-size: 1.2rem; display: flex; gap: 1rem; align-items: center; }
.kb-comment-form__cancel { background: none; border: 0; color: inherit; opacity: .7; font-size: .85rem; cursor: pointer; text-decoration: underline; }
.kb-comment-form__row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .kb-comment-form__row { grid-template-columns: 1fr; } }
.kb-comment-form label { display: grid; gap: .4rem; font-size: .9rem; }
.kb-comment-form input, .kb-comment-form textarea { width: 100%; padding: .75rem 1rem; border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .04); color: inherit; font: inherit; }
.kb-comment-form input:focus, .kb-comment-form textarea:focus { outline: none; border-color: rgba(255, 255, 255, .55); }
.kb-comment-form__notice { padding: .75rem 1rem; border-radius: 10px; background: rgba(34, 197, 94, .15); color: #4ade80; }
.kb-error { color: #f87171; }
.kb-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.kb-btn { justify-self: start; padding: .8rem 2rem; border-radius: 999px; border: 0; background: #fff; color: #111; font-weight: 600; cursor: pointer; }
.kb-btn[disabled] { opacity: .6; cursor: wait; }

/* Post cards (blog index + "related posts").
   .blog-box has no theme styles (the theme's grid rules target .blog), so the
   thumbnails had no reserved height: each lazy-loaded image pushed the text and
   the cards below it down as it arrived (layout shift, worst on phones where the
   grid is a single column). Reserve a fixed ratio box up front and crop into it. */
.blog-area-2 .blogs-wrapper > *,
.blog-area-3 .blogs-wrapper > * { min-width: 0; } /* long titles/URLs can't widen the grid column */
.blog-box .thumb { overflow: hidden; border-radius: 12px; aspect-ratio: 16 / 10; background: rgba(255, 255, 255, .04); }
.blog-box .thumb a { display: block; width: 100%; height: 100%; }
.blog-box .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.blog-box:hover .thumb img { transform: scale(1.05); }
.blog-box .content { margin-top: 1rem; }
.blog-box .title { overflow-wrap: anywhere; }
.blog-box .meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .9rem; opacity: .8; }
.blog-box .meta a.cat { color: inherit; text-decoration: underline; text-underline-offset: 4px; }

/* Single post featured image: width/height attributes give the browser its
   ratio before it loads; keep it fluid so it never overflows on phones. */
.blog-details-area .thumb img { display: block; width: 100%; height: auto; }

/* ---------------------------------------------------------------------------
   Blog index (/blog) — tablet & mobile fixes. Desktop (>= 1200px) unchanged.
   --------------------------------------------------------------------------- */

/* Card titles inherit the global h2 size (30px) inside 2–3 column grids, which
   is far too heavy for ~250–300px wide cards; scale them down below desktop. */
@media only screen and (max-width: 1199px) {
    .blog-area-2 .blog-box .title { font-size: 22px; line-height: 1.6; }
}
@media only screen and (max-width: 575px) {
    .blog-area-2 .blog-box .title { font-size: 20px; }
    /* Single-column list: the 46px row gap reads as broken spacing on phones. */
    .blog-area-2 .blogs-wrapper { gap: 36px; }
    .blog-area-2 .kb-cats { margin-bottom: 2rem; }
}

/* Long category names in the page heading must wrap, not overflow. */
.page-title-area .section-title,
.blog-area-2 .section-title { overflow-wrap: anywhere; }

/* Pagination (Livewire bootstrap view): dark-theme colours, pill buttons that
   wrap instead of overflowing on narrow screens. */
.blog-area-2 .pagination-wrapper nav { flex-wrap: wrap; gap: 1rem; }
.blog-area-2 .pagination-wrapper p { margin: 0; color: inherit !important; opacity: .6; }
.blog-area-2 .pagination { flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.blog-area-2 .pagination .page-item .page-link {
    margin: 0; min-width: 2.5rem; padding: .45rem .9rem; text-align: center; line-height: 1.5;
    border-radius: 999px !important; border: 1px solid rgba(255, 255, 255, .18);
    background: transparent; color: inherit; box-shadow: none; transition: background .2s, border-color .2s;
}
.blog-area-2 .pagination .page-item .page-link:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .45); }
.blog-area-2 .pagination .page-item.active .page-link { background: #fff; border-color: #fff; color: #111; }
.blog-area-2 .pagination .page-item.disabled .page-link { opacity: .4; background: transparent; }

/* Blog index (/blog) — phone polish */
.kb-cat { max-width: 100%; overflow-wrap: anywhere; }
.blog-box .kb-excerpt { overflow-wrap: anywhere; }
@media only screen and (max-width: 575px) {
    .kb-lead { font-size: 1rem; line-height: 1.9; }
    .blog-area-2 .kb-cats { gap: .4rem; }
    .blog-area-2 .kb-cat { padding: .4rem .85rem; font-size: .85rem; }
    .blog-area-2 .kb-excerpt { font-size: .9rem; line-height: 1.8; }
    .blog-area-2 .blog-box .meta { font-size: .85rem; }
    /* Livewire's bootstrap pager: stack the "showing x of y" text above the links */
    .blog-area-2 .pagination-wrapper nav > div { flex-wrap: wrap; gap: .75rem; }
    .blog-area-2 .pagination .page-item .page-link { min-width: 2.25rem; padding: .4rem .7rem; }
}

/* ---------------------------------------------------------------------------
   Single post (/blog/{slug}) — tablet & mobile. Desktop (>= 992px) unchanged.
   The theme's Latin display rules leak into this page on small screens:
   - `.section-title.font-bdogrotesk-regular` gives the Persian H1 a 1.1
     line-height and -0.05em letter-spacing (cramped lines, squashed joins);
   - the global `p { 20px / 28px }` beats `.kb-prose`'s size, so paragraphs
     are oversized with a ~1.4 line-height while list items stay at 17px;
   - `.blog-details-area .meta` (5px gap) + rtl.css `row-reverse` scramble the
     meta line once it wraps.
   --------------------------------------------------------------------------- */
@media only screen and (max-width: 991px) {
    .blog-details-area h1.section-title { line-height: 1.5; letter-spacing: 0; overflow-wrap: anywhere; }
}

@media only screen and (max-width: 767px) {
    /* Header block: tighter top spacing so the title sits above the fold. */
    .blog-details-area .blog-details-area-inner { padding-top: 32px; padding-bottom: 48px; }
    .blog-details-area .kb-breadcrumb { font-size: .85rem; gap: .35rem; margin-bottom: 1rem; }
    .blog-details-area .section-header { margin-top: 0; }
    .blog-details-area h1.section-title { font-size: 26px; }

    .blog-details-area .kb-meta,
    html[dir="rtl"] .blog-details-area .kb-meta {
        flex-direction: row; align-items: center; gap: .25rem .9rem; margin-top: .9rem; font-size: .85rem;
    }
    .blog-details-area .kb-meta > *,
    .blog-details-area .kb-meta span { font-size: inherit; line-height: 1.8; }

    /* Featured image: the GSAP "go_full" effect makes it edge-to-edge, so the
       article needs less of a gap below it. */
    .blog-details-area .thumb { margin-top: 1.5rem; }
    .kb-article { margin-top: 2rem; }

    /* Body copy: one comfortable reading size for p and li. */
    .kb-prose { font-size: 1rem; line-height: 2; overflow-wrap: break-word; }
    .kb-prose p, .kb-prose li { font-size: 1rem; line-height: 2; }
    .kb-prose > * + * { margin-top: 1em; }
    .kb-prose h2 { font-size: 1.35rem; margin-top: 2em; line-height: 1.7; }
    .kb-prose h3 { font-size: 1.15rem; margin-top: 1.7em; line-height: 1.7; }
    .kb-prose h4 { font-size: 1.05rem; }
    .kb-prose ul, .kb-prose ol { padding-inline-start: 1.25rem; }
    .kb-prose figure.kb-ai-figure { margin: 1.75rem 0; }

    /* Long inline tokens (URLs, env var names) must wrap, not widen the page. */
    .kb-prose :not(pre) > code { overflow-wrap: anywhere; word-break: break-word; }
    .kb-prose pre { font-size: .8rem; padding: .85rem 1rem; border-radius: 10px; -webkit-overflow-scrolling: touch; }
    .kb-prose blockquote { padding: .75rem 1rem; border-radius: 0 10px 10px 0; background: rgba(255, 255, 255, .04); }
    html[dir="rtl"] .kb-prose blockquote { border-radius: 10px 0 0 10px; }
    .kb-prose table { font-size: .85rem; -webkit-overflow-scrolling: touch; }
    .kb-prose th, .kb-prose td { padding: .5rem .6rem; }
    .kb-prose th { white-space: nowrap; }

    /* FAQ */
    .kb-faq { margin-top: 2.5rem; }
    .kb-faq h2 { font-size: 1.3rem; }
    .kb-faq__item { padding: .8rem 1rem; }
    .kb-faq__item summary { font-size: .95rem; }
    .kb-faq__item p { font-size: .95rem; line-height: 1.9; }

    /* Comments */
    .kb-comments { margin-top: 2.75rem; padding-top: 2rem; }
    .kb-comments__title { font-size: 1.3rem; margin-bottom: 1.1rem; }
    .kb-comments__replies { padding-inline-start: .75rem; }
    .kb-comment { padding: .85rem 1rem; }
    .kb-comment__body { font-size: .95rem; }
    .kb-comment__reply { padding: .35rem 0; } /* larger tap target */
    .kb-comment-form { margin-top: 2rem; }
    .kb-comment-form__title { font-size: 1.1rem; flex-wrap: wrap; gap: .5rem 1rem; }
    /* 16px+ inputs stop iOS Safari from zooming the page on focus. */
    .kb-comment-form input, .kb-comment-form textarea { font-size: 16px; }
    .kb-btn { justify-self: stretch; width: 100%; padding: .9rem 1.5rem; }

    /* Related posts: drop the double section padding, give the cards room
       below the heading (the template has no .blogs-wrapper-box margin). */
    .blog-area-3 .blog-area-3-inner { padding-top: 8px; padding-bottom: 48px; }
    .blog-area-3 .section-title { font-size: 24px; }
    .blog-area-3 .blogs-wrapper { margin-top: 1.75rem; gap: 32px 20px; }
    .blog-area-3 .blog-box .title { font-size: 19px; line-height: 1.7; }
    .blog-area-3 .blog-box .meta { font-size: .85rem; }
}

@media only screen and (max-width: 575px) {
    .blog-details-area h1.section-title { font-size: 23px; }
}
