/* =============================================
   CP4U Blog Archive — Custom Styles
   ============================================= */

/* Full-width override */
.cp4u-blog-page,
.cp4u-blog-page #content,
.cp4u-blog-page .site-content,
.cp4u-blog-page .ast-container,
.cp4u-blog-page #primary,
.cp4u-blog-page .content-area,
.cp4u-blog-page .ast-row,
.cp4u-blog-page #content .ast-container {
    max-width: 100% !important;
    width: 100% !important;
    float: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.cp4u-blog-page #secondary,
.cp4u-blog-page .widget-area {
    display: none !important;
}

/* Kill Astra sidebar layout shifts on blog */
body.blog #primary,
body.home #primary {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.blog .ast-row,
body.home .ast-row {
    display: block !important;
}

body.blog #secondary,
body.home #secondary {
    display: none !important;
}

/* ---- Outer wrap ---- */
.cp4u-blog-wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto !important;
    padding: 48px 40px 72px;
    box-sizing: border-box;
    float: none !important;
}

/* ---- Hero header ---- */
.cp4u-blog-hero {
    text-align: center;
    margin-bottom: 52px;
}

.cp4u-blog-hero-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #003978;
    background: #e8f2fb;
    padding: 5px 14px;
    border-radius: 50px;
    margin-bottom: 14px;
}

.cp4u-blog-hero h1 {
    font-size: 42px !important;
    font-weight: 700 !important;
    color: #131a31 !important;
    margin: 0 0 14px !important;
    line-height: 1.2 !important;
}

.cp4u-blog-hero p {
    font-size: 16px;
    color: #6b7280;
    margin: 0 auto;
    max-width: 540px;
    line-height: 1.7;
}

/* ---- Featured (first post) ---- */
.cp4u-blog-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.09);
    margin-bottom: 52px;
    text-decoration: none !important;
    color: inherit !important;
    transition: box-shadow 0.25s, transform 0.25s;
}

.cp4u-blog-featured:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.14);
    transform: translateY(-3px);
}

.cp4u-blog-featured-img {
    width: 100%;
    height: 100%;
    min-height: 380px;
    object-fit: cover;
    display: block;
}

.cp4u-blog-featured-img-placeholder {
    width: 100%;
    min-height: 380px;
    background: linear-gradient(135deg, #e8f2fb 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
}

.cp4u-blog-featured-body {
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.cp4u-blog-cat-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #003978;
    background: #e8f2fb;
    padding: 4px 12px;
    border-radius: 50px;
    align-self: flex-start;
}

.cp4u-blog-featured-title {
    font-size: 28px;
    font-weight: 700;
    color: #131a31;
    line-height: 1.3;
    margin: 0;
}

.cp4u-blog-featured:hover .cp4u-blog-featured-title {
    color: #003978;
}

.cp4u-blog-featured-excerpt {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.7;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cp4u-blog-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.cp4u-blog-meta-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.cp4u-blog-meta-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.cp4u-blog-meta-author .cp4u-blog-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #003978;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cp4u-blog-meta-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
}

.cp4u-blog-meta-date,
.cp4u-blog-meta-read {
    font-size: 13px;
    color: #9ca3af;
}

.cp4u-blog-featured-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #003978;
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 22px;
    border-radius: 50px;
    text-decoration: none !important;
    align-self: flex-start;
    transition: background 0.2s;
}

.cp4u-blog-featured:hover .cp4u-blog-featured-cta {
    background: #256f96;
}

/* ---- Section heading ---- */
.cp4u-blog-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.cp4u-blog-section-head h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #131a31 !important;
    margin: 0 !important;
    position: relative;
    padding-left: 16px;
}

.cp4u-blog-section-head h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    background: #003978;
    border-radius: 4px;
}

.cp4u-blog-post-count {
    font-size: 13px;
    color: #9ca3af;
    white-space: nowrap;
}

/* ---- Cards grid ---- */
.cp4u-blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

/* ---- Blog Card ---- */
.cp4u-blog-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    color: inherit !important;
    transition: box-shadow 0.22s, transform 0.22s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.cp4u-blog-card:hover {
    box-shadow: 0 10px 32px rgba(0,0,0,0.11);
    transform: translateY(-4px);
}

