/* Pantalla de inicio de sesion inmersiva: la animacion ocupa toda la ventana,
   la barra superior queda transparente encima y el logo de "Herbario Llanos"
   se lee en claro sobre el fondo oscuro. */
body.immersive { margin: 0; overflow-x: hidden; }
body.immersive header.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: transparent;
  border-bottom: none;
  z-index: 2;
}
/* El titulo grande reemplaza a la marca chica del topbar en esta pantalla. */
body.immersive header.topbar .brand { display: none; }
body.immersive main { max-width: none; padding: 0; margin: 0; }
/* El pie de contacto propio reemplaza al pie generico de la plataforma. */
body.immersive footer.footnote { display: none; }

/* Animación decorativa de musgos y líquenes para la pantalla de inicio de sesión. */
.login-hero {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  min-height: 100vh;
  overflow: hidden;
}

.login-title {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  margin: 0;
  width: 90%;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  /* Relieve dorado: degrade tipo luz natural + varias capas de sombra para dar
     volumen (contacto, proyectada y resplandor), en vez de un color plano. */
  background: linear-gradient(180deg, #f6e2a8 0%, #dcb567 45%, #b3823a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: #d4af5f;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 #8a6423aa, 0 3px 6px #00000070, 0 10px 26px #000000aa, 0 0 60px #d4af5f3d;
  transition: opacity 400ms ease;
}
/* Mientras el panel de acceso esta abierto, el titulo cede protagonismo para no chocar con el. */
.login-hero:has(.login-access[open]) .login-title { opacity: 0.1; }

.login-hero .scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, #233e24 0%, #102719 45%, #07130e 100%);
}
.login-hero .scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-hero .scene .moss { transform-box: fill-box; transform-origin: 50% 100%; animation: login-bg-sway 8s ease-in-out infinite; }
.login-hero .scene .moss.slow { animation-duration: 12s; }
.login-hero .scene .stem { transform-box: fill-box; transform-origin: 50% 100%; animation: login-bg-sway 9s ease-in-out infinite; }
.login-hero .scene .capsule { transform-box: fill-box; transform-origin: 50% 90%; animation: login-bg-nod 7s ease-in-out infinite; }
.login-hero .scene .spore { animation: login-bg-drift var(--d) linear infinite; animation-delay: var(--delay); opacity: 0; }
.login-hero .scene .glow { animation: login-bg-pulse 6s ease-in-out infinite; transform-origin: center; }

