/* ================================================================
   MYSTERY CLASS 2026-2027 - RESPONSIVE

   Ce fichier est charge en dernier sur toutes les pages.

   Il regroupe :
   - les adaptations pour tablette ;
   - les adaptations pour smartphone ;
   - le menu tactile ;
   - les pages d'archives ;
   - la page d'accueil ;
   - le footer ;
   - la reduction des animations.
   ================================================================ */

/* ================================================================
   1. INTERACTIONS AVEC UNE SOURIS
   ================================================================ */

@media (hover: hover) and (pointer: fine) {

    #nav .deroulant:hover > .sous {
        display: block;
    }

    .archive-affiche:hover {
        box-shadow:
            0 14px 32px rgba(8, 35, 50, .28),
            0 4px 10px rgba(8, 35, 50, .16);
        transform: translateY(-2px);
    }

    .archive-affiche:hover img {
        transform: scale(1.025);
        filter: contrast(1.02);
    }

    .archive-affiche-complete:hover img {
        transform: scale(1.01);
    }
}

/* ================================================================
   2. TABLETTES ET PETITS ORDINATEURS
   ================================================================ */

@media screen and (max-width: 1050px) {

    /* Navigation */

    #nav > ul,
    #nav nav > ul,
    #nav .menu-principal {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #nav a,
    #nav .bouton-sous-menu {
        white-space: nowrap;
    }

    /* Bandeau */

    header {
        min-height: 340px;
    }

    /* Pages classiques */

    article:not(.archive-page) {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 18px;
    }

    /* Pages d'archives */

    article.archive-page {
        width: min(calc(100% - 32px), var(--content-max));
    }

    /* Accueil */

    .archives-laterales #indice a {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .archives-logo img {
        width: min(128px, 72%);
    }

    /* Footer */

    footer {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1.8fr)
            minmax(0, .8fr);
    }

    #info-NDP img {
        width: 220px;
    }

    #erasmus img {
        width: 190px;
    }
}

/* ================================================================
   3. SMARTPHONES
   ================================================================ */

@media screen and (max-width: 760px) {

    /* Base */

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

    /* ------------------------------------------------------------
       Navigation principale tactile
       ------------------------------------------------------------ */

    #nav {
        position: relative;
        display: block;
        z-index: 3000;
        width: 100%;
        max-width: 100%;
        min-height: 56px;
        overflow: visible;
    }

    #nav .style-nav {
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #nav > ul,
    #nav nav > ul,
    #nav .menu-principal {
        display: flex;
        flex-flow: row nowrap;
        justify-content: flex-start;
        width: max-content;
        min-width: 100%;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    #nav .menu-principal > li,
    #nav > ul > li,
    #nav nav > ul > li {
        position: static;
        flex: 0 0 auto;
        margin: 0;
    }

    #nav .menu-principal > li > a,
    #nav > ul > li > a,
    #nav nav > ul > li > a,
    #nav .bouton-sous-menu {
        min-height: 56px;
        padding: .75rem 1.1rem;
        white-space: nowrap;
    }

    #nav .sous,
    #nav li ul {
        display: none;
    }

    #nav .deroulant.sous-menu-ouvert > .sous,
    #nav li.sous-menu-ouvert > ul {
        position: absolute;
        top: 56px;
        right: 10px;
        left: 10px;
        z-index: 4000;
        display: block;
        width: auto;
        min-width: 0;
        max-height: calc(100vh - 76px);
        margin: 0;
        padding: 8px;
        overflow-x: hidden;
        overflow-y: auto;
        background: rgba(16, 47, 67, .99);
        border-top: 3px solid var(--limestone);
        border-radius: 0 0 10px 10px;
        box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
    }

    #nav .sous li,
    #nav li.sous-menu-ouvert > ul > li {
        display: block;
        width: 100%;
        margin: 0;
    }

    #nav .sous a,
    #nav li.sous-menu-ouvert > ul a {
        display: block;
        width: 100%;
        min-height: auto;
        padding: .85rem 1rem;
        white-space: normal;
        text-align: left;
        border-left: 4px solid transparent;
        border-bottom: 1px solid rgba(231, 207, 159, .14);
    }

    #nav .sous a:hover,
    #nav .sous a:focus-visible,
    #nav li.sous-menu-ouvert > ul a:hover,
    #nav li.sous-menu-ouvert > ul a:focus-visible {
        color: var(--limestone-light);
        background: rgba(85, 127, 120, .34);
        border-left-color: var(--limestone);
    }

    #nav .deroulant.sous-menu-ouvert > .bouton-sous-menu,
    #nav li.sous-menu-ouvert > a {
        color: var(--limestone-light);
        background: rgba(85, 127, 120, .30);
        box-shadow: inset 0 -3px 0 var(--limestone);
    }

    #nav .erreur-menu {
        margin: 0;
        padding: 16px;
        color: var(--ivory);
        text-align: center;
    }

    /* ------------------------------------------------------------
       Bandeau principal sur smartphone
       Solution commune a toutes les pages
       ------------------------------------------------------------ */

    body header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        height: clamp(210px, 58vw, 260px);
        min-height: 0 !important;
        max-height: 260px;
        overflow: hidden;
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }

    body header::before {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    body header #logo_class {
        position: relative;
        z-index: 5;
        flex: 0 0 auto;
        width: clamp(125px, 38vw, 165px) !important;
        max-width: 42%;
        margin: 0 0 0 16px !important;
        padding: 0;
        transform: none;
    }

    body header #logo_class img {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 220px;
        margin: 0;
        object-fit: contain;
    }

