/* ===============================
   FICHIER CSS OPTIMISÉ
   Version optimisée regroupant les styles de base, header, footer, popup et conteneur
   =============================== */

/* ===============================
   VARIABLES CSS GLOBALES
   =============================== */
:root {
    --primary-black: rgba(0, 0, 0, 0.7);
    --primary-green: rgba(76, 175, 80, 0.7);
    --primary-white: rgba(255, 255, 255, 0.95);
    --primary-black-solid: rgba(0, 0, 0, 1);
    --primary-green-solid: rgba(34, 139, 34, 0.7);
    --text-orange: #FF6B35;
    --text-white: white;
    --shadow-base: 0 10px 25px rgba(0, 0, 0, 0.6);
    --border-radius: 20px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Poppins', sans-serif;
    --font-script: 'MaManuscrite', cursive;
    --shadow-text: 1px 1px 2px rgba(0, 0, 0, 1), 2px 2px 4px rgba(0, 0, 0, 0.8);
    --font-size-base: clamp(0.8rem, 1vw, 1.2rem);
    --font-size-heading: clamp(1.2rem, 3vw, 4rem);
    --font-size-small: clamp(0.6rem, 1.5vw, 2rem);
    --backdrop-filter: blur(10px) saturate(160%);
}

/* ===============================
   POLICES PERSONNALISÉES
   =============================== */
