/* ============================================================================
   PartirTranquille — AUTHENTIFICATION (connexion + inscription)
   FEUILLE DE STYLE PRODUCTION AUTONOME — source unique, à intégrer telle quelle.
   ----------------------------------------------------------------------------
   Kit INDÉPENDANT, dédié aux pages publiques /login et /inscription.
   Ne dépend PAS de export/refonte.css (le kit de l'espace membre). Self-contained :
   tokens + base + composants partagés nécessaires + section AUTH.
   Si l'intégration veut mutualiser avec refonte.css, retirer les §1–§3 d'ici et
   ne garder que §4 (les classes .auth-* y sont isolées).

   Direction A1 « Empilé ». Tokens --vt-*. Pas de Bootstrap brut.
   RÈGLES DE STABILITÉ : hooks = CLASSES (jamais :nth-child) ; responsive = media
   query réelle (≤768px) ; aucune dépendance JS pour le rendu.
   ============================================================================ */

/* ============================================================================
   1. TOKENS
   ============================================================================ */
:root {
  /* Fonts remapped to project-served families (spec §3 / review H2): Fraunces is
     self-hosted (site.css @font-face); no Google Fonts link is added. */
  --font-display: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --vt-forest-900: #1a2e26;
  --vt-forest-800: #233f33;
  --vt-forest-700: #2e5142;
  --vt-forest-600: #3e6655;
  --vt-forest-500: #5a8270;
  --vt-forest-300: #a8c0b3;
  --vt-forest-100: #d9e3dc;
  --vt-forest-50:  #ecf1ed;

  --vt-terra-700: #a8401f;
  --vt-terra-600: #c25a35;
  --vt-terra-500: #d97757;
  --vt-terra-300: #ecbba8;
  --vt-terra-100: #f7e1d6;
  --vt-terra-50:  #fbeee5;

  --vt-cream:   #f9f5ec;
  --vt-paper-2: #f7f3ea;

  --vt-ink:     #1f1d1a;
  --vt-text:    #2a2823;
  --vt-muted:   #6b6359;
  --vt-muted-2: #948b7e;
  --vt-line:    #e2d9c8;
  --vt-line-2:  #ece3d2;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px;

  --r-1: 4px; --r-2: 8px; --r-3: 12px; --r-4: 18px; --r-full: 999px;

  --t-body: 16px;

  --accent: var(--vt-forest-800);
  --accent-hover: var(--vt-forest-900);
  --accent-ink: #fff;
  --accent-soft-bg: var(--vt-forest-50);

  --surface-page: var(--vt-cream);
  --surface-card: #ffffff;
}

/* ============================================================================
   2. BASE
   ============================================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  color: var(--vt-text);
  background: var(--surface-page);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--font-display); color: var(--vt-ink); line-height: 1.1; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ============================================================================
   3. COMPOSANTS PARTAGÉS (sous-ensemble nécessaire à l'auth)
   Mêmes définitions que refonte.css — conservées identiques pour parité visuelle.
   ============================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 14px; border: 1px solid var(--accent);
  cursor: pointer; transition: transform .08s ease, background .15s ease; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn:focus-visible { color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn.lg { padding: 14px 22px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.input {
  width: 100%; background: var(--surface-card);
  border: 1px solid var(--vt-line); border-radius: var(--r-2);
  padding: 11px 14px; font-size: 1rem; /* >=16px : empêche le zoom-au-focus iOS qui ne se dézoome pas */ color: var(--vt-text);
  outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus { border-color: var(--vt-forest-700); box-shadow: 0 0 0 3px var(--vt-forest-100); }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--vt-muted); margin-bottom: 6px; letter-spacing: 0.01em; }

/* Placeholder d'image (volet confiance) — purement décoratif ici */
.photo {
  width: 100%; aspect-ratio: 4/3; border-radius: var(--r-3);
  background:
    repeating-linear-gradient(135deg, rgba(31,29,26,.05) 0 1px, transparent 1px 16px),
    linear-gradient(180deg, var(--vt-forest-100), var(--vt-forest-50));
  position: relative; overflow: hidden;
}

