html[data-template-id="meganews"] {
  --tf-accent: #0f9f78;
  --tf-accent-deep: #08624f;
  --tf-mint: #dff7ed;
  --tf-display: "Segoe UI", system-ui, sans-serif;
  --tf-serif: Georgia, "Times New Roman", serif;
  --tf-radius: 5px;
}
html[data-template-id="meganews"] .reader-frontpage { font-family: var(--tf-display); }
html[data-template-id="meganews"] .rf-edition-bar { background: linear-gradient(100deg, #e4f8ef, #fff 68%); }
html[data-template-id="meganews"] .rf-lead h2 { font-weight: 900; }
html[data-template-id="meganews"] .rf-latest { background: linear-gradient(135deg, #edfaf4, #fff); }
html[data-template-id="meganews"] .rf-article h1 { font-family: var(--tf-display); }
html[data-template-id="meganews"] .article-body { font-family: Georgia, serif; }
/* periodicoIA · Meganews: el directo y el carrusel mantienen el ADN verde original. */
body.pia-tpl-meganews #wrapper { background: #fff !important; }
body.pia-tpl-meganews #header { background: #fff !important; }
body.pia-tpl-meganews .pia-live-rail { margin-bottom: 12px; }
body.pia-tpl-meganews #sidebar .box h2 { color: #0b6b61 !important; }
body.pia-tpl-meganews #content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}
body.pia-tpl-meganews #content .pia-meganews-carousel { grid-column: 1 / -1; }
body.pia-tpl-meganews #content .post {
  float: none;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 10px;
  border-bottom: 1px solid #dbe9e2;
}
body.pia-tpl-meganews #content .post img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 4px;
}
body.pia-tpl-meganews #content .post h3 { line-height: 1.2; }
body.pia-tpl-meganews #content .post .readmore {
  width: auto;
  height: auto;
  padding: 7px 11px;
  background: #0b6b61;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-indent: 0;
  text-decoration: none;
  border-radius: 4px;
}
body.pia-tpl-meganews #sidebar .search form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: auto;
  padding: 8px;
  background: #e8f5ef;
}
body.pia-tpl-meganews #sidebar .search form input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #bcd9cd;
  border-radius: 4px;
  background: #fff;
}
body.pia-tpl-meganews #sidebar .search form button {
  flex: 0 0 auto;
  float: none;
  width: auto;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: #0b6b61;
  color: #fff;
  font-weight: 700;
  text-indent: 0;
  cursor: pointer;
}
body.pia-tpl-meganews #sidebar .pia-news-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
body.pia-tpl-meganews #sidebar .pia-news-gallery a {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 4 / 3;
}
body.pia-tpl-meganews #sidebar .pia-news-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 700px) {
  body.pia-tpl-meganews #content { grid-template-columns: 1fr; gap: 10px; }
}

/* El carrusel conserva su Nivo original, pero en móvil gana altura para que
   titular, sumario y llamada a la acción no queden recortados por la imagen. */
@media (max-width: 620px) {
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .nivoSlider {
    aspect-ratio: 4 / 3 !important;
    min-height: 255px;
  }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .pia-slide-copy {
    min-height: 100%;
    justify-content: flex-end !important;
    padding: 46px 14px 16px !important;
  }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .title1 {
    font-size: clamp(19px, 5.8vw, 24px) !important;
    line-height: 1.02 !important;
  }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .title2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* Las flechas viven en la zona superior de la imagen: nunca tapan el titular. */
@media (max-width: 900px) {
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .nivo-directionNav a {
    top: 12px !important;
    width: 32px !important;
    height: 32px !important;
    border: 1px solid rgba(255, 255, 255, .36) !important;
    background: rgba(3, 42, 34, .78) !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(1, 30, 24, .28);
  }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .nivo-prevNav { left: 10px !important; }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .nivo-nextNav { right: 10px !important; }
  body.pia-template-cover.pia-tpl-meganews .pia-meganews-carousel .nivo-directionNav a::before {
    display: block !important;
    text-indent: 0 !important;
    transform: none !important;
  }
}
