/* ============================================================
   Hosting del Sur — Custom WordPress Login
    Version: 1.2.3
   Corrección: Evita flash de imagen estática antes de la animación Vanta
   ============================================================ */

/* ---- Google Font: Inter ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --hds-orange: #F07D30;
  --hds-orange-deep: #D96520;
  --hds-orange-rgb: 240, 125, 48;
  --hds-bg: #5aafe0;
  --hds-card: #FFFFFF;
  --hds-text: #1C1008;
  --hds-text-mid: #55341A;
  --hds-text-muted: #9E7A5A;
  --hds-line: rgba(80, 40, 10, 0.14);
  --hds-radius: 20px;
  --hds-t: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --hds-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---- Base ---- */
html {
  height: 100%;
}

body.login {
  margin: 0;
  padding: 60px 0 80px;
  min-height: 100vh;
  background-color: var(--hds-bg) !important;
  background-image: url('assets/images/fondo-nubes.webp') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  font-family: var(--hds-font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* ---- Evita el flash imagen -> animación en dispositivos que van a cargar Vanta:
   mientras cargan los scripts se ve el color liso (skyColor de Vanta), sin la
   imagen estática de fallback. Si JS no corre o el dispositivo es lento,
   la clase nunca se agrega y se mantiene la imagen de siempre. ---- */
html.hds-js-anim body.login {
  background-image: none !important;
  background-color: var(--hds-bg) !important;
}

/* ---- Vanta Background Div ---- */
#hds-bg-vanta {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0;
  /* Transición más rápida para que no parezca que demora */
  transition: opacity 0.8s ease-in-out;
  background: transparent;
}

#hds-bg-vanta.vanta-active {
  opacity: 1;
}

#hds-bg-vanta canvas {
  pointer-events: none;
}

/* ---- #login wrapper ---- */
body.login #login {
  position: relative;
  z-index: 10;
  width: 420px;
  max-width: 92vw;
  margin: 0 auto;
  padding: 0;
}

/* ---- Logo ---- */
body.login div#login h1 a {
  background-image: url('assets/images/logo-light.svg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  width: 300px;
  height: 112px;
  display: block;
  margin: 0 auto 36px;
  text-indent: -9999px;
  overflow: hidden;
  animation: hds-down 0.6s ease both;
}

/* ---- Badge ---- */
body.login #loginform::before,
body.login #registerform::before,
body.login #lostpasswordform::before {
  content: '▶  Área de Acceso';
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hds-orange);
  margin-bottom: 28px;
}

/* ---- Form Card ---- */
body.login #loginform,
body.login #registerform,
body.login #lostpasswordform {
  background: var(--hds-card);
  border-radius: var(--hds-radius);
  border-left: 5px solid var(--hds-orange);
  box-shadow:
    0 2px 6px rgba(var(--hds-orange-rgb), 0.08),
    0 16px 48px rgba(var(--hds-orange-rgb), 0.12),
    0 40px 80px rgba(30, 12, 0, 0.07);
  padding: 36px 36px 40px 32px;
  position: relative;
  animation: hds-up 0.6s 0.1s ease both;
  margin: 0;
}

/* ---- Inputs ---- */
body.login label {
  display: block;
  color: var(--hds-text-mid) !important;
  font-family: var(--hds-font) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 7px !important;
}

body.login input[type="text"],
body.login input[type="password"],
body.login input[type="email"] {
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid var(--hds-line) !important;
  border-radius: 0 !important;
  color: var(--hds-text) !important;
  font-size: 17px !important;
  padding: 6px 2px 10px !important;
  width: 100% !important;
  box-shadow: none !important;
  transition: border-color var(--hds-t);
}

body.login input[type="text"]:focus,
body.login input[type="password"]:focus {
  border-bottom-color: var(--hds-orange) !important;
  outline: none !important;
}

/* ---- Botón Principal (Login) ---- */
body.login .button-primary,
body.login #wp-submit {
  width: 100% !important;
  background: linear-gradient(135deg, #F08030 0%, #D96520 100%) !important;
  border: none !important;
  border-radius: 10px !important;
  color: #fff !important;
  font-family: var(--hds-font) !important;
  font-size: 15px !important;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 16px !important;
  height: auto !important;
  line-height: 1 !important;
  box-shadow: 0 4px 20px rgba(var(--hds-orange-rgb), 0.40) !important;
  transition: transform var(--hds-t), box-shadow var(--hds-t);
  cursor: pointer;
  margin-top: 20px !important;
}

body.login .button-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 28px rgba(var(--hds-orange-rgb), 0.50) !important;
}

/* ---- Selector de Idiomas (WordPress 5.9+) ---- */
.language-switcher {
  margin-top: 30px;
  text-align: center;
  animation: hds-up 0.6s 0.4s ease both;
}

