/* ==========================================================================
   public.css — Estilos del blog público de Datapolium.
   Paleta exacta igual a la landing React (coherencia visual).

   Principios (spec landing §2.3):
     · Fondo oscuro (#1C1C1C).
     · Verde #85BB65 solo como acento: nav, CTAs, bordes, números fuertes.
     · Respiración: generoso espacio entre secciones.
   ========================================================================== */
:root {
  --brand:        #85BB65;
  --brand-hover:  #9ED67A;
  --brand-muted:  #85BB6530;
  --brand-glow:   #85BB6540;
  --bg-base:      #1C1C1C;
  --bg-card:      #1A1A1A;
  --bg-deep:      #111111;
  --fg-primary:   #E8E8E8;
  --fg-secondary: #A0A0A0;
  --fg-on-brand:  #0D0D0D;
  --data-up:      #85BB65;
  --data-down:    #E05252;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--fg-primary);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

h1, h2, h3 { font-family: "IBM Plex Serif", Georgia, Cambria, serif; color: var(--fg-primary); }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .3em; }
h2 { font-size: 1.6rem; line-height: 1.25; margin: 2rem 0 .8rem; }
h3 { font-size: 1.2rem; margin: 1.4rem 0 .6rem; }

.mono, code, kbd, pre {
  font-family: "IBM Plex Mono", "JetBrains Mono", Consolas, monospace;
}

::selection { background: var(--brand); color: var(--fg-on-brand); }

/* ── NAV superior ──────────────────────────────────────────────────────── */
.blog-nav {
  background: var(--brand);
  color: var(--fg-on-brand);
  position: sticky; top: 0; z-index: 10;
}
.blog-nav-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
}
/* Tamaño 1:1 con la landing React (Logo size="md"):
     · icono: h-9 w-9         → 2.25rem (36 px)
     · texto: text-2xl bold   → 1.5rem / line-height 2rem
     · gap-3                  → 0.75rem
     · tracking-tight         → -0.025em
   Usamos las mismas unidades rem para que escale igual con el root font-size. */
.blog-logo {
  color: var(--fg-on-brand);
  display: inline-flex; align-items: center; gap: 0.75rem;
  font-family: "IBM Plex Serif", Georgia, Cambria, serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.025em;
}
.blog-logo svg { width: 2.25rem; height: 2.25rem; flex-shrink: 0; display: block; }
.blog-logo span { display: inline-block; line-height: 2rem; }
.blog-nav-links { display: flex; align-items: center; gap: 20px; }
.blog-nav-links a { color: var(--fg-on-brand); font-weight: 500; font-size: 15px; }
.blog-nav-links a:hover { opacity: .75; }
/* Botón CTA dentro del nav: el selector .blog-nav-links a tiene mayor
   especificidad que .btn-cta, así que sin esto el texto del botón se
   pintaba en negro sobre fondo negro y sólo aparecía al hacer hover. */
.blog-nav-links a.btn-cta        { color: var(--brand); opacity: 1; }
.blog-nav-links a.btn-cta:hover  { color: var(--brand-hover); opacity: 1; }

/* ── Botones CTA ───────────────────────────────────────────────────────── */
.btn-cta, .btn-cta-lg {
  display: inline-flex; align-items: center; gap: .5em;
  background: var(--fg-on-brand); color: var(--brand);
  padding: 8px 16px; border-radius: 8px;
  font-weight: 600; transition: transform .15s ease, box-shadow .15s ease;
  border: none; cursor: pointer;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.4); color: var(--brand); }

.btn-cta-lg { padding: 14px 22px; font-size: 17px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .5em;
  background: transparent; color: var(--brand);
  padding: 12px 18px; border: 1px solid var(--brand); border-radius: 8px;
  font-weight: 500;
}
.btn-ghost:hover { background: var(--brand); color: var(--fg-on-brand); }

