/* assets/css/blog.css — Estilos artículo de blog · FuncioHouse Design System v1 */

/* ── Layout artículo ──────────────────────────────────────────── */
.art-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
  padding: clamp(2.5rem, 5vh, 4rem) 0 clamp(4rem, 8vh, 7rem);
}
.art-layout > * { min-width: 0; }
@media (max-width: 900px) {
  .art-layout { grid-template-columns: 1fr; }
  .art-sidebar { order: -1; }
}

/* ── Cabecera del artículo ────────────────────────────────────── */
.art-header { margin-bottom: 2.25rem; }

.art-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.art-badge {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-naranja);
  background: oklch(57% 0.21 36 / 0.1);
  border: 1px solid oklch(57% 0.21 36 / 0.25);
  border-radius: var(--r-pill);
  padding: 0.3rem 0.85rem;
  text-decoration: none;
  transition: background 140ms ease-out;
}
.art-badge:hover { background: oklch(57% 0.21 36 / 0.18); }

.art-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.8vw, 2.875rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  text-wrap: balance;
  margin-bottom: 1.25rem;
}
.art-h1 .accent { color: var(--color-naranja); }

.art-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.art-meta time { font-variant-numeric: tabular-nums; }
.art-meta-sep { width: 3px; height: 3px; background: var(--text-muted); border-radius: 50%; flex-shrink: 0; }
.art-meta-author { color: var(--text-secondary); font-weight: 500; }

/* ── Imagen destacada ─────────────────────────────────────────── */
.art-hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-lg);
  margin-bottom: 2.5rem;
  display: block;
}

/* ── Cuerpo del artículo (prose) ─────────────────────────────── */
.art-prose {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.4vw, 1.0625rem);
  line-height: 1.78;
  color: var(--text-secondary);
}
.art-prose > * + * { margin-top: 1.4em; }

.art-prose h2,
.art-prose h3,
.art-prose h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.25;
  margin-top: 2.25em;
  margin-bottom: 0.65em;
  scroll-margin-top: 5rem;
}
.art-prose h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); font-weight: 700; }
.art-prose h3 { font-size: clamp(1.1rem, 1.8vw, 1.3rem);  font-weight: 600; }
.art-prose h4 { font-size: clamp(1rem,  1.5vw, 1.125rem); font-weight: 600; }

.art-prose a {
  color: var(--color-naranja);
  text-decoration: underline;
  text-decoration-color: oklch(57% 0.21 36 / 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms;
}
.art-prose a:hover { text-decoration-color: var(--color-naranja); }

.art-prose strong { color: var(--text-primary); font-weight: 600; }
.art-prose em     { font-style: italic; color: var(--text-secondary); }

.art-prose ul,
.art-prose ol {
  padding-left: 1.4em;
  list-style: disc;
}
.art-prose ol { list-style: decimal; }
.art-prose li { margin-top: 0.4em; }
.art-prose li::marker { color: var(--color-naranja); }

.art-prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.art-prose figure { margin: 1.8em 0; }
.art-prose figure img {
  width: 100%;
  border-radius: var(--r-md);
  display: block;
}
.art-prose figcaption {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5em;
}

/* Tabla de datos */
.art-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-family: var(--font-body);
  margin: 1.75em 0;
  overflow-x: auto;
  display: block;
}
.art-prose th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.art-prose td {
  padding: 0.55rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.art-prose tr:last-child td { border-bottom: none; }
.art-prose tr:nth-child(even) td { background: oklch(100% 0 0 / 0.018); }

/* ── Tarjetas de dato (fh-stats) ─────────────────────────────── */
.fh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 1.8em 0;
}
.fh-stat {
  background: oklch(100% 0 0 / 0.04);
  border: 0.5px solid oklch(100% 0 0 / 0.1);
  border-radius: 10px;
  padding: 14px 16px;
}
.fh-stat-label {
  font-size: 0.72rem;
  color: oklch(70% 0 0);
  margin: 0 0 4px;
  line-height: 1.3;
}
.fh-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  color: oklch(95% 0 0);
}
.fh-stat-value.neg { color: oklch(65% 0.18 25); }
.fh-stat-sub {
  font-size: 0.68rem;
  color: oklch(55% 0 0);
  margin: 4px 0 0;
}
.fh-bar-wrap {
  margin: 0.5em 0 1.8em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fh-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 42px;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}