@font-face {
    font-family: "MaManuscrite";
    src: url("../fonts/GorriSans.woff2") format("woff2"),
         url("../fonts/GorriSans.woff") format("woff"),
         url("../fonts/GorriSans.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

/* ===============================
   ANIMATIONS GLOBALES
   =============================== */
@keyframes rouler {
    0%   { transform: translateX(-120%) rotate(-720deg); opacity: 0; filter: drop-shadow(0 0 0 rgba(0,0,0,0)); }
    80%  { opacity: 1; }
    100% { transform: translateX(0) rotate(0deg); filter: drop-shadow(10px 10px 15px rgba(0,0,0,0.94)); }
}

@keyframes zoomIn {
    0%   { transform: scale(0); opacity: 0; }
    80%  { opacity: 1; }
    100% { transform: scale(1); opacity: 1; filter: drop-shadow(10px 10px 15px rgba(0,0,0,0.94)); }
}

@keyframes tornade {
    0% { transform: scale(0) rotate(0deg); opacity: 0; filter: blur(10px) drop-shadow(0 0 0 rgba(0,0,0,0)); }
    25% { transform: scale(0.3) rotate(180deg); opacity: 0.3; filter: blur(5px); }
    50% { transform: scale(0.6) rotate(360deg); opacity: 0.6; filter: blur(2px); }
    75% { transform: scale(0.9) rotate(540deg); opacity: 0.8; filter: blur(1px); }
    100% { transform: scale(1) rotate(720deg); opacity: 1; filter: blur(0px) drop-shadow(10px 10px 15px rgba(0,0,0,0.94)); }
}

@keyframes tornadeEntonnoir {
    0% {
        transform: scale(0.1, 0.05) rotateY(0deg) rotateZ(5deg);
        opacity: 0;
        filter: blur(20px);
        border-radius: 8px;
    }
    25% {
        transform: scale(0.4, 0.2) rotateY(270deg) rotateZ(10deg);
        opacity: 0.3;
        filter: blur(10px);
        border-radius: 8px;
    }
    50% {
        transform: scale(0.7, 0.5) rotateY(540deg) rotateZ(5deg);
        opacity: 0.6;
        filter: blur(5px);
        border-radius: 8px;
    }
    75% {
        transform: scale(0.9, 0.8) rotateY(810deg) rotateZ(2deg);
        opacity: 0.8;
        filter: blur(2px);
        border-radius: 8px;
    }
    100% {
        transform: scale(1, 1) rotateY(1080deg) rotateZ(0deg);
        opacity: 1;
        filter: blur(0px) drop-shadow(10px 10px 15px rgba(0,0,0,0.94));
        border-radius: 8px;
    }
}

@keyframes pulsShadow {
    0%, 100% { filter: drop-shadow(10px 10px 15px rgba(0,0,0,0.94)); }
    50%      { filter: drop-shadow(15px 10px 25px rgba(0,0,0,0.97)); }
}

@keyframes bounceIn {
    0% { transform: scale(2); opacity: 0; visibility: visible; }
    80% { transform: scale(0.99); opacity: 0.9; }
    90% { transform: scale(1.01); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; visibility: visible; }
}

@keyframes bounceInStrong {
    0%   { transform: scale(2); opacity: 0; visibility: visible; }
    60%  { transform: scale(0.85); opacity: 1; }
    80%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; visibility: visible; }
}

@keyframes popupZoomBounce {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes popupZoomOut {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* ===============================
   CLASSES D'ANIMATION RÉUTILISABLES
   =============================== */
.animated    { animation-fill-mode: forwards; }
.no-zoom     { animation: none !important;}
.zoom-in     { animation: zoomIn 2s ease-out forwards, pulsShadow 2s ease-in-out infinite; animation-delay: 0s, 2s; }
.roll-in     { animation: rouler 3s ease-out forwards, pulsShadow 2s ease-in-out infinite; animation-delay: 0s, 3s; }
.presse-in   { animation: tornade 3s ease-out forwards, pulsShadow 2s ease-in-out infinite; animation-delay: 0s, 3s; }
.image-pulse { animation: pulsShadow 2s ease-in-out infinite; filter: drop-shadow(1000px 1000px 1500px rgba(0,0,0,1)); }
.tornado-in  { animation: tornadeEntonnoir 4s ease-out forwards, pulsShadow 2s ease-in-out infinite; animation-delay: 0s, 4s; transform-style: preserve-3d; }

/* ===============================
   RESET ET STYLES DE BASE
   =============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    height: 100vh;
    height: 100dvh;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100%;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    background-image: url('../images/bg_lowres.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* ===============================
   CONTENEURS PRINCIPAUX
   =============================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    background-color: rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

/* ===============================
   VIDÉO ET IMAGE DE FOND
   =============================== */
#video-background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
}

.background-image,
.background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.background-image {
    background-image: url('../images/bg_lowres.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.background-video {
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 2;
}

.background-video.active {
    opacity: 1;
}

.background-video.fading-out {
    opacity: 0;
}

/* ===============================
   HEADER - STRUCTURE PRINCIPALE
   =============================== */
.header-banner {
    background-color: var(--primary-green-solid);
    color: var(--text-white);
    padding: 3px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    position: relative;
}

/* ===============================
   NAVIGATION PRINCIPALE
   =============================== */
.main-nav {
    width: 100%;
}

.nav-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0 15px;
}

/* Styles communs pour tous les liens de navigation */
.nav-link {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: clamp(14px, 2.8vw + 0.3rem, 18px);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
    display: inline-block;
    position: relative;
    text-shadow: var(--shadow-text);
}

.nav-link:hover {
    color: var(--text-orange);
    transform: scale(1.05) translateY(-2px);
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.9),
        0 0 8px rgba(255, 107, 53, 0.4),
        0 0 12px rgba(255, 107, 53, 0.2);
}

.nav-link-dark {
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* ===============================
   BOUTON HAMBURGER (MOBILE)
   =============================== */
.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-white);
    margin: 2px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Animation hamburger vers croix */
.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-4px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-4px, -5px);
}

/* ===============================
   LIENS SOCIAUX
   =============================== */
.social-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.social-link {
    transition: var(--transition-smooth);
    display: inline-block;
    padding: 5px;
    margin: 0 10px;
}

.social-icon {
    width: 24px;
    height: 24px;
    transition: var(--transition-smooth);
    display: inline-block;
}

.social-link:hover {
    transform: scale(1.1);
}

.social-link:hover .social-icon {
    transform: scale(1.15) rotate(5deg);
    filter: sepia(1) saturate(2) hue-rotate(15deg) brightness(1.1);
    opacity: 0.8;
}

/* Éléments sociaux mobiles (texte) */
.social-item {
    display: none;
    list-style: none;
}

