/* PortalGraf Next 0.5.52 — separación estructural de módulos laterales.
   Solo se carga si existe un módulo en sidebar-left o sidebar-right.
   Sin modificar estilos internos de módulos ni anchuras de columnas. */
.pg-next .pg-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  row-gap: 20px;
}
.pg-next .pg-sidebar > * {
  min-width: 0;
  margin-block: 0;
  box-sizing: border-box;
  max-width: 100%;
}
/* Los módulos card de Cassiopeia y sus contenidos no deben forzar el
   ancho de la columna: misma geometría para ambas barras laterales. */
.pg-next .pg-sidebar :is(.card, .card-body, .card-header, .moduletable, .mod-custom) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.pg-next .pg-sidebar :is(img, picture, video, iframe, table) {
  max-width: 100%;
}
.pg-next .pg-sidebar :is(.card-body, .mod-custom) {
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .pg-next .pg-sidebar { row-gap: 16px; }
}

/* El primer módulo visual y Popular en PortalGraf usan la presentación
   editorial abierta. Popular conserva este aspecto aunque exista un módulo
   gráfico antes de él. Sus tarjetas internas mantienen su propia carcasa. */
body.pg-next .pg-sidebar--left > :is(.card:first-child, .card:has(.pg-popular)) {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
body.pg-next .pg-sidebar--left > :is(.card:first-child, .card:has(.pg-popular)) > .card-header {
  padding: 0 0 .9rem;
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
}
body.pg-next .pg-sidebar--left > :is(.card:first-child, .card:has(.pg-popular)) > .card-body {
  padding: 0;
  background: transparent;
  border: 0;
}

/* v0.5.66 · jerarquía de la barra izquierda abierta.
   Acento integrado en el título del primer módulo, sin invadir el canal
   entre columnas ni alterar la geometría de las tarjetas internas. */
body.pg-next .pg-sidebar--left > :is(.card:first-child, .card:has(.pg-popular)) > .card-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: .3rem;
  width: 42px;
  height: 2px;
  border-radius: 2px;
  background: var(--pg-green);
}

/* Ritmo de listados de titulares de la columna derecha, sin tocar tarjetas
   ni listas de navegación de otras zonas. */
body.pg-next .pg-sidebar--right .card-body ul:not([class]) > li + li,
body.pg-next .pg-sidebar--right .mod-custom ul:not([class]) > li + li {
  margin-top:.55rem;
}

/* Opt-in del módulo de lecturas relacionadas: asignar clase pg-related-links en Joomla.
   Se conserva el chrome card general de los demás módulos. */
