/**
 * ANT Trégastel - CSS Modulaire avec Cloisonnement par Page
 * Architecture : Global (base) → Spécifique par page (.page-xxx)
 * Objectif : Zéro régression graphique et maintenance simplifiée
 */

/* ============================================================
   VARIABLES & RESET GLOBAL
   ============================================================ */

:root {
    --white-cass: #EEEDE0;
    --blue-mer: #0F344B;
    --blue-cta: #3498db;
    --font-header: 'Oswald', sans-serif;
    --font-body: 'Montserrat', sans-serif;

    /* Espacement strict pour les grilles */
    --gap-vertical: 60px;
    --gap-horizontal: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--white-cass);
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Fond général du site = blanc cassé du logo ANT (#eeede0).
   IMPORTANT : pas d'image plein écran ici, sinon elle masque le blanc cassé
   sur toutes les pages. Le hero et la bannière gardent leur propre image. */
.fixed-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--white-cass);
    z-index: -1;
    pointer-events: none;
}

/* Saut d'ancre avec marge */
.card[id] {
    scroll-margin-top: 100px;
}

/* ============================================================
   HEADER & NAVIGATION (GLOBAL)
   ============================================================ */

header {
    background: var(--blue-mer);
    padding: 0 5%;
    position: fixed;
    width: 100%;
    height: 60px;
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

.logo-container {
    height: 90px;
    position: relative;
    top: 27px;
}

.logo-img {
    height: 100%;
    width: auto;
    display: block;
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
}

nav ul li {
    margin-left: 25px;
    position: relative;
}

nav ul li a {
    color: var(--white-cass);
    text-decoration: none;
    font-weight: bold;
    font-family: var(--font-header);
    text-transform: uppercase;
    font-size: 0.95rem;
    padding: 20px 0;
    display: block;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--blue-cta);
}

/* Dropdown Menu */
.dropdown-content {
    display: none;
    position: absolute;
    background: var(--blue-mer);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    top: 100%;
    left: 0;
    z-index: 2001;
}

.dropdown-content a {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    display: block;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Bouton hamburger : masqué sur desktop, affiché sur mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white-cass);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

/* Titre de la page courante : visible uniquement sur mobile, centré dans la barre */
.mobile-page-title {
    display: none;
}

/* ============================================================
   MAIN & CONTAINER (GLOBAL)
   ============================================================ */

main {
    flex: 1;
}

.container {
    padding: 120px 10% 60px 10%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

h2 {
    font-family: var(--font-header);
    color: var(--blue-mer);
    text-transform: uppercase;
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 40px;
}

h3 {
    font-family: var(--font-header);
    color: var(--blue-mer);
    margin-bottom: 15px;
}

/* ============================================================
   CARTES (GLOBAL) — base partagée par TOUTES les pages
   (boutique, agenda, 24h, infos, bénévoles…). Les pages
   Accueil/Association ne font que SURCHARGER ces règles.
   ============================================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap-vertical) var(--gap-horizontal);
    margin-top: 30px;
}

/* Grille 24h : cartes plus larges (max 2 colonnes) */
.card-grid-24h {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.card {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border-top: 5px solid var(--blue-mer);
}

.card h3 {
    font-family: var(--font-header);
    color: var(--blue-mer);
    margin-bottom: 15px;
}

/* Visionneuse PDF intégrée : haute sur desktop, réduite sur mobile */
.pdf-frame {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}
@media (max-width: 900px) {
    .pdf-frame { height: 70vh; }
}

/* En-tête d'événement : intro à gauche, affiche à droite (24h + pages événement) */
.event-head {
    display: flex;
    gap: 30px;
    align-items: stretch;
    margin-bottom: 40px;
}
.event-head .intro-card {
    flex: 1;
    margin-bottom: 0 !important;
}
.event-affiche {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.event-affiche img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: block;
}
.affiche-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--blue-mer);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}
.affiche-placeholder img { width: 90px; opacity: 0.85; }
.affiche-placeholder span {
    font-family: var(--font-header);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    opacity: 0.9;
}
@media (max-width: 900px) {
    .event-head { flex-direction: column; }
    .event-affiche { width: 100%; max-width: 230px; margin: 0 auto; }
}

/* Message d'info / d'alerte (Agenda, etc.) : caché par défaut, encadré jaune, centré.
   S'affiche au clic via JS (toggleMsg). Même rendu que l'encart 24h. */
.info-msg {
    display: none;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 5px;
    padding: 12px 15px;
    margin: 20px auto 0 auto;
    max-width: 600px;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
}

/* Sur mobile : une seule colonne partout */
@media (max-width: 600px) {
    .card-grid,
    .card-grid-24h {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   BOUTONS & FORMULAIRES (GLOBAL)
   ============================================================ */

.btn-main {
    display: inline-block;
    background: var(--blue-cta);
    color: white;
    padding: 15px 35px;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-family: var(--font-header);
    text-transform: uppercase;
    transition: all 0.4s ease;
    cursor: pointer;
}

.btn-main:hover {
    background: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

.btn-large {
    padding: 18px 45px;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--blue-mer);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue-cta);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* ============================================================
   FOOTER (GLOBAL)
   ============================================================ */

footer {
    background: #081d2a;
    color: white;
    text-align: center;
    padding: 50px;
    margin-top: auto;
}

footer a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--blue-cta);
}