.social-text {
    display: none;
}

/* ===============================
   FOOTER - STRUCTURE ET SWIPER
   =============================== */
footer {
    margin-top: auto;
    flex-shrink: 0;
}

.footer-banner-container {
    background-color: var(--primary-green-solid);
    overflow: hidden;
}

.footer-banner {
    width: 100%;
    height: auto;
    color: var(--text-white);
    text-align: center;
}

.footer-banner .swiper-wrapper {
    align-items: center;
}

.footer-banner .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
    min-height: 35px;
    width: 100%;
}

.footer-banner p {
    margin: 0;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: clamp(14px, 3.5vw, 20px);
    line-height: 1.4;
    padding: 0 clamp(10px, 2vw, 20px);
    max-width: 100%;
    word-wrap: break-word;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.6),
        1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* ===============================
   SYSTÈME DE POPUP
   =============================== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    justify-content: center;
    align-items: center;
}

.popup-overlay[aria-hidden="true"] {
    pointer-events: none;
    opacity: 0;
}

.popup-window {
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: linear-gradient(180deg, var(--primary-green) 0%, rgba(0, 0, 0, 0.8) 100%);
    width: clamp(60%, 80%, 800px);
    border-radius: 15px;
    position: relative;
    padding: 30px;
    box-shadow: var(--shadow-base);
    transform: scale(0);
    opacity: 0;
    max-height: 80vh;
    overflow-y: hidden;
    font-family: var(--font-script);
    font-size: clamp(10px, 3vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-white);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Contenu du popup avec styles communs */
.popup-content {
    color: var(--text-white);
    text-align: center;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.8),
        1px 1px 2px rgba(0, 0, 0, 0.9);
}

.popup-content h2,
.popup-content h3 {
    margin-top: 0;
    color: var(--text-orange);
    font-size: clamp(0.9rem, 2.5vw, 1.6rem);
    margin-bottom: 10px;
    text-shadow:
        3px 3px 6px rgba(0, 0, 0, 0.7),
        1px 1px 3px rgba(0, 0, 0, 0.9);
}

.popup-content p {
    margin-bottom: 10px;
    font-size: 0.95em;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.6),
        1px 1px 2px rgba(0, 0, 0, 0.8);
}

.popup-content div {
    margin-bottom: 0;
    text-align: left;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.6),
        1px 1px 2px rgba(0, 0, 0, 0.8);
}

.popup-content img {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    width: auto;
    margin: 0 auto 15px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

/* Animations du popup */
.popup-overlay.popup-show .popup-window {
    animation: popupZoomBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.popup-overlay.popup-hide .popup-window {
    animation: popupZoomOut 0.3s ease-in forwards;
}

/* ===============================
   CONTENEUR PRINCIPAL (GLASSMORPHISM)
   =============================== */
.centered-container {
    width: 80%;
    height: calc(100vh - 200px);
    max-height: 800px;
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--primary-black) 100%);
    backdrop-filter: var(--backdrop-filter);
    -webkit-backdrop-filter: var(--backdrop-filter);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-base), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    padding: 2rem;
    box-sizing: border-box;
    overflow-y: auto;
    transform-origin: center center;
    opacity: 0;
    visibility: hidden;
    animation: bounceIn 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards 0.2s;
    font-family: var(--font-script);
    font-size: var(--font-size-base);
    color: var(--text-white);
    text-shadow: var(--shadow-text);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-green) rgba(255, 255, 255, 0.1);
}

/* Effet de reflet sur le conteneur */
.centered-container::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.15),
        rgba(255, 255, 255, 0.05) 30%,
        transparent 100%
    );
    pointer-events: none;
}

/* Scrollbar Webkit personnalisée */
.centered-container::-webkit-scrollbar {
    width: 8px;
}

.centered-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.centered-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-green) 0%, rgba(76, 175, 80, 0.6) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.centered-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(76, 175, 80, 1) 0%, rgba(76, 175, 80, 0.8) 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.centered-container h3 {
    font-size: 1.5rem;
    color: var(--text-orange);
    margin-bottom: 1.2rem;
}

