/* ==========================================================================
   Entrar (plantillas/entrar.html), solo en la web.

   Para quien: instructores y coordinadores del SENA, y quien lo vea en una
   presentacion. Que debe sentir: institucional, preciso, confiable.

   Concepto: «la credencial». A la izquierda, el papel de seguridad del Lector
   -el mismo guilloche de la portada- en tinta azul de documento, con una franja
   MRZ como la del reverso de una cedula. A la derecha, la contrasena sobre
   papel limpio, sin nada mas que distraiga.

   Lo memorable: un haz que recorre la franja MRZ y la va «leyendo» -las letras
   pasan de apagadas a nitidas a su paso-, que es lo que hace el programa con la
   camara del celular. Con movimiento reducido, quieto.

   Letras: las de la portada (fuentes.css). Bricolage para lo que se mira de
   lejos, Public Sans para leer, IBM Plex Mono para la MRZ. Los colores salen
   de estilo.css y portada.css: el mismo azul de tinta y el ocre de la portada.
   ========================================================================== */

:root {
  --en-tinta: #0f1d45;          /* el azul de la credencial */
  --en-tinta-2: #182a5c;
  --en-sobre-tinta: #e9edfc;
  --en-sobre-tinta-2: #aab6dc;
  --en-haz: #5fd6a0;
  --en-campo: var(--papel);
  --en-radio: 10px;
}
:root[data-tema="oscuro"] {
  --en-tinta: #0b1430;
  --en-tinta-2: #12204a;
  --en-campo: var(--papel-2);
}

body.en-cuerpo {
  margin: 0; min-height: 100vh; background: var(--fondo); color: var(--texto);
  font-family: var(--pt-letra-texto);
}

.en {
  min-height: 100vh; display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr);
}

/* ----------------------------------------------------------- la credencial */
.en-credencial {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 3.2rem 3.4rem 2.6rem;
  background: radial-gradient(120% 90% at 20% 15%, var(--en-tinta-2), var(--en-tinta));
  color: var(--en-sobre-tinta);
  --pt-guilloche: rgba(139, 166, 255, .16);
}
.en-guilloche { z-index: -1; opacity: .9; }
.en-cred-cuerpo { max-width: 34rem; }
.en-ceja {
  display: inline-flex; align-items: center; gap: .55rem; margin: 0;
  font-family: var(--pt-letra-mrz); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--en-sobre-tinta-2);
}
.en-ceja i { width: 7px; height: 7px; border-radius: 50%; background: var(--en-haz); flex: none; }
.en-titular {
  margin: 1.4rem 0 0; font-family: var(--pt-letra-portada); font-weight: 800;
  font-size: clamp(2.2rem, 3.6vw, 3.4rem); line-height: 1.02; letter-spacing: -.025em;
  text-wrap: balance;
}
.en-titular em { font-style: normal; color: var(--pt-ocre-vivo); }
.en-bajada { margin: 1.1rem 0 0; max-width: 40ch; font-size: 1rem; line-height: 1.55;
  color: var(--en-sobre-tinta-2); }

/* La franja MRZ, con el haz que la lee */
.en-mrz {
  position: relative; margin-top: 2.4rem; padding: 1rem 1.2rem;
  border: 1px solid rgba(233, 237, 252, .18); border-radius: var(--en-radio);
  background: rgba(8, 14, 34, .45); overflow: hidden;
  font-family: var(--pt-letra-mrz); font-size: clamp(.78rem, 1.15vw, .98rem);
  letter-spacing: .22em; line-height: 1.75; white-space: nowrap;
}
.en-mrz p { margin: 0; color: rgba(233, 237, 252, .3); overflow: hidden; text-overflow: clip; }
.en-mrz p { background: linear-gradient(90deg, var(--en-sobre-tinta) 0 var(--leido, 0%),
  rgba(233, 237, 252, .3) var(--leido, 0%)); -webkit-background-clip: text; background-clip: text;
  color: transparent; }
