/**
 * WP Aprende: estilos de temas, índice lateral, lecciones y progreso.
 * Usa las variables del tema Gob.bo si existen; si no, valores por defecto.
 */

/* ---------- Listado /aprende/ ---------- */

.aprende-titulo-listado {
  margin-bottom: 0.25rem;
}

.aprende-subtitulo-listado {
  font-size: 16px;
  line-height: 24px;
  color: var(--texto-default, #343a40);
  margin-bottom: 0.5rem;
}

.aprende-index {
  margin: 1rem 0;
}

.aprende-index__titulo {
  margin-bottom: 0.25rem;
}

.aprende-index__subtitulo {
  color: var(--texto-default, #343a40);
  margin-bottom: 1rem;
}

.aprende-grid {
  margin-top: 1rem;
}

/* Tarjetas de reserva (solo si WP Flexible Cards no está activo) */

.aprende-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--primary-main, #424740);
  border-radius: 20px;
  overflow: hidden;
  background: var(--background-paper, #ffffff);
  color: var(--texto-default, #343a40);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aprende-card:hover {
  transform: scale(1.008);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: var(--texto-default, #343a40);
}

.aprende-card__imagen {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.aprende-card__icono {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem 0;
  font-size: 2.5rem;
  line-height: 1;
}

.aprende-card__icono img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.aprende-card__cuerpo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
}

.aprende-card__etiqueta {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-main, #424740);
}

.aprende-card__titulo {
  font-size: 20px;
  line-height: 1.3;
  margin: 0;
}

.aprende-card__desc {
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.aprende-card__enlace {
  margin-top: 0.5rem;
  font-weight: 700;
  color: var(--primary-main, #424740);
}

.aprende-vacio {
  padding: 1rem 1.25rem;
  border: 1px dashed #adb5bd;
  border-radius: 12px;
  color: #5f6368;
  margin: 1rem 0;
}

/* ---------- Página de tema ---------- */

.aprende-tema {
  --aprende-color: var(--primary-main, #424740);
  margin-top: 0.5rem;
}

.aprende-hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.aprende-hero__imagen {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 16px;
}

.aprende-hero__icono {
  display: inline-block;
  font-size: 2.5rem;
  line-height: 1;
}

.aprende-hero__icono img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.aprende-hero__titulo {
  margin: 0 0 0.35rem;
}

.aprende-hero__intro {
  font-size: 17px;
  line-height: 1.6;
  color: var(--texto-default, #343a40);
  margin: 0;
  max-width: 70ch;
}

/* Barra de progreso */

.aprende-progreso {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.aprende-progreso__barra {
  flex: 1 1 220px;
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.aprende-progreso__relleno {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--aprende-color, var(--primary-main, #424740));
  transition: width 0.3s ease;
}

.aprende-progreso__texto {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--texto-default, #343a40);
}

/* Layout: índice + contenido */

.aprende-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

.aprende-side {
  position: sticky;
  top: 1.5rem;
}

/* Índice lateral */

.aprende-indice {
  border: 1px solid #d9d9d9;
  border-radius: 16px;
  padding: 1rem 1rem 0.75rem;
  background: var(--background-paper, #f8f9fa);
}

.aprende-indice__titulo {
  margin: 0 0 0.5rem;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--texto-default, #343a40);
  opacity: 0.75;
}

.aprende-indice__lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.aprende-indice__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--texto-default, #343a40);
  font-size: 15px;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease;
}

.aprende-indice__link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.aprende-indice__numero {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.aprende-indice__texto {
  flex: 1 1 auto;
}

.aprende-indice__check {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--aprende-color, var(--primary-main, #424740));
  opacity: 0.4;
}

.aprende-indice__link.is-active {
  background: color-mix(in srgb, var(--aprende-color, #424740) 14%, transparent);
  font-weight: 700;
}

.aprende-indice__link.is-active .aprende-indice__numero {
  background: var(--aprende-color, var(--primary-main, #424740));
  color: #ffffff;
}

.aprende-indice__item.is-done .aprende-indice__check {
  background: var(--aprende-color, var(--primary-main, #424740));
  border-color: var(--aprende-color, var(--primary-main, #424740));
  opacity: 1;
}

.aprende-indice__reset {
  margin-top: 0.75rem;
  width: 100%;
  border: 1px solid #ced4da;
  background: transparent;
  color: var(--texto-default, #343a40);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.aprende-indice__reset:hover {
  border-color: var(--aprende-color, var(--primary-main, #424740));
}

/* Lecciones */

.aprende-leccion {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #e9ecef;
  scroll-margin-top: 1.5rem;
}

.aprende-leccion:last-of-type {
  border-bottom: 0;
}

.aprende-leccion__cabecera {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.aprende-leccion__numero {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--aprende-color, var(--primary-main, #424740));
  color: #ffffff;
  font-weight: 700;
}

.aprende-leccion__titulo {
  flex: 1 1 auto;
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.aprende-leccion__intro {
  font-size: 17px;
  line-height: 1.6;
  color: var(--texto-default, #343a40);
  margin: 0 0 1rem;
}

.aprende-leccion__contenido {
  font-size: 16px;
  line-height: 1.7;
  color: var(--texto-default, #343a40);
}

.aprende-leccion__contenido > *:first-child {
  margin-top: 0;
}

.aprende-leccion__contenido > *:last-child {
  margin-bottom: 0;
}

.aprende-leccion__contenido h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 20px;
  line-height: 1.3;
}

.aprende-leccion__contenido h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 17px;
  line-height: 1.35;
}

.aprende-leccion__contenido ul,
.aprende-leccion__contenido ol {
  padding-left: 1.25rem;
}

.aprende-leccion__contenido li {
  margin-bottom: 0.35rem;
}

/* Aviso / nota destacada */

.aprende-aviso {
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
  border-left: 4px solid var(--aprende-color, var(--primary-main, #424740));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  background: color-mix(in srgb, var(--aprende-color, #424740) 8%, transparent);
  font-size: 15px;
  line-height: 1.6;
}

[data-theme="dark"] .aprende-aviso {
  background: rgba(255, 255, 255, 0.06);
  background: color-mix(in srgb, var(--aprende-color, #8ab4a0) 22%, transparent);
}

/* Botón "marcar como vista" */

.aprende-completar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #ced4da;
  background: transparent;
  color: var(--texto-default, #343a40);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.aprende-completar:hover {
  border-color: var(--aprende-color, var(--primary-main, #424740));
}

.aprende-completar__marca {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  box-sizing: border-box;
}

.aprende-completar[aria-pressed="true"] {
  background: var(--aprende-color, var(--primary-main, #424740));
  border-color: var(--aprende-color, var(--primary-main, #424740));
  color: #ffffff;
}

.aprende-completar[aria-pressed="true"] .aprende-completar__texto {
  font-weight: 700;
}

/* Otros temas */

.aprende-otros {
  margin-top: 1.5rem;
}

.aprende-otros__titulo {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.aprende-otros__lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.aprende-otros__lista a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--primary-main, #424740);
  border-radius: 999px;
  text-decoration: none;
  color: var(--texto-default, #343a40);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.aprende-otros__lista a:hover {
  background: var(--primary-main, #424740);
  color: #ffffff;
}

.aprende-otros__cuenta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  font-size: 12px;
}

/* ---------- Modo oscuro ---------- */

[data-theme="dark"] .aprende-indice,
.aprende-indice {
  border-color: #3a3a3d;
}

[data-theme="dark"] .aprende-leccion {
  border-bottom-color: #3a3a3d;
}

[data-theme="dark"] .aprende-progreso__barra {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .aprende-indice__link:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .aprende-indice__numero {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .aprende-otros__lista a:hover {
  color: #ffffff;
}

[data-theme="dark"] .aprende-otros__cuenta {
  background: rgba(255, 255, 255, 0.15);
}

/* ---------- Responsive ---------- */

@media only screen and (max-width: 991.98px) {
  .aprende-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .aprende-side {
    position: static;
  }

  .aprende-leccion__titulo {
    font-size: 22px;
  }

  .aprende-leccion__cabecera {
    flex-wrap: wrap;
  }

  .aprende-completar {
    order: 3;
    margin-left: auto;
  }
}

@media only screen and (max-width: 575.98px) {
  .aprende-leccion__cabecera {
    gap: 0.6rem;
  }

  .aprende-completar__texto {
    display: none;
  }
}
