/*
Theme Name: Alabanza Peruana
Theme URI: https://alabanzaperuana.com
Author: Desarrollador Web Full Stack
Author URI: https://alabanzaperuana.com
Description: Tema premium de alto rendimiento para WordPress sin constructores visuales. Diseñado para 100/100 PageSpeed, PWA, SEO optimizado y soporte completo para modo oscuro sin emojis.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: alabanza-peruana
*/

/* ==========================================================================
   1. VARIABLES DE DISEÑO & MODO OSCURO
   ========================================================================== */
:root {
  --primary: #231E94;
  --primary-hover: #1b1772;
  --primary-light: #ecebfb;
  --bg-color: #f4f6f9;
  --card-bg: #ffffff;
  --text-color: #1a1a1a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --header-text: #ffffff;
  --header-border: rgba(255, 255, 255, 0.12);
  --header-bg: #231E94;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --container-max: 1200px;
}

/* dark-mode en body Y en html (para cubrir FOUC desde header.php) */
body.dark-mode,
html.dark-mode {
  --bg-color: #0f0f0f;
  --card-bg: #1a1a1a;
  --text-color: #f0f0f0;
  --text-muted: #a0a0a0;
  --border-color: #2e2e2e;
  --header-bg: rgba(15, 15, 15, 0.92);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --primary-light: #1e1a5a;
}

html.dark-mode body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* ── Modo oscuro: títulos y links en tarjetas deben ser claros, NO color primario ── */
body.dark-mode .card-title a,
body.dark-mode .card-title a:visited {
  color: #f0f0f0;
}

body.dark-mode .card-title a:hover {
  color: #c5c3f5;
}

body.dark-mode .pelicula-card-title a,
body.dark-mode .pelicula-card-title a:visited {
  color: #f0f0f0;
}

body.dark-mode .ritmo-title a,
body.dark-mode .ritmo-title a:visited {
  color: #f0f0f0;
}

body.dark-mode .read-more-link {
  color: #8b88e8;
}

body.dark-mode .sidebar-widget ul li a {
  color: #d0d0d0;
}

body.dark-mode .sidebar-widget ul li a:hover {
  color: #c5c3f5;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Evitar scroll horizontal en toda la página */
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.site-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ==========================================================================
   3. HEADER & NAVEGACIÓN
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #231E94;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
}

body.dark-mode .site-header {
  background-color: #1a1660;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-color);
  flex-shrink: 0;
}

.header-brand a {
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-brand .brand-badge {
  background-color: var(--primary);
  color: #ffffff;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-logo-img {
  display: inline-block;
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  vertical-align: middle;
  transition: opacity 0.25s ease;
}

.header-brand a:hover .header-logo-img {
  opacity: 0.88;
}

.header-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-menu li a {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
  position: relative;
}

.nav-menu li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #ffffff;
  transition: var(--transition);
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a {
  color: #ffffff;
}

.nav-menu li a:hover::after,
.nav-menu li.current-menu-item > a::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buscador en Header */
.header-search {
  position: relative;
}

.header-search-form {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  transition: var(--transition);
}

.header-search-form:focus-within {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.header-search-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 30, 148, 0.15);
}

.header-search-input {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 0.875rem;
  outline: none;
  width: 130px;
  transition: width 0.3s ease;
}

.header-search-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.header-search-input:focus {
  width: 190px;
}

.header-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s ease;
}

.header-search-btn:hover {
  color: #ffffff;
}

/* Botón Modo Oscuro */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.theme-toggle-btn .icon-moon {
  display: block;
}
.theme-toggle-btn .icon-sun {
  display: none;
}

body.dark-mode .theme-toggle-btn .icon-moon {
  display: none;
}
body.dark-mode .theme-toggle-btn .icon-sun {
  display: block;
}

/* Menú Hamburguesa Móvil */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* ==========================================================================
   4. LAYOUT PRINCIPAL & CONTENIDO
   ========================================================================== */
.site-main {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 3.5rem;
}

.main-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
}

.page-content-full {
  width: 100%;
}

/* Tarjetas Estándar (Index, Categorías) */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.post-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(35, 30, 148, 0.3);
}

.card-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background-color: var(--border-color);
}

