/* ============================================================
   B Corridor — Blog page styles
   Builds on styles.css (variables, header, footer, buttons,
   .cta-section). Only blog-specific layout lives here.
   ============================================================ */

.blog-page { background: var(--cream); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Shared little line-arrow used in buttons/links */
.ico-arrow { width: 1em; height: 1em; display: block; }

/* Active nav item keeps its underline shown */
.nav-links a.is-active::after { transform: scaleX(1); }

/* ───────────── HERO ───────────── */
.blog-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 70vh;
  padding: calc(var(--announce-h) + 150px) 0 clamp(130px, 14vw, 190px);
  background:
    linear-gradient(180deg, rgba(13, 38, 24, 0.62) 0%, rgba(13, 38, 24, 0.42) 45%, rgba(13, 38, 24, 0.66) 100%),
    url('assets/hero-poster.jpg') center / cover no-repeat;
  color: var(--white);
  overflow: hidden;
}
.blog-hero__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.blog-hero__copy { max-width: 620px; }
.blog-hero h1 {
  margin: 0 0 18px;
  color: var(--white) !important;        /* override global green heading colour */
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 0.95;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
.blog-hero__lede {
  max-width: 30ch;
  margin: 0 0 28px;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}
/* Hero wave — same curve and proportions as the homepage hero. It sits at
   the very bottom of the hero and spills into the section below, so the hero
   isn't a boxed block: it flows straight into the category bar beneath it. */
.blog-hero .hero-wave {
  position: absolute;
  left: 0; right: 0; bottom: -27px;
  width: 100%;
  height: clamp(108px, 10vw, 162px);
  line-height: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.blog-hero .hero-wave svg { display: block; width: 100%; height: 100%; }
.blog-hero .hero-wave path { fill: var(--cream); }

/* ───────────── CATEGORY FILTER ───────────── */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 4vw, 64px);
  max-width: 1100px;
  /* No top gap: the hero wave flows straight into this bar */
  margin: 0 auto;
  padding: clamp(6px, 1.5vw, 16px) 24px clamp(20px, 3vw, 30px);
  border-bottom: 1px solid rgba(70, 133, 92, 0.18);
}
.blog-filter__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 2px 10px;
  position: relative;
  text-decoration: none;
  color: var(--text-muted-2);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color .2s ease;
}
.blog-filter__icon { width: 30px; height: 30px; }
.blog-filter__item::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: var(--green);
  transform: scaleX(0);
  transition: transform .25s ease;
}
.blog-filter__item:hover,
.blog-filter__item:focus-visible,
.blog-filter__item.is-active { color: var(--green-dark); }
.blog-filter__item.is-active::after,
.blog-filter__item:hover::after { transform: scaleX(1); }

/* ───────────── LAYOUT ───────────── */
.blog-layout {
  max-width: 1180px;
  margin: clamp(36px, 5vw, 56px) auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-rows: auto 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
/* Desktop: articles span the left; News & Updates sits top-right with
   Popular Topics beneath it. (Source order is About → posts → topics so
   that mobile stacks them in that order automatically.) */
.blog-posts   { grid-column: 1; grid-row: 1 / span 2; }
.blog-about   { grid-column: 2; grid-row: 1; }
.blog-sidebar { grid-column: 2; grid-row: 2; align-self: start; }

/* ───────────── POST CARDS ───────────── */
.blog-posts { display: flex; flex-direction: column; }
.post-card {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: center;
  padding: clamp(22px, 3vw, 32px) 0;
  border-bottom: 1px solid rgba(70, 133, 92, 0.16);
}
.blog-posts .post-card:first-child { padding-top: 0; }

.post-card__media {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--sage-light);
  box-shadow: 0 10px 26px rgba(22, 49, 31, 0.12);
}
.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.post-card:hover .post-card__media img { transform: scale(1.05); }

.post-card__body { min-width: 0; }
.post-card__tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.post-card__title {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  line-height: 1.05;
}
.post-card__title a {
  color: var(--green-dark);
  text-decoration: none;
  transition: color .2s ease;
}
.post-card__title a:hover,
.post-card__title a:focus-visible { color: var(--green); }
.post-card__excerpt {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}
.post-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--text-muted-2);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.post-card__date { display: inline-flex; align-items: center; gap: 8px; }
.post-card__date svg { width: 16px; height: 16px; color: var(--green); }
.post-card__dot { color: var(--green); }

/* ───────────── PAGINATION ───────────── */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(28px, 4vw, 40px);
}
.blog-pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(70, 133, 92, 0.25);
  background: var(--white);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.blog-pagination__page:hover { border-color: var(--green); color: var(--green-dark); }
