/**
 * ============================================================================
 * Fichier : boussole.css
 * Projet  : SkinZenitude Framework
 * Module  : Boussole
 * Description : Styles visuels de la page Boussole FR / EN
 * ============================================================================
 */


/* ==========================================================================
   RESET
   ========================================================================== */

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


html,
body {
    width: 100%;
    height: 100%;

    overflow: hidden;

    font-family:
        "Segoe UI",
        Arial,
        Helvetica,
        sans-serif;

    background: #F5F1E8;
}


/* ==========================================================================
   SCÈNE
   ========================================================================== */

#scene {
    position: relative;

    width: 100vw;
    height: 100vh;

    overflow: hidden;

    display: flex;

    align-items: center;
    justify-content: center;

    background: #F5F1E8;
}


/* ==========================================================================
   CONTENEUR PRINCIPAL
   ========================================================================== */

#boussole-layout {

    width: 94vw;
    height: 92vh;

    max-width: 1500px;
    max-height: 900px;

    min-width: 0;
    min-height: 0;

    margin: 0 auto;

    display: flex;

    align-items: center;
    justify-content: center;

    gap: clamp(16px, 2vw, 28px);
}


/* ==========================================================================
   CONTENEUR IMAGE + AVA
   ========================================================================== */

#boussole-image {

    position: relative;

    aspect-ratio: 1402 / 1122;

    width:
        min(
            calc(92vh * 1402 / 1122),
            calc(
                94vw
                - clamp(280px, 25vw, 400px)
                - clamp(16px, 2vw, 28px)
            )
        );

    height: auto;

    max-width: 100%;
    max-height: 100%;

    min-width: 0;
    min-height: 0;

    flex: 0 1 auto;

    display: block;

    z-index: 1;

    overflow: visible;
}


/* ==========================================================================
   IMAGE
   ========================================================================== */

#background-image {

    position: absolute;

    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    object-fit: fill;

    object-position: center center;

    z-index: 1;
}


/* ==========================================================================
   APPLICATION / PANNEAU
   ========================================================================== */

#app {

    position: relative;

    flex:
        0 1 clamp(
            280px,
            25vw,
            400px
        );

    width:
        clamp(
            280px,
            25vw,
            400px
        );

    height: 100%;

    min-width: 0;
    min-height: 0;

    z-index: 2;

    display: flex;

    align-items: center;

    pointer-events: none;
}


/* ==========================================================================
   ORDRE FR
   ========================================================================== */

body.lang-fr #boussole-layout {

    flex-direction: row;
}


/* ==========================================================================
   ORDRE EN
   ========================================================================== */

body.lang-en #boussole-layout {

    flex-direction: row-reverse;
}


/* ==========================================================================
   PANNEAU DE VERRE
   ========================================================================== */

#conversation {

    position: relative;

    width: 100%;

    height: 100%;
    max-height: 100%;

    padding:
        clamp(18px, 2vw, 26px);

    border-radius:
        clamp(20px, 2vw, 30px);

    background:
        rgba(
            255,
            255,
            255,
            .84
        );

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            .90
        );

    backdrop-filter:
        blur(18px);

    -webkit-backdrop-filter:
        blur(18px);

    box-shadow:
        0 18px 45px
        rgba(
            60,
            55,
            45,
            .16
        ),

        inset 0 1px 0
        rgba(
            255,
            255,
            255,
            .85
        );

    overflow: hidden;

    pointer-events: auto;
}


/* ==========================================================================
   MESSAGES
   ========================================================================== */

#messages {

    display: flex;

    flex-direction: column;

    gap: 10px;
}


/* ==========================================================================
   TEXTES
   ========================================================================== */

.boussole-message {

    padding: 4px 0;

    background: transparent;

    border: none;

    box-shadow: none;

    color: #3F463F;

    font-size: 14px !important;

    line-height: 1.55;

    font-weight: 400;

    text-shadow: none;
}


/* ==========================================================================
   ÉTAT INITIAL DES TEXTES
   ========================================================================== */

.boussole-message {

    opacity: 0;

    transform:
        translateY(10px);
}


/* ==========================================================================
   AVA INERTE — STRUCTURE
   ========================================================================== */

