/**
 * Draft2Live Blocks Styles
 * Light, neutral styles for TOC and FAQ blocks
 */

/* ==========================================================================
   Table of Contents (TOC) Block
   ========================================================================== */

.toc {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    max-width: 100%;
}

.toc__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-counter;
}

.toc__list li {
    margin: 0.375rem 0;
    line-height: 1.5;
}

.toc__list a {
    color: #495057;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
    display: inline-block;
}

.toc__list a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

/* Nested TOC levels */
.toc__list ul {
    list-style: none;
    margin: 0.25rem 0 0.25rem 1.25rem;
    padding: 0;
}

.toc__list ul li {
    margin: 0.25rem 0;
    font-size: 0.95em;
}

.toc__list ul li::before {
    content: "—";
    color: #adb5bd;
    margin-right: 0.5rem;
}

/* ==========================================================================
   Figure with Caption
   ========================================================================== */

figure {
    margin: 1.5rem 0;
    max-width: 100%;
}

figure.align-left {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
}

figure.align-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

figure.align-right {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    max-width: 50%;
}

figure img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

figure.align-center img {
    margin: 0 auto;
}

figcaption {
    margin-top: 0.5rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    text-align: center;
    font-style: italic;
    background-color: #f8f9fa;
    border-radius: 0 0 6px 6px;
}

/* Clear floats after figures */
.entry-content::after,
.post-content::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   FAQ Block
   ========================================================================== */

.faq-section {
    margin: 2rem 0;
}

.faq-section h2,
.faq-section h3,
.faq-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 1rem 0;
}

.faq-section details {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    transition: box-shadow 0.15s ease-in-out;
}

.faq-section details:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.faq-section details[open] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.faq-section summary {
    padding: 1rem 1.25rem;
    padding-right: 2.5rem;
    font-weight: 500;
    color: #212529;
    cursor: pointer;
    list-style: none;
    position: relative;
    background-color: #f8f9fa;
    transition: background-color 0.15s ease-in-out;
}

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

.faq-section summary::after {
    content: "";
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid #6c757d;
    border-bottom: 2px solid #6c757d;
    transform: translateY(-50%) rotate(45deg);
    transition: transform 0.2s ease-in-out;
}

.faq-section details[open] summary::after {
    transform: translateY(-25%) rotate(-135deg);
}

.faq-section summary:hover {
    background-color: #e9ecef;
}

.faq-section details[open] summary {
    border-bottom: 1px solid #e9ecef;
}

.faq-section details p,
.faq-section details div:not(:first-child) {
    padding: 1rem 1.25rem;
    margin: 0;
    color: #495057;
    line-height: 1.6;
    background-color: #ffffff;
}

/* Alternative: FAQ items without details/summary */
.faq-item {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 1rem;
    padding: 1.25rem;
}

.faq-item .faq-question {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.75rem;
}

.faq-item .faq-answer {
    color: #495057;
    line-height: 1.6;
}

/* ==========================================================================
   Related Posts Block
   ========================================================================== */

.related-posts {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0d6efd;
}

.related-posts__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 1rem 0;
}

.related-posts__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-posts__item {
    padding: 0.625rem 0;
    border-bottom: 1px solid #e9ecef;
}

.related-posts__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.related-posts__item:first-child {
    padding-top: 0;
}

.related-posts__link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}

.related-posts__link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* Inline cross-link style (for AI-inserted links) */
a.cross-link {
    color: #0d6efd;
    text-decoration: none;
    border-bottom: 1px dashed #0d6efd;
    transition: all 0.15s ease-in-out;
}

a.cross-link:hover {
    color: #0a58ca;
    border-bottom-style: solid;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .toc {
        padding: 1rem;
    }

    .toc__list ul {
        margin-left: 1rem;
    }

    figure.align-left,
    figure.align-right {
        float: none;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .faq-section summary {
        padding: 0.875rem 1rem;
        padding-right: 2.25rem;
    }

    .faq-section details p,
    .faq-section details div:not(:first-child) {
        padding: 0.875rem 1rem;
    }

    .related-posts {
        padding: 1rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .toc {
        background-color: #fff;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    figure {
        page-break-inside: avoid;
    }

    figure.align-left,
    figure.align-right {
        float: none;
        max-width: 100%;
    }

    .faq-section details {
        border: 1px solid #ccc;
    }

    .faq-section details[open] summary {
        border-bottom: 1px solid #ccc;
    }
}
