/* ============================================================
   CONNEXION — refonte V3 (validée par le propriétaire le 2026-10-28, active pour tous)
   Choix parmi 4 versions : « je choisis la version A ; sur ordinateur, comme la version B ».
   - téléphone (et tablette debout) : texture rouge en haut avec le logo, la feuille blanche remonte dessus ;
   - ordinateur, tablette ou téléphone à l'horizontale : carrelage et logo à gauche, formulaire à droite ;
   - « Mot de passe oublié » glisse sur place (de la droite, retour par la gauche).
   Charte V3 : Plus Jakarta Sans, rouge TreGusto #A3141C pour l'action, champs blancs à filet fin, interrupteur au lieu
   de la case, aucun texte d'aide, aucune pastille, aucun « … ». Page fixe : rien ne défile (seule la feuille, si un long
   message ne tient pas). Mise en page : login.html ; états et animations : js/login-page.js (data-panel, data-dir,
   html.lg3-on quand police, logo et fond sont prêts ; filet à 3,5 s dans js/login-boot.js).
   ============================================================ */
@font-face{ font-family:'Plus Jakarta Sans'; font-style:normal; font-weight:200 800; font-display:block;
  src:url('../assets/fonts/plus-jakarta-sans-latin-wght.woff2') format('woff2');
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face{ font-family:'Plus Jakarta Sans'; font-style:normal; font-weight:200 800; font-display:block;
  src:url('../assets/fonts/plus-jakarta-sans-latin-ext-wght.woff2') format('woff2');
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

*, *::before, *::after{ box-sizing:border-box; }
html{
  --l3-ink:#1D1D1F; --l3-ink-2:#6E6E73; --l3-ink-3:#8E8E93; --l3-page:#F2F1F1; --l3-line:#DCDCE0; --l3-line-2:#EEEEF0;
  --l3-brand:#A3141C; --l3-brand-2:#8A1018; --l3-tint:#FBE9EA;
  --l3-ok:#157A3A; --l3-ok-tint:#E7F4EB; --l3-err:#B3161E; --l3-err-tint:#FDECEC; --l3-warn:#8A5A12; --l3-warn-tint:#FCF3E4;
  --l3-card-line:rgba(0,0,0,.07);
  --l3-ease:cubic-bezier(.23,1,.32,1);
  --l3-font:'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* carrelage de la marque voilé de bordeaux, haut en fondu depuis la couleur de la barre d'état (#5C070A) */
  --l3-tiles:
    linear-gradient(#5c070a env(safe-area-inset-top, 0px), rgb(92 7 10 / 0) calc(env(safe-area-inset-top, 0px) + 90px)),
    linear-gradient(rgb(64 6 9 / .36), rgb(64 6 9 / .36)),
    url('../assets/carrelage-tuiles.jpg') center top / 300px auto repeat,
    #5c070a;
  height:100%; overflow:hidden; overscroll-behavior:none; background:#5c070a;
  touch-action:pan-x pan-y; -webkit-text-size-adjust:100%;
}
body{
  height:100%; margin:0; overflow:hidden; overscroll-behavior:none; background:#fff;
  font-family:var(--l3-font); color:var(--l3-ink); -webkit-font-smoothing:antialiased; -webkit-tap-highlight-color:transparent;
}
/* tout apparaît d'un seul coup, une fois la police, le logo et le fond prêts */
html:not(.lg3-on) body{ visibility:hidden; }
html.lg3-on body{ animation:l3Fade .26s ease-out; }
body *:not(input){ -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
[hidden]{ display:none !important; }
h1, h2, p, ul{ margin:0; }
@keyframes l3Fade{ from{ opacity:0; } }
@keyframes l3Up{ from{ opacity:0; transform:translateY(10px); } }
@keyframes l3FromRight{ from{ opacity:0; transform:translateX(28px); } }
@keyframes l3FromLeft{ from{ opacity:0; transform:translateX(-28px); } }
@keyframes l3Msg{ from{ opacity:0; transform:translateY(-4px); } }
@keyframes l3Spin{ to{ transform:rotate(360deg); } }

/* ---------------------------------------------------------------- composants */
.lg3{ position:fixed; inset:0; display:flex; flex-direction:column; overflow:hidden; font-family:var(--l3-font); color:var(--l3-ink); }
.lg3 button, .lg3 input{ font-family:var(--l3-font); }
.lg3-logo{ display:block; height:auto; max-width:100%; }
.lg3 .login-title{ margin:0 0 20px; font:800 28px/1.12 var(--l3-font); letter-spacing:-.03em; color:var(--l3-ink); }
.lg3-sub{ margin:-12px 0 20px; font:500 15px/1.45 var(--l3-font); color:var(--l3-ink-2); }
.login-form{ display:flex; flex-direction:column; align-items:stretch; width:100%; }
.lg3-group{ display:flex; flex-direction:column; gap:16px; margin-bottom:16px; }
.lg3-lrow{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; min-height:20px; margin:0 2px 7px; }
.lg3-lbl{ font:700 13.5px var(--l3-font); color:var(--l3-ink-2); cursor:pointer; }
.field{
  display:flex; align-items:center; width:100%; height:52px; margin:0; padding:0 4px 0 16px; cursor:text;
  background:#fff; border:1px solid var(--l3-line); border-radius:14px;
  transition:border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field:focus-within{ border-color:var(--l3-brand); box-shadow:0 0 0 4px var(--l3-tint); }
.field input{ flex:1; min-width:0; height:100%; padding:0; border:0; outline:0; background:transparent;
  font:550 16px var(--l3-font); color:var(--l3-ink); }   /* 16 px : iOS ne zoome pas sur le champ */
.field input::placeholder{ color:#AEAEB2; font-weight:500; }
/* points du mot de passe : police du système (Safari dessinait des barres avec la police de la marque) */
.field input[type="password"]{ font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; letter-spacing:.08em; }
/* remplissage automatique (trousseau iPhone, Chrome) : pas de rectangle coloré dans la case */
.field input:-webkit-autofill{ -webkit-box-shadow:0 0 0 40px #fff inset; -webkit-text-fill-color:var(--l3-ink); caret-color:var(--l3-ink); }
.field__eye{ display:grid; place-items:center; flex:none; width:44px; height:44px; margin:0; padding:0; border:0; border-radius:10px;
  background:none; color:var(--l3-ink-3); cursor:pointer; }
.field__eye svg{ width:21px; height:21px; }
.field__eye .i-off, .field__eye[aria-pressed="true"] .i-on{ display:none; }
.field__eye[aria-pressed="true"] .i-off{ display:block; }
.field__eye:active{ background:var(--l3-page); }
/* après une erreur, les champs vides ou mal remplis passent en rouge */
form:has(.login-error:not([hidden])) .field:has(input:invalid){ border-color:var(--l3-err); background:#FFFBFB; }

/* interrupteur « se souvenir de cet appareil » (coché d'office par login-page.js) */
.remember-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; min-height:48px; margin:0 0 16px; padding:0 2px; cursor:pointer; }
.remember-row span{ order:-1; font:600 15px/1.3 var(--l3-font); color:var(--l3-ink); }
.remember-row input{ -webkit-appearance:none; appearance:none; position:relative; flex:none; width:46px; height:28px; margin:0;
  border-radius:14px; background:#E5E5EA; cursor:pointer; transition:background-color .2s ease; }
.remember-row input::before{ content:""; position:absolute; top:2px; left:2px; width:24px; height:24px; border-radius:50%;
  background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.25); transition:transform .25s var(--l3-ease); }
.remember-row input:checked{ background:var(--l3-ok); }
.remember-row input:checked::before{ transform:translateX(18px); }
.remember-row input:focus-visible{ outline:0; box-shadow:0 0 0 3px var(--l3-tint); }

/* bouton principal : rouge TreGusto, s'enfonce au toucher, roue pendant l'envoi */
.btn-primary{
  position:relative; display:flex; align-items:center; justify-content:center; width:100%; height:54px; margin:0; padding:0 20px;
  border:0; border-radius:14px; background:var(--l3-brand); color:#fff; font:700 16px var(--l3-font); letter-spacing:-.005em;
  box-shadow:0 1px 2px rgba(92,7,10,.3), 0 10px 20px -10px rgba(163,20,28,.7); cursor:pointer;
  transition:transform .14s var(--l3-ease), background-color .15s ease;
}
.btn-primary:active{ transform:scale(.98); background:var(--l3-brand-2); }
.btn-primary:focus-visible{ outline:0; box-shadow:0 0 0 4px var(--l3-tint), 0 0 0 6px var(--l3-brand); }
.btn-primary.is-loading{ color:transparent; pointer-events:none; }
.btn-primary.is-loading::after{ content:""; position:absolute; width:22px; height:22px; border-radius:50%;
  border:2.5px solid rgba(255,255,255,.35); border-top-color:#fff; animation:l3Spin .7s linear infinite; }
.lg3-btn2{ display:flex; align-items:center; justify-content:center; width:100%; height:52px; margin:0; padding:0 20px;
  border:1px solid var(--l3-line); border-radius:14px; background:#fff; color:var(--l3-brand); font:700 16px var(--l3-font);
  cursor:pointer; transition:transform .14s var(--l3-ease), background-color .15s ease; }
.lg3-btn2:active{ transform:scale(.98); background:var(--l3-tint); }
.lg3-link{ display:inline-flex; align-items:center; margin:-12px -4px; padding:12px 4px; font:700 13.5px var(--l3-font); color:var(--l3-brand);
  text-decoration:none; cursor:pointer; }
.lg3-backbtn{ display:inline-flex; align-items:center; gap:2px; min-height:44px; margin:-10px 0 8px -10px; padding:0 10px 0 4px;
  border-radius:10px; font:700 15.5px var(--l3-font); color:var(--l3-brand); text-decoration:none; }
.lg3-backbtn svg{ width:22px; height:22px; }
.lg3-backbtn:active{ background:var(--l3-tint); }
@media (hover:hover) and (pointer:fine){
  .btn-primary:hover{ background:#B2161F; }
  .lg3-btn2:hover{ background:#FFF7F7; }
  .lg3-link:hover, .lg3-backbtn:hover span{ text-decoration:underline; text-underline-offset:3px; }
}

/* messages : erreur (rouge), succès (vert), lien expiré (ambre) — une icône, une phrase, arrivée en douceur */
.login-error, .login-ok, .link-expired{
  display:flex; align-items:flex-start; gap:10px; margin:0 0 16px; padding:12px 14px; border-radius:12px;
  font:600 14px/1.42 var(--l3-font); animation:l3Msg .28s var(--l3-ease) backwards;
}
:is(.login-error, .login-ok, .link-expired)::before{ content:""; flex:none; width:18px; height:18px; margin-top:1px;
  background:currentColor; -webkit-mask:var(--l3-i) center / contain no-repeat; mask:var(--l3-i) center / contain no-repeat; }
.login-error{ background:var(--l3-err-tint); color:var(--l3-err);
  --l3-i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 7.5v5'/%3E%3Cpath d='M12 16.5h.01'/%3E%3C/svg%3E"); }
.login-ok{ background:var(--l3-ok-tint); color:var(--l3-ok);
  --l3-i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.login-ok a{ margin-left:4px; color:inherit; font-weight:800; }
.link-expired{ background:var(--l3-warn-tint); color:var(--l3-warn);
  --l3-i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6.5V12l3.5 2'/%3E%3C/svg%3E"); }

/* compte concerné par la définition du mot de passe */
.lg3-who{ display:flex; align-items:center; gap:12px; margin:-6px 0 20px; padding:10px 14px 10px 10px; border:1px solid var(--l3-line-2);
  border-radius:14px; background:#fff; font:650 14.5px/1.35 var(--l3-font); color:var(--l3-ink); overflow-wrap:anywhere; }
.lg3-who::before{ content:""; flex:none; width:36px; height:36px; border-radius:50%; background:var(--l3-tint)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A3141C' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4.5'/%3E%3Cpath d='M19.5 20.5a7.5 7.5 0 0 0-15 0'/%3E%3C/svg%3E") center / 20px no-repeat; }
/* repères du nouveau mot de passe : se cochent en vert pendant la saisie */
.lg3-checks{ display:flex; flex-wrap:wrap; gap:6px 18px; margin:-4px 2px 18px; padding:0; list-style:none; }
.lg3-checks li{ display:flex; align-items:center; gap:6px; font:600 13px var(--l3-font); color:var(--l3-ink-3); transition:color .2s ease; }
.lg3-checks li::before{ content:""; width:16px; height:16px; border-radius:50%; border:1.5px solid #C7C7CC;
  background:center / 10px no-repeat; transition:background-color .2s ease, border-color .2s ease; }
.lg3-checks li.is-ok{ color:var(--l3-ok); }
.lg3-checks li.is-ok::before{ border-color:var(--l3-ok); background-color:var(--l3-ok);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }

/* « mot de passe oublié » une fois le lien demandé : l'écran devient une confirmation */
.lg3-sent, .lg3-sent-back{ display:none; }
#panelForgot:has(#forgotOk:not([hidden])) :is(.login-title, .lg3-sub, .lg3-group, #forgotBtn, #forgotError, .lg3-backbtn){ display:none !important; }
#panelForgot:has(#forgotOk:not([hidden])) :is(.lg3-sent, .lg3-sent-back){ display:flex; }
.lg3-sent{ flex-direction:column; align-items:flex-start; gap:16px; margin:0 0 10px; animation:l3Up .32s var(--l3-ease) backwards; }
.lg3-sent__ico{ display:grid; place-items:center; width:56px; height:56px; border-radius:50%; background:var(--l3-ok-tint); color:var(--l3-ok); }
.lg3-sent__ico svg{ width:27px; height:27px; }
.lg3-sent h2{ font:800 26px/1.15 var(--l3-font); letter-spacing:-.03em; color:var(--l3-ink); }
#forgotOk{ display:block; margin:0 0 22px; padding:0; background:none; color:var(--l3-ink-2); font:500 15px/1.5 var(--l3-font); animation:none; }
#forgotOk::before{ display:none; }

/* changement d'écran sur place : « mot de passe oublié » arrive de la droite, le retour de la gauche */
.lg3[data-dir="fwd"] #panelForgot{ animation:l3FromRight .3s var(--l3-ease) backwards; }
.lg3[data-dir="back"] #panelLogin{ animation:l3FromLeft .3s var(--l3-ease) backwards; }
/* cascade d'arrivée, une seule fois, avec le fondu de la page */
html.lg3-on .lg3-intro #panelLogin :is(.login-title, .lg3-field, .remember-row, .btn-primary){
  animation:l3Up .46s var(--l3-ease) backwards; animation-delay:calc(var(--i, 0) * 40ms + 140ms); }
#panelLogin .lg3-field{ --i:1; }
#panelLogin .lg3-field + .lg3-field{ --i:2; }
#panelLogin .remember-row{ --i:3; }
#panelLogin .btn-primary{ --i:4; }

/* ---------------------------------------------------------------- téléphone : bandeau rouge et feuille blanche */
.lg3-brand{
  flex:1 1 auto; min-height:calc(env(safe-area-inset-top, 0px) + 104px); display:grid; place-items:center;
  padding:calc(env(safe-area-inset-top, 0px) + 6px) 24px 34px; container-type:size;
  background:
    linear-gradient(#5c070a env(safe-area-inset-top, 0px), rgb(92 7 10 / 0) calc(env(safe-area-inset-top, 0px) + 90px)),
    linear-gradient(rgb(60 4 8 / .12), rgb(60 4 8 / .12)), #5c070a url('../assets/login-red-mobile.jpg') center / cover no-repeat;
}
.lg3-logo{ width:min(250px, 66vw); width:min(250px, 68cqw, 128cqh); filter:drop-shadow(0 2px 10px rgb(0 0 0 / .2)); }
.lg3-stage{
  position:relative; flex:none; margin-top:-28px; padding:30px 24px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height:calc(100% - env(safe-area-inset-top, 0px) - 76px); overflow-y:auto; overscroll-behavior:none; touch-action:pan-y;
  background:#fff; border-radius:28px 28px 0 0; box-shadow:0 -12px 32px -16px rgb(40 0 0 / .45);
}
html.lg3-on .lg3-intro .lg3-stage{ animation:l3Up .5s var(--l3-ease) backwards; }

/* tablette debout : bandeau en haut, carte centrée qui le chevauche */
@media (min-width:768px) and (max-width:1023.5px) and (orientation:portrait){
  body{ background:var(--l3-page); }
  .lg3{ display:block; overflow-y:auto; background:var(--l3-page); }
  .lg3-brand{ position:absolute; inset:0 0 auto; height:max(320px, 40vh); min-height:0; display:flex; justify-content:center;
    align-items:flex-start; padding:max(56px, 9vh) 24px 0; container-type:normal; }
  .lg3-logo{ width:300px; }
  .lg3-stage{ width:min(480px, calc(100% - 48px)); max-height:none; overflow:visible; margin:calc(max(320px, 40vh) - 120px) auto 48px;
    padding:36px 40px 32px; border:1px solid var(--l3-card-line); border-radius:24px;
    box-shadow:0 1px 2px rgba(0,0,0,.05), 0 30px 60px -28px rgb(60 0 0 / .42); }
  .lg3 .login-title{ font-size:30px; }
}
/* ordinateur, tablette ou téléphone à l'horizontale : carrelage et logo à gauche, formulaire à droite */
@media (min-width:1024px), (min-width:640px) and (orientation:landscape){
  .lg3{ display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); background:#fff; }
  .lg3-brand{ min-height:0; padding:48px; background:var(--l3-tiles); container-type:normal; }
  .lg3-logo{ width:min(380px, 72%); }
  .lg3-stage{ display:flex; flex-direction:column; margin:0; max-height:none; min-height:0; overflow-y:auto;
    padding:40px 48px calc(32px + env(safe-area-inset-bottom, 0px)); border-radius:0; box-shadow:none; }
  .lg3-stage > section{ width:100%; max-width:400px; margin:auto; }   /* centré, sans jamais couper le haut */
  .lg3 .login-title{ font-size:36px; margin-bottom:28px; }
  html.lg3-on .lg3-intro .lg3-stage{ animation:l3Fade .4s ease-out backwards; }
}
@media (orientation:landscape) and (max-height:520px){
  .lg3-stage{ padding:20px 28px calc(16px + env(safe-area-inset-bottom, 0px)) 28px; padding-right:max(28px, env(safe-area-inset-right, 0px)); }
  .lg3-brand{ padding:24px; padding-left:max(24px, env(safe-area-inset-left, 0px)); }
  .lg3-logo{ width:min(240px, 70%); }
  .lg3 .login-title{ font-size:26px; margin-bottom:16px; }
}

@media (prefers-reduced-motion:reduce){
  .lg3 *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
