/**
 * Styles modernes pour les blocs de contenu
 */

/* Container de blocs */
.article-blocks {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Bloc Texte - Style moderne et épuré */
.block-text {
    line-height: 1.8;
    font-size: 1.125rem;
    color: #374151;
}

.block-text p {
    margin-bottom: 1.75rem;
    text-align: justify;
}

/* Images insérées dans TinyMCE - Limites de hauteur */
.block-text img {
    max-height: 800px !important;
    max-width: 100% !important;
    height: auto !important;
    width: auto !important;
    object-fit: contain;
    margin: 2rem auto !important;
    display: block !important;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.block-text h2 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: #111827;
    text-align: center;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.block-text h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: #1f2937;
    text-align: center;
    letter-spacing: -0.015em;
}

.block-text h4 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #374151;
    letter-spacing: -0.01em;
}

.block-text ul,
.block-text ol {
    margin-bottom: 2rem;
    padding-left: 2.5rem;
    margin-top: 1rem;
}

.block-text li {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.block-text li::marker {
    color: #3b82f6;
    font-weight: 600;
}

.block-text strong {
    font-weight: 700;
    color: #111827;
}

.block-text em {
    font-style: italic;
    color: #4b5563;
}

.block-text a {
    color: #3b82f6;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
    word-break: break-word;
    overflow-wrap: break-word;
}

.block-text a:hover {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* Gérer les mots longs et URLs qui pourraient casser la mise en page */
.block-text p,
.block-quote p {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.block-text code {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #dc2626;
    border: 1px solid #e5e7eb;
}

.block-text pre {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    padding: 1.5rem;
    border-radius: 1rem;
    overflow-x: auto;
    margin: 2rem 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

.block-text pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    border: none;
    font-size: 0.95rem;
}

/* Bloc Image */
.block-image {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.block-image.float-left,
.block-image.float-right {
    max-width: 400px;
}

.block-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* Limites de hauteur pour éviter les images trop hautes */
.block-image img.max-h-800 {
    max-height: 800px;
}

.block-image img.max-h-600 {
    max-height: 600px;
}

.block-image img.max-h-400 {
    max-height: 400px;
}

/* Object-fit pour conserver les proportions */
.block-image img[class*="object-cover"] {
    object-fit: cover;
}

.block-image img[class*="object-contain"] {
    object-fit: contain;
}

.block-image figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    font-style: italic;
}

/* Bloc Galerie */
.block-gallery {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.block-gallery img {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.block-gallery img:hover {
    transform: scale(1.05);
}

/* Carousel pour galerie */
.carousel {
    position: relative;
}

.carousel-inner {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-item {
    min-width: 100%;
    flex-shrink: 0;
}

.carousel-prev,
.carousel-next {
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-prev:hover,
.carousel-next:hover {
    background-color: rgba(255, 255, 255, 1);
}

/* Masonry pour galerie */
.masonry-grid {
    column-gap: 1rem;
}

/* Bloc Citation */
.block-quote {
    position: relative;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.block-quote p {
    position: relative;
    z-index: 10;
    margin: 0;
}

.block-quote cite {
    display: block;
    margin-top: 1rem;
}

/* Bloc Vidéo */
.block-video {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.block-video .aspect-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.block-video iframe,
.block-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Animations et transitions */
.block-image img,
.gallery-item img,
.masonry-item img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.block-image:hover img,
.gallery-item:hover img,
.masonry-item:hover img {
    transform: scale(1.05);
}

/* Effet de survol sur les galeries */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Responsivité moderne */
@media (max-width: 768px) {
    .block-image.float-left,
    .block-image.float-right {
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
    }

    .block-text {
        font-size: 1rem;
    }

    .block-text p {
        text-align: left;
    }

    .block-text h2 {
        font-size: 1.75rem;
        margin-top: 2rem;
    }

    .block-text h3 {
        font-size: 1.375rem;
        margin-top: 1.5rem;
    }

    .block-text h4 {
        font-size: 1.125rem;
    }

    .block-quote {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .block-quote p {
        font-size: 1.25rem !important;
    }

    .masonry-grid {
        column-count: 1 !important;
    }

    .article-blocks {
        padding: 0 1rem;
    }
}

/* Clearfix pour les images flottantes */
.clear-both {
    clear: both;
}

/* Amélioration visuelle du contenu legacy */
.article-content-legacy {
    line-height: 1.8;
}

.article-content-legacy p {
    margin-bottom: 1.5rem;
}

.article-content-legacy h2,
.article-content-legacy h3,
.article-content-legacy h4 {
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content-legacy img {
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 2rem auto;
    max-width: 100%;
    height: auto;
}
