/* =====================================================================
   Article Grid / Cards — Standalone CSS
   Reusable component for article listing pages.
===================================================================== */

/* ============================================================
   ARTICLE SECTION
============================================================ */
.article-section {
  padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem);
  background: var(--d3-paper);
}

/* ============================================================
   ARTICLE GRID
============================================================ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ============================================================
   ARTICLE CARD
============================================================ */
.article-card {
  background: var(--d3-white);
  border: 1px solid var(--d3-rule);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .3s, transform .3s;
}
.article-card:hover {
  box-shadow: 0 12px 40px -12px rgba(3, 16, 49, .15);
  transform: translateY(-2px);
}

/* --- Card Image -----------------------------------------------------
   Same rule as the featured panel: the <a> has to be a block with a
   definite height or `height:100%` / `object-fit:cover` are ignored.
-------------------------------------------------------------------- */
.article-card__img {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--d3-paper-2);
}
.article-card__img a {
  display: block;
  width: 100%;
  height: 100%;
}
.article-card__img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.article-card:hover .article-card__img img {
  transform: scale(1.04);
}

/* --- Category Badge --- */
.article-card__category {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--d3-ff-nav);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
  background: var(--d3-brand);
  color: #fff;
}
.article-card__category.cat-hfo   { background: #0058BD; }
.article-card__category.cat-hfc   { background: #0a8a4a; }
.article-card__category.cat-hcfc  { background: #7c3aed; }
.article-card__category.cat-hc    { background: #d97706; }
.article-card__category.cat-general { background: var(--d3-brand); }

/* --- Card Body --- */
.article-card__body {
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* --- Date --- */
.article-card__date {
  font-family: var(--d3-ff-nav);
  font-size: .72rem;
  font-weight: 500;
  color: var(--d3-steel);
  letter-spacing: .03em;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.article-card__date i {
  font-size: .65rem;
}

/* --- Title --- */
.article-card__title {
  font-family: var(--d3-ff-disp);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--d3-ink);
  line-height: 1.35;
  margin-bottom: .6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Excerpt --- */
.article-card__excerpt {
  font-size: .86rem;
  color: var(--d3-ink-soft);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.25rem;
  flex: 1;
}

/* --- Card Footer --- */
.article-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--d3-rule);
}
.article-card__read {
  font-family: var(--d3-ff-nav);
  font-size: .8rem;
  font-weight: 600;
  color: var(--d3-brand);
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: gap .2s;
}
.article-card:hover .article-card__read {
  gap: .6rem;
}
.article-card__read i {
  font-size: .7rem;
  transition: transform .2s;
}
.article-card:hover .article-card__read i {
  transform: translateX(2px);
}
.article-card__time {
  font-size: .72rem;
  color: var(--d3-steel-2);
  font-family: var(--d3-ff-nav);
}

/* ============================================================
   FEATURED ARTICLE (spans full grid width)
============================================================ */
.article-featured {
  grid-column: 1 / -1;
  display: grid;
  /* minmax(0,…) so a wide cover image can never blow out a column */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--d3-white);
  border: 1px solid var(--d3-rule);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow .3s;
}
.article-featured:hover {
  box-shadow: 0 16px 48px -12px rgba(3, 16, 49, .18);
}

/* --- Featured Image -------------------------------------------------
   The panel is sized by the text column, not by the picture:
   min-height gives it a floor, the grid stretches it to the full row,
   and object-fit: cover crops the picture into that box.

   The <a> around the <img> must be block-level with a definite height,
   otherwise `height: 100%` on the <img> resolves to auto and the cover
   crop silently stops working (image renders at intrinsic ratio, then
   gets clipped by overflow: hidden).
-------------------------------------------------------------------- */
.article-featured__img {
  position: relative;
  min-height: clamp(260px, 30vw, 420px);
  overflow: hidden;
  background: var(--d3-paper-2);
}
.article-featured__img a {
  position: absolute;
  inset: 0;
  display: block;
}
.article-featured__img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.article-featured:hover .article-featured__img img {
  transform: scale(1.03);
}

/* --- Featured Body --- */
.article-featured__body {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- Featured Badge --- */
.article-featured__badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--d3-ff-nav);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--d3-brand);
  margin-bottom: 1rem;
}
.article-featured__badge::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--d3-brand);
}

/* --- Featured Title --- */
.article-featured__title {
  font-family: var(--d3-ff-disp);
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--d3-ink);
  line-height: 1.25;
  margin-bottom: .75rem;
  letter-spacing: -.01em;
}

/* --- Featured Excerpt --- */
.article-featured__excerpt {
  font-family: var(--d3-ff-body);
  font-size: .92rem;
  color: var(--d3-ink-soft);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Featured Meta --- */
.article-featured__meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: .78rem;
  color: var(--d3-steel);
  font-family: var(--d3-ff-nav);
}
.article-featured__meta span {
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* ============================================================
   PAGINATION
============================================================ */
.article-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.5rem 0 0;
}
.article-pagination a,
.article-pagination span {
  font-family: var(--d3-ff-nav);
  font-size: .85rem;
  font-weight: 500;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--d3-rule-hard);
  border-radius: var(--d3-r);
  color: var(--d3-ink-soft);
  transition: all .2s;
}
.article-pagination a:hover {
  border-color: var(--d3-ink);
  color: var(--d3-ink);
}
.article-pagination .active {
  background: var(--d3-ink);
  color: #fff;
  border-color: var(--d3-ink);
}
.article-pagination .nav-arrow {
  width: auto;
  padding: 0 16px;
  gap: .4rem;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1080px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .article-featured {
    grid-template-columns: minmax(0, 1fr);
  }
  .article-featured__img {
    position: relative;
    /* stacked layout: image becomes a normal banner above the text */
    aspect-ratio: 16/9;
    min-height: 0;
  }
}

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