.ava-intro {

    width: 100%;

    margin-top: 22px;

    padding-top: 18px;

    display: flex;

    flex-direction: row;

    align-items: center;

    justify-content: flex-start;

    gap: 12px;

    text-align: left;

    flex-shrink: 0;

    /*
     * Ava et son texte sont invisibles au chargement.
     *
     * L'apparition est déclenchée par boussole.js
     * lorsque la séquence des textes est terminée.
     */

    opacity: 0;

    transform:
        translateY(10px);
}


/* ==========================================================================
   AVA INERTE — APPARITION
   ========================================================================== */

.ava-intro.ava-intro-visible {

    animation:
        avaIntroAppear 1.25s ease forwards;
}


/* ==========================================================================
   ANIMATION AVA INERTE
   ========================================================================== */

@keyframes avaIntroAppear {

    from {

        opacity: 0;

        transform:
            translateY(10px);
    }

    to {

        opacity: 1;

        transform:
            translateY(0);
    }
}


/* ==========================================================================
   AVA INERTE — IMAGE
   ========================================================================== */

.ava-intro-image {

    display: block;

    cursor: pointer;
    touch-action: manipulation;

    width: 100px;
    height: 100px;

    max-width: 100px;
    max-height: 100px;

    object-fit: contain;

    flex: 0 0 100px;

    pointer-events: none;

    user-select: none;
}


/* ==========================================================================
   AVA INTERACTIVE — RÉACTION AU CLIC SUR L'AVA INERTE
   ========================================================================== */

#ava.ava-attention {

    animation:
        avaAttention 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}


@keyframes avaAttention {

    0% {

        transform:
            scale(1)
            rotate(0deg);
    }

    22% {

        transform:
            scale(1.16)
            rotate(-4deg);
    }

    45% {

        transform:
            scale(.94)
            rotate(3deg);
    }

    68% {

        transform:
            scale(1.08)
            rotate(-2deg);
    }

    100% {

        transform:
            scale(1)
            rotate(0deg);
    }
}


/* ==========================================================================
   AVA INERTE — TEXTE
   ========================================================================== */

.ava-intro-text {

    flex: 1 1 auto;

    min-width: 0;

    margin-top: 0;

    color: #3F463F;

    text-align: left;
}


/* ==========================================================================
   AVA INERTE — TITRE
   ========================================================================== */

.ava-intro-title {

    display: block;

    margin-bottom: 6px;

    color: #5E3E8C;

    font-size: 15px;

    line-height: 1.35;

    font-weight: 600;
}


/* ==========================================================================
   AVA INERTE — DESCRIPTION
   ========================================================================== */

.ava-intro-description {

    margin: 0;

    max-width: none;

    color: #3F463F;

    font-size: 11px;

    line-height: 1.5;

    font-weight: 400;
}


/* ==========================================================================
   ZONE DU BOUTON
   ========================================================================== */

#boussole-action-zone {

    margin-top: 4px;

    margin-bottom: 20px;
}


/* ==========================================================================
   BOUTON
   ========================================================================== */

#boussole-action {

    display: block;

    width: 100%;

    padding:
        14px 18px;

    border: none;

    border-radius: 14px;

    background: #6F4AA2;

    color: #FFFFFF;

    font-size: 12px !important;

    font-weight: 600;

    line-height: 1.4;

    text-align: center;

    text-decoration: none;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform:
        translateY(8px);

    transition:
        opacity 1.25s ease,
        visibility 1.25s ease,
        transform 1.25s ease,
        background .25s ease;
}


/* ==========================================================================
   BOUTON VISIBLE
   ========================================================================== */

#boussole-action.is-visible {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform:
        translateY(0);
}


/* ==========================================================================
   SURVOL
   ========================================================================== */

#boussole-action:hover {

    background: #5E3E8C;
}


/* ==========================================================================
   ACTIVATION
   ========================================================================== */