.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .card-thumbnail img {
  transform: scale(1.05);
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-category {
  color: var(--primary);
  font-weight: 600;
}

.card-title {
  font-size: 1.25rem;
  line-height: 1.35;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.card-title a {
  color: var(--text-color);
}

.card-title a:hover {
  color: var(--primary);
}

.card-excerpt {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex: 1;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.read-more-link svg {
  transition: transform 0.2s ease;
}

.read-more-link:hover svg {
  transform: translateX(4px);
}

/* Paginación */
.pagination {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
}

.pagination .nav-links {
  display: flex;
  gap: 0.5rem;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-weight: 600;
  font-size: 0.9rem;
}

.pagination .page-numbers.current {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   5. SHORTCODE: PORTADA MAGAZINE [portada_magazine]
   ========================================================================== */
.magazine-section {
  margin-bottom: 4rem;
  /* Evitar que el grid desborde la pantalla */
  overflow: hidden;
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-color);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 0;
  width: 60px;
  height: 2px;
  background-color: var(--primary);
}

/* ── Layout principal: 2 columnas (grande | grid 2x2) ── */
.magazine-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 2.25rem;
  /* Crítico: el grid nunca debe salirse del contenedor */
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

/* ── Post grande (izquierda) ── */
.magazine-main-card-link {
  display: block;
  text-decoration: none;
  height: 100%;
}

.magazine-main-card {
  position: relative;
  width: 100%;
  height: 100%;
  /* clamp: mínimo 240px, ideal 38vw, máximo 460px */
  min-height: clamp(240px, 38vw, 460px);
  background-color: #1a1660;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow-md);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.magazine-main-card-link:hover .magazine-main-card {
  transform: scale(1.012);
  box-shadow: var(--shadow-lg);
}

.magazine-main-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.88) 0%,
    rgba(0,0,0,0.35) 55%,
    rgba(0,0,0,0.05) 100%
  );
}

.magazine-main-content {
  position: relative;
  z-index: 2;
  padding: 1.75rem 1.85rem;
  width: 100%;
}

.magazine-main-content .mag-category {
  display: inline-block;
  background-color: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.22rem 0.7rem;
  border-radius: 9999px;
  margin-bottom: 0.6rem;
}

.magazine-main-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.22;
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
}

.magazine-main-date {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.58);
}

/* ── Grid 2x2 derecha ── */
.magazine-side-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.85rem;
  /* Nunca debe desbordar su celda del grid padre */
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

/* ── Tarjetas pequeñas del grid 2x2 ── */
.magazine-small-card-link {
  display: block;
  text-decoration: none;
  height: 100%;
}

.magazine-small-card {
  position: relative;
  width: 100%;
  height: 100%;
  /* Altura adaptativa según el ancho disponible */
  min-height: clamp(110px, 20vw, 180px);
  background-color: #231E94;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.magazine-small-card-link:hover .magazine-small-card {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.magazine-small-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.82) 0%,
    rgba(0,0,0,0.25) 55%,
    transparent 100%
  );
}

.magazine-small-content {
  position: relative;
  z-index: 2;
  padding: 0.75rem 0.85rem;
  width: 100%;
}

.magazine-small-content .mag-category {
  display: inline-block;
  background-color: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  margin-bottom: 0.28rem;
}

.magazine-small-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,0.65);
}

.magazine-small-date {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.58);
}

/* ── Botón ver todo ── */
.magazine-footer-btn-wrap {
  text-align: center;
  margin-top: 2.25rem;
}

.btn-primary-magazine {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--primary);
  color: #ffffff;
  padding: 0.85rem 2rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(35, 30, 148, 0.35);
  transition: var(--transition);
}

.btn-primary-magazine:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(35, 30, 148, 0.45);
}


/* ==========================================================================
   6. SHORTCODE: CARRUSEL PELICULAS [carrusel_peliculas]
   ========================================================================== */

/* Encabezado de sección: título izquierda, botones derecha */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-color);
  position: relative;
  padding-bottom: 0.6rem;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
}

.carousel-section {
  margin-bottom: 4rem;
  position: relative;
  /* Evitar que el swiper cause scroll horizontal */
  overflow: hidden;
}

/* Contenedores Swiper — overflow:hidden OBLIGATORIO */
.ap-swiper-peliculas,
.ap-swiper-ritmos {
  overflow: hidden;
  width: 100%;
  /* Asegurar que los slides no desborden */
  min-width: 0;
}

