/* ==========================================================================
   JORDI ROS — EDITORIAL BLOG (NYT Inspired Style)
   ========================================================================== */

/* 1. VARIABLES Y RESET */
:root {
  --bg-color: #ffffff;
  --text-color: #121212;
  --meta-color: #666666;
  --border-color: #e2e2e2;
  
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-serif);
  line-height: 1.6;
  padding: 0 1.5rem;
  -webkit-font-smoothing: antialiased;
}

/* 2. CONTENEDORES Y ESTRUCTURA */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 0;
}

.article-container {
  max-width: 680px; /* Ancho idóneo para lectura cómoda sin fatiga visual */
}

/* 3. CABECERA Y LOGO estilo Prensa */
.header {
  max-width: 960px;
  margin: 0 auto;
  padding-top: 2.5rem;
  text-align: center;
}

.logo {
  font-family: 'Times New Roman', var(--font-serif);
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.tagline {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--meta-color);
  margin-bottom: 1.25rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.5rem 0;
}

.header .divider {
  border-top: 2px solid var(--text-color); /* Línea superior doble estilo periódico */
}

/* 4. NAVEGACIÓN Y BOTÓN VOLVER */
.back-link {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--meta-color);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text-color);
}

/* 5. PORTADA (FEED DE ARTÍCULOS) */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem 2rem;
  margin-top: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.category {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--meta-color);
  margin-bottom: 0.5rem;
}

.card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.card h2 a {
  color: var(--text-color);
  text-decoration: none;
  /* Transición suave para que el cambio de color no sea brusco */
  transition: color 0.2s ease; 
}

.card h2 a:hover {
  text-decoration: none;  /* Quitamos el subrayado */
  color: #857b7b;        /* Color al pasar el ratón (Gris medio elegante) */
}
.excerpt {
  font-size: 0.95rem;
  color: #333333;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.date {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--meta-color);
  margin-top: auto;
}

/* 6. PÁGINA DE ARTÍCULO COMPLETO */
.full-article {
  margin-top: 0.5rem;
}

.headline {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 0.5rem 0 1rem 0;
}

.meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--meta-color);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.meta strong {
  color: var(--text-color);
}

.content {
  font-size: 1.15rem;
  line-height: 1.7;
}

.content p {
  margin-bottom: 1.5rem;
}

/* Entradilla destacada */
.content .lead {
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.45;
  color: #1a1a1a;
  margin-bottom: 2rem;
}

.content h2, 
.content h3 {
  font-family: var(--font-sans);
  font-weight: 700;
  margin: 2.5rem 0 1rem 0;
}

.content h2 { font-size: 1.6rem; }
.content h3 { font-size: 1.3rem; }

/* Citas / Destacados */
.content blockquote {
  font-style: italic;
  font-size: 1.25rem;
  border-left: 2px solid var(--text-color);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: #333333;
}

.content ul, 
.content ol {
  margin: 1.5rem 0 1.5rem 2rem;
}

.content li {
  margin-bottom: 0.5rem;
}

.content a {
  color: var(--text-color);
  text-decoration: underline;
}

/* 7. PIE DE PÁGINA */
.footer {
  max-width: 960px;
  margin: 4rem auto 2rem auto;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--meta-color);
}

/* 8. ADAPTACIÓN PARA MÓVILES */
@media (max-width: 768px) {
  .logo {
    font-size: 2.2rem;
  }
  
  .headline {
    font-size: 1.85rem;
  }
  
  .content {
    font-size: 1.05rem;
  }
  
  .feed {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   9. MODO OSCURO AUTOMÁTICO (Ajuste por SO/Navegador)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;       /* Fondo negro mate muy suave */
    --text-color: #e4e4e4;     /* Texto gris claro en lugar de blanco puro */
    --meta-color: #999999;     /* Fechas y categorías en gris medio */
    --border-color: #2c2c2c;   /* Líneas divisorias sutiles */
  }
  
  /* Ajustes finos de contraste para lectura nocturna */
  .excerpt, .content p {
    color: #d0d0d0;
  }

  .content .lead {
    color: #ffffff;
  }

  .content blockquote {
    color: #b0b0b0;
    border-left-color: var(--text-color);
  }

  .back-link:hover {
    color: #ffffff;
  }
  .card h2 a:hover {
    color: #a0a0a0; /* Gris claro suave para el hover en modo oscuro */
  }
}
/* ==========================================================================
   10. TRATAMIENTO DE IMÁGENES Y PIES DE FOTO
   ========================================================================== */

/* Imágenes en las tarjetas de la PORTADA */
.card img {
  width: 100%;
  height: 190px;             /* Altura fija uniforme para todas las portadas */
  object-fit: cover;          /* Recorta la imagen limpiamente sin deformarla */
  margin-bottom: 0.75rem;
  border-radius: 2px;
  display: block;
}

/* Imágenes dentro del ARTÍCULO COMPLETO */
.content img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0 0.5rem 0;
  border-radius: 2px;
}

/* Pies de foto estilo prensa (Figcaption) */
figure {
  margin: 2rem 0;
}

figcaption {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--meta-color);
  margin-top: 0.5rem;
  line-height: 1.4;
  border-left: 2px solid var(--border-color);
  padding-left: 0.6rem;
}
/* ==========================================================================
   11. APERTURA DE PORTADA (El artículo más reciente destacado)
   ========================================================================== */

/* Hacemos que el primer artículo ocupe todo el ancho disponible */
.feed .card:first-child {
  grid-column: 1 / -1; 
  border-bottom: 2px solid var(--text-color); /* Línea más gruesa para separar del resto */
  padding-bottom: 2.5rem;
  margin-bottom: 1rem;
}

/* Imagen panorámica para el artículo principal */
.feed .card:first-child img {
  height: 420px; /* Imagen más espectacular */
}

/* Titular enorme estilo 'Noticia del Día' */
.feed .card:first-child h2 {
  font-size: 2.8rem;
  line-height: 1.1;
  margin-top: 1rem;
}

/* Entradilla más legible para el destacado */
.feed .card:first-child .excerpt {
  font-size: 1.15rem;
  max-width: 800px; /* Evita que el texto sea infinito a lo ancho (fatiga visual) */
  margin-bottom: 1.5rem;
}

/* Ajustes para móviles (para que el destacado no se rompa en pantallas pequeñas) */
@media (max-width: 768px) {
  .feed .card:first-child img {
    height: 250px;
  }
  .feed .card:first-child h2 {
    font-size: 2rem;
  }
}
