/* ============================================
   Single Blog Post Detail Page
   ============================================ */

/* --- Variables (inherit from blog-filter) --- */
.sp-wrapper {
    --sp-primary: #00c3fe;
    --sp-primary-dark: #0284c7;
    --sp-primary-light: #e0f2fe;
    --sp-bg: #f8fafc;
    --sp-white: #ffffff;
    --sp-text: #1e293b;
    --sp-text-muted: #64748b;
    --sp-text-light: #94a3b8;
    --sp-border: #e2e8f0;
    --sp-radius: 12px;
    --sp-radius-sm: 8px;
    --sp-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --sp-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --sp-max-width: 900px;
    --sp-wide-width: 1200px;
}

/* --- Wrapper --- */
.sp-wrapper {
    background: var(--sp-bg);
    min-height: 100vh;
}

/* --- Header Section --- */
.sp-header {
    max-width: var(--sp-wide-width);
    margin: 0 auto;
    padding: 48px 24px 0;
    text-align: center;
}

.sp-meta-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sp-meta-top .bf-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sp-meta-dot {
    color: var(--sp-text-light);
    font-size: 14px;
}

.sp-meta-date,
.sp-meta-readtime {
    color: var(--sp-text-muted);
    font-size: 14px;
}

.sp-title {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--sp-text);
    margin: 0 auto 28px;
    max-width: var(--sp-max-width);
    letter-spacing: -0.02em;
}

/* --- Author Row --- */
.sp-author-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 36px;
}

.sp-author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sp-border);
}

.sp-author-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sp-primary-light), var(--sp-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-white);
    font-weight: 700;
    font-size: 18px;
}

.sp-author-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-author-name {
    font-weight: 600;
    color: var(--sp-text);
    font-size: 15px;
}

.sp-author-verified {
    display: inline-flex;
    align-items: center;
    color: var(--sp-primary);
}

.sp-author-verified svg {
    width: 16px;
    height: 16px;
}

.sp-author-readtime {
    color: var(--sp-text-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sp-author-readtime svg {
    width: 16px;
    height: 16px;
}

/* --- Featured Image --- */
.sp-featured-image {
    max-width: var(--sp-wide-width);
    margin: 0 auto 48px;
    padding: 0 24px;
}

.sp-featured-image img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: cover;
    border-radius: var(--sp-radius);
    display: block;
}

/* --- Content Layout (2 columns) --- */
.sp-content-layout {
    max-width: var(--sp-wide-width);
    margin: 0 auto;
    padding: 0 24px 60px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 48px;
    align-items: start;
}

/* --- Main Content --- */
.sp-content {
    min-width: 0;
}

.sp-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 48px 0 16px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.sp-content h2:first-child {
    margin-top: 0;
}

.sp-content h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--sp-text);
    margin: 36px 0 12px;
    line-height: 1.35;
}

.sp-content h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--sp-text);
    margin: 28px 0 10px;
}

.sp-content p {
    font-size: 17px;
    line-height: 1.8;
    color: #374151;
    margin: 0 0 20px;
}

.sp-content a {
    color: var(--sp-primary-dark);
    text-decoration: underline;
    text-decoration-color: rgba(0, 132, 199, 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s;
}

.sp-content a:hover {
    text-decoration-color: var(--sp-primary-dark);
}

.sp-content ul,
.sp-content ol {
    margin: 0 0 24px;
    padding-left: 24px;
}

.sp-content li {
    font-size: 17px;
    line-height: 1.8;
    color: #374151;
    margin-bottom: 8px;
}

.sp-content blockquote {
    border-left: 4px solid var(--sp-primary);
    margin: 32px 0;
    padding: 20px 24px;
    background: var(--sp-primary-light);
    border-radius: 0 var(--sp-radius-sm) var(--sp-radius-sm) 0;
    font-size: 17px;
    line-height: 1.7;
    color: var(--sp-text);
}

.sp-content blockquote p {
    margin: 0;
    color: var(--sp-text);
}

.sp-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--sp-radius-sm);
    margin: 24px 0;
}

