/* ============================================================================
 * Related Articles — canonical "You may/might also like" component.
 *
 * Single source of truth for the markup that the `related_hub_articles`
 * flex layout (PSL, savings hub) and the hub_article auto-pickup partial
 * both produce via htb_render_related_articles(). All callers get the
 * same visual.
 *
 * --ps-* variables are expected to be defined elsewhere (personal-savings-v4.css
 * sets them at :root; hub-article.css also sets them at :root). If neither
 * stylesheet is enqueued on a page, declare fallbacks here so the component
 * still renders correctly.
 * ============================================================================ */

:root {
  /* Fallbacks — overridden by page-specific palettes if they define these
   * variables earlier in the cascade. */
  --ps-navy: #041e41;
  --ps-pale: #f3f5f7;
  --ps-muted: #5b6a85;
  --ps-line: #e1e6ec;
  --ps-font: "canada-type-gibson", "Gibson", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

section.content.deel-related-articles {
  /* 60px lead-in matching the other section headings (client: uniform);
   * bottom keeps 80. */
  padding: 60px 0 80px;
  background: #f3f5f7;
  margin: 0;
  font-family: var(--ps-font);
}
section.content.deel-related-articles .content-block {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.deel-related-articles__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}
.deel-related-articles__title {
  font-size: 36px;
  font-weight: 600;
  color: var(--ps-navy);
  margin: 0 0 10px;
  line-height: 1.15;
}
.deel-related-articles__subtitle {
  font-size: 17px;
  color: var(--ps-muted);
  margin: 0;
  line-height: 1.5;
}

/* Flex (not grid) so 1-2 cards centre within the section instead of
 * left-aligning; card widths match the former 3-column grid. */
.deel-related-articles__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}
.deel-related-articles__grid > * {
  flex: 0 0 calc((100% - 64px) / 3);
  max-width: calc((100% - 64px) / 3);
}
@media (max-width: 900px) {
  .deel-related-articles__grid > * {
    flex-basis: calc((100% - 32px) / 2);
    max-width: calc((100% - 32px) / 2);
  }
}
@media (max-width: 600px) {
  .deel-related-articles__grid > * {
    flex-basis: 100%;
    max-width: 100%;
  }
}

.deel-related-articles .savings-hub-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(4, 30, 65, 0.06);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  font-family: var(--ps-font);
}
.deel-related-articles .savings-hub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border-color: rgba(4, 30, 65, 0.12);
}
.deel-related-articles .savings-hub-card__image {
  width: 100%;
  /* 16:9 to match the hub-card / article-hero crops (was a fixed 180px,
   * which displayed ~2:1 and re-cropped every image — client). */
  aspect-ratio: 16 / 9;
  height: auto;
  overflow: hidden;
  background: var(--ps-pale);
}
.deel-related-articles .savings-hub-card__image img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.deel-related-articles .savings-hub-card__title {
  font-size: 19px;
  font-weight: 600;
  color: var(--ps-navy);
  margin: 18px 24px 8px;
  line-height: 1.25;
}
.deel-related-articles .savings-hub-card__desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ps-muted);
  margin: 0 24px 14px;
}
.deel-related-articles .savings-hub-card__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--ps-muted);
  /* margin-top: auto pushes the meta to the bottom of the flex column
   * so cards with short descriptions don't have the meta floating
   * mid-card — it always sits flush at the bottom edge. */
  margin: auto 24px 22px;
}
.deel-related-articles .savings-hub-card__type {
  background: transparent;
  color: var(--ps-muted);
  padding: 0;
  border-radius: 0;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.deel-related-articles .savings-hub-card__meta-sep { color: var(--ps-line); }

/* Footer CTA — rendered only when the editor sets a cta_button.
   Inherits .deel-btn base size/typography from deel-btn.css. */
.deel-related-articles__footer {
  text-align: center;
  margin-top: 40px;
}
.deel-related-articles__footer .deel-btn--outline {
  background: transparent;
  color: #041e41;
  border-color: #d6dbe2;
}
.deel-related-articles__footer .deel-btn--outline:hover {
  background: #fff;
  border-color: #041e41;
  color: #041e41;
}
