// =============================================================================
// Blog Listing — Cards, Featured, Filters, Sidebar, Pagination
// =============================================================================

// --- Blog header ---
.blog-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;

  &__title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--text);
    margin: 0;
  }

  &__count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
  }
}

// --- Category filter pills ---
.blog-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;

  &::-webkit-scrollbar {
    display: none;
  }

  &__pill {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);

    &:hover {
      color: var(--primary);
      border-color: var(--primary);
      background: rgba(var(--primary-rgb, 37, 99, 235), 0.06);
    }

    &--active {
      color: #fff;
      background: var(--primary);
      border-color: var(--primary);

      &:hover {
        color: #fff;
        background: var(--primary);
        opacity: 0.9;
      }
    }
  }
}

// --- Blog grid (2 colonnes desktop, 1 mobile) ---
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;

  @media (max-width: 991.98px) {
    gap: 1rem;
  }

  @media (max-width: 767.98px) {
    grid-template-columns: 1fr;
  }

  &--3col {
    grid-template-columns: repeat(3, 1fr);

    @media (max-width: 991.98px) {
      grid-template-columns: repeat(2, 1fr);
      gap: 1rem;
    }

    @media (max-width: 575.98px) {
      grid-template-columns: 1fr;
    }
  }

  &--1col {
    grid-template-columns: 1fr;
    max-width: 700px;
  }
}

// --- Card article standard ---
.blog-card {
  background: var(--white, #fff);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);

  &:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }

  &__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
  }

  &__img {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--surface);
  }

  &__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);

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

  &__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
    opacity: 0.4;
  }

  &__badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  &__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem;
    gap: 0.5rem;
  }

  &__title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
  }

  &__excerpt {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    flex: 1;
  }

  &__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);

    &--light {
      color: rgba(255, 255, 255, 0.85);
    }
  }

  &__dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;

    .blog-card__meta--light & {
      background: rgba(255, 255, 255, 0.6);
    }
  }

  &__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: auto;
  }
}

// --- Card article featured (pleine largeur) ---
.blog-featured {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-base);

  &:hover {
    box-shadow: var(--shadow-lg);
  }

  &__link {
    display: block;
    text-decoration: none;
    color: inherit;
  }

  &__img {
    position: relative;
    aspect-ratio: 21 / 9;
    background: var(--surface);
    overflow: hidden;

    @media (max-width: 991.98px) {
      aspect-ratio: 16 / 9;
    }
  }

  &__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);

    .blog-featured:hover & {
      transform: scale(1.03);
    }
  }

  &__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    @media (max-width: 767.98px) {
      padding: 1.25rem;
    }
  }

  &__title {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
  }

  &__excerpt {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    max-width: 600px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;

    @media (max-width: 767.98px) {
      display: none;
    }
  }
}

// --- Blog sidebar ---
.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;

  @media (max-width: 991.98px) {
    margin-top: 2rem;
  }
}

// --- Empty state ---
.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  gap: 1rem;

  svg {
    opacity: 0.3;
  }

  p {
    margin: 0;
    font-size: 1rem;
  }
}

// --- Pagination ---
.pagination {
  .page-link {
    border-radius: var(--radius-sm);
    margin: 0 0.125rem;
    font-weight: 500;
    transition: all var(--transition-fast);
  }

  .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
  }
}