/* Titre du bandeau sur smartphone */

body header #titre_page {

    position: absolute;

    top: 24px;

    right: 12px;

    left: auto;

    z-index: 6;

    display: block !important;

    width: calc(100% - 190px);

    margin: 0;

    text-align: center;

    pointer-events: none;

}



body header #titre_page h1 {

    margin: 0;

    color: var(--limestone-light);

    font-size: clamp(1.15rem, 5vw, 1.65rem);

    font-weight: normal;

    letter-spacing: .035em;

    line-height: 1.15;

    text-transform: uppercase;

    text-shadow:
        0 2px 5px rgba(0, 0, 0, .75),
        0 0 14px rgba(0, 0, 0, .50);

}

    /* ------------------------------------------------------------
       Structure generale en une colonne
       ------------------------------------------------------------ */

    body article,
    article.archive-page {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: calc(100% - 24px);
        max-width: none;
        margin: 18px 12px 28px;
    }

    #nav_indice {
        position: relative;
        top: auto;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    #text_01,
    #text-01 {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        padding: 20px;
    }

    #text_01 .style-01,
    #text-01 .style-01 {
        text-align: left;
        word-spacing: normal;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .cols-2 {
        grid-template-columns: 1fr;
    }

    /* ------------------------------------------------------------
       Menu contextuel et archives laterales
       ------------------------------------------------------------ */

    #indice ul,
    .archives-laterales #indice ul {
        display: flex;
        flex-flow: row nowrap;
        gap: 8px;
        width: 100%;
        margin: 0;
        padding: 0 0 10px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    #indice li,
    .archives-laterales #indice li {
        flex: 0 0 auto;
        margin: 0;
        scroll-snap-align: start;
    }

    #indice a {
        white-space: nowrap;
    }

    .archives-logo {
        padding: 14px;
    }

    .archives-logo img {
        width: 110px;
        max-width: 45%;
    }

    .archives-laterales #indice {
        width: 100%;
        padding: 10px;
        overflow: hidden;
    }

    .archives-laterales #indice li {
        flex-basis: 138px;
    }

    .archives-laterales #indice a {
        display: block;
        width: 100%;
        min-width: 0;
        padding: 12px 8px;
        text-align: center;
        white-space: normal;
        transform: none;
    }

    .archive-annee,
    .archive-ville {
        display: block;
    }

    .archive-ville {
        margin-top: 4px;
    }

    /* ------------------------------------------------------------
       Page d'accueil
       ------------------------------------------------------------ */

    #text_01 .enquete-actuelle {
        width: 100%;
        margin: 26px 0;
        padding: 22px;
    }

    .competences-mc {
        gap: 7px;
    }

    .competences-mc span {
        font-size: .84rem;
    }

    #text_01 .accueil-grille {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 20px;
        width: 100%;
    }

    #text_01 .accueil-grille .accueil-carte {
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 20px;
    }

    .accueil-erasmus,
    .accueil-archives {
        padding: 20px;
    }

    .video-mc,
    .video-mc video {
        width: 100%;
        max-width: 100%;
    }

    /* ------------------------------------------------------------
       Pages d'archives
       ------------------------------------------------------------ */

    .archive-affiche {
        margin: 20px auto;
    }

    .archive-affiche img {
        height: 260px;
    }

    .archive-affiche-complete {
        width: 100%;
    }

    .archive-affiche-complete img {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .archive-meta {
        padding: 16px;
    }

    #text_01 .archive-annee {
        font-size: 2rem;
    }

    #text_01 .archive-titre-enquete {
        margin-bottom: 34px;
        padding: 17px 18px;
        font-size: 1.65rem;
    }

    #text_01 .archive-intertitre {
        margin-top: 36px;
        font-size: 1.3rem;
    }

    /* ------------------------------------------------------------
       Footer sur smartphone
       ------------------------------------------------------------ */

    body footer {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        overflow: hidden;
    }

    body footer #info-NDP,
    body footer #avertissement,
    body footer #erasmus {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 28px 20px !important;
        box-sizing: border-box;
        border-right: 0 !important;
        border-left: 0 !important;
    }

    body footer #avertissement {
        border-top: 1px solid rgba(231, 207, 159, .35) !important;
        border-bottom: 1px solid rgba(231, 207, 159, .35) !important;
    }

    body footer .style-04 {
        width: 100% !important;
        max-width: 720px;
        margin: 0 auto !important;
        color: var(--ivory);
        font-size: .90rem;
        line-height: 1.55;
        text-align: center !important;
        overflow-wrap: break-word;
        word-break: normal;
        hyphens: auto;
    }

    body footer #info-NDP img {
        display: block;
        width: 220px !important;
        max-width: 75% !important;
        height: auto;
        margin: 0 auto 22px !important;
    }

    body footer #erasmus img {
        display: block;
        width: 230px !important;
        max-width: 75% !important;
        height: auto;
        margin: 0 auto !important;
    }

    body footer #info-NDP a,
    body footer #erasmus a {
        display: block;
        max-width: 100%;
        margin: 0 auto;
        text-align: center;
    }
}

/* ================================================================
   4. ACCESSIBILITE - REDUCTION DES ANIMATIONS
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }

    .archive-affiche:hover,
    .archive-affiche:hover img {
        transform: none !important;
        filter: none !important;
    }

    .enquete-actuelle::after {
        display: none;
    }
}
