/* =========================================
   FUENTES
========================================= */

@font-face {
  font-family: "Work Sans";
  src: url("../assets/fonts/WorkSans-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("../assets/fonts/WorkSans-Medium.otf") format("opentype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("../assets/fonts/WorkSans-SemiBold.otf") format("opentype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Libre Baskerville";
  src: url("../assets/fonts/LibreBaskerville-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}


/* =========================================
   VARIABLES
========================================= */

:root {
  color-scheme: light;

  --page-background: #f1ebde;
  --text-primary: #1f1d19;
  --text-secondary: #6b6455;
  --accent: #01939c;
  --accent-soft: #dceff0;
  --field-background: #faf7f0;
}


/* =========================================
   CONFIGURACIÓN GENERAL
========================================= */

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

html,
body {
  width: 100%;
  height: 100%;
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--page-background);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--text-primary);
  font-family: "Work Sans", system-ui, sans-serif;
}

.login-page {
  width: 100%;
  max-width: 1560px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 64px 20px 40px;

  display: flex;
  flex-direction: column;
  align-items: center;

  overflow: hidden;
  background: var(--page-background);
}

.login-content {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.login-content[hidden] {
  display: none !important;
}

.login-column {
  width: 340px;
  max-width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
}


/* =========================================
   MARCA
========================================= */

.brand {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.brand-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2.8px;
  line-height: normal;
  white-space: nowrap;
}


/* =========================================
   ENCABEZADOS
========================================= */

.login-heading {
  width: 100%;
  padding-top: 40px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;

  text-align: center;
}

.login-heading h1 {
  width: 100%;
  margin: 0;

  color: var(--text-primary);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 37px;
}

.login-heading p {
  width: 100%;
  margin: 0;

  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}


/* =========================================
   FORMULARIO DE CORREO
========================================= */

.login-form {
  width: 100%;
  margin: 0;
}

.form-field {
  width: 100%;
  padding-top: 30px;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.form-field label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  line-height: normal;
}

.input-frame {
  width: 100%;
  padding: 3px;
  border-radius: 9px;
  background: transparent;
  transition: background-color 150ms ease;
}

.input-frame:focus-within {
  background: var(--accent-soft);
}

.input-frame input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;

  border: 0;
  border-radius: 6px;
  outline: 1.2px solid #d7cebf;
  outline-offset: -0.6px;

  transition: outline-color 150ms ease;

  background: var(--field-background);
  color: var(--text-primary);

  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
}

.input-frame input:focus,
.input-frame input:not(:placeholder-shown) {
  outline-color: var(--accent);
}

.input-frame input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.input-frame input:focus {
  outline: 1.2px solid var(--accent);
}


/* =========================================
   BOTONES
========================================= */

.form-action {
  width: 100%;
  padding-top: 20px;
}

.form-action button {
  width: 100%;
  height: 48px;
  padding: 0 16px;

  border: 0;
  border-radius: 10px;

  background: var(--accent);
  color: #ffffff;

  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;

  cursor: pointer;
  transition: background-color 150ms ease;
}

.form-action button:hover {
  background: #017f87;
}

.form-action button:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}


/* =========================================
   MENSAJES DE VALIDACIÓN
========================================= */

.form-note {
  display: none;

  width: 100%;
  min-height: 0;
  margin: 0;
  padding-top: 14px;

  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
  text-align: left;
}

.form-note.is-visible {
  display: block;
}


/* =========================================
   PIE DE PÁGINA
========================================= */

.login-footer {
  width: 100%;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: normal;
  text-align: center;
}


/* =========================================
   PANTALLA DE CÓDIGO
========================================= */

.code-screen .login-heading {
  padding-top: 40px;
  gap: 12px;
}

.code-screen .login-heading h1 {
  font-size: 32px;
  line-height: 37px;
}

.code-screen .login-heading p {
  font-size: 14px;
  line-height: 22px;
}

.code-form {
  width: 100%;
  margin: 0;
}


/* =========================================
   SEIS CASILLAS
========================================= */

.code-fields {
  width: 100%;
  padding-top: 28px;

  display: flex;
  align-items: center;
  gap: 8px;
}

.code-cell {
  position: relative;

  flex: 1 1 0;
  min-width: 0;
  height: 54px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 6px;
  outline: 1.2px solid #bdb29c;
  outline-offset: -0.6px;

  background: var(--field-background);
}

.code-cell.is-current,
.code-cell:focus-within {
  outline: 1.6px solid var(--accent);
  outline-offset: -0.8px;
}

.code-digit {
  display: block;

  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;

  border: 0;
  border-radius: 6px;
  outline: 0;

  background: transparent;
  color: var(--text-primary);
  caret-color: var(--accent);

  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: normal;
  text-align: center;
}

@keyframes digit-bounce {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.16);
  }

  65% {
    transform: scale(0.94);
  }

  100% {
    transform: scale(1);
  }
}

