/* CF Theme - Custom Fixes for Horizontal Scroll Issues */
/* ============================================
   PERFORMANCE & LOADING OPTIMIZATIONS
   ============================================ */

/* Remove initial hide/fade that waits for images */
body {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Images visible by default, smooth transition for lazy-loaded ones */
img {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Only fade in lazy-loaded images */
img[loading="lazy"]:not(.cf-img) {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Placeholder only for lazy-loaded images while loading */
img[loading="lazy"]:not(.loaded):not(.cf-img) {
    background: linear-gradient(90deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 200px; /* Prevent layout shift */
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Prevent layout shift */
img[width][height] {
    height: auto;
}

/* Fix: Prevent horizontal overflow caused by Bootstrap row negative margins */
body {
    overflow-x: hidden !important;
}

html {
    overflow-x: hidden !important;
}

/* Alternative fix: Ensure swiper containers don't cause overflow */
.js-section-slider {
    max-width: 100%;
}

/* Fix: Navigation buttons positioning - reduce distance from edges */
.navAbsolute.-type-2 {
    left: -40px !important;
    right: -40px !important;
}

/* Fix: Title truncation to 2 lines for category page cards */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-height: 2.6em; /* 2 lines * 1.3 line-height */
}

/* Fix: Update line-height for pageHero title */
.pageHero.-type-1 .pageHero__title {
    line-height: 1.1 !important;
    font-size: 68px;
}

/* Fix: Blogpost iframe responsive styling */
.blogpost iframe {
    width: 100%;
}

.blogpost .is-type-video iframe {
    aspect-ratio: 16 / 9;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
}

/* Fix: Blogpost spacing for h3 and ul */
.blogpost h3, .blogpost ul {
    margin-bottom: 20px;
}

/* Fix: Blogpost link styling */
.blogpost a {
    color: #0a58ca;
    text-decoration: underline;
}

.blogpost a:hover {
    color: #7aa095;
    text-decoration: none;
}

/* AI Summary Block */
.ai-summary {
	display: flex; align-items: center; gap: 20px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 32px 0;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.ai-summary-heading {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #92400e;
    letter-spacing: 0.01em;
}

.ai-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ai-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ai-link:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.ai-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ai-link span {
    color: #374151;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-summary {
        padding: 16px 20px;
        margin: 24px 0;
    }
    
    .ai-summary-heading {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .ai-summary-list {
        gap: 8px;
    }
    
    .ai-link {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .ai-link svg {
        width: 18px;
        height: 18px;
    }
}

/* Sommaire (Table of Contents) */
.sommaire-container {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0ea5e9;
    border-radius: 12px;
    padding: 24px;
    margin: 0 0 32px 0;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
}

.sommaire-title {
    font-size: 18px;
    font-weight: 600;
    color: #0c4a6e;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sommaire-title::before {
    content: "📑";
    font-size: 20px;
}

.sommaire-list {
    margin: 0;
    padding-left: 24px;
    list-style: decimal;
}

.sommaire-list li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.sommaire-list li:last-child {
    margin-bottom: 0;
}

.sommaire-link {
    color: #0369a1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
}

.sommaire-link:hover {
    color: #0ea5e9;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .sommaire-container {
        padding: 20px;
        margin: 0 0 24px 0;
    }
    
    .sommaire-title {
        font-size: 16px;
    }
    
    .sommaire-list {
        padding-left: 20px;
    }
    
    .sommaire-link {
        font-size: 14px;
    }
}

/* Promo Block - Château La Fontaine */
.promo-block-container {
    margin: 40px 0;
}

.promo-block {
    background: linear-gradient(135deg, #7aa095 0%, #6b9187 100%);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: 0 4px 20px rgba(122, 160, 149, 0.25);
    position: relative;
    overflow: hidden;
}

.promo-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.promo-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.promo-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.promo-title {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.promo-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.promo-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: #7aa095 !important;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.promo-button:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #6b9187;
}

.promo-button svg {
    transition: transform 0.3s ease;
}

.promo-button:hover svg {
    transform: translateX(4px);
}

.promo-image {
    flex: 0 0 280px;
    position: relative;
    z-index: 1;
}

.promo-image img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

/* Responsive */
@media (max-width: 968px) {
    .promo-block {
        flex-direction: column;
        text-align: center;
        padding: 28px 24px;
    }
    
    .promo-image {
        flex: 0 0 auto;
        max-width: 240px;
        order: -1;
    }
    
    .promo-title {
        font-size: 22px;
    }
    
    .promo-subtitle {
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    .promo-block-container {
        margin: 32px -20px;
    }
    
    .promo-block {
        border-radius: 0;
        padding: 24px 20px;
    }
    
    .promo-title {
        font-size: 20px;
    }
    
    .promo-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .promo-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .promo-image {
        max-width: 200px;
    }
}