/* ==================================================================
   Blog listing (archive.php) + single post (single.php)
   Relies on shared .page-banner / .breadcrumb from style-page-shared.css,
   .container / .reveal* from style.css, and .glossary-category-badge /
   .glossary-back-link from style-glossary.css (both enqueued together on
   blog views). Card + grid recipe mirrors .service-card / .service-grid.
   ================================================================== */

/* ---------- Blog index: AJAX filter loading state (blog-filter.js) ---------- */
.blog-main {
    position: relative;
    min-height: 220px;
    transition: opacity 0.15s ease;
}

.blog-main.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

/* Spinner overlay, shown only while .is-loading — inserted/removed by
   blog-filter.js rather than always present in the DOM, so it never
   affects layout or shows up in the AJAX response's own markup. */
.blog-loading-spinner {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--blue-soft);
    border-top-color: var(--blue-dark);
    border-radius: 50%;
    animation: blogSpinnerRotate 0.7s linear infinite;
    z-index: 5;
}

@keyframes blogSpinnerRotate {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .blog-loading-spinner {
        animation: none;
    }
}

/* ---------- Blog meta row (date / author / category) ---------- */
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
    margin: 0 0 0.8rem;
    font-size: 0.82rem;
    color: var(--ink-faint);
}

.blog-meta-date::after,
.blog-meta-author::after {
    content: "\2022";
    margin-left: 0.7rem;
    color: var(--ink-faint);
}

.blog-meta > *:last-child::after { content: none; }

/* ---------- Blog index: sidebar + main layout ---------- */
.blog-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: clamp(2rem, 4vw, 3.2rem);
    align-items: start;
}

@media (max-width: 860px) {
    .blog-layout { grid-template-columns: 1fr; }
}

.blog-sidebar {
    position: sticky;
    top: 100px;
}

.blog-category-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    /* Container card so the list reads as a distinct panel against the
       page background, matching the border/shadow recipe used by
       .service-card / .blog-post-card elsewhere on the site. */
    background: #fff;
    border: 1px solid rgba(10, 104, 238, 0.1);
    border-radius: 16px;
    padding: 0.7rem;
    box-shadow: 0 10px 26px -18px rgba(0, 32, 80, 0.25);
}

@media (max-width: 860px) {
    /* A wrapped flex row of variable-width pills reads as ragged/uneven
       on mobile (short labels leave odd gaps, long ones like "Compliance
       & Regulation" force awkward line breaks). A single horizontally
       scrollable row keeps every pill the same height and lets the visitor
       swipe through them — the same "scrollable filter strip" pattern
       used for the A-Z nav on the Glossary page. */
    .blog-category-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.5rem;
    }

    .blog-category-list::-webkit-scrollbar {
        display: none;
    }
}

.blog-category-item {
    display: block;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

@media (max-width: 860px) {
    .blog-category-item {
        flex: none;
        white-space: nowrap;
    }
}

.blog-category-item:hover {
    background: var(--blue-soft);
    color: var(--blue-dark);
}

.blog-category-item.is-active {
    background: var(--blue-dark);
    color: #fff;
}

/* ---------- Blog index: featured spotlight card ---------- */
.blog-featured-card {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 0;
    background: #fff;
    border: 1px solid rgba(10, 104, 238, 0.1);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 14px 32px -20px rgba(0, 32, 80, 0.3);
    margin-bottom: clamp(2rem, 4vw, 2.8rem);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-featured-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 44px -20px rgba(0, 32, 80, 0.4);
}

.blog-featured-card-thumb {
    background: var(--blue-soft);
    min-height: 260px;
}

.blog-featured-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-featured-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(1.6rem, 3vw, 2.4rem);
}

.blog-featured-card-body .glossary-category-badge {
    margin-bottom: 0.9rem;
}

.blog-featured-card-body h2 {
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    color: var(--blue-dark);
    margin: 0 0 0.8rem;
    line-height: 1.3;
}