.blog-pagination__page.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}
.blog-pagination__ellipsis { color: var(--text-muted-3); letter-spacing: 2px; }
.blog-pagination__next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  color: var(--green-dark);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
  transition: color .2s ease, gap .2s ease;
}
.blog-pagination__next svg { width: 18px; height: 18px; }
.blog-pagination__next:hover { color: var(--green); gap: 10px; }

/* ───────────── SIDEBAR ───────────── */
.blog-sidebar { position: sticky; top: calc(var(--announce-h) + 90px); }
.blog-sidebar__card {
  background: var(--cream-panel);
  /* same border colour + offset shadow as the Quick Facts card */
  border: 1.5px solid #46855c;
  border-radius: 20px;
  padding: clamp(22px, 2.6vw, 30px);
  box-shadow: 4px 5px 0 0 #46855c;
}
.sidebar-block + .sidebar-block {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid rgba(70, 133, 92, 0.16);
}
.sidebar-block__title {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar-block p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}
.sidebar-block__sub { margin-bottom: 14px !important; }

/* Subscribe form (sidebar) */
.sidebar-subscribe { display: flex; flex-direction: column; gap: 10px; }
.sidebar-subscribe__input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(70, 133, 92, 0.28);
  border-radius: 12px;
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--forest);
}
.sidebar-subscribe__input::placeholder { color: var(--text-muted-3); }
.sidebar-subscribe__input:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(70, 133, 92, 0.18);
}
.sidebar-subscribe__btn {
  justify-content: center;
  padding: 12px 18px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sidebar-subscribe__btn .btn-icon { display: inline-flex; margin-left: 8px; }

/* Popular topics */
.topic-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-list a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color .2s ease;
}
.topic-list a:hover { background: rgba(70, 133, 92, 0.08); }
.topic-list img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--sage-light);
}
.topic-list__name {
  color: var(--forest);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
}
.topic-list__count {
  color: var(--text-muted-3);
  font-size: 0.78rem;
  font-family: var(--font-display);
  white-space: nowrap;
}
.sidebar-block__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color .2s ease, gap .2s ease;
}
.sidebar-block__link svg { width: 16px; height: 16px; }
.sidebar-block__link:hover { color: var(--green); gap: 10px; }

/* ───────────── RESPONSIVE ───────────── */
@media (max-width: 980px) {
  /* Single column. Source order (About → posts → Popular Topics) stacks
     as: News & Updates first, then the articles, then Popular Topics. */
  .blog-layout { grid-template-columns: 1fr; grid-template-rows: none; }
  .blog-about,
  .blog-posts,
  .blog-sidebar { grid-column: 1; grid-row: auto; }
  /* Centre the News & Updates and Popular Topics blocks */
  .blog-about,
  .blog-sidebar {
    position: static;
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
  /* keep the category rows tidy */
  .blog-sidebar .cat-list { text-align: left; }
  /* Sit the hero wave a little higher on tablet/mobile */
  .blog-hero .hero-wave { bottom: -16px; }
}
@media (max-width: 640px) {
  .post-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .post-card__media { aspect-ratio: 16 / 9; }
  .blog-filter { gap: 18px 28px; }
  .blog-filter__item { font-size: 0.8rem; }
}

/* ───────────── Sidebar categories (filter) ───────────── */
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--forest);
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.cat-link:hover { background: rgba(70, 133, 92, 0.1); }
.cat-link.is-active { background: var(--green); color: var(--white); }
.cat-count {
  flex: 0 0 auto;
  min-width: 26px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-muted-3);
  background: var(--sage-light);
  border-radius: 999px;
  padding: 1px 9px;
}
.cat-link.is-active .cat-count { background: rgba(255, 255, 255, 0.28); color: var(--white); }

.post-empty-filter {
  padding: 28px 4px;
  color: var(--text-muted-2);
  font-size: 1rem;
}

/* ───────────── Pagination buttons (generated by JS) ───────────── */
.blog-pagination button { font: inherit; box-sizing: border-box; }
.blog-pagination__nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(70, 133, 92, 0.25);
  border-radius: 999px;
  background: var(--white);
  color: var(--green-dark);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.blog-pagination__nav:hover { border-color: var(--green); color: var(--green); }
.blog-pagination__page { cursor: pointer; }
button.blog-pagination__ellipsis {
  border: 0;
  background: transparent;
  cursor: pointer;
  align-self: center;
  padding: 0 4px;
  transition: color .2s ease;
}
button.blog-pagination__ellipsis:hover { color: var(--green-dark); }