.language-switcher form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.language-switcher select {
  background: rgba(255, 255, 255, 0.5) !important;
  border: 1px solid rgba(13, 42, 69, 0.2) !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
  font-size: 13px !important;
  color: #0d2a45 !important;
}

/* El botón "Cambiar" ahora es sutil */
.language-switcher input[type="submit"] {
  background: transparent !important;
  border: 1px solid var(--hds-orange) !important;
  color: var(--hds-orange) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background var(--hds-t), color var(--hds-t);
}

.language-switcher input[type="submit"]:hover {
  background: var(--hds-orange) !important;
  color: #fff !important;
}

/* ---- Nav links ---- */
body.login #nav,
body.login #backtoblog {
  text-align: center;
  margin-top: 18px;
  animation: hds-up 0.6s 0.22s ease both;
}

body.login #nav a,
body.login #backtoblog a {
  color: #0d2a45;
  font-size: 14px;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.4);
}

/* ---- Footer ---- */
#hds-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 12px 24px 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---- Keyframes ---- */
@keyframes hds-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hds-down {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Publications share the existing login identity without blocking authentication. */
body.login:has(#hds-announcements) {
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px minmax(0, 1fr);
  column-gap: clamp(32px, 4vw, 64px);
  row-gap: 24px;
  justify-content: center;
  align-content: center;
  padding: 48px 32px 24px;
}
body.login:has(#hds-announcements) #login {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: 100%;
}
body.login:has(#hds-announcements) .language-switcher { grid-column: 2; grid-row: 2; margin: 0; }
body.login:has(#hds-announcements) .language-switcher form { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 0; }
body.login:has(#hds-announcements) .language-switcher label { margin: 0 !important; }
body.login:has(#hds-announcements) .language-switcher select,
body.login:has(#hds-announcements) .language-switcher input[type="submit"] { min-height: 44px !important; }
body.login:has(#hds-announcements) .language-switcher input[type="submit"] { color: #66300e !important; border-color: #66300e !important; }
body.login:has(#hds-announcements) .privacy-policy-page-link { margin: 24px 0 0; }
body.login:has(#hds-announcements) #login h1 a { width: min(100%, 300px); }
#hds-announcements {
  position: relative;
  z-index: 10;
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: subgrid;
  row-gap: 20px;
  align-self: center;
  min-width: 0;
  pointer-events: none;
}
.hds-publication {
  grid-column: 3;
  grid-row: 1;
  justify-self: start;
  align-self: start;
  width: min(100%, 280px);
  box-sizing: border-box;
  pointer-events: auto;
  overflow: hidden;
  border: 1px solid rgba(80, 40, 10, .14);
  border-radius: 12px;
  background: #fff;
  color: #1c1008;
  box-shadow: 0 4px 16px rgba(30, 12, 0, .05);
  overflow-wrap: anywhere;
}
.hds-publication:nth-child(2) { grid-column: 1; justify-self: end; }
.hds-publication:nth-child(3) { grid-row: 2; }
.hds-publication-image { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.hds-publication-content { padding: 20px; }
.hds-publication .hds-publication-label { color: #66594f; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 10px; }
.hds-publication h2 { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 12px; }
.hds-publication .hds-publication-text { font-size: 16px; line-height: 1.6; color: #55341a; margin: 0; }
.hds-publication-link { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; color: #55341a; font-size: 16px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; margin-top: 12px; }
.hds-publication-link:hover { color: #1c1008; }
.hds-publication-notice { border-top: 5px solid #0d2a45; }
.hds-publication-notice .hds-publication-label { color: #0d2a45; }
body.login a:focus-visible, body.login input:focus-visible, body.login select:focus-visible { outline: 3px solid #0d2a45 !important; outline-offset: 4px; }
body.login:has(#hds-announcements) #hds-footer { position: relative; grid-column: 1 / -1; grid-row: 3; margin-top: 16px; }
@media (max-width: 1120px) {
  body.login:has(#hds-announcements) { display: flex; padding: 40px 20px 0; gap: 24px; justify-content: flex-start; }
  body.login:has(#hds-announcements) #login { width: min(100%, 420px); }
  body.login:has(#hds-announcements) .language-switcher { order: 1; }
  #hds-announcements { order: 2; width: min(calc(100% - 24px), 320px); grid-template-columns: minmax(0, 1fr); align-self: center; }
  #hds-announcements .hds-publication { grid-column: auto; grid-row: auto; justify-self: stretch; width: 100%; }
  body.login:has(#hds-announcements) #hds-footer { order: 3; box-sizing: border-box; width: calc(100% + 40px); }
}
@media (prefers-reduced-motion: reduce) {
  body.login *, body.login *::before { animation: none !important; transition: none !important; }
}
