/* ==========================================================================
   posts.css - Hero slider, 3 bien the post card, breadcrumb, single post,
   Related Posts, Guest posts (danh sach ngang).
   ========================================================================== */

/* ==========================================================================
   1. HERO SLIDER (cot giua trang landing)
   Truot bang scroll-snap, khong phu thuoc JS. Chi bao "> ooo >" ben duoi.
   ========================================================================== */
.ec-hero {
  position: relative;
  margin-bottom: var(--ec-space-4);
}

.ec-hero__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ec-hero__track::-webkit-scrollbar { display: none; }

.ec-hero__slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.ec-hero__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Lop phu toi o day anh de chu trang du tuong phan */
.ec-hero__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--ec-space-4);
  background-color: var(--ec-overlay);
  color: var(--ec-white);
}

.ec-hero__title {
  margin: 0;
  color: var(--ec-white);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-lg);
  font-weight: 700;
  line-height: var(--ec-lh-snug);
}

.ec-hero__title-link {
  color: var(--ec-white);
}

.ec-hero__title-link:hover {
  color: var(--ec-green); /* green tren lop phu toi - dat tuong phan */
}

.ec-hero__date {
  display: block;
  margin-top: var(--ec-space-1);
  color: var(--ec-white);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-sm);
}

/* ---------- Chi bao "> ooo >" ---------- */
.ec-hero__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ec-space-3);
  padding-top: var(--ec-space-3);
}

.ec-hero__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--ec-text);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-md);
  line-height: 1;
}

.ec-hero__arrow:hover {
  color: var(--ec-link-hover);
  text-decoration: none;
}

.ec-hero__dots {
  display: flex;
  align-items: center;
  gap: var(--ec-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ec-hero__dot {
  display: block;
  width: 10px;
  height: 10px;
  border: var(--ec-rule-width) solid var(--ec-rule);
  border-radius: var(--ec-radius-pill);
  background-color: transparent;
  transition: background-color var(--ec-dur-fast) var(--ec-ease);
}

.ec-hero__dot:hover { background-color: var(--ec-border-strong); }

/* Slide dang xem: dot to dac */
.ec-hero__dot-item.is-active .ec-hero__dot,
.ec-hero__dot[aria-current="true"] {
  background-color: var(--ec-rule);
}

/* ==========================================================================
   2. POST CARD - 3 BIEN THE
   .ec-card              : vo chung
   .ec-card--main        : cot giua, co breadcrumb + ngay + trich doan
   .ec-card--compact     : cot bien (chi anh + tieu de)
   .ec-card--horizontal  : guest post, danh sach ngang
   ========================================================================== */
.ec-card {
  display: block;
  margin-bottom: var(--ec-space-5);
}

.ec-card:last-child { margin-bottom: 0; }

.ec-card__thumb {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.ec-card__thumb--empty {
  aspect-ratio: 16 / 9;
  background-color: var(--ec-surface-alt);
  border: var(--ec-rule-width) solid var(--ec-border);
}

.ec-card__body {
  padding-top: var(--ec-space-2);
}

.ec-card__title {
  margin: 0 0 var(--ec-space-1);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-base);
  font-weight: 700;
  line-height: var(--ec-lh-snug);
}

.ec-card__title-link { color: var(--ec-link); }

/* Breadcrumb nho phia tren tieu de - chu in hoa, mau meta */
.ec-card__cats {
  margin: 0 0 var(--ec-space-1);
  color: var(--ec-meta);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ec-card__cats a { color: var(--ec-meta); }

/* F10: soc ngang "/" ngan giua Category va Sub-category (PDF trang 2:
   "CIRCULAR ECONOMY / Agriculture"). PHP in cac link lien tiep, dau phan
   cach do CSS sinh ra - chen truoc moi link ke sau link truoc. */
.ec-card__cats a + a::before {
  content: "/";
  margin: 0 var(--ec-space-2);
  color: var(--ec-meta);
}

.ec-card__date {
  display: block;
  color: var(--ec-meta);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-sm);
}

.ec-card__excerpt {
  margin: var(--ec-space-2) 0 0;
  font-size: var(--ec-fs-sm);
  line-height: var(--ec-lh-base);
}

/* ---------- Bien the cot giua ---------- */
.ec-card--main {
  margin-bottom: var(--ec-space-6);
}

/*
 * Trong .ec-band__cards (grid 3 cot ngang) thi khoang cach do gap cua grid lo,
 * margin-bottom cua card chi tao khoang trong vo ich duoi moi card.
 */
.ec-band__cards .ec-card,
.ec-band__cards .ec-card--main {
  margin-bottom: 0;
}

.ec-card--main .ec-card__title {
  font-size: var(--ec-fs-lg);
}

/* ---------- Bien the gon (cot bien): chi anh + tieu de ---------- */
.ec-card--compact .ec-card__title {
  font-size: var(--ec-fs-sm);
  font-weight: 500;
}

.ec-card--compact .ec-card__excerpt,
.ec-card--compact .ec-card__cats {
  display: none;
}

/* ---------- Bien the ngang (Guest posts) ---------- */
.ec-card--horizontal {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--ec-space-3);
  align-items: start;
  padding-bottom: var(--ec-space-4);
  border-bottom: var(--ec-rule-width) solid var(--ec-border);
}

/* Tieu de guest post bang co chu voi card o cot giua cua dai tren (user chot 2026-08-13) */
.ec-card--horizontal .ec-card__title {
  font-size: var(--ec-fs-lg);
}

.ec-card--horizontal:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ec-card--horizontal .ec-card__thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
}

.ec-card--horizontal .ec-card__thumb--empty {
  aspect-ratio: auto;
}

