/* =============================================================================
   DISCERN — Couche "mobile d'abord" des pages publiques
   =============================================================================
   Fichier      : css/mobile.css
   Rôle         : Optimise l'expérience téléphone (usage principal du test et
                  des partages) SANS modifier css/style.css : chargée APRÈS lui
                  sur index, test, results, compare, enquête, méthode, frise et
                  encyclopédie. Les règles de mise en page spécifiques au
                  téléphone sont dans @media (max-width: 599px).
   Objectifs    : 1. Ergonomie : cibles tactiles >= 48px, zone du pouce (les
                     réponses du test sont ancrées en bas d'écran), champs en
                     16px (évite le zoom automatique d'iOS), marges de sécurité
                     (encoche / barre de geste), hauteur d'écran dynamique (dvh).
                  2. Viralité : appels à l'action visibles en permanence (barre
                     collante "Commencer" / "Partager" — voir js/mobile.js),
                     retour tactile (vibration, micro-animations), messages
                     d'étape pendant le test.
   Neutralité   : aucune couleur de jugement moral (cf. charte) — les 4 niveaux
                  de réponse suivent le dégradé de marque cyan -> violet.
   ============================================================================= */


/* =============================================================================
   1. BASES TACTILES (tous écrans)
   ============================================================================= */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

