/* ============================================================
   TChess · Acceso (rd-auth) — feedback de formularios y layout
   Complementa auth.css. Prefijo acc-.
   ============================================================ */

/* Foco visible en los controles del acceso */
.auth-panel a:focus-visible,
.auth-content a:focus-visible,
.btn-submit:focus-visible,
.btn-oauth:focus-visible,
.field__toggle:focus-visible,
.auth-check input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}
.auth-alert:focus { outline: none; }

/* Subtítulo del panel */
.acc-lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Etiqueta de sección dentro del registro */
.acc-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 14px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.acc-section::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.acc-section--first { margin-top: 0; }

/* Mensajes bajo el campo */
.acc-error {
  display: flex;
  gap: 6px;
  margin: 6px 0 0;
  font-size: .84rem;
  font-weight: 500;
  color: #a11d1d;
}
.acc-error::before { content: "!"; font-weight: 800; }
.acc-error[hidden], .acc-caps[hidden] { display: none; }
.acc-caps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: .82rem;
  font-weight: 600;
  color: #7a5b30;
}
.field__control:has(input[aria-invalid="true"]) { border-color: #a11d1d; }
.auth-panel .field__control:has(input[aria-invalid="true"]) { border-bottom-color: #a11d1d; }
.field__hint { align-items: flex-start; line-height: 1.4; }
.field__label { font-size: .84rem; }

/* Foco del campo con línea inferior (panel dividido) más marcado */
.auth-panel .field__control:focus-within {
  border-bottom-width: 2px;
  margin-bottom: -.5px;
}

/* Botón primario: único elemento con peso en la pantalla */
.btn-submit { min-height: 48px; }
.btn-submit.is-loading { cursor: progress; opacity: .85; }
.acc-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: acc-spin .7s linear infinite;
}
@keyframes acc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .acc-spinner { animation-duration: 2.4s; }
}

/* Enlace con apariencia de botón primario (reset inválido) */
.acc-btn-link { text-decoration: none; }

/* Campo de código de 6 dígitos */
.field__control--token {
  padding-top: 6px;
  padding-bottom: 6px;
}
.field__control--token .field__input--token {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 1.9rem;
  letter-spacing: .45em;
  padding-left: .45em;
  max-width: 240px;
  font-variant-numeric: tabular-nums;
}
.acc-token-help {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: .95rem;
  line-height: 1.5;
}

/* Confirmación de correo enviado (recuperar contraseña) */
.acc-sent__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--gold-bg);
  color: var(--gold-text, #8a6440);
  font-size: 1.1rem;
  margin-bottom: 14px;
}
.acc-sent__title { font-size: 1.25rem; font-weight: 800; margin: 0 0 8px; }
.acc-sent p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.5; }
.acc-sent .acc-sent__hint { color: var(--muted); font-size: .9rem; }
.acc-sent a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Aviso legal pegado al botón de crear cuenta */
.acc-legal {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.acc-legal a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Móvil */
@media (max-width: 480px) {
  .auth-panel { padding: 28px 18px 40px; align-items: flex-start; }
  .auth-row--top { flex-direction: column; gap: 0; }
  .auth-row--top .field--flex { width: 100%; margin-bottom: 18px; }
  .field__control input { font-size: 16px; } /* evita el zoom de iOS */
}

.acc-link-btn { background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.auth-help--tight { margin-top: 10px; }

/* Confirmación de "recuperar contraseña": reenviar a otro correo sin salir. */
.acc-retry { margin-top: 12px; text-align: left; }
.acc-retry summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; color: var(--acc-link, #7d5a2f); }
.acc-retry summary:focus-visible { outline: 2px solid #b0875a; outline-offset: 2px; border-radius: 4px; }
.acc-retry form { margin-top: 14px; }

/* Pantallas táctiles: controles de 44 px */
.auth-back { display: inline-flex; align-items: center; min-height: 44px; }
.auth-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) { min-height: 44px; }
.field__toggle { min-width: 44px; min-height: 44px; }

/* Bordes de campos con al menos 3:1 (WCAG 1.4.11) */
.auth-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) { border-color: var(--muted-2); }

/* Foco visible con teclado (2.4.7) */
.auth-panel :is(input, select, textarea, a, button):focus-visible { outline: 2px solid var(--gold, #b0875a); outline-offset: 2px; }