.blog-featured-card-body p {
    font-size: 0.95rem;
    color: var(--ink-muted);
    line-height: 1.6;
    margin: 0 0 1.3rem;
}

@media (max-width: 700px) {
    .blog-featured-card { grid-template-columns: 1fr; }
    .blog-featured-card-thumb { min-height: 200px; }
}

/* ---------- Blog index: grid + card ---------- */
.blog-post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.6rem;
}

@media (max-width: 640px) {
    .blog-post-grid { grid-template-columns: 1fr; }
}

.blog-post-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #fff;
    border: 1px solid rgba(10, 104, 238, 0.1);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 10px 26px -18px rgba(0, 32, 80, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.blog-post-card:hover {
    transform: translateY(-4px);
    background: var(--blue-dark);
    border-color: var(--blue-dark);
    box-shadow: 0 20px 38px -18px rgba(0, 48, 117, 0.45);
}

.blog-post-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--blue-soft);
}

.blog-post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.blog-post-card:hover .blog-post-card-thumb img { transform: scale(1.05); }

.blog-post-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 1.6rem 1.7rem 1.8rem;
}

.blog-post-card:hover .blog-meta,
.blog-post-card:hover .blog-meta-date,
.blog-post-card:hover .blog-meta-author,
.blog-post-card:hover .blog-meta-date::after { color: rgba(255, 255, 255, 0.6); }

/* .glossary-category-badge's own default (light-blue bg, dark-blue text)
   nearly disappears once the card behind it flips to a dark-blue
   background on hover — invert it to a light badge here so it stays
   legible against the now-dark card. */
.blog-post-card:hover .glossary-category-badge {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.blog-post-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--blue-dark);
    margin: 0 0 0.6rem;
    line-height: 1.35;
    transition: color 0.25s ease;
}

.blog-post-card p {
    font-size: 0.88rem;
    color: var(--ink-muted);
    margin: 0 0 1.1rem;
    line-height: 1.55;
    transition: color 0.25s ease;
}

.blog-post-card:hover h3 { color: #fff; }
.blog-post-card:hover p { color: rgba(255, 255, 255, 0.75); }

.blog-post-card-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--blue);
    transition: color 0.25s ease;
}

.blog-post-card-link svg { width: 16px; height: 16px; stroke: currentColor; transition: transform 0.25s ease; }
.blog-post-card:hover .blog-post-card-link { color: var(--blue-mid); }
.blog-post-card:hover .blog-post-card-link svg { transform: translateX(3px); }

/* ---------- Pagination ---------- */
.blog-pagination {
    margin-top: clamp(2.4rem, 5vw, 3.4rem);
}

.blog-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.blog-pagination .page-numbers:hover,
.blog-pagination .page-numbers.current {
    background: var(--blue-dark);
    color: #fff;
}

/* ---------- Single post ---------- */
.blog-post-inner {
    max-width: 780px;
    margin: 0 auto;
}

.blog-post-thumb {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin: 0 0 2rem;
}

.blog-post-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.blog-content {
    font-size: 1.02rem;
    color: var(--ink);
    line-height: 1.8;
}

.blog-content h2,
.blog-content h3,
.blog-content h4 {
    margin: 1.8rem 0 0.9rem;
}

.blog-content p {
    margin: 0 0 1.2rem;
    color: var(--ink);
}

.blog-content p:last-child { margin-bottom: 0; }

.blog-content ul,
.blog-content ol {
    margin: 0 0 1.2rem 1.3rem;
    color: var(--ink);
    line-height: 1.8;
}

.blog-content a { color: var(--blue); }
.blog-content a:hover { color: var(--blue-mid); }

.blog-content blockquote {
    margin: 1.6rem 0;
    padding: 0.4rem 0 0.4rem 1.4rem;
    border-left: 3px solid var(--blue-mid);
    color: var(--ink-muted);
    font-style: italic;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0;
}

.blog-post-inner .glossary-back-link {
    margin-top: 2.4rem;
}
