/* ── Targa'micale · l'écran de connexion ─────────────────────────────────────
   wp-login.php, brought onto the brand.

   Why this surface and not a template of our own: every screen the club has
   added to the login flow — le lien par courriel and its confirmation, the
   enrolment TOTP, les codes de secours, la demande de code, le bouton clé
   d'accès — is drawn through login_header() / login_footer(), as are
   WordPress's own « mot de passe oublié » and « réinitialiser ». Styling here
   brings all eight onto the brand at once. A bespoke page would have dressed
   one and left seven looking like stock WordPress.

   Everything is tokens. The plugin's own blocks on this page read the same
   custom properties, with hard-coded fallbacks, so switching the theme off
   leaves them plain rather than broken.
   ────────────────────────────────────────────────────────────────────────── */

body.login {
  background: var(--paper-100);
  color: var(--ink-700);
  font-family: var(--font-body);
  /* WordPress centres by padding the body; the card is placed properly instead. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  margin: 0;
}

/* La colonne : la carte, et rien d'autre. « Pas encore membre ? » et le
   sélecteur de langue de WordPress sont partis — voir `inc/login.php` — donc il
   n'y a plus d'ordre à rétablir. */
body.login #login { width: 100%; max-width: 25rem; padding: 0; margin: 0; }

/* ── The navy band, and the logo standing on it ───────────────────────────── */

/* WordPress's h1 holds the W logo as a background image on an anchor. Both are
   replaced: the mark becomes the club's, and the heading becomes the band. */
body.login h1.wp-login-logo,
body.login #login h1 {
  background: var(--navy-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin: 0;
  padding: 26px 30px;
  /* Flex, not text-align: an inline-flex anchor sits on a text baseline and
     carries a descender's worth of navy under it that no padding explains. */
  display: flex;
  justify-content: center;
  line-height: 0;
}

body.login #login h1 a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  /* The logo sits on a paper chip, as the design kit draws it: the mark is
     navy and gold, and neither reads on a navy ground. */
  padding: 12px 18px;
  background: var(--paper-0);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  background-image: none;
  text-indent: 0;
  overflow: visible;
  font-size: 0;
  line-height: 0;
  /* WordPress pose `margin: 0 auto 25px` sur ce lien : sans ce zéro le bandeau
     portait 24 px de plus sous le cadre qu'au-dessus, et le logo paraissait
     collé en haut. Trouvé 2026-09-27. */
  margin: 0;
}

/* Un logo clair se pose sans pastille, comme dans le tiroir. */
body.login.tgc-login-logo-bare #login h1 a {
  padding: 0;
  background: none;
  box-shadow: none;
}

body.login #login h1 a::after {
  content: '';
  display: block;
  /* The mark is all but square (1500 × 1302), so it is sized on its height
     rather than given a wordmark's letterbox. */
  width: 84px;
  height: 73px;
  background: var(--tgc-login-logo) center / contain no-repeat;
}

/* When the welcome follows, the band is one block and the mark should sit
   closer to its line than to the card below. Without a welcome the padding
   stays even, which is why this is a :has() and not a smaller default. */
body.login #login h1:has(+ .tgc-login-welcome) { padding-bottom: 16px; }

/* « Bienvenue à bord ». Printed by the theme into the band, so it belongs to
   the navy rather than floating above the fields. */
body.login .tgc-login-welcome {
  background: var(--navy-800);
  margin: 0;
  padding: 0 30px 24px;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--navy-200);
}

/* ── The card ─────────────────────────────────────────────────────────────── */

/* `#login > form` and not `form`: the club's own screens put a form *inside*
   their block, and carding every form on the page drew a second white box with
   its own shadow around the one button in it. */
body.login #login > form,
body.login #login > .tgc-2fa {
  background: var(--surface-card, var(--paper-0));
  border: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin: 0 0 20px;
  padding: 26px 30px 30px;
}

/* Anything nested inside is part of that card, not another one. */
body.login .tgc-2fa form {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

/* A message or an error takes the top of the card, so the band stays whole. */
body.login #login .message,
body.login #login .success,
body.login #login #login_error {
  background: var(--paper-50);
  border: 0;
  border-left: 3px solid var(--navy-600);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 14px 30px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-700);
}