.footer-links {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 8px;
    line-height: 1.8;
}

.footer-links .footer-contact-block {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* ============================================================
   LIVE EDITION (ADMIN) - GLOBAL
   ============================================================ */

body.admin-logged-in .editable-zone,
body.admin-logged-in .editable-info {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 5px;
    border-radius: 3px;
    outline: 1px dashed rgba(52, 152, 219, 0.4);
}

body.admin-logged-in .editable-zone:hover,
body.admin-logged-in .editable-info:hover {
    background-color: rgba(255, 212, 0, 0.15);
    outline: 1px solid var(--blue-cta);
}

/* Effet après sauvegarde réussie */
body.admin-logged-in .editable-zone.edit-success {
    animation: editSuccess 0.6s ease;
}

@keyframes editSuccess {
    0% { background-color: rgba(76, 175, 80, 0.3); }
    100% { background-color: transparent; }
}

/* ============================================================
   PAGE ACCUEIL (.page-accueil)
   ============================================================ */

.page-accueil #hero {
    min-height: 100vh;
    background: linear-gradient(rgba(15, 52, 75, 0.6), rgba(15, 52, 75, 0.7)),
                url('../img/bg_index.jpg') no-repeat center center/cover fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    position: relative;
    padding: 60px 20px;
}

.page-accueil #hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: transparent;
    z-index: 1;
}

.page-accueil .hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
}

.page-accueil #hero h1 {
    font-family: var(--font-header);
    font-size: 4rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.page-accueil .hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
}

/* Grille de cartes - Accueil */
.page-accueil .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap-vertical) var(--gap-horizontal);
    margin-top: 40px;
}

.page-accueil .card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border-top: 5px solid var(--blue-mer);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.page-accueil .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.page-accueil .card h3 {
    color: var(--blue-mer);
    margin-bottom: 15px;
}

.page-accueil .card-link {
    color: var(--blue-cta);
    font-weight: bold;
    text-decoration: none;
    transition: color 0.3s ease;
}

.page-accueil .card-link:hover {
    color: #2980b9;
}

/* Bannière - Accueil */
.page-accueil .banner-section {
    background: linear-gradient(rgba(15, 52, 75, 0.7), rgba(15, 52, 75, 0.7)),
                url('../img/bg_index.jpg') no-repeat center center/cover fixed;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 60px 20px;
}

.page-accueil .banner-content {
    max-width: 900px;
}

.page-accueil .banner-content h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.page-accueil .banner-text {
    font-size: 1.2rem;
    line-height: 1.8;
}

/* CTA Section - Accueil */
.page-accueil .cta-section {
    text-align: center;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.page-accueil .cta-section h2 {
    margin-bottom: 30px;
    width: 100%;
}

.page-accueil .cta-section p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 700px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.page-accueil .cta-section a {
    margin-top: 10px;
}

/* ============================================================
   PAGE ASSOCIATION (.page-association)
   ============================================================ */

.page-association .container {
    padding-top: 100px;
}

/* Split Section 70/30 */
.page-association .split-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--gap-horizontal);
    align-items: center;
    margin-bottom: var(--gap-vertical);
}

.page-association .split-text {
    padding-right: 20px;
}

.page-association .split-text p {
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.8;
}

.page-association .split-text p:first-child {
    font-size: 1.1rem;
    font-weight: 500;
}

.page-association .split-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: block;
}

/* Grille de cartes missions */
.page-association .card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-vertical) var(--gap-horizontal);
    margin: var(--gap-vertical) 0;
}

.page-association .mission-card,
.page-association .expertise-card,
.page-association .esprit-card {
    text-align: center;
}

.page-association .card {
    background: white;
    padding: 40px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border-top: 5px solid var(--blue-mer);
    transition: transform 0.3s ease;
}

.page-association .card:hover {
    transform: translateY(-5px);
}

