/* ==========================================================================
   SciRedPen, pages d'identification

   Une colonne unique : la marque en haut, un filet rouge tiré dessous, et la
   carte qui porte le formulaire. Rien d'autre. Les jetons, les fontes et les
   contrôles viennent de styles.css ; cette feuille n'ajoute que la mise en
   page de la colonne et la matière des champs.
   ========================================================================== */

.auth {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-8) var(--s-5) var(--s-9);
}

/* --------------------------------------------------------------------------
   Marque
   -------------------------------------------------------------------------- */

.auth-masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-7);
  text-align: center;
  animation: masthead-rise 620ms var(--ease-out) both;
}

.auth-masthead .brand-mark {
  width: 280px;
  height: 105px;
  /* Keep both theme variants in the same grid cell. If this becomes a block,
     the transparent logo still takes up space and the visible light logo
     drops by one full logo height. */
  display: grid;
  border-radius: var(--r-md);
}

.auth-masthead .brand-mark:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 4px;
}

/* Le trait du relecteur, tiré sous la marque à l'ouverture : le même geste que
   sur la page de présentation, à l'échelle d'une page de titre. */
.masthead-rule {
  width: 94px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--danger);
  transform: scaleX(0);
  transform-origin: center;
  animation: rule-draw 700ms var(--ease-out) 380ms forwards;
}

.auth-tagline {
  color: var(--text-faint);
  font-family: var(--font-text);
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Feuille
   -------------------------------------------------------------------------- */

/* Une carte posée sur la page : angles pleins, filet le plus fin, et l'ombre
   qui dit qu'elle est au-dessus du fond. */
.auth-card {
  width: 100%;
  max-width: 412px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg-raised);
  box-shadow: var(--shadow-md);
  padding: var(--s-7) var(--s-7) var(--s-6);
  animation: card-rise 620ms var(--ease-out) 120ms both;
}

.auth-card h1 {
  margin-bottom: var(--s-2);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: var(--w-display);
  letter-spacing: var(--track-title);
  text-align: center;
  white-space: normal;
}

.auth-lede {
  margin-bottom: var(--s-6);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Fournisseur externe
   -------------------------------------------------------------------------- */

/* Déclaré au complet plutôt que dérivé de `button` : l'élément est une ancre,
   le détour OAuth est une navigation, pas une action de script, et n'hérite
   donc d'aucun style de bouton. */
.provider-button {
  width: 100%;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text);
  padding: 0 var(--s-4);
  font-family: var(--font-meta);
  font-size: 14px;
  font-weight: var(--w-strong);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-hover) var(--ease-hover), border-color var(--t-hover) var(--ease-hover);
}

.provider-button:active {
  background: var(--bg-active);
}

@media (hover: hover) and (pointer: fine) {
  .provider-button:hover {
    background: var(--bg-hover);
  }
}

.provider-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

/* `inline-flex` l'emporterait sur l'attribut `hidden` : chaque fournisseur
   n'apparaît que si le serveur l'a configuré. */
.provider-button[hidden] {
  display: none;
}

/* `gap` plutôt qu'une marge entre voisins : un bouton masqué n'y compte pas. */
.provider-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.provider-note {
  margin-top: var(--s-3);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-6) 0;
  color: var(--text-faint);
  font-family: var(--font-meta);
  font-size: 13px;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   Formulaire
   -------------------------------------------------------------------------- */

.auth-form {
  display: grid;
  gap: var(--s-4);
}

.field {
  display: grid;
  gap: var(--s-2);
}

/* L'intitulé nomme le champ, il ne le surplombe pas : même corps que la ligne
   d'aide, une graisse au-dessus. */
.field label {
  color: var(--text-muted);
  font-family: var(--font-meta);
  font-size: 13px;
  font-weight: var(--w-strong);
}

.field input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  outline: 0;
  padding: 0 var(--s-4);
  font-family: var(--font-text);
  font-size: 15px;
  transition: border-color var(--t-hover) var(--ease-hover), box-shadow var(--t-hover) var(--ease-hover);
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.field input:-webkit-autofill {
  /* Le remplissage automatique impose son propre fond ; l'ombre interne le
     recouvre sans toucher au texte saisi. */
  box-shadow: 0 0 0 40px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
}

.field-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.field-hint {
  color: var(--text-faint);
  font-size: 13px;
}

.field-action {
  width: fit-content;
  justify-self: end;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--danger);
  text-underline-offset: 3px;
}

.reveal-button {
  height: auto;
  border: 0;
  color: var(--text-faint);
  padding: 0;
  font-size: 13px;
}

@media (hover: hover) and (pointer: fine) {
  .reveal-button:hover:not(:disabled) {
    background: transparent;
    color: var(--text);
  }
}

.auth-submit {
  width: 100%;
  height: 44px;
  justify-content: center;
  margin-top: var(--s-2);
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

/* Un refus se marque comme une correction : fond à peine teinté, texte
   lisible, et le même angle que les champs qu'il commente. */
.auth-error {
  border: 0;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--text);
  margin-bottom: var(--s-5);
  padding: var(--s-3) var(--s-4);
  font-size: 14px;
  line-height: 1.6;
}

.auth-error[hidden] {
  display: none;
}

.auth-message {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: var(--s-5);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.auth-message h2 {
  margin-bottom: var(--s-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 19px;
}

.auth-message p + p,
.auth-message p + a,
.auth-message .btn-primary {
  margin-top: var(--s-3);
}

.auth-message[hidden],
.auth-form[hidden] {
  display: none;
}

.auth-footer {
  margin-top: var(--s-6);
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
}

.auth-disclosure {
  margin-top: var(--s-2);
  border-top: 1px solid var(--line);
  padding-top: var(--s-4);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-disclosure > strong {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--text);
  font-weight: var(--w-strong);
}

.auth-disclosure-links {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-2);
}

.auth-disclosure + .auth-submit {
  margin-top: var(--s-3);
}

.auth-disclosure a {
  color: var(--text);
  text-underline-offset: 3px;
}

.auth-footer a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--danger);
  text-underline-offset: 3px;
  transition: color var(--t-hover) var(--ease-hover);
}

@media (hover: hover) and (pointer: fine) {
  .auth-footer a:hover {
    color: var(--danger);
  }
}

.auth-aside {
  max-width: 412px;
  margin-top: var(--s-6);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.auth-home-link {
  margin-top: var(--s-3);
  color: var(--text-muted);
  font-size: 13px;
  text-underline-offset: 3px;
}

.support-fallback {
  max-width: 412px;
  margin-top: var(--s-4);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.auth-controls {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* --------------------------------------------------------------------------
   Ouverture
   -------------------------------------------------------------------------- */

@keyframes masthead-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes rule-draw {
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-masthead,
  .auth-card {
    animation: none !important;
  }

  /* Le trait reste tire : il fait partie de la page de titre, ce n'est pas son
     trace qui compte. */
  .masthead-rule {
    animation: none !important;
    transform: scaleX(1);
  }
}

@media (max-width: 480px) {
  .auth {
    justify-content: flex-start;
    padding: var(--s-8) var(--s-4) var(--s-8);
  }

  .auth-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: var(--s-6) 0 0;
  }
}