.ap-swiper-peliculas .swiper-slide {
  height: auto;
  /* Tamaño base: en mobile se ven 2 tarjetas cómodamente */
  width: auto;
}

.ap-swiper-ritmos .swiper-slide {
  height: auto;
  width: auto;
}

.swiper-pelicula-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;  /* necesita que el .swiper-slide sea height:auto */
  position: relative;
  transition: var(--transition);
}

.swiper-pelicula-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.pelicula-thumbnail-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: #000000;
}

.pelicula-thumbnail-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.swiper-pelicula-card:hover .pelicula-thumbnail-wrap img {
  transform: scale(1.08);
}

.pelicula-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

.swiper-pelicula-card:hover .pelicula-overlay {
  opacity: 1;
}

.play-badge-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background-color: rgba(35, 30, 148, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.swiper-pelicula-card:hover .play-badge-icon {
  transform: scale(1.15);
  background-color: var(--primary);
}

.pelicula-card-info {
  padding: 1rem;
}

.pelicula-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-color);
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pelicula-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   7. SHORTCODE: CARRUSEL RITMOS [carrusel_ritmos]
   ========================================================================== */
.swiper-ritmo-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  height: 120px;
  transition: var(--transition);
}

.swiper-ritmo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.ritmo-thumbnail {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.ritmo-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ritmo-info {
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  line-height: 1.2;
}

.ritmo-info .ritmo-tag {
  font-size: 0.725rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.ritmo-info .ritmo-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.35rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ritmo-info .ritmo-date {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Controles de Swiper */
.swiper-nav-buttons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.swiper-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  /* Asegurar que sea clickeable */
  position: relative;
  z-index: 10;
  user-select: none;
}

.swiper-nav-btn:hover,
.swiper-nav-btn:focus-visible {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  outline: none;
}

.swiper-nav-btn:active {
  transform: scale(0.92);
}

/* Estado deshabilitado */
.swiper-nav-btn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   8. PÁGINA INDIVIDUAL (single.php)
   ========================================================================== */
.single-article {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
}

.single-header {
  margin-bottom: 1.75rem;
}

.single-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.single-category-badge {
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.775rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.single-title {
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 1rem;
}

.single-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

/* Contenedor Responsive 16:9 para Video */
.video-embed-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 2rem;
  background-color: #000000;
  box-shadow: var(--shadow-md);
}

.video-embed-container iframe,
.video-embed-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Botón de Descarga Grande (Categoría Ritmos) */
.download-action-box {
  margin: 2.5rem 0;
  padding: 2rem;
  background-color: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
  text-align: center;
}

.download-action-box h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.download-action-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-download-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background-color: var(--primary);
  color: #ffffff;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 9999px;
  box-shadow: 0 6px 20px rgba(35, 30, 148, 0.4);
  transition: var(--transition);
}

.btn-download-hero:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(35, 30, 148, 0.5);
}

.btn-download-hero svg {
  animation: downloadPulse 1.8s infinite ease-in-out;
}

@keyframes downloadPulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

.single-content {
  font-size: 1.075rem;
  line-height: 1.75;
  color: var(--text-color);
}

.single-content p {
  margin-bottom: 1.4rem;
}

.single-content h2, .single-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--text-color);
}

/* Entradas Relacionadas */
.related-posts-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-color);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   9. SIDEBAR
   ========================================================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-widget {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-color);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.sidebar-widget ul {
  list-style: none;
}

.sidebar-widget ul li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-widget ul li:last-child {
  border-bottom: none;
}

.sidebar-widget ul li a {
  color: var(--text-color);
  font-size: 0.925rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-widget ul li a:hover {
  color: var(--primary);
  padding-left: 4px;
}

/* ==========================================================================
   10. FOOTER
   ========================================================================== */
.site-footer {
  background-color: #231E94;
  border-top: none;
  padding-top: 3.5rem;
  padding-bottom: 2rem;
  margin-top: auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand .footer-logo-svg,
.footer-brand .footer-logo-wrap {
  margin-bottom: 1rem;
}

.footer-logo-img {
  display: inline-block;
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  filter: brightness(0) invert(1); /* hace el logo blanco sobre fondo azul */
  transition: opacity 0.25s ease;
}

.footer-logo-img:hover {
  opacity: 0.8;
}

.footer-brand h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: #ffffff;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.925rem;
  max-width: 380px;
}

.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.65rem;
}

