/* W05: Blog / Insights listing, article cards, single articles and related reading.
   Uses the W02–W04 tokens and surfaces already defined in theme.css. */

/* --- Listing ------------------------------------------------------------- */

.blog-intro {
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  color: var(--vr-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.blog-intro > :last-child {
  margin-bottom: 0;
}

.blog-list {
  padding-top: clamp(0.5rem, 2vw, 1rem);
}

.blog-list__heading {
  margin-bottom: 1rem;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.blog-result-count {
  margin: 0 0 1.15rem;
  color: var(--vr-muted);
  font-size: 0.9rem;
}

/* --- Category filter ----------------------------------------------------- */

.blog-filter {
  display: grid;
  gap: 0.7rem;
  margin-bottom: clamp(1.25rem, 3vw, 1.9rem);
  padding-block: 1rem;
  border-top: 1px solid var(--vr-line);
  border-bottom: 1px solid var(--vr-line);
}

.blog-filter__label {
  margin: 0;
  color: var(--vr-muted);
  font-size: 0.79rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blog-filter__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-filter__list a {
  display: inline-flex;
  min-height: 2.6rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(36, 92, 74, 0.22);
  border-radius: 99rem;
  color: var(--vr-green-dark);
  font-size: 0.88rem;
  font-weight: 640;
  text-decoration: none;
}

.blog-filter__list a:hover,
.blog-filter__list a[aria-current="page"] {
  border-color: var(--vr-green);
  background: var(--vr-sage);
}

.blog-filter__count {
  color: var(--vr-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.blog-filter__clear {
  margin: 0;
}

/* --- Article grid and cards ---------------------------------------------- */

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.article-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.article-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(27, 49, 44, 0.12);
  border-radius: 0.6rem;
  background: var(--vr-paper);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.article-card__demo {
  margin: 0;
  padding: 0.55rem 0.8rem;
  background: #f5e9df;
  color: #703e35;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1.4;
}

.article-card__image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--vr-sage);
}

.article-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Graceful stand-in so an article without a featured image still reads as a card. */
.article-card__placeholder {
  position: relative;
  display: flex;
  aspect-ratio: 16 / 9;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background:
    radial-gradient(ellipse at 22% 28%, rgba(232, 239, 234, 0.95), rgba(232, 239, 234, 0) 62%),
    linear-gradient(150deg, #eef3ef 0%, #e2ebe5 100%);
  overflow: hidden;
}

.article-card__placeholder::after {
  position: absolute;
  right: -12%;
  bottom: -34%;
  width: 68%;
  aspect-ratio: 1;
  border: 1px solid rgba(36, 92, 74, 0.14);
  border-radius: 48% 52% 67% 33% / 44% 38% 62% 56%;
  content: "";
}

.article-card__placeholder-mark {
  color: rgba(36, 92, 74, 0.42);
  font-family: var(--vr-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.article-card__placeholder-lines {
  width: 38%;
  height: 0.5rem;
  margin-bottom: 0.35rem;
  border-radius: 99rem;
  background: rgba(36, 92, 74, 0.16);
}

.article-card__body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(1.15rem, 2.2vw, 1.6rem);
}

.article-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
}

.article-card__categories span,
.article-hero__categories span {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #edf1ed;
  color: #43574e;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.35;
}

.article-card__title {
  width: 100%;
  margin-bottom: 0.6rem;
  font-size: clamp(1.2rem, 1.65vw, 1.5rem);
  line-height: 1.26;
  overflow-wrap: anywhere;
}

.article-card__title a {
  color: var(--vr-ink);
  text-decoration: none;
}

.article-card__title a:hover {
  color: var(--vr-green);
  text-decoration: underline;
}

.article-card__teaser {
  margin-bottom: 0.9rem;
  color: var(--vr-muted);
  font-size: 0.92rem;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.article-card__meta {
  margin: 0 0 0.9rem;
  color: var(--vr-muted);
  font-size: 0.82rem;
}

.article-card__action {
  margin: auto 0 0;
  padding-top: 0.25rem;
}

/* Featured card: full-width lead treatment on the unfiltered listing. */
.article-card--featured {
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.article-card--featured .article-card__body {
  padding: clamp(1.35rem, 3vw, 2.2rem);
}

.article-card--featured .article-card__title {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  max-width: 26ch;
}

.article-card--featured .article-card__teaser {
  max-width: 62ch;
  font-size: 1rem;
}

@media (min-width: 48rem) {
  .article-card--featured {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: stretch;
  }

  .article-card--featured .article-card__image,
  .article-card--featured .article-card__placeholder {
    height: 100%;
    aspect-ratio: auto;
    min-height: 17rem;
  }
}

/* --- Empty state --------------------------------------------------------- */

.blog-empty {
  display: flex;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 2rem);
  margin-block: clamp(1rem, 3vw, 2rem);
  padding: clamp(1.5rem, 3.5vw, 2.6rem);
  border: 1px dashed rgba(27, 49, 44, 0.2);
  border-radius: 0.6rem;
  background: var(--vr-paper);
}

.blog-empty__mark {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--vr-sage);
  color: var(--vr-green);
  font-family: var(--vr-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.blog-empty h2 {
  max-width: 24ch;
  margin-bottom: 0.65rem;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
}

.blog-empty p:last-child {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--vr-muted);
  line-height: 1.7;
}

/* --- Pagination ---------------------------------------------------------- */

.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(1.5rem, 3vw, 2.4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--vr-line);
}

.blog-pagination__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-pagination__item > * {
  display: inline-flex;
  min-width: 2.6rem;
  min-height: 2.6rem;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(36, 92, 74, 0.22);
  border-radius: 0.25rem;
  color: var(--vr-green-dark);
  font-size: 0.9rem;
  font-weight: 640;
  text-decoration: none;
}

.blog-pagination__item > a:hover {
  border-color: var(--vr-green);
  background: var(--vr-sage);
}

.blog-pagination__item > .current {
  border-color: var(--vr-green);
  background: var(--vr-green);
  color: var(--vr-paper);
}

.blog-pagination__status {
  margin: 0;
  color: var(--vr-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* --- Single article ----------------------------------------------------- */

/* Breadcrumb links meet the 24px minimum target size (WCAG 2.2 SC 2.5.8).
   Scoped to the W05 article breadcrumb so the approved W04 case-study
   breadcrumb keeps its reviewed rendering. */
.article-breadcrumb {
  align-items: center;
  flex-wrap: wrap;
}

.article-breadcrumb a {
  display: inline-flex;
  min-height: 1.5rem;
  align-items: center;
}

.article-hero {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 3vw, 2rem);
}

.article-hero h1 {
  max-width: 32ch;
  margin-bottom: 1.1rem;
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.article-hero__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.article-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  color: var(--vr-muted);
  font-size: 0.9rem;
}

.article-content {
  max-width: 46rem;
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  font-size: 1.075rem;
  line-height: 1.78;
}

.article-content > :first-child {
  margin-top: 0;
}

.article-content p,
.article-content li {
  color: var(--vr-body);
  overflow-wrap: anywhere;
}

.article-content h2 {
  margin-top: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.85rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.2;
  scroll-margin-top: 6rem;
}

.article-content h3 {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 0.65rem;
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  line-height: 1.28;
  scroll-margin-top: 6rem;
}

.article-content ul,
.article-content ol {
  margin: 0 0 1.35rem;
  padding-left: 1.4rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.article-content blockquote {
  margin: 1.75rem 0;
  padding: 0.35rem 0 0.35rem 1.35rem;
  border-left: 0.2rem solid var(--vr-green);
  color: var(--vr-ink);
  font-family: var(--vr-serif);
  font-size: 1.15rem;
  font-style: italic;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content figure {
  margin: 1.9rem 0;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.4rem;
}

.article-content figcaption {
  margin-top: 0.6rem;
  color: var(--vr-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.article-content table {
  width: 100%;
  margin: 1.75rem 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.article-content th,
.article-content td {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--vr-line);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: var(--vr-sage);
  font-weight: 700;
}

/* Make wide tables and images scroll rather than overflow the viewport. */
.article-content .wp-block-table {
  overflow-x: auto;
}

.article-content code {
  padding: 0.15em 0.35em;
  border-radius: 0.2rem;
  background: var(--vr-sage);
  font-size: 0.9em;
}

.article-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem 1.15rem;
  border-radius: 0.4rem;
  background: #1f2b26;
  color: #eef3ef;
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-content pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.article-content hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--vr-line);
}

/* --- Table of contents -------------------------------------------------- */

.article-toc {
  max-width: 46rem;
  margin-block: clamp(1.25rem, 3vw, 2rem);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid rgba(27, 49, 44, 0.12);
  border-radius: 0.55rem;
  background: var(--vr-sage);
}

.article-toc__title {
  margin-bottom: 0.65rem;
  font-size: 0.79rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-toc__list {
  margin: 0;
  padding-left: 1.2rem;
}

.article-toc__item {
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.article-toc__item--level-3 {
  margin-left: 1rem;
  font-size: 0.94rem;
}

.article-toc__item a {
  color: var(--vr-green-dark);
  text-underline-offset: 0.18em;
}

/* --- Related reading and back navigation -------------------------------- */

.article-related {
  /* Same gutter as .content-width, so the heading is never flush to the edge. */
  width: min(calc(100% - 2 * var(--vr-page-gutter)), 75rem);
  margin-inline: auto;
  padding-block: clamp(2rem, 4vw, 3.25rem);
  border-top: 1px solid var(--vr-line);
}

.article-related .section-heading {
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.article-back {
  padding-block: clamp(1.25rem, 3vw, 2rem) clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--vr-line);
}

/* --- Preview banner ----------------------------------------------------- */

.blog-preview-banner {
  display: grid;
  gap: 0.35rem;
  margin-block: 1.5rem;
  padding: 1rem 1.2rem;
  border-left: 0.25rem solid #875045;
  background: #f7eee7;
  color: #56342e;
  font-size: 0.9rem;
}

.blog-preview-banner strong {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* --- Homepage Latest Insights ------------------------------------------- */

.section--insights .article-grid {
  margin-top: clamp(1.25rem, 3vw, 2rem);
}

.section--insights .section-action {
  margin-top: clamp(1.25rem, 3vw, 2rem);
}

/* The section heading/lede are already constrained by the section layout. */
.section--insights .section-heading {
  max-width: 60rem;
}

/* --- Hover and responsive behaviour ------------------------------------- */

@media (hover: hover) and (pointer: fine) {
  .article-card:hover {
    border-color: rgba(36, 92, 74, 0.32);
    box-shadow: 0 0.6rem 1.6rem rgba(27, 49, 44, 0.1);
    transform: translateY(-2px);
  }

  .article-card__title a:hover {
    text-decoration: underline;
  }
}

@media (max-width: 63.99rem) {
  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-grid--single {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 47.99rem) {
  .article-grid,
  .article-grid--single {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .blog-empty {
    flex-direction: column;
  }

  .article-content {
    font-size: 1.03rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-card {
    transition: none;
  }
}

@media (forced-colors: active) {
  .article-card,
  .blog-empty,
  .article-toc {
    border: 1px solid CanvasText;
  }

  .article-card__placeholder {
    background: Canvas;
  }
}