/* ── Layout general ────────────────────────────────────────────────────── */
.blog-main {
  max-width: 1120px; margin: 0 auto;
  padding: 48px 24px;
}
@media (max-width: 640px) { .blog-main { padding: 24px 16px; } }

.kicker {
  color: var(--brand);
  text-transform: uppercase; letter-spacing: .15em;
  font-size: .78rem; font-weight: 600; margin: 0 0 .4rem;
}
.updated { color: var(--fg-secondary); font-size: .9rem; }
.lead    { color: var(--fg-secondary); font-size: 1.1rem; max-width: 62ch; }
.empty   { color: var(--fg-secondary); background: var(--bg-card); padding: 1em; border-radius: 8px; border-top: 3px solid var(--brand); }
.disclaimer { color: var(--fg-secondary); font-size: .88rem; margin-top: 1rem; }

.positivo { color: var(--data-up); }
.negativo { color: var(--data-down); }

/* ── Hero home pública ─────────────────────────────────────────────────── */
.hero-public {
  max-width: 800px; margin: 40px auto 60px;
  text-align: left;
}
.hero-public .cta-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px;
}

/* ── Cards macro ───────────────────────────────────────────────────────── */
.macro-cards {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin: 24px 0 32px;
}
.macro-card {
  background: var(--bg-card); border-top: 3px solid var(--brand);
  border-radius: 12px; padding: 16px;
}
.macro-label { color: var(--fg-secondary); font-size: .88rem; }
.macro-value { font-size: 2rem; color: var(--brand); font-weight: 600; margin: 4px 0; }
.macro-extra { color: var(--fg-secondary); font-size: .82rem; }

