/* =============================================
   Blog — Estilos para listing y artículo
   Usa variables de layout.css
   ============================================= */

/* ── Blog Listing — Header ──────────────────── */
.blog-header {
  padding: 5rem 0 3rem;
  text-align: center;
  background: var(--color-light);
}

.blog-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.blog-header-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-light);
  margin-bottom: 0;
}

/* ── Blog Listing — Filters ─────────────────── */
.blog-filters {
  padding: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.blog-filter-link {
  padding: 0.4rem 1.2rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--color-text-light);
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.blog-filter-link:hover,
.blog-filter-link.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ── Blog Listing — Grid ────────────────────── */
.blog-section {
  padding: 3rem 0 5rem;
}

.blog-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(30, 58, 95, 0.14);
}

.blog-card-image {
  height: 180px;
  background: center / cover no-repeat;
  flex-shrink: 0;
}

.blog-card-image--gradient {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-card-image--gradient i {
  font-size: 2.8rem;
  color: rgba(255, 255, 255, 0.75);
}

.blog-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Category Badge ─────────────────────────── */
.blog-category-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  /* default SG-SST */
  background: #ebf4ff;
  color: #1e3a5f;
}

/* Category-specific badges — use JS data if needed; these apply via content matching */
/* Normativa */
.post-header .blog-category-badge,
.blog-card-body .blog-category-badge {
  /* Base — overridden by inline style or JS if needed */
}

/* We handle category colors via the template; here are helper classes */
.badge-normativa  { background: #fff0f0; color: #c0392b; }
.badge-pesv       { background: #f0fff4; color: #1e7e34; }
.badge-salud      { background: #fff8e7; color: #b7770d; }
.badge-sgsst      { background: #ebf4ff; color: #1e3a5f; }

/* ── Card typography ────────────────────────── */
.blog-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.blog-card-excerpt {
  color: var(--color-text-light);
  font-size: 0.9rem;
  flex: 1;
  line-height: 1.6;
  margin-bottom: 0;
}

.blog-card-meta {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--color-text-light);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.blog-card-date {
  margin-left: auto;
}

/* ── Single Post — Header ───────────────────── */
.post-header {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary) 0%, #2d5a8e 100%);
}

.post-header-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.post-header-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
}

.post-header-content {
  position: relative;
  z-index: 1;
  padding: 3rem 0 2.5rem;
  color: #fff;
}

.post-header .blog-category-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(4px);
}

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  color: #fff;
  line-height: 1.2;
}

.post-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  opacity: 0.85;
  color: #fff;
  flex-wrap: wrap;
}

/* ── Single Post — Article ──────────────────── */
.post-article {
  padding: 3rem 0 5rem;
}

.post-content {
  line-height: 1.85;
  color: #333;
  font-family: var(--font-body);
  text-align: justify;
  hyphens: auto;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.25rem 0 1rem;
  color: var(--color-primary);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  color: #2d5a8e;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.45rem;
}

.post-content p.lead {
  font-size: 1.1rem;
  font-weight: 500;
  color: #555;
  border-left: 4px solid var(--color-accent);
  padding-left: 1.1rem;
  margin-bottom: 1.5rem;
}

/* ── Callout boxes ──────────────────────────── */
.blog-callout {
  display: flex;
  gap: 1rem;
  background: #ebf4ff;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem;
  margin: 2rem 0;
  align-items: flex-start;
}

.blog-callout i {
  font-size: 1.4rem;
  color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.blog-callout strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--color-primary);
}

.blog-callout.blog-callout-warning {
  background: #fff8e7;
  border-left-color: var(--color-accent);
}

.blog-callout.blog-callout-warning i {
  color: #b7770d;
}

/* ── Author card ────────────────────────────── */
.post-author-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: #f8fafc;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.author-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-accent);
  flex-shrink: 0;
}

.author-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
}

.author-role {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
}

.author-bio {
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 0.6rem;
  line-height: 1.6;
}

.author-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.author-link-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  background: #ebf4ff;
  color: var(--color-primary);
  border: 1.5px solid rgba(30, 58, 95, 0.15);
  transition: background 0.2s ease, color 0.2s ease;
}

.author-link-badge:hover {
  background: var(--color-primary);
  color: #fff;
}

.author-link-badge--wa {
  background: #f0fff4;
  color: #1e7e34;
  border-color: rgba(30, 126, 52, 0.15);
}

.author-link-badge--wa:hover {
  background: #25d366;
  color: #fff;
}

/* ── CTA Section ────────────────────────────── */
.post-cta {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2d5a8e 100%);
  color: #fff;
  text-align: center;
  padding: 4rem 2rem;
}

.post-cta h2 {
  color: #fff;
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 1rem;
}

.post-cta p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.btn-cta-inverted {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-dark);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: background-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-cta-inverted:hover {
  background: var(--color-accent-dark);
  color: var(--color-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ── Back link ──────────────────────────────── */
.back-to-blog {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}

.back-to-blog:hover {
  color: var(--color-primary);
}

/* ── Responsive tweaks ──────────────────────── */
@media (max-width: 576px) {
  .blog-header {
    padding: 3.5rem 0 2rem;
  }

  .post-author-card {
    flex-direction: column;
    text-align: center;
  }

  .author-links {
    justify-content: center;
  }

  .post-meta {
    gap: 0.75rem;
  }
}