/* ============================================================================
   4. AUTHENTIFICATION (.auth-*) — section isolée, portable
       Layout split : volet formulaire (gauche) + volet confiance forest (droite).
       Responsive ≤768px : 1 colonne, volet droit masqué, logo du formulaire affiché.
   ============================================================================ */
.auth-frame { min-height: 100vh; background: var(--surface-page); color: var(--vt-text); }
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }

/* ----- Volet formulaire ----- */
.auth-pane {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: clamp(28px, 5vh, 64px) clamp(20px, 5vw, 56px);
  background: var(--surface-page);
}
.auth-card { width: 100%; max-width: 400px; }
.auth-back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: var(--s-6);
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 13.5px; color: var(--vt-muted); text-decoration: none;
}
.auth-back:hover { color: var(--vt-forest-800); }
.auth-back .ic { width: 15px; height: 15px; }

/* Logo du volet formulaire : visible en ≤768px seulement (le volet droit le porte en desktop) */
.auth-form-logo { height: 30px; width: auto; display: none; margin-bottom: var(--s-7); }

.auth-head { margin-bottom: var(--s-6); }
.auth-head h1 {
  font-family: var(--font-display); font-size: 34px; font-weight: 500;
  color: var(--vt-ink); letter-spacing: -0.015em; line-height: 1.05; margin: 0;
}
.auth-head p { margin: 8px 0 0; font-size: 15px; color: var(--vt-muted); line-height: 1.5; }

/* Connexion sociale */
.auth-social {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px; border: 1px solid var(--vt-line); border-radius: var(--r-2);
  background: var(--surface-card); font-family: var(--font-ui);
  font-size: 14.5px; font-weight: 600; color: var(--vt-text); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.auth-social:hover { border-color: var(--vt-forest-300); background: var(--vt-paper-2); }
.auth-fb-mark { display: grid; place-items: center; }
.auth-fb-mark svg { width: 16px; height: 16px; display: block; }

.auth-or {
  display: flex; align-items: center; gap: 14px; margin: var(--s-5) 0;
  color: var(--vt-muted-2); font-size: 12px; letter-spacing: 0.04em;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--vt-line-2); }

/* Champs */
.auth-form { display: flex; flex-direction: column; gap: var(--s-5); }
.auth-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.auth-field { display: block; }
.auth-input-wrap { position: relative; }
.auth-input-wrap.has-icon .input { padding-left: 40px; }
.auth-input-wrap .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--vt-muted-2); display: grid; place-items: center; pointer-events: none;
}
.auth-input-wrap .ico .ic { width: 16px; height: 16px; }
.auth-input-wrap .input { padding-top: 12px; padding-bottom: 12px; }
.auth-reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer; font-family: var(--font-ui);
  font-size: 12.5px; font-weight: 600; color: var(--vt-forest-700); padding: 6px 8px; border-radius: var(--r-1);
}
.auth-reveal:hover { background: var(--vt-forest-50); }
.auth-hint { margin: 6px 0 0; font-size: 12px; color: var(--vt-muted); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -2px; }
.auth-link { font-size: 13px; font-weight: 600; color: var(--vt-forest-800); cursor: pointer; text-decoration: none; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Case à cocher (état porté par l'input natif :checked) */
.auth-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--vt-text); line-height: 1.45; cursor: pointer; }
.auth-box {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px;
  border: 1.5px solid var(--vt-line); border-radius: 6px; background: var(--surface-card);
  cursor: pointer; display: grid; place-items: center; color: #fff;
  transition: background .12s ease, border-color .12s ease;
}
.auth-box .ic { width: 13px; height: 13px; opacity: 0; }
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check input:checked + .auth-box { background: var(--vt-forest-700); border-color: var(--vt-forest-700); }
.auth-check input:checked + .auth-box .ic { opacity: 1; }

