/* Blog templates (home.php, single.php, category.php, search.php, 404.php, template-parts/blog-*.php).
   Loaded after the division stylesheet, blog.css (patterns) and services.css (.svc variables,
   breadcrumbs, buttons, cards, CTA band). */

/* ---------- Hero (index, category, search, 404) ---------- */
.blog-hero {
    background: linear-gradient(135deg, #18212b 0%, #232e3a 100%);
    color: #fff;
    padding: 3rem 0 3.25rem;
    text-align: center;
}
.blog-hero h1 {
    font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 .75rem;
    color: #fff;
    overflow-wrap: anywhere;
}
.blog-hero p { max-width: 720px; margin: 0 auto 1.5rem; color: rgba(255, 255, 255, .85); font-size: 1.08rem; }
.blog-hero .svc-hero-actions { justify-content: center; margin-top: 1.5rem; }
.blog-hero a.svc-eyebrow { text-decoration: none; }

/* ---------- Search box ---------- */
.blog-search {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    border-radius: 14px;
    padding: .35rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.blog-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: .6rem .9rem;
    font: inherit;
    color: var(--svc-ink);
}
.blog-search input:focus { outline: none; }
.blog-search:focus-within { box-shadow: 0 0 0 3px rgba(88, 146, 61, .45), 0 10px 30px rgba(0, 0, 0, .18); }
.blog-search button {
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    background: var(--svc-green-dark);
    color: #fff;
    width: 3rem;
    font-size: 1.1rem;
}
.blog-search button:hover { background: var(--svc-green-darker); }
.blog-help-search { margin-bottom: 3rem; }
.blog-help-search .blog-search { border: 1px solid var(--svc-line); box-shadow: none; }

/* ---------- Category chips ---------- */
.blog-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 2.25rem; }
.blog-chips a {
    padding: .4rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--svc-line);
    background: #fff;
    color: var(--svc-navy);
    font-weight: 600;
    font-size: .92rem;
    text-decoration: none;
    transition: border-color .2s, background .2s, color .2s;
}
.blog-chips a:hover { border-color: var(--svc-green); color: var(--svc-green-dark); }
.blog-chips a[aria-current] { background: var(--svc-green-dark); border-color: var(--svc-green-dark); color: #fff; }

/* ---------- Lists + cards ---------- */
.blog-list { padding: 2.75rem 0 3.5rem; }
.blog-grid { --blog-cols: 3; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
/* Fixed column widths with a centred last row: 1 or 2 cards never hug the right edge or stretch. */
.blog-grid > * { flex: 0 0 calc((100% - (var(--blog-cols) - 1) * 1.5rem) / var(--blog-cols)); }
.blog-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--svc-line);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    min-width: 0;
}
.blog-card:hover { border-color: var(--svc-green); box-shadow: 0 14px 34px rgba(15, 40, 70, .1); transform: translateY(-3px); }
.blog-card-media { display: block; aspect-ratio: 16 / 10; background: var(--svc-light); overflow: hidden; }
.blog-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-card-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.75rem;
    color: #5f7285;
    background: linear-gradient(135deg, #f4f7fa 0%, #e6ecf1 100%);
}
.blog-card-ph--consulting { color: #0f2846; }
.blog-card-body { display: flex; flex-direction: column; flex: 1 1 auto; padding: 1.25rem 1.35rem 1.35rem; }
.blog-card-cat {
    align-self: flex-start;
    color: var(--svc-green-dark);
    font-size: .85rem;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: .4rem;
}
a.blog-card-cat:hover { text-decoration: underline; }
.blog-card-title { font-size: 1.12rem; font-weight: 700; line-height: 1.55; margin: 0 0 .5rem; }
.blog-card-title a { color: var(--svc-navy); text-decoration: none; }
.blog-card-title a:hover { color: var(--svc-green-dark); }
.blog-card-excerpt { color: var(--svc-muted); font-size: .94rem; margin: 0 0 1rem; }
.blog-card-meta { margin: auto 0 0; display: flex; flex-wrap: wrap; gap: .4rem; color: #5f7285; font-size: .85rem; }

.blog-card--featured { flex-direction: row; margin-bottom: 1.75rem; }
.blog-card--featured .blog-card-media { flex: 0 0 55%; aspect-ratio: auto; min-height: 320px; }
.blog-card--featured .blog-card-body { justify-content: center; padding: 2rem 2.25rem; }
.blog-card--featured .blog-card-title { font-size: clamp(1.3rem, 1rem + 1vw, 1.75rem); line-height: 1.45; }
.blog-card--featured .blog-card-excerpt { font-size: 1.02rem; }
.blog-card--featured .blog-card-meta { margin-top: 0; }

/* Pagination */
.blog-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; list-style: none; margin: 2.5rem 0 0; padding: 0; }
.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0 .75rem;
    border-radius: 10px;
    border: 1px solid var(--svc-line);
    color: var(--svc-navy);
    font-weight: 600;
    text-decoration: none;
}
.blog-pagination a.page-numbers:hover { border-color: var(--svc-green); color: var(--svc-green-dark); }
.blog-pagination .page-numbers.current { background: var(--svc-navy); border-color: var(--svc-navy); color: #fff; }
.blog-pagination .page-numbers.dots { border: 0; }

/* Help block (404, empty search, empty blog) */
.blog-help { padding: 3.5rem 0; }
.blog-help-head { margin-top: 3.5rem; }

/* ---------- Single post ---------- */
.post-hero { background: linear-gradient(135deg, #18212b 0%, #232e3a 100%); color: #fff; padding: 2.75rem 0 3rem; }
.post-hero.has-cover { padding-bottom: 5.5rem; }
.post-hero-inner { max-width: 860px; margin-inline: auto; text-align: center; }
.post-hero a.svc-eyebrow { text-decoration: none; }
.post-hero a.svc-eyebrow:hover { color: #fff; }
.post-hero h1 {
    font-size: clamp(1.65rem, 1.15rem + 2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 1.1rem;
    color: #fff;
    overflow-wrap: anywhere;
}
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; list-style: none; margin: 0; padding: 0; color: rgba(255, 255, 255, .8); font-size: .92rem; }
.post-meta i { color: #8fd16a; margin-inline-end: .3rem; }

.post-cover { max-width: 1040px; margin: -3.75rem auto 0; position: relative; }
.post-cover img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; border-radius: 18px; box-shadow: 0 20px 50px rgba(15, 40, 70, .25); }
.post-cover figcaption { text-align: center; color: var(--svc-muted); font-size: .88rem; margin-top: .6rem; }

.post-layout { padding: 2.75rem 0 1rem; }
.post-layout.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 3rem; align-items: start; }
.post-main { min-width: 0; max-width: 780px; margin-inline: auto; width: 100%; }
.post-body { max-width: none; }
.post-body h2[id], .post-body h3[id] { scroll-margin-top: 130px; }
.post-body > p:first-child { font-size: 1.12rem; color: var(--svc-ink); }
.post-body img { max-width: 100%; height: auto; border-radius: 12px; }
.post-body .saf-plain { padding-inline-start: 1.25rem; }

/* Table of contents: sticky sidebar on desktop, collapsible box on mobile (open state set by posts.js) */
.post-toc { order: 2; position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow: auto; }
.post-toc details { background: var(--svc-light); border: 1px solid var(--svc-line); border-radius: 14px; padding: .4rem .25rem .6rem; }
.post-toc summary { cursor: pointer; font-weight: 700; color: var(--svc-navy); padding: .55rem 1rem; list-style: none; }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc summary::after { content: "\F282"; font-family: "bootstrap-icons"; float: left; font-size: .8rem; margin-top: .35rem; transition: transform .2s; }
.post-toc details[open] summary::after { transform: rotate(180deg); }
.post-toc ol { list-style: none; margin: 0; padding: 0 .5rem; }
.post-toc li a {
    display: block;
    padding: .38rem .6rem;
    border-inline-start: 3px solid transparent;
    border-radius: 0 6px 6px 0;
    color: #3d4f62;
    font-size: .9rem;
    line-height: 1.55;
    text-decoration: none;
}
.post-toc li.toc-h3 a { padding-inline-start: 1.5rem; font-size: .85rem; color: var(--svc-muted); }
.post-toc li a:hover { color: var(--svc-green-dark); background: #fff; }
.post-toc li a.is-active { border-inline-start-color: var(--svc-green); color: var(--svc-navy); font-weight: 600; background: #fff; }

/* Auto CTA inside the article (markup: saf_article_cta()) */
.saf-cta--auto { margin-block: 2.25rem; }
.saf-cta--auto .saf-cta-kicker { color: var(--svc-green-dark); font-size: .85rem; font-weight: 700; margin: 0 0 .25rem; }
.saf-cta--auto h3 { font-size: 1.3rem; margin: 0 0 .5rem; color: var(--svc-navy); }
.saf-cta--auto p,
.post-body .saf-cta--auto p { margin: 0 0 1.1rem; color: #3f4f61; }
.post-body .saf-cta--auto .saf-cta-kicker { color: var(--svc-green-dark); margin-bottom: .25rem; }
.saf-cta-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.post-body .saf-cta--auto a { color: #fff; }
/* light box: the ghost button becomes a navy outline */
.saf-cta--auto .svc-btn--ghost, .post-body .saf-cta--auto a.svc-btn--ghost { border-color: #cfd8e2; color: var(--svc-navy); background: #fff; }
.saf-cta--auto .svc-btn--ghost:hover, .post-body .saf-cta--auto a.svc-btn--ghost:hover { border-color: var(--svc-navy); background: var(--svc-navy); color: #fff; }

/* Share */
.post-share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 2.5rem 0 0; padding: 1.25rem 0; border-top: 1px solid var(--svc-line); border-bottom: 1px solid var(--svc-line); }
.post-share-label { font-weight: 700; color: var(--svc-navy); margin-inline-end: .35rem; }
.post-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0 .75rem;
    border-radius: 10px;
    border: 1px solid var(--svc-line);
    background: #fff;
    color: var(--svc-navy);
    font: inherit;
    font-size: .9rem;
    text-decoration: none;
    transition: background .2s, color .2s, border-color .2s;
}
.post-share-btn i { font-size: 1.1rem; }
.post-share-btn--whatsapp { color: #17803f; }
.post-share-btn--linkedin { color: #0a66c2; }
.post-share-btn:hover { background: var(--svc-navy); border-color: var(--svc-navy); color: #fff; }
.post-share-copy.is-copied { background: var(--svc-green-dark); border-color: var(--svc-green-dark); color: #fff; }

/* Author box */
.post-author { display: flex; gap: 1.1rem; align-items: flex-start; margin: 2rem 0 1rem; padding: 1.4rem 1.5rem; background: var(--svc-light); border-radius: 16px; }
.post-author img { flex: 0 0 64px; width: 64px; height: 64px; object-fit: contain; border-radius: 50%; background: #fff; border: 1px solid var(--svc-line); padding: 8px; }
.post-author p { margin: 0 0 .4rem; color: var(--svc-muted); font-size: .95rem; }
.post-author .post-author-name { color: var(--svc-navy); font-weight: 700; font-size: 1.05rem; }
.post-author a { color: var(--svc-green-dark); font-weight: 600; font-size: .92rem; text-decoration: none; }
.svc--consulting .post-author img { filter: none; }

@media (max-width: 991px) {
    .blog-grid { --blog-cols: 2; }
    .blog-card--featured { flex-direction: column; }
    .blog-card--featured .blog-card-media { flex: none; min-height: 0; aspect-ratio: 16 / 9; }
    .blog-card--featured .blog-card-body { padding: 1.4rem 1.5rem 1.5rem; }
    .post-layout.has-toc { display: block; }
    .post-toc { position: static; max-height: none; overflow: visible; margin-bottom: 1.75rem; }
}
@media (max-width: 767px) {
    .blog-hero { padding: 2.25rem 0 2.5rem; }
    .blog-grid { --blog-cols: 1; }
    .blog-list { padding: 2rem 0 2.5rem; }
    .blog-chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .4rem; margin-inline: -12px; padding-inline: 12px; scrollbar-width: none; }
    .blog-chips a { flex: 0 0 auto; }
    .post-hero { padding: 2rem 0 2.25rem; }
    .post-hero.has-cover { padding-bottom: 4.5rem; }
    .post-cover { margin-top: -3rem; }
    .post-cover img { border-radius: 12px; }
    .post-layout { padding-top: 2rem; }
    .post-author { flex-direction: column; }
    .post-share-label { flex-basis: 100%; }
}
