/* ========================================
   Blog Post Reusable Components
   ========================================
   These styles auto-apply to standard HTML
   elements inside .blog-post-body — content
   editors just write normal HTML.

   Components:
   1. Callout boxes        — <blockquote>
   2. Tip/Insight variants — <blockquote class="tip|insight|warning">
   3. Comparison tables    — <table>
   4. Image figures        — <figure> + <figcaption>
   5. FAQ accordion        — <details> + <summary>
   6. CTA banner           — <div class="cta-banner">
   7. Step headings        — <h2> auto-numbered
   8. Reading progress bar — added via template
   9. Back to blog link    — added via template
   10. Author card         — added via template
   ======================================== */

/* ----------------------------------------
   1. Callout Boxes — <blockquote>
   Default: purple left border with light bg.
   Add class="tip" for orange, "insight" for
   blue, "warning" for red.
   ---------------------------------------- */
.blog-post-body blockquote {
    border-left: 4px solid #4834d4;
    background: #f4f0ff;
    padding: 20px 24px;
    margin: 28px 0;
    border-radius: 0 10px 10px 0;
    font-style: normal;
    color: #333;
    position: relative;
}

.blog-post-body blockquote p:last-child {
    margin-bottom: 0;
}

.blog-post-body blockquote strong:first-child {
    display: block;
    color: #4834d4;
    font-size: 15px;
    margin-bottom: 8px;
}

/* Tip variant — orange */
.blog-post-body blockquote.tip {
    border-left-color: #f58820;
    background: #fff8f0;
}

.blog-post-body blockquote.tip strong:first-child {
    color: #f58820;
}

/* Insight variant — blue */
.blog-post-body blockquote.insight {
    border-left-color: #2196f3;
    background: #f0f7ff;
}

.blog-post-body blockquote.insight strong:first-child {
    color: #2196f3;
}

/* Warning variant — red */
.blog-post-body blockquote.warning {
    border-left-color: #e74c3c;
    background: #fff5f5;
}

.blog-post-body blockquote.warning strong:first-child {
    color: #e74c3c;
}

/* ----------------------------------------
   2. Comparison Tables — <table>
   Any table inside blog body gets clean
   styling. Use <thead> for header row.
   ---------------------------------------- */
.blog-post-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 28px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.blog-post-body table thead th {
    background: #2d3436;
    color: #fff;
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-post-body table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid #eef1f7;
    vertical-align: top;
}

.blog-post-body table tbody tr:last-child td {
    border-bottom: none;
}

.blog-post-body table tbody tr:nth-child(even) {
    background: #f8f9ff;
}

.blog-post-body table tbody tr:hover {
    background: #eef1f7;
}

/* ----------------------------------------
   3. Image Figures — <figure> + <figcaption>
   Wrap images in <figure> for full-width
   display with optional caption.
   ---------------------------------------- */
.blog-post-body figure {
    margin: 32px 0;
    text-align: center;
}

.blog-post-body figure img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.blog-post-body figcaption {
    margin-top: 10px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

/* Plain images (not in figure) also get styling */
.blog-post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
    display: block;
}

/* ----------------------------------------
   Diagram images — polished presentation
   Images with light/transparent backgrounds
   get a styled container treatment.
   ---------------------------------------- */
.blog-post-body figure {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1f7 100%);
    border: 1px solid #e0e5f0;
    padding: 24px;
    border-radius: 12px;
}

.blog-post-body figure img {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #eef1f7;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin: 0;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.35s ease;
}

