/* =========================================================
   THEX — Sección Noticias
   Hoja de estilos compartida (pag_noticias.html + pag_noticia_individual.html)
   ========================================================= */

/* ==========================================================================
   0. VARIABLES LOCALES
   (Compatibles con el sistema de diseño global de Thex)
   ========================================================================== */
:root {
  /* Colores */
  --n-ink: #111111;
  --n-muted: #888888;
  --n-surface: #ffffff;
  --n-line: #e8e8e8;
  --n-line-strong: #111111;
  --n-accent: #d4c8b8;

  /* Tipografías */
  --n-font-display: 'Outfit', sans-serif;
  --n-font-mono: 'Outfit', monospace;

  /* Layout */
  --n-maxw: 1280px;
  --n-gutter: clamp(24px, 5vw, 80px);
  --n-radius: 4px;
}

/* ==========================================================================
   1. CONFIGURACIÓN GENERAL DE PÁGINA
   ========================================================================== */
body.news-page {
  background-color: #ffffff;
  color: #111111;
  -webkit-font-smoothing: antialiased;
}

/* El webgl canvas queda muy sutil en páginas blancas */
body.news-page #webgl-canvas {
  opacity: 0.04;
}

/* Logo invertido para fondo blanco */
body.news-page .logo img {
  filter: invert(1);
}

/* Hamburger oscuro */
body.news-page .menu-btn {
  background: #111111;
  border-color: rgba(0, 0, 0, 0.1);
}

body.news-page .hamburger-line {
  background-color: #ffffff;
}

/* Botón de idioma */
body.news-page .nav a.lang-toggle-btn {
  color: #111111;
}

/* Reseteos editoriales de imagen */
img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   2. RESET DE TIPOGRAFÍA GLOBAL DENTRO DE NOTICIAS
   El style.css global define h1/h2/h3 con tamaños enormes (5rem+).
   Los overrides de abajo los devuelven a la escala editorial de noticias.
   ========================================================================== */
.news-hero h1,
.article-header h1 {
  font-family: var(--n-font-display) !important;
  font-size: clamp(2.8rem, 7vw, 5rem) !important;
  font-weight: 300 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.01em !important;
  text-transform: uppercase !important;
  margin: 0 0 16px !important;
}

.list-toolbar h2,
.related h2 {
  font-family: var(--n-font-display) !important;
  font-size: clamp(0.8rem, 1.4vw, 1rem) !important;
  font-weight: 400 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  padding: clamp(30px, 8vw, 35px) 0;
}

.news-item .content h3 {
  font-family: var(--n-font-display) !important;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem) !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  margin: 0 !important;
}

.article-content h2 {
  font-family: var(--n-font-display) !important;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem) !important;
  font-weight: 500 !important;
  margin: 40px 0 16px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.3 !important;
}

