/* assets/css/section_styles.css */

/* Core Layout Rules */
.blog-section {
    position: relative;
    margin-bottom: 48px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Section Header Wrapper (Spans Top, carries Selected Theme) --- */
.section-header-wrap {
    width: 100%;
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.section-header-wrap .section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0;
    letter-spacing: -0.5px;
}

.section-header-wrap .section-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Content Container (White Background, Left Orange Border) --- */
.section-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    gap: 48px;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-left: 6px solid #ff6c37;
    border-radius: 16px;
    padding: 36px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.section-text {
    flex: 1.2;
    z-index: 2;
    text-align: left;
}

.section-paragraph {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #334155;
    margin-bottom: 0;
    
    /* Prevent overflow from Quill Rich HTML elements */
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.section-paragraph a {
    color: #0b3c5d;
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
    transition: color 0.2s ease;
}

.section-paragraph a:hover {
    color: #ff6c37;
}

.section-paragraph img, 
.section-paragraph iframe {
    max-width: 100% !important;
    height: auto !important;
}

.section-paragraph table {
    width: 100% !important;
    max-width: 100% !important;
    display: block;
    overflow-x: auto;
}

.section-paragraph pre,
.section-paragraph code {
    white-space: pre-wrap !important;
    word-break: break-all !important;
    max-width: 100% !important;
}

/* ── Premium Highlights Card ── */
.section-highlights {
    margin-top: 36px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    position: relative;
}

.section-highlights-header {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 16px;
    border-bottom: 2px solid #ff6c37;
    padding-bottom: 8px;
    display: inline-block;
}

.highlights-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.highlights-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #334155;
    font-weight: 500;
}

.highlights-list li:last-child {
    margin-bottom: 0;
}

.highlights-list li::before {
    content: "•";
    color: #ff6c37;
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -4px;
}

/* Hyperlink styling inside highlights */
.highlights-list li a {
    color: #ff6c37;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.highlights-list li a:hover {
    color: #e84393;
}

/* Dark theme highlights adaptation (full-width-banner) */
.section-container.layout-full-width-banner .section-highlights {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.section-container.layout-full-width-banner .section-highlights-header {
    color: #ffffff;
}

.section-container.layout-full-width-banner .highlights-list li {
    color: rgba(255, 255, 255, 0.95);
}

.section-container.layout-full-width-banner .highlights-list li a {
    color: #ff9a6c;
}

.section-container.layout-full-width-banner .highlights-list li a:hover {
    color: #ffffff;
}

/* Highlights scroll animation */
.section-animate .section-highlights {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.3s;
}

.section-animate.in-view .section-highlights {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive highlights */
@media (max-width: 900px) {
    .section-highlights {
        padding: 20px;
        margin-top: 24px;
    }
    .section-highlights-header {
        font-size: 1.1rem;
    }
    .highlights-list li {
        font-size: 0.95rem;
    }
}

.section-media {
    flex: 0.8;
    position: relative;
    z-index: 2;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.section-media:hover {
    transform: translateY(-4px);
}

.section-media img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* --- Layout Modifiers (Applied to .section-container) --- */

/* Image Left */
.section-container.layout-image-left {
    flex-direction: row-reverse;
}

/* Image Right */
.section-container.layout-image-right {
    flex-direction: row;
}

/* Image Top */
.section-container.layout-image-top {
    flex-direction: column-reverse;
    text-align: center;
    gap: 32px;
}
.section-container.layout-image-top .section-media,
.section-container.layout-image-top .section-text {
    flex: none;
    width: 100%;
}
.section-container.layout-image-top .section-media {
    max-width: 800px;
    margin: 0 auto;
}

/* Image Bottom */
.section-container.layout-image-bottom {
    flex-direction: column;
    text-align: center;
    gap: 32px;
}
.section-container.layout-image-bottom .section-media,
.section-container.layout-image-bottom .section-text {
    flex: none;
    width: 100%;
}
.section-container.layout-image-bottom .section-media {
    max-width: 800px;
    margin: 0 auto;
}

/* Full Width Banner (Special styled container overlay) */
.section-container.layout-full-width-banner {
    flex-direction: column;
    text-align: center;
    padding: 100px 32px;
    position: relative;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    border-left: 6px solid #ff6c37;
    margin: 10px auto;
    width: 100%;
}

.section-container.layout-full-width-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1;
}

.section-container.layout-full-width-banner .section-text {
    position: relative;
    z-index: 2;
    color: #ffffff !important;
}

.section-container.layout-full-width-banner .section-paragraph {
    color: rgba(255, 255, 255, 0.95) !important;
    max-width: 800px;
    margin: 0 auto;
}

/* --- CURATED PREMIUM HEADER THEMES --- */

/* 1. Midnight Navy (Deep Navy & Gold) */
.section-header-wrap.theme-midnight-navy {
    background: linear-gradient(135deg, #071e3d 0%, #0b3c5d 100%);
    color: #e2e8f0;
}
.section-header-wrap.theme-midnight-navy .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-midnight-navy .section-subtitle {
    color: #ff6c37;
}

/* 2. Sunset Peach (Warm Gradient & Charcoal Text) */
.section-header-wrap.theme-sunset-peach {
    background: linear-gradient(135deg, #ffeedd 0%, #ffd6cc 100%);
    color: #1e293b;
}
.section-header-wrap.theme-sunset-peach .section-title {
    color: #0b3c5d;
}
.section-header-wrap.theme-sunset-peach .section-subtitle {
    color: #ff3d00;
}

/* 3. Emerald Calm (Soft Teal/Mint to Forest Green) */
.section-header-wrap.theme-emerald-calm {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #14532d;
}
.section-header-wrap.theme-emerald-calm .section-title {
    color: #064e3b;
}
.section-header-wrap.theme-emerald-calm .section-subtitle {
    color: #059669;
}

/* 4. Lavender Dream (Sleek Royal Lavender Accent) */
.section-header-wrap.theme-lavender-dream {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    color: #3b0764;
}
.section-header-wrap.theme-lavender-dream .section-title {
    color: #2e0854;
}
.section-header-wrap.theme-lavender-dream .section-subtitle {
    color: #8e54e9;
}

/* 5. Cyberpunk Dark (Futuristic neon outline) */
.section-header-wrap.theme-cyberpunk-dark {
    background: #0f0c1b;
    color: #a5f3fc;
}
.section-header-wrap.theme-cyberpunk-dark .section-title {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}
.section-header-wrap.theme-cyberpunk-dark .section-subtitle {
    color: #06b6d4;
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* 6. Frosted Glass (Glassmorphism layered on background) */
.section-header-wrap.theme-frosted-glass {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #1e293b;
}
.section-header-wrap.theme-frosted-glass .section-title {
    color: #0b3c5d;
}
.section-header-wrap.theme-frosted-glass .section-subtitle {
    color: #328cc1;
}

/* 7. Classic Light (Clean Light Grey & Navy Accent) */
.section-header-wrap.theme-classic-light {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
}
.section-header-wrap.theme-classic-light .section-title {
    color: #0b3c5d;
}
.section-header-wrap.theme-classic-light .section-subtitle {
    color: #64748b;
}

/* 8. Charcoal Slate (Modern Dark Tech Accent) */
.section-header-wrap.theme-charcoal-slate {
    background: #1e293b;
    color: #cbd5e1;
}
.section-header-wrap.theme-charcoal-slate .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-charcoal-slate .section-subtitle {
    color: #94a3b8;
}

/* 9. Royal Amethyst (Deep Purple to Indigo Gradient) */
.section-header-wrap.theme-royal-amethyst {
    background: linear-gradient(135deg, #3f2b96 0%, #a8c0ff 100%);
    color: #ffffff;
}
.section-header-wrap.theme-royal-amethyst .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-royal-amethyst .section-subtitle {
    color: #ffd700;
}

/* 10. Ocean Breeze (Aquamarine to Deep Blue Gradient) */
.section-header-wrap.theme-ocean-breeze {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    color: #ffffff;
}
.section-header-wrap.theme-ocean-breeze .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-ocean-breeze .section-subtitle {
    color: #e0f7fa;
}

/* 11. Forest Dawn (Warm Gold to Minty Teal Gradient) */
.section-header-wrap.theme-forest-dawn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #ffffff;
}
.section-header-wrap.theme-forest-dawn .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-forest-dawn .section-subtitle {
    color: #fff9db;
}

/* 12. Electric Gold (Crimson Red to Vibrant Orange-Yellow Gradient) */
.section-header-wrap.theme-electric-gold {
    background: linear-gradient(135deg, #f12711 0%, #f5af19 100%);
    color: #ffffff;
}
.section-header-wrap.theme-electric-gold .section-title {
    color: #ffffff;
}
.section-header-wrap.theme-electric-gold .section-subtitle {
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* --- Responsive Layout Adjustments --- */
@media (max-width: 900px) {
    .blog-section {
        margin-bottom: 32px;
        gap: 16px;
    }

    .section-header-wrap {
        padding: 20px 24px;
    }

    .section-header-wrap .section-title {
        font-size: 1.6rem;
    }

    .section-container {
        flex-direction: column !important;
        gap: 24px;
        text-align: center;
        padding: 24px;
    }
    
    .section-media,
    .section-text {
        flex: none;
        width: 100%;
    }
    
    .section-media {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .section-paragraph {
        font-size: 0.98rem;
    }

    .section-container.layout-full-width-banner {
        padding: 60px 16px;
    }
}

/* --- STICKY TABLE OF CONTENTS SIDEBAR --- */
.toc-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
}

.toc-card .toc-header {
    padding: 18px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: .95rem;
    font-weight: 700;
    color: #0b3c5d;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-card .toc-header i {
    color: #ff6c37;
}

.toc-list {
    list-style: none;
    padding: 12px 0;
}

.toc-item {
    border-bottom: 1px solid #f8fafc;
}

.toc-item:last-child {
    border-bottom: none;
}

.toc-link {
    display: block;
    padding: 12px 24px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    color: #ff6c37;
    background: #fafbfc;
    border-left-color: #ff6c37;
    padding-left: 28px;
}

.toc-link.active {
    color: #ff6c37;
    background: #fff8f5;
    border-left-color: #ff6c37;
    padding-left: 28px;
}

/* Premium Scroll Animations: Staggered Header & Slide-Wipe Content */
.section-animate {
    opacity: 1;
}

/* 1. Header Wrap Card Animation (Fade-down & Scale-up) */
.section-animate .section-header-wrap {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity;
}

.section-animate.in-view .section-header-wrap {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Staggered Subtitle Animation (Rise-up) */
.section-animate .section-subtitle {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.15s;
    will-change: transform, opacity;
}

.section-animate.in-view .section-subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Title Animation (Rise-up) */
.section-animate .section-title {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.3s;
    will-change: transform, opacity;
}

.section-animate.in-view .section-title {
    opacity: 1;
    transform: translateY(0);
}

/* 2. Content Container Card Animation (Slide and Wipe) */
.section-animate .section-container {
    opacity: 0.01;
    transform: translateX(-40px);
    -webkit-clip-path: inset(0 99% 0 0);
    clip-path: inset(0 99% 0 0);
    transition: opacity 0.8s ease, 
                transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                -webkit-clip-path 1.0s cubic-bezier(0.25, 1, 0.5, 1),
                clip-path 1.0s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.1s;
    will-change: transform, opacity, clip-path;
}

.section-animate.in-view .section-container {
    opacity: 1;
    transform: translateX(0);
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
}

/* 3. Glossy White Shine Sweep Overlay Animation (Only Header Cards) */
.section-header-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    z-index: 10;
    pointer-events: none;
}

@keyframes header-shine-sweep {
    0% {
        left: -150%;
    }
    33% {
        left: 150%;
    }
    100% {
        left: 150%;
    }
}

.section-animate.in-view .section-header-wrap::after {
    animation: header-shine-sweep 6s infinite ease-in-out;
    animation-delay: 0.3s;
}
