/* [lot L-porte] LA PORTE DU PHARE (Nicolas, 24/10/2026 : « réimagine la boîte
   de login avec cette grammaire irisée qui devient une identité du site » ;
   arbitré sur la planche `connexion-boite-irisee-jour|nuit` : « C sur
   lephare.ai », « OK pour modifier le logo en animé »).

   UNE SEULE BOÎTE, DEUX ADRESSES. Cette feuille habille la page d'accueil de
   lephare.ai (`porte.html`) et l'écran de connexion de l'application
   (`js/porte.js`, monté par `app.js`). Elle ne dépend que des jetons de la
   charte (`--v3-*`) et de l'iris (`--iris-*`).

   [lot L-porte2] TOUJOURS EN NUIT, SUR LE FOND DU VOILE J (Nicolas, 25/10/2026).
   La porte ignore le thème du système et du navigateur : les jetons de nuit sont
   posés sur `.porte` elle-même, sur lephare.ai comme dans l'application. Le
   fond est le moteur du voile J (`voile-j.css`, chargé à côté, jamais recopié)
   avec les réglages de Nicolas : 69 % sur les filets, intensité 70 %, filet
   1 px au pas de 82 px, vertical, matière granuleuse (71 %), sur un noir
   couvert du voile du thème nuit à 71 %. Le flou du voile n'est pas posé : il
   n'y a rien derrière à flouter. Le mouvement est « phare », centré sur la
   lampe de l'emblème (`porte.js` mesure la lampe), un tour en 50 s, préréglage
   P2 « large et lent » : 45° d'ouverture, traîne longue de 90°. Un seul
   faisceau : il remplace le faisceau irisé à deux pinceaux de la variante C.

   LA VARIANTE C, ce qui en reste. Le liseré de la boîte est irisé à mi-force au repos
   (9 s) et à pleine force pendant la vérification (3,4 s), la lampe de
   l'emblème coule en iris en continu. À l'entrée, le liseré fait un tour, la
   lumière monte, la boîte s'efface (900 ms).

   LE JEU A (sans `:root[data-celebrations="iris"]`). Le phare reste, en violet
   uni et immobile (la règle du voile J) ; la lampe garde l'or ; le liseré n'existe que pendant la
   vérification, en violet uni et immobile.

   RÉDUIRE LES ANIMATIONS. Le phare se fige, posé de biais ; la lampe et le
   liseré restent, figés (la couleur porte l'identité et l'état) ;
   le passage devient un fondu de 150 ms.

   Banc : `outils/banc-porte.mjs`. */

/* ── LES JETONS, SEULEMENT SUR LA PAGE SEULE ──────────────────────────────────
   `porte.html` ne charge pas les kits (1,5 Mo) : elle reçoit ici la COPIE des
   jetons de `ds-v3-kit.css` (blocs `:root[data-charte="v3"]`, nuit et jour) et
   de l'iris de `ds-v2-kit.css` dont elle se sert. Le banc compare chaque valeur
   à sa source : une copie qui dériverait fait rougir `banc-porte`. Dans
   l'application, le même bloc se pose sur `.porte` : la porte y reste en nuit
   quel que soit le thème choisi (lot L-porte2). */