.blog-post-body figure:hover img {
    transform: scale(1.03);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* ----------------------------------------
   4. FAQ Accordion — <details> + <summary>
   Just use standard <details><summary>
   elements — they get styled automatically.
   ---------------------------------------- */
.blog-post-body details {
    margin: 12px 0;
    border: 1px solid #eef1f7;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.blog-post-body details[open] {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.blog-post-body details summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
    color: #2d3436;
    cursor: pointer;
    background: #f8f9ff;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.blog-post-body details summary::-webkit-details-marker {
    display: none;
}

.blog-post-body details summary::after {
    content: "+";
    font-size: 20px;
    font-weight: 700;
    color: #4834d4;
    flex-shrink: 0;
    margin-left: 12px;
    transition: transform 0.2s;
}

.blog-post-body details[open] summary::after {
    content: "\2212";
}

.blog-post-body details summary:hover {
    background: #eef1f7;
}

.blog-post-body details > *:not(summary) {
    padding: 0 20px;
}

.blog-post-body details > p:last-child {
    padding-bottom: 16px;
}

/* ----------------------------------------
   5. CTA Banner — <div class="cta-banner">
   A styled call-to-action block.
   ---------------------------------------- */
.blog-post-body .cta-banner {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d2460 100%);
    color: #fff;
    padding: 40px 36px;
    border-radius: 12px;
    margin: 40px 0;
    text-align: center;
}

.blog-post-body .cta-banner h3,
.blog-post-body .cta-banner h2 {
    color: #fff;
    font-family: 'Poppins', sans-serif;
    margin-top: 0;
    margin-bottom: 10px;
}

.blog-post-body .cta-banner p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    font-size: 15px;
}

.blog-post-body .cta-banner a {
    display: inline-block;
    background: linear-gradient(135deg, #f58820, #ffbf00);
    color: #fff;
    padding: 12px 32px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
}

.blog-post-body .cta-banner a:hover {
    box-shadow: 0 4px 20px rgba(245, 136, 32, 0.5);
    transform: translateY(-2px);
}

/* ----------------------------------------
   6. Step Headings — <h2>
   Auto-numbered step headings inside blog body.
   ---------------------------------------- */
.blog-post-body {
    counter-reset: blog-steps;
}

.blog-post-body h2 {
    font-size: 24px;
    margin-top: 40px;
    margin-bottom: 16px;
    color: #2d3436;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.4;
    padding-bottom: 10px;
    border-bottom: 2px solid #eef1f7;
}

.blog-post-body h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 12px;
    color: #4834d4;
    font-weight: 600;
}

/* ----------------------------------------
   7. Lists — <ul> and <ol>
   Better styled lists with spacing.
   ---------------------------------------- */
.blog-post-body ul {
    list-style: none;
    padding-left: 0;
    margin: 18px 0;
}

.blog-post-body ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
}

.blog-post-body ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #f58820, #ffbf00);
    border-radius: 50%;
}

.blog-post-body ol {
    padding-left: 0;
    margin: 18px 0;
    counter-reset: blog-ol;
    list-style: none;
}

.blog-post-body ol li {
    position: relative;
    padding-left: 36px;
    margin-bottom: 10px;
    counter-increment: blog-ol;
}

.blog-post-body ol li::before {
    content: counter(blog-ol);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: #4834d4;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ----------------------------------------
   8. Reading Progress Bar
   Added via template, animated via JS.
   ---------------------------------------- */
.blog-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #f58820, #ffbf00);
    z-index: 10000;
    transition: width 0.1s linear;
}

/* With admin toolbar */
body.toolbar-fixed .blog-reading-progress {
    top: 39px;
}

body.toolbar-fixed.toolbar-tray-open .blog-reading-progress {
    top: 79px;
}

/* ----------------------------------------
   9. Back to Blog Link
   ---------------------------------------- */
.blog-post-back {
    margin-bottom: 20px;
}

.blog-post-back a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #4834d4;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-post-back a:hover {
    color: #341f97;
}

.blog-post-back a i {
    font-size: 12px;
}

/* ----------------------------------------
   10. Author Card
   ---------------------------------------- */
.blog-post-author-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border-radius: 14px;
    margin-top: 48px;
    border: 1px solid #e0e5f0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.blog-post-author-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.blog-post-author-card img {
    width: 120px;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    margin: 0;
    padding: 8px;
    background: #fff;
    border: 1px solid #eef1f7;
    box-shadow: 0 2px 8px rgba(72, 52, 212, 0.1);
}

.blog-post-author-card .author-info {
    flex: 1;
}

