/* =============================================
 * BLOG CARD COMPONENT
 * Card size: 342px × 298px
 * Used in blog section grid
 * ============================================= */

.blog-card {
  position: relative;
  background: var(--color-white);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.blog-card:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* =============================================
 * IMAGE SECTION
 * ============================================= */

.blog-card__image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--color-gray-100, #F5F5F5);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

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

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

/* =============================================
 * CATEGORY BADGE
 * ============================================= */

.blog-card__category {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: var(--color-white);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}

/* =============================================
 * CONTENT SECTION
 * ============================================= */

.blog-card__content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card__title {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #333333;
  margin: 0;

  /* 2 lines max with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-card__link {
  text-decoration: none;
  color: inherit;
}

.blog-card__link:hover .blog-card__title {
  color: var(--color-primary);
}

.blog-card__description {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-secondary);
  margin: 0 0 auto 0;

  /* 2 lines max with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================
 * META INFORMATION
 * ============================================= */

.blog-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.blog-card__date,
.blog-card__read-time {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.blog-card__date::before {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2H12V1H11V2H5V1H4V2H3C2.4 2 2 2.4 2 3V13C2 13.6 2.4 14 3 14H13C13.6 14 14 13.6 14 13V3C14 2.4 13.6 2 13 2ZM13 13H3V6H13V13Z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.blog-card__read-time::before {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 1C4.1 1 1 4.1 1 8C1 11.9 4.1 15 8 15C11.9 15 15 11.9 15 8C15 4.1 11.9 1 8 1ZM8 14C4.7 14 2 11.3 2 8C2 4.7 4.7 2 8 2C11.3 2 14 4.7 14 8C14 11.3 11.3 14 8 14ZM8.5 4H7.5V8.5L11.2 10.7L11.8 9.8L8.5 7.9V4Z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* =============================================
 * CTA LINK - "Xem thêm"
 * ============================================= */

.blog-card__cta {
  display: inline-block;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 16px;
  line-height: 1, 4;
  color: #FF6600;
  text-decoration: none;
  padding-top: 8px;
  transition: color 0.3s ease;
}

.blog-card__cta:hover {
  color: #FF8800;
  text-decoration: underline;
}

/* =============================================
 * FEATURED VARIANT
 * ============================================= */

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

.blog-card--featured .blog-card__image {
  height: 280px;
}

.blog-card--featured .blog-card__title {
  font-size: 20px;
  line-height: 28px;
  -webkit-line-clamp: 3;
}

/* =============================================
 * LOADING STATE
 * ============================================= */

.blog-card--loading {
  pointer-events: none;
}

.blog-card--loading .blog-card__image {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

  100% {
    background-position: -200% 0;
  }
}

/* =============================================
 * RESPONSIVE STYLES
 * ============================================= */

@media (max-width: 768px) {
  .blog-card__image {
    height: 180px;
  }

  .blog-card__title {
    font-size: 15px;
    line-height: 21px;
  }

  .blog-card__description {
    font-size: 13px;
    line-height: 19px;
  }

  .blog-card--featured {
    grid-column: span 1;
  }

  .blog-card--featured .blog-card__image {
    height: 180px;
  }

  .blog-card--featured .blog-card__title {
    font-size: 15px;
    line-height: 21px;
  }
}

@media (max-width: 480px) {
  .blog-card__content {
    padding: 14px;
  }

  .blog-card__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}