/* ==========================================================================
   Genealogía JJQM - Estilos de la Portada & Blog
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta histórica y moderna */
  --bg-main: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(26, 36, 56, 0.9);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(16, 185, 129, 0.35);

  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
}

.glow-top-left {
  width: 550px;
  height: 550px;
  top: -150px;
  left: 10%;
  background: radial-gradient(circle, var(--accent-emerald), transparent 70%);
}

.glow-bottom-right {
  width: 500px;
  height: 500px;
  bottom: 0;
  right: 10%;
  background: radial-gradient(circle, #0284c7, transparent 70%);
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* Header & Barra de Navegación */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 3.5rem;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #059669, #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.brand-info h1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-info span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-cta-diagrams {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: white;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: var(--transition);
}

.btn-cta-diagrams:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

/* Hero Section */
.hero-box {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 3.5rem;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.gradient-title {
  background: linear-gradient(135deg, #a7f3d0 0%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.12rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: var(--accent-emerald);
  color: #0b0f19;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-hero-primary:hover {
  background: #34d399;
  transform: translateY(-2px);
}

.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Banner de la Herramienta de Diagramas */
.app-highlight-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99, 102, 241, 0.06));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.banner-left {
  max-width: 620px;
}

.banner-left h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.banner-left p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.banner-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.feature-tag {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  color: #cbd5e1;
}

/* Sección de Artículos / Blog */
.articles-section {
  margin-bottom: 4rem;
}

.section-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 1rem;
}

.section-top h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-top p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Filtros y Buscador */
.blog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-emerald);
  color: #0b0f19;
  font-weight: 700;
  border-color: var(--accent-emerald);
}

.blog-search-box {
  position: relative;
  width: 100%;
  max-width: 300px;
}

.blog-search-box input {
  width: 100%;
  padding: 8px 14px 8px 34px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

.blog-search-box input:focus {
  border-color: var(--accent-emerald);
}

.search-svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

/* Grid de Artículos */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.article-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -8px rgba(16, 185, 129, 0.15);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.topic-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.article-date {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.article-title {
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}

.article-excerpt {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.card-read-link {
  color: #6ee7b7;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Modal de Lectura */
.article-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.article-modal-body {
  background: #111827;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.modal-content-rendered {
  color: #cbd5e1;
  font-size: 1.02rem;
  line-height: 1.75;
}

.modal-content-rendered h3 {
  color: #ffffff;
  margin: 1.5rem 0 0.5rem;
  font-size: 1.2rem;
}

.modal-content-rendered ul {
  margin: 0.75rem 0 1.25rem 1.5rem;
}

.modal-content-rendered li {
  margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
  padding-top: 3rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-nav {
    justify-content: space-between;
  }
  .articles-grid {
    grid-template-columns: 1fr;
  }
  .app-highlight-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
