/**
 * 📂 Archivo: assets/css/main.css
 * 🎯 Qué hace: utilidades del LMS Cursora.
 * Consume tokens generados por theme.json (--wp--preset--* y --wp--custom--*).
 * NO duplica valores: si cambias paleta/tokens en theme.json, esto sigue.
 */

/* =========================================================
   1) Accesibilidad: focus visible global
   ========================================================= */
:focus-visible {
  outline: none;
  box-shadow: var(--wp--custom--shadow--focus);
  border-radius: var(--wp--custom--radius--small);
}

/* =========================================================
   2) Tarjeta de curso (.mtac-curso-card)
   ========================================================= */
.mtac-curso-card {
  background: var(--wp--preset--color--blanco);
  border: 1px solid var(--wp--preset--color--aula-gris-100);
  border-radius: var(--wp--custom--radius--card);
  box-shadow: var(--wp--custom--shadow--card);
  padding: 1.25rem;
  transition: transform var(--wp--custom--transition--normal),
              box-shadow var(--wp--custom--transition--normal);
}
.mtac-curso-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--wp--custom--shadow--card-hover);
}
.mtac-curso-card__title {
  font-family: var(--wp--preset--font-family--serif);
  color: var(--wp--preset--color--aula-azul);
  margin: 0 0 .5rem;
}

/* ----- Catálogo /cursos/ : grid uniforme ----- */

/* Cada tarjeta se estira a la altura de la fila */
.mtac-cursos-grid.is-layout-grid > .wp-block-post {
  display: flex;
  align-self: stretch;
}
.mtac-cursos-grid .mtac-curso-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Imagen destacada con aspect-ratio fija */
.mtac-curso-card__media {
  margin: 0;
  border-radius: var(--wp--custom--radius--small, 6px);
  overflow: hidden;
  background: var(--wp--preset--color--aula-gris-100);
}
.mtac-curso-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder cuando NO hay imagen destacada (figura vacía) */
.mtac-curso-card .wp-block-post-featured-image:not(:has(img)),
.mtac-curso-card figure.wp-block-post-featured-image:empty {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg,
              var(--wp--preset--color--aula-azul) 0%,
              #3b82f6 100%);
  border-radius: var(--wp--custom--radius--small, 6px);
  position: relative;
}
.mtac-curso-card .wp-block-post-featured-image:not(:has(img))::after {
  content: "📚";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3rem;
  opacity: .85;
}

/* Excerpt: empuja al final para alinear bordes */
.mtac-curso-card__excerpt {
  margin-top: auto;
  color: var(--wp--preset--color--aula-gris-600);
  font-size: .95rem;
}

/* Limitar título a 2 líneas */
.mtac-curso-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.6em;
  line-height: 1.3;
  font-size: 1.15rem;
}

/* Limitar excerpt a 3 líneas (recorte visual, no toca el contenido real) */
.mtac-curso-card__excerpt p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.5;
}

/* Ocultar "Leer más" duplicado del excerpt */
.mtac-curso-card__excerpt .wp-block-post-excerpt__more-link,
.mtac-curso-card__excerpt .wp-block-post-excerpt__more-text {
  display: none;
}

/* =========================================================
   3) Barra de progreso (.mtac-progreso)
   ========================================================= */
.mtac-progreso {
  width: 100%;
  height: var(--wp--custom--lms--progress-height);
  background: var(--wp--preset--color--aula-gris-100);
  border-radius: 999px;
  overflow: hidden;
}
.mtac-progreso__bar {
  height: 100%;
  background: var(--wp--preset--color--aula-verde);
  border-radius: 999px;
  transition: width var(--wp--custom--transition--slow);
}

/* =========================================================
   4) Lección bloqueada (.mtac-leccion--bloqueada)
   ========================================================= */
.mtac-leccion--bloqueada {
  opacity: .55;
  pointer-events: none;
  position: relative;
}
.mtac-leccion--bloqueada::after {
  content: "🔒";
  position: absolute;
  top: .5rem;
  right: .75rem;
  color: var(--wp--preset--color--aula-rojo);
  font-size: 1.1rem;
}

/* =========================================================
   5) Avatar (.mtac-avatar)
   ========================================================= */
.mtac-avatar {
  width:  var(--wp--custom--lms--avatar-size);
  height: var(--wp--custom--lms--avatar-size);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--wp--preset--color--aula-gris-100);
}

/* =========================================================
   6) Hero gradient utility
   ========================================================= */
.mtac-hero {
  background: var(--wp--preset--gradient--aula-gradient-hero);
  color: var(--wp--preset--color--blanco);
  padding: 3rem 1.5rem;
  border-radius: var(--wp--custom--radius--hero);
}
.mtac-hero h1,
.mtac-hero h2 {
  color: var(--wp--preset--color--blanco);
}
