/*
 * listings.css — Equal-height grid layout for Divi loop-module listings.
 *
 * Loaded globally (cheap: <1 KB). Rules are scoped via :has(.loop-excerpt)
 * so they apply only on pages whose body contains Divi loop cards
 * (customer-cases, blog, etc.) and are no-ops everywhere else.
 *
 * The original Divi loop layout uses .et_pb_row_1 as a flex row with
 * et_flex_column_8_24 (33% width) children, and lets each card's
 * .et_pb_group size itself to its content. With variable title and
 * excerpt lengths, neighbouring cards end up at different heights.
 *
 * This override:
 *   - converts the row to a 3-up CSS grid (2-up tablet, 1-up phone)
 *   - stretches each card's group to fill its grid cell
 *   - pushes the "Read more" button to the bottom of every card
 */

.et_pb_row.et_flex_row:has(.loop-excerpt) {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  align-items: stretch;
  /* Match the Divi content gutter so the listing aligns with the
     hero/intro section above it. Without this, our `display: grid`
     override lets the row span the full viewport. */
  width: 80%;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.et_pb_row.et_flex_row:has(.loop-excerpt) > [class*="et_pb_column"] {
  width: auto !important;
  max-width: none;
  margin: 0 !important;
  display: flex;
}

.et_pb_row.et_flex_row:has(.loop-excerpt) > [class*="et_pb_column"] > .et_pb_group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.et_pb_row.et_flex_row:has(.loop-excerpt) .et_pb_button_module_wrapper {
  margin-top: auto;
}

@media (max-width: 980px) {
  .et_pb_row.et_flex_row:has(.loop-excerpt) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .et_pb_row.et_flex_row:has(.loop-excerpt) {
    grid-template-columns: 1fr;
  }
}

/* --- Pagination (rendered by scripts/build-blog.bb) --------------------- */

.cm-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px auto 0;
  font-size: 15px;
}

.cm-pagination__link,
.cm-pagination__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 6px;
  color: #154c52;
  text-decoration: none;
  line-height: 1;
}

.cm-pagination__link {
  background: #f0f4f5;
  transition: background-color 120ms ease;
}

.cm-pagination__link:hover {
  background: #d9e6e8;
  text-decoration: none;
}

.cm-pagination__link--current {
  background: #154c52;
  color: #fff;
  cursor: default;
}

.cm-pagination__gap {
  color: #6b7a7c;
  cursor: default;
}

/* --- News index (rendered by scripts/build-news.bb) --------------------- */

main.cm-news-index {
  max-width: 1080px;
}

.cm-news-header {
  text-align: center;
  margin: 0 auto 48px;
  max-width: 720px;
}
.cm-news-header h1 {
  font-size: 40px;
  font-weight: 700;
  color: #154c52;
  margin: 0 0 12px;
  line-height: 1.2;
}

.cm-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .cm-news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .cm-news-grid { grid-template-columns: 1fr; }
}

.cm-news-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #d9e6e8;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
.cm-news-card:hover {
  box-shadow: 0 12px 24px -10px rgba(21, 76, 82, 0.18);
  transform: translateY(-2px);
}

.cm-news-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e8f1ec;
}
.cm-news-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cm-news-card__body {
  display: flex;
  flex-direction: column;
  padding: 20px 22px 22px;
  flex: 1;
}

.cm-news-card__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 10px;
}
.cm-news-card__title a {
  color: #154c52;
  text-decoration: none;
}
.cm-news-card__title a:hover { text-decoration: underline; }

.cm-news-card__excerpt {
  color: #154c52;
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 16px;
  flex: 1;
}

.cm-news-card__button {
  align-self: flex-start;
  color: #2ea3f2;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.cm-news-card__button:hover { text-decoration: underline; }
.cm-news-card__button::after { content: " →"; }