html.porte-seule[data-charte="v3"], .porte {
  --v3-fond: #071317;      --v3-panneau: #0a1d22;   --v3-leve: #0d2429;
  --v3-encre: #e3eff0;     --v3-encre2: #9db0b2;    --v3-encre3: #7f9497;
  --v3-filet: rgba(150,190,195,.13);                --v3-filet2: rgba(150,190,195,.07);
  --v3-creux: rgba(150,190,195,.055);               --v3-creux2: rgba(150,190,195,.1);
  --v3-ambre: #e0a95c;     --v3-ambre-sur: #071317;
  --v3-argile: #d0776a;    --v3-argile-t: rgba(208,119,106,.42);
  --v3-violet: #9b8ec4;
  --v3-r: 10px;
  --iris-1: #4f7bff; --iris-2: #7b5cff; --iris-3: #b45cff;
  --iris-4: #f26bd0; --iris-5: #3fd8ff; --iris-6: #3ff0b0;
  --iris-tour: 3.4s;
  --iris-uni: var(--v3-violet);
}
/* [lot L-porte2] plus de jeu de jour : la porte est toujours en nuit */
html.porte-seule, html.porte-seule body {
  margin: 0; min-height: 100%; background: var(--v3-fond); color: var(--v3-encre);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── LE MOUVEMENT ── */
@property --porte-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes porte-tourne { to { --porte-a: 360deg; } }
@keyframes porte-coule { from { background-position: 0 0%; } to { background-position: 0 100%; } }
@keyframes porte-passe { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes porte-respire { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes porte-un-tour { from { --porte-a: 0deg; opacity: 1; } 80% { opacity: 1; } to { --porte-a: 360deg; opacity: 0; } }
@keyframes porte-efface { 0%, 40% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(.985); } }

/* ── LA PAGE ── */
.porte {
  --iris-l: linear-gradient(180deg, var(--iris-1), var(--iris-3), var(--iris-4), var(--iris-5), var(--iris-6), var(--iris-1));
  position: fixed; inset: 0; z-index: 1; overflow: hidden auto;
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  padding: 32px 16px; background: #000; color: var(--v3-encre); color-scheme: dark;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums;
}
.porte *, .porte *::before, .porte *::after { box-sizing: border-box; }

/* [lot L-porte2] LE FOND : le voile J en mouvement « phare ». Les calques sont
   ceux de `voile-j.css` (`.vj-teinte`, `.vj-sur`, `.vj-entre`, `.vj-mat`,
   `.vj-phare`) ; ici, seulement ce qui tient à la porte : le calque couvre la
   page au lieu de la fenêtre, la teinte est celle de la nuit, le centre est la
   lampe (`--porte-lx`, `--porte-ly`, mesurés par `porte.js` ; avant la mesure,
   le milieu à 34 % de la hauteur). */
.porte > .porte-fx.vj { position: absolute; inset: 0; z-index: -1; min-height: 100%;
  --voile-teinte: 8, 16, 24;
  --vj-cx: var(--porte-lx, 50%); --vj-cy: var(--porte-ly, var(--porte-fy, 34%)); }

/* ── LA BOÎTE ── */
.porte-boite {
  position: relative; z-index: 1; width: 340px; max-width: 100%;
  padding: 34px 30px 26px; border: 1px solid var(--v3-filet); border-radius: var(--v3-r, 10px);
  background: color-mix(in srgb, var(--v3-panneau) 84%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  text-align: left; font-size: 14px; line-height: 1.45;
}
/* le liseré : un filet de 1 px découpé par masque, qui ne touche ni le fond ni le texte */
.porte-boite::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  pointer-events: none; z-index: 2; opacity: 0;
  background: var(--iris-uni);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.porte-boite[data-etat="verifie"]::after { opacity: 1; }
html:root[data-celebrations="iris"] .porte-boite::after {
  opacity: .5;
  background: conic-gradient(from var(--porte-a), var(--iris-1), var(--iris-2), var(--iris-3),
    var(--iris-4), var(--iris-5), var(--iris-6), var(--iris-1));
  animation: porte-tourne 9s linear infinite;
}
html:root[data-celebrations="iris"] .porte-boite[data-etat="verifie"]::after {
  opacity: 1; animation-duration: var(--iris-tour, 3.4s);
}

.porte-haut { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }
.porte-nom { margin: 0; font-weight: 200; font-size: 32px; letter-spacing: -.02em; line-height: 1; color: var(--v3-encre); }
.porte-phrase { margin: -2px 0 0; font-size: 12.5px; color: var(--v3-encre2); text-align: center; }
.porte-sous { margin: 0; font-size: 13.5px; color: var(--v3-encre); text-align: center; }

/* ── L'EMBLÈME : trois traits d'or, le milieu est la lampe ── */
.porte-emb { display: inline-flex; gap: 6px; align-items: center; height: 36px; }
.porte-emb i { display: block; width: 5px; height: 36px; border-radius: 1px; background: var(--v3-ambre);
  transition: height .4s cubic-bezier(.22,1,.36,1); }
.porte-emb i:nth-child(2) { height: 18px; }
html:root[data-celebrations="iris"] .porte-emb i:nth-child(2) {
  background: var(--iris-l); background-size: 100% 300%;
  animation: porte-coule var(--iris-tour, 3.4s) linear infinite;
}
.porte-boite[data-etat="ouvre"] .porte-emb i:nth-child(2) { height: 36px; }

/* ── LES CHAMPS ── */
.porte-ch { display: block; margin: 0 0 12px; }
.porte-ch > span { display: block; font-size: 11.5px; color: var(--v3-encre3); margin: 0 0 5px 2px; }
html .porte input.porte-in {
  display: block; width: 100%; height: 42px; margin: 0; padding: 0 14px;
  border-radius: var(--v3-r, 10px); background: var(--v3-creux); border: 1px solid var(--v3-filet);
  font: inherit; font-size: 14px; color: var(--v3-encre); outline: none; box-shadow: none; text-align: left;
}
html .porte input.porte-in:focus { border-color: var(--v3-encre3); background: var(--v3-creux2); }
html .porte input.porte-in.err { border-color: var(--v3-argile-t); }
html .porte input.porte-in:disabled { color: var(--v3-encre3); }
html .porte input.porte-in::placeholder { color: var(--v3-encre3); }
html .porte input.porte-in.code { height: 52px; font-size: 22px; font-weight: 300; letter-spacing: .42em; text-align: center; }

/* ── LES BOUTONS ── */
html .porte button.porte-bt {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; margin: 6px 0 0;
  border: 0; border-radius: var(--v3-r, 10px); background: var(--v3-ambre); color: var(--v3-ambre-sur);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: none;
}
html .porte button.porte-bt.second { background: transparent; color: var(--v3-encre); border: 1px solid var(--v3-filet); font-weight: 400; }
html .porte button.porte-bt:disabled { background: var(--v3-creux2); color: var(--v3-encre3); cursor: default; }
.porte-mot { color: var(--iris-uni); }
@media (prefers-reduced-motion: no-preference) {
  html:root[data-celebrations="iris"] .porte-mot {
    background: linear-gradient(90deg, var(--v3-encre2) 0 36%, var(--iris-1) 42%, var(--iris-3) 46%, var(--iris-4) 50%,
      var(--iris-5) 54%, var(--iris-6) 58%, var(--v3-encre2) 64% 100%);
    background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: porte-passe 2.6s linear infinite;
  }
}
html:root[data-celebrations="iris"] .porte-mot { color: var(--v3-encre2); }

/* ── LES LIENS ET LES MESSAGES ── */
.porte-pied { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 12px; }
html .porte .porte-pied a, html .porte .porte-pied button.porte-lien {
  color: var(--v3-encre3); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
html .porte .porte-pied a:hover, html .porte .porte-pied button.porte-lien:hover { color: var(--v3-encre); }
.porte-msg { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--v3-encre2); margin: 2px 0 10px; line-height: 1.45; }
.porte-msg:empty { display: none; }
.porte-msg::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--v3-encre3); }
.porte-msg[data-ton="argile"]::before { background: var(--v3-argile); }
.porte-msg[data-ton="ambre"]::before { background: var(--v3-ambre); animation: porte-respire 2.2s ease-in-out infinite; }
.porte-coche { display: flex; gap: 9px; align-items: center; font-size: 12px; color: var(--v3-encre2); margin-top: 12px; cursor: pointer; }
html .porte .porte-coche input { margin: 0; width: 14px; height: 14px; accent-color: var(--v3-encre2); }
.porte-sys { margin: 4px 0 12px; padding: 12px 14px; border-radius: var(--v3-r, 10px); background: var(--v3-creux);
  border: 1px solid var(--v3-filet2); display: flex; gap: 12px; align-items: center; font-size: 12.5px; color: var(--v3-encre2); }
.porte-sys svg { flex: none; color: var(--v3-encre2); }
.porte-note { margin: 14px 0 0; font-size: 12px; color: var(--v3-encre3); line-height: 1.5; text-align: center; }
html .porte .porte-note a { color: var(--v3-encre2); }
/* les écrans voisins (nouveau mot de passe, invitation, premier compte, aucun
   espace) gardent leurs champs : ils prennent la mesure de la boîte */
.porte-boite .field { margin: 0 0 12px; }
.porte-boite .field input, .porte-boite .field select { width: 100%; }

/* ── LE PASSAGE : un tour du liseré, la lumière monte, la boîte s'efface ── */
.porte-boite[data-etat="ouvre"] { animation: porte-efface .9s ease-in forwards; }
.porte-boite[data-etat="ouvre"]::after { opacity: 1; }
html:root[data-celebrations="iris"] .porte-boite[data-etat="ouvre"]::after { animation: porte-un-tour .9s linear forwards; }

/* ── RÉDUIRE LES ANIMATIONS : figé, le phare compris (`voile-j.css`) ── */
@media (prefers-reduced-motion: reduce) {
  .porte-boite::after, .porte-emb i, .porte-msg::before { animation: none !important; }
  html:root[data-celebrations="iris"] .porte-emb i:nth-child(2) { animation: none; background-position: 0 30%; }
  .porte-emb i { transition: none; }
  .porte-boite[data-etat="ouvre"] { animation: porte-efface .15s linear forwards; }
}

/* ── LE TÉLÉPHONE ── */
@media (max-width: 480px) {
  .porte { --porte-fy: 28%; align-items: flex-start; padding-top: 12vh; }
  .porte-boite { width: 100%; padding: 30px 22px 22px; }
}
