/**
 * Blog Listing Page Styles
 * 
 * Medium-inspired design with clean typography and generous whitespace
 * Requirements: 2.4, 2.5, 7.1, 7.3, 8.1
 */

/* ============================================
   BLOG LISTING SECTION
   ============================================ */

.section--blog-listing {
  min-height: 100vh;
  background: var(--bg-main);
}

.section--blog-listing .content-layer {
  padding: var(--space-xl) var(--space-md);
  max-width: 1400px;
  margin: 0 auto;
}

.blog-listing__intro {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text-secondary);
  text-align: center;
  max-width: 680px;
  margin: 0 auto var(--space-xl) auto;
  font-weight: 400;
  letter-spacing: -0.003em;
}

/* ============================================
   BLOG LISTING GRID
   ============================================ */

.blog-listing__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-top: var(--space-xl);
  padding: 0;
}

/* ============================================
   POST PREVIEW CARD
   ============================================ */

.post-preview {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: all var(--duration-normal) var(--ease-smooth);
  position: relative;
}

.post-preview:hover {
  transform: translateY(-6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}

.post-preview__link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

/* Enhanced focus indicator for keyboard navigation */
.post-preview__link:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

.post-preview:focus-within {
  box-shadow: 0 0 0 3px var(--accent-strong);
}

/* ============================================
   POST PREVIEW IMAGE
   ============================================ */

.post-preview__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-main);
  position: relative;
}

.post-preview__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--duration-slow) var(--ease-smooth), opacity var(--duration-normal) var(--ease-smooth);
  opacity: 0;
}

/* Fade in when image loads */
.post-preview__image img.image-loaded {
  opacity: 1;
}

.post-preview:hover .post-preview__image img {
  transform: scale(1.05);
}

/* Handle failed images */
.post-preview__image.image-failed {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  opacity: 0.3;
  min-height: 200px;
}

.post-preview__image.image-failed::after {
  content: 'Image unavailable';
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-style: italic;
}

.post-preview__image.image-failed img {
  display: none;
}

/* ============================================
   POST PREVIEW CONTENT
   ============================================ */

.post-preview__content {
  padding: 1.75rem 2rem 2rem;
}

.post-preview__title {
  font-size: clamp(1.375rem, 2.5vw, 1.625rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
  transition: color var(--duration-fast) var(--ease-smooth);
}

.post-preview:hover .post-preview__title {
  color: var(--accent-strong);
}

.post-preview__subtitle {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  font-weight: 400;
  letter-spacing: -0.003em;
}

.post-preview__excerpt {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: rgba(0, 0, 0, 0.6);
  margin: 0 0 1.5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.003em;
}

/* ============================================
   POST PREVIEW METADATA
   ============================================ */

.post-preview__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: rgba(0, 0, 0, 0.54);
  margin-bottom: 1rem;
  letter-spacing: 0;
}

.post-preview__author {
  font-weight: 500;
  color: var(--text-main);
}

.post-preview__separator {
  color: rgba(0, 0, 0, 0.3);
  font-weight: 300;
}

.post-preview__date {
  color: rgba(0, 0, 0, 0.54);
  font-weight: 400;
}

.post-preview__reading-time {
  color: rgba(0, 0, 0, 0.54);
  font-weight: 400;
}

/* ============================================
   POST PREVIEW TAGS
   ============================================ */

.post-preview__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  background: rgba(156, 175, 136, 0.12);
  color: var(--accent-soft);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  transition: all var(--duration-fast) var(--ease-smooth);
  border: 1px solid transparent;
}

.post-preview:hover .tag {
  background: rgba(199, 53, 46, 0.08);
  color: var(--accent-strong);
  border-color: rgba(199, 53, 46, 0.15);
}

/* Enhanced focus indicator for tags */
.tag:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.empty-state h2 {
  font-size: 1.75rem;
  margin-bottom: var(--space-sm);
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  letter-spacing: -0.003em;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile (< 768px) - Single column layout */
@media (max-width: 767px) {
  .blog-listing__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .post-preview__content {
    padding: 1.25rem 1.5rem 1.5rem;
  }
  
  .blog-listing__intro {
    font-size: 1.0625rem;
    margin-bottom: var(--space-lg);
    line-height: 1.7;
  }
  
  .section--blog-listing .content-layer {
    padding: 3rem var(--space-sm);
  }
}

/* Tablet (768px - 1023px) - Two column layout */
@media (min-width: 768px) and (max-width: 1023px) {
  .blog-listing__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
  
  .section--blog-listing .content-layer {
    padding: 4rem var(--space-md);
  }
}

/* Desktop (1024px+) - Three column layout */
@media (min-width: 1024px) {
  .blog-listing__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
  
  .section--blog-listing .content-layer {
    padding: 5rem var(--space-lg);
  }
  
  .blog-listing__intro {
    font-size: 1.375rem;
    line-height: 1.8;
  }
}

/* Large Desktop (1440px+) - Maintain three columns with more spacing */
@media (min-width: 1440px) {
  .blog-listing__grid {
    gap: 3rem;
  }
  
  .section--blog-listing .content-layer {
    padding: 6rem var(--space-xl);
  }
}

/* ============================================
   TOUCH-FRIENDLY INTERACTION TARGETS
   ============================================
   Ensure minimum 44x44px touch targets on mobile
   Requirements: 7.3
*/

@media (max-width: 767px) {
  .post-preview__link {
    min-height: 44px;
  }
  
  .tag {
    min-height: 32px;
    padding: 0.375rem 0.875rem;
  }
}