.cp4u-blog-card-img-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f2fb, #dbeafe);
    flex-shrink: 0;
    position: relative;
}

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

.cp4u-blog-card:hover .cp4u-blog-card-img-wrap img {
    transform: scale(1.05);
}

.cp4u-blog-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.cp4u-blog-card-body {
    padding: 22px 24px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.cp4u-blog-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #131a31;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cp4u-blog-card:hover .cp4u-blog-card-title {
    color: #003978;
}

.cp4u-blog-card-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.65;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.cp4u-blog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

.cp4u-blog-card-read {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #003978;
}

.cp4u-blog-card-read svg {
    transition: transform 0.2s;
}

.cp4u-blog-card:hover .cp4u-blog-card-read svg {
    transform: translateX(3px);
}

/* ---- Pagination ---- */
.cp4u-blog-pagination {
    margin-top: 56px;
    display: flex;
    justify-content: center;
}

.cp4u-blog-pagination .page-numbers {
    display: inline-flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.cp4u-blog-pagination .page-numbers li a,
.cp4u-blog-pagination .page-numbers li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s;
    background: #fff;
}

.cp4u-blog-pagination .page-numbers li a:hover {
    background: #e8f2fb;
    border-color: #003978;
    color: #256f96;
}

.cp4u-blog-pagination .page-numbers li span.current {
    background: #003978;
    border-color: #003978;
    color: #fff;
    font-weight: 700;
}

/* ---- No posts ---- */
.cp4u-blog-empty {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
    font-size: 16px;
}

.cp4u-blog-empty span {
    display: block;
    font-size: 56px;
    margin-bottom: 16px;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .cp4u-blog-grid { grid-template-columns: repeat(2, 1fr); }
    .cp4u-blog-wrap { padding: 36px 28px 56px; }
    .cp4u-blog-hero h1 { font-size: 34px !important; }
}

@media (max-width: 800px) {
    .cp4u-blog-featured { grid-template-columns: 1fr; }
    .cp4u-blog-featured-img,
    .cp4u-blog-featured-img-placeholder { min-height: 240px; }
    .cp4u-blog-featured-body { padding: 28px 28px 32px; }
    .cp4u-blog-featured-title { font-size: 22px; }
}

@media (max-width: 640px) {
    .cp4u-blog-grid { grid-template-columns: 1fr; gap: 18px; }
    .cp4u-blog-wrap { padding: 24px 16px 48px; }
    .cp4u-blog-hero h1 { font-size: 26px !important; }
    .cp4u-blog-featured-body { padding: 22px 20px 26px; }
}


/* =============================================
   CP4U Single Post
   ============================================= */

.cp4u-post { background: #fff; }

/* ── Hero ── */
.cp4u-post__hero {
    position: relative;
    min-height: 360px;
    padding: 80px 20px 60px;
    background-size: cover;
    background-position: center;
    background-color: #131a31;
    color: #fff;
}
@media (min-width: 768px) {
    .cp4u-post__hero { min-height: 460px; padding: 100px 32px 80px; }
}
.cp4u-post__hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,.5), rgba(0,0,0,.72));
}
.cp4u-post__hero-inner {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}
.cp4u-post__back {
    display: inline-block;
    font-size: 13px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    margin-bottom: 18px;
}
.cp4u-post__back:hover { color: #fff; }
.cp4u-post__cat-pill {
    display: inline-block;
    background: rgba(48,144,192,.22);
    border: 1px solid rgba(48,144,192,.55);
    color: #fff !important;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 50px;
    text-decoration: none;
    margin-bottom: 18px;
}
.cp4u-post__cat-pill:hover { background: rgba(48,144,192,.35); color: #fff !important; }
.cp4u-post__title {
    font-size: 28px !important;
    font-weight: 800 !important;
    color: #fff !important;
    line-height: 1.2 !important;
    margin: 0 0 18px !important;
}
@media (min-width: 768px) { .cp4u-post__title { font-size: 44px !important; } }
.cp4u-post__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,.85);
}
.cp4u-post__author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
}
.cp4u-post__author img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.cp4u-post__sep { color: rgba(255,255,255,.45); }