.sp-content pre {
    background: var(--sp-text);
    color: #e2e8f0;
    padding: 20px 24px;
    border-radius: var(--sp-radius-sm);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
    margin: 24px 0;
}

.sp-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 15px;
    color: #e11d48;
}

.sp-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.sp-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.sp-content th,
.sp-content td {
    border: 1px solid var(--sp-border);
    padding: 12px 16px;
    text-align: left;
    font-size: 15px;
}

.sp-content th {
    background: #f8fafc;
    font-weight: 600;
}

.sp-content figure {
    margin: 32px 0;
}

.sp-content figcaption {
    text-align: center;
    color: var(--sp-text-muted);
    font-size: 14px;
    margin-top: 8px;
}

/* WP blocks inside content */
.sp-content .wp-block-image {
    margin: 32px 0;
}

.sp-content .wp-block-image img {
    border-radius: var(--sp-radius-sm);
}

/* --- Sidebar --- */
.sp-sidebar {
    position: sticky;
    top: 100px;
}

/* --- Table of Contents --- */
.sp-toc {
    background: var(--sp-white);
    border-radius: var(--sp-radius);
    padding: 24px;
    box-shadow: var(--sp-shadow);
    border: 1px solid var(--sp-border);
    margin-bottom: 24px;
}

.sp-toc-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-toc-title svg {
    width: 18px;
    height: 18px;
    color: var(--sp-primary);
}

.sp-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sp-toc-list li {
    margin-bottom: 0;
}

.sp-toc-list a {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--sp-text-muted);
    text-decoration: none;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
}

.sp-toc-list a:hover {
    color: var(--sp-primary-dark);
    background: var(--sp-primary-light);
    border-left-color: var(--sp-primary);
}

.sp-toc-list a.active {
    color: var(--sp-primary-dark);
    background: var(--sp-primary-light);
    border-left-color: var(--sp-primary);
    font-weight: 600;
}

/* --- Sidebar CTA Card --- */
.sp-sidebar-cta {
    background: var(--sp-white);
    border-radius: var(--sp-radius);
    overflow: hidden;
    box-shadow: var(--sp-shadow);
    border: 1px solid var(--sp-border);
}

.sp-sidebar-cta-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.sp-sidebar-cta-body {
    padding: 20px;
}

.sp-sidebar-cta-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 8px;
}

.sp-sidebar-cta-text {
    font-size: 14px;
    color: var(--sp-text-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

.sp-sidebar-cta-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--sp-primary);
    color: var(--sp-white) !important;
    border-radius: var(--sp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s;
}

.sp-sidebar-cta-btn:hover {
    background: var(--sp-primary-dark);
}

/* --- Mid-Article CTA Banner --- */
.sp-cta-banner {
    background: var(--sp-primary-light);
    border-radius: var(--sp-radius);
    padding: 28px 32px;
    margin: 40px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.sp-cta-banner-text h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 4px;
}

.sp-cta-banner-text p {
    font-size: 14px;
    color: var(--sp-text-muted);
    margin: 0;
}

.sp-cta-banner-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--sp-primary);
    color: var(--sp-white) !important;
    border-radius: var(--sp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background 0.2s;
}

.sp-cta-banner-btn:hover {
    background: var(--sp-primary-dark);
}

/* --- Author Bio Box --- */
.sp-author-bio {
    max-width: var(--sp-max-width);
    margin: 0 auto 60px;
    padding: 0 24px;
}

.sp-author-bio-inner {
    background: var(--sp-white);
    border-radius: var(--sp-radius);
    padding: 32px;
    box-shadow: var(--sp-shadow);
    border: 1px solid var(--sp-border);
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.sp-author-bio-avatar {
    flex-shrink: 0;
}

.sp-author-bio-avatar img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--sp-primary-light);
}

.sp-author-bio-avatar .sp-avatar-placeholder-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sp-primary-light), var(--sp-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-white);
    font-weight: 700;
    font-size: 28px;
}

.sp-author-bio-content {
    flex: 1;
    min-width: 0;
}

.sp-author-bio-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-author-bio-role {
    font-size: 14px;
    color: var(--sp-primary-dark);
    font-weight: 500;
    margin: 0 0 12px;
}