.auth-submit { width: 100%; margin-top: var(--s-2); }
.auth-switch { margin: var(--s-6) 0 0; font-size: 14px; color: var(--vt-muted); text-align: center; }
.auth-switch a { color: var(--vt-forest-800); font-weight: 600; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ----- Volet confiance (forest, desktop) ----- */
.auth-aside { position: relative; overflow: hidden; background: var(--vt-forest-900); color: #fff; display: flex; }
.auth-aside-photo { position: absolute; inset: 0; opacity: 0.16; }
.auth-aside-photo .photo { width: 100%; height: 100%; border-radius: 0; aspect-ratio: auto; }
.auth-aside::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(26,46,38,.72), rgba(26,46,38,.94)); }
.auth-aside-inner {
  position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%;
  padding: clamp(40px, 6vh, 72px) clamp(36px, 4vw, 72px);
}
.auth-aside-logo { height: 34px; width: auto; align-self: flex-start; }
.auth-aside-mid { margin-top: auto; padding: var(--s-8) 0; }
.auth-aside-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--vt-terra-300); }
.auth-aside-h {
  margin: 16px 0 0; font-family: var(--font-display); font-size: clamp(28px, 3vw, 40px);
  font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; color: #fff; max-width: 16ch;
}
.auth-aside-h em { color: var(--vt-terra-300); font-style: italic; }
.auth-trust {
  list-style: none; margin: 0; padding: var(--s-6) 0 0; border-top: 1px solid rgba(255,255,255,.14);
  display: flex; flex-direction: column; gap: var(--s-5);
}
.auth-trust li { display: flex; gap: 14px; align-items: flex-start; }
.auth-trust li .ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; }
.auth-trust li .ico .ic { width: 18px; height: 18px; }
.auth-trust li .tx { display: flex; flex-direction: column; gap: 3px; }
.auth-trust li .tx b { font-size: 14.5px; font-weight: 600; color: #fff; }
.auth-trust li .tx em { font-size: 13px; font-style: normal; color: rgba(255,255,255,.72); line-height: 1.45; }

/* Repli mobile : 1 colonne, volet droit masqué, logo formulaire visible */
@media (max-width: 768px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-form-logo { display: block; }
  .auth-grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================================
   5. COMPAT — Font Awesome webfont glyphs replace the kit's SVG .ic sprites.
   A webfont <i> is sized by font-size (the kit's width/height on .ic do not
   size it), so re-express the per-context glyph sizes + the checkbox tick
   opacity toggle for <i> glyphs.
   ============================================================================ */
.auth-back i { font-size: 15px; }
.auth-input-wrap .ico i { font-size: 16px; }
.auth-reveal i { font-size: 15px; }
.auth-box i { font-size: 13px; line-height: 1; opacity: 0; }
.auth-check input:checked + .auth-box i { opacity: 1; }
.auth-trust li .ico i { font-size: 18px; }

/* ============================================================================
   6. 2FA — défi de vérification (carte centrée unique, hors layout split)
   ============================================================================ */
.auth-2fa { text-align: center; }
.auth-2fa-logo { display: block; height: 30px; width: auto; margin: 0 auto var(--s-7); }
.auth-2fa-badge {
  width: 56px; height: 56px; margin: 0 auto var(--s-5);
  border-radius: 50%; display: grid; place-items: center;
  background: var(--vt-forest-50); color: var(--vt-forest-800);
}
.auth-2fa-badge i { font-size: 22px; }
.auth-2fa-head { text-align: center; margin-bottom: var(--s-5); }
.auth-2fa-head h1 { font-size: 26px; }
.auth-2fa-head p { font-size: 14.5px; }

/* Champ code : centré, monospace, généreusement espacé */
.auth-code {
  text-align: center; font-family: var(--font-mono);
  font-size: 22px; letter-spacing: 0.3em;
  padding-top: 14px; padding-bottom: 14px;
}
.auth-code::placeholder { letter-spacing: 0.3em; color: var(--vt-muted-2); }

.auth-2fa-logout {
  display: block; text-align: center; margin-top: var(--s-4);
  font-size: 13px; color: var(--vt-muted); text-decoration: none;
}
.auth-2fa-logout:hover { color: var(--vt-forest-800); text-decoration: underline; text-underline-offset: 2px; }

/* Repli « code de secours » */
.auth-backup { margin-top: var(--s-6); text-align: left; }
.auth-backup summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--vt-forest-800);
  list-style: none;
}
.auth-backup summary::-webkit-details-marker { display: none; }
.auth-backup p { margin: var(--s-3) 0 0; font-size: 12.5px; color: var(--vt-muted); line-height: 1.5; }