.ec-card--horizontal .ec-card__body {
  padding-top: 0;
}

/* Danh sach chua cac card ngang */
.ec-postlist {
  display: grid;
  gap: var(--ec-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ==========================================================================
   3. BREADCRUMB
   ========================================================================== */
.ec-breadcrumb {
  margin-bottom: var(--ec-space-2);
  color: var(--ec-meta);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-sm);
}

.ec-breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ec-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ec-breadcrumb__item + .ec-breadcrumb__item::before {
  content: "/";
  margin-right: var(--ec-space-1);
  color: var(--ec-meta);
}

.ec-breadcrumb__link { color: var(--ec-meta); }

.ec-breadcrumb__link:hover { color: var(--ec-link-hover); }

.ec-breadcrumb__current { color: var(--ec-meta); }

/* ==========================================================================
   4. SINGLE POST
   ========================================================================== */
.ec-single__featured {
  width: 100%;
  height: auto;
  margin-bottom: var(--ec-space-4);
  object-fit: cover;
}

.ec-single__title {
  margin: 0 0 var(--ec-space-2);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-2xl);
  font-weight: 700;
  line-height: var(--ec-lh-tight);
}

/* Dong meta "Posted by ... I <ngay>" */
.ec-single__meta {
  margin: 0 0 var(--ec-space-5);
  color: var(--ec-meta);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-sm);
}

.ec-single__meta-sep {
  margin-inline: var(--ec-space-2);
}

.ec-entry-content {
  font-size: var(--ec-fs-base);
  line-height: var(--ec-lh-base);
}

.ec-entry-content > *:last-child { margin-bottom: 0; }

/* ==========================================================================
   5. RELATED POSTS - tieu de gach chan, moi item co tien to ">"
   ========================================================================== */
.ec-related {
  margin-top: var(--ec-space-8);
}

/* PDF trang 3 ve tieu de nay co gach chan, nhung user chot bo het underline. */
.ec-related__title {
  margin: 0 0 var(--ec-space-3);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-md);
  font-weight: 700;
  text-decoration: none;
  color: var(--ec-navy);   /* F15 - tieu de khoi mau navy */
}

.ec-related__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ec-related__item + .ec-related__item {
  margin-top: var(--ec-space-2);
}

.ec-related__link {
  color: var(--ec-link);
  font-family: var(--ec-font-ui);
}

/* Dau ">" la trang tri, tao bang CSS nen khong lot vao screen reader */
.ec-related__item::before {
  content: "> ";
  color: var(--ec-text);
}

/* ==========================================================================
   6. Phan trang
   ========================================================================== */
.ec-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ec-space-2);
  margin-top: var(--ec-space-8);
  font-family: var(--ec-font-ui);
}

.ec-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: var(--ec-space-1) var(--ec-space-2);
  border: var(--ec-rule-width) solid var(--ec-border-strong);
  color: var(--ec-link);
}

.ec-pagination .page-numbers.current {
  background-color: var(--ec-navy);
  border-color: var(--ec-navy);
  color: var(--ec-on-navy);
}

/* ==========================================================================
   7. prefers-reduced-motion: tat truot muot & hieu ung
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .ec-hero__track {
    scroll-behavior: auto;
    animation: none !important;
  }

  .ec-hero__slide,
  .ec-hero__dot,
  .ec-card,
  .ec-card__thumb {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   8. Responsive
   ========================================================================== */
@media (max-width: 767px) {
  .ec-card--horizontal {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .ec-card--horizontal .ec-card__thumb {
    width: 72px;
    height: 72px;
  }

  .ec-single__title { font-size: var(--ec-fs-xl); }

  .ec-hero__title { font-size: var(--ec-fs-md); }

  .ec-hero__caption { padding: var(--ec-space-3); }
}

/* ==========================================================================
   Khung tac gia cuoi bai viet (.ec-authorbox)
   Avatar tron ben trai, ten + chuc danh + gioi thieu ben phai.
   ========================================================================== */
.ec-authorbox {
  display: flex;
  gap: var(--ec-space-4);
  align-items: flex-start;
  margin-top: var(--ec-space-8);
  padding: var(--ec-space-5);
  background-color: var(--ec-surface-alt);
  border-top: var(--ec-rule-width) solid var(--ec-rule);
}

.ec-authorbox__avatar {
  flex: 0 0 auto;
  line-height: 0;
}

.ec-authorbox__avatar img,
.ec-avatar {
  border-radius: 50%;
  width: 96px;
  height: 96px;
  object-fit: cover;
}

.ec-authorbox__body {
  min-width: 0;
}

.ec-authorbox__name {
  margin: 0 0 var(--ec-space-1);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-md);
  font-weight: 700;
}

.ec-authorbox__name-link {
  color: var(--ec-link);
  text-decoration: none;
}

.ec-authorbox__name-link:hover {
  color: var(--ec-link-hover);
}

.ec-authorbox__role {
  margin: 0 0 var(--ec-space-2);
  color: var(--ec-meta);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-sm);
}

.ec-authorbox__bio {
  margin: 0;
  font-size: var(--ec-fs-sm);
  line-height: var(--ec-lh-normal, 1.6);
}

.ec-authorbox__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ec-space-3);
  margin: var(--ec-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.ec-authorbox__link {
  color: var(--ec-link);
  font-family: var(--ec-font-ui);
  font-size: var(--ec-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.ec-authorbox__link:hover {
  color: var(--ec-link-hover);
}

/* Man hep: avatar len tren, chu xuong duoi */
@media (max-width: 479px) {
  .ec-authorbox {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .ec-authorbox__links {
    justify-content: center;
  }
}