/* ── Leyenda del ranking (didáctica) ──────────────────────────────────── */
.rank-legend {
  list-style: none; padding: 0; margin: 18px 0 8px;
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  color: var(--fg-secondary); font-size: .9rem;
}
.rank-legend li { display: inline-flex; align-items: center; gap: 8px; }
.rank-legend .dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.rank-legend .dot-alto  { background: var(--brand); }
.rank-legend .dot-medio { background: #E6B845; }
.rank-legend .dot-bajo  { background: var(--data-down); }

/* Descripción larga del ranking: leíble y con respiración. */
.page-ranking .desc { color: var(--fg-secondary); max-width: 70ch; line-height: 1.6; }

/* ── Tabla ranking ─────────────────────────────────────────────────────── */
.rank-table {
  width: 100%; border-collapse: collapse; margin-top: 16px;
  background: var(--bg-card); border-radius: 12px; overflow: hidden;
}
.rank-table th, .rank-table td { padding: 12px 14px; border-bottom: 1px solid var(--brand-muted); text-align: left; }
.rank-table th { color: var(--fg-secondary); font-weight: 500; font-size: .88rem; background: var(--bg-deep); }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table .sym { color: var(--fg-secondary); }
.rank-table a { color: var(--fg-primary); }
.rank-table a:hover { color: var(--brand); }
.score-cell.score-alto  { color: var(--brand); font-weight: 600; }
.score-cell.score-medio { color: #E6B845; }
.score-cell.score-bajo  { color: var(--data-down); }
.view-more { margin-top: 14px; font-size: .95rem; }

/* ── Página de activo ──────────────────────────────────────────────────── */
.asset-summary {
  display: grid; gap: 24px; grid-template-columns: minmax(160px, 200px) 1fr;
  align-items: center; margin: 24px 0 40px;
}
@media (max-width: 640px) { .asset-summary { grid-template-columns: 1fr; } }

.score-badge {
  background: var(--bg-card); border-top: 3px solid var(--brand);
  border-radius: 12px; padding: 20px; text-align: center;
}
.score-badge .score-value {
  display: block; font-family: "IBM Plex Mono", monospace; font-size: 3.5rem; font-weight: 600; color: var(--brand); line-height: 1;
}
.score-badge .score-scale { color: var(--fg-secondary); font-size: .9rem; }
.score-badge .score-label { display: block; color: var(--fg-secondary); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; margin-top: 6px; }
.score-badge.score-alto  .score-value { color: var(--brand); }
.score-badge.score-medio .score-value { color: #E6B845; }
.score-badge.score-bajo  .score-value { color: var(--data-down); }

.asset-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; margin: 0; }
.asset-metrics dt { color: var(--fg-secondary); font-size: .85rem; }
.asset-metrics dd { margin: 2px 0 0; font-size: 1.2rem; color: var(--fg-primary); font-weight: 500; }

.score-breakdown { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.score-breakdown li {
  display: grid; grid-template-columns: 160px 1fr 60px auto; gap: 12px; align-items: center;
  background: var(--bg-card); padding: 12px 14px; border-radius: 8px;
}
.score-breakdown .bar { display: block; background: #2a2a2a; height: 10px; border-radius: 5px; overflow: hidden; }
.score-breakdown .fill { display: block; height: 100%; background: var(--brand); }
.score-breakdown .value { color: var(--fg-primary); text-align: right; }
.score-breakdown .interp { color: var(--fg-secondary); font-size: .88rem; grid-column: 1 / -1; }
@media (max-width: 640px) { .score-breakdown li { grid-template-columns: 1fr auto; } .score-breakdown .bar, .score-breakdown .interp { grid-column: 1 / -1; } }

.signals { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.signals li { padding: 10px 14px; background: var(--bg-card); border-radius: 8px; border-left: 3px solid var(--brand-muted); }
.signals .sig-alcista { border-left-color: var(--data-up); }
.signals .sig-bajista { border-left-color: var(--data-down); }
.signals .icono { margin-right: .5em; font-weight: 600; }
.signals .name { color: var(--fg-primary); font-weight: 500; }

.related-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.related-list a { background: var(--bg-card); padding: 6px 12px; border-radius: 6px; color: var(--fg-primary); }
.related-list a:hover { color: var(--brand); }

/* ── CTA embebido ──────────────────────────────────────────────────────── */
.cta-register {
  margin: 48px 0; padding: 28px; border-radius: 12px;
  background: var(--bg-deep); border: 1px solid var(--brand-muted);
}
.cta-register h3 { margin-top: 0; color: var(--fg-primary); }
.cta-register p { color: var(--fg-secondary); }
.cta-register-caption { font-size: .9rem; color: var(--fg-secondary); }
.cta-register .btn-cta-lg { background: var(--brand); color: var(--fg-on-brand); margin-top: 8px; }

/* ── Glosario: índice + ficha ──────────────────────────────────────────── */
/* Onboarding v2 Pieza 6 (modelo §8.1): buscador instantáneo, categorías
   expandibles (<details>), impresión limpia. Estilos coherentes con el
   resto del blog público — usan los mismos tokens. */

/* Buscador + acciones */
.glosario-header { margin-bottom: 28px; }
.glosario-controls {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin: 20px 0 8px;
}
.glosario-search {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; flex: 1 1 280px; min-width: 240px;
  background: var(--bg-card); border: 1px solid var(--brand-muted);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.glosario-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(133, 187, 101, 0.18);
}
.glosario-search svg { color: var(--fg-secondary); flex-shrink: 0; }
.glosario-search input {
  flex: 1; border: 0; background: transparent;
  color: var(--fg-primary); font-size: .95rem; outline: none; padding: 0;
}
.glosario-search input::placeholder { color: var(--fg-secondary); }
.glosario-kbd {
  font-family: inherit; font-size: .72rem;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-deep); color: var(--fg-secondary);
  border: 1px solid var(--brand-muted);
}
/* Grupos por categoría (<details>) */
.glosario-grupos { display: grid; gap: 12px; }
.glosario-grupo {
  background: var(--bg-card); border: 1px solid var(--brand-muted);
  border-radius: 12px; padding: 4px 16px;
}
.glosario-grupo[open] { padding-bottom: 12px; }
.glosario-grupo summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; font-weight: 600; color: var(--fg-primary);
}
.glosario-grupo summary::-webkit-details-marker { display: none; }
.glosario-grupo summary::before {
  content: "▸"; margin-right: 10px; color: var(--brand);
  transition: transform .15s; display: inline-block;
}
.glosario-grupo[open] summary::before { transform: rotate(90deg); }
.glosario-grupo-count {
  font-size: .8rem; color: var(--fg-secondary);
  background: var(--bg-deep); padding: 2px 8px; border-radius: 9999px;
  font-weight: 500;
}

/* Lista de términos */
.glosario-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.glosario-list a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--fg-primary); text-decoration: none;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.glosario-list a:hover {
  background: var(--bg-deep); border-color: var(--brand-muted);
}
.glosario-list strong { color: var(--brand); font-size: .98rem; display: block; }
.glosario-list span   { color: var(--fg-secondary); font-size: .88rem; line-height: 1.5; }

.glosario-empty {
  margin: 24px 0; padding: 16px; text-align: center;
  color: var(--fg-secondary); font-size: .92rem;
  background: var(--bg-card); border: 1px dashed var(--brand-muted);
  border-radius: 10px;
}

/* Página de término individual */
.page-glosario .glosario-body p { line-height: 1.7; }
.page-glosario .related-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.page-glosario .related-list a {
  display: inline-block; padding: 6px 12px;
  border: 1px solid var(--brand-muted); border-radius: 9999px;
  font-size: .88rem; color: var(--fg-primary); text-decoration: none;
}
.page-glosario .related-list a:hover {
  border-color: var(--brand); color: var(--brand);
}
.page-glosario .disclaimer {
  margin-top: 32px; padding-top: 16px; font-size: .85rem;
  color: var(--fg-secondary); border-top: 1px solid var(--brand-muted);
}

/* Estilos de impresión — limpio, B/N, sin nav/footer/CTAs.
   Soporta tanto índice como ficha. */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .blog-nav, .blog-footer, .cta-register, .no-print,
  .glosario-controls,
  .newsletter-inline {
    display: none !important;
  }
  .glosario-grupo { background: #fff !important; border-color: #ccc !important; page-break-inside: avoid; }
  .glosario-grupo[open] summary::before { transform: none; }
  /* <details> se imprime expandido por defecto al añadir `open` por JS,
     pero forzamos por si acaso (no todos los UA respetan open en print). */
  details:not([open]) > *:not(summary) { display: block !important; }
  details > summary { list-style: none; pointer-events: none; }
  .glosario-list a, .glosario-list strong, .glosario-list span,
  .page-glosario h1, .page-glosario p { color: #000 !important; }
  .glosario-search, .glosario-empty { display: none !important; }
  a { color: #000 !important; text-decoration: none !important; }
  a[href^="/"]::after { content: " (" attr(href) ")"; color: #444; font-size: .85em; }
}

/* Utilidad accesibilidad — esconde visualmente pero anuncia al lector. */
.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important; border: 0 !important;
}

/* ── Blog: recursos (auditoría, eventos, glosario, comparar, discrepancias) ─ */
.blog-resources { margin: 32px 0 40px; }
.blog-resources h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-secondary); margin: 0 0 12px; }
.resources-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.resources-grid a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--bg-card);
  border-radius: 10px; background: var(--bg-card);
  color: var(--fg-primary); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.resources-grid a:hover { border-color: var(--brand); transform: translateY(-1px); }
.resources-grid strong { color: var(--brand); font-size: .95rem; }
.resources-grid span { color: var(--fg-secondary); font-size: .82rem; line-height: 1.45; }
.blog-section-title { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-secondary); margin: 32px 0 16px; }