a, button, label, summary, .discern-bouton {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.discern-bouton { min-height: 48px; }
.discern-bouton--petit { min-height: 44px; }

/* Évite un double-tap-zoom parasite et le rebond de défilement horizontal */
body { overflow-x: hidden; }


/* =============================================================================
   2. TÉLÉPHONE (< 600px)
   ============================================================================= */

@media (max-width: 599px) {

    /* --- Champs de saisie : 16px minimum, sinon iOS zoome la page au focus --- */
    input, select, textarea { font-size: 16px; }

    /* --- Marges de sécurité (encoche, barre de geste) --- */
    .discern-conteneur {
        padding-left  : max(16px, env(safe-area-inset-left));
        padding-right : max(16px, env(safe-area-inset-right));
    }

    /* --- Cartes : moins de marge intérieure, coins plus doux --- */
    .discern-carte {
        padding       : 22px 18px;
        border-radius : 20px;
    }

    /* -------------------------------------------------------------------------
       2.1 PAGE D'ACCUEIL
       ------------------------------------------------------------------------- */

    .discern-page-intro .discern-hero__titre {
        font-size     : clamp(1.95rem, 8.6vw, 2.6rem);
        line-height   : 1.12;
        font-weight   : 800;
        letter-spacing: -0.02em;
        text-wrap     : balance;
        background    : linear-gradient(90deg, #ffffff 40%, #c4b5fd 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .discern-page-intro .discern-hero__sous-titre {
        font-size     : 1.05rem;
        line-height   : 1.55;
    }

    /* Bouton principal : grand, lumineux, pulsation discrète */
    .discern-hero__cta .discern-bouton {
        min-height    : 62px;
        font-size     : 1.12rem;
        font-weight   : 700;
        border-radius : 999px;
        box-shadow    : 0 10px 30px rgba(139, 92, 246, 0.45);
        animation     : discern-mobile-pulsation 2.8s ease-in-out infinite;
    }
    .discern-hero__cta .discern-bouton::after { content: "\2192"; margin-left: 10px; font-weight: 400; }

    .discern-hero__cta-secondaire .discern-bouton { width: 100%; }

    /* Infos pratiques : 3 pastilles côte à côte au lieu d'une liste verticale */
    .discern-info-pratique {
        display       : grid;
        grid-template-columns: repeat(3, 1fr);
        gap           : 8px;
    }
    .discern-info-pratique__item {
        flex-direction: column;
        text-align    : center;
        gap           : 6px;
        padding       : 12px 6px;
        border-radius : 14px;
        background    : rgba(255, 255, 255, 0.04);
    }
    .discern-info-pratique__texte { align-items: center; text-align: center; }

    /* -------------------------------------------------------------------------
       2.2 PAGE DU TEST — plein écran, réponses dans la zone du pouce
       ------------------------------------------------------------------------- */

    .discern-page-test .discern-barre-progression {
        padding       : calc(env(safe-area-inset-top) + 10px) 18px 12px;
        background    : rgba(13, 13, 22, 0.86);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-bottom : 0;
    }
    .discern-page-test .discern-barre-progression__piste { height: 6px; border-radius: 999px; }
    .discern-page-test .discern-barre-progression__remplissage {
        border-radius : 999px;
        box-shadow    : 0 0 14px rgba(139, 92, 246, 0.7);
    }
    .discern-page-test .discern-barre-progression__compteur { font-variant-numeric: tabular-nums; }

    .discern-page-test .discern-zone-question {
        min-height    : 100vh;
        min-height    : 100dvh;
        justify-content: flex-start;
        align-items   : stretch;
        padding       : calc(env(safe-area-inset-top) + 74px) 18px calc(env(safe-area-inset-bottom) + 20px);
    }

    .discern-page-test #discern-test-app {
        display       : flex;
        flex-direction: column;
        flex          : 1;
        width         : 100%;
    }

    /* La carte devient une colonne pleine hauteur sans cadre : énoncé au
       centre, réponses collées en bas (pouce) */
    .discern-page-test .discern-question-carte {
        display       : flex;
        flex-direction: column;
        flex          : 1;
        max-width     : none;
        padding       : 0;
        background    : transparent;
        box-shadow    : none;
        border-radius : 0;
    }

    .discern-page-test .discern-question__numero {
        align-self    : center;
        margin-bottom : 18px;
        padding       : 6px 14px;
        border-radius : 999px;
        background    : rgba(139, 92, 246, 0.16);
        color         : #d8ccff;
        letter-spacing: 0.12em;
    }

    .discern-page-test .discern-question__enonce {
        flex          : 1;
        display       : flex;
        align-items   : center;
        justify-content: center;
        text-align    : center;
        margin-bottom : 22px;
        font-size     : clamp(1.32rem, 5.8vw, 1.75rem);
        font-weight   : 600;
        line-height   : 1.32;
        letter-spacing: -0.01em;
        text-wrap     : balance;
    }

    .discern-page-test .discern-echelle {
        display       : flex;
        flex-direction: column;
        gap           : 10px;
        border        : 0;
        padding       : 0;
        margin        : 0;
    }

    .discern-page-test .discern-echelle__label {
        min-height    : 64px;
        padding       : 14px 18px;
        border-radius : 18px;
        font-size     : 1.02rem;
        font-weight   : 500;
        background    : rgba(27, 27, 44, 0.9);
        transition    : transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
    }

    /* Un liseré de couleur par niveau (cyan -> violet) : repère visuel rapide,
       neutre (aucune couleur « bon / mauvais ») */
    .discern-page-test .discern-echelle__item:nth-child(1) .discern-echelle__label { box-shadow: inset 5px 0 0 #4cd4e8; }
    .discern-page-test .discern-echelle__item:nth-child(2) .discern-echelle__label { box-shadow: inset 5px 0 0 #6fa8ee; }
    .discern-page-test .discern-echelle__item:nth-child(3) .discern-echelle__label { box-shadow: inset 5px 0 0 #9a82f4; }
    .discern-page-test .discern-echelle__item:nth-child(4) .discern-echelle__label { box-shadow: inset 5px 0 0 #8b5cf6; }

    .discern-page-test .discern-echelle__label:active { transform: scale(0.98); }

    .discern-page-test .discern-echelle__label--selectionne {
        animation     : discern-mobile-validation 0.28s ease;
        border-color  : var(--couleur-accent);
        background    : rgba(139, 92, 246, 0.24);
    }

    .discern-page-test .discern-echelle__indicateur { width: 24px; height: 24px; }

    /* Message d'étape ("Déjà la moitié !") — voir js/mobile.js */
    .discern-toast-etape {
        position      : fixed;
        top           : calc(env(safe-area-inset-top) + 66px);
        left          : 50%;
        transform     : translate(-50%, -12px);
        z-index       : 120;
        padding       : 9px 18px;
        border-radius : 999px;
        background    : linear-gradient(135deg, rgba(76, 212, 232, 0.95), rgba(139, 92, 246, 0.95));
        color         : #0d0d16;
        font-size     : 0.86rem;
        font-weight   : 700;
        white-space   : nowrap;
        box-shadow    : 0 8px 24px rgba(0, 0, 0, 0.4);
        opacity       : 0;
        pointer-events: none;
        transition    : opacity 0.25s ease, transform 0.25s ease;
    }
    .discern-toast-etape--visible { opacity: 1; transform: translate(-50%, 0); }

    /* -------------------------------------------------------------------------
       2.3 PAGE DE RÉSULTATS — partage mis en avant
       ------------------------------------------------------------------------- */

    .discern-profil-hero__surnom {
        font-size     : clamp(1.55rem, 7.2vw, 2.1rem);
        line-height   : 1.15;
        text-wrap     : balance;
    }

    .discern-bouton-partage,
    .discern-partage .discern-bouton { width: 100%; min-height: 58px; font-size: 1.05rem; font-weight: 700; border-radius: 999px; }

    .discern-resultats-section__corps { padding: 18px 16px; }

    /* Sections repliables : zone de tap confortable */
    .discern-mecanisme-detail > summary,
    .discern-mecanisme-reponse__approfondir > summary { min-height: 56px; padding-top: 14px; padding-bottom: 14px; }

    /* Formulaires email / comparaison : champ pleine largeur, boutons dessous */
    .discern-email-formulaire { flex-direction: column; align-items: stretch; gap: 10px; }
    .discern-email-formulaire .discern-bouton,
    .discern-email-formulaire__champ { width: 100%; }
    .discern-email-formulaire__champ { min-height: 52px; border-radius: 14px; }

    /* Les cartes de profils comparés (compare.php) s'empilent */
    .discern-comparaison-profils { grid-template-columns: 1fr; }
}


/* =============================================================================
   3. BARRE D'ACTION COLLANTE (créée par js/mobile.js — téléphone/tablette)
   ============================================================================= */

.discern-barre-collante {
    position      : fixed;
    left          : 0;
    right         : 0;
    bottom        : 0;
    z-index       : 90;
    padding       : 10px max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 10px) max(16px, env(safe-area-inset-left));
    background    : rgba(13, 13, 22, 0.9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top    : 1px solid rgba(255, 255, 255, 0.08);
    transform     : translateY(110%);
    transition    : transform 0.28s ease;
}
.discern-barre-collante--visible { transform: translateY(0); }
.discern-barre-collante .discern-bouton {
    width         : 100%;
    min-height    : 54px;
    font-size     : 1.02rem;
    font-weight   : 700;
    border-radius : 999px;
}

/* Réserve la place de la barre pour ne pas masquer le bas de page */
body.discern-avec-barre-collante { padding-bottom: calc(env(safe-area-inset-bottom) + 84px); }

@media (min-width: 761px) {
    .discern-barre-collante { display: none; }
    body.discern-avec-barre-collante { padding-bottom: 0; }
}


/* =============================================================================
   4. SOURIS ABSENTE (écrans tactiles) : pas d'état « survol » collant
   ============================================================================= */

@media (hover: none) {
    .discern-echelle__item:hover .discern-echelle__label {
        border-color : var(--couleur-bordure);
        background   : var(--couleur-fond-carte);
        color        : var(--couleur-texte-secondaire);
    }
    .discern-echelle__item:hover .discern-echelle__indicateur { border-color: var(--couleur-bordure-forte); }
    .discern-echelle__item:hover .discern-echelle__label--selectionne {
        border-color : var(--couleur-accent);
        background   : var(--couleur-accent-tres-clair);
        color        : var(--couleur-texte-principal);
    }
}


/* =============================================================================
   5. ANIMATIONS
   ============================================================================= */

@keyframes discern-mobile-pulsation {
    0%, 100% { transform: scale(1);    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.45); }
    50%      { transform: scale(1.025); box-shadow: 0 14px 38px rgba(76, 212, 232, 0.5); }
}

@keyframes discern-mobile-validation {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .discern-hero__cta .discern-bouton,
    .discern-echelle__label--selectionne { animation: none !important; }
    .discern-barre-collante, .discern-toast-etape { transition: none; }
}
