/* ==========================================================================
   AFFICHAGE TÉLÉPHONE
   S'applique aux écrans étroits (téléphones, jusqu'à 768 px de large)
   et aux très petits écrans d'ordinateur (jusqu'à 600 px de haut).
   Ce fichier est chargé en dernier : ses règles remplacent celles des autres fichiers.
   ========================================================================== */

@media (max-width: 768px), (max-height: 600px) {

    :root {
        --zoom: 1;
        --section-gap: 32px;
    }

    /* ---------- Bandeau du haut : nom, FR/EN, bouton ☰ ---------- */

    .header {
        flex-direction: row;
        justify-content: space-between;
        gap: 12px;
        min-height: 56px;
        padding: 0 12px 0 16px;
    }

    .brand {
        margin-right: auto;
    }

    .brand img {
        height: 34px;
    }

    .languages {
        gap: 4px;
    }

    .lang-btn {
        padding: 4px 10px;
    }

    /* Bouton ☰ : trois barres qui se transforment en croix quand le menu est ouvert */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 9px;
        background: none;
        border: none;
        cursor: pointer;
    }

    .menu-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background-color: var(--title-light);
        transition: transform 0.3s, opacity 0.3s;
    }

    .header.nav-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .header.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
    .header.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Menu en plein écran, ouvert par le bouton ☰ */
    .nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(20, 20, 20, 0.94);
        -webkit-backdrop-filter: blur(var(--glass-blur));
        backdrop-filter: blur(var(--glass-blur));
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .header.nav-open .nav {
        opacity: 1;
        visibility: visible;
    }

    .nav-list {
        flex-direction: column;
        align-items: center;
        gap: 28px;
    }

    .nav-link {
        font-family: var(--font-title);
        font-size: 2rem;
        padding: 4px 0;
    }

    /* ---------- Page : défilement naturel, chaque section prend la hauteur de son contenu ---------- */

    main {
        zoom: 1;
        padding-top: var(--header-height);
        padding-bottom: 0;
    }

    .section {
        height: auto;
        min-height: 0;
        overflow: visible;
        padding: var(--section-gap) 16px;
        scroll-margin-top: var(--header-height);
    }

    /* L'image de fond fixe n'est pas prise en charge sur iPhone : elle défile avec la page */
    #biographie,
    #musique,
    #evenements,
    #contact {
        background-attachment: scroll;
    }

    .section h1,
    .section h2 {
        font-size: 2.2rem;
    }

    .section p {
        padding: 0 16px;
    }

    /* ---------- Accueil : photo en plein écran, nom en bas ---------- */

    #home {
        min-height: calc(100svh - var(--header-height));
        justify-content: flex-end;
        padding-bottom: 40px;
    }

    #home .home-name {
        font-size: 2.8rem;
        line-height: 1.1;
        margin-bottom: 8px;
    }

    #home .home-roles {
        font-size: 0.95rem;
        line-height: 1.5;
        padding: 0;
    }

    #home .home-tagline {
        font-size: 1.3rem;
        line-height: 1.3;
        padding: 0;
    }

    /* ---------- Biographie : lecture continue, les onglets deviennent des titres ---------- */

    .bio-tabs {
        display: none;
    }

    #biographie .bio-panel {
        display: block;
    }

    #biographie .bio-panel-title {
        display: block;               /* le titre de l'autre langue reste masqué */
        margin: 20px 0 6px;
        padding: 0 16px;
        font-size: 1.5rem;
        color: var(--accent);
        text-align: left;
    }

    #biographie p {
        text-align: left;
        padding: 0 16px;
    }

    /* ---------- Musique : filtres défilant horizontalement, œuvres en liste ---------- */

    .music-menu {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 4px;
        padding: 4px 8px;
        margin-bottom: 16px;
        overflow-x: auto;
        scrollbar-width: none;        /* masque la barre de défilement */
    }

    .music-menu::-webkit-scrollbar {
        display: none;
    }

    .music-menu-btn {
        flex: 0 0 auto;
        min-width: 0;
        margin: 0;
        padding: 8px 14px;
        font-size: 16px;
        white-space: nowrap;
    }

    .music-content {
        padding: 0;
        gap: 12px;
    }

    .music-item {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 12px;
    }

    /* Vignette à gauche, titre et description à droite */
    .music-item .popup-trigger {
        display: grid;
        grid-template-columns: 110px 1fr;
        column-gap: 14px;
        align-items: center;
        text-align: left;
    }

    .music-item img {
        grid-column: 1;
        grid-row: span 2;
        width: 110px;
        margin: 0;
    }

    .music-item h3 {
        margin-bottom: 4px;
        font-size: 1.25rem;
    }

    #musique .music-item p {
        margin: 0;
        padding: 0;               /* aligné sur le titre */
    }

    /* ---------- Événements ---------- */

    .events-card {
        padding: 18px 0;
    }

    #evenements .event {
        padding: 0 16px;
    }

    #evenements .event p {
        font-size: 16px;
        line-height: 1.7;
    }

    .event-dates {
        font-size: 17px;
    }

    /* ---------- Contact ---------- */

    #contact {
        padding-bottom: 40px;
    }

    #contact .contact-intro {
        margin: -8px auto 14px;
        padding: 0;
        font-size: 15px;
        line-height: 1.5;
    }

    .contact-form {
        width: 100%;
        max-width: none;
        padding: 14px 16px;
    }

    .form-group-message textarea {
        flex: none;
        height: 140px;
    }

    /* ---------- Pied de page : en bas de la page, plus fixe ---------- */

    .footer {
        position: static;
        height: auto;
        padding: 20px 0;
    }

    /* ---------- Pop-ups : presque plein écran, texte au-dessus de la vidéo ---------- */

    .popup-content-container {
        width: 94%;
        max-height: 90svh;
        overflow-y: auto;
    }

    .popup-content {
        flex-direction: column;
    }

    .popup-close {
        top: 8px;
        right: 8px;
        font-size: 30px;
        z-index: 2002;
    }

    .popup-left {
        padding: 16px 48px 8px 16px;   /* place pour la croix à droite */
    }

    .popup-right {
        padding: 8px 16px 16px;
    }

    .popup-content iframe {
        height: auto;
        aspect-ratio: 16 / 9;
    }
}