.page-association .card h3 {
    font-family: var(--font-header);
    color: var(--blue-mer);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.page-association .card p {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Emblème Section */
.page-association .embleme-section {
    display: flex;
    justify-content: center;
    margin: 100px 0 var(--gap-vertical) 0;
    margin-top: 80px;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
}

.page-association .embleme-card {
    background: var(--blue-mer) !important;
    color: white !important;
    max-width: 800px;
    width: 100%;
    padding: 50px !important;
    text-align: center;
    border-top: 5px solid white !important;
}

.page-association .embleme-card h3 {
    color: white !important;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.page-association .embleme-card p {
    color: white;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .container {
        padding: 100px 5% 40px 5%;
    }

    /* ----- PARALLAXE MOBILE FLUIDE (CSS pur) -----
       background-attachment:fixed est cassé sur iOS/Android. On le remplace par
       un VRAI élément en position:fixed (.fixed-bg) qui porte l'image : c'est
       fluide partout. Le hero/bannière deviennent translucides (laissent voir
       l'image fixe derrière) et les sections blanc cassé restent opaques et
       glissent par-dessus — exactement l'effet du bureau. */
    body.page-accueil .fixed-bg {
        background:
            linear-gradient(rgba(15, 52, 75, 0.35), rgba(15, 52, 75, 0.45)),
            url('../img/bg_index.jpg') center center / cover no-repeat;
    }
    .page-accueil #hero {
        background: linear-gradient(rgba(15, 52, 75, 0.45), rgba(15, 52, 75, 0.55)) !important;
    }
    .page-accueil .banner-section {
        background: linear-gradient(rgba(15, 52, 75, 0.5), rgba(15, 52, 75, 0.5)) !important;
    }
    /* Les blocs de contenu masquent l'image (effet d'alternance comme sur PC) */
    .page-accueil .container {
        background: var(--white-cass);
        position: relative;
        z-index: 1;
    }

    /* ----- MENU MOBILE (hamburger) ----- */
    .nav-toggle {
        display: block;
    }

    /* Nom de la page courante, centré entre le logo et le hamburger */
    .mobile-page-title {
        display: block;
        flex: 1;
        text-align: center;
        margin: 0 10px;
        color: var(--white-cass);
        font-family: var(--font-header);
        text-transform: uppercase;
        font-size: 1rem;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Logo : tient ENTIÈREMENT dans la barre de 60px (sinon il dépasse
       sous le header et le menu déroulant le recouvre) */
    .logo-container {
        height: 44px;
        top: 0;
    }

    /* Le menu devient un panneau déroulant sous le header */
    nav {
        position: absolute;
        top: 100%;              /* juste sous la barre, quel que soit le décalage admin */
        left: 50%;
        transform: translateX(-50%);
        width: 100vw;           /* pleine largeur réelle (ignore le padding du header) */
        background: var(--blue-mer);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    }

    header.nav-open nav {
        max-height: 85vh;
        overflow-y: auto;
    }

    nav ul {
        flex-direction: column;
        align-items: stretch;
    }

    nav ul li {
        margin-left: 0;
    }

    nav ul li a {
        padding: 16px 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    /* Sous-menu "Événements" : affiché en accordéon (pas de hover au toucher) */
    .dropdown-content {
        position: static;
        display: block;
        box-shadow: none;
        min-width: 0;
        background: rgba(0, 0, 0, 0.22);
    }

    .dropdown-content a {
        padding-left: 44px;     /* léger retrait pour montrer la hiérarchie */
        font-size: 0.9rem;
    }

    .page-accueil #hero h1 {
        font-size: 2.5rem;
    }

    .page-accueil .banner-content h2 {
        font-size: 2rem;
    }

    .page-association .split-section {
        grid-template-columns: 1fr;
        gap: var(--gap-vertical);
    }

    .page-association .split-image {
        order: -1;
    }

    .page-association .split-text {
        padding-right: 0;
    }

    .page-association .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    h2 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .page-accueil #hero h1 {
        font-size: 1.8rem;
    }

    .page-accueil .hero-subtitle {
        font-size: 1.1rem;
    }

    .page-accueil .card-grid {
        grid-template-columns: 1fr;
        gap: var(--gap-vertical);
    }

    .page-association .card-grid {
        grid-template-columns: 1fr;
    }

    /* (le menu mobile est entièrement géré dans la media query 900px) */

    .container {
        padding: 100px 5% 30px 5%;
    }

    h2 {
        font-size: 1.6rem;
    }

    .page-association .embleme-card {
        padding: 30px !important;
    }

    .page-association .embleme-card h3 {
        font-size: 1.4rem;
    }
}

/* ============================================================
   UTILITAIRES (Mentions Légales, etc.)
   ============================================================ */

/* Pages réglementaires : bloc texte lisible, centré, largeur de lecture
   confortable — volontairement PAS un format "carte" accentué. */
.legal-box {
    text-align: left;
    line-height: 1.8;
    max-width: 880px;       /* évite les lignes étirées à 100% */
    margin: 0 auto;         /* centré dans le conteneur */
    border-top: none;       /* on retire l'accent "carte" */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05); /* ombre discrète */
}

.legal-box h1 {
    font-family: var(--font-header);
    color: var(--blue-mer);
    margin-bottom: 20px;
    border-bottom: 3px solid var(--blue-cta);
    display: inline-block;
}

.legal-box h2 {
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 10px;
    color: var(--blue-mer);
    text-transform: none;
}

/* Toggle Buttons Admin */
.toggle-btn {
    cursor: pointer;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    background: #fff;
    transition: all 0.2s;
}

.toggle-on {
    color: #27ae60;
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.toggle-off {
    color: #ccc;
    border-color: #ccc;
    opacity: 0.6;
}