/* Écran de connexion (login.php, les deux étapes) — même monde que la saisie du code
   à six chiffres : fond sombre et or, carte de verre qui se pose en arrivant.

   Règle de survie : l'état de base de chaque élément est son état FINAL, et toutes les
   animations sont suspendues à la classe `cnx-anime` posée par login.php. Tout ce qui
   bouge part d'un `from` écrit dans un @keyframes. Si l'animation ne joue pas — vieux
   navigateur, mouvement réduit, feuille non chargée, mot de passe refusé — la carte,
   les champs et le bouton sont là, à leur place, utilisables. Le formulaire ne dépend
   d'aucun JavaScript non plus. */

body.page-connexion { background: #0e0d0b; min-height: 100vh; }
body.page-connexion::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(70vw 45vh at 85% 8%, rgb(190 175 135 / .38), transparent 70%),
    radial-gradient(55vw 50vh at 5% 95%, rgb(132 114 82 / .45), transparent 70%),
    radial-gradient(40vw 30vh at 60% 45%, rgb(217 197 143 / .10), transparent 70%),
    linear-gradient(150deg, #0e0d0b 0%, #2a241a 38%, #0e0d0b 62%, #241e15 100%);
  filter: saturate(115%);
}
body.page-connexion .contenu { position: relative; z-index: 1; max-width: none; margin: 0; padding: 0; }

.cnx-scene { position: relative; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px 16px; }

/* ---- La carte ----------------------------------------------------------------- */
.cnx-carte {
  position: relative; z-index: 1; overflow: hidden;
  width: min(440px, 100%); padding: 34px 30px 26px; text-align: center; border-radius: 28px;
  color: #f4f1ea;
  background: linear-gradient(160deg, rgb(255 255 255 / .12), rgb(255 255 255 / .04));
  border: 1px solid rgb(255 255 255 / .16);
  box-shadow: 0 30px 80px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .18);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
}
.cnx-anime .cnx-carte { animation: cnx-leve .55s cubic-bezier(.2, .9, .25, 1.05) both; }
/* Le reflet qui balaie la carte une fois, à l'arrivée. */
.cnx-carte::after {
  content: ""; position: absolute; inset: -40% -60%; pointer-events: none; opacity: 0;
  background: linear-gradient(104deg, transparent 42%, rgb(255 255 255 / .16) 50%, transparent 58%);
}
.cnx-anime .cnx-carte::after { animation: cnx-reflet .9s .3s ease-out both; }
@keyframes cnx-leve {
  from { opacity: 0; transform: translateY(44px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cnx-reflet {
  from { opacity: 0; transform: translateX(-70%); }
  20%  { opacity: 1; }
  to   { opacity: 0; transform: translateX(70%); }
}

/* ---- Le contenu de la carte, en cascade --------------------------------------
   `--d` porte le retard de chaque bloc : il est écrit dans le gabarit, à côté du
   contenu, pour qu'on lise l'ordre d'apparition dans le HTML. */
.cnx-anime .cnx-apparait { animation: cnx-monte .45s calc(.2s + var(--d, 0s)) cubic-bezier(.2, .8, .3, 1) both; }
@keyframes cnx-monte {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cnx-logo { display: block; width: min(176px, 58%); margin: 0 auto .5rem; }
.cnx-accroche { margin: 0 0 1.7rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .22em;
  color: rgb(244 241 234 / .5); }


/* ---- Le formulaire ------------------------------------------------------------
   Champs sombres plutôt que soulignés : sur fond de verre, un trait fin se perd. */
.cnx-carte .form-c21 { text-align: left; }
.cnx-carte .form-c21 input {
  width: 100%; border: 1.5px solid rgb(255 255 255 / .18); border-radius: 14px;
  background: rgb(0 0 0 / .28); color: #fff; padding: .85rem 1rem; font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.cnx-carte .form-c21 input::placeholder { color: rgb(244 241 234 / .42); }
.cnx-carte .form-c21 input:focus {
  outline: none; border-color: #d9c58f;
  box-shadow: 0 0 0 4px rgb(190 175 135 / .22), 0 0 18px rgb(217 197 143 / .3);
}
.cnx-carte .form-c21 > input { margin-bottom: .85rem; }
.cnx-carte .champ-mdp input { padding-right: 2.9rem; }
.cnx-carte .oeil { right: .9rem; color: rgb(244 241 234 / .55); }
.cnx-carte .oeil:hover { color: #d9c58f; }

.cnx-carte .btn-c21 {
  margin-top: 1.4rem; border-radius: 14px; padding: .95rem 1rem; letter-spacing: .04em;
  text-transform: none; font-size: .95rem; color: #1d1a13;
  background: linear-gradient(180deg, #e2cf97, #b59a5a);
  box-shadow: 0 10px 28px rgb(190 160 90 / .35);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.cnx-carte .btn-c21:hover { background: linear-gradient(180deg, #e9d8a6, #c0a665); transform: translateY(-1px); box-shadow: 0 14px 34px rgb(190 160 90 / .45); }

/* ---- Liens et message d'erreur ------------------------------------------------ */
.cnx-carte .liens-connexion { margin-top: 1.2rem; }
.cnx-carte .liens-connexion a { color: rgb(244 241 234 / .62); font-size: .86rem; margin-top: .6rem; }
.cnx-carte .liens-connexion a:hover { color: #d9c58f; }
.cnx-carte .liens-connexion .besoin-aide { font-size: .8rem; }
.cnx-carte .aide-premiere {
  margin-top: .7rem; background: rgb(0 0 0 / .3); border: 1px solid rgb(190 175 135 / .35);
  color: rgb(244 241 234 / .78); font-size: .84rem; border-radius: 14px;
}
.cnx-carte .aide-premiere strong { color: #d9c58f; }
.cnx-carte .flash-erreur {
  margin-bottom: 1rem; border-radius: 14px; font-size: .86rem;
  background: rgb(163 42 32 / .22); border: 1px solid rgb(255 138 128 / .5); color: #ff8a80;
}

/* ---- Deuxième étape (saisie du code) -----------------------------------------
   La carte du code se pose de la même façon que celle de la connexion, pour que les
   deux écrans se suivent. Après un code refusé, `cnx-anime` n'est pas posée : la carte
   est là tout de suite et c'est le tremblement d'`otp.css` qui parle. */
.cnx-anime.page-otp .otp-carte:not(.refus) { animation: cnx-leve .55s cubic-bezier(.2, .9, .25, 1.05) both; }

@media (max-width: 400px) {
  .cnx-carte { padding: 28px 18px 22px; }
}

/* Mouvement réduit : la carte est simplement là, rien ne monte. */
@media (prefers-reduced-motion: reduce) {
  .cnx-anime .cnx-carte, .cnx-anime .cnx-carte::after, .cnx-anime .cnx-apparait,
  .cnx-anime.page-otp .otp-carte:not(.refus) { animation: none; }
}

/* ---- Pages sœurs du parcours : mot de passe oublié, première connexion -------
   Même carte, même fond. Ce qu'il reste à habiller, ce sont les blocs qu'elles sont
   seules à utiliser (explications, QR code, clé manuelle). */
.cnx-carte > p, .cnx-carte .form-c21 p { text-align: left; font-size: .88rem; line-height: 1.55;
  color: rgb(244 241 234 / .72); }
.cnx-carte strong { color: #e2cf97; font-weight: 600; }
.cnx-carte .sous-marque { margin: -.2rem 0 1.5rem; text-align: center; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .18em; color: rgb(244 241 234 / .5); }
.cnx-carte .form-c21 label { display: block; margin-bottom: 1rem; font-size: .82rem; font-weight: 500;
  color: rgb(244 241 234 / .72); }
.cnx-carte .form-c21 label input { margin-top: .35rem; }
.cnx-carte .liste-etapes { margin: .6rem 0 1.1rem; padding-left: 1.1rem; font-size: .86rem; line-height: 1.55;
  color: rgb(244 241 234 / .72); }
.cnx-carte .liste-etapes li { margin-bottom: .35rem; }
.cnx-carte .liste-etapes::marker, .cnx-carte .liste-etapes li::marker { color: #d9c58f; }
/* Un QR code a besoin de sa marge claire pour être lu : on lui donne un carré blanc. */
.cnx-carte .qrcode { display: grid; place-items: center; width: fit-content; margin: 0 auto 1rem;
  padding: 12px; background: #fff; border-radius: 14px; }
.cnx-carte .qrcode img, .cnx-carte .qrcode canvas { display: block; }
.cnx-carte .secret-manuel { text-align: center; font-size: .8rem; color: rgb(244 241 234 / .62); }
.cnx-carte .secret-manuel code { display: inline-block; margin-top: .3rem; padding: .35rem .7rem;
  border-radius: 10px; background: rgb(0 0 0 / .3); border: 1px solid rgb(190 175 135 / .35);
  color: #e2cf97; letter-spacing: .12em; font-size: .85rem; }
.cnx-carte .champ-code { text-align: center; letter-spacing: .4em; font-size: 1.15rem; }
.cnx-carte .flash { margin-bottom: 1rem; border-radius: 14px; font-size: .86rem; }
