/*
 * Hatipikal · plantilla única del recorrido de entrada
 *
 * Acceso, elección de cuenta, alta, recuperar y cambiar contraseña, verificar el
 * correo, doble factor y las dos pantallas de fidelidad comparten esta hoja: la
 * misma página lisa, la misma tarjeta, la misma marca, el mismo título, los
 * mismos campos y el mismo botón. Auditoría de diseño del 2026-11-20,
 * propuesta 14: el recorrido usaba tres plantillas y cada paso parecía otra web.
 *
 * Se carga la ÚLTIMA y se activa con `body.auth-entry`. Tiene dos mitades:
 *
 *   1. La receta común (`.auth-entry-*`), que escriben las pantallas sencillas
 *      con `includes/auth-entry.php`.
 *   2. La alineación de las pantallas que ya tenían la tarjeta del acceso
 *      (`.login-auth-card`): se les retira el fondo de manchas difuminadas, el
 *      vidrio y el rayado, y se les da la misma superficie.
 *
 * Los `!important` no son gusto: las hojas heredadas del acceso (`auth-base`,
 * `auth-onboarding`, `login`) fijan fondo, tarjeta y título con `!important`, y
 * esta hoja tiene que ganarles sin tocarlas. Por lo mismo cada selector lleva
 * `:not(#_)`: no excluye nada (ningún cuerpo tiene ese id) y sube la
 * especificidad por encima de reglas como
 * `html body:not(.login-auth-body) main.auth-page.section-shell > section.auth-card:only-of-type`,
 * que ponían a cero el relleno de la tarjeta. Cada `var()` lleva valor de reserva
 * porque verificar el correo y el doble factor no cargan ninguna otra hoja.
 */

