:root {
  --azul-profundo: #0a2a6b;
  --azul: #0f3fa6;
  --azul-hover: #0b3188;
  --rojo: #da4f40;
  --azul-dpi: #066ccc;
  --piedra: #5b6169;
  --tinta: #1b2433;
  --fondo: #f6f8fc;
  --linea: #d9dfeb;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--tinta);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
}

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Panel institucional */
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(16px, 4vh, 48px);
  padding: clamp(24px, 7vh, 88px) clamp(40px, 6vw, 88px);
  color: #fff;
  background:
    radial-gradient(120% 90% at 85% 15%, #1a4fc4 0%, rgba(26, 79, 196, 0) 60%),
    linear-gradient(160deg, var(--azul) 0%, var(--azul-profundo) 100%);
}

/* Escudo: ocupa solo el espacio libre entre la lista y el pie, nunca queda tras otro elemento */
.marca-escudo {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  object-position: right center;
  opacity: 0.4;
  pointer-events: none;
  animation: escudo 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes escudo {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
  }

  to {
    opacity: 0.4;
    transform: none;
  }
}

.login-brand>* {
  position: relative;
}

/* Red de nodos animada, inspirada en "Usuarios similares" del home */
.login-brand>.red-nodos {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.brand-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, min(3.6vw, 6vh), 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 15ch;
}

.brand-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(10px, 2.5vh, 20px);
  max-width: 38ch;
}

.brand-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: start;
  font-size: 0.975rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.brand-list strong {
  display: block;
  color: #fff;
  font-weight: 600;
}

.brand-list .fa {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  font-size: 16px;
  color: #fff;
}

.brand-foot {
  margin: 0;
  padding-top: 16px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
  border-top: 3px solid var(--rojo);
  width: fit-content;
}

/* Panel de ingreso */
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vh, 72px) clamp(20px, 5vw, 64px);
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-logo {
  display: block;
  height: clamp(80px, 14vh, 128px);
  flex-shrink: 0;
  width: auto;
  max-width: 100%;
  margin: 0 0 clamp(12px, 3vh, 28px);
}

.login-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--azul-profundo);
  margin: 0 0 8px;
}

.login-subtitle {
  margin: 0 0 clamp(16px, 4vh, 32px);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--piedra);
}

.login-actions {
  display: grid;
  gap: 12px;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 20px;
  border: 1.5px solid var(--azul);
  border-radius: 8px;
  font: 600 1rem/1.3 var(--sans);
  text-align: center;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-login:focus-visible,
.login-help a:focus-visible {
  outline: 3px solid var(--rojo);
  outline-offset: 3px;
}

.btn-uchile {
  background: var(--azul);
  color: #fff;
}

.btn-uchile:hover {
  background: var(--azul-hover);
  border-color: var(--azul-hover);
  color: #fff;
}

.btn-ingenieria {
  background: transparent;
  color: var(--azul);
}

.btn-ingenieria:hover {
  background: var(--azul);
  color: #fff;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.875rem;
  color: var(--piedra);
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--linea);
}

.login-help {
  margin: clamp(16px, 4vh, 32px) 0 0;
  padding-top: clamp(12px, 2.5vh, 20px);
  border-top: 1px solid var(--linea);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--piedra);
}

.login-help a {
  color: var(--azul-dpi);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}

.login-help a:hover {
  color: var(--azul);
}

/* Pantallas medianas y móviles: solo el panel de ingreso, con franja azul y roja */
@media (max-width: 920px) {
  .login {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    border-top: 6px solid var(--azul);
    align-items: flex-start;
    padding-top: clamp(28px, 8vh, 64px);
    background:
      linear-gradient(var(--rojo), var(--rojo)) top left / 72px 6px no-repeat,
      var(--fondo);
  }

  .login-box {
    margin: 0 auto;
  }
}

/* Siempre se ve al menos un logo: el de la derecha nunca se oculta; el escudo se omite si queda chico */
@media (max-height: 760px) {
  .marca-escudo {
    display: none;
  }
}

@media (max-height: 560px) {
  .login-logo {
    height: 80px;
    margin-bottom: 16px;
  }

  .login-subtitle {
    margin-bottom: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marca-escudo {
    animation: none;
  }
}