.related-item h3 {
  font-family: var(--n-font-display) !important;
  font-size: 1.05rem !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* Reset de párrafos editoriales */
.news-item .content p,
.article-content p,
.news-hero .subtitle,
.article-header .hook,
.empty-state {
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.7 !important;
}

/* ==========================================================================
   3. CONTENEDOR GENÉRICO
   ========================================================================== */
.wrap {
  max-width: var(--n-maxw);
  margin: 0 auto;
  padding-left: var(--n-gutter);
  padding-right: var(--n-gutter);
}

/* Utilitarios de tipografía editorial */
.eyebrow,
.meta,
.tag {
  font-family: var(--n-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n-muted);
}

.tag {
  color: var(--n-ink);
  font-weight: 500;
}

/* ==========================================================================
   4. HERO DE LA SECCIÓN (Encabezado de Noticias)
   ========================================================================== */
.news-hero {
  padding: clamp(150px, 16vw, 220px) var(--n-gutter) clamp(36px, 5vw, 56px);
  border-bottom: 1px solid var(--n-line);
}

.news-hero .subtitle {
  color: var(--n-muted) !important;
  max-width: 46ch;
  margin: 0 !important;
}

/* ==========================================================================
   5. FILTRO DE CATEGORÍAS
   ========================================================================== */
.category-filter {
  border-bottom: 1px solid var(--n-line);
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

.category-filter ul {
  list-style: none;
  display: flex;
  gap: clamp(18px, 3vw, 40px);
  margin: 0;
  padding: 20px var(--n-gutter);
  max-width: var(--n-maxw);
  margin-inline: auto;
  min-width: max-content;
}

.category-filter button {
  font-family: var(--n-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--n-muted);
  cursor: pointer;
  padding: 6px 2px 12px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.category-filter button:hover {
  color: var(--n-ink);
}

.category-filter button.is-active {
  color: var(--n-ink);
  font-weight: 700;
  border-bottom-color: var(--n-line-strong);
}

/* ==========================================================================
   6. BARRA DE HERRAMIENTAS DEL LISTADO
   ========================================================================== */
.list-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: clamp(28px, 4vw, 48px);
  padding-bottom: 18px;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--n-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--n-muted);
}

.date-filter label {
  font-size: 0.78rem;
}

.date-filter select {
  font-family: var(--n-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--n-line);
  background: var(--n-surface);
  padding: 8px 12px;
  border-radius: var(--n-radius);
  color: var(--n-ink);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.date-filter select:hover,
.date-filter select:focus {
  border-color: var(--n-ink);
  outline: none;
}

/* ==========================================================================
   7. LISTADO DE NOTICIAS
   ========================================================================== */
.news-list {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  border-top: 1px solid var(--n-line);
}

/* Item de noticia — grid 2 columnas */
.news-item {
  border-bottom: 1px solid var(--n-line);
  padding: clamp(20px, 3vw, 36px) 0;
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  column-gap: clamp(20px, 4vw, 48px);
  row-gap: 24px;
  align-items: stretch;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Thumbnail */
.news-item .thumb {
  overflow: hidden;
  background: var(--n-line);
  aspect-ratio: 4 / 3;
  display: block;
}

.news-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-item .thumb:hover img {
  transform: scale(1.04);
}

/* Contenido */
.news-item .content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.news-item .content .meta-row {
  display: flex;
  gap: 14px;
  align-items: baseline;
}

.news-item .content p {
  margin: 0 !important;
  color: var(--n-muted) !important;
  max-width: 60ch;
}

/* Enlace "Leer más" */
.news-item .read-more {
  font-family: var(--n-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin-top: 4px;
  color: var(--n-ink);
  transition: opacity 0.2s ease;
}

.news-item .read-more:hover {
  opacity: 0.6;
}

/* Estado vacío */
.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--n-muted) !important;
  font-family: var(--n-font-mono);
  text-transform: uppercase;
  font-size: 0.85rem !important;
  letter-spacing: 0.06em;
}

/* ==========================================================================
   8. PAGINACIÓN
   ========================================================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-bottom: 60px;
  font-family: var(--n-font-mono);
  font-size: 0.8rem;
}

.pagination button {
  background: none;
  border: 1px solid transparent;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--n-muted);
  border-radius: var(--n-radius);
  font-family: var(--n-font-mono);
  font-size: 0.8rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  color: var(--n-ink);
  border-color: var(--n-line);
}

.pagination button.is-active {
  color: var(--n-ink);
  font-weight: 700;
  border-color: var(--n-line);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ==========================================================================
   9. NOTICIA INDIVIDUAL — CABECERA
   ========================================================================== */
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(110px, 14vw, 140px);
  padding: 20px 0;
  font-family: var(--n-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--n-muted);
  transition: color 0.2s ease;
}

.article-back svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.article-back:hover {
  color: var(--n-ink);
}

.article-header {
  padding-bottom: clamp(24px, 4vw, 40px);
}

.article-header .meta-row {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.article-header .hook {
  font-size: clamp(1rem, 1.6vw, 1.25rem) !important;
  color: var(--n-muted) !important;
  max-width: 62ch;
  margin: 0 0 26px !important;
  font-family: var(--n-font-display) !important;
  font-style: italic;
  font-weight: 400 !important;
  line-height: 1.6 !important;
}

/* Bloque autor / tiempo de lectura */
.article-byline {
  display: flex;
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--n-line);
  font-family: var(--n-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--n-muted);
}

.article-byline strong {
  color: var(--n-ink);
  font-weight: 600;
}

/* Imagen principal del artículo */
.article-hero-image {
  width: 100%;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: var(--n-line);
  margin-bottom: clamp(30px, 5vw, 56px);
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   10. CUERPO DEL ARTÍCULO — 3 columnas (20% / auto / 20%)
   ========================================================================== */
.article-body-grid {
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  gap: clamp(20px, 4vw, 48px);
  padding-bottom: clamp(40px, 6vw, 72px);
}

/* Columna 1: compartir en redes */
.article-share {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 120px;
  align-self: start;
  z-index: 2;
}

.article-share .eyebrow {
  margin-bottom: 4px;
}

.article-share a {
  width: 38px;
  height: 38px;
  border: 1px solid var(--n-line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--n-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.article-share img {
  width: 24px;
  height: 24px;
}

.article-share a:hover {
  background: #111111;
  border-color: var(--n-ink);
  filter: invert(100%);
}

/* Columna 2: contenido */
.article-content {
  min-width: 0;
}

.article-content p {
  margin: 0 0 22px !important;
  font-size: 1.05rem !important;
  font-weight: 400 !important;
  line-height: 1.8 !important;
  color: #333333 !important;
}

.article-content blockquote {
  margin: 32px 0;
  padding-left: 22px;
  border-left: 2px solid var(--n-ink);
  font-family: var(--n-font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.4rem) !important;
  line-height: 1.4 !important;
  font-weight: 300 !important;
  color: var(--n-ink) !important;
}

.article-content figure {
  margin: 32px 0;
}

.article-content figure img {
  width: 100%;
}

.article-content figcaption {
  margin-top: 8px;
  font-family: var(--n-font-mono);
  font-size: 0.72rem !important;
  color: var(--n-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bloque de estadísticas */
.article-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 36px 0;
  padding: 26px 0;
  border-top: 1px solid var(--n-line);
  border-bottom: 1px solid var(--n-line);
}

.article-stats .stat-value {
  font-family: var(--n-font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem) !important;
  font-weight: 300 !important;
  line-height: 1;
  letter-spacing: -0.01em;
}

.article-stats .stat-label {
  margin-top: 6px;
  font-family: var(--n-font-mono);
  font-size: 0.7rem !important;
  color: var(--n-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 400 !important;
}

/* Columna 3: vacía */
.article-space {
  /* solo centra el contenido */
}

/* ==========================================================================
   11. SECCIÓN "MÁS SOBRE ESTA HISTORIA"
   ========================================================================== */
.related {
  border-top: 1px solid var(--n-line);
  padding: clamp(30px, 5vw, 56px) 0 clamp(50px, 7vw, 90px);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 40px);
}

.related-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.related-item .row-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.related-item .index {
  font-family: var(--n-font-mono);
  font-size: 0.75rem;
  color: var(--n-muted);
  flex-shrink: 0;
  padding-top: 3px;
}

.related-item .row-bottom {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--n-line);
}

.related-item .row-bottom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.related-item:hover .row-bottom img {
  transform: scale(1.04);
}

/* ==========================================================================
   12. RESPONSIVE
   ========================================================================== */

/* Tablet grande */
@media (max-width: 1024px) {
  .news-item {
    grid-template-columns: minmax(0, 220px) 1fr;
  }

  .article-body-grid {
    grid-template-columns: 0.8fr 3fr 0.8fr;
  }
}

/* Tablet pequeña / móvil horizontal */
@media (max-width: 860px) {
  .article-body-grid {
    grid-template-columns: 1fr;
  }

  .article-share {
    position: static;
    flex-direction: row;
    align-items: center;
    order: 3;
    border-top: 1px solid var(--n-line);
    padding-top: 24px;
    margin-top: 8px;
  }

  .article-content {
    order: 1;
  }

  .article-space {
    display: none;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Móvil */
@media (max-width: 720px) {
  .news-hero {
    padding-top: clamp(120px, 22vw, 150px);
  }

  .news-item {
    grid-template-columns: 1fr;
    row-gap: 24px;
  }

  .news-item .thumb {
    aspect-ratio: 16 / 10;
    width: 100%;
  }

  .list-toolbar {
    flex-direction: column;
    align-items: center;
  }

  .article-stats {
    grid-template-columns: 1fr 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .related-item .row-bottom {
    aspect-ratio: 16 / 10;
  }
}

/* Móvil pequeño */
@media (max-width: 400px) {
  .category-filter ul {
    gap: 16px;
  }
}