body.login #login #login_error {
  border-left-color: var(--gold-500);
  background: var(--gold-100);
  color: var(--navy-800);
}

/* **Le lien est parti : en vert** (2026-10-20, A-FAIRE 27, « mettre un fond
   couleur verte, plus visible »). C'est la réponse au geste qu'on vient de
   faire, et elle se lisait du même gris que n'importe quel avis. Les jetons
   d'état du club : le lavis vert et son encre 700 (5,36:1), le filet en 600. */
body.login #login .tgc-login-sent {
  border-left-color: var(--green-600);
  background: var(--status-success-bg);
  color: var(--status-success-fg);
}

/* The band, any notice and the card are one stack: no gaps between them, or a
   notice reads as a slab floating above a separate card. The maintenance
   band is one of them (2026-10-23, A-FAIRE 34): it sat 20px above the card. */
body.login #login .message + form,
body.login #login .message + .tgc-2fa,
body.login #login .success + form,
body.login #login #login_error + form,
body.login #login #login_error + .tgc-2fa,
body.login #login .tgc-login-notice + form,
body.login #login .tgc-login-notice + .tgc-2fa {
  margin-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Fields ───────────────────────────────────────────────────────────────── */

body.login label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-500);
}

body.login input[type='text'],
body.login input[type='email'],
body.login input[type='password'],
body.login input[type='tel'] {
  width: 100%;
  padding: 11px 13px;
  background: var(--paper-0);
  border: 1px solid var(--paper-300);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-900);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

body.login input[type='text']:focus,
body.login input[type='email']:focus,
body.login input[type='password']:focus,
body.login input[type='tel']:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px var(--navy-100);
  /* Transparent, jamais `none` : le trait du système en couleurs forcées
     (2026-11-04, audit SUITE-FRONT-003 et TH-FRONT-001, lot 7b). */
  outline: 2px solid transparent;
}

/* Voir la règle du thème : un texte indicatif se lit. */
body.login input::placeholder { color: var(--ink-500); }

body.login .login .password-input-wrapper { display: block; }

/* Inside the field, not beside it: it is a control on the input, and a box of
   its own reads as a second button competing with the one below. */
body.login .wp-hide-pw {
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--ink-500);
  right: 2px;
  height: 100%;
}

body.login .wp-hide-pw:hover,
body.login .wp-hide-pw:focus { color: var(--navy-700); }

/* `#login` in the selector, not for tidiness: WordPress styles these as
   `#login form p`, and an id beats any number of classes. Without it the
   paragraph margins here compute to zero and every field touches the next. */
body.login #login .forgetmenot { margin: 18px 0 0; }

body.login .forgetmenot label {
  display: inline-block;
  margin: 0 0 0 6px;
  font-size: 0.85rem;
  color: var(--ink-500);
}

/* Fields need air between them; WordPress relies on its own <p> margins and
   the card's padding, both of which have been replaced. */
body.login #login form > p { margin: 0 0 18px; }
body.login #login form > p:last-child { margin-bottom: 0; }

body.login input[type='checkbox'] {
  border: 1px solid var(--paper-400);
  border-radius: var(--radius-xs);
  background: var(--paper-0);
  width: 17px;
  height: 17px;
}

body.login input[type='checkbox']:checked {
  background: var(--navy-800);
  border-color: var(--navy-800);
}

