/* =========================================================================
   noticias.css — Feed de noticias + modal a pantalla completa con carrusel.
   Contenido data-driven (js/noticias.js). Hoy con placeholders; luego el
   panel admin (Firestore) alimentará los mismos campos.
   ========================================================================= */

.news-page { background: #fff; color: #33413a; }

/* ------------------------------------------------------------------ HERO */
.news-hero {
  position: relative;
  min-height: 46vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; color: #fff; overflow: hidden;
}
.news-hero__bg {
  position: absolute; inset: 0;
  background-image: url("/assets/img/lizagro-caja1.webp");
  background-size: cover; background-position: center;
}
.news-hero__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,35,26,.55) 0%, rgba(0,50,25,.8) 100%);
}
.news-hero__inner { position: relative; z-index: 2; padding: 4rem 1.5rem; max-width: 44ch; }
.news-hero__eyebrow { font-size: .78rem; letter-spacing: .3em; text-transform: uppercase; color: rgba(255,255,255,.82); margin: 0 0 .8rem; }
.news-hero__title {
  font-family: "Poppins", system-ui, sans-serif; font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.02; margin: 0;
}
.news-hero__sub { margin: 1rem auto 0; color: rgba(255,255,255,.88); font-size: clamp(1rem, 1.8vw, 1.2rem); max-width: 40ch; }

