/* ===========================================
   Blog Page CSS
   Page-specific styles for blog.html
   =========================================== */

/* ===========================================
   Main Container
   =========================================== */
.blog-container {
  max-width: 1200px;
  margin: -2.5rem auto 0 auto;
  padding: 2rem 0;
}

/* ===========================================
   Featured Section
   =========================================== */
.featured-section {
  margin-bottom: 3rem;
}

.featured-section h2 {
  font-size: 2rem;
  color: #333;
  margin: 0 0 1.5rem 0;
  font-weight: 600;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.featured-card {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  cursor: pointer;
  height: 300px;
}

.featured-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.featured-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  color: white;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.featured-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.featured-excerpt {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.4;
}

/* ===========================================
   Posts Section
   =========================================== */
.posts-section h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* ===========================================
   Blog Card
   =========================================== */
.blog-card {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.blog-card .card-image {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.blog-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.blog-card:hover .card-image img {
  transform: scale(1.05);
}

/* Blog category badge positioning */
.blog-card .category-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
}

.featured-overlay .category-badge {
  position: static;
  align-self: flex-start;
  margin-bottom: 0.5rem;
}

/* ===========================================
   Blog Category Badge Colors
   =========================================== */
.badge-thoughts {
  background: rgba(102, 16, 242, 0.9);
  color: white;
}

.badge-tutorial {
  background: rgba(0, 123, 255, 0.9);
  color: white;
}

.badge-research {
  background: rgba(40, 167, 69, 0.9);
  color: white;
}

.badge-update {
  background: rgba(255, 193, 7, 0.9);
  color: #856404;
}

.badge-project {
  background: rgba(23, 162, 184, 0.9);
  color: white;
}

/* ===========================================
   Card Content
   =========================================== */
.blog-card .card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.card-meta .read-time {
  color: #888;
}

.card-meta .read-time::before {
  content: "•";
  margin-right: 0.5rem;
}

.blog-card .card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.blog-card .card-excerpt {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: #f0f0f0;
  color: #666;
  border-radius: 12px;
}

/* ===========================================
   Blog Post Page
   =========================================== */

/* Back Link */
.back-link {
  margin-bottom: 2rem;
}

.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.back-link a:hover {
  color: #333;
}

/* Post Article */
.blog-post-article {
  max-width: 800px;
  margin: 0 auto;
}

/* Loading & Error States */
.loading-state,
.error-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.error-state h2 {
  margin-bottom: 1rem;
  color: #333;
}

.error-state .button {
  margin-top: 1.5rem;
}

/* Post Header */
.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #666;
}

.post-meta .post-read-time::before {
  content: "\2022";
  margin-right: 1rem;
}

.post-header h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  color: #333;
  margin: 0;
}

/* Post Hero Image */
.post-hero {
  margin-bottom: 2rem;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.post-hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* Post Body */
.post-body {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #333;
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body p:last-child {
  margin-bottom: 0;
}

/* Post Footer */
.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-tags .tag {
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
}

/* ===========================================
   Filter Section
   =========================================== */
.filter-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* ===========================================
   Card Link Styling (cards are now anchor tags)
   =========================================== */
a.blog-card {
  text-decoration: none;
  color: inherit;
}

a.featured-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ===========================================
   Responsive - Tablet (max-width: 768px)
   =========================================== */
@media (max-width: 768px) {
  .blog-container {
    padding: 1rem;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .featured-card {
    height: 220px;
  }

  .featured-title {
    font-size: 1.25rem;
  }

  .featured-excerpt {
    display: none;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .featured-section h2,
  .posts-section h2 {
    font-size: 1.5rem;
  }

  /* Blog Post Page Responsive */
  .post-header h1 {
    font-size: 1.75rem;
  }

  .post-body {
    font-size: 1rem;
  }
}

/* ===========================================
   Responsive - Small Mobile (max-width: 480px)
   =========================================== */
@media (max-width: 480px) {
  .blog-card .card-image {
    height: 140px;
  }

  .blog-card .card-content {
    padding: 1rem;
  }

  .blog-card .card-title {
    font-size: 1rem;
  }

  .card-tags {
    display: none;
  }

  .filter-section {
    gap: 0.5rem;
  }

  /* Blog Post Page Responsive */
  .post-header h1 {
    font-size: 1.5rem;
  }

  .post-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