.blog-footer-resources { margin: 0 0 12px; font-size: .9rem; }
.blog-footer-resources a { margin: 0 4px; }

/* ── Blog posts ────────────────────────────────────────────────────────── */
.blog-index .posts-list,
.home-posts .posts-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; }
.posts-list a { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; color: var(--fg-primary); }
.posts-list a:hover .post-title { color: var(--brand); }
.post-title { font-family: "IBM Plex Serif", serif; font-weight: 600; font-size: 1.2rem; }
.post-date  { color: var(--fg-secondary); font-size: .88rem; white-space: nowrap; }
.post-excerpt { color: var(--fg-secondary); margin: 4px 0 0; font-size: .95rem; }

.blog-post { max-width: 720px; margin: 0 auto; }
.post-cover img { width: 100%; border-radius: 12px; display: block; }
.post-meta { color: var(--fg-secondary); font-size: .9rem; }
.post-meta .post-author { color: var(--fg-secondary); }
.post-meta .post-author strong { color: var(--fg-primary); font-weight: 600; }

/* Vídeo incrustado (YouTube/Vimeo). Ratio 16:9 responsive: padding-bottom
   56.25% mantiene la proporción sin importar el ancho del contenedor. */
.post-content .video-embed,
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin: 1.5em 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.post-content .video-embed iframe,
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.post-content { font-size: 1.08rem; line-height: 1.75; }
.post-content h2 { margin-top: 2em; }
.post-content p  { margin: 1em 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content blockquote {
  margin: 1.4em 0; padding: 10px 18px;
  border-left: 3px solid var(--brand); background: var(--bg-card);
  color: var(--fg-secondary); border-radius: 0 8px 8px 0;
}
.post-content img { max-width: 100%; border-radius: 8px; margin: 1em 0; display: block; }
.post-content a { color: var(--brand); text-decoration: underline; }
.post-content code {
  background: var(--bg-card); padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--brand-muted); font-size: .94em;
}
.post-content pre {
  background: var(--bg-deep); padding: 14px; border-radius: 8px;
  overflow-x: auto; border: 1px solid var(--brand-muted);
}
.post-footer { margin-top: 40px; }