body.pg-next .pg-sidebar--right > .card.pg-related-links {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
body.pg-next .pg-sidebar--right > .card.pg-related-links > .card-header {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0 0 1rem;
  white-space: normal;
}
body.pg-next .pg-sidebar--right > .card.pg-related-links > .card-header::after {
  content: "";
  position: absolute;
  bottom: .4rem;
  left: 0;
  width: 42px;
  height: 2px;
  background: var(--pg-green, #258362);
}
body.pg-next .pg-sidebar--right > .card.pg-related-links > .card-body {padding:0; background:transparent;}
body.pg-next .pg-sidebar--right > .card.pg-related-links .card-body li,
body.pg-next .pg-sidebar--right > .card.pg-related-links .card-body > a {
  border-left: 2px solid #e1e9e5;
  padding-left: .65rem;
  margin-block: .5rem;
  overflow-wrap: break-word;
}

/* PortalGraf Next 0.5.54 — módulo editorial reutilizable. No afecta al cuerpo del artículo ni a la cabecera. */
.pg-next {
  --pg-mod-title: #174d40;
  --pg-mod-copy: #253832;
  --pg-mod-link: #155b95;
  --pg-mod-hover: #0c4675;
  --pg-mod-border: #dce7e0;
  --pg-mod-tint: #f7f9f8;
}
/* Módulos actualmente renderizados por Cassiopeia: conservar geometría, afinar jerarquía. */
.pg-next :is(.pg-sidebar, .pg-primary-content > .moduletable, .pg-main-bottom, .pg-modules-band) :is(.card-header, .card > h2, .card > h3, .moduletable > h2, .moduletable > h3) {
  color: var(--pg-mod-title);
  font-size: clamp(1.075rem, 1.06rem + .15vw, 1.25rem);
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -.01em;
}
.pg-next :is(.pg-sidebar, .pg-main-bottom, .pg-modules-band) :is(.card-body, .mod-custom, .moduletable) { color: var(--pg-mod-copy); }
.pg-next :is(.pg-sidebar, .pg-main-bottom, .pg-modules-band) a:not(.btn):not(.badge) {
  color: var(--pg-mod-link);
  text-decoration-color: transparent;
  text-underline-offset: .16em;
}
.pg-next :is(.pg-sidebar, .pg-main-bottom, .pg-modules-band) a:not(.btn):not(.badge):is(:hover, :focus-visible) {
  color: var(--pg-mod-hover);
  text-decoration: underline;
}
/* Encabezados Cassiopeia: suavizar la superficie, no alterar la rejilla ni el contenido. */
.pg-next .pg-sidebar .card > .card-header {
  background: #f8faf9;
  border-bottom-color: var(--pg-mod-border);
}
/* Enlaces por defecto: azul editorial distinguible del verde de los títulos.
   Respetar los botones, insignias y cualquier navegación fuera del contenido. */
.pg-next :is(.pg-sidebar, .pg-main-bottom, .pg-modules-band) a:not(.btn):not(.badge):focus-visible {
  outline: 2px solid var(--pg-mod-link);
  outline-offset: 3px;
}
/* Tres estilos optativos (Advanced > Module Style), independientes de la posición. */
.pg-next .pg-module { min-width: 0; color: var(--pg-mod-copy); }
.pg-next .pg-module__title {
  margin: 0 0 .85rem;
  color: var(--pg-mod-title);
  font-size: clamp(1.075rem, 1.06rem + .15vw, 1.25rem);
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -.012em;
}
.pg-next .pg-module__body { min-width: 0; }
.pg-next .pg-module__body > :last-child { margin-bottom: 0; }
.pg-next .pg-module a:not(.btn):not(.badge) { color: var(--pg-mod-link); text-decoration-color: transparent; text-underline-offset: .16em; }
.pg-next .pg-module a:not(.btn):not(.badge):is(:hover, :focus-visible) { color: var(--pg-mod-hover); text-decoration: underline; }
.pg-next .pg-module--editorial { padding: .2rem 0; background: transparent; border: 0; }
.pg-next .pg-module--editorial .pg-module__title { padding-bottom: .6rem; border-bottom: 1px solid var(--pg-mod-border); }
.pg-next .pg-module--card { padding: 1.1rem; background: #fff; border: 1px solid var(--pg-mod-border); border-radius: 12px; }
.pg-next .pg-module--hybrid .pg-module__title { padding-left: .8rem; border-left: 3px solid #f28c20; }
.pg-next .pg-module--hybrid .pg-module__body { background: var(--pg-mod-tint); border: 1px solid var(--pg-mod-border); border-radius: 10px; padding: 1rem; }
/* Modos de distribución opcionales, sobre el contenido directo que produzca el módulo.
   No fuerzan listados internos de terceros ni provocan desbordamientos. */
.pg-next .pg-module.pg-layout--horizontal .pg-module__body,
.pg-next .pg-module.pg-layout--grid .pg-module__body { display: grid; gap: 1rem; align-items: start; }
.pg-next .pg-module.pg-layout--horizontal .pg-module__body { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.pg-next .pg-module.pg-layout--grid .pg-module__body { grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); }
.pg-next .pg-module.pg-layout--horizontal .pg-module__body > *,
.pg-next .pg-module.pg-layout--grid .pg-module__body > * { min-width: 0; }
@media (max-width: 640px) {
  .pg-next .pg-module--card { padding: .95rem; }
  .pg-next .pg-module--hybrid .pg-module__body { padding: .85rem; }
  .pg-next .pg-module.pg-layout--horizontal .pg-module__body,
  .pg-next .pg-module.pg-layout--grid .pg-module__body { grid-template-columns: minmax(0, 1fr); }
}

/* Acentos opcionales POR MÓDULO mediante «Clase CSS del módulo».
   No hay barras CMYK globales repetidas: sólo donde el editor las seleccione. */
.pg-next :is(.pg-module.pg-accent--cmyk, .card.pg-accent--cmyk, .moduletable.pg-accent--cmyk) {
  border-top: 0;
  position: relative;
}
.pg-next :is(.pg-module.pg-accent--cmyk, .card.pg-accent--cmyk, .moduletable.pg-accent--cmyk)::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(to right, #02a9d5 0 25%, #d92b91 25% 50%, #f0d400 50% 75%, #23282a 75% 100%);
  border-radius: 8px 8px 0 0;
}
.pg-next :is(.pg-module.pg-accent--green, .card.pg-accent--green, .moduletable.pg-accent--green) {
  border-top: 3px solid #258362;
}
.pg-next :is(.pg-module.pg-accent--orange, .card.pg-accent--orange, .moduletable.pg-accent--orange) {
  border-top: 3px solid #d57718;
}
/* El chrome editorial sin marco no debe recibir relleno de tarjeta por el acento. */
.pg-next .pg-module--editorial.pg-accent--cmyk::before { margin-bottom: .7rem; }
.pg-next .pg-module--editorial:is(.pg-accent--green,.pg-accent--orange) { padding-top: .7rem; }

/* v0.5.83 | Chrome Joomla pgRelatedEditorial: visual abierto, acento vertical.
   No modifica pgEditorial/pgHybrid ni módulos que no seleccionen este chrome. */
.pg-next .pg-module--related-editorial {
  padding: .2rem 0; background: transparent; border: 0; box-shadow: none;
}
.pg-next .pg-module--related-editorial .pg-module__title {
  padding: .12rem 0 .12rem .72rem;
  margin: 0 0 .85rem;
  border: 0; border-left: 3px solid #f28c20;
  background: transparent;
}
.pg-next .pg-module--related-editorial .pg-module__body {
  padding: 0; border: 0; background: transparent;
}
/* Lista nativa mod_related_items: separadores discretos, sin cuadros. */
.pg-next .pg-module--related-editorial .pg-module__body ul {
  list-style: none; margin: 0; padding: 0;
}
.pg-next .pg-module--related-editorial .pg-module__body li {
  margin: 0; padding: .62rem 0;
  border-bottom: 1px solid var(--pg-mod-border);
  line-height: 1.45; overflow-wrap: anywhere;
}
.pg-next .pg-module--related-editorial .pg-module__body li:first-child { padding-top: .15rem; }
.pg-next .pg-module--related-editorial .pg-module__body li:last-child { border-bottom: 0; }
.pg-next .pg-module--related-editorial .pg-module__body a {
  display: inline-block; max-width: 100%; font-weight: 400;
}

/* v0.5.86 — Chrome dedicado a PortalGraf Últimos, sin alterar pgRelatedEditorial. */
.pg-next .pg-module--latest-editorial {padding:.2rem 0;background:transparent;border:0;box-shadow:none}
.pg-next .pg-module--latest-editorial .pg-module__title {padding:.12rem 0 .12rem .72rem;margin:0 0 .85rem;border:0;border-left:3px solid #f28c20;background:transparent}
.pg-next .pg-module--latest-editorial .pg-module__body {padding:0;border:0;background:transparent}

/* PortalGraf NEXT 0.5.229 - chrome pgForumEditorial (Kunena Latest).
   Hereda las bases de presentations.css; alcance exclusivo de este chrome.
   No altera pgLatestEditorial ni el CSS propio de Kunena. */
.pg-next .pg-module--forum-editorial {
  padding: .2rem 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.pg-next .pg-module--forum-editorial .pg-module__title {
  padding: .12rem 0 .12rem .72rem;
  margin: 0 0 .85rem;
  border: 0;
  border-left: 3px solid #f28c20;
  background: transparent;
}
.pg-next .pg-module--forum-editorial .pg-module__body {
  padding: 0;
  border: 0;
  background: transparent;
  overflow-wrap: anywhere;
}
/* Mejoras locales: enlaces compactos, algo más legibles y fáciles de pulsar.
   No se fuerzan listas, iconos, avatares ni la estructura del módulo. */
.pg-next .pg-module--forum-editorial .pg-module__body a:not(.btn):not(.badge) {
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.5;
}
.pg-next .pg-module--forum-editorial .pg-module__body li + li {
  margin-top: .35rem;
}

/* El acceso a todos los temas marca la transicion entre listado y navegacion.
   Se identifica por la ruta comprobada en PortalGraf; no se modifican
   las tarjetas de temas ni enlaces de otros modulos. */
.pg-next .pg-module--forum-editorial .pg-module__body a[href*="/topics/mode-recent"] {
  display: inline-block;
  margin-top: .75rem;
}

/* Los dos accesos finales se leen como un mismo grupo. */
.pg-next .pg-module--forum-editorial .pg-forum-editorial__footer {
  margin-top: .18rem;
}
.pg-next .pg-module--forum-editorial .pg-forum-editorial__home-link {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  max-width: 100%;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.5;
}

/* PortalGraf NEXT 0.5.230 - chrome pgMarketEditorial (PortalGraf Market NEXT).
   Clon visual de pgForumEditorial 0.5.229 para separar responsabilidades.
   No altera pgForumEditorial, pgLatestEditorial ni el CSS del modulo Market. */
.pg-next .pg-module--market-editorial {
  padding: .2rem 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.pg-next .pg-module--market-editorial .pg-module__title {
  padding: .12rem 0 .12rem .72rem;
  margin: 0 0 .85rem;
  border: 0;
  border-left: 3px solid #f28c20;
  background: transparent;
}
.pg-next .pg-module--market-editorial .pg-module__body {
  padding: 0;
  border: 0;
  background: transparent;
  overflow-wrap: anywhere;
}
/* Enlaces con la tipografia aprobada en la vista actual. */
.pg-next .pg-module--market-editorial .pg-module__body a:not(.btn):not(.badge) {
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.5;
}
/* Permite listados dinamicos sin imponer una estructura al componente. */
.pg-next .pg-module--market-editorial .pg-module__body li + li {
  margin-top: .35rem;
}

/* PortalGraf Next 0.5.102 · Posición derecha reutilizable; flujo natural. */
body.pg-next.pg-sticky-header-enabled .pg-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}
/* Separación entre posiciones sin reservar alturas: vacío => sin margen. */
body.pg-next .pg-sidebar--right > :is(.pg-sidebar-sticky-position, .pg-sidebar-normal-position) {
  min-width: 0;
  margin: 0;
}
body.pg-next .pg-sidebar--right > .pg-sidebar-normal-position {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-content: start;
  row-gap: 20px;
}
body.pg-next .pg-sidebar--right > .pg-sidebar-sticky-position {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-content: start;
  row-gap: 20px;
}
body.pg-next .pg-sidebar--right > .pg-sidebar-sticky-position:empty {display:none}
/* Superficie blanca opaca uniforme; sin franja visible bajo la cabecera. */
@media (min-width:1150px) {
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar--right {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar-sticky-position.pg-sticky-eligible {
    position: sticky;
    top: calc(var(--pg-sidebar-sticky-top, 96px) + 12px);
    align-self: stretch;
    z-index: 5;
    isolation: isolate;
    background: #fff;
  }
  /* El borde superior queda cubierto por la misma capa opaca que el módulo.
     Se evita el z-index negativo y el fondo de márgenes externos. */
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar-sticky-position.pg-sticky-eligible::before {
    content: "";
    position: absolute;
    top: -12px;
    right: 0;
    bottom: -2px;
    left: 0;
    z-index: 0;
    background: #fff;
    pointer-events: none;
  }
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar-sticky-position.pg-sticky-eligible > * {
    position: relative;
    z-index: 1;
  }

  /* La cabecera y su separación son UNA caja real de pintura. El margen
     original .85rem se convierte en padding del envoltorio, sin variar alturas.
     El acento conserva su altura original al seguir aplicado solo al h2-h6. */
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar--right.pg-next-heading-enabled
    .pg-sidebar-normal-position > .pg-module > .pg-module__heading-surface {
    position: sticky;
    top: var(--pg-next-heading-top, 400px);
    /* La union visual debe pintar por delante de la posicion superior.
       El solape blanco oculta exclusivamente la costura de redondeo (2px),
       sin alterar geometria ni introducir una sombra visible. */
    z-index: 6;
    box-shadow: 0 -3px 0 #fff;
    padding-bottom: var(--pg-next-heading-gap, .85rem);
    background: #fff;
  }
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar--right.pg-next-heading-enabled
    .pg-sidebar-normal-position > .pg-module > .pg-module__heading-surface > .pg-module__title {
    margin-bottom: 0;
  }

  /* Ocultar de una vez al agotar el contenido, sin colapsar el modulo. */
  body.pg-next.pg-sticky-right-position-enabled .pg-sidebar--right.pg-next-heading-enabled
    .pg-sidebar-normal-position > .pg-module > .pg-module__heading-surface.pg-next-heading-exhausted {
    visibility: hidden;
  }
}
@media (max-width:1149.98px) {
  body.pg-next .pg-sidebar--right {gap: 20px}
  body.pg-next .pg-sidebar-sticky-position {position: static}
}
