:root {
  --bg: #f7f8fb;
  --card-bg: #ffffff;
  --text: #1a1d29;
  --text-muted: #5b6172;
  --border: #e5e7ef;
  --accent: #2563eb;
  --header-bg: #101425;
  --header-text: #f5f6fa;
  --radius: 12px;
  --max-width: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --card-bg: #171a23;
    --text: #eceef3;
    --text-muted: #9aa0b2;
    --border: #262a37;
    --header-bg: #0a0c13;
    --header-text: #f5f6fa;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 0.25s ease;
}

header.site-header.is-scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo .dot { color: #4f8cff; }

.tagline {
  font-size: 0.8rem;
  color: #aab0c4;
  font-weight: 400;
  margin-top: 2px;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  row-gap: 10px;
}

nav.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #cfd3e2;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  display: inline-block;
}

nav.main-nav a:hover {
  transform: translateY(-1px);
}

nav.main-nav a:hover,
nav.main-nav a.active {
  background: #2563eb;
  color: #fff;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7d84a0;
  margin-left: 10px;
  padding-right: 2px;
  white-space: nowrap;
}

.nav-group-label--guides {
  margin-left: 16px;
}

/* Enlaces a guías: solo explican conceptos, no son secciones de noticias
   de la portada, así que llevan un estilo "contorno" en vez de píldora sólida. */
nav.main-nav a.nav-link--guide {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #cfd3e2;
}

nav.main-nav a.nav-link--guide:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

nav.main-nav a.nav-link--guide.active {
  background: #fff;
  border-color: #fff;
  color: #101425;
}

/* Hero */
.hero {
  position: relative;
  padding: 48px 0 28px;
  overflow: hidden;
}

.hero h1 {
  position: relative;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hero p {
  position: relative;
  color: var(--text-muted);
  max-width: 640px;
  font-size: 1.05rem;
  margin: 0;
}

.hero-blob {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  pointer-events: none;
}

.hero-blob--1 {
  width: 320px;
  height: 320px;
  top: -160px;
  right: -60px;
  background: radial-gradient(circle, #2563eb, transparent 70%);
  animation: floatBlob 14s ease-in-out infinite;
}

.hero-blob--2 {
  width: 260px;
  height: 260px;
  bottom: -140px;
  left: -60px;
  background: radial-gradient(circle, #0d9488, transparent 70%);
  animation: floatBlob 18s ease-in-out infinite reverse;
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, 18px) scale(1.08); }
}

/* Barra de estadísticas */
.stats-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 28px 0 8px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.15);
}

.filter-btn:active { transform: translateY(0); }

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Grid & cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px 0 56px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.card:hover .card-icon {
  transform: scale(1.15) rotate(-6deg);
}

.card-banner {
  height: 84px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
}

.card-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.25s ease;
  display: inline-block;
}

.card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.card-summary {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}

.card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-eyebrow::before {
  content: "✨";
}

/* Tarjeta destacada: la noticia más reciente de la portada */
.card--featured {
  grid-column: 1 / -1;
  flex-direction: row;
}

.card--featured .card-banner {
  height: auto;
  width: 200px;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
}

.card--featured .card-icon {
  font-size: 2rem;
}

.card--featured .card-title {
  font-size: 1.35rem;
}

@media (max-width: 640px) {
  .card--featured {
    flex-direction: column;
  }

  .card--featured .card-banner {
    width: 100%;
    height: 84px;
  }
}

.card-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* Category badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  width: fit-content;
}

/* Article page */
.article-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.article-wrap--wide {
  max-width: 960px;
}

.text-muted {
  color: var(--text-muted);
  font-weight: 400;
}

.table-scroll {
  overflow-x: auto;
  margin: 20px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--card-bg);
}

.compare-table th,
.compare-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.compare-table th {
  font-weight: 700;
  white-space: nowrap;
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.compare-table td:first-child {
  font-weight: 700;
  white-space: nowrap;
}

.table-note {
  margin: -20px 0 32px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.92rem;
}

.article-wrap h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 14px 0 8px;
  letter-spacing: -0.02em;
}

.article-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 14px 0 0;
}

.article-body h2 {
  font-size: 1.2rem;
  margin: 32px 0 8px;
  letter-spacing: -0.01em;
}

.article-body h3 {
  font-size: 1.05rem;
  margin: 24px 0 6px;
}

.article-body a {
  color: var(--accent);
  font-weight: 600;
}

.article-body p {
  font-size: 1.05rem;
  margin: 0 0 18px;
}

.article-body ul {
  margin: 0 0 18px;
  padding-left: 22px;
  font-size: 1.05rem;
}

.article-body li {
  margin-bottom: 8px;
}

.guide-image {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 4px auto 18px;
  border-radius: var(--radius);
}

.source-box {
  margin-top: 32px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 0.9rem;
}

.source-box a {
  color: var(--accent);
  font-weight: 700;
}

/* Disclaimer */
.disclaimer {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 40px;
}

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-nav a {
  font-weight: 600;
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--accent);
}

.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--text-muted);
}

/* Animación de entrada: se dispara sola al cargar la página (no depende del
   scroll ni de JavaScript), para que el contenido nunca quede oculto si el
   usuario no llega a desplazarse hasta abajo. */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.reveal {
  animation: fadeInUp 0.6s ease both;
}

.grid .card.reveal:nth-child(1) { animation-delay: 0ms; }
.grid .card.reveal:nth-child(2) { animation-delay: 60ms; }
.grid .card.reveal:nth-child(3) { animation-delay: 120ms; }
.grid .card.reveal:nth-child(4) { animation-delay: 180ms; }
.grid .card.reveal:nth-child(5) { animation-delay: 240ms; }
.grid .card.reveal:nth-child(6) { animation-delay: 300ms; }
.grid .card.reveal:nth-child(n+7) { animation-delay: 360ms; }

/* Botón flotante para volver arriba */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
  z-index: 90;
}

.back-to-top:hover {
  background: #1d4fd1;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