#boussole-action:active {

    transform:
        scale(.98);
}


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 767px) {


    /* ======================================================================
       DOCUMENT
       ====================================================================== */

    html,
    body {

        width: 100%;
        height: auto;

        min-height: 100%;

        overflow-x: hidden;
        overflow-y: auto;

        background: #F5F1E8;
    }


    /* ======================================================================
       SCÈNE
       ====================================================================== */

    #scene {

        width: 100%;
        height: auto;

        min-height: 100vh;

        padding: 16px;

        display: flex;

        align-items: flex-start;
        justify-content: center;

        overflow: visible;
    }


    /* ======================================================================
       CONTENEUR PRINCIPAL
       ====================================================================== */

    #boussole-layout {

        width: 100%;
        height: auto;

        max-width: 520px;

        min-width: 0;
        min-height: 0;

        margin: 0 auto;

        display: flex;

        flex-direction: column !important;

        align-items: stretch;

        gap: 18px;
    }


    /* ======================================================================
       IMAGE + AVA
       ====================================================================== */

    #boussole-image {

        position: relative;

        width: 100%;
        height: auto;

        aspect-ratio: 1402 / 1122;

        max-width: 100%;
        max-height: none;

        flex: none;

        display: block;

        overflow: visible;
    }


    /* ======================================================================
       IMAGE MOBILE
       ====================================================================== */

    #background-image {

        position: absolute;

        inset: 0;

        display: block;

        width: 100%;
        height: 100%;

        object-fit: fill;

        object-position: center center;
    }


    /* ======================================================================
       APPLICATION MOBILE
       ====================================================================== */

    #app {

        position: relative;

        width: 100%;
        height: auto;

        min-width: 0;
        min-height: 0;

        flex: none;

        display: flex;

        align-items: stretch;

        pointer-events: none;
    }


    /* ======================================================================
       ORDRE MOBILE
       ====================================================================== */

    body.lang-fr #boussole-layout,
    body.lang-en #boussole-layout {

        flex-direction: column !important;
    }


    /* ======================================================================
       PANNEAU MOBILE
       ====================================================================== */

    #conversation {

        position: relative;

        width: 100%;

        height: auto;

        max-height: none;

        padding: 22px;

        border-radius: 24px;

        overflow: visible;

        pointer-events: auto;
    }


    /* ======================================================================
       MESSAGES MOBILE
       ====================================================================== */

    #messages {

        gap: 10px;
    }


    /* ======================================================================
       TEXTES MOBILE
       ====================================================================== */

    .boussole-message {

        font-size: 12px !important;

        line-height: 1.55;
    }


    /* ======================================================================
       AVA INERTE — MOBILE
       ====================================================================== */

    .ava-intro {

        margin-top: 18px;

        padding-top: 14px;

        gap: 10px;
    }


    .ava-intro-image {

        width: 80px;
        height: 80px;

        max-width: 80px;
        max-height: 80px;

        flex-basis: 80px;
    }


    .ava-intro-text {

        margin-top: 0;

        text-align: left;
    }


    .ava-intro-title {

        font-size: 14px;

        margin-bottom: 5px;
    }


    .ava-intro-description {

        font-size: 11px;

        line-height: 1.5;
    }


    /* ======================================================================
       BOUTON MOBILE
       ====================================================================== */

    /* #boussole-action {

        padding:
            13px 16px;

        font-size: 12px !important;
    } */


    /* ======================================================================
       ZONE BOUTON MOBILE
       ====================================================================== */

    #boussole-action-zone {

        margin-top: 2px;

        margin-bottom: 18px;
    }
}


/* ==========================================================================
   RÉDUCTION DES ANIMATIONS
   ========================================================================== */

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

    #boussole-action,
    .boussole-message,
    .ava-intro {

        transition: none !important;

        animation: none !important;

        opacity: 1 !important;

        transform: none !important;
    }
}

/* ==========================================================================
   MOBILE — AFFICHAGE RÉEL DES APPAREILS MOBILES
   ==========================================================================
   Le desktop reste inchangé.
   Cette section complète uniquement le comportement cell.
   ========================================================================== */

@media (max-width: 767px) {

    #boussole-image > picture {
        display: block;
        width: 100%;
        height: 100%;
    }

    #boussole-image > picture > #background-image {
        width: 100%;
        height: 100%;
    }

    /*
     * Sur mobile, Ava reste attachée à la scène Boussole.
     * On conserve les coordonnées d'ancrage fournies par boussole/index.php.
     */
    #boussole-image > #ava {
        max-width: 72px;
    }

}

