/* Detalle de noticia (noticias.php): hero pinneado con --hero-progress y barra de progreso de
   lectura, ambos calculados por js/noticia-hero.js (un solo scroll listener + rAF). */

.noticia-progreso {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 2000;
  background: rgba(10, 61, 35, 0.08);
}

.noticia-progreso__fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #1c5434, #148b33);
}

/* --- Hero vivo --- */
/* Caja de contención en flujo normal (NUNCA sticky/fixed): sube y desaparece con el scroll como
   cualquier bloque. Solo se anima transform:scale() de la imagen y el border-radius del
   contenedor, vía --hero-progress (js/noticia-hero.js); jamás su position/top. */

.noticia-hero {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 60vh;
  min-height: 320px;
  overflow: hidden;
  margin-top: var(--sv-navbar-clear, var(--sv-navbar-clear-fallback));
  border-radius: calc(32px * var(--hero-progress, 0));
}

.noticia-hero__media {
  position: absolute;
  inset: 0;
}

.noticia-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(calc(1.2 - (0.2 * var(--hero-progress, 0))));
  transform-origin: center;
  transition: transform 0.1s ease-out;
}

.noticia-hero__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: clamp(24px, 5vw, 56px) clamp(20px, 6vw, 64px);
  background: linear-gradient(to top, rgba(8, 16, 12, 0.72), transparent);
  opacity: calc(1 - var(--hero-progress, 0));
}

.noticia-hero__categoria {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.noticia-hero__titulo {
  margin: 0;
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  max-width: 900px;
}

/* --- Área de lectura --- */

.noticia-lectura {
  position: relative;
  z-index: 10;
  display: block;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) 20px;
  background: #fff;
  font-size: 1.15rem;
  line-height: 1.75;
  color: #333;
}

.noticia-lectura p {
  margin: 0 0 1.2rem;
  text-align: justify;
}

.noticia-lectura h2,
.noticia-lectura h3,
.noticia-lectura h4 {
  color: #1c5434;
  margin: 1.6rem 0 0.8rem;
  font-weight: 700;
}

.noticia-lectura ul,
.noticia-lectura ol {
  padding-left: 1.5rem;
  margin: 0 0 1.2rem;
}

.noticia-lectura li {
  margin-bottom: 0.5rem;
}

.noticia-lectura img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1.2rem 0;
}

.noticia-lectura a {
  color: #1c5434;
  font-weight: 600;
}

.noticia-lectura a:hover {
  color: #148b33;
}

/* --- Otras noticias: galería flex-grow --- */

.otras-noticias {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) 20px clamp(48px, 8vw, 80px);
}

.otras-noticias__titulo {
  margin: 0 0 20px;
  color: #1c5434;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
}

.otras-noticias__franjas {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  height: 400px;
  overflow: hidden;
}

.franja {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.franja__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.franja__velo {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 16, 12, 0.78), rgba(8, 16, 12, 0.1) 55%, transparent);
}

.franja__contenido {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
}

.franja__titulo {
  display: block;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.franja__extracto {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  line-height: 1.4;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.4s ease;
}

@media (hover: hover) and (pointer: fine) {
  .franja:hover,
  .franja:focus-visible {
    flex: 4;
  }

  .franja:hover .franja__titulo,
  .franja:focus-visible .franja__titulo {
    white-space: normal;
  }

  .franja:hover .franja__extracto,
  .franja:focus-visible .franja__extracto {
    max-height: 120px;
    opacity: 1;
    transition: opacity 0.4s ease 0.15s;
  }
}

/* Sin hover real (táctil): todas las franjas visibles apiladas, sin efecto de expansión. */
@media not all and (hover: hover) and (pointer: fine) {
  .otras-noticias__franjas {
    flex-direction: column;
    height: auto;
  }

  .franja {
    height: 220px;
  }

  .franja__extracto {
    max-height: 120px;
    opacity: 1;
  }
}

@media (max-width: 759.98px) {
  .noticia-hero {
    height: 45vh;
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Sin JS de scroll (el listener no se engancha): --hero-progress nunca se actualiza, así que se
     fuerza directamente el estado "asentado" en vez de quedar pegado al tamaño inicial (scale 1.2). */
  .noticia-hero {
    border-radius: 32px;
  }

  .noticia-hero__img {
    transform: none;
    transition: none;
  }

  .noticia-hero__caption {
    opacity: 1;
  }

  .franja,
  .franja__extracto,
  .noticia-progreso__fill {
    transition: none;
  }
}
