/* ==========================================================================
   COMPONENT: EDITORIAL POST CAROUSEL (SOLID, BEM, CLEAN CSS)
   Scope: .id-editorial-section, .id-carousel, .id-post-card
   Principles: Single Responsibility, No !important, No Negative Margins
   ========================================================================== */

/* Thẻ ngăn cách tinh tế giữa các section trên Desktop: Hairline mờ 40% */
.id-editorial-section {
  width: 100%;
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.dark-theme .id-editorial-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Section đầu tiên (#Tag) cũng có đường kẻ mờ ngăn cách với thân bài */
.id-tag-section {
  width: 100%;
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.dark-theme .id-tag-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Header & Line Title */
.id-editorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  margin-bottom: 1.75rem;
  box-sizing: border-box;
}

.id-editorial-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #71717a;
  margin: 0;
  padding: 0;
  line-height: 1;
}

/* Tabs */
.id-editorial-tabs {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: #f4f4f5;
  padding: 3px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}

.dark-theme .id-editorial-tabs {
  background: #27272a;
  border-color: rgba(255, 255, 255, 0.08);
}

.id-tab-btn {
  border: none;
  background: transparent;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 9999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark-theme .id-tab-btn {
  color: #a1a1aa;
}

.id-tab-btn.is-active,
.id-tab-btn.active {
  background: var(--id-color-primary, #FCC82D);
  color: #000000;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   GRID ON DESKTOP & TABLET (min-width: 768px)
   ========================================================================== */
@media (min-width: 768px) {
  .id-carousel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  .id-post-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.25s ease;
  }

  .id-post-card:hover {
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   SCROLL SNAP CAROUSEL ON MOBILE (max-width: 767.98px)
   70% Active Item + 30% Next Peek, Gióng thẳng lề trái với Title
   ========================================================================== */
@media (max-width: 767.98px) {
  .id-carousel {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding: 0 0 16px 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
  }

  .id-carousel::-webkit-scrollbar {
    display: none;
  }

  .id-post-card {
    flex: 0 0 72%;
    width: 72%;
    min-width: 72%;
    max-width: 72%;
    scroll-snap-align: start;
    box-sizing: border-box;
  }

  .id-editorial-header {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    gap: 12px;
  }

  .id-editorial-tabs {
    width: 100%;
    display: flex;
  }

  .id-tab-btn {
    flex: 1;
    text-align: center;
  }
}

/* ==========================================================================
   POST CARD ATOMS (IMAGE, TITLE, META)
   ========================================================================== */
.id-post-card__thumb-link {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  overflow: hidden;
  background-color: #1a1a1c;
  margin-bottom: 12px;
}

.id-post-card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.id-post-card:hover .id-post-card__thumb-img {
  transform: scale(1.04);
}

.id-post-card__meta {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.id-post-card__category {
  font-family: var(--id-font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--id-color-primary, #FCC82D);
  text-decoration: none;
}

.id-post-card__title {
  font-family: var(--font-display, "Lora", Georgia, serif);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  color: #111111;
  margin: 0 0 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dark-theme .id-post-card__title {
  color: #f2f2f7;
}

.id-post-card__title a {
  color: inherit;
  text-decoration: none;
}

.id-post-card:hover .id-post-card__title a {
  color: var(--id-color-primary, #FCC82D);
}

.id-post-card__excerpt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #666666;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dark-theme .id-post-card__excerpt {
  color: #8e8e93;
}

/* Skeleton Loading State */
.id-post-card-skeleton {
  pointer-events: none;
}

.id-post-card-skeleton .id-post-card__thumb-link {
  background: rgba(255, 255, 255, 0.06);
  animation: idPulse 1.5s ease-in-out infinite;
}

@keyframes idPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}