body.login input[type='checkbox']:checked::before {
  content: '';
  display: block;
  margin: 3px 0 0 1px;
  width: 12px;
  height: 12px;
  background: none;
  border-right: 2px solid var(--paper-0);
  border-bottom: 2px solid var(--paper-0);
  transform: rotate(45deg) scale(0.62);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

/* **The club's button, on WordPress's screen** (2026-10-23, A-FAIRE 34): the
   pill of the landing, `md`, with the `--btn-*` tokens. Its size used to be
   WordPress's: `.wp-core-ui .button.button-large` (0,3,0), in
   load-styles.php, set the padding, the line-height and a 40px floor, again
   under 782px with 14px and a 4px margin, and this sheet's (0,2,1) never
   won. `body.login .button:not(.wp-hide-pw)` weighs (0,3,1), so the club's
   measures hold at every width without `!important`. **Every `.button` of
   these screens**, not only the large ones: the second factor's « Copier les
   dix codes » is a bare `.button`, and kept WordPress's 40px square. The
   eye of a password field is an icon, never a pill. */
body.login .button:not(.wp-hide-pw) {
  box-sizing: border-box;
  min-height: var(--btn-h);
  margin: 0;
  padding: var(--btn-py) var(--btn-px);
  border: 0;
  border-radius: var(--btn-radius);
  font-family: var(--font-body);
  font-size: var(--btn-fs);
  font-weight: var(--btn-fw);
  line-height: var(--btn-lh);
  text-shadow: none;
  white-space: nowrap;
  transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

/* Gold is the single accent, so exactly one button carries it: the highest
   intent on whatever screen this is. Everything else is an outline. Navy on
   gold: gold does not carry white text at this size. **The hover lightens**
   (gold-400, 7.4:1 under navy), as on every gold button of the club. */
body.login .button.button-primary {
  width: 100%;
  float: none;
  display: block;
  background: var(--gold-500);
  color: var(--navy-800);
  box-shadow: none;
}

/* WordPress paints its own blue on :focus (0,3,0) and a ring of its colour:
   the club's ring is the outline below, on the keyboard only. */
body.login .button.button-primary:focus {
  background: var(--gold-500);
  color: var(--navy-800);
  box-shadow: none;
}

body.login .button.button-primary:hover {
  background: var(--accent-bg-hover);
  color: var(--navy-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

body.login .button.button-primary:active {
  background: var(--accent-bg-active);
  transform: none;
  box-shadow: none;
}

body.login #login .submit,
body.login #login p.submit { margin: 18px 0 0; padding: 0; }

/* The passkey button: the outline, a navy ring inside the pill rather than a
   border, so it is the height of the gold one above it. */
body.login .button:not(.button-primary):not(.wp-hide-pw) {
  background: var(--paper-0);
  border: 0;
  box-shadow: inset 0 0 0 var(--btn-ring-w) var(--btn-ring-c);
  color: var(--navy-800);
}

body.login .button:not(.button-primary):not(.wp-hide-pw):focus {
  background: var(--paper-0);
  color: var(--navy-800);
  box-shadow: inset 0 0 0 var(--btn-ring-w) var(--btn-ring-c);
}

body.login .button:not(.button-primary):not(.wp-hide-pw):hover {
  background: var(--navy-50);
  color: var(--navy-800);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 var(--btn-ring-w) var(--btn-ring-c), var(--shadow-sm);
}

/* The copy button of the recovery codes keeps the space its screen asks
   under it, which the measure above would otherwise take back to 0. */
body.login .tgc-2fa .button.tgc-2fa__copy { margin-bottom: 16px; }

/* The keyboard's ring, the theme's: WordPress sets a transparent 1px outline
   on :focus, which `:focus-visible` (one more class) replaces. */
body.login .button:not(.wp-hide-pw):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ── La clé d'accès, sous le bouton du lien ──────────────────────────────── */

body.login .tgc-passkey { border-top-color: var(--paper-300); }

/* `--danger-600` n'existe pas ; le rouge posé sur du clair est `--red-700`. */
body.login .tgc-passkey__msg { color: var(--red-700, #A93226); }

/* ── Under the card ───────────────────────────────────────────────────────── */

body.login #nav,
body.login #backtoblog {
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: 0.82rem;
}

body.login #nav { margin-bottom: 8px; }
body.login #backtoblog { margin-bottom: 18px; }

body.login #nav a,
body.login #backtoblog a {
  color: var(--ink-500);
  text-decoration: none;
}

body.login #nav a:hover,
body.login #nav a:focus,
body.login #backtoblog a:hover,
body.login #backtoblog a:focus {
  color: var(--navy-700);
  text-decoration: underline;
}


/* ── The club's own screens ───────────────────────────────────────────────── */

/* The second factor prints its own layout; only its surface needs bringing
   over, and it carries token fallbacks of its own. It sets a top margin for
   the unstyled case, which here would open a seam under the notice. */
body.login .tgc-2fa { margin-top: 0; color: var(--ink-700); }

body.login .tgc-2fa__steps li { color: var(--ink-700); }
body.login .tgc-2fa__manual { color: var(--ink-500); }
body.login .tgc-2fa__manual code {
  font-family: var(--font-mono);
  color: var(--navy-800);
}

body.login .tgc-2fa__codes {
  font-family: var(--font-mono);
  color: var(--navy-800);
}

body.login .tgc-2fa__qr svg { border-radius: var(--radius-sm); }

body.login #tgc_code {
  font-family: var(--font-mono);
  color: var(--navy-800);
}

/* ── Interim login: WordPress reuses this screen inside a small popup ─────── */

body.login.interim-login {
  display: block;
  min-height: 0;
  padding: 0;
}

body.login.interim-login #login { max-width: none; }

/* ── Narrow screens ───────────────────────────────────────────────────────── */

@media (max-width: 30rem) {
  body.login { padding: 0; justify-content: flex-start; }
  body.login #login { max-width: none; }
  body.login #login h1,
  body.login .tgc-login-welcome { border-radius: 0; }
  body.login #login > form,
  body.login #login > .tgc-2fa { border-radius: 0; padding: 22px 20px 26px; }
  /* The stack's own rule weighs more (one class): square here too, or a card
     under a notice kept its rounded foot on a full-width phone screen. */
  body.login #login :is(.message, .success, #login_error, .tgc-login-notice) + :is(form, .tgc-2fa) { border-radius: 0; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  body.login .button:not(.wp-hide-pw),
  body.login input { transition: none; }
  body.login .button:not(.wp-hide-pw):hover,
  body.login .button:not(.wp-hide-pw):active,
  body.login .button:not(.button-primary):not(.wp-hide-pw):hover { transform: none; }
}

/* ── Forced colours ───────────────────────────────────────────────────────── */

/* Windows' high contrast mode drops `box-shadow`: the outline's ring would go
   and the passkey button become bare text. A system-coloured edge inside the
   pill, the keyboard's ring outside it. */
@media (forced-colors: active) {
  body.login .button:not(.wp-hide-pw) {
    outline: 1px solid ButtonText;
    outline-offset: -1px;
  }
  body.login .button:not(.wp-hide-pw):focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

/* ── Maintenance ─────────────────────────────────────────────────────────────
 *
 * Le club annonce ses travaux **avant** qu'on essaie. La règle « les gardes
 * tournent à l'usage, pas à la demande » existe pour ne pas répondre « cette
 * adresse est-elle du club ? » ; ici la réponse est la même pour tout le monde,
 * donc l'annoncer ne distingue personne.
 *
 * **Une bande de la pile, comme les autres avis de cet écran** (2026-10-23,
 * A-FAIRE 34, « les bords sont arrondis et il y a un blanc ») : pleine
 * largeur, angles vifs, filet de 3 px, retrait de 30 px. Elle était la seule
 * pièce arrondie d'une pile à angles vifs, à 20 px au-dessus de la carte.
 * `BCP_Maintenance::login_notice()` l'imprime juste sous le bandeau navy,
 * avant la consigne : c'est ce qu'il faut lire en premier. Contrastes sur
 * gold-100 : navy-900 14,6:1, ink-700 8,5:1.
 *
 * `#login` dans le sélecteur : WordPress habille cet écran par identifiant, et
 * une classe seule y perd — c'est le piège que ce fichier documente déjà.
 */
body.login #login .tgc-login-notice {
  margin: 0;
  padding: 14px 30px;
  border: 0;
  border-left: 3px solid var(--gold-500);
  border-radius: 0;
  background: var(--gold-100);
}

body.login #login .tgc-login-notice p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-700);
}

body.login #login .tgc-login-notice p:first-child {
  color: var(--navy-900);
  font-weight: 600;
}

/* The title is a <b>, whose `bolder` would take 600 to the face's 700. */
body.login #login .tgc-login-notice b { font-weight: inherit; }

body.login #login .tgc-login-notice p + p { margin-top: 2px; }
