/* ================================================================
   SINGLE BLOG PAGE — single-blog.css
   Enqueue in functions.php alongside blog-page.css and footer.css
================================================================ */

/* ----------------------------------------------------------------
   CSS Variables (inherits brand from blog-page.css if loaded,
   otherwise defined here as fallback)
   ---------------------------------------------------------------- */
:root {
    --sb-accent-red:       #e40e01;
    --sb-accent-purple:    #7c5cbf;       /* sidebar border, TOC active */
    --sb-accent-pink-bg:   #fde8e8;       /* meta tag background */
    --sb-card-bg:          #ffffff;
    --sb-card-border:      #e5e5e5;
    --sb-text-dark:        #1a1a1a;
    --sb-text-muted:       #555555;
    --sb-meta-tag-border:  #cccccc;
    --sb-outer-border-radius:    26px;
    --sb-inner-border-radius:    20px;
    --sb-card-shadow:      0 2px 14px rgba(0, 0, 0, 0.07);
    --sb-font-heading:     'Canva Sans', serif;
    --sb-font-body:        'Canva Sans', Arial, sans-serif;
}


/* ----------------------------------------------------------------
   Page Wrapper
   ---------------------------------------------------------------- */
#single-blog-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    font-family: var(--sb-font-body);
    color: var(--sb-text-dark);
}


/* ----------------------------------------------------------------
   Two-column layout: main (~64%) | sidebar (~36%)
   ---------------------------------------------------------------- */
#single-blog-layout {
    display: grid;
    grid-template-columns: 64fr 36fr;
    gap: 32px;
    align-items: start;
}


/* ================================================================
   MAIN CONTENT — left column
================================================================ */
#single-blog-main {
    min-width: 0; /* prevent grid blowout */
}

/* ── Featured Image ── */
#single-blog-featured-image-wrapper {
    width: 100%;
    border-radius: var(--sb-outer-border-radius);
    overflow: hidden;
    margin-bottom: 24px;
    line-height: 0;
}

.single-blog-featured-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 520px;
    object-fit: cover;
}

/* ── Meta Tags ── */
#single-blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0; /* no extra padding needed outside a card */
}

/* Shared meta tag style — also used in recent-blog cards */
.meta-tag {
    display: inline-block;
    font-size: 13px;
    font-family: var(--sb-font-body);
    padding: 7px 18px;
    border-radius: 30px;
    /* border: 1px solid var(--sb-meta-tag-border); */
    background: var(--sb-accent-pink-bg);
    color: var(--sb-text-dark);
    white-space: nowrap;
}

.meta-tag--category { font-weight: 600; }

/* ── Post Title ── */
#single-blog-title {
    font-family: var(--sb-font-heading);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--sb-text-dark);
    margin: 0 0 28px;
}

/* ── Post Body Content ── */
#single-blog-content {
    font-size: 16px;
    line-height: 1.85;
    color: var(--sb-text-muted);
}

/* Typography inside the post content */
#single-blog-content h2 {
    font-family: var(--sb-font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--sb-text-dark);
    /* margin: 40px 0 14px; */
    scroll-margin-top: 24px; /* offset for sticky TOC */
}

#single-blog-content h3 {
    font-family: var(--sb-font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--sb-text-dark);
    margin: 32px 0 10px;
    scroll-margin-top: 24px;
}

#single-blog-content p {
    margin: 0 0 18px;
}

#single-blog-content ul,
#single-blog-content ol {
    margin: 0 0 18px 24px;
}

#single-blog-content li {
    /* margin-bottom: 6px; */
}

#single-blog-content a {
    color: var(--sb-accent-red);
    text-decoration: underline;
}

#single-blog-content blockquote {
    border-left: 4px solid var(--sb-accent-red);
    margin: 24px 0;
    padding: 12px 20px;
    background: var(--sb-accent-pink-bg);
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

#single-blog-content img {
    max-width: 100%;
    border-radius: 8px;
    /* margin: 16px 0; */
}

#single-blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

#single-blog-content th,
#single-blog-content td {
    border: 1px solid var(--sb-card-border);
    padding: 10px 14px;
    text-align: left;
}

#single-blog-content th {
    background: var(--sb-accent-pink-bg);
    font-weight: 600;
    color: var(--sb-text-dark);
}

/* ── Prev / Next Post Navigation ── */
#single-blog-post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    /* border-top: 1px solid var(--sb-card-border); */
}

#single-blog-post-nav a {
    font-size: 14px;
    font-weight: 600;
    color: var(--sb-accent-red);
    text-decoration: none;
    transition: opacity 0.2s;
}

#single-blog-post-nav a:hover {
    opacity: 0.75;
}

.post-nav-next {
    text-align: right;
}


/* ================================================================
   SIDEBAR — right column
================================================================ */
#single-blog-sidebar {
    position: sticky;
    top: 160px;               /* sticks 24px from top of viewport while scrolling */
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* max-height: calc(100vh - 48px); */
    overflow-y: auto;
    scrollbar-width: none;   /* Firefox */
}

#single-blog-sidebar::-webkit-scrollbar {
    display: none;           /* Chrome/Safari */
}


/* ── Table of Contents Widget ── */
#toc-widget {
    border: 1.5px solid var(--sb-accent-red);
    border-radius: var(--sb-outer-border-radius);
    background: #ffffff;
    overflow: hidden;
}

#toc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--sb-font-body);
    color: var(--sb-text-dark);
    text-align: left;
}

#toc-toggle-icon {
    font-size: 13px;
    color: var(--sb-accent-red);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

