/* ==========================================================
   Navigation par thèmes — comprendre-sante.org
   Effet pile de photos avec déploiement au survol
   ========================================================== */

.themes-section {
    background: #f8fafc;
    padding: 64px 0 60px;
    border-bottom: 1px solid #e5e7eb;
}

.themes-section .container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---- Label section ---- */

.themes-section-label {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #20507A;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.themes-section-label::before,
.themes-section-label::after {
    content: '';
    display: block;
    width: 48px;
    height: 1px;
    background: rgba(32, 80, 122, 0.35);
}

/* ---- Grille : 1ère carte pleine largeur, puis 2×2 ---- */

.themes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ---- Carte de base ---- */

.theme-card {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    height: 200px;
    text-decoration: none;
    display: block;
    cursor: pointer;
    background: #0d1b2a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

/* Découvertes accidentelles : full-width + plus haute */
.theme-card:first-child {
    grid-column: 1 / -1;
    height: 260px;
}

.theme-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 64px rgba(0, 0, 0, 0.26);
    text-decoration: none;
}

/* ---- Pile d'images ---- */

.theme-stack {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

.si {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.34, 1.1, 0.64, 1), opacity 0.5s ease;
    transform-origin: center 75%;
}

/* Positions initiales — empilées */
.si-1 { transform: rotate(0deg)   scale(1);    z-index: 5; opacity: 1;    }
.si-2 { transform: rotate(4deg)   scale(0.96); z-index: 4; opacity: 0.82; }
.si-3 { transform: rotate(-4deg)  scale(0.96); z-index: 3; opacity: 0.72; }
.si-4 { transform: rotate(8deg)   scale(0.91); z-index: 2; opacity: 0.62; }
.si-5 { transform: rotate(-8deg)  scale(0.91); z-index: 1; opacity: 0.52; }

/* Survol — déploiement en éventail */
.theme-card:hover .si-1 { transform: rotate(0deg)    scale(1.04);                                  opacity: 1; }
.theme-card:hover .si-2 { transform: rotate(14deg)   scale(0.88) translateX(14%) translateY(7%);   opacity: 1; }
.theme-card:hover .si-3 { transform: rotate(-14deg)  scale(0.88) translateX(-14%) translateY(7%);  opacity: 1; }
.theme-card:hover .si-4 { transform: rotate(24deg)   scale(0.80) translateX(26%) translateY(13%);  opacity: 1; }
.theme-card:hover .si-5 { transform: rotate(-24deg)  scale(0.80) translateX(-26%) translateY(13%); opacity: 1; }

/* ---- Overlay gradient ---- */

.theme-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10, 20, 42, 0.85) 0%,
        rgba(10, 20, 42, 0.18) 38%,
        rgba(10, 20, 42, 0) 100%
    );
    z-index: 10;
    transition: background 0.4s ease;
}

.theme-card:hover .theme-card-overlay {
    background: linear-gradient(
        to top,
        rgba(10, 20, 42, 0.92) 0%,
        rgba(10, 20, 42, 0.28) 48%,
        rgba(10, 20, 42, 0) 100%
    );
}

/* ---- Texte ---- */

.theme-card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 22px 24px;
    z-index: 11;
}

.theme-card-name {
    display: block;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
    transition: transform 0.3s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5), 0 2px 12px rgba(0,0,0,0.4);
}

.theme-card:first-child .theme-card-name {
    font-size: 2rem;
}

.theme-card:hover .theme-card-name {
    transform: translateY(-2px);
}

.theme-card-count {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Indicateur permanent — invite au clic */
.theme-card-body::after {
    content: '→ voir les articles';
    display: block;
    margin-top: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

/* Carte sélectionnée — articles affichés en bas */
.theme-card.theme-selected .theme-card-body::after {
    content: '▼ articles ci-dessous';
    color: rgba(255, 255, 255, 0.95);
    animation: theme-pulse 1.8s ease-in-out infinite;
}

@keyframes theme-pulse {
    0%, 100% { opacity: 0.95; }
    50%       { opacity: 0.5; }
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
    .themes-section {
        padding: 44px 0 40px;
    }

    .themes-grid {
        grid-template-columns: 1fr;
    }

    .theme-card:first-child {
        grid-column: 1;
        height: 190px;
    }

    .theme-card {
        height: 170px;
    }
}

/* ---- Desktop : proportions plus équilibrées ---- */

@media (min-width: 641px) {
    .theme-card:first-child {
        height: 340px;
    }

    .theme-card {
        height: 240px;
    }

    .theme-card-name {
        font-size: 1.15rem;
    }

    .theme-card:first-child .theme-card-name {
        font-size: 1.5rem;
    }
}