.blog-post-author-card .author-name {
    font-weight: 700;
    font-size: 16px;
    color: #2d3436;
    margin-bottom: 4px;
    font-family: 'Poppins', sans-serif;
}

.blog-post-author-card .author-desc {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.5;
}

/* ----------------------------------------
   11. Reading Time Badge
   ---------------------------------------- */
.blog-post-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #6c757d;
}

.blog-post-reading-time i {
    color: #f58820;
}

/* --- Text Block Paragraph (with optional image) --- */
.blog-component-text {
    font-size: 16px;
    line-height: 1.85;
    color: #333;
    margin: 0 0 8px;
}

/* When image is present, use side-by-side layout */
.blog-component-text.has-image {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 28px 0;
}

/* Image figure inside text block */
.blog-component-text .blog-text-figure {
    margin: 0 auto;
    max-width: 80%;
    text-align: center;
    background: #f8f9ff;
    border: 1px solid #e0e5f0;
    border-radius: 12px;
    overflow: hidden;
}

.blog-component-text .blog-text-figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.blog-component-text .blog-text-figure:hover img {
    transform: scale(1.02);
}

.blog-component-text .blog-text-figure figcaption {
    padding: 12px 16px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    line-height: 1.5;
    background: #f8f9ff;
    border-top: 1px solid #eef1f7;
    transition: color 0.2s ease;
}

.blog-component-text .blog-text-figure:hover figcaption {
    color: #4834d4;
}

.blog-component-text .blog-text-content {
    flex: 1;
    min-width: 0;
}

.blog-component-text h2 {
    font-size: 24px;
    margin-top: 36px;
    margin-bottom: 16px;
    color: #2d3436;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.4;
    padding-bottom: 10px;
    border-bottom: 2px solid #eef1f7;
}

.blog-component-text.has-image h2:first-child {
    margin-top: 0;
}

.blog-component-text h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 12px;
    color: #4834d4;
    font-weight: 600;
}

.blog-component-text p { margin-bottom: 18px; }
.blog-component-text strong { color: #2d3436; font-weight: 600; }

.blog-component-text ul {
    list-style: none;
    padding-left: 0;
    margin: 18px 0;
}

.blog-component-text ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
}

.blog-component-text ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #f58820, #ffbf00);
    border-radius: 50%;
}

.blog-component-text ol {
    padding-left: 0;
    margin: 18px 0;
    counter-reset: text-ol;
    list-style: none;
}

.blog-component-text ol li {
    position: relative;
    padding-left: 36px;
    margin-bottom: 10px;
    counter-increment: text-ol;
}

