/* ==========================================================================
   Page de connexion WACOMOS Fes - autonome (sans layout principal).
   Polices : Poppins (titres) et Nunito Sans (texte), repli sur la pile systeme.
   ========================================================================== */

:root {
    --vert-fond-1: #0d2a10;
    --vert-fond-2: #04140a;
    --citron: #9be31a;
    --citron-bouton: #7fd400;
    --vert-champ: #3a9a1c;
    --texte: #14221a;
    --gris: #5b6a60;
    --police-titre: "Montserrat", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --police-texte: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.connexion {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    background: linear-gradient(135deg, var(--vert-fond-1) 0%, var(--vert-fond-2) 70%);
    background-color: var(--vert-fond-2);
    color: #fff;
    font-family: var(--police-texte);
}

/* ---- Decor -------------------------------------------------------------- */
.fond, .photo { position: absolute; pointer-events: none; }
.fond { inset: 0; overflow: hidden; z-index: 0; }

.fond-grille {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(155, 227, 26, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(155, 227, 26, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 20%, transparent 75%);
            mask-image: radial-gradient(ellipse at 30% 30%, #000 20%, transparent 75%);
}

.ligne { display: block; overflow: visible; fill: none; stroke: var(--citron); stroke-width: 2.5; stroke-linecap: round;
         filter: drop-shadow(0 0 5px rgba(155, 227, 26, .65)); }
.ligne circle { fill: var(--citron); stroke: none; }

.ligne-haut { position: absolute; left: 0; top: 0; width: 49.6vw; height: auto; max-width: 960px; }

.photo {
    left: 0; bottom: 0; z-index: 1;
    width: 57vw; max-width: 1100px;
    aspect-ratio: 945 / 381;
    background: url("../images/connexion/fes-nuit.jpg") left bottom / cover no-repeat;
    -webkit-mask-image: linear-gradient(to top, #000 45%, transparent 100%), linear-gradient(to left, transparent 0, #000 24%);
    -webkit-mask-composite: source-in;
            mask-image: linear-gradient(to top, #000 45%, transparent 100%), linear-gradient(to left, transparent 0, #000 24%);
            mask-composite: intersect;
}

/* ---- Mise en page -------------------------------------------------------- */
.page {
    overflow-x: clip;
    position: relative; z-index: 2;
    min-height: 100vh; min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(420px, 37.8vw, 660px);
    align-items: center;
    column-gap: 4vw;
    padding: 5vh 5.6vw 5vh 7.3vw;
}

/* ---- Colonne gauche ------------------------------------------------------ */
.marque { position: relative; padding-bottom: 2vh; }

.pastille {
    width: clamp(150px, 14.1vw, 250px); aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    display: grid; place-items: center;
    border: clamp(5px, .5vw, 9px) solid #6fc01a;
    box-shadow: 0 0 0 3px rgba(155, 227, 26, .25), 0 0 34px 6px rgba(155, 227, 26, .55), 0 0 90px rgba(155, 227, 26, .25);
    margin-bottom: clamp(18px, 2.2vw, 34px);
}
.pastille img { width: 78%; height: 78%; object-fit: contain; }

.titre {
    margin: 0 0 .35em;
    font-family: var(--police-titre);
    font-weight: 800;
    font-size: clamp(38px, 3.83vw, 76px);
    line-height: 1.05;
    letter-spacing: -.01em;
    color: #fff;
}
.titre span { color: var(--citron); }

.sous-titre {
    margin: 0;
    max-width: 40vw;
    font-size: clamp(16px, 1.32vw, 24px);
    line-height: 1.45;
    color: #fff;
}

.ligne-bas { width: 35.9vw; max-width: 700px; height: auto; margin-top: -10px; }

/* ---- Carte ---------------------------------------------------------------- */
.carte-zone { position: relative; width: 100%; }

.carte {
    position: relative; z-index: 2;
    background: #fff;
    color: var(--texte);
    border-radius: 28px;
    padding: 28px clamp(24px, 2.4vw, 40px) clamp(22px, 2.2vw, 34px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, .45), 0 4px 16px rgba(0, 0, 0, .2);
}

.cadre { position: absolute; z-index: 1; height: 220px; border: 2px solid var(--citron);
         filter: drop-shadow(0 0 5px rgba(155, 227, 26, .6)); pointer-events: none; }
.cadre-haut { left: calc(100% - 230px); top: -124px; width: 14vw; border-right: 0; border-bottom: 0; border-radius: 56px 0 0 0; }
.cadre-bas { left: calc(100% - 137px); bottom: -52px; width: 14vw; border-top: 0; border-right: 0; border-radius: 0 0 0 56px; }

.bandeau {
    display: flex; align-items: center; justify-content: center; gap: clamp(14px, 2.4vw, 36px);
    background: #f1f5ef;
    border-radius: 20px;
    padding: 14px clamp(12px, 2vw, 28px);
    margin: 0 -12px;
}

.bandeau img { display: block; height: auto; }
.logo-commune { width: clamp(150px, 15.2vw, 250px); }
.logo-mecomar { width: clamp(70px, 7.6vw, 125px); }
.filet { width: 2px; align-self: stretch; margin: 10px 0; background: #d5b97a; opacity: .8; border-radius: 2px; }

.carte-titre {
    margin: clamp(18px, 2vw, 30px) 0 4px;
    font-family: var(--police-titre);
    font-weight: 700;
    font-size: clamp(28px, 2.15vw, 38px);
    line-height: 1.15;
    color: #0b1510;
}
.carte-texte { margin: 0 0 clamp(14px, 1.6vw, 22px); color: var(--gris); font-size: clamp(15px, 1.2vw, 20px); line-height: 1.4; }

label { display: block; margin: 14px 0 8px; font-weight: 700; font-size: clamp(15px, 1.15vw, 19px); color: #0b1510; }

.champ {
    position: relative; display: flex; align-items: center;
    height: clamp(52px, 3.5vw, 60px);
    border: 2px solid #dfe5dc; border-radius: 16px; background: #f7f9f6;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.champ:focus-within { border-color: var(--vert-champ); background: #fff; box-shadow: 0 0 0 4px rgba(58, 154, 28, .14); }
.champ .icone, .securise svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.champ .icone { width: 24px; height: 24px; margin-left: 16px; flex: none; color: #2a3a2f; }
.champ input {
    flex: 1; min-width: 0; height: 100%;
    border: 0; background: transparent; outline: 0;
    padding: 0 16px 0 14px;
    font: inherit; font-size: clamp(16px, 1.2vw, 19px); color: var(--texte);
}
.champ input::placeholder { color: #66726a; opacity: 1; }
.afficher {
    flex: none; margin-right: 18px; padding: 8px 4px;
    border: 0; background: transparent; cursor: pointer;
    font: inherit; font-weight: 700; font-size: clamp(14px, 1.05vw, 17px); color: #1f7a12;
}
.afficher:hover { text-decoration: underline; }
.afficher:focus-visible, .valider:focus-visible { outline: 3px solid #1f7a12; outline-offset: 2px; border-radius: 8px; }

.erreur {
    margin-top: 16px; padding: 11px 14px;
    background: #fdeeee; border: 1px solid #f3c9c9; border-radius: 12px;
    color: #a63232; font-size: 15px; line-height: 1.35;
}

.valider {
    display: block; width: 100%; margin-top: clamp(18px, 2vw, 28px);
    height: clamp(54px, 3.9vw, 68px);
    border: 0; border-radius: 14px; cursor: pointer;
    background: var(--citron-bouton);
    color: #0a0f0a;
    font-family: var(--police-titre); font-weight: 700; font-size: clamp(18px, 1.5vw, 24px);
    box-shadow: 0 10px 26px rgba(127, 212, 0, .38);
    transition: filter .15s, transform .15s;
}
.valider:hover { filter: brightness(1.06); }
.valider:active { transform: translateY(1px); }

.securise {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: clamp(14px, 1.6vw, 22px) 0 0;
    color: #3d4b42; font-size: clamp(14px, 1.05vw, 17px);
}
.securise svg { width: 20px; height: 20px; color: #2a9a1c; }

@media (min-width: 1100px) {
    .marque { align-self: start; margin-top: 11.5vh; }
}

/* ---- Tablette : colonne unique ------------------------------------------- */
@media (max-width: 1099.98px) {
    .page {
        grid-template-columns: minmax(0, 560px);
        justify-content: center;
        align-content: start;
        row-gap: 28px;
        padding: 36px 24px 220px;
    }
    .marque { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 24px; row-gap: 6px; }
    .pastille { width: 120px; margin: 0; grid-row: 1 / span 2; border-width: 5px; }
    .titre { font-size: clamp(36px, 6vw, 48px); margin: 0; align-self: end; }
    .sous-titre { max-width: none; grid-column: 2; font-size: 16px; align-self: start; }
    .ligne-haut, .ligne-bas, .cadre { display: none; }
    .photo { width: 100%; max-width: none; aspect-ratio: 945 / 300; background-position: center bottom;
             -webkit-mask-image: linear-gradient(to top, #000 40%, transparent 100%); -webkit-mask-composite: source-over;
                     mask-image: linear-gradient(to top, #000 40%, transparent 100%); mask-composite: add; }
    .logo-commune { width: 190px; }
    .logo-mecomar { width: 80px; }
}

/* ---- Mobile --------------------------------------------------------------- */
@media (max-width: 599.98px) {
    .page { padding: 20px 16px 180px; row-gap: 20px; }
    .marque { grid-template-columns: auto 1fr; column-gap: 14px; }
    .pastille { width: 84px; border-width: 4px; }
    .titre { font-size: 30px; }
    .sous-titre { font-size: 14px; line-height: 1.4; grid-column: 1 / -1; margin-top: 10px; }
    .carte { border-radius: 22px; padding: 20px 18px 20px; }
    .bandeau { margin: 0; padding: 12px 10px; gap: 12px; }
    .logo-commune { width: 140px; }
    .logo-mecomar { width: 62px; }
    .carte-titre { font-size: 28px; }
    .photo { aspect-ratio: 945 / 360; }
}

@media (max-height: 700px) and (min-width: 1100px) {
    .page { padding-top: 24px; padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Intro animee (environ 2,4 s, passable au clic / Echap) puis apparition de la page.
   Reservee a html.anim : sans JavaScript, avec prefers-reduced-motion ou au
   retour d'une erreur de connexion, rien de tout cela n'est actif.
   ========================================================================== */
.intro { display: none; }

html.intro-actif, html.intro-actif body { overflow: hidden; }

html.intro-actif .intro {
    position: fixed; inset: 0; z-index: 50; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 3vh, 26px);
    padding: 16px;
    background: radial-gradient(900px 600px at 50% 42%, rgba(28, 92, 24, .75), transparent 70%),
                linear-gradient(135deg, var(--vert-fond-1) 0%, var(--vert-fond-2) 70%);
    clip-path: circle(150% at 50% 42%);
}
.intro.fin { animation: intro-iris .7s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes intro-iris { to { clip-path: circle(0% at 50% 42%); } }

.intro-trame {
    position: absolute; inset: 0; opacity: .7;
    background-image: linear-gradient(rgba(155, 227, 26, .06) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(155, 227, 26, .06) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0, transparent 60%);
            mask-image: radial-gradient(circle at 50% 42%, #000 0, transparent 60%);
}

.intro-scene { position: relative; width: clamp(170px, 26vmin, 230px); aspect-ratio: 1; display: grid; place-items: center; }

.intro .onde {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid rgba(155, 227, 26, .5);
    opacity: 0; animation: intro-onde 1.8s ease-out infinite;
}
.intro .onde:nth-child(2) { animation-delay: .6s; }
.intro .onde:nth-child(3) { animation-delay: 1.2s; }
@keyframes intro-onde { 0% { transform: scale(.78); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }

.intro-disque {
    position: relative; width: 84%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
    background: #fff; display: grid; place-items: center;
    border: 5px solid #6fc01a;
    box-shadow: 0 0 0 3px rgba(155, 227, 26, .25), 0 0 34px 6px rgba(155, 227, 26, .5), 0 0 80px rgba(155, 227, 26, .22);
    animation: intro-sortie .8s cubic-bezier(.2, .9, .3, 1.15) both;
}
.intro-disque img { display: block; width: 66%; height: auto; }
.intro-disque::after { /* reflet qui balaie le logo */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .85) 50%, transparent 62%);
    transform: translateX(-120%); animation: intro-reflet 1s .75s ease-in-out forwards;
}
@keyframes intro-sortie { from { opacity: 0; transform: scale(.6) rotate(-8deg); filter: blur(12px); }
                          to   { opacity: 1; transform: none; filter: blur(0); } }
@keyframes intro-reflet { to { transform: translateX(120%); } }

.intro-anneau { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.intro-anneau circle { fill: none; stroke-width: 3.5; }
.intro-anneau-fond { stroke: rgba(255, 255, 255, .1); }
.intro-anneau-progres {
    stroke: var(--citron); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1;
    filter: drop-shadow(0 0 5px rgba(155, 227, 26, .7));
    animation: intro-remplir 1.9s .2s cubic-bezier(.45, 0, .2, 1) forwards;
}
@keyframes intro-remplir { to { stroke-dashoffset: 0; } }
.intro-tete { position: absolute; inset: 0; animation: intro-tourner 1.9s .2s cubic-bezier(.45, 0, .2, 1) forwards; }
.intro-tete::before {
    content: ""; position: absolute; top: 1px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px;
    border-radius: 50%; background: #fff; box-shadow: 0 0 12px 3px var(--citron);
}
@keyframes intro-tourner { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.intro-titre {
    font-family: var(--police-titre); font-weight: 800; color: #fff; text-align: center;
    font-size: clamp(32px, 7vmin, 44px); letter-spacing: .01em; line-height: 1.1;
}
.intro-titre .lettre { display: inline-block; opacity: 0; transform: translateY(14px);
                       animation: intro-lettre .45s cubic-bezier(.2, .9, .3, 1.2) forwards; }
.intro-titre .ville { display: inline-block; margin-left: .3em; color: var(--citron); opacity: 0;
                      animation: intro-monter .5s 1.15s ease-out forwards; }
@keyframes intro-lettre { to { opacity: 1; transform: none; } }
@keyframes intro-monter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Mecomar Fes (delegataire) : signature discrete sur pastille claire */
.intro-signature {
    display: flex; align-items: center; justify-content: center;
    width: clamp(46px, 8vmin, 60px); aspect-ratio: 1; border-radius: 14px; background: #f1f5ef;
    opacity: 0; animation: intro-monter .5s 1.3s ease-out forwards;
}
.intro-signature img { display: block; height: 70%; width: auto; }

.intro-barre { width: min(220px, 60vw); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden;
               opacity: 0; animation: intro-monter .4s .5s ease-out forwards; }
.intro-barre span { display: block; height: 100%; width: 0; border-radius: 4px;
                    background: linear-gradient(90deg, var(--citron-bouton), var(--citron));
                    box-shadow: 0 0 10px rgba(155, 227, 26, .8);
                    animation: intro-charger 1.7s .4s cubic-bezier(.45, 0, .2, 1) forwards; }
@keyframes intro-charger { to { width: 100%; } }

.intro-passer { position: absolute; bottom: 24px; font-size: 13px; color: rgba(255, 255, 255, .5);
                opacity: 0; animation: intro-monter .5s 1s ease-out forwards; }

/* ---- Apparition de la page apres l'intro --------------------------------- */
html.anim .marque     { animation: page-monter .8s .05s ease-out both paused; }
html.anim .carte-zone { animation: page-monter .8s .2s ease-out both paused; }
html.anim .photo      { animation: page-fondu 1.4s .1s ease-out both paused; }
html.anim .cadre      { animation: page-fondu .8s .9s ease-out both paused; }
html.anim .ligne path { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
                        animation: page-tracer 1.8s .15s cubic-bezier(.45, 0, .2, 1) forwards paused; }
html.anim .ligne circle { opacity: 0; animation: page-fondu .4s 1.7s ease-out forwards paused; }
html.anim .ligne-bas path { animation-delay: .6s; }
html.anim .ligne-bas circle { animation-delay: 2.1s; }

html.anim body.dessin .marque, html.anim body.dessin .carte-zone, html.anim body.dessin .photo,
html.anim body.dessin .cadre, html.anim body.dessin .ligne path, html.anim body.dessin .ligne circle { animation-play-state: running; }

@keyframes page-monter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes page-fondu { from { opacity: 0; } to { opacity: 1; } }
@keyframes page-tracer { 0% { opacity: 1; stroke-dashoffset: 1; } 100% { opacity: 1; stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
    .intro { display: none !important; }
    html.intro-actif, html.intro-actif body { overflow: auto; }
}
