/*
Theme Name:  Thème enfant personnalisé Astra pour la MAAD
Author:       Lila GERMOND
Template:     astra
Version:      1.0.0
*/

/* ==========================================================================
   1. STYLES GLOBAUX
   ========================================================================== */

body {
    overflow-x: hidden;
}

#primary {
    margin-top: 60px !important;
    margin-bottom: 60px !important;
}

/* Boutons personnalisés */
.ast-custom-button {
    text-align: center;
}

/* Affichage correct sur les pages spécifiques */
.single-actions #primary,
.single-offers #primary,
.single-ressources #primary,
.single-events #primary,
.single-members #primary {
    max-width: 1280px !important;
    margin: 0 auto !important;
}

/* Titres sous forme de label */
.wp-block-heading.section-label,
h2.section-label, h3.section-label {
    display: block;
    width: fit-content;
    border: none;
    border-radius: 6px;
    padding: 10px 40px;
    font-family: 'Karla', sans-serif;
    font-size: 20px !important;
    font-weight: 700;
    letter-spacing: 0;
    line-height: normal;
    color: #FFFFFF;
    background: rgba(29, 89, 55, 0.8);
}

.section-label.has-text-align-center {
    margin-left: auto;
    margin-right: auto;
}

.section-label.has-text-align-left{
    margin-left: 0;
    margin-right: auto;
    width:50%;
    text-align:center;
}

.section-label.has-text-align-right {
    margin-left: auto;
    margin-right: 0;
    width:50%;
    text-align:center;
}


/* ==========================================================================
   2. NAVIGATION & MENU
   ========================================================================== */

.sub-menu {
    max-width: 350px;
}

