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

:root {
  --bg:          #0d0d0d;
  --bg-card:     #1a1a1a;
  --text:        #f0f0f0;
  --text-muted:  #999;
  --border:      #222;
  --gap-desktop: 8px;
  --gap-mobile:  5px;
  --cols:        6;
  --radius:      10px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: 3rem;
}

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
  width: 100%;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.logo-img {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* ─── Título de materia ───────────────────────────────────── */
.titulo-materia-wrap {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
}

.titulo-materia {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.2;
}

/* ─── Sección por grupo ───────────────────────────────────── */
.tema-section {
  padding: 0 12px 1.75rem;
  animation: fadeUp 0.3s ease both;
}

.tema-titulo {
  font-size: clamp(0.78rem, 2vw, 0.92rem);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  padding-left: 2px;
  letter-spacing: 0.01em;
}

/* ─── Grid de imágenes ────────────────────────────────────── */
.img-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap-desktop);
}

/* ─── Tarjeta imagen ratio 4:7 ───────────────────────────── */
.img-card {
  aspect-ratio: 4 / 7;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  text-decoration: none;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
}

.img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s ease, opacity 0.18s;
}

.img-card:hover img {
  transform: scale(1.04);
  opacity: 0.88;
}

.img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 1.4rem;
  background: var(--bg-card);
}

/* ─── Animación ───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Móvil ───────────────────────────────────────────────── */
@media (max-width: 640px) {

  .site-header {
    padding: 8px 14px;
  }

  .logo-img {
    height: 28px;
  }

  .titulo-materia-wrap {
    padding: 1rem 0.75rem 0.75rem;
  }

  .tema-section {
    padding: 0 7px 1.2rem;
  }

  .img-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-mobile);
  }

  .img-card {
    border-radius: 7px;
  }
}