/* ── Body layout ── */
.cp4u-post__body {
    max-width: 760px;
    margin: 0 auto;
    padding: 64px 20px 48px;
}
@media (min-width: 768px) { .cp4u-post__body { padding: 88px 32px 64px; } }

.cp4u-post__body.has-toc { max-width: 1180px; }
@media (min-width: 1024px) {
    .cp4u-post__body.has-toc {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 260px;
        align-items: start;
        gap: 56px;
    }
}
.cp4u-post__main { min-width: 0; }

/* ── Summary box ── */
.cp4u-post__summary {
    background: #f0fdf4;
    border-left: 4px solid #003978;
    border-radius: 6px;
    padding: 22px 26px;
    margin-bottom: 36px;
}
.cp4u-post__summary-label {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #131a31;
    margin-bottom: 12px;
    line-height: 1.2;
}
.cp4u-post__summary p { font-size: 15.5px; line-height: 1.75; color: #374151; margin: 0 0 10px; }
.cp4u-post__summary p:last-child { margin-bottom: 0; }

/* ── CTA box ── */
.cp4u-post__cta {
    background: #f0fdf4;
    border-left: 4px solid #003978;
    border-radius: 6px;
    padding: 26px 28px;
    margin: 40px 0;
}
.cp4u-post__cta-title { font-size: 21px; font-weight: 800; color: #131a31; margin: 0 0 10px; }
.cp4u-post__cta p { font-size: 15.5px; line-height: 1.75; color: #374151; margin: 0 0 10px; }
.cp4u-post__cta p:last-child { margin-bottom: 0; }

/* ── Post content ── */
.cp4u-post__content { font-size: 17px; line-height: 1.75; color: #374151; }
.cp4u-post__content > * { margin-bottom: 22px; }
.cp4u-post__content h2,
.cp4u-post__content h3,
.cp4u-post__content h4 {
    color: #131a31 !important;
    margin-top: 36px !important;
    margin-bottom: 14px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    scroll-margin-top: 100px;
}
.cp4u-post__content h2 { font-size: 26px !important; }
.cp4u-post__content h3 { font-size: 22px !important; }
.cp4u-post__content h4 { font-size: 19px !important; }
.cp4u-post__content p { margin: 0 0 22px; }
.cp4u-post__content a { color: #003978; text-decoration: underline; }
.cp4u-post__content a:hover { color: #256f96; }
.cp4u-post__content img { max-width: 100%; height: auto; border-radius: 10px; margin: 28px 0; display: block; }
.cp4u-post__content ul, .cp4u-post__content ol { margin: 0 0 22px; padding-left: 26px; }
.cp4u-post__content ul { list-style: disc; }
.cp4u-post__content ol { list-style: decimal; }
.cp4u-post__content li { margin-bottom: 8px; }
.cp4u-post__content blockquote {
    border-left: 4px solid #003978;
    padding: 6px 22px;
    margin: 28px 0;
    font-style: italic;
    color: #1f2937;
    background: #f0fdf4;
}
.cp4u-post__content code { background: #f3f4f6; color: #131a31; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.cp4u-post__content pre { background: #131a31; color: #f9fafb; padding: 18px; border-radius: 8px; overflow-x: auto; }
.cp4u-post__content hr { border: 0; border-top: 1px solid #e5e7eb; margin: 36px 0; }
.cp4u-post__content table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 0 0 22px; }
.cp4u-post__content th, .cp4u-post__content td { padding: 10px 14px; border: 1px solid #e5e7eb; text-align: left; }
.cp4u-post__content th { background: #f0fdf4; font-weight: 700; color: #131a31; }

/* ── Table of Contents sidebar ── */
.cp4u-toc {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}
@media (min-width: 1024px) {
    .cp4u-toc {
        position: sticky;
        top: 96px;
        align-self: start;
        max-height: calc(100vh - 128px);
        overflow-y: auto;
        padding: 22px 20px;
    }
}
.cp4u-toc__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9ca3af;
    margin-bottom: 10px;
}
.cp4u-toc__list { list-style: none; margin: 0; padding: 0; }
.cp4u-toc__list--nested { margin: 4px 0 6px 14px; padding-left: 12px; border-left: 1px solid #e5e7eb; }
.cp4u-toc__item { margin: 0; }
.cp4u-toc__link {
    display: block;
    padding: 6px 0 6px 12px;
    margin-left: -13px;
    font-size: 13.5px;
    line-height: 1.45;
    color: #4b5563;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.cp4u-toc__item--h2 > .cp4u-toc__link { font-weight: 700; color: #131a31; }
.cp4u-toc__item--h3 > .cp4u-toc__link { font-size: 13px; }
.cp4u-toc__item--h4 > .cp4u-toc__link { font-size: 12.5px; color: #6b7280; }
.cp4u-toc__link:hover { color: #003978; }
.cp4u-toc__link.is-active {
    color: #003978 !important;
    border-left-color: #003978;
    font-weight: 700;
}
.cp4u-toc__mobile-toggle { display: none; }

@media (max-width: 1023.98px) {
    .cp4u-toc {
        margin-bottom: 32px;
        background: transparent;
        border: none;
    }
    .cp4u-toc__mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        padding: 14px 18px;
        background: #f0fdf4;
        border: 1px solid #dbeafe;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 700;
        color: #131a31;
        cursor: pointer;
        text-align: left;
    }
    .cp4u-toc__chevron { flex-shrink: 0; transition: transform .2s ease; }
    .cp4u-toc[data-open="true"] .cp4u-toc__mobile-toggle { border-radius: 10px 10px 0 0; }
    .cp4u-toc[data-open="true"] .cp4u-toc__chevron { transform: rotate(180deg); }
    .cp4u-toc__panel {
        max-height: 0;
        overflow: hidden;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-top: none;
        border-radius: 0 0 10px 10px;
        transition: max-height .3s ease;
    }
    .cp4u-toc[data-open="true"] .cp4u-toc__panel {
        max-height: 70vh;
        overflow-y: auto;
        padding: 6px 18px 18px;
    }
    .cp4u-toc__label { display: none; }
    .cp4u-post__body.has-toc { display: flex; flex-direction: column; }
    .cp4u-post__body.has-toc .cp4u-toc { order: -1; }
}

/* ── Tags ── */
.cp4u-post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}
.cp4u-post__tag {
    background: #f3f4f6;
    color: #4b5563 !important;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s;
}
.cp4u-post__tag:hover { background: #dbeafe; color: #256f96 !important; }

/* ── Author card ── */
.cp4u-post__author-card {
    margin-top: 40px;
    background: #f9fafb;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    gap: 18px;
    align-items: flex-start;
    border: 1px solid #f3f4f6;
}
.cp4u-post__author-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cp4u-post__author-label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cp4u-post__author-name { font-size: 17px; font-weight: 700; color: #131a31; margin: 0 0 8px; }
.cp4u-post__author-bio { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.55; }

/* ── Prev / Next ── */
.cp4u-post__adjacent {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (min-width: 768px) { .cp4u-post__adjacent { padding: 0 32px 64px; } }
.cp4u-post__adjacent-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.cp4u-post__adjacent-link:hover { border-color: #003978; background: #f0fdf4; }
.cp4u-post__adjacent-link--next { grid-column: 2; text-align: right; align-items: flex-end; }
.cp4u-post__adjacent-dir { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9ca3af; }
.cp4u-post__adjacent-title {
    font-size: 15px;
    font-weight: 700;
    color: #131a31;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 639px) {
    .cp4u-post__adjacent { grid-template-columns: 1fr; }
    .cp4u-post__adjacent-link--next { grid-column: 1; text-align: left; align-items: flex-start; }
    .cp4u-post__adjacent-spacer { display: none; }
}

/* ── Related posts ── */
.cp4u-post__related { background: #f9fafb; padding: 56px 20px; }
.cp4u-post__related-inner { max-width: 1200px; margin: 0 auto; }
.cp4u-post__related-title { font-size: 22px !important; font-weight: 800 !important; color: #131a31 !important; margin: 0 0 24px !important; }
@media (min-width: 768px) { .cp4u-post__related-title { font-size: 28px !important; } }
.cp4u-post__related-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 700px)  { .cp4u-post__related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cp4u-post__related-grid { grid-template-columns: repeat(3, 1fr); } }