.code-digit.is-entering {
  animation: digit-bounce 280ms ease-out;
}

/* =========================================
   BOTÓN DE VERIFICACIÓN
========================================= */

.code-action {
  padding-top: 24px;
}

.code-action button {
  height: 48px;
  font-size: 15px;
}


/* =========================================
   REENVÍO Y CAMBIO DE CORREO
========================================= */

.code-resend {
  width: 100%;
  padding-top: 16px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.resend-countdown,
.change-email-button {
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 13px;
  line-height: normal;
  letter-spacing: 0;
  white-space: nowrap;
}

.resend-countdown {
  color: var(--text-secondary);
  font-weight: 400;
}

.change-email-button {
  padding: 0;
  border: 0;

  background: transparent;
  color: var(--accent);

  font-weight: 500;
  cursor: pointer;
}

.change-email-button:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
  border-radius: 2px;
}


/* =========================================
   ADAPTACIÓN MÓVIL
   Hasta 600 px
========================================= */

@media (max-width: 600px) {

  body {
    align-items: stretch;
    justify-content: center;
  }

  .login-page {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .login-content {
    align-items: center;
    justify-content: center;
    padding: 40px 20px 0;
  }

  .login-column {
    width: 350px;
    max-width: 100%;
  }


  /* Marca */

  .brand {
    gap: 12px;
  }

  .brand-logo {
    width: 100px;
    height: 100px;
  }

  .brand-label {
    font-size: 13px;
    letter-spacing: 2.6px;
  }


  /* Encabezados */

  .login-heading {
    padding-top: 36px;
    gap: 10px;
  }

  .login-heading h1 {
    font-size: 28px;
    line-height: 32px;
  }

  .login-heading p {
    font-size: 15px;
    line-height: 23px;
  }


  /* Correo */

  .form-field {
    padding-top: 28px;
  }

  .form-field label {
    font-size: 14px;
  }

  .input-frame input {
    height: 52px;
  }


  /* Botón */

  .form-action {
    padding-top: 22px;
  }

  .form-action button {
    height: 52px;
    font-size: 16px;
  }


  /* Código */

  .code-screen .login-heading {
    padding-top: 36px;
    gap: 10px;
  }

  .code-screen .login-heading h1 {
    font-size: 28px;
    line-height: 32px;
  }

  .code-screen .login-heading p {
    font-size: 15px;
    line-height: 23px;
  }

  .code-fields {
    padding-top: 24px;
  }

  .code-cell {
    height: 60px;
  }

  .code-digit {
    font-size: 24px;
  }

  .code-action {
    padding-top: 22px;
  }

  .code-action button {
    height: 52px;
    font-size: 16px;
  }

  .code-resend {
    padding-top: 14px;
    gap: 6px;
  }

  .resend-countdown,
  .change-email-button {
    font-size: 14px;
  }


  /* Pie */

  .login-footer {
    flex-direction: column;
    justify-content: flex-start;
    padding: 0 0 28px;
    font-size: 12px;
  }
}


/* =========================================
   PANTALLAS DE ESCRITORIO BAJAS
========================================= */

@media (max-height: 580px) and (min-width: 601px) {
  .login-page {
    padding: 20px 20px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 96px;
    height: 96px;
  }

  .login-heading,
  .code-screen .login-heading {
    padding-top: 18px;
    gap: 8px;
  }

  .form-field {
    padding-top: 14px;
  }

  .form-action {
    padding-top: 12px;
  }

  .code-fields {
    padding-top: 16px;
  }

  .code-action {
    padding-top: 14px;
  }

  .code-resend {
    padding-top: 10px;
    gap: 5px;
  }
}

/* =========================================
   ESTADO DE CÓDIGO INCORRECTO
========================================= */

.code-error {
  width: 100%;
  padding-top: 16px;

  display: flex;
  align-items: center;
  gap: 8px;
}

.code-error[hidden] {
  display: none !important;
}

.code-error svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  overflow: visible;
}