.fh-bar-row span:first-child { color: oklch(65% 0 0); }
.fh-bar-track {
  background: oklch(100% 0 0 / 0.08);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.fh-bar-fill { height: 100%; border-radius: 4px; background: oklch(65% 0.18 25); }
.fh-bar-fill.neutral { background: oklch(60% 0 0); }
.fh-bar-val { font-weight: 600; font-size: 0.75rem; color: oklch(90% 0 0); text-align: right; }

/* ── TOC Sidebar ──────────────────────────────────────────────── */
.art-sidebar { position: sticky; top: 5.5rem; }

.art-toc {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.375rem;
}
.art-toc-title {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.art-toc-title::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--color-naranja);
  flex-shrink: 0;
}
.art-toc-list { list-style: none; padding: 0; margin: 0; }
.art-toc-list li { margin: 0; }
.art-toc-list a {
  display: block;
  font-size: 0.825rem;
  line-height: 1.45;
  color: var(--text-muted);
  padding: 0.35rem 0 0.35rem 0.875rem;
  border-left: 2px solid var(--border);
  text-decoration: none;
  transition: color 140ms, border-color 140ms;
}
.art-toc-list a:hover,
.art-toc-list a.toc-active {
  color: var(--color-naranja);
  border-left-color: var(--color-naranja);
}
.art-toc-list .toc-h3 a,
.art-toc-list .toc-h4 a { padding-left: 1.6rem; font-size: 0.8rem; }

/* ── CTA hipoteca/cooperativa ─────────────────────────────────── */
.art-cta {
  margin: 3rem 0 0;
  background: linear-gradient(135deg, oklch(57% 0.21 36 / 0.07) 0%, transparent 60%),
              var(--bg-surface);
  border: 1px solid oklch(57% 0.21 36 / 0.22);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
@media (max-width: 640px) { .art-cta { flex-direction: column; } }
.art-cta-ico {
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: #E8500A;
  display: flex;
  align-items: flex-start;
}
.art-cta-body { flex: 1; }
.art-cta-body h3 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.art-cta-body p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.art-cta-btns { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Posts relacionados ───────────────────────────────────────── */
.art-related { margin-top: 4rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.art-related-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.art-related-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.art-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.art-related-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 180ms, transform 180ms;
  display: flex;
  flex-direction: column;
}
.art-related-card:hover { border-color: oklch(57% 0.21 36 / 0.4); transform: translateY(-2px); }
.art-related-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.art-related-card-body { padding: 1rem; flex: 1; }
.art-related-card-cat {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-naranja);
  margin-bottom: 0.5rem;
}
.art-related-card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Progreso de lectura (barra top) ──────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-naranja);
  z-index: 9999;
  transition: width 80ms linear;
}

/* ═══════════════════════════════════════════════════════════════
   ÍNDICE DEL BLOG (blog/index.php)
   ═══════════════════════════════════════════════════════════════ */

