/* Responsabilidad: página de inicio (/), solo acceso para pacientes y personal.
 * Dos «puertas» a pantalla completa: la que recibe el puntero o el foco se abre.
 * Keyframes propios (pedido explícito de animación): entrada escalonada, igual a pi-rise,
 * y una deriva lenta de la decoración radial. Todo se apaga con prefers-reduced-motion. */

body.inicio {
  display: block;
  --inicio-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.inicio__top,
.inicio__pie {
  position: absolute;
  z-index: 2;
  left: clamp(24px, 4vw, 64px);
  pointer-events: none;
}

.inicio__top {
  top: clamp(24px, 4vw, 48px);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.inicio__top span {
  padding-left: var(--space-3);
  border-left: 1px solid var(--line);
}

.inicio__pie {
  bottom: clamp(20px, 3vw, 36px);
  color: var(--fg-soft);
  font-size: 12px;
}

.inicio__puertas {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
}

.inicio__puerta {
  position: relative;
  overflow: hidden;
  flex: 1 1 0;
  min-width: 0;
  padding: clamp(112px, 16vh, 176px) clamp(24px, 4vw, 64px) clamp(72px, 12vh, 120px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  transition: flex-grow 0.6s var(--inicio-ease), background-color 0.4s ease;
}

/* .auth-page a hereda el color del body: cada puerta fija el suyo. */
.auth-page .inicio__puerta--paciente {
  background: var(--bg);
  color: var(--fg);
}

.auth-page .inicio__puerta--personal {
  background: var(--bg-dark);
  color: var(--fg-on-dark);
}

/* Paciente: círculo gris suave; personal: la esfera roja de marca. Ambas se acercan al abrir. */
.inicio__puerta::before {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.8s var(--inicio-ease), opacity 0.6s ease;
}

.inicio__puerta--paciente::before {
  right: -14vw;
  bottom: -18vw;
  width: 42vw;
  height: 42vw;
  background: var(--bg-soft);
  opacity: 0.55;
}

.inicio__puerta--personal::before {
  right: -180px;
  top: -180px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%);
  animation: inicio-deriva 14s ease-in-out infinite alternate;
}

.inicio__cuerpo,
.inicio__ir {
  position: relative;
}

.inicio__cuerpo > *,
.inicio__ir {
  opacity: 0;
  transform: translateY(14px);
  animation: inicio-entrada 0.7s var(--inicio-ease) forwards;
}

.inicio__cuerpo > :nth-child(2) { animation-delay: 0.08s; }
.inicio__cuerpo > :nth-child(3) { animation-delay: 0.16s; }
.inicio__ir { animation-delay: 0.24s; }
.inicio__puerta--personal :is(.inicio__cuerpo > *, .inicio__ir) { animation-delay: calc(var(--d, 0s) + 0.12s); }
.inicio__puerta--personal .inicio__cuerpo > :nth-child(2) { --d: 0.08s; }
.inicio__puerta--personal .inicio__cuerpo > :nth-child(3) { --d: 0.16s; }
.inicio__puerta--personal .inicio__ir { --d: 0.24s; }

.inicio__eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.inicio__puerta--paciente .inicio__eyebrow { color: var(--accent-fg-strong); }
.inicio__puerta--personal .inicio__eyebrow { color: color-mix(in srgb, var(--fg-on-dark) 60%, transparent); }

.auth-page .inicio__titulo {
  max-width: 9ch;
  margin-top: var(--space-4);
  color: inherit;
  font-size: clamp(44px, 5.6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.inicio__texto {
  max-width: 34ch;
  margin-top: var(--space-5);
  font-size: 16px;
  line-height: 1.6;
}

.inicio__puerta--paciente .inicio__texto { color: var(--fg-muted); }
.inicio__puerta--personal .inicio__texto { color: color-mix(in srgb, var(--fg-on-dark) 72%, transparent); }

.inicio__ir {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-size: 15px;
  font-weight: 500;
}

.inicio__ingresar {
  transition: opacity 0.4s ease, transform 0.5s var(--inicio-ease);
}

.inicio__flecha {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, transform 0.5s var(--inicio-ease);
}

.inicio__puerta--paciente .inicio__flecha {
  border: 1px solid var(--line);
  color: var(--fg);
}

.inicio__puerta--personal .inicio__flecha {
  border: 1px solid color-mix(in srgb, var(--fg-on-dark) 28%, transparent);
}

.inicio__puerta:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

/* Abrir una puerta: crece, su decoración se acerca y la flecha se llena. */
.inicio__puerta:is(:hover, :focus-visible) .inicio__flecha {
  transform: translateX(6px);
}

.inicio__puerta--paciente:is(:hover, :focus-visible) .inicio__flecha {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--fg-on-dark);
}

.inicio__puerta--personal:is(:hover, :focus-visible) .inicio__flecha {
  border-color: var(--fg-on-dark);
  background: var(--surface);
  color: var(--fg);
}

.inicio__puerta--paciente:is(:hover, :focus-visible)::before {
  transform: scale(1.12) translate(-4%, -4%);
}

.inicio__puerta--personal:is(:hover, :focus-visible)::before {
  transform: scale(1.18);
}

@media (hover: hover) and (min-width: 901px) {
  .inicio__puerta:is(:hover, :focus-visible) {
    flex-grow: 1.35;
  }

  /* «Ingresar» aparece al abrir la puerta; en táctil siempre está visible. */
  .inicio__ingresar {
    opacity: 0;
    transform: translateX(-12px);
  }

  .inicio__puerta:is(:hover, :focus-visible) .inicio__ingresar {
    opacity: 1;
    transform: none;
  }
}

@keyframes inicio-entrada {
  to { opacity: 1; transform: none; }
}

@keyframes inicio-deriva {
  to { transform: translate(-60px, 40px); }
}

@media (max-width: 900px) {
  .inicio__puertas {
    min-height: 0;
    flex-direction: column;
  }

  .inicio__puerta {
    flex: none;
    min-height: 0;
    padding: 104px clamp(20px, 6vw, 48px) 48px;
  }

  .inicio__puerta--personal {
    padding-top: 56px;
  }

  .inicio__puerta--paciente::before {
    width: 70vw;
    height: 70vw;
    right: -24vw;
    bottom: -30vw;
  }

  .inicio__flecha {
    width: 56px;
    height: 56px;
  }

  .inicio__top {
    left: clamp(20px, 6vw, 48px);
  }

  .inicio__pie {
    position: static;
    padding: var(--space-6) clamp(20px, 6vw, 48px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .inicio__puerta,
  .inicio__puerta::before,
  .inicio__ingresar,
  .inicio__flecha {
    transition: none;
  }

  .inicio__puerta--personal::before {
    animation: none;
  }

  .inicio__cuerpo > *,
  .inicio__ir {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