/* Réduire la hauteur du header - surcharger les styles inline d'Astra */
.site-branding.ast-site-identity {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Optimisation du menu pour petits écrans desktop (1001px - 1280px) */
/* Note: Au-dessus de 1280px, le menu et le bouton s'affichent normalement */
@media (min-width: 1001px) and (max-width: 1280px) {
    /* Réduire l'espacement des côtés du header */
    .ast-primary-header-bar .site-primary-header-wrap {
        padding: 0 10px;
    }

    /* Supprimer l'espace entre le logo et le menu */
    .ast-builder-grid-row,
    .ast-header-break-point .ast-builder-grid-row {
        gap: 0;
    }

    .site-branding,
    .site-logo-img,
    .ast-site-identity {
        margin-right: 0 !important;
        padding-right: 0 !important;
    }

    /* Éviter le retour à la ligne dans le menu */
    .main-header-menu {
        flex-wrap: nowrap !important;
    }

    .main-header-menu > .menu-item {
        flex-shrink: 0;
    }

    /* Bouton CTA - autoriser 2 lignes mais garder forme */
    .ast-header-button-1 .ast-custom-button,
    .ast-primary-header-bar .ast-builder-button-wrap .ast-custom-button,
    .ast-builder-button-wrap .ast-custom-button {
        white-space: normal;
        text-align: center;
        max-width: 130px;
        line-height: 1.3;
        flex-shrink: 0 !important;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    /* Petit espace autour du bouton */
    .ast-builder-button-wrap {
        margin-left: 15px;
        margin-right: 15px;
    }
}

/* Écrans entre 1130px et 1280px - réduire espacements */
@media (min-width: 1130px) and (max-width: 1280px) {
    .main-header-menu > .menu-item > .menu-link {
        padding: 0 10px;
    }
}

/* Écrans entre 1000px et 1130px - réduire logo et police */
@media (min-width: 1001px) and (max-width: 1129px) {
    /* Réduire le logo (min 150px) */
    .site-logo-img img,
    .custom-logo-link img,
    .ast-site-identity img {
        max-width: 150px;
        height: auto;
    }

    /* Réduire la taille de police du menu et du bouton (min 15px) */
    .main-header-menu .menu-link {
        font-size: 15px;
    }

    .ast-header-button-1 .ast-custom-button,
    .ast-primary-header-bar .ast-builder-button-wrap .ast-custom-button,
    .ast-builder-button-wrap .ast-custom-button {
        font-size: 15px;
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .main-header-menu > .menu-item > .menu-link {
        padding: 0 8px;
    }

    /* Réduire les marges du header */
    .ast-primary-header-bar .site-primary-header-wrap {
        padding: 0 5px;
    }
}

/* Menu burger - padding pour les éléments */
@media (max-width: 1000px) {
    .ast-builder-menu-mobile .main-header-menu .menu-item > .menu-link,
    .ast-mobile-popup-drawer .menu-link,
    .ast-mobile-header-content .menu-link {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}


/* ==========================================================================
   3. PAGE D'ACCUEIL
   ========================================================================== */

/* --------------------------------------------------------------------------
   3.1 Carrousel
   -------------------------------------------------------------------------- */

/* Conteneur du carrousel */
.carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-slide {
    min-width: 100%;
    position: relative;
    padding-bottom: 33.33%; /* Ratio 3/1 */
}

.home .carousel-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Boutons de navigation du carrousel */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px 15px;
    z-index: 10;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* Carrousel sur tablettes et mobiles */
@media (max-width: 1279px) {
    .carousel-btn {
        font-size: 1.5rem;
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .carousel-btn {
        font-size: 1.2rem;
        padding: 6px 10px;
    }
}

/* --------------------------------------------------------------------------
   4.2 Derniers articles (page d'accueil)
   -------------------------------------------------------------------------- */

.home-latest-posts {
    max-width: 1280px;
    margin: 60px auto;
    padding: 0 20px;
}

.home-latest-posts-title {
    margin-bottom: 30px;
    text-align: center;
}

.home-latest-posts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Carte article */
.home-post-item {
    flex: 0 0 calc(33.333% - 14px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

.home-post-thumbnail img {
    width: 100%;
    height: auto;
    aspect-ratio: 660 / 440;
    object-fit: cover;
    display: block;
}

.home-post-content {
    padding: 15px;
}

.home-post-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.home-post-title a {
    text-decoration: none;
    color: inherit;
}

.home-post-title a:hover {
    text-decoration: underline;
}

.home-post-date {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.home-post-excerpt {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
}

.home-post-link {
    display: inline-block;
    font-size: 0.9em;
}


/* ==========================================================================
   4. PAGE DES ACTIONS
   ========================================================================== */

/* Grille des actions */
.actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.action-article {
    flex: 0 0 calc(33.333% - 14px);
    text-align: justify;
    padding: 10px;
    box-sizing: border-box;
}

/* Masquer le texte des actions */
.action-content {
    display: none;
}

/* Image en format 3/2 (photo classique) */
.action-article > img,
.action-article .wp-post-image {
    width: 100% !important;
    height: unset !important;
    aspect-ratio: 3 / 2 !important;
    object-fit: cover !important;
    margin-bottom: 15px;
}

.action-title {
    margin: 10px 0;
    text-align: center;
}

/* Bouton pleine largeur */
.action-meta {
    width: 100%;
}

.action-meta .ast-custom-button {
    width: 100%;
    display: block;
}

/* Page single action */
.action-pdf-container {
    margin-top: 30px;
}

.action-pdf-container .ast-custom-button {
    display: inline-block;
}


/* ==========================================================================
   5. PAGE DES OFFRES D'EMPLOI
   ========================================================================== */

/* Grille des offres */
.offers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.offer-article {
    flex: 0 0 calc(33.333% - 14px);
    text-align: justify;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

.offer-meta {
    text-align: left;
    margin-top: 10px;
}

.offer-title {
    text-align: center;
    margin-bottom: 15px;
}

.offer-logo-container {
    text-align: center;
    margin-bottom: 8px;
}

.offer-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
}

.offer-pdf-link {
    display: block;
    margin: 25px auto 0;
    text-align: center;
}


/* ==========================================================================
   6. PAGE DES MEMBRES
   ========================================================================== */

/* --------------------------------------------------------------------------
   Liste des membres (page-members)
   -------------------------------------------------------------------------- */

/* Filtres */
.members-filters {
    margin-bottom: 30px;
}

.members-filters form {
    display: flex;
    gap: 15px;
    align-items: center;
}

.members-filters select {
    padding: 14px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    max-width: 700px;
    line-height: 1.5;
    height: auto;
}

/* Grille des membres */
.members-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Carte membre */
.member-article {
    flex: 0 0 calc(33.333% - 14px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.member-logo {
    margin-bottom: 15px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-logo img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.member-title {
    margin: 0 0 25px 0;
    font-size: 1.2em;
}

.member-meta {
    margin-top: auto;
    padding-top: 15px;
}

/* --------------------------------------------------------------------------
   Page single membre
   -------------------------------------------------------------------------- */

/* En-tête avec logo et titre */
.member-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 3px solid var(--ast-global-color-0, #046f44);
}

.member-header-logo img {
    height: 100px;
    width: auto;
    object-fit: contain;
}

/* Contenu principal */
.member-content {
    margin-bottom: 40px;
    text-align: justify;
}

/* Section coordonnées */
.member-contact {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
}

.member-contact h2 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.member-contact-info {
    text-align: center;
}

.member-contact-info p {
    margin: 10px 0;
}

.member-contact-info a {
    color: inherit;
}

.member-contact-info a:hover {
    text-decoration: underline;
}

/* Icônes réseaux sociaux */
.member-social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 25px;
}

.member-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgb(29, 88, 55);
    transition: opacity 0.2s ease;
}

.member-social-icon:hover {
    opacity: 0.7;
}

.member-social-icon svg {
    width: 40px;
    height: 40px;
}


/* ==========================================================================
   7. PAGE DES EVENEMENTS
   ========================================================================== */

/* Navigation par mois */
.events-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

#current-month {
    font-size: 25px;
    margin: 0;
}

#events-list {
    margin-top: 20px;
}

/* Carte événement */
.event-item {
    display: block;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

/* Bordures colorées par catégorie */
.event-item.event-pro {
    border-left: 5px solid blue;
}

.event-item.event-public {
    border-left: 5px solid red;
}

.event-item.event-default {
    border-left: 5px solid gray;
}

/* Résumé de l'événement (partie cliquable) */
.event-summary {
    display: flex;
    padding: 10px;
    cursor: pointer;
    background: #f5f5f5;
}

.event-summary:hover {
    background: #ebebeb;
}

/* Partie gauche : date et catégorie */
.event-left {
    padding: 10px;
    width: 180px;
    text-align: center;
    flex-shrink: 0;
}

.event-day {
    font-weight: bold;
}

.event-cat {
    font-size: 0.85em;
    color: #666;
}

/* Badges de catégorie */
.event-cat-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75em;
    border-radius: 4px;
    margin-top: 5px;
    background: #f0f0f0;
    white-space: nowrap;
}

.event-cat-badge.event-pro {
    background: #e6f0ff;
}

.event-cat-badge.event-public {
    background: #ffe6e6;
}

.event-cat-badge.event-default {
    background: #f0f0f0;
}

/* Partie droite : titre et description */
.event-right {
    padding: 10px;
    flex-grow: 1;
}

.event-right h3 {
    margin: 0;
}

.event-right p {
    margin: 0.2em 0 0 0;
    color: #555;
}

/* Détails de l'événement (accordéon) */
.event-details {
    display: none;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #ddd;
}

.event-details p {
    margin: 0.5em 0;
}



/* Page single événement */
.single-events .events-page,
.single-events #events-list,
.single-events .event-item,
.single-events .event-summary,
.single-events .event-details {
    max-width: 100% !important;
    width: 100% !important;
}

.single-events .event-item {
    box-sizing: border-box !important;
}

/* ==========================================================================
   8. PAGE DES ACTUALITES
   ========================================================================== */

/* Titre de la page blog */
.blog #primary > .entry-header {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.blog #primary > .entry-header .entry-title {
    font-size: 2em;
}

/* Conteneur des articles */
.blog .ast-row {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.blog .ast-row article {
    padding-left: 5px;
    padding-right: 5px;
}

/* Images des articles : ratio 660x440 (3/2) sans étirement */
.blog .ast-row article img {
    width: 100%;
    height: auto;
    aspect-ratio: 660 / 440;
    object-fit: cover;
}

/* ==========================================================================
   9. PAGE DES RESSOURCES
   ========================================================================== */

/* Filtres */
.ressources-filters {
    margin-bottom: 30px;
}

.ressources-filters form {
    display: flex;
    gap: 15px;
    align-items: center;
}

.ressources-filters select {
    padding: 14px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    min-width: 200px;
    line-height: 1.5;
    height: auto;
}

/* Grille des ressources */
.ressources-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Carte ressource */
.ressource-article {
    flex: 0 0 calc(33.333% - 14px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

.ressource-image img {
    width: 100%;
    height: unset;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.ressource-content {
    padding: 15px;
}

.ressource-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

/* Tags de taxonomie */
.ressource-taxonomies {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.ressource-type,
.ressource-theme {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.85em;
    border-radius: 4px;
}

.ressource-type {
    background: #e6f0ff;
    color: #0056b3;
}

.ressource-theme {
    background: #f0f0f0;
    color: #555;
}

.ressource-pdf-link {
    display: inline-block;
    margin-top: 10px;
}

/* Page single ressource */
.single-ressources .ressource-article {
    max-width: 600px;
}


/* ==========================================================================
   10. PAGE DES FORMATIONS
   ========================================================================== */

/* Titre de section */
.formations-section-title {
    margin-top: 40px;
    margin-bottom: 20px;
    text-align: center;
}

/* Bannière de section (avec image de fond ACF) */
.formations-section-banner {
    position: relative;
    width: 100%;
    min-height: 160px;
    margin: 40px 0 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}

.formations-section-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
}

.formations-section-banner-title {
    position: relative;
    color: #fff;
    font-weight: 700;
    text-align: center;
    margin: 0;
    padding: 20px;
    font-size: 2em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Grille des formations */
.formations-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 100px;
}

/* Carte formation */
.formation-article {
    flex: 0 0 calc(33.333% - 14px);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.formation-logo {
    margin-bottom: 15px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.formation-logo img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.formation-title {
    margin: 0 0 25px 0;
    font-size: 1.2em;
}

.formation-meta {
    margin-top: auto;
    padding-top: 15px;
}


/* ==========================================================================
   11. PAGE MANIFESTE
   ========================================================================== */

/* Bloc fichier : cacher le lien texte et centrer le bouton */
.wp-block-file {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.wp-block-file > a:not(.wp-block-file__button) {
    display: none;
}


/* ==========================================================================
   12. PIED DE PAGE
   ========================================================================== */




/* ==========================================================================
   13. RESPONSIVE
   ========================================================================== */

/* Tablettes (max 1280px) */
@media (max-width: 1280px) {
    /* Actions */
    .action-article {
        flex: 0 0 calc(50% - 10px);
    }

    /* Offres */
    .offer-article {
        flex: 0 0 calc(50% - 10px);
    }

    /* Membres */
    .member-article {
        flex: 0 0 calc(50% - 10px);
    }

    /* Ressources */
    .ressource-article {
        flex: 0 0 calc(50% - 10px);
    }

    /* Formations */
    .formation-article {
        flex: 0 0 calc(50% - 10px);
    }

    /* Articles accueil */
    .home-post-item {
        flex: 0 0 calc(50% - 10px);
    }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
    /* Actions */
    .action-article {
        flex: 0 0 100%;
    }

    /* Offres */
    .offer-article {
        flex: 0 0 100%;
    }

    /* Membres */
    .member-article {
        flex: 0 0 100%;
    }

    /* Ressources */
    .ressource-article {
        flex: 0 0 100%;
    }

    /* Formations */
    .formation-article {
        flex: 0 0 100%;
    }

    .ressources-filters form {
        flex-wrap: wrap;
    }

    .ressources-filters select {
        min-width: 100%;
    }

    /* Articles accueil */
    .home-post-item {
        flex: 0 0 100%;
    }
}
