/* ==========================================================================
   BLOG EDITORIAL B2B - MEAT DELI CHILE
   Arquitectura limpia basada en referencias 21st.dev (HTML/CSS nativo)
   ========================================================================== */

:root {
  --primary: #C72429;
  --primary-dark: #991b1b;
  --primary-light: #fef2f2;
  --green-wa: #25D366;
  --green-wa-dark: #16a34a;
  --gold: #D4AF37;
  --gold-dark: #854d0e;
  --gold-light: #fef9c3;

  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #cbd5e1;

  --text-main: #0f172a;
  --text-sub: #334155;
  --text-muted: #64748b;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Barlow Condensed', "Arial Narrow", sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 16px 32px rgba(15, 23, 42, 0.1);
  --shadow-wa: 0 8px 20px rgba(37, 211, 102, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-alt);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER COMPACTO INSTITUCIONAL
   ========================================================================== */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: #C72429;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  box-shadow: 0 4px 20px rgba(199, 36, 41, 0.2);
}

.blog-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.blog-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.blog-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #ffffff;
  object-fit: cover;
}

.blog-brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.blog-brand-name span {
  color: #000000;
}

.blog-header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.blog-nav-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.blog-nav-link:hover {
  opacity: 0.85;
}

.blog-header-btn {
  background: var(--green-wa);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.blog-header-btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .blog-nav-link {
    display: none;
  }
  .blog-header-btn {
    padding: 7px 12px;
    font-size: 0.82rem;
  }
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.breadcrumb-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 0 16px;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-sub);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: #94a3b8;
  user-select: none;
}

.breadcrumb-item.current {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   PORTADA: HERO EDITORIAL & GRILLA
   ========================================================================== */
.editorial-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 36px 16px;
}

.editorial-tag {
  display: inline-block;
  background: var(--gold-light);
  border: 1px solid #fde047;
  color: var(--gold-dark);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.editorial-h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 12px;
}

.editorial-sub {
  font-size: 1.05rem;
  color: var(--text-sub);
  max-width: 760px;
  line-height: 1.6;
}

/* Grilla de Artículos */
.blog-grid-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 48px 16px;
}

.article-card-featured {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card-featured:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

@media (max-width: 860px) {
  .article-card-featured {
    grid-template-columns: 1fr;
  }
}

.article-card-featured .card-img-wrap {
  width: 100%;
  height: 100%;
  min-height: 280px;
  max-height: 380px;
  background: #f1f5f9;
}

.article-card-featured .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-featured .card-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  align-self: flex-start;
}

.card-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 12px;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: var(--primary);
}

.card-excerpt {
  color: var(--text-sub);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-read-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  margin-top: 16px;
}

.card-read-link:hover {
  text-decoration: underline;
}

.blog-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.article-card-standard {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card-standard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.article-card-standard .card-img-wrap {
  width: 100%;
  height: 220px;
  background: #f1f5f9;
}

.article-card-standard .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-standard .card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

/* ==========================================================================
   PLANTILLA DE ARTÍCULO: LAYOUT EDITORIAL CON TOC
   ========================================================================== */
.article-header {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 20px 16px;
  text-align: center;
}

.article-h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
  margin: 12px 0 16px 0;
}

.article-lead {
  font-size: 1.1rem;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 18px;
}

.article-meta-bar {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #ffffff;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.article-main-image-wrap {
  max-width: 1000px;
  margin: 0 auto 36px auto;
  padding: 0 16px;
}

.article-main-image-wrap img {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.article-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 60px 16px;
  display: grid;
  grid-template-columns: minmax(0, 740px) 280px;
  gap: 48px;
  align-items: start;
}

@media (max-width: 960px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.article-content {
  font-size: 1.05rem;
  color: var(--text-sub);
  line-height: 1.75;
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 36px 0 14px 0;
  line-height: 1.2;
  scroll-margin-top: 80px;
}

.article-content h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin: 24px 0 10px 0;
  line-height: 1.25;
  scroll-margin-top: 80px;
}

.article-content p {
  margin-bottom: 18px;
}

.article-content ul, .article-content ol {
  margin: 0 0 20px 24px;
}

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

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.article-content a:hover {
  color: var(--primary-dark);
}

/* Tabla de Contenidos Sticky (Sidebar Desktop) */
.toc-sidebar {
  position: sticky;
  top: 80px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.toc-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-list {
  list-style: none;
  font-size: 0.88rem;
}

.toc-item {
  margin-bottom: 8px;
}

.toc-item a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 3px 0 3px 8px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.toc-item a:hover, .toc-item a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
  background: #fef2f2;
}

.toc-mobile-box {
  display: none;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .toc-sidebar {
    display: none;
  }
  .toc-mobile-box {
    display: block;
  }
}

/* Callout / Cajas de Fórmulas y Notas */
.callout-box {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}

.callout-box.formula-box {
  border-left-color: #0284c7;
  background: #f0f9ff;
}

.callout-box.note-box {
  border-left-color: var(--gold);
  background: #fefce8;
  font-size: 0.9rem;
}

.formula-title {
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.formula-code {
  font-family: monospace;
  background: #ffffff;
  border: 1px solid #bae6fd;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: block;
  color: #0c4a6e;
  font-size: 0.92rem;
  margin: 6px 0 10px 0;
}

/* Tablas Financieras Comparables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.table-b2b {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.table-b2b th {
  background: #f8fafc;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--text-main);
}

.table-b2b td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
}

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

/* Preguntas Frecuentes */
.faq-block {
  margin: 32px 0;
}

.faq-item {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
}

.faq-q {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.faq-a {
  font-size: 0.95rem;
  color: var(--text-sub);
}

/* Banner Comercial CTA en Artículo */
.article-cta-box {
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
  border: 2px solid rgba(199, 36, 41, 0.25);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 40px 0;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.article-cta-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.article-cta-desc {
  font-size: 0.95rem;
  color: var(--text-sub);
  max-width: 580px;
  margin: 0 auto 20px auto;
}

.article-cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-cta-primary {
  background: linear-gradient(135deg, #25D366 0%, #16a34a 100%);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-wa);
}

.btn-cta-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1.5px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-cta-secondary:hover {
  background: #f1f5f9;
}

/* Artículos Relacionados */
.related-section {
  max-width: 1100px;
  margin: 0 auto 40px auto;
  padding: 0 16px;
}

.related-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

/* ==========================================================================
   FOOTER EDITORIAL CORPORATIVO
   ========================================================================== */
.blog-footer {
  border-top: 1px solid var(--border);
  padding: 40px 16px 60px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: #ffffff;
}

.blog-footer a {
  color: var(--text-sub);
  text-decoration: none;
  margin: 0 8px;
  font-weight: 600;
}

.blog-footer a:hover {
  color: var(--primary);
}
