/* ============================================
   BLOG STYLES
   Estilos para el sistema de blog con Contentful
   ============================================ */

/* --- Blog Main Layout (2/3 - 1/3) --- */
.w-layout-grid.blog-grid {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 2/3 para posts, 1/3 para sidebar */
  gap: 3rem;
  margin: 2rem 0;
}

@media (max-width: 991px) {
  .w-layout-grid.blog-grid {
    grid-template-columns: 1fr; /* Stack en móvil */
    gap: 2rem;
  }
}

/* --- Blog Posts Grid (dentro de collection-list-wrapper-4) --- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* --- Sidebar (content-right) --- */
.content-right {
  /* El sidebar ocupa 1/3 del espacio */
  min-width: 0; /* Evita overflow */
}

.content-right .stick-wrapper {
  position: sticky;
  top: 100px; /* Ajustar según altura del navbar */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

@media (max-width: 991px) {
  .content-right .stick-wrapper {
    position: relative;
    top: 0;
    max-height: none;
  }
}

/* --- Posts Container --- */
.collection-list-wrapper-4 {
  /* Ocupa 2/3 del espacio */
  min-width: 0; /* Evita overflow */
}

/* --- Blog Card --- */
.blog-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

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

.blog-card-featured {
  grid-column: span 2;
  flex-direction: row;
}

@media (max-width: 991px) {
  .blog-card-featured {
    grid-column: span 1;
    flex-direction: column;
  }
}

.blog-card-image-link {
  position: relative;
  display: block;
  overflow: hidden;
  height: 240px;
}

.blog-card-featured .blog-card-image-link {
  width: 50%;
  height: auto;
}

@media (max-width: 991px) {
  .blog-card-featured .blog-card-image-link {
    width: 100%;
    height: 240px;
  }
}

.blog-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.blog-card-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--netg-primary-1, #160d54);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* --- Card Content --- */
.blog-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card-featured .blog-card-content {
  width: 50%;
  padding: 2rem;
}

@media (max-width: 991px) {
  .blog-card-featured .blog-card-content {
    width: 100%;
  }
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.blog-card-category {
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.blog-card-category:hover {
  opacity: 0.7;
}

.blog-card-divider {
  color: #ddd;
}

.blog-card-date,
.blog-card-read-time {
  color: #888;
}

.blog-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.3;
}

.blog-card-title a {
  color: var(--netg-primary-1, #160d54);
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-card-title a:hover {
  color: var(--netg-primary-2, #93151b);
}

.blog-card-excerpt {
  color: #555;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}

/* --- Card Footer --- */
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.blog-card-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.blog-card-author-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.blog-card-author-info {
  display: flex;
  flex-direction: column;
}

.blog-card-author-name {
  font-weight: 600;
  color: var(--netg-primary-1, #160d54);
  text-decoration: none;
  font-size: 0.9rem;
}

.blog-card-author-name:hover {
  text-decoration: underline;
}

.blog-card-author-role {
  font-size: 0.8rem;
  color: #888;
}

.blog-card-link {
  color: var(--netg-primary-2, #93151b);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: gap 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.blog-card-link:hover {
  gap: 0.5rem;
}

/* --- Blog Filters --- */
.blog-filters {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
  justify-content: center;
}

.blog-filter-item {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  color: #666;
  background: #f5f5f5;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.blog-filter-item:hover {
  background: #e5e5e5;
  transform: translateY(-2px);
}

.blog-filter-item.active {
  background: var(--category-color, var(--netg-primary-1, #160d54));
  color: white;
  border-color: var(--category-color, var(--netg-primary-1, #160d54));
}

/* --- Blog Search --- */
.blog-search {
  display: flex;
  gap: 0.5rem;
  margin: 2rem auto;
  max-width: 600px;
}

.blog-search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.blog-search-input:focus {
  outline: none;
  border-color: var(--netg-primary-1, #160d54);
}

.blog-search-btn {
  padding: 1rem 1.5rem;
  background: var(--netg-primary-1, #160d54);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-search-btn:hover {
  background: var(--netg-primary-2, #93151b);
}

/* --- Loading States --- */
.blog-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.blog-skeleton {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.skeleton-image {
  width: 100%;
  height: 240px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.skeleton-text {
  height: 20px;
  margin: 1rem 1.5rem;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

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

/* --- Empty/Error States --- */
.blog-empty-state,
.blog-error,
.blog-no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: #666;
}

.blog-error button {
  margin-top: 1rem;
}

/* --- Pagination --- */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 3rem 0;
}

.pagination-btn,
.pagination-number {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  color: var(--netg-primary-1, #160d54);
  background: white;
  border: 2px solid #ddd;
  transition: all 0.2s ease;
}

.pagination-btn:hover,
.pagination-number:hover {
  border-color: var(--netg-primary-1, #160d54);
  transform: translateY(-2px);
}

.pagination-number.active {
  background: var(--netg-primary-1, #160d54);
  color: white;
  border-color: var(--netg-primary-1, #160d54);
}

.pagination-numbers {
  display: flex;
  gap: 0.5rem;
}

.pagination-ellipsis {
  padding: 0.75rem 0.5rem;
  color: #999;
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin: 1rem 0 2rem;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--netg-primary-1, #160d54);
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #999;
}

.breadcrumb-current {
  color: #666;
}

/* --- Related Posts --- */
.blog-related-section {
  margin: 4rem 0 2rem;
  padding-top: 3rem;
  border-top: 2px solid #eee;
}

.blog-related-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--netg-primary-1, #160d54);
  margin-bottom: 2rem;
}

.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .blog-card-title {
    font-size: 1.25rem;
  }
  
  .blog-filters {
    gap: 0.5rem;
  }
  
  .blog-filter-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .blog-related-grid {
    grid-template-columns: 1fr;
  }
}