.footer-col ul li a {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-col ul li a:hover {
  color: #ffffff;
  padding-left: 4px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   11. RESPONSIVE / MEDIA QUERIES
   ========================================================================== */
/* ==========================================================================
   11. RESPONSIVE / MEDIA QUERIES
   ========================================================================== */

/* ── Tablet grande (≤1024px) ── */
@media (max-width: 1024px) {
  .main-with-sidebar {
    grid-template-columns: 1fr;
  }

  .magazine-grid {
    grid-template-columns: 1fr;
  }

  .magazine-main-card {
    min-height: 300px;
    aspect-ratio: 16 / 7;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {
  .mobile-nav-toggle {
    display: flex;
  }

  .header-nav {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 999;
  }

  .header-nav.is-open {
    display: flex;
  }

  .nav-menu {
    flex-direction: column;
    width: 100%;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav-menu li {
    width: 100%;
  }

  .nav-menu li a {
    display: block;
    padding: 0.5rem 0;
    font-size: 1.05rem;
    color: var(--text-color);
  }

  .nav-menu li a::after {
    background-color: var(--primary);
  }

  .header-search {
    display: none;
  }

  .magazine-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .magazine-main-card {
    /* En tablet: altura proporcional a la pantalla */
    min-height: clamp(200px, 40vw, 300px);
    aspect-ratio: 16 / 8;
  }

  .magazine-side-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .magazine-small-card {
    /* Altura relativa al ancho disponible en grid de 2 columnas */
    min-height: clamp(100px, 28vw, 150px);
  }

  .magazine-main-content {
    padding: 1.25rem 1.5rem;
  }

  .magazine-main-title {
    font-size: clamp(1rem, 4vw, 1.3rem);
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .single-title {
    font-size: 1.75rem;
  }

  .single-article {
    padding: 1.5rem;
  }

  /* Carruseles: overflow hidden para que no desborden */
  .carousel-section {
    overflow: hidden;
  }

  /* Posts grid en tablet: 1 columna */
  .posts-grid {
    grid-template-columns: 1fr;
  }

  /* Botones nav swiper más accesibles en touch */
  .swiper-nav-btn {
    width: 40px;
    height: 40px;
  }
}

/* ==========================================================================
   12. MOBILE PEQUEÑO (≤480px)
   ========================================================================== */
@media (max-width: 480px) {
  /* Header compacto */
  .header-inner {
    height: 60px;
    gap: 0.75rem;
  }

  .header-logo-img {
    height: 34px;
  }

  .footer-logo-img {
    height: 32px;
  }

  .header-search {
    display: none;
  }

  /* Magazine portada: apilado vertical en móvil */
  .magazine-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .magazine-main-card {
    min-height: clamp(180px, 55vw, 250px);
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
  }

  .magazine-side-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .magazine-small-card {
    min-height: clamp(95px, 25vw, 130px);
    border-radius: var(--radius-sm);
  }

  .magazine-main-title {
    font-size: 1.1rem;
    line-height: 1.3;
  }

  .magazine-main-content {
    padding: 1rem;
  }

  /* Section headers más pequeños */
  .section-title {
    font-size: 1.15rem;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Posts grid: 1 columna, tarjeta horizontal compacta */
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .post-card {
    flex-direction: row;
    height: auto;
    min-height: 100px;
  }

  .card-thumbnail {
    width: 120px;
    flex-shrink: 0;
    aspect-ratio: auto;
    min-height: 100px;
  }

  /* Footer compacto */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    font-size: 0.78rem;
  }

  /* Site container: padding reducido */
  .site-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Single article */
  .single-title {
    font-size: 1.4rem;
  }

  .single-article {
    padding: 1rem;
    border-radius: var(--radius-sm);
  }

  /* Paginación */
  .pagination {
    gap: 0.25rem;
  }

  /* Botones Swiper más grandes en móvil (facilita el toque) */
  .swiper-nav-btn {
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   13. CORRECCIONES GLOBALES ANTI OVERFLOW
   ========================================================================== */

/* Cualquier imagen o embed no debe romper el layout */
iframe, embed, object, video {
  max-width: 100%;
}

/* El wrapper del swiper nunca debe desbordar su contenedor */
.swiper-wrapper {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Asegurar que .swiper-slide respete el contenedor */
.swiper-slide {
  box-sizing: border-box;
  min-width: 0;
}

