/* ================================================================
   blog-index.css — Blog listing page enhancements
   Extends main.css. Linked only from blog/index.html.
   All values use MD3 design tokens from main.css.
   ================================================================ */

/* ── Featured Article ─────────────────────────────────────────── */

.blog-feat {
  margin-bottom: 40px;
}

.blog-feat__card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-1);
  transition: box-shadow 250ms ease, transform 200ms ease;
  color: inherit;
  text-decoration: none;
}

.blog-feat__card:hover {
  box-shadow: var(--md-sys-elevation-3);
  transform: translateY(-3px);
}

.blog-feat__img-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
  flex-shrink: 0;
}

.blog-feat__img-wrap--placeholder {
  background: linear-gradient(135deg, var(--md-sys-color-primary-container) 0%, var(--md-sys-color-secondary-container) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-feat__placeholder {
  font-size: 56px;
  color: var(--md-sys-color-on-primary-container);
  opacity: .35;
}

.blog-feat__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 500ms ease;
}

.blog-feat__card:hover .blog-feat__img {
  transform: scale(1.04);
}

.blog-feat__body {
  padding: 2.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.blog-feat__eyebrow {
  color: var(--md-sys-color-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0;
}

.blog-feat__cat {
  display: inline-flex;
  align-items: center;
  padding: .25em .9em;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: var(--md-sys-shape-corner-full);
  text-transform: uppercase;
  letter-spacing: .05em;
  align-self: flex-start;
}

.blog-feat__title {
  color: var(--md-sys-color-on-surface);
  margin: 0;
  max-width: 24ch;
}

.blog-feat__excerpt {
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-feat__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.blog-meta-dot {
  color: var(--md-sys-color-outline-variant);
}

/* ── Filter chips ─────────────────────────────────────────────── */

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 20px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 24px;
}

/* MD3 filter chip spec: 32dp height, small shape, outline border */
.blog-filter-chip {
  height: 32px;
  padding: 0 16px;
  font: 500 14px/1 var(--font);
  letter-spacing: .1px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  white-space: nowrap;
}

.blog-filter-chip:hover {
  background: var(--md-sys-color-surface-container-high);
}

.blog-filter-chip--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}

/* ── Grid override (named blog-grid to avoid conflict) ─────────── */
/* preview-grid already exists in main.css; we add filtering support */

.preview-card.hidden {
  display: none;
}

/* ── Card excerpt (progressive disclosure) ────────────────────── */

.preview-card__excerpt {
  font: 400 13px/1.55 var(--font);
  letter-spacing: .25px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Desktop: hidden by default, revealed on hover */
  max-height: 0;
  opacity: 0;
  transition: max-height 300ms ease, opacity 250ms ease;
}

.preview-card:hover .preview-card__excerpt {
  max-height: 5.5em;
  opacity: 1;
}

/* ── Card byline (author + reading time) ──────────────────────── */

.preview-card__byline {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--md-sys-color-on-surface-variant);
  flex: 1;
}

.preview-card__byline-sep {
  color: var(--md-sys-color-outline-variant);
}

/* ── Skeleton shimmer ─────────────────────────────────────────── */

.preview-card.img-loading .preview-card__img-wrap,
.blog-feat__card.img-loading .blog-feat__img-wrap {
  background: linear-gradient(
    90deg,
    var(--md-sys-color-surface-container) 25%,
    var(--md-sys-color-surface-container-high) 50%,
    var(--md-sys-color-surface-container) 75%
  );
  background-size: 200% 100%;
  animation: zyu-shimmer 1.4s infinite;
}

@keyframes zyu-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Load More ────────────────────────────────────────────────── */

.blog-load-more {
  display: flex;
  justify-content: center;
  padding: 40px 0 8px;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 840px) {
  /* Featured: stack image above text */
  .blog-feat__card {
    grid-template-columns: 1fr;
  }
  .blog-feat__img-wrap {
    aspect-ratio: 16 / 9;
  }
  .blog-feat__body {
    padding: 1.5rem;
    gap: 10px;
  }
  .blog-feat__title {
    max-width: none;
  }

  /* Mobile: always show 2 lines of excerpt */
  .preview-card__excerpt {
    max-height: 3.5em;
    opacity: 1;
    -webkit-line-clamp: 2;
  }
}
