/* IEICII Hub v236 · presentación pública uniforme
   Consolida contraste de banners/tags y tratamiento inteligente de medios en todo el portal.
   Se carga al final de los estilos públicos y reemplaza el motor smart-media anterior. */

/* ---------- Variables editoriales ---------- */
body.public-body{
  --pm236-line:var(--line,#dfe6ef);
  --pm236-ink:var(--text,#0f172a);
  --pm236-muted:var(--muted,#64748b);
  --pm236-brand:var(--brand,#2563eb);
  --pm236-soft:#f4f7fb;
  --pm236-chip-bg:#eff6ff;
  --pm236-chip-fg:#1d4ed8;
  --pm236-chip-line:#bfdbfe;
}

/* ---------- Chips, badges y etiquetas: una sola gramática visual ---------- */
body.public-body .tag-chip,
body.public-body .badge,
body.public-body .status-pill,
body.public-body .category-chip,
body.public-body .eyebrow,
body.public-body .scic74-chip,
body.public-body .scic74-kicker{
  max-width:100%!important;
  min-height:27px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  padding:5px 10px!important;
  border-radius:999px!important;
  border:1px solid var(--pm236-chip-line)!important;
  background:var(--pm236-chip-bg)!important;
  color:var(--pm236-chip-fg)!important;
  font-size:11px!important;
  font-weight:900!important;
  line-height:1.2!important;
  letter-spacing:.015em!important;
  text-shadow:none!important;
  text-decoration:none!important;
  vertical-align:middle!important;
  overflow-wrap:anywhere!important;
}
body.public-body .eyebrow,
body.public-body .scic74-kicker{
  text-transform:uppercase!important;
  letter-spacing:.055em!important;
}
/* Semántica de estado conservada pero con contraste suficiente. */
body.public-body .badge.ok,
body.public-body .status-pill.active,
body.public-body .status-pill.published,
body.public-body .status-pill.valid{
  background:#ecfdf3!important;color:#067647!important;border-color:#abefc6!important;
}
body.public-body .badge.warn,
body.public-body .badge.warning,
body.public-body .status-pill.pending,
body.public-body .status-pill.draft{
  background:#fffaeb!important;color:#93370d!important;border-color:#fedf89!important;
}
body.public-body .badge.bad,
body.public-body .badge.danger,
body.public-body .status-pill.cancelled,
body.public-body .status-pill.canceled,
body.public-body .status-pill.expired{
  background:#fef3f2!important;color:#b42318!important;border-color:#fecdca!important;
}

/* Etiquetas sobre fondos oscuros o fotográficos: nunca desaparecen. */
body.public-body .hero .eyebrow,
body.public-body .visual-hero .eyebrow,
body.public-body .scic74-hero .scic74-kicker,
body.public-body .event-hero-detail-v148 .eyebrow,
body.public-body .home-stage-v142 .eyebrow,
body.public-body .home-stage-v143 .eyebrow,
body.public-body .home-stage-v142 .stage-kicker-v142,
body.public-body .home-stage-v143 .stage-kicker-v142{
  background:rgba(255,255,255,.96)!important;
  color:#172033!important;
  border-color:rgba(255,255,255,.98)!important;
  box-shadow:0 7px 22px rgba(0,0,0,.14)!important;
  backdrop-filter:blur(8px)!important;
}
body.public-body .scic74-hero h1,
body.public-body .scic74-hero h2,
body.public-body .scic74-hero p,
body.public-body .hero h1,
body.public-body .hero h2,
body.public-body .hero p{
  color:#fff!important;
}
body.public-body .scic74-hero h1,
body.public-body .hero h1,
body.public-body .hero h2{
  text-shadow:0 2px 22px rgba(0,0,0,.18)!important;
}
body.public-body .scic74-hero p,
body.public-body .hero p{color:rgba(255,255,255,.9)!important}
body.public-body .scic74-hero-stat{
  color:#fff!important;
  background:rgba(7,20,48,.34)!important;
  border-color:rgba(255,255,255,.28)!important;
}
body.public-body .scic74-hero-stat b{color:#fff!important}
body.public-body .scic74-hero-stat span{color:rgba(255,255,255,.88)!important}

/* Tags del hero de evento: cristal oscuro estable sobre cualquier foto. */
body.public-body .event-hero-detail-v148 .event-meta span{
  background:rgba(10,18,34,.82)!important;
  color:#fff!important;
  border:1px solid rgba(255,255,255,.42)!important;
  box-shadow:0 7px 22px rgba(0,0,0,.16)!important;
  backdrop-filter:blur(10px)!important;
  text-shadow:none!important;
}
body.public-body .event-hero-detail-v148 .event-back-link-v140{
  background:rgba(10,18,34,.72)!important;
  color:#fff!important;
  border-color:rgba(255,255,255,.34)!important;
  backdrop-filter:blur(10px)!important;
}

/* ---------- Motor de medios v236 ---------- */
.pm-v236-frame{
  position:relative!important;
  overflow:hidden!important;
  isolation:isolate!important;
  background:linear-gradient(135deg,#f8fbff,#edf3f9)!important;
}
.pm-v236-frame::before{
  content:"";
  position:absolute;
  inset:-22px;
  z-index:0;
  background-image:var(--pm236-bg);
  background-size:cover;
  background-position:center;
  filter:blur(24px) saturate(.82);
  transform:scale(1.10);
  opacity:0;
  pointer-events:none;
}
.pm-v236-frame::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  background:linear-gradient(135deg,rgba(248,251,255,.84),rgba(238,244,255,.62));
  opacity:0;
  pointer-events:none;
}
.pm-v236-frame.pm-v236-contain::before{opacity:.22}
.pm-v236-frame.pm-v236-contain::after{opacity:.74}
.pm-v236-frame>img,
.pm-v236-frame>a>img,
.pm-v236-frame .pm-v236-image{
  position:relative!important;
  z-index:1!important;
  display:block!important;
  max-width:100%!important;
  margin:0!important;
  transition:transform .22s ease,filter .22s ease!important;
}
.pm-v236-frame.pm-v236-contain>img,
.pm-v236-frame.pm-v236-contain>a>img,
.pm-v236-frame.pm-v236-contain .pm-v236-image{
  object-fit:contain!important;
  background:transparent!important;
  filter:drop-shadow(0 10px 18px rgba(15,23,42,.12));
}
.pm-v236-frame.pm-v236-cover>img,
.pm-v236-frame.pm-v236-cover>a>img,
.pm-v236-frame.pm-v236-cover .pm-v236-image{
  object-fit:cover!important;
  background:transparent!important;
}
.pm-v236-frame.pm-v236-lowres>img{image-rendering:auto!important;transform:none!important}

/* Publicaciones / noticias: detalle siempre completo y limpio. */
body.public-body .post-article-media-v70.pm-v236-frame,
body.public-body .post-article-media-v39.pm-v236-frame{
  height:clamp(320px,35vw,480px)!important;
  min-height:0!important;
  display:grid!important;
  place-items:center!important;
  padding:14px!important;
}
body.public-body .post-article-media-v70.pm-v236-frame>img,
body.public-body .post-article-media-v39.pm-v236-frame>img{
  width:calc(100% - 6px)!important;
  height:calc(100% - 6px)!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
  border-radius:15px!important;
}
body.public-body .post-article-hero-v70.pm-v236-root.pm-v236-portrait,
body.public-body .post-article-hero-v70.pm-v236-root.pm-v236-tall{
  grid-template-columns:minmax(260px,.66fr) minmax(0,1.34fr)!important;
}
body.public-body .post-article-hero-v70.pm-v236-root.pm-v236-panorama,
body.public-body .post-article-hero-v70.pm-v236-root.pm-v236-wide{
  grid-template-columns:minmax(390px,.95fr) minmax(0,1.05fr)!important;
}

/* Cards de publicaciones: horizontal llena; afiche/cuadrada/panorama se ve completo. */
body.public-body .post-card-thumb-v70.pm-v236-frame{
  height:210px!important;
  display:grid!important;
  place-items:center!important;
  padding:0!important;
}
body.public-body .post-card-thumb-v70.pm-v236-frame>img{width:100%!important;height:100%!important}
body.public-body .post-card-thumb-v70.pm-v236-contain>img{width:calc(100% - 14px)!important;height:calc(100% - 14px)!important;border-radius:12px!important}
body.public-body .post-card-v70.pm-v236-root.pm-v236-portrait .post-card-thumb-v70,
body.public-body .post-card-v70.pm-v236-root.pm-v236-tall .post-card-thumb-v70{height:230px!important}

/* Inicio: publicación destacada y novedades. */
body.public-body .content-lead-img-v71.pm-v236-frame{
  height:clamp(225px,23vw,300px)!important;
  display:grid!important;place-items:center!important;padding:0!important;
}
body.public-body .content-lead-img-v71.pm-v236-frame>img{width:100%!important;height:100%!important}
body.public-body .content-lead-img-v71.pm-v236-contain>img{width:calc(100% - 16px)!important;height:calc(100% - 16px)!important;border-radius:12px!important}
body.public-body .content-row-v71>.pm-v236-row-frame{
  width:96px!important;height:76px!important;min-width:96px!important;border-radius:12px!important;display:grid!important;place-items:center!important;align-self:center!important;
}
body.public-body .content-row-v71>.pm-v236-row-frame>img{width:100%!important;height:100%!important;border-radius:10px!important}
body.public-body .content-row-v71.pm-v236-root.pm-v236-portrait,
body.public-body .content-row-v71.pm-v236-root.pm-v236-tall{grid-template-columns:84px minmax(0,1fr)!important;min-height:116px!important}
body.public-body .content-row-v71.pm-v236-root.pm-v236-portrait>.pm-v236-row-frame,
body.public-body .content-row-v71.pm-v236-root.pm-v236-tall>.pm-v236-row-frame{width:84px!important;min-width:84px!important;height:104px!important}

/* Eventos: tratamiento según proporción real. */
body.public-body .event-feature-media-v91.pm-v236-frame,
body.public-body .event-list-media-v91.pm-v236-frame,
body.public-body .agenda-feature-media-v71.pm-v236-frame{
  background:#f5f8fc!important;
}
body.public-body .event-feature-media-v91.pm-v236-frame>img,
body.public-body .event-list-media-v91.pm-v236-frame>img,
body.public-body .agenda-feature-media-v71.pm-v236-frame>img{
  width:100%!important;height:100%!important;padding:0!important;
}
body.public-body .event-feature-media-v91.pm-v236-contain>img,
body.public-body .event-list-media-v91.pm-v236-contain>img,
body.public-body .agenda-feature-media-v71.pm-v236-contain>img{
  width:calc(100% - 16px)!important;height:calc(100% - 16px)!important;border-radius:14px!important;
}
body.public-body .event-list-media-v91.pm-v236-frame{height:235px!important}
body.public-body .event-list-card-v91.is-past .event-list-media-v91.pm-v236-frame{height:205px!important}
body.public-body .event-feature-media-v91.pm-v236-frame{min-height:360px!important}
/* Un poster vertical merece más área que una miniatura horizontal. */
body.public-body .event-list-card-v91.pm-v236-root.pm-v236-portrait .event-list-media-v91,
body.public-body .event-list-card-v91.pm-v236-root.pm-v236-tall .event-list-media-v91{height:280px!important}

/* Comité: evita recortes extremos en imágenes académicas sin convertir fotos normales en miniaturas. */
body.public-body .scic74-media.pm-v236-frame>img{width:100%!important;height:100%!important;padding:0!important}
body.public-body .scic74-media.pm-v236-frame.pm-v236-panorama>img,
body.public-body .scic74-media.pm-v236-frame.pm-v236-tall>img{width:calc(100% - 12px)!important;height:calc(100% - 12px)!important;border-radius:12px!important;object-fit:contain!important}
body.public-body .scic74-media.pm-v236-frame.pm-v236-portrait>img{object-position:center 24%!important}

/* Sedes, membresías y servicios: cards con criterio común. */
body.public-body .image-card.pm-v236-root,
body.public-body .public-image-card.pm-v236-root,
body.public-body .partner-public-card.pm-v236-root{overflow:hidden!important}
body.public-body .image-card>.pm-v236-card-media,
body.public-body .public-image-card>.pm-v236-card-media{
  width:100%!important;height:190px!important;display:grid!important;place-items:center!important;border-bottom:1px solid var(--pm236-line)!important;
}
body.public-body .image-card>.pm-v236-card-media>img,
body.public-body .public-image-card>.pm-v236-card-media>img{width:100%!important;height:100%!important}
/* Logos de socios: nunca se recortan. */
body.public-body .partner-public-card>.pm-v236-card-media{height:150px!important;display:grid!important;place-items:center!important;background:#fff!important}
body.public-body .partner-public-card>.pm-v236-card-media>img{width:calc(100% - 22px)!important;height:calc(100% - 22px)!important;object-fit:contain!important}

/* Imágenes dentro de subpáginas/eventos: el contenido editorial se preserva completo. */
body.public-body img.event-subpage-hero.pm-v236-direct,
body.public-body img.event-block-image.pm-v236-direct{
  width:100%!important;max-height:min(640px,72vh)!important;object-fit:contain!important;object-position:center!important;background:#f5f8fc!important;border:1px solid var(--pm236-line)!important;border-radius:18px!important;padding:8px!important;
}

/* Hero de evento con imagen: panorama/horizontal cubre; poster o cuadrada no se destruye. */
body.public-body .event-hero-detail-v148.pm-v236-bg{
  background-color:#0b1730!important;
  background-image:var(--event-hero-image)!important;
  background-repeat:no-repeat!important;
}
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-wide,
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-landscape,
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-panorama{
  background-size:cover!important;background-position:center!important;
}
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-square,
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-portrait,
body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-tall{
  background-size:auto 94%!important;background-position:82% center!important;
}
/* Overlay: garantiza legibilidad aunque la imagen sea muy clara. */
body.public-body .event-hero-detail-v148::after{
  background:linear-gradient(90deg,rgba(10,15,28,.94) 0%,rgba(10,15,28,.82) 43%,rgba(10,15,28,.42) 72%,rgba(10,15,28,.16) 100%)!important;
}

/* Home stage / banners fotográficos: texto y métricas siempre por encima. */
body.public-body .home-stage-v142,
body.public-body .home-stage-v143{isolation:isolate!important}
body.public-body .home-stage-v142 .stage-copy-v142,
body.public-body .home-stage-v143 .stage-copy-v142,
body.public-body .home-stage-v143 .stage-copy-v143{position:relative!important;z-index:3!important}
body.public-body .home-stage-v142 .stage-meta-v142 span,
body.public-body .home-stage-v143 .stage-meta-v143 span,
body.public-body .home-stage-v142 .event-meta-light span,
body.public-body .home-stage-v143 .event-meta-light span{
  background:rgba(10,18,34,.76)!important;color:#fff!important;border:1px solid rgba(255,255,255,.34)!important;box-shadow:0 6px 20px rgba(0,0,0,.13)!important;backdrop-filter:blur(9px)!important;
}

/* Dark theme: el fondo contextual no se convierte en una caja blanca. */
html[data-theme="dark"] body.public-body .pm-v236-frame{background:#172033!important}
html[data-theme="dark"] body.public-body .pm-v236-frame::after{background:linear-gradient(135deg,rgba(15,23,42,.68),rgba(30,41,59,.52))}

@media(max-width:1040px){
  body.public-body .post-article-hero-v70.pm-v236-root{grid-template-columns:1fr!important}
  body.public-body .post-article-media-v70.pm-v236-frame,body.public-body .post-article-media-v39.pm-v236-frame{height:clamp(280px,62vw,450px)!important}
  body.public-body .event-feature-media-v91.pm-v236-frame{min-height:300px!important}
}
@media(max-width:720px){
  body.public-body .post-article-media-v70.pm-v236-frame,body.public-body .post-article-media-v39.pm-v236-frame{height:300px!important;padding:10px!important}
  body.public-body .post-article-media-v70.pm-v236-frame.pm-v236-portrait,body.public-body .post-article-media-v70.pm-v236-frame.pm-v236-tall{height:390px!important}
  body.public-body .post-card-thumb-v70.pm-v236-frame{height:190px!important}
  body.public-body .content-lead-img-v71.pm-v236-frame{height:220px!important}
  body.public-body .content-row-v71,body.public-body .content-row-v71.pm-v236-root.pm-v236-portrait,body.public-body .content-row-v71.pm-v236-root.pm-v236-tall{grid-template-columns:76px minmax(0,1fr)!important;min-height:88px!important}
  body.public-body .content-row-v71>.pm-v236-row-frame,body.public-body .content-row-v71.pm-v236-root.pm-v236-portrait>.pm-v236-row-frame,body.public-body .content-row-v71.pm-v236-root.pm-v236-tall>.pm-v236-row-frame{width:76px!important;min-width:76px!important;height:76px!important}
  body.public-body .event-feature-media-v91.pm-v236-frame{min-height:240px!important}
  body.public-body .event-list-card-v91.pm-v236-root.pm-v236-portrait .event-list-media-v91,body.public-body .event-list-card-v91.pm-v236-root.pm-v236-tall .event-list-media-v91{height:240px!important}
  body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-square,body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-portrait,body.public-body .event-hero-detail-v148.pm-v236-bg.pm-v236-tall{background-size:cover!important;background-position:center!important}
  body.public-body .event-hero-detail-v148::after{background:linear-gradient(180deg,rgba(10,15,28,.48) 0%,rgba(10,15,28,.72) 42%,rgba(10,15,28,.94) 100%)!important}
}
@media(prefers-reduced-motion:reduce){.pm-v236-frame>img,.pm-v236-frame>a>img{transition:none!important}}