/* ===============================
   MACHINE À ÉCRIRE
   =============================== */
.typewriter-container {
    font-family: var(--font-script);
    font-size: clamp(0.8rem, 1vw, 1.2rem);
    line-height: 1.6;
    color: var(--text-white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 1), 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* ===============================
   ÉLÉMENTS RESPONSIFS ET UTILITAIRES
   =============================== */
/* Affichage conditionnel texte desktop/mobile */
.desktop-text {
    display: block;
}

.mobile-text {
    display: none;
}

/* Classe utilitaire popup */
.popup-overlay.disabled {
    pointer-events: none;
    opacity: 0;
}

/* Amélioration accessibilité footer */
.footer-banner:focus-within {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ===============================
   RESPONSIVE - MOBILE (≤768px)
   =============================== */
@media (max-width: 768px) {
    /* Ajustements généraux mobile */
    .container {
        padding: 0 15px;
    }

    body {
        background-attachment: scroll;
    }

    html, body {
        height: 100%;
        overflow-x: hidden;
    }

    /* Header mobile */
    .header-banner {
        padding: 12px 0;
    }

    .hamburger {
        display: flex;
    }

    /* Navigation mobile */
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: rgba(34, 139, 34, 0.95);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }

    .main-nav.active {
        max-height: 400px;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 10px 0;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-link {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Liens sociaux mobile */
    .social-links {
        display: none;
    }

    .main-nav.active .social-item {
        display: block;
    }

    .social-item .nav-link {
        display: block;
        padding: 10px 0;
        border-bottom: none;
    }

    /* Affichage conditionnel texte */
    .mobile-text {
        display: block;
    }

    .desktop-text {
        display: none;
    }

    /* Footer mobile */
    .footer-banner p {
        font-size: 15px;
        padding: 0 15px;
    }

    .footer-banner .swiper-slide {
        padding: 4px 0;
        min-height: 30px;
    }

    /* Popup mobile */
    .popup-window {
        width: clamp(85%, 90%, 400px);
        padding: 20px;
    }

    .popup-close {
        top: 10px;
        right: 15px;
        font-size: 20px;
    }

    .popup-content img {
        max-height: 180px;
    }

    /* Conteneur principal mobile */
    .page-wrapper,
    main,
    .main-container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .main-content {
        padding: 20px 0;
        width: 90%;
        height: calc(95vh - 160px);
        max-height: calc(95vh - 160px);
        min-height: unset;
        margin: auto;
        flex: 0 0 auto;
        background-color: transparent;
    }

    .centered-container {
        width: 100%;
        height: 100%;
        min-height: 100%;
        max-height: 100%;
        margin: 0;
        padding: 1rem;
        overflow-y: auto;
        overflow-x: hidden;
        justify-content: flex-start;
    }

    .centered-container img {
        border-radius: 0;
    }

    footer {
        margin-top: auto;
        flex-shrink: 0;
    }
}

/* ===============================
   RESPONSIVE - PETIT MOBILE (≤480px)
   =============================== */
@media (max-width: 480px) {
    .footer-banner p {
        font-size: 14px;
        padding: 0 10px;
    }

    .main-content {
        padding: 10px 0;
        width: 95%;
        height: calc(95vh - 130px);
        max-height: calc(95vh - 130px);
    }
}

/* ===============================
   RESPONSIVE - TRÈS PETIT MOBILE (≤320px)
   =============================== */
@media (max-width: 320px) {
    .footer-banner p {
        font-size: clamp(12px, 4vw, 14px);
    }
}

/* ===============================
   RESPONSIVE - DESKTOP LARGE (≥769px)
   =============================== */
@media (min-width: 769px) {
    .social-links {
        display: flex;
        gap: 10px;
    }

    .social-text {
        display: none;
    }
}

/* ===============================
   RESPONSIVE - TRÈS GRAND ÉCRAN (≥1440px)
   =============================== */
@media (min-width: 1440px) {
    .nav-link {
        font-size: clamp(17px, 1.2vw, 20px);
    }
}
