/* ==========================================================================
   TALLER DE CRIPTOGRAFÍA — style.css
   Sistema de diseño "Liquid Glass" en modo claro, optimizado para
   proyección: texto muy oscuro sobre cristal esmerilado y un fondo
   vibrante con formas abstractas en cian, naranja y magenta.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET BÁSICO
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1, h2, h3,
p, form, fieldset {
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

input {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

/* --------------------------------------------------------------------------
   2. TOKENS DE DISEÑO
   -------------------------------------------------------------------------- */
:root {
  /* Tipografía */
  --font-display: "Poppins", sans-serif;
  --font-body: "Inter", sans-serif;

  /* Texto: siempre oscuro, para máximo contraste en proyector */
  --ink: #10142a;                    /* casi negro / azul marino profundo */
  --ink-soft: #3c4166;               /* texto secundario, sigue siendo oscuro */
  --ink-faint: rgba(16, 20, 42, .58);/* pistas y ayudas, aún legible */

  /* Superficies de cristal */
  --glass: rgba(255, 255, 255, .55);
  --glass-strong: rgba(255, 255, 255, .8);
  --glass-border: rgba(255, 255, 255, .9);

  /* Fondo base y colores vibrantes */
  --bg-base: #eef2fb;
  --c-cyan: #00e0ff;
  --c-orange: #ff7a18;
  --c-magenta: #ff2f9e;
  --focus-ring: #00b8d9;

  /* Sombras */
  --shadow-1: 0 10px 30px rgba(16, 20, 42, .14);
  --shadow-2: 0 18px 45px rgba(16, 20, 42, .22);

  /* Radios */
  --radius-sm: .75rem;
  --radius-md: 1.25rem;
  --radius-lg: 1.75rem;
  --radius-pill: 999px;

  /* Espaciado */
  --space-1: .5rem;
  --space-2: .75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4rem;
}

/* --------------------------------------------------------------------------
   3. BASE DE PÁGINA Y FONDO VIBRANTE
   -------------------------------------------------------------------------- */
body {
  min-height: 100svh;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.5;
  background-color: var(--bg-base);
  overflow-x: hidden;
}

/* Formas abstractas y saturadas detrás del cristal (decorativas) */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-blobs span {
  position: absolute;
  display: block;
  filter: blur(70px);
  opacity: .5;
  border-radius: 48% 40% 60% 50% / 55% 60% 40% 45%;
}

.bg-blobs span:nth-child(1) {
  width: 46vw;
  height: 46vw;
  top: -12%;
  left: -10%;
  background: var(--c-cyan);
}

.bg-blobs span:nth-child(2) {
  width: 40vw;
  height: 40vw;
  bottom: -14%;
  right: -8%;
  background: var(--c-orange);
}

.bg-blobs span:nth-child(3) {
  width: 32vw;
  height: 32vw;
  top: 38%;
  right: 12%;
  background: var(--c-magenta);
  opacity: .38;
}

/* --------------------------------------------------------------------------
   4. UTILIDADES Y LAYOUT
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-3);
}

.hero {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   5. TIPOGRAFÍA
   -------------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  text-align: center;
}

h2 {
  font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem);
  font-weight: 700;
}

.page-subtitle {
  text-align: center;
  color: var(--ink-soft);
  font-weight: 500;
  margin-top: var(--space-1);
  margin-bottom: var(--space-5);
}

/* --------------------------------------------------------------------------
   6. TARJETA DE CRISTAL (glassmorphism)
   -------------------------------------------------------------------------- */
.glass-card {
  position: relative;
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  padding: var(--space-6) var(--space-5);
  overflow: hidden;
}

/* Filo superior: la firma visual del taller, repetida en cada tarjeta */
.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--c-cyan), var(--c-orange), var(--c-magenta));
}

.glass-card--auth {
  max-width: 920px;
}

.glass-card--menu {
  max-width: 560px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   7. FORMULARIOS
   -------------------------------------------------------------------------- */
.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  align-items: stretch;
}

.auth-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input {
  background: var(--glass-strong);
  border: 1px solid rgba(16, 20, 42, .12);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  color: var(--ink);
}

.field input::placeholder {
  color: var(--ink-faint);
}

.field input:focus-visible {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px rgba(0, 184, 217, .28);
}

/* Divisor "o" entre inicio de sesión y registro */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-soft);
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(16, 20, 42, .15);
}

.auth-divider span {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-cyan), var(--c-magenta));
  text-transform: uppercase;
  font-family: var(--font-display);
}

.cta-block {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(16, 20, 42, .12);
  text-align: center;
}

.cta-block__hint {
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------------------
   8. BOTONES
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: .95rem 1.75rem;
  border-radius: var(--radius-pill);
  transition: transform .18s ease, box-shadow .18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 1.1rem 2rem;
  font-size: 1.1rem;
}

.btn--sm {
  padding: .55rem 1.1rem;
  font-size: .85rem;
}

/* Botón primario: gradiente vibrante, texto siempre oscuro */
.btn--primary {
  background: linear-gradient(120deg, var(--c-cyan), var(--c-magenta));
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.btn--primary:hover {
  box-shadow: var(--shadow-2);
}

/* Botón "outline": vidrio con borde, para llamadas a la acción secundarias */
.btn--outline {
  background: var(--glass-strong);
  border: 1.5px solid rgba(16, 20, 42, .18);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.btn--outline:hover {
  border-color: var(--ink);
}

/* Botón "ghost": para acciones de bajo énfasis, como "Volver al inicio" */
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn--ghost:hover {
  color: var(--ink);
  transform: none;
}

/* --------------------------------------------------------------------------
   9. MENÚ DE ALGORITMOS
   -------------------------------------------------------------------------- */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.menu-btn {
  justify-content: flex-start;
  padding: 1.15rem 1.5rem;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.menu-btn:hover {
  box-shadow: var(--shadow-2);
}

.menu-btn__index {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  font-size: 1rem;
  flex-shrink: 0;
}

.menu-btn__label {
  font-size: 1.05rem;
}

.menu-btn--cesar { background: var(--c-orange); }
.menu-btn--afin { background: var(--c-cyan); }
.menu-btn--vigenere { background: var(--c-magenta); }

.back-link {
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   10. DISCO DE CIFRADO (elemento decorativo, firma visual del sitio)
   -------------------------------------------------------------------------- */
.cipher-disk {
  position: absolute;
  z-index: -1;
  width: min(70vw, 640px);
  height: min(70vw, 640px);
  color: var(--ink);
  opacity: .1;
}

.cipher-disk__inner {
  transform-box: fill-box;
  transform-origin: center;
  animation: cipher-disk-spin 90s linear infinite;
}

@keyframes cipher-disk-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE (mobile-first)
   -------------------------------------------------------------------------- */
@media (min-width: 760px) {
  .glass-card {
    padding: var(--space-7) var(--space-6);
  }

  .auth-grid {
    grid-template-columns: 1fr auto 1fr;
  }

  .auth-divider {
    flex-direction: column;
    height: 100%;
  }

  .auth-divider::before,
  .auth-divider::after {
    width: 1px;
    height: auto;
  }

  .menu-list {
    gap: var(--space-4);
  }
}

@media (min-width: 1024px) {
  .glass-card--auth {
    max-width: 980px;
  }
}

/* --------------------------------------------------------------------------
   12. PREFERENCIAS DE ACCESIBILIDAD
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .cipher-disk__inner {
    animation: none;
    transition: none;
  }
}