.en-haz {
  position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--en-haz);
  box-shadow: 0 0 14px 3px rgba(95, 214, 160, .55); animation: en-barrer 5.5s ease-in-out infinite;
}
.en-mrz p { animation: en-leer 5.5s ease-in-out infinite; }
@property --leido { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@keyframes en-barrer {
  0% { left: 0; opacity: 0; } 6% { opacity: 1; }
  70% { left: calc(100% - 2px); opacity: 1; } 78%, 100% { left: calc(100% - 2px); opacity: 0; }
}
@keyframes en-leer { 0% { --leido: 0%; } 70%, 92% { --leido: 100%; } 100% { --leido: 0%; } }

/* ----------------------------------------------------------------- el panel */
.en-panel { display: grid; place-items: center; padding: 2.5rem 2rem; background: var(--papel); }
.en-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.en-logo { width: 38px; height: 38px; color: var(--azul); }
.en-titulo { margin: 1.2rem 0 0; font-family: var(--pt-letra-portada); font-weight: 800;
  font-size: 2rem; letter-spacing: -.02em; }
.en-sub { margin: .35rem 0 1.6rem; color: var(--texto-2); font-size: .92rem; line-height: 1.45; }

.en-alerta {
  display: flex; align-items: flex-start; gap: .6rem; margin: 0 0 1.2rem; padding: .75rem .85rem;
  border-radius: var(--en-radio); background: var(--rojo-claro); color: var(--rojo);
  border: 1px solid color-mix(in srgb, var(--rojo) 35%, transparent); font-size: .87rem; line-height: 1.4;
}
.en-alerta svg { width: 18px; height: 18px; flex: none; margin-top: .05rem; }
.en-alerta b { font-family: var(--pt-letra-mrz); font-variant-numeric: tabular-nums; }

.en-etiqueta { font-size: .8rem; font-weight: 650; color: var(--texto-2); margin-bottom: .4rem; }
.en-campo { position: relative; }
.en-campo input {
  box-sizing: border-box; width: 100%; height: 50px; padding: 0 3.2rem 0 .95rem;
  border: 1px solid var(--borde); border-radius: var(--en-radio); background: var(--en-campo);
  color: var(--texto); font: inherit; font-size: 1.05rem; letter-spacing: .02em;
  transition: border-color .15s, box-shadow .15s;
}
.en-campo input:hover { border-color: var(--suave); }
.en-campo input:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-claro); }
.en-campo input:disabled { opacity: .55; cursor: not-allowed; }
.en-ver {
  position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--texto-2); cursor: pointer;
}
.en-ver:hover { color: var(--texto); background: var(--papel-2); }
.en-ver:focus-visible { outline: 2px solid var(--azul); outline-offset: -2px; }
.en-ver svg { width: 20px; height: 20px; }
.en-ver .tapado { display: none; }
.en-ver[aria-pressed="true"] .ojo { display: none; }
.en-ver[aria-pressed="true"] .tapado { display: block; }
.en-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.en-mayus { margin: .45rem 0 0; font-size: .8rem; color: var(--ambar); }

.en-entrar {
  margin-top: 1.4rem; height: 50px; display: inline-flex; align-items: center; justify-content: center;
  gap: .55rem; border: 0; border-radius: var(--en-radio); background: var(--en-tinta);
  color: #fff; font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .06s;
}
:root[data-tema="oscuro"] .en-entrar { background: var(--azul); color: #0b1020; }
.en-entrar svg { width: 19px; height: 19px; transition: transform .2s ease-out; }
.en-entrar:hover { background: var(--azul); }
.en-entrar:hover svg { transform: translateX(3px); }
.en-entrar:active { transform: translateY(1px); }
.en-entrar:focus-visible { outline: 3px solid var(--azul-claro); outline-offset: 2px; }
.en-entrar:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.en-entrar.cargando svg { animation: en-va 1s ease-in-out infinite; }
@keyframes en-va { 50% { transform: translateX(4px); } }

.en-pie {
  display: flex; gap: .55rem; align-items: flex-start; margin: 1.8rem 0 0; padding-top: 1.1rem;
  border-top: 1px solid var(--borde-suave); font-size: .76rem; line-height: 1.45; color: var(--suave);
}
.en-pie svg { width: 15px; height: 15px; flex: none; margin-top: .1rem; }

/* ------------------------------------------------------------- en el celular */
@media (max-width: 860px) {
  .en { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .en-credencial { padding: 1.8rem 1.4rem 1.4rem; }
  .en-titular { font-size: 1.9rem; margin-top: .9rem; }
  .en-bajada { display: none; }
  .en-mrz { margin-top: 1.2rem; font-size: .72rem; letter-spacing: .14em; }
  .en-panel { place-items: start center; padding: 1.8rem 1.2rem 2.4rem; }
  .en-titulo { margin-top: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .en-haz { animation: none; opacity: 0; }
  .en-mrz p { animation: none; --leido: 100%; }
  .en-entrar svg, .en-entrar.cargando svg { transition: none; animation: none; }
}
