/* ==========================================================================
   Connexion et inscription : composants propres à ces deux pages.
   Chargé APRÈS css/socle.css. Jetons du socle uniquement, aucune valeur de couleur en dur
   (sauf le texte posé sur la photo, qui reste clair dans les deux thèmes).
   ========================================================================== */

/* ---------- Mise en page : colonne formulaire + colonne photo ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; padding-top: var(--top-h);
  background: linear-gradient(180deg, var(--dawn) 0%, var(--paper) 360px); }
.auth-main { display: flex; justify-content: center; align-items: flex-start;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 5vw, 88px) clamp(48px, 7vw, 96px); }
.auth-col { width: 100%; max-width: 480px; }
/* Titre lisible d'abord (retour de Louis, 2026-10-22) : l'ancien serif fin en italique
   (Fraunces 300) se lisait mal, surtout sur téléphone. */
.auth-title { font: 700 clamp(30px, 3vw, 42px)/1.15 var(--sans); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.auth-title em { font-style: normal; color: var(--violet); }
.auth-sub { margin-top: 14px; font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-2); }
.auth .form { max-width: none; margin-top: var(--sp-6); gap: 20px; }
.auth .input { min-height: 52px; font-size: 17px; }
.auth .btn-block { min-height: 54px; font-size: 17px; }
.auth-or { display: flex; align-items: center; gap: 14px; margin: var(--sp-5) 0 0; font: 500 13px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--stone); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.auth-switch { margin-top: var(--sp-5); font-size: 16px; color: var(--ink-2); }
.auth-switch a, .auth-link { color: var(--violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-switch a:hover, .auth-link:hover { text-decoration-thickness: 2px; }
.auth-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.auth-fine { margin-top: var(--sp-4); font-size: 14px; line-height: 1.55; color: var(--stone); }
.auth-fine a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.auth :is(a, button, input, summary):focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
.auth .input:focus-visible { outline: 2px solid transparent; outline-offset: 0; } /* l'anneau du socle (box-shadow) prend le relais */

/* ---------- Colonne visuelle (disparaît sous 900 px) ---------- */
.auth-visual { position: relative; padding: 0 var(--sp-5) var(--sp-5) 0; }
.auth-photo { position: sticky; top: calc(var(--top-h) + 0px); height: calc(100vh - var(--top-h) - var(--sp-5)); min-height: 520px; margin: 0;
  border-radius: var(--radius-l); overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow-soft); isolation: isolate; }
.auth-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 68% 50%; }
.auth-photo::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(20,14,10,0) 18%, rgba(20,14,10,.62) 48%, rgba(20,14,10,.9) 100%); }
:root:not([data-theme="light"]) .auth-photo img { filter: brightness(.86); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .auth-photo img { filter: none; } }
:root[data-theme="dark"] .auth-photo img { filter: brightness(.86); }
.auth-caption { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: clamp(24px, 3vw, 44px); color: #FBF5EA; }
.auth-caption h2 { font: 300 clamp(26px, 2.4vw, 36px)/1.14 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.auth-caption h2 em { font-style: italic; color: #D9CFFF; }
.auth-caption ul { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; max-width: 34em; }
.auth-caption li { font-size: 15.5px; line-height: 1.45; color: rgba(251,245,234,.92); }
.auth-caption li b { display: block; font-weight: 600; color: #FBF5EA; }

/* ---------- Champs : icône, mot de passe, adresse avec sous-domaine ---------- */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 56px; }
.pwd-toggle { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); cursor: pointer; }
.pwd-toggle:hover { background: var(--violet-tint); color: var(--ink); }
.pwd-toggle .eye-off { display: none; }
.pwd-toggle[aria-pressed="true"] .eye { display: none; }
.pwd-toggle[aria-pressed="true"] .eye-off { display: block; }
.domain { display: flex; align-items: stretch; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--card); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.domain:hover { border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.domain:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-tint); }
.domain.is-invalid { border-color: var(--bad); }
.domain.is-invalid:focus-within { box-shadow: 0 0 0 4px var(--bad-tint); }
.domain .input { border: 0; border-radius: 12px 0 0 12px; box-shadow: none; min-width: 0; flex: 1; background: transparent; }
.domain .input:focus { box-shadow: none; }
.domain-suffix { display: flex; align-items: center; padding: 0 14px; font: 500 15px/1 var(--mono); color: var(--ink-2); background: var(--paper-2); border-left: 1px solid var(--line-2); border-radius: 0 10px 10px 0; white-space: nowrap; }
.preview b { color: var(--ink); font-weight: 600; word-break: break-all; }
.auth .check a { color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }
.auth .check input[aria-invalid="true"] { outline: 2px solid var(--bad); outline-offset: 2px; }
.field > .error { margin-top: 1px; }

/* ---------- Boutons annexes ---------- */
.btn-oauth { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 54px; margin-top: var(--sp-6); padding: 0 20px; position: relative;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink); font: 600 16.5px/1 var(--sans); text-decoration: none; transition: border-color var(--dur-1), background-color var(--dur-1); }
.btn-oauth:hover { border-color: var(--ink); }
.btn-oauth svg { width: 20px; height: 20px; flex: none; }
.btn-oauth.is-off { opacity: .8; }
.btn-oauth.is-off::after { content: "Bientôt"; position: absolute; right: 16px; font: 500 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--stone); }
.btn[aria-busy="true"] { opacity: .75; cursor: progress; }

