/* ==========================================================================
   THÈMES EXPRESS — page d'accueil
   Vignettes identiques à themes.php, en ligne unique pilotée par Swiper.js
   (swipe manuel + autoplay).
   ========================================================================== */

.themes-express-section {
    margin: 20px auto 30px;
    width: 100%;
    max-width: 1200px;
    padding: 0;
    box-sizing: border-box;
}

/* Conteneur Swiper */
.themes-express-swiper.swiper {
    width: 100%;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.themes-express-swiper .swiper-wrapper {
    display: flex;
    align-items: stretch;
    /* Easing souple : avancement doux entre slides (pas marquee linéaire) */
    transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

.themes-express-swiper .swiper-slide {
    height: auto;
    box-sizing: border-box;
}

/* ==========================================================================
   PRÉ-DIMENSIONNEMENT (avant init Swiper)
   Swiper ajoute la classe .swiper-initialized au conteneur une fois prêt.
   Tant que cette classe est absente : on pré-dimensionne les slides à leur
   largeur cible pour éviter le FOUC où la première slide prend 100% de la
   largeur du wrapper flex.
   ========================================================================== */

.themes-express-swiper:not(.swiper-initialized) {
    /* Masque élégant tant que le layout n'est pas prêt. Pas de display:none :
       il faut laisser le navigateur mesurer les slides pour que Swiper
       puisse calculer les offsets correctement à l'init. */
    opacity: 0;
    visibility: hidden;
}

.themes-express-swiper.swiper-initialized {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease;
}

.themes-express-swiper:not(.swiper-initialized) .swiper-wrapper {
    /* Espace entre slides façon Swiper (spaceBetween) */
    gap: 16px;
}

.themes-express-swiper:not(.swiper-initialized) .swiper-slide {
    /* mobile-first : 1.2 slides visibles */
    flex: 0 0 calc((100% - 16px * 0.2) / 1.2);
    max-width: calc((100% - 16px * 0.2) / 1.2);
}

@media (min-width: 350px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 16px * 0.5) / 1.5);
        max-width: calc((100% - 16px * 0.5) / 1.5);
    }
}

@media (min-width: 400px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }
}

.themes-express-swiper:not(.swiper-initialized) .swiper-button-prev,
.themes-express-swiper:not(.swiper-initialized) .swiper-button-next {
    display: none;
}

/* Le lien remplit le slide */
.themes-express-section .theme-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Vignette (identique aux cartes de themes.php : voir page-themes-cards.css)
   ========================================================================== */

.themes-express-section .theme-card {
    display: flex;
    flex-direction: row;
    background-color: #1E2A3B;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    height: 160px;
    position: relative;
    transform: scale(1);
}

.dark-mode .themes-express-section .theme-card {
    background-color: var(--card-bg, #1a1a2e);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

.themes-express-section .theme-card:hover {
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (min-width: 1025px) {
    .themes-express-section .theme-card:hover .theme-card-bg {
        transform: scale(1.1);
    }
}

/* Image de fond */
.themes-express-section .theme-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--theme-bg-image);
    background-size: cover;
    background-position: center;
    transform: scale(1.05);
    z-index: 0;
    transition: transform 0.3s ease;
}

/* Overlay sombre */
.themes-express-section .theme-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 25, 40, 0.92);
    z-index: 1;
}

