/* =============================================================================
   Blogs Filter – filterable post grid with AJAX pagination
   BEM: .bf, .bf-filter, .bf-filter__tab, .bf-grid,
        .bf-post, .bf-pagination
   ============================================================================= */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.bf {
  position: relative;
  width: 100%;
  font-family: inherit;
}

/* ── Filter tabs ─────────────────────────────────────────────────────────── */
.bf-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.bf-filter__tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #969696;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #969696;
  white-space: nowrap;
  margin: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.bf-filter__tab--active {
  background: #FFFF00;
  border: 1px solid #D5D50A;
  color: #434343;
  font-weight: 700;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.bf-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.72);
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.bf.bf--loading .bf-loading {
  display: flex;
}

.bf-loading__spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #e0e0e0;
  border-top-color: #f5d000;
  border-radius: 50%;
  animation: bf-spin 0.7s linear infinite;
}

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

/* ── Posts grid ──────────────────────────────────────────────────────────── */
.bf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  min-height: 180px;
  transition: opacity 0.2s ease;
}

.bf.bf--loading .bf-grid {
  opacity: 0.35;
  pointer-events: none;
}

/* Empty state */
.bf-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 0;
  color: #aaa;
  font-size: 14px;
}

/* ── Post card ───────────────────────────────────────────────────────────── */
.bf-post {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  padding: 4px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.bf-post:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.13);
  transform: translateY(-3px);
}

/* Thumbnail */
.bf-post__thumb-link {
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 10;
  flex-shrink: 0;
  border-radius: 22px;
}

.bf-post__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 22px;
  transition: transform 0.4s ease;
}

.bf-post:hover .bf-post__thumb {
  transform: scale(1.06);
}

.bf-post__thumb--placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8e8e8 0%, #d4d4d4 100%);
}

/* Card body */
.bf-post__body {
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.bf-post__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: #181818;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

.bf-post__title a {
  color: inherit;
  text-decoration: none;
}

.bf-post__meta {
  margin: 0;
  font-size: 14px;
  line-height: 14px;
  font-weight: 400;
  color: #202124;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.bf-post__excerpt {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #595F65;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.bf-pagination-wrap {
  margin-top: 36px;
}

.bf-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bf-pagination__nav {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #444;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bf-pagination__nav:hover:not(:disabled) {
  background: #f5d000;
  border-color: #f5d000;
  color: #111;
}

.bf-pagination__nav:disabled {
  opacity: 0.38;
  cursor: default;
}

.bf-pagination__numbers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.bf-pagination__page {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #444;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bf-pagination__page:hover {
  background: #fafafa;
  border-color: #bbb;
}

.bf-pagination__page--active {
  background: #f5d000;
  border-color: #f5d000;
  color: #111;
  font-weight: 700;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .bf-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .bf-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  /* Horizontally scrollable filter tabs */
  .bf-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bf-filter::-webkit-scrollbar {
    display: none;
  }
}

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