/* =====================================================================
   BASE — estructura y layout comunes a todos los temas.
   Aquí solo va lo "estructural". Los colores, fondos, fuentes y
   decoraciones van en cada css/temas/*.css
   ===================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* ===== Capas de efectos que crean los temas desde JS ===== */
.capa-ambiente {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.capa-cursor {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}

/* ===== Cabecera / título ===== */
header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 70px 20px 40px;
}

h1 {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(48px, 14vw, 240px);
  text-transform: uppercase;
  letter-spacing: 4px;
  line-height: 0.95;
}

.subtitulo {
  margin-top: 20px;
  font-size: clamp(1rem, 3vw, 1.3rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 700;
}

/* ===== Grid de asignaturas ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  align-items: start; /* cada tarjeta crece sola, sin estirar las de su fila */
}

/* ===== Tarjeta de asignatura (estructura) ===== */
.asignatura {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.asignatura__cabecera {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.asignatura__siglas { display: block; font-size: 2.4rem; line-height: 1; }
.asignatura__nombre { display: block; margin-top: 8px; font-size: 0.8rem; }
.asignatura__contador {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
}

.asignatura__flecha { font-size: 1.6rem; transition: transform 0.3s ease; }
.asignatura.abierta .asignatura__flecha { transform: rotate(180deg); }

/* Panel desplegable (acordeón) */
.asignatura__panel {
  position: relative;
  z-index: 1;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.asignatura.abierta .asignatura__panel { max-height: 600px; }

.asignatura__ejercicios {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 20px;
}

.vacio {
  text-align: center;
  font-style: italic;
  padding: 8px 0 4px;
}

/* Botón de ejercicio */
.ejercicio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ejercicio__flecha { font-size: 1.2rem; transition: transform 0.2s ease; }
.ejercicio:hover .ejercicio__flecha { transform: translateX(4px); }

/* ===== Botón flotante para cambiar de tema ===== */
.btn-temas {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn-temas:hover {
  transform: scale(1.12) rotate(20deg);
  background: rgba(0, 0, 0, 0.55);
}

/* Botón "tema anterior": a la izquierda del de "siguiente" */
.btn-temas--prev { right: 82px; }
.btn-temas[hidden] { display: none; }

/* ===== Botones de esquina: «Salir» (arriba izq.) y «Panel de administración» (abajo izq.) ===== */
.btn-esquina {
  position: fixed;
  left: 20px;
  z-index: 99999;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn-esquina--arriba { top: 20px; }
.btn-esquina--abajo { bottom: 20px; }
.btn-esquina:hover { transform: scale(1.06); background: rgba(0, 0, 0, 0.55); }

/* ===== Aviso de la portada y mantenimiento (se editan desde el panel) ===== */
.aviso-sitio {
  position: relative;
  z-index: 1;
  margin: 0 0 22px;
  padding: 12px 18px;
  border-radius: 12px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #6ea8ff;
  backdrop-filter: blur(6px);
}
.aviso-sitio--ok { border-color: #3ddc97; }
.aviso-sitio--aviso { border-color: #ffb454; }
.aviso-sitio[hidden] { display: none; }

.grid > .mantenimiento { grid-column: 1 / -1; max-width: 560px; width: 100%; margin: 0 auto; }
.mantenimiento .asignatura__cabecera { cursor: default; }
.mantenimiento .asignatura__nombre { font-size: 1rem; line-height: 1.4; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  header { padding: 50px 16px 32px; }
  h1 { letter-spacing: 2px; }
}