/* ── Submenú sticky (2 filas) ─────────────────────────────────────── */
.blog-submenu {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #1a1a1a;
  border-bottom: 1px solid var(--border);
}
.blog-submenu-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem 0;
}
.blog-submenu-row--temas {
  border-bottom: 1px solid var(--border);
}
.blog-submenu-row--cuerpos {
  background: #161616;
}
.blog-submenu-row--cuerpos .blog-submenu-row {
  border-bottom: none;
}
.blog-cuerpo-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.25);
  white-space: nowrap;
  flex-shrink: 0;
}
.blog-tab {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.blog-tab:hover { color: var(--text-primary); }
.blog-tab.active { color: #FFFFFF; border-bottom-color: var(--color-naranja); }

.blog-tab-cuerpo {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
}
.blog-tab-cuerpo:hover { color: rgba(255, 255, 255, 0.6); }
.blog-tab-cuerpo.active { color: var(--color-naranja); }

/* ── Hero strip ────────────────────────────────────────────────── */
.blog-hero {
  background: #1a1a1a;
  padding: clamp(2.5rem, 6vh, 4rem) 0;
}
.blog-hero-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-naranja);
  margin-bottom: 0.75rem;
}
.blog-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.9rem;
}
.blog-hero-title .accent { color: var(--color-naranja); }
.blog-hero-meta {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Sección genérica ─────────────────────────────────────────── */
.blog-section { padding: clamp(2.5rem, 5vh, 3.5rem) 0; }
.blog-section-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ── Destacados (2 columnas, imagen izq + texto der) ─────────────── */
.blog-featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .blog-featured-grid { grid-template-columns: 1fr; }
  .art-related-grid { grid-template-columns: 1fr; }

  /* Ocultar ticker y banner en blog móvil */
  .ticker { display: none; }
  .urgency-banner { display: none; }

  /* FIX 1: art-layout colapsa a columna única en móvil */
  .art-layout { grid-template-columns: 1fr !important; }
  .art-sidebar { display: none; }
  .art-main { min-width: 0; width: 100%; }

  /* FIX 2: TOC deja de ser sticky en móvil */
  .art-toc { position: static !important; }

  /* Submenús: scroll horizontal en vez de wrap vertical */
  .blog-submenu-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    scrollbar-width: none; /* Firefox */
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .blog-submenu-row::-webkit-scrollbar { display: none; }
  .blog-cuerpo-label { display: none; }
}
.blog-featured-card {
  display: flex;
  gap: 1.25rem;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.blog-featured-card:hover {
  border-color: oklch(57% 0.21 36 / 0.4);
  transform: translateY(-2px);
}
.blog-featured-img {
  position: relative;
  width: 200px;
  flex-shrink: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  min-height: 200px;
  background: #2a2a2a;
}
.blog-featured-img img,
.blog-featured-img .blog-img-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.blog-img-fallback {
  background: #2a2a2a;
  min-height: 200px;
}
.blog-featured-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--color-naranja);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.55rem;
  border-radius: 0.3rem;
}
.blog-featured-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.blog-featured-title {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  transition: color 0.15s ease;
}
.blog-featured-card:hover .blog-featured-title { color: var(--color-naranja); }
.blog-featured-title .accent { color: var(--color-naranja); }
.blog-featured-card:hover .blog-featured-title .accent { color: var(--color-naranja); }
.blog-featured-excerpt {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
}
.blog-featured-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ── Grid 3 columnas (últimas entradas) ──────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .blog-grid { grid-template-columns: 1fr; }
}
.blog-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.blog-card:hover {
  border-color: oklch(57% 0.21 36 / 0.4);
  transform: translateY(-2px);
}
.blog-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  background: #2a2a2a;
}
.blog-card-img img,
.blog-card-img .blog-img-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.blog-card-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: oklch(0% 0 0 / 0.55);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.55rem;
  border-radius: 0.3rem;
}
.blog-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  transition: color 0.15s ease;
}
.blog-card:hover .blog-card-title { color: var(--color-naranja); }
.blog-card-title .accent { color: var(--color-naranja); }
.blog-card:hover .blog-card-title .accent { color: var(--color-naranja); }
.blog-card-excerpt {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
}
.blog-card-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}
.blog-card-date svg { flex-shrink: 0; opacity: 0.6; }

/* ── Paginación ────────────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0 1rem;
  flex-wrap: wrap;
}
.blog-page-link,
.blog-page-num {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.blog-page-link:hover,
.blog-page-num:hover { border-color: oklch(57% 0.21 36 / 0.4); color: var(--text-primary); }
.blog-page-num.active {
  background: var(--color-naranja);
  border-color: var(--color-naranja);
  color: #FFFFFF;
}
.blog-page-ellipsis { color: var(--text-muted); padding: 0.5rem 0.3rem; }