#toc-list {
    padding: 4px 0 16px;
    border-top: 1px solid var(--sb-card-border);
}

#toc-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

#toc-items li {
    margin: 0;
}

.toc-link {
    display: block;
    font-size: 14px;
    color: var(--sb-text-muted);
    text-decoration: none;
    padding: 7px 20px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.toc-link--h3 {
    padding-left: 34px;
    font-size: 13px;
}

.toc-link:hover {
    color: var(--sb-accent-purple);
    background: #f8f4ff;
    border-left-color: var(--sb-accent-purple);
}

.toc-link--active {
    color: var(--sb-accent-purple);
    border-left-color: var(--sb-accent-purple);
    font-weight: 600;
    background: #f8f4ff;
}


/* ── Recent Blogs Panel ── */
#recent-blogs-panel {
    /* border: 1.5px solid var(--sb-accent-purple); */
    border-radius: var(--sb-outer-border-radius);
    background: var(--sb-accent-pink-bg);
    padding: 20px;
}

#recent-blogs-heading {
    font-family: var(--sb-font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--sb-text-dark);
    margin: 0 0 16px;
}

#recent-blogs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Each recent blog card */
.recent-blog-card {
    display: block;
    background: var(--sb-card-bg);
    border-radius: var(--sb-outer-border-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--sb-card-shadow);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.recent-blog-card:hover {
    box-shadow: 0 6px 24px rgba(124, 92, 191, 0.18);
    transform: translateY(-2px);
}

/* Card thumbnail */
.recent-blog-card-image-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: var(--sb-outer-border-radius);
    padding: 1rem
}

.recent-blog-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    border-radius: var(--sb-inner-border-radius);
}

.recent-blog-card:hover .recent-blog-card-image {
    transform: scale(1.04);
}

/* Meta tags inside recent cards — smaller padding */
.recent-blog-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 14px 4px;
}

.recent-blog-meta-tags .meta-tag {
    font-size: 11.5px;
    padding: 4px 12px;
}

/* Card title */
.recent-blog-card-title {
    font-family: var(--sb-font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--sb-text-dark);
    line-height: 1.35;
    margin: 4px 14px 8px;
}

/* Card excerpt */
.recent-blog-card-excerpt {
    font-size: 13px;
    line-height: 1.6;
    color: var(--sb-text-muted);
    margin: 0 14px 14px;
}

.no-recent-blogs {
    font-size: 14px;
    color: var(--sb-text-muted);
    text-align: center;
    padding: 20px 0;
}


/* ================================================================
   RESPONSIVE
================================================================ */

/* Tablet: stack into single column */
@media (max-width: 900px) {
    #single-blog-layout {
        grid-template-columns: 1fr;
    }

    /* Sidebar melts away so its children become grid items directly */
    #single-blog-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
        display: contents;
    }

    /* Order: TOC → main content → Recent Blogs */
    #toc-widget {
        order: -1;
    }

    #single-blog-main {
        order: 0;
    }

    #recent-blogs-panel {
        order: 1;
    }
}

/* Mobile */
@media (max-width: 580px) {
    #single-blog-title {
        font-size: 26px;
    }

    #single-blog-content {
        font-size: 15px;
    }

    .recent-blog-card-image-wrapper {
        height: 150px;
    }
}


/* ================================================================
   FAQ ACCORDION — below post content, above prev/next nav
   Clean divider-only style: no card borders, no backgrounds.
================================================================ */
#single-blog-faq {
    margin-top: 52px;
    padding-top: 40px;
    /* border-top: 1px solid var(--sb-card-border); */
}

#single-blog-faq-heading {
    font-family: var(--sb-font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--sb-text-dark);
    margin: 0 0 32px;
    scroll-margin-top: 0;
}

#faq-accordion {
    display: flex;
    flex-direction: column;
}

/* Divider lines only — no card, no background */
.faq-item {
    border-top: 1px solid #e0e0e0;
    background: none !important;   /* override any theme card styles */
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.faq-item:last-child {
    border-bottom: 1px solid #e0e0e0;
}

/* Question button — hardened against theme overrides */
.faq-question {
    width: 100%;
    display: flex !important;       /* theme must not change this to block/inline */
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px;
    padding: 20px 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    position: static !important;    /* prevent theme absolute-positioning the button */
    cursor: pointer;
    text-align: left;
    font-family: var(--sb-font-body);
}

.faq-question-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--sb-text-dark);
    line-height: 1.4;
    flex: 1;
    /* Neutralise any theme link colour that might bleed in */
    text-decoration: none !important;
}

/* Chevron — rotates when open */
.faq-chevron {
    flex-shrink: 0;
    color: var(--sb-text-dark);
    display: flex;
    align-items: center;
    transition: transform 0.25s ease;
}

.faq-chevron--open {
    transform: rotate(180deg);
}

/*
   Answer panel visibility — animated with max-height and opacity.
   JS sets max-height via scrollHeight for pixel-perfect timing.
*/
.faq-answer {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.faq-answer--open {
    opacity: 1;
}

/* Chevron rotation */
.faq-chevron {
    transition: transform 0.3s ease;
}

.faq-chevron--open {
    transform: rotate(180deg);
}

.faq-answer-body {
    padding-bottom: 20px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--sb-text-muted);
    background: none !important;  /* ensure no theme card bg leaks in */
}

.faq-answer-body p {
    margin: 0 0 14px;
}

.faq-answer-body p:last-child {
    margin-bottom: 0;
}

.faq-answer-body a {
    color: var(--sb-accent-red);
    text-decoration: underline;
}