/* ================================================================
   COPIATODO — CSS del Blog
   Estilos para /blog/ (listado) y /blog/slug/ (artículo)
   Fondo blanco, tarjetas al estilo miflowqr.com
================================================================ */

/* ── Variables heredadas de main.css ── */

/* ════════════════════════════════════════════════════════════════
   NAVBAR (overrides para páginas de blog — fondo oscuro fijo)
════════════════════════════════════════════════════════════════ */
.blog-page #navbar.scrolled {
  background: white;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}
.blog-page #navbar .navbar-link {
  color: var(--text-primary);
}
.blog-page #navbar .navbar-link.active,
.blog-page #navbar .navbar-link:hover {
  color: var(--brand-orange);
}
.blog-page .navbar-logo-name,
.blog-page .navbar-logo-tagline {
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════════
   HERO DEL BLOG (listado)
════════════════════════════════════════════════════════════════ */
.blog-hero {
  background: var(--bg-light);
  padding: 8rem 0 4rem;
  border-bottom: 1px solid var(--gray-200);
}

.blog-hero-content {
  max-width: 600px;
}

.blog-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0.75rem 0 1rem;
}

.blog-hero-title span {
  color: var(--brand-orange);
}

.blog-hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.7;
}

/* ════════════════════════════════════════════════════════════════
   BREADCRUMB
════════════════════════════════════════════════════════════════ */
.blog-breadcrumb {
  margin-bottom: 1.5rem;
}

.blog-breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.blog-breadcrumb li {
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.blog-breadcrumb li:not(:last-child)::after {
  content: '›';
  color: var(--gray-300);
}

.blog-breadcrumb a {
  color: var(--brand-orange);
  text-decoration: none;
  transition: opacity 0.2s;
}
.blog-breadcrumb a:hover { opacity: 0.75; }

.blog-breadcrumb--light li { color: rgba(255,255,255,0.7); }
.blog-breadcrumb--light li:not(:last-child)::after { color: rgba(255,255,255,0.3); }
.blog-breadcrumb--light a { color: white; }

/* ════════════════════════════════════════════════════════════════
   TOOLBAR / FILTROS
════════════════════════════════════════════════════════════════ */
.blog-main {
  background: white;
  padding: 3rem 0 6rem;
}

.blog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.blog-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════
   GRID DE TARJETAS — Estilo miflowqr.com con fondo blanco
════════════════════════════════════════════════════════════════ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Skeleton loaders */
.blog-skeleton {
  height: 420px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tarjeta de blog */
.blog-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-100);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

/* Imagen */
.blog-card-img-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  height: 220px;
  background: var(--gray-100);
  text-decoration: none;
}

.blog-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

.blog-card:hover .blog-card-img {
  transform: scale(1.05);
}

.blog-card-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255,255,255,0.6);
}

.blog-card-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(45,43,143,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.blog-card:hover .blog-card-img-overlay {
  opacity: 1;
}

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

/* Meta: autor • fecha • tiempo */
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.blog-card-author-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-orange);
  letter-spacing: 0.04em;
}

.blog-card-sep {
  color: var(--gray-300);
  font-size: 0.72rem;
}

.blog-card-date-text,
.blog-card-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Título */
.blog-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.6rem;
}

.blog-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.blog-card-title a:hover {
  color: var(--brand-purple);
}

/* Extracto */
.blog-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 1.25rem;
}

/* Footer de la tarjeta */
.blog-card-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

.blog-card-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-orange) 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.blog-card-author-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  flex: 1;
}

.blog-card-read {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-orange);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.2s;
}

.blog-card-read:hover { gap: 0.4rem; }

/* ════════════════════════════════════════════════════════════════
   VACÍO / ERROR
════════════════════════════════════════════════════════════════ */
.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 2rem;
  text-align: center;
}

.blog-empty i {
  font-size: 3rem;
  color: var(--gray-300);
}

.blog-empty p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ════════════════════════════════════════════════════════════════
   PAGINACIÓN
════════════════════════════════════════════════════════════════ */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.pag-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.pag-btn:hover {
  background: var(--brand-orange);
  color: white;
  border-color: var(--brand-orange);
}

.pag-btn.active {
  background: var(--brand-purple);
  color: white;
  border-color: var(--brand-purple);
}

/* ════════════════════════════════════════════════════════════════
   PÁGINA ARTÍCULO INDIVIDUAL
════════════════════════════════════════════════════════════════ */

/* Loading state */
.post-loading-state {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--brand-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error state */
.post-error-state {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
}

.post-error-content {
  text-align: center;
  max-width: 420px;
}

.post-error-icon {
  font-size: 3.5rem;
  color: var(--gray-300);
  margin-bottom: 1.5rem;
}

.post-error-content h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.post-error-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Hero del artículo (imagen de fondo) */
.post-hero {
  min-height: 460px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding-bottom: 0;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-dark) 100%);
}

.post-hero.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.post-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17,24,39,0.3) 0%, rgba(17,24,39,0.7) 100%);
}

.post-hero.no-image {
  min-height: 240px;
}

.post-hero.no-image .post-hero-overlay {
  background: none;
}

.post-hero-inner {
  position: relative;
  z-index: 1;
  padding-top: 7rem;
  padding-bottom: 2rem;
}

/* Layout del artículo */
.post-content-wrap {
  background: white;
  padding: 0 0 6rem;
}

.post-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: start;
  padding-top: 3rem;
}

/* Artículo */
.post-article {
  min-width: 0;
}

/* Header del post */
.post-header {
  margin-bottom: 2.5rem;
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-orange) 100%);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.post-meta-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-author-name {
  font-weight: 600;
  color: var(--text-secondary);
}

.post-meta-sep { color: var(--gray-300); }

.post-date { color: var(--text-muted); }

.post-read-time {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--brand-orange);
  font-weight: 500;
}

.post-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 1rem;
}

.post-excerpt {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
  border-left: 3px solid var(--brand-orange);
  padding-left: 1rem;
}

/* Imagen destacada (cuando no hay hero) */
.post-featured-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
}

/* Cuerpo del artículo */
.post-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--gray-700);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.35;
  margin: 2rem 0 1rem;
}

.post-body h2 { font-size: 1.65rem; }
.post-body h3 { font-size: 1.35rem; }
.post-body h4 { font-size: 1.1rem; }

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

.post-body a {
  color: var(--brand-orange);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}
.post-body a:hover { opacity: 0.75; }

.post-body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1.5rem auto;
  display: block;
  box-shadow: var(--shadow-md);
}

.post-body ul,
.post-body ol {
  margin: 1rem 0 1.25rem 1.5rem;
  line-height: 1.8;
}

.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }

.post-body li { margin-bottom: 0.35rem; }

.post-body blockquote {
  border-left: 4px solid var(--brand-orange);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-body pre,
.post-body code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
}

.post-body pre {
  background: var(--gray-900);
  color: #e5e7eb;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-body :not(pre) > code {
  background: var(--gray-100);
  color: var(--brand-purple);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.post-body strong { color: var(--text-primary); font-weight: 700; }
.post-body em { font-style: italic; }

.post-body hr {
  border: none;
  border-top: 2px solid var(--gray-100);
  margin: 2.5rem 0;
}

/* Footer del artículo */
.post-footer {
  margin-top: 3rem;
  padding: 1rem 1.5rem;
  background: var(--brand-navy, #1a1f6e);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.post-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-share-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.post-share-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
  border: none;
}

.post-share-wa  { background: #25D366; color: white; }
.post-share-fb  { background: #1877F2; color: white; }
.post-share-x   { background: #000; color: white; }
.post-share-copy { background: rgba(255,255,255,0.15); color: white; }

.post-share-btn:hover { transform: scale(1.1); opacity: 0.9; }

.post-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: white !important;
  border-color: rgba(255,255,255,0.5) !important;
}
.post-back-btn:hover {
  background: rgba(255,255,255,0.15) !important;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR DEL ARTÍCULO
════════════════════════════════════════════════════════════════ */
.post-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-sidebar-card {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--gray-100);
}

.post-sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-sidebar-title i { color: var(--brand-orange); }

/* Posts relacionados */
.related-post-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-200);
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.related-post-item:last-child { border-bottom: none; }
.related-post-item:hover { opacity: 0.75; }

.related-post-img {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
}

.related-post-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-post-info { flex: 1; min-width: 0; }

.related-post-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.related-post-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.related-skeleton {
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  margin-bottom: 0.75rem;
}

/* CTA del sidebar */
.post-sidebar-cta {
  background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-purple-dark) 100%);
  border-color: transparent;
}

.post-sidebar-cta h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.75rem;
}

.post-sidebar-cta p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ════════════════════════════════════════════════════════════════
   SECCIÓN NOTICIAS EN HOMEPAGE (rediseño estilo miflowqr)
════════════════════════════════════════════════════════════════ */
#noticias {
  background: white;
  padding: 5rem 0;
  border-top: 1px solid var(--gray-100);
}

.noticias-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 3rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.noticias-header-text .badge { margin-bottom: 0.75rem; }

.noticias-header-text .section-title {
  margin-bottom: 0.5rem;
}

.noticias-header-text .section-subtitle {
  margin-bottom: 0;
  max-width: 480px;
}

.noticias-ver-todos {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-orange);
  text-decoration: none;
  white-space: nowrap;
  transition: gap 0.2s;
  padding-bottom: 0.25rem;
}
.noticias-ver-todos:hover { gap: 0.6rem; }

/* Grid de 3 tarjetas */
.blog-home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .blog-home-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .post-layout {
    grid-template-columns: 1fr;
  }
  .post-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .blog-hero {
    padding: 7rem 0 3rem;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-home-grid {
    grid-template-columns: 1fr;
  }

  .noticias-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-hero {
    min-height: 320px;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .blog-card-img-wrap {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .blog-hero-title {
    font-size: 2rem;
  }

  .post-meta-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .post-meta-sep { display: none; }
}