body.auth-entry {
  --auth-entry-page: #F4EFE7;
  --auth-entry-surface: #FFFDF9;
  --auth-entry-line: #DCC8B5;
  --auth-entry-ink: #2F2F2B;
  --auth-entry-ink-soft: #6B5B4B;
  --auth-entry-field-line: #CDBFAE;
  --auth-entry-radius: 22px;
  --auth-entry-control-radius: 9px;
  --auth-entry-control-height: 48px;
  --auth-entry-button: linear-gradient(135deg, #6B5B4B 0%, #6B5B4B 42%, #4A4A42 100%);
  --auth-entry-button-active: linear-gradient(135deg, #4A4A42 0%, #2F2F2B 100%);
  --auth-entry-display: var(--font-display, "Cormorant Garamond", Georgia, serif);
  --auth-entry-ui: var(--font-ui, "Geist", Montserrat, "Noto Sans Devanagari", system-ui, sans-serif);
}

/* ── 1. Página: fondo liso de la paleta, sin manchas ni ruido ─────────────── */

html body.auth-entry:not(#_) {
  margin: 0;
  background: var(--auth-entry-page) !important;
  background-image: none !important;
  color: var(--auth-entry-ink);
  font-family: var(--auth-entry-ui);
}

html body.auth-entry:not(#_)::before,
html body.auth-entry:not(#_)::after {
  content: none !important;
  display: none !important;
}

/* Las pantallas sencillas no pintan la cabecera fija de la aplicación, pero las
   hojas heredadas le reservaban su hueco (156 px en escritorio, 88 en móvil). */
html body.auth-entry.auth-entry--simple:not(#_) {
  padding: 0 !important;
}

html body.auth-entry:not(#_) .login-noise,
html body.auth-entry:not(#_) .login-ambient,
html body.auth-entry:not(#_) .login-card-shine {
  display: none !important;
}

/* ── 2. Tarjeta: opaca, borde fino, sin vidrio ni rayado ──────────────────── */

html body.auth-entry:not(#_) .auth-entry-card,
html body.auth-entry:not(#_) .login-auth-card {
  background: var(--auth-entry-surface) !important;
  background-image: none !important;
  border: 1px solid var(--auth-entry-line) !important;
  border-radius: var(--auth-entry-radius) !important;
  box-shadow: 0 24px 60px -40px rgba(74, 74, 66, 0.32) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html body.auth-entry:not(#_) .login-auth-card::before,
html body.auth-entry:not(#_) .login-auth-card::after {
  background: none !important;
  background-image: none !important;
}

/* La marca del acceso, plana como la de la receta común. */
html body.auth-entry:not(#_) .login-auth-card .login-brand-mark {
  background: #FFFFFF !important;
  box-shadow: none !important;
}

html body.auth-entry:not(#_) .login-auth-card .login-brand-mark img { filter: none !important; }

/* Primer paso del alta: «Continuar» a todo el ancho, como «Iniciar sesión». */
html body.auth-entry:not(#_) .login-auth-card.is-registration-email-step .registration-wizard-next {
  width: 100% !important;
  max-width: none !important;
}

/* ── 3. La receta común de las pantallas sencillas ────────────────────────── */

html body.auth-entry:not(#_) .auth-entry-page {
  box-sizing: border-box;
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 24px !important;
}

html body.auth-entry:not(#_) .auth-entry-card {
  box-sizing: border-box;
  position: relative;
  display: block !important;
  width: min(100%, 460px) !important;
  max-width: 460px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 44px !important;
  text-align: start !important;
}

/* Un solo «volver», arriba; a su lado, el idioma cuando la pantalla lo ofrece. */
html body.auth-entry:not(#_) .auth-entry-card > .login-card-top,
html body.auth-entry:not(#_) .auth-entry-top {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: auto !important;
  min-height: 44px;
  margin: 0 0 22px !important;
  padding: 0 !important;
}

html body.auth-entry:not(#_) .auth-entry-back,
html body.auth-entry:not(#_) .login-card-top .login-card-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--auth-entry-ink-soft) !important;
  font-family: var(--auth-entry-ui);
  font-size: 0.84rem;
  font-weight: 500 !important;
  text-decoration: none;
  border-radius: 6px;
}

html body.auth-entry:not(#_) .auth-entry-back:hover,
html body.auth-entry:not(#_) .login-card-top .login-card-back:hover { color: var(--auth-entry-ink) !important; }

html body.auth-entry:not(#_) .auth-entry-back:focus-visible,
html body.auth-entry:not(#_) .login-card-top .login-card-back:focus-visible {
  outline: 2px solid var(--auth-entry-ink-soft);
  outline-offset: 3px;
}

html body.auth-entry:not(#_) .auth-entry-brand {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;
  border: 1px solid rgba(155, 133, 115, 0.38);
  border-radius: 50%;
  background: #FFFFFF;
}

html body.auth-entry:not(#_) .auth-entry-brand img {
  display: block;
  width: auto;
  height: 30px;
}

html body.auth-entry:not(#_) .auth-entry-title {
  max-width: none !important;
  margin: 0 0 12px !important;
  color: var(--auth-entry-ink) !important;
  font-family: var(--auth-entry-display) !important;
  font-size: clamp(1.9rem, 5vw, 2.25rem) !important;
  font-weight: 400 !important;
  letter-spacing: var(--heading-tracking, -0.01em) !important;
  line-height: 1.08 !important;
  text-align: center !important;
  text-transform: none !important;
  text-wrap: balance;
}

html body.auth-entry:not(#_) .auth-entry-text {
  max-width: none !important;
  margin: 0 0 22px !important;
  color: var(--auth-entry-ink-soft) !important;
  font-family: var(--auth-entry-ui) !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
  line-height: 1.55 !important;
  text-align: center !important;
}

html body.auth-entry:not(#_) .auth-entry-text--strong {
  margin-bottom: 8px !important;
  color: var(--auth-entry-ink) !important;
  font-weight: 500 !important;
  overflow-wrap: anywhere;
}

html body.auth-entry:not(#_) .auth-entry-card > :last-child { margin-bottom: 0 !important; }

html body.auth-entry:not(#_) .auth-entry-form {
  display: grid !important;
  gap: 14px !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

html body.auth-entry:not(#_) .auth-entry-form label {
  display: grid !important;
  gap: 6px !important;
  margin: 0 !important;
  text-align: start !important;
}

html body.auth-entry:not(#_) .auth-entry-form label > span {
  color: #4A4A42 !important;
  font-family: var(--auth-entry-ui) !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  line-height: 1.3 !important;
  text-transform: none !important;
}

html body.auth-entry:not(#_) .auth-entry-form input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box;
  width: 100% !important;
  height: var(--auth-entry-control-height) !important;
  min-height: var(--auth-entry-control-height) !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid var(--auth-entry-field-line) !important;
  border-radius: var(--auth-entry-control-radius) !important;
  background: #FFFFFF !important;
  box-shadow: none !important;
  color: var(--auth-entry-ink) !important;
  font-family: var(--auth-entry-ui) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  text-align: start !important;
}

/* Los campos de escritura no resaltan el foco: basta el cursor (AGENTS.md,
   orden de la propietaria del 2026-11-15). El botón sí lo marca. */
html body.auth-entry:not(#_) .auth-entry-form input:not([type="hidden"]):focus,
html body.auth-entry:not(#_) .auth-entry-form input:not([type="hidden"]):focus-visible {
  border-color: var(--auth-entry-field-line) !important;
  box-shadow: none !important;
  outline: none !important;
}

html body.auth-entry:not(#_) .auth-entry-button {
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  max-width: none !important;
  min-height: var(--auth-entry-control-height) !important;
  margin: 0 !important;
  padding: 10px 20px !important;
  border: 0 !important;
  border-radius: var(--auth-entry-control-radius) !important;
  background: var(--auth-entry-button) !important;
  box-shadow: none !important;
  color: #FFFFFF !important;
  cursor: pointer;
  font-family: var(--auth-entry-ui) !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  line-height: 1.2 !important;
  text-align: center;
  text-decoration: none !important;
  text-transform: none !important;
}

html body.auth-entry:not(#_) .auth-entry-button:hover,
html body.auth-entry:not(#_) .auth-entry-button:focus-visible {
  background: var(--auth-entry-button-active) !important;
}

html body.auth-entry:not(#_) .auth-entry-button:focus-visible {
  outline: 2px solid var(--auth-entry-ink-soft) !important;
  outline-offset: 3px !important;
}

html body.auth-entry:not(#_) .auth-entry-form + .auth-entry-button,
html body.auth-entry:not(#_) .auth-entry-alert + .auth-entry-button { margin-top: 4px !important; }

html body.auth-entry:not(#_) .auth-entry-button--spaced { margin-top: 14px !important; }

/* Doble factor: la tarjeta cuelga directamente del cuerpo, que ya la centra. */
html body.auth-entry.auth-entry--simple:not(#_) > .auth-entry-card { margin: 24px auto !important; }

/* Aviso: texto normal con una raya lateral, sin sombra. La caja con sombra y
   negrita de antes se confundía con un campo del formulario. */
html body.auth-entry:not(#_) .auth-entry-alert {
  margin: 0 0 18px !important;
  padding: 12px 14px !important;
  border: 0 !important;
  border-inline-start: 3px solid #9B8573 !important;
  border-radius: 0 var(--auth-entry-control-radius) var(--auth-entry-control-radius) 0 !important;
  background: var(--auth-entry-page) !important;
  box-shadow: none !important;
  color: var(--auth-entry-ink) !important;
  font-family: var(--auth-entry-ui) !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  text-align: start !important;
}

html[dir="rtl"] body.auth-entry:not(#_) .auth-entry-alert {
  border-radius: var(--auth-entry-control-radius) 0 0 var(--auth-entry-control-radius) !important;
}

html body.auth-entry:not(#_) .auth-entry-alert.success { border-inline-start-color: #8D9A84 !important; }

html body.auth-entry:not(#_) .auth-entry-form .cf-turnstile,
html body.auth-entry:not(#_) .auth-entry-form .turnstile-widget { justify-self: center; }

/* ── 4. Pie del acceso y de la elección de cuenta: peso normal ────────────── */

html body.auth-entry:not(#_) .login-auth-card .login-legal a,
html body.auth-entry:not(#_) .login-auth-card .login-legal-links a,
html body.auth-entry:not(#_) .login-auth-card .auth-legal-links a {
  font-weight: 400 !important;
}

/* ── 5. Móvil: a pantalla completa, sin tarjeta flotante ──────────────────── */

@media (max-width: 540px) {
  html body.auth-entry:not(#_) .auth-entry-page {
    place-items: start stretch !important;
    padding: 0 !important;
  }

  html body.auth-entry:not(#_) .auth-entry-card {
    width: 100% !important;
    max-width: none !important;
    padding: max(18px, env(safe-area-inset-top)) 24px 32px !important;
  }

  html body.auth-entry.auth-entry--simple:not(#_) > .auth-entry-card { margin: 0 !important; }

  html body.auth-entry:not(#_) .auth-entry-card,
  html body.auth-entry:not(#_) .login-auth-card {
    border-color: transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.auth-entry:not(#_) .auth-entry-button,
  html body.auth-entry:not(#_) .auth-entry-back { transition: none !important; }
}