/* ------------------------------------------------------------------ FEED */
.news-feed {
  max-width: 1200px; margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 4vw, 2rem);
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.25rem);
}
.news-empty { grid-column: 1 / -1; text-align: center; color: #7a857f; padding: 3rem 0; }

.news-card {
  position: relative;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #eef0ee; border-radius: 14px; overflow: hidden;
  cursor: pointer;
  opacity: 0; transform: translateY(28px);
  transition: box-shadow .3s ease, transform .3s ease, border-color .3s ease;
}
.news-card.is-visible { opacity: 1; transform: translateY(0); }
.news-card:hover { box-shadow: 0 24px 50px rgba(0,0,0,.12); border-color: #dcebe0; transform: translateY(-6px); }

.news-card__media { position: relative; aspect-ratio: 16/11; overflow: hidden; }
.news-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.news-card:hover .news-card__media img { transform: scale(1.06); }
.news-card__date {
  position: absolute; top: .8rem; left: .8rem;
  background: rgba(255,255,255,.92); color: #005005;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  padding: .35rem .7rem; border-radius: 999px; backdrop-filter: blur(4px);
}
.news-card__badge {
  position: absolute; top: .8rem; right: .8rem;
  background: #2e7d32; color: #fff; font-size: .65rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding: .3rem .6rem; border-radius: 6px;
}
.news-card__body { padding: 1.3rem 1.4rem 1.6rem; display: flex; flex-direction: column; flex: 1; }
.news-card__title {
  font-family: "Poppins", sans-serif; font-weight: 600; font-size: 1.25rem;
  color: #16324f; line-height: 1.25; margin: 0 0 .6rem;
}
.news-card__excerpt { color: #5b665f; line-height: 1.6; font-size: .96rem; margin: 0 0 1.1rem; flex: 1; }
.news-card__more {
  align-self: flex-start; color: #2e7d32; font-weight: 600; font-size: .9rem;
  display: inline-flex; align-items: center; gap: .4rem;
}
.news-card:hover .news-card__more { gap: .7rem; }
.news-card__more::after { content: "→"; transition: transform .25s ease; }

/* ------------------------------------------------------------------ MODAL */
.news-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  background: rgba(8, 20, 14, .78); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s ease;
  overflow-y: auto;
}
.news-modal.is-open { opacity: 1; visibility: visible; }

.news-modal__panel {
  position: relative;
  width: min(1000px, 100%);
  min-height: 100vh;
  background: #fff;
  transform: translateY(24px);
  transition: transform .4s cubic-bezier(.22,1,.36,1);
}
.news-modal.is-open .news-modal__panel { transform: translateY(0); }

.news-modal__close {
  position: fixed; top: 1rem; right: 1rem; z-index: 1002;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1.4rem; line-height: 1;
  display: grid; place-items: center; transition: background .2s ease, transform .2s ease;
}
.news-modal__close:hover { background: #005005; transform: rotate(90deg); }

/* Carrusel */
.news-carousel { position: relative; width: 100%; aspect-ratio: 16/9; background: #0b1f16; overflow: hidden; }
.news-slide {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity .6s ease;
  background-size: cover; background-position: center;
}
.news-slide.is-active { opacity: 1; }
.news-carousel__btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.85); color: #16324f; font-size: 1.3rem;
  display: grid; place-items: center; transition: background .2s ease;
}
.news-carousel__btn:hover { background: #fff; }
.news-carousel__btn--prev { left: 1rem; }
.news-carousel__btn--next { right: 1rem; }
.news-carousel__dots { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: .5rem; }
.news-carousel__dots button {
  width: 9px; height: 9px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.5); transition: background .2s ease, transform .2s ease;
}
.news-carousel__dots button.is-active { background: #fff; transform: scale(1.25); }
.news-carousel__count {
  position: absolute; top: 1rem; right: 1rem; z-index: 3;
  background: rgba(0,0,0,.55); color: #fff; font-size: .78rem; padding: .3rem .7rem; border-radius: 999px;
}

/* Cuerpo del artículo */
.news-article { max-width: 760px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 2rem) 5rem; }
.news-article__meta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.news-article__date { color: #2e7d32; font-weight: 600; font-size: .9rem; }
.news-article__badge { background: #eaf5ec; color: #2e7d32; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .3rem .6rem; border-radius: 6px; }
.news-article__title {
  font-family: "Poppins", sans-serif; font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: #16324f; line-height: 1.12; margin: 0 0 1.5rem;
}
.news-article__body p { line-height: 1.85; font-size: 1.08rem; color: #3f4a43; margin: 0 0 1.3rem; }
.news-article__body h3 { font-family: "Poppins", sans-serif; color: #16324f; font-size: 1.4rem; margin: 2rem 0 .8rem; }

/* --- Página de detalle (noticia.html), no el modal --- */
.news-article__back {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--primary, #2e7d32); font-weight: 600; font-size: .9rem;
  margin-bottom: 1.6rem; padding: .4rem 0; min-height: 44px;
  transition: transform .2s ease;
}
.news-article__back:hover { transform: translateX(-3px); text-decoration: underline; }
.news-article__img {
  width: 100%; height: auto; margin: 0 0 1.8rem;
  border-radius: 14px; object-fit: cover;
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}
.news-article__loading { color: #7a857f; }
.news-article__error { color: #b91c1c; }

/* --- Subtítulo (bajada), viñetas y galería: campos que publica el panel --- */
.news-article__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.6; color: #5b665f; font-weight: 500;
  margin: -.6rem 0 1.6rem;
}
.news-article__list {
  margin: 0 0 1.4rem; padding-left: 1.2rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.news-article__list li { line-height: 1.7; font-size: 1.05rem; color: #3f4a43; }
.news-article__list li::marker { color: var(--primary, #2e7d32); }

/* Imágenes secundarias de la noticia (la primera va a ancho completo arriba) */
.news-article__gallery {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem;
  margin: 0 0 1.8rem;
}
.news-article__gallery img {
  width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 10px;
}
@media (max-width: 520px) {
  .news-article__gallery { grid-template-columns: 1fr; }
  .news-article__subtitle { font-size: 1rem; }
  .news-article__list li { font-size: 1rem; }
}

/* Bloquea scroll del fondo cuando el modal está abierto */
body.news-modal-open { overflow: hidden; }

/* ------------------------------------------------------------------ RESPONSIVE */
@media (max-width: 900px) { .news-feed { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .news-feed { grid-template-columns: 1fr; }
  .news-carousel { aspect-ratio: 4/3; }

  /* Las flechas del carrusel se pegan al borde y el botón de cerrar se
     solapaba con el contador; se recolocan para no pisarse. */
  .news-carousel__btn { width: 40px; height: 40px; font-size: 1.15rem; }
  .news-carousel__btn--prev { left: .5rem; }
  .news-carousel__btn--next { right: .5rem; }
  .news-carousel__count { top: .6rem; right: .6rem; font-size: .72rem; }
  .news-carousel__dots { bottom: .6rem; }
  .news-modal__close { top: .6rem; right: .6rem; width: 42px; height: 42px; }

  .news-article { padding-bottom: 3rem; }
  .news-article__body p { font-size: 1.02rem; line-height: 1.8; }
  .news-article__body h3 { font-size: 1.25rem; margin-top: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .news-card { opacity: 1; transform: none; transition: none; }
  .news-slide { transition: none; }
  .news-modal, .news-modal__panel { transition: none; }
}