/* ── Posts relacionados ───────────────────────────────────────────────── */
.related-posts { margin-top: 48px; }
.related-posts h3 { margin-bottom: 12px; }

/* ── Newsletter inline (post-contenido) ───────────────────────────────── */
.newsletter-inline {
  margin: 48px 0 24px;
  padding: 22px 26px;
  background: var(--bg-card);
  border: 1px solid var(--brand-muted);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
}
.newsletter-inline h3 { margin: 0 0 6px; font-size: 1.1rem; }
.newsletter-inline p  { margin: 0 0 14px; color: var(--fg-secondary); font-size: .95rem; }
.newsletter-inline-form {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.newsletter-inline-form input {
  flex: 1; min-width: 200px;
  padding: 10px 12px; background: var(--bg-deep); color: var(--fg-primary);
  border: 1px solid var(--brand-muted); border-radius: 6px; font: inherit;
}
.newsletter-inline-form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.newsletter-inline-form button {
  background: var(--brand); color: var(--fg-on-brand); border: 0;
  padding: 10px 18px; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.newsletter-inline-form button:disabled { opacity: .6; cursor: wait; }
.newsletter-inline-msg { margin: 10px 0 0; font-size: .9rem; }
.newsletter-inline-msg.ok  { color: var(--brand); }
.newsletter-inline-msg.err { color: var(--data-down); }

/* sr-only util */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 404 ───────────────────────────────────────────────────────────────── */
.page-404 { text-align: center; padding: 80px 20px; }
.big-404  { font-size: 7rem; color: var(--brand); margin: 0; line-height: 1; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.blog-footer { background: var(--brand); color: var(--fg-on-brand); margin-top: 80px; }
.blog-footer-inner { max-width: 1120px; margin: 0 auto; padding: 28px 24px; text-align: center; }
.blog-footer a { color: var(--fg-on-brand); text-decoration: underline; }
.blog-footer-legal { margin: 8px 0; }
.blog-footer-disclaimer { font-size: .85rem; opacity: .85; }