/* ---------- Messages d'état (zone annoncée aux lecteurs d'écran) ---------- */
.auth-status { margin-top: var(--sp-5); max-width: none; }
.auth-status b { display: block; margin-bottom: 2px; }
.auth-status .choix { display: grid; gap: 8px; margin-top: 12px; }
.auth-status .choix button { min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink); font: 600 16px/1.3 var(--sans); text-align: left; cursor: pointer; }
.auth-status .choix button:hover { border-color: var(--violet); }
.auth-status a { color: var(--violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Inscription : étapes, code, création, fin ---------- */
.stepper { list-style: none; display: flex; flex-wrap: nowrap; gap: 10px;  margin: 0 0 var(--sp-5); padding: 0; counter-reset: s; }
.stepper li { flex: 0 1 auto; display: flex; align-items: center; gap: 10px; font: 500 13px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--stone); min-width: 0; }
.stepper li + li::before { content: ""; flex: none; width: 14px; height: 1px; background: var(--line-2); margin-right: 2px; }
.stepper .dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-2); font: 600 13px/1 var(--sans); color: var(--ink-2); background: var(--card); }
.stepper .is-active { color: var(--ink); }
.stepper .is-active .dot { background: var(--violet); border-color: var(--violet); color: var(--card); }
.stepper .is-done .dot { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
.stepper .txt { overflow: hidden; white-space: nowrap; }
.otp { position: relative; max-width: 380px; margin-top: var(--sp-5); }
.otp-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: text; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; pointer-events: none; }
.otp-boxes span { height: 60px; display: grid; place-items: center; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--card); font: 500 26px/1 var(--mono); color: var(--ink); }
.otp-boxes span.is-filled { border-color: var(--ink-2); }
.otp:focus-within .otp-boxes span.is-current { border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-tint); }
.otp.is-error .otp-boxes span { border-color: var(--bad); }
.code-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: var(--sp-4); }
.code-info b { color: var(--ink); }
.prov { margin-top: var(--sp-6); padding: clamp(20px, 3vw, 28px); border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.prov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 600; color: var(--ink); }
.prov-pct { font: 500 15px/1 var(--mono); color: var(--violet); }
.progress { height: 10px; margin-top: 14px; border-radius: var(--radius-pill); background: var(--paper-2); overflow: hidden; }
.progress-fill { height: 100%; width: 3%; border-radius: inherit; background: var(--violet); transition: width var(--dur-3) var(--ease); }
.prov-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font: 500 13px/1.3 var(--mono); color: var(--stone); }
.prov-detail { margin-top: 14px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.phases { list-style: none; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.phases li { position: relative; padding-left: 30px; font-size: 15px; color: var(--stone); }
.phases li::before { content: ""; position: absolute; left: 3px; top: .22em; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.phases .is-done { color: var(--ink); }
.phases .is-done::before { background: var(--ok); border-color: var(--ok); }
.phases .is-done::after { content: ""; position: absolute; left: 8px; top: calc(.22em + 2px); width: 4px; height: 8px; border: solid var(--card); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.phases .is-active { color: var(--ink); font-weight: 600; }
.phases .is-active::before { border-color: var(--violet); background: var(--violet-tint); }
.credentials { margin: var(--sp-6) 0 0; padding: 4px 0; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.credentials div { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 20px; }
.credentials div + div { border-top: 1px solid var(--line); }
.credentials dt { color: var(--stone); font-size: 15px; }
.credentials dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; word-break: break-all; }
.credentials dd a { color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }
.auth [hidden] { display: none !important; }

/* ---------- Tablette et mobile : la photo disparaît ---------- */
@media (max-width: 899px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .auth-main { padding-top: clamp(24px, 6vw, 48px); }
}
@media (max-width: 480px) {
  .stepper .txt { display: none; }
  .stepper li.is-active .txt { display: block; }
  .stepper li + li::before { display: none; }
  .stepper li.is-active { flex: 1 1 auto; }
  .stepper .txt { letter-spacing: .02em; }
  .prov-meta { flex-direction: column; gap: 4px; }
  .domain-suffix { padding: 0 10px; font-size: 14px; }
  .otp-boxes { gap: 6px; }
  .otp-boxes span { height: 54px; }
}
@media (prefers-reduced-motion: reduce) { .progress-fill, .btn-oauth { transition: none; } }

/* ---------- Intégration : classes posées par les scripts de /login et /signup ----------
   Les scripts de production écrivent dans .kk-status (classes show + error | info | success),
   affichent les étapes par .show et marquent les boutons indisponibles par kk-oauth-disabled
   ou kk-disabled. Mêmes rendus que .note / .note-bad / .note-info / .note-ok du socle. */
.kk-status { display: none; }
.kk-status.show { display: block; margin-top: var(--sp-5); padding: 16px 20px; border-radius: 14px; background: var(--warn-tint); color: var(--ink); line-height: 1.5; }
.kk-status.show b { font-weight: 600; }
.kk-status.show small { display: block; margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.kk-status.info { background: var(--violet-tint); }
.kk-status.success { background: var(--ok-tint); }
.kk-status.error { background: var(--bad-tint); box-shadow: inset 3px 0 0 var(--bad); }
.kk-status a { color: var(--violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.kk-status .kk-choix-btn { min-height: 48px; font-weight: 600 !important; }
.kk-status .kk-choix-btn:hover { border-color: var(--violet) !important; }
.btn-oauth.kk-oauth-disabled { opacity: .8; }
.btn-oauth.kk-oauth-disabled::after { content: "Bientôt"; position: absolute; right: 16px; font: 500 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--stone); }
.kk-code-step:not(.show), .kk-prov:not(.show) { display: none; }
.prov-detail small { display: block; margin-top: 6px; font-size: 14px; color: var(--stone); }
.auth-link.kk-disabled { opacity: .55; pointer-events: none; text-decoration: none; }
.btn[data-busy] { opacity: .75; cursor: progress; }
.motion .kk-enter { animation: kk-entree var(--dur-2, .32s) var(--ease, ease-out); }
@keyframes kk-entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.motion .otp.is-error .otp-boxes { animation: kk-secousse .4s ease; }
@keyframes kk-secousse { 20%, 80% { transform: translateX(3px); } 40%, 60% { transform: translateX(-5px); } }
/* App iPhone (script de /login) : pas de colonne de présentation. */
.auth:not(.has-aside) { grid-template-columns: minmax(0, 1fr); }
.auth:not(.has-aside) .auth-visual { display: none; }
.kk-app .auth { padding-top: env(safe-area-inset-top, 0px); min-height: 100svh; }