.blog-component-text ol li::before {
    content: counter(text-ol);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: #4834d4;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-component-text a { color: #4834d4; text-decoration: underline; }
.blog-component-text a:hover { color: #341f97; }

/* ========================================
   PARAGRAPH-BASED COMPONENTS
   These styles apply to the Drupal paragraph
   types rendered via field_blog_components.
   ======================================== */

/* --- Callout Box Paragraph --- */
.blog-component-callout {
    border-left: 4px solid #4834d4;
    background: #f4f0ff;
    padding: 20px 24px;
    margin: 28px 0;
    border-radius: 0 10px 10px 0;
    font-style: normal;
    color: #333;
}

.blog-component-callout strong:first-child {
    display: block;
    color: #4834d4;
    font-size: 15px;
    margin-bottom: 8px;
}

.blog-component-callout.tip {
    border-left-color: #f58820;
    background: #fff8f0;
}
.blog-component-callout.tip strong:first-child { color: #f58820; }

.blog-component-callout.insight {
    border-left-color: #2196f3;
    background: #f0f7ff;
}
.blog-component-callout.insight strong:first-child { color: #2196f3; }

.blog-component-callout.warning {
    border-left-color: #e74c3c;
    background: #fff5f5;
}
.blog-component-callout.warning strong:first-child { color: #e74c3c; }

/* --- CTA Banner Paragraph --- */
.blog-component-cta {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d2460 50%, #1a1a3e 100%);
    color: #fff;
    padding: 48px 40px;
    border-radius: 16px;
    margin: 48px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(26, 26, 62, 0.25);
}

.blog-component-cta::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(245, 136, 32, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(72, 52, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.blog-post-body .blog-component-cta h3,
.blog-component-cta h3 {
    color: #ffffff !important;
    font-family: 'Poppins', sans-serif;
    margin: 0 0 14px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border-bottom: none;
    padding-bottom: 0;
}

.blog-component-cta .cta-desc,
.blog-component-cta .cta-desc p {
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.6;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.blog-post-body .blog-component-cta .cta-btn,
.blog-component-cta .cta-btn {
    display: inline-block;
    background: linear-gradient(127deg, #ffbf00, #ffc107 50%, #fd0000);
    color: #ffffff !important;
    padding: 14px 36px;
    border-radius: 5px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    box-shadow: 0 4px 15px rgba(245, 136, 32, 0.3);
    border: 1px solid transparent;
}

.blog-component-cta .cta-btn:hover {
    box-shadow: 0 6px 24px rgba(245, 136, 32, 0.5);
    transform: translateY(-3px);
    color: #ffffff !important;
}

/* --- FAQ Item Paragraph --- */
.blog-component-faq {
    margin: 12px 0;
    border: 1px solid #eef1f7;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.blog-component-faq[open] {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.blog-component-faq summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
    color: #2d3436;
    cursor: pointer;
    background: #f8f9ff;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.blog-component-faq summary::-webkit-details-marker { display: none; }

.blog-component-faq summary::after {
    content: "+";
    font-size: 20px;
    font-weight: 700;
    color: #4834d4;
    flex-shrink: 0;
    margin-left: 12px;
}

.blog-component-faq[open] summary::after { content: "\2212"; }
.blog-component-faq summary:hover { background: #eef1f7; }

.blog-component-faq .faq-answer {
    padding: 16px 20px;
}

.blog-component-faq .faq-answer p {
    margin: 0;
    line-height: 1.7;
}

/* --- Comparison Table Paragraph --- */
.blog-component-table-wrapper {
    margin: 28px 0;
}

.blog-component-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.blog-component-table thead th {
    background: #2d3436;
    color: #fff;
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-component-table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid #eef1f7;
    vertical-align: top;
}

.blog-component-table tbody tr:last-child td { border-bottom: none; }
.blog-component-table tbody tr:nth-child(even) { background: #f8f9ff; }
.blog-component-table tbody tr:hover { background: #eef1f7; }

/* --- Image with Caption Paragraph (deprecated — use Blog Text Block with image instead) --- */
.blog-component-figure {
    margin: 32px 0;
    text-align: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1f7 100%);
    border: 1px solid #e0e5f0;
    padding: 24px;
    border-radius: 12px;
    overflow: hidden;
}

.blog-component-figure img {
    max-width: 100%;
    height: auto;
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #eef1f7;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.35s ease;
}

.blog-component-figure:hover img {
    transform: scale(1.03);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.blog-component-figure figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    transition: color 0.2s ease;
}

.blog-component-figure:hover figcaption {
    color: #4834d4;
}

/* ----------------------------------------
   12. Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
    .blog-post-body h2 {
        font-size: 20px;
    }

    .blog-post-body blockquote {
        padding: 16px 18px;
        margin: 20px 0;
    }

    .blog-post-body table {
        font-size: 13px;
    }

    .blog-post-body table thead th,
    .blog-post-body table tbody td {
        padding: 10px 12px;
    }

    .blog-post-body .cta-banner {
        padding: 28px 20px;
    }

    .blog-post-body details summary {
        font-size: 15px;
        padding: 14px 16px;
    }

    .blog-post-author-card {
        flex-direction: column;
        text-align: center;
    }

    .blog-component-text.has-image {
        flex-direction: column;
    }

    .blog-component-text .blog-text-figure {
        padding: 12px;
    }

    .blog-component-text .blog-text-figure img {
        padding: 4px;
    }
}