/* Luciernagas volando a lo ancho de la escena, con parpadeo suave. */
.login-hero .fireflies { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.login-hero .firefly {
  position: absolute;
  top: var(--y);
  left: -4%;
  width: var(--s, 5px);
  height: var(--s, 5px);
  border-radius: 50%;
  background: #f5eba0;
  box-shadow: 0 0 6px 2px #f5eba0cc, 0 0 16px 5px #d8c96a55;
  opacity: 0;
  animation: login-bg-firefly var(--t) linear infinite;
  animation-delay: var(--d);
}

/* Favicon de acceso: un icono que, al hacer clic, despliega usuario y contraseña.
   Va fijo en la esquina superior derecha, y el panel se abre debajo alineado a ese borde. */
.login-access {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  text-align: right;
}
.login-access summary {
  list-style: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #10241b8f;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #ffffff40;
  color: #eef0df;
  cursor: pointer;
}
.login-access summary::-webkit-details-marker { display: none; }
.login-access summary:hover { background: #1c3527; }
.login-access summary:focus-visible { outline: 2px solid #c0cb8b; outline-offset: 2px; }
.login-access summary { margin-left: auto; }
.login-access[open] summary { margin-bottom: 0.9rem; }

.login-access-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-width: 320px;
  max-width: min(92vw, 420px);
  margin-left: auto;
  padding: 1.3rem 1.5rem;
  background: linear-gradient(165deg, #1c3f35d9, #0c211ce3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #bfe8db3d;
  border-radius: 16px;
  color: #eef0df;
  text-align: center;
  /* Retraso de 2s antes de aparecer, luego una entrada suave (menos estatica). */
  opacity: 0;
  animation: login-panel-in 1100ms 2000ms cubic-bezier(.22, .8, .3, 1) both;
  box-shadow:
    0 18px 45px -14px #000000b0,
    0 4px 14px #00000066,
    inset 0 1px 0 #ffffff2e,
    inset 0 -18px 34px -22px #5fd6c033;
}
/* Ondas de agua: un brillo que respira y un reflejo que la recorre en diagonal. */
.login-access-panel::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle, #6fe0c93a, transparent 62%);
  animation: login-panel-ripple 5s ease-in-out infinite;
  animation-delay: 2100ms;
  pointer-events: none;
}
.login-access-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, #ffffff2b 50%, transparent 65%);
  background-size: 220% 220%;
  animation: login-panel-shimmer 7s ease-in-out infinite;
  animation-delay: 2100ms;
  pointer-events: none;
}
.login-access-panel > * { position: relative; z-index: 1; }
.login-access-panel h2 { margin: 0 0 0.9rem; font-size: 1.1rem; font-weight: 400; letter-spacing: 0.02em; color: #eef0df; }
.login-access-panel form { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 0.75rem; }
.login-access-panel .field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 180px; flex: 1 1 180px; text-align: left; }
.login-access-panel .field label {
  font: 11px system-ui;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8d4b7;
}
.login-access-panel input {
  background: #ffffff17;
  border: 1px solid #ffffff3a;
  color: #eef0df;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
}
.login-access-panel input::placeholder { color: #c8d4b799; }
.login-access-panel input:focus { outline: 2px solid #c0cb8b; outline-offset: 1px; background: #ffffff26; }
.login-access-panel button {
  background: #8ba888;
  color: #10241b;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.15rem;
  white-space: nowrap;
}
.login-access-panel button:hover { background: #a3c2a0; }
/* Mensajes del login (error de credenciales, cuenta creada) dentro del cuadro, con la paleta de la escena. */
.login-access-panel .login-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font: 13px/1.45 system-ui, sans-serif;
  text-align: left;
  animation: login-msg-in 450ms ease-out both;
}
.login-access-panel .login-msg svg { flex: none; margin-top: 1px; }
.login-access-panel .login-msg--error {
  color: #f7d9d1;
  background: linear-gradient(135deg, #a8404899, #6e2a3299);
  border: 1px solid #f0a39a99;
  box-shadow: inset 0 1px 0 #ffffff14, 0 4px 14px -6px #00000088;
  animation: login-msg-in 450ms ease-out both, login-msg-shake 520ms 500ms ease-in-out;
}
.login-access-panel .login-msg--error svg { color: #f0a69b; }
.login-access-panel .login-msg--ok {
  color: #dcf3e2;
  background: linear-gradient(135deg, #2f6b4a55, #1d4a3466);
  border: 1px solid #8fd6aa55;
  box-shadow: inset 0 1px 0 #ffffff14, 0 4px 14px -6px #00000088;
}
.login-access-panel .login-msg--ok svg { color: #9fe0b7; }
/* Si el cuadro se abre por un mensaje del servidor, no hace falta el retraso de 2 s. */
.login-access.has-msg .login-access-panel { animation-delay: 120ms; }
.login-access.has-msg .login-access-panel::before,
.login-access.has-msg .login-access-panel::after { animation-delay: 220ms; }

.login-access-panel .hint { margin: 0.9rem 0 0; font: 12px system-ui; color: #d2ddc9; }
.login-access-panel .hint a { color: #d6e2c9; }

/* Pie de contacto de la empresa, agrupado en una tarjeta discreta. */
.login-hero .login-contact {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.75rem;
  padding: 0.6rem 1.1rem;
  max-width: 94vw;
  background: #0d1f16a6;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #ffffff1f;
  border-radius: 12px;
  font: 12px system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: #b9c7ac;
}
.login-hero .login-contact-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}
.login-hero .login-contact a,
.login-hero .login-contact-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #d6e2c9;
  white-space: nowrap;
}
.login-hero .login-contact a svg,
.login-hero .login-contact-name svg { opacity: 0.85; flex: none; }
.login-hero .login-contact a:hover { color: #eef0df; }
.login-hero .login-contact-name { color: #b9c7ac; }

@keyframes login-panel-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes login-msg-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}
@keyframes login-msg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
@keyframes login-panel-ripple {
  0%, 100% { transform: scale(1); opacity: .55; }
  50% { transform: scale(1.18); opacity: .95; }
}
@keyframes login-panel-shimmer {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

@keyframes login-bg-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2.5deg); } }
@keyframes login-bg-nod { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
@keyframes login-bg-drift { 0% { opacity: 0; transform: translate(0, 25px) scale(.5); } 15% { opacity: .65; } 80% { opacity: .35; } 100% { opacity: 0; transform: translate(35px, -115px) scale(1.15); } }
@keyframes login-bg-pulse { 0%, 100% { opacity: .12; } 50% { opacity: .35; } }
@keyframes login-bg-firefly {
  0% { opacity: 0; transform: translate(0, 0); }
  6% { opacity: .85; }
  25% { transform: translate(29vw, -22px); opacity: .25; }
  50% { transform: translate(58vw, 16px); opacity: .9; }
  75% { transform: translate(87vw, -14px); opacity: .2; }
  94% { opacity: .8; }
  100% { opacity: 0; transform: translate(112vw, 6px); }
}

@media (prefers-reduced-motion: reduce) {
  .login-hero * { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}