/* Overlays colorés par type */
.themes-express-section .theme-card.tag-allergenes .theme-card-overlay {
    background: linear-gradient(135deg, rgba(180, 60, 60, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-nutrition .theme-card-overlay {
    background: linear-gradient(135deg, rgba(50, 140, 65, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-temps .theme-card-overlay {
    background: linear-gradient(135deg, rgba(45, 110, 180, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-prix .theme-card-overlay {
    background: linear-gradient(135deg, rgba(180, 150, 30, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-difficulte .theme-card-overlay {
    background: linear-gradient(135deg, rgba(130, 45, 155, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-etapes .theme-card-overlay {
    background: linear-gradient(135deg, rgba(180, 100, 25, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-ustensiles .theme-card-overlay {
    background: linear-gradient(135deg, rgba(20, 130, 150, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-ingredients .theme-card-overlay {
    background: linear-gradient(135deg, rgba(100, 150, 25, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-personnes .theme-card-overlay {
    background: linear-gradient(135deg, rgba(219, 112, 147, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-regimes .theme-card-overlay {
    background: linear-gradient(135deg, rgba(46, 139, 87, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-saisons .theme-card-overlay {
    background: linear-gradient(135deg, rgba(210, 105, 30, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-occasions .theme-card-overlay {
    background: linear-gradient(135deg, rgba(218, 165, 32, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-regions .theme-card-overlay {
    background: linear-gradient(135deg, rgba(139, 90, 43, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-groupes_age .theme-card-overlay {
    background: linear-gradient(135deg, rgba(100, 149, 237, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-conditions .theme-card-overlay {
    background: linear-gradient(135deg, rgba(186, 85, 211, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-objectifs .theme-card-overlay {
    background: linear-gradient(135deg, rgba(0, 201, 167, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-popularite .theme-card-overlay {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-recettes .theme-card-overlay {
    background: linear-gradient(135deg, rgba(255, 87, 51, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}
.themes-express-section .theme-card.tag-types-ingredients .theme-card-overlay,
.themes-express-section .theme-card.tag-types_ingredients .theme-card-overlay {
    background: linear-gradient(135deg, rgba(107, 142, 35, 0.3) 0%, rgba(10, 15, 25, 0.8) 100%);
}

/* Contenu (titre centré) */
.themes-express-section .theme-card-content {
    flex: 1;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-width: 0;
    position: relative;
    z-index: 2;
    background: transparent;
}

.themes-express-section .theme-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    text-align: center;
}

/* ==========================================================================
   Navigation Swiper (couleurs Savoor) — pas de pagination à boulettes
   ========================================================================== */

.themes-express-swiper .swiper-button-prev,
.themes-express-swiper .swiper-button-next {
    color: #ffffff;
    background: rgba(15, 25, 40, 0.55);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.themes-express-swiper .swiper-button-prev::after,
.themes-express-swiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: 700;
}

.themes-express-swiper .swiper-button-prev:hover,
.themes-express-swiper .swiper-button-next:hover {
    background: rgba(15, 25, 40, 0.85);
}

.themes-express-swiper .swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ==========================================================================
   Bouton "Tous les thèmes"
   ========================================================================== */

.themes-express-actions {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

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

@media (max-width: 1024px) {
    .themes-express-section .theme-card { height: 150px; border-radius: 11px; }
}

@media (max-width: 768px) {
    .themes-express-section .theme-card { height: 140px; border-radius: 10px; }
    .themes-express-swiper .swiper-button-prev,
    .themes-express-swiper .swiper-button-next { display: none; }
}

@media (max-width: 480px) {
    .themes-express-section .theme-card { height: 120px; }
    .themes-express-section .theme-card-title { font-size: 0.95rem; }
}

/* ==========================================================================
   PRÉ-DIMENSIONNEMENT — breakpoints (miroir des breakpoints Swiper JS)
   Chaque breakpoint doit matcher exactement la config JS pour éviter le
   jump visuel entre le CSS-layout et l'init Swiper.
   ========================================================================== */

@media (min-width: 480px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 16px * 0.8) / 1.8);
        max-width: calc((100% - 16px * 0.8) / 1.8);
    }
}

@media (min-width: 640px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-wrapper { gap: 18px; }
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 18px * 1.3) / 2.3);
        max-width: calc((100% - 18px * 1.3) / 2.3);
    }
}

@media (min-width: 768px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-wrapper { gap: 20px; }
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 20px * 2) / 3);
        max-width: calc((100% - 20px * 2) / 3);
    }
}

@media (min-width: 1024px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 20px * 3) / 4);
        max-width: calc((100% - 20px * 3) / 4);
    }
}

@media (min-width: 1200px) {
    .themes-express-swiper:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 calc((100% - 20px * 4) / 5);
        max-width: calc((100% - 20px * 4) / 5);
    }
}
