/* ── Variables de color ── */
:root {
  --rojo:       #9b1a1a;
  --crema:      #fdf6ec;
  --blanco:     #fff9f2;
  --sombra:     rgba(100, 20, 20, 0.14);
  --texto:      #2a1a1a;
  --gris:       #7a5a5a;
  --linea:      rgba(155, 26, 26, 0.1);
}

/* ── Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.page {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.navbar {
  background: #a22b1f;
  color: white;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.nav-left {
  position: absolute;
  left: 25px;
}

.logo-icon {
  font-size: 28px;
  color: white;
}

.topbar {
  width: 100%;
  min-height: 78px;
  background: #a22b1f;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.topbar h1 {
  font-family: "Srisakdi", cursive;
  font-size: clamp(1.25rem, 4.5vw, 2.4rem);
  font-weight: 700;
}

.book-icon {
  position: absolute;
  left: 12px;
  font-size: 2.6rem;
  background: none;
  border: none;
}

.titulo {
  font-family: 'Srisakdi', cursive;
  font-size: clamp(1.2rem, 4.2vw, 2.2rem);
}

body {
  background: var(--crema);
  font-family: 'Crimson Pro', Georgia, serif;
  color: var(--texto);
  min-height: 100vh;
}

/* ── Encabezado ── */
.encabezado {
  background: var(--rojo);
  padding: 22px 32px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100vw;
  margin-left: calc(-1 * ((100vw - 100%) / 2));
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.32);
}

.icono-libro {
  width: 30px;
  height: 30px;
  color: #fff;
  flex-shrink: 0;
}

.icono-libro svg {
  width: 100%;
  height: 100%;
}

.titulo-encabezado {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  font-weight: 600;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ── Contenido principal ── */
.contenido {
  padding: 0;
}

/* ── Título de cada grado ── */
.titulo-grado {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 700;
  color: var(--rojo);
  letter-spacing: 0.04em;
  padding: 28px 20px 10px;
  border-bottom: 2px solid var(--linea);
  margin: 0 14px 6px;
}

/* ── Lista de clases (cuadrícula) ──
   Móvil:    1 columna
   Tableta:  2 columnas
   Escritorio: 3 columnas
   ─────────────────────────────── */
.lista-clases {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 6px 14px 14px;
}
@media (min-width: 640px) {
  .lista-clases {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .titulo-grado {
    margin: 0 20px 6px;
    padding: 32px 0 10px;
  }
}


@media (min-width: 1024px) {
  .contenido {
    max-width: 960px;
    margin: 0 auto;
  }

  .lista-clases {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    padding: 8px 20px 18px;
  }
}

/* ── Tarjeta de clase ── */
.clase {
  background: var(--blanco);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  box-shadow: 0 2px 10px var(--sombra), 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(155, 26, 26, 0.07);
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  animation: aparecer 0.38s ease both;
}

.clase:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 24px var(--sombra), 0 2px 6px rgba(0, 0, 0, 0.07);
}

.clase:active {
  transform: scale(0.985);
}

/* Animación de entrada escalonada */
.lista-clases .clase:nth-child(1)  { animation-delay: 0.04s; }
.lista-clases .clase:nth-child(2)  { animation-delay: 0.08s; }
.lista-clases .clase:nth-child(3)  { animation-delay: 0.12s; }
.lista-clases .clase:nth-child(4)  { animation-delay: 0.16s; }
.lista-clases .clase:nth-child(5)  { animation-delay: 0.20s; }
.lista-clases .clase:nth-child(6)  { animation-delay: 0.24s; }
.lista-clases .clase:nth-child(7)  { animation-delay: 0.28s; }
.lista-clases .clase:nth-child(8)  { animation-delay: 0.32s; }
.lista-clases .clase:nth-child(9)  { animation-delay: 0.36s; }
.lista-clases .clase:nth-child(10) { animation-delay: 0.40s; }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Imagen de la portada ── */
.imagen-obra {
  width: 82px;
  height: 82px;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e8ddd0; /* color mientras carga la imagen */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.imagen-obra img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  .imagen-obra {
    width: 88px;
    height: 88px;
  }
}

/* ── Datos de la clase ── */
.datos-clase {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nombre-obra {
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.95rem, 2.5vw, 1.08rem);
  font-weight: 700;
  color: var(--texto);
  line-height: 1.3;
}

.ubicacion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-family: 'Crimson Pro', serif;
  font-size: clamp(0.82rem, 2vw, 0.92rem);
  color: var(--gris);
}

/* Etiqueta roja con el grupo (ej: 7-A) */
.etiqueta-grupo {
  background: var(--rojo);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.punto {
  color: var(--linea);
  font-size: 1rem;
}

.nombre-aula {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Pie de página ── */
.pie {
  text-align: center;
  padding: 24px 0 36px;
}

.texto-pie {
  font-family: 'Crimson Pro', serif;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gris);
  opacity: 0.6;
}