.sp-author-bio-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--sp-text-muted);
    margin: 0;
}

/* --- Related Posts --- */
.sp-related {
    background: var(--sp-white);
    border-top: 1px solid var(--sp-border);
    padding: 60px 24px;
}

.sp-related-inner {
    max-width: var(--sp-wide-width);
    margin: 0 auto;
}

.sp-related-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--sp-text);
    text-align: center;
    margin: 0 0 36px;
}

.sp-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.sp-related-card {
    background: var(--sp-bg);
    border-radius: var(--sp-radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--sp-border);
}

.sp-related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sp-shadow-md);
}

.sp-related-card a {
    text-decoration: none;
    color: inherit;
}

.sp-related-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.sp-related-card-image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-related-card-image-placeholder svg {
    width: 40px;
    height: 40px;
    color: var(--sp-text-light);
}

.sp-related-card-body {
    padding: 20px;
}

.sp-related-card-badge {
    margin-bottom: 10px;
}

.sp-related-card-badge .bf-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 16px;
}

.sp-related-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-related-card-excerpt {
    font-size: 14px;
    color: var(--sp-text-muted);
    line-height: 1.6;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-related-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--sp-text-light);
}

.sp-related-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-related-card-author img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* --- All Blogs Slider --- */
.sp-all-blogs {
    background: var(--sp-bg);
    padding: 60px 24px 72px;
    border-top: 1px solid var(--sp-border);
}

.sp-all-blogs-inner {
    max-width: var(--sp-wide-width);
    margin: 0 auto;
}

.sp-all-blogs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.sp-all-blogs-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0;
}

.sp-all-blogs-nav {
    display: flex;
    gap: 10px;
}

.sp-slider-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--sp-border);
    background: var(--sp-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--sp-text);
}

.sp-slider-btn:hover {
    border-color: var(--sp-primary);
    color: var(--sp-primary);
    box-shadow: var(--sp-shadow);
}

.sp-slider-btn.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
    border-color: var(--sp-border);
    color: var(--sp-text-light);
}

.sp-slider-btn svg {
    width: 20px;
    height: 20px;
}

.sp-blogs-swiper {
    overflow: hidden;
}

.sp-blogs-swiper .swiper-slide {
    height: auto;
}

.sp-blogs-swiper .sp-related-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--sp-white);
}

.sp-blogs-swiper .sp-related-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sp-blogs-swiper .sp-related-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sp-blogs-swiper .sp-related-card-excerpt {
    flex: 1;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sp-content-layout {
        grid-template-columns: 1fr 280px;
        gap: 32px;
    }

    .sp-title {
        font-size: 34px;
    }
}

@media (max-width: 768px) {
    .sp-content-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .sp-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-top: 40px;
    }

    .sp-header {
        padding-top: 32px;
    }

    .sp-title {
        font-size: 28px;
    }

    .sp-featured-image img {
        max-height: 360px;
    }

    .sp-content h2 {
        font-size: 24px;
    }

    .sp-content h3 {
        font-size: 20px;
    }

    .sp-related-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sp-author-bio-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .sp-author-bio-name {
        justify-content: center;
    }

    .sp-cta-banner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .sp-title {
        font-size: 24px;
    }

    .sp-sidebar {
        grid-template-columns: 1fr;
    }

    .sp-author-row {
        flex-wrap: wrap;
    }

    .sp-featured-image img {
        max-height: 260px;
        border-radius: var(--sp-radius-sm);
    }

    .sp-content p,
    .sp-content li {
        font-size: 16px;
    }

    .sp-related {
        padding: 40px 16px;
    }

    .sp-all-blogs {
        padding: 40px 16px 48px;
    }

    .sp-all-blogs-title {
        font-size: 20px;
    }

    .sp-slider-btn {
        width: 38px;
        height: 38px;
    }
}

/* --- TOC scroll highlight JS helper --- */
.sp-toc-list a.active {
    color: var(--sp-primary-dark);
    background: var(--sp-primary-light);
    border-left-color: var(--sp-primary);
    font-weight: 600;
}