.code-error p {
  flex: 1;
  margin: 0;

  color: #a23b2a;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 19px;
  text-align: left;
}

/* Bordes rojos en las seis casillas */

.code-screen.has-error .code-cell,
.code-screen.has-error .code-cell.is-current,
.code-screen.has-error .code-cell:focus-within {
  outline: 1.2px solid #a23b2a;
  outline-offset: -0.6px;
}


/* Adaptación móvil */

@media (max-width: 600px) {

  .code-error {
    padding-top: 14px;
  }

  .code-error svg {
    width: 18px;
    height: 18px;
  }

  .code-error p {
    font-size: 14px;
    line-height: 20px;
  }

  .code-screen.has-error .code-action {
    padding-top: 20px;
  }

}

/* =========================================
   ESTADO DE CÓDIGO VENCIDO
========================================= */

.code-expired-message {
  width: 100%;
  height: 58px;
  margin-top: 26px;
  padding: 0 16px;

  display: flex;
  align-items: center;
  gap: 10px;

  border: 1px solid #ddd3c1;
  border-radius: 6px;

  background-color: #faf7f0;
}

.code-expired-message[hidden],
.code-expired-action[hidden] {
  display: none !important;
}

.code-expired-message svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.code-expired-message p {
  flex: 1;
  margin: 0;

  color: #1f1d19;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  text-align: left;
}


/* Ocultar las acciones normales */

.code-screen.is-expired .code-error,
.code-screen.is-expired .code-action,
.code-screen.is-expired .code-resend {
  display: none !important;
}


/* Botón de código nuevo */

.code-expired-action {
  padding-top: 26px;
}

.code-expired-action button {
  height: 48px;
  border-radius: 10px;
  font-size: 15px;
}


/* =========================================
   ADAPTACIÓN MÓVIL
========================================= */

@media (max-width: 600px) {

  .code-expired-message {
    height: 74px;
    margin-top: 22px;
    padding: 14px;
    align-items: center;
    gap: 10px;
  }

  .code-expired-message svg {
    width: 18px;
    height: 18px;
  }

  .code-expired-message p {
    font-size: 15px;
    line-height: 23px;
  }

  .code-expired-action {
    padding-top: 20px;
  }

  .code-expired-action button {
    height: 52px;
    font-size: 16px;
  }

}

/* =========================================
   ESTADO DE VERIFICACIÓN
========================================= */

.verify-spinner {
  display: none;

  width: 16px;
  height: 16px;
  flex-shrink: 0;

  animation: verify-spin 1s linear infinite;
}

.code-screen.is-verifying .verify-spinner {
  display: block;
}

.code-screen.is-verifying .code-action button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  cursor: wait;
}

.code-screen.is-verifying .code-action button:disabled {
  opacity: 1;
  cursor: wait;
}

.code-screen.is-verifying .code-resend,
.code-screen.is-verifying .code-error,
.code-screen.is-verifying .code-expired-message,
.code-screen.is-verifying .code-expired-action {
  display: none !important;
}

@keyframes verify-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}


/* ADAPTACIÓN MÓVIL */

@media (max-width: 600px) {

  .verify-spinner {
    width: 18px;
    height: 18px;
  }

}