/* FinForFam illustration language: four slots, five pale colour families.
   Approved PNGs are unchanged. The image safety area accommodates bounded
   optical compensation without clipping or escaping the tile. No motion. */
.fff-illustration {
  --fff-ill-size: 72px;
  --fff-ill-image-size: 88%;
  --fff-ill-radius: 18px;
  --fff-ill-background: #f3f4f0;
  --fff-ill-edge: rgba(25, 66, 72, .055);
  --fff-ill-scale: 1.04;
  --fff-ill-x: 0%;
  --fff-ill-y: 0%;
  --fff-ill-gap: 12px;
  position: relative;
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--fff-ill-size);
  height: var(--fff-ill-size);
  min-width: var(--fff-ill-size);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--fff-ill-radius);
  background: var(--fff-ill-background);
  box-shadow: inset 0 0 0 1px var(--fff-ill-edge);
  vertical-align: middle;
}
.fff-illustration > picture {
  display: block;
  width: var(--fff-ill-image-size);
  height: var(--fff-ill-image-size);
}
.fff-illustration img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  object-position: center;
  transform: translate(var(--fff-ill-x), var(--fff-ill-y)) scale(var(--fff-ill-scale));
  transform-origin: center;
}
.fff-illustration > img { width: var(--fff-ill-image-size); height: var(--fff-ill-image-size); }

.fff-illustration--feature { --fff-ill-size: 96px; --fff-ill-radius: 22px; --fff-ill-gap: 16px; }
.fff-illustration--card { --fff-ill-size: 72px; --fff-ill-radius: 18px; }
.fff-illustration--row { --fff-ill-size: 36px; --fff-ill-radius: 9px; --fff-ill-gap: 12px; }
.fff-illustration--inline { --fff-ill-size: 48px; --fff-ill-radius: 12px; --fff-ill-gap: 12px; }

.fff-illustration--home,
.fff-illustration--learn { --fff-ill-background: #f8f1e8; }
.fff-illustration--education { --fff-ill-background: #edf4f8; }
.fff-illustration--saving { --fff-ill-background: #edf5f0; }
.fff-illustration--money,
.fff-illustration--planning { --fff-ill-background: #f3f4f0; }
.fff-illustration--overview { --fff-ill-background: #eaf4f3; }

/* Alpha bounds and weighted centroids inform these deliberately modest values.
   Wide/shallow and narrow silhouettes keep their character; dense art is quieter. */
.fff-illustration[data-illustration="tfsa_flexible_savings"] { --fff-ill-scale: 1.12; --fff-ill-y: -.4%; }
.fff-illustration[data-illustration="rrsp_retirement_savings"] { --fff-ill-scale: 1.02; }
.fff-illustration[data-illustration="mortgage_renewal"] { --fff-ill-scale: .98; --fff-ill-x: -1%; --fff-ill-y: -1%; }
.fff-illustration[data-illustration="mortgage_prepayment"] { --fff-ill-scale: 1.04; --fff-ill-x: 1.5%; }
.fff-illustration[data-illustration="compare_financial_options"] { --fff-ill-scale: 1.10; --fff-ill-y: .5%; }
.fff-illustration[data-illustration="monthly_surplus_money_available"] { --fff-ill-scale: 1.10; --fff-ill-x: .5%; --fff-ill-y: -1%; }
.fff-illustration[data-illustration="bigger_picture_your_finances"] { --fff-ill-scale: 1.12; }
.fff-illustration[data-illustration="build_ahead_long_term_planning"] { --fff-ill-scale: 1.08; --fff-ill-x: -1.5%; --fff-ill-y: -2%; }
.fff-illustration[data-illustration="learn_understand_basics"] { --fff-ill-scale: 1.10; }
.fff-illustration[data-illustration="family_budget_planner"] { --fff-ill-scale: .98; --fff-ill-y: -.5%; }
.fff-illustration[data-illustration="resp_education_savings"] { --fff-ill-scale: 1.04; --fff-ill-x: -1%; }
.fff-illustration--row[data-illustration="mortgage_renewal"] { --fff-ill-scale: 1; }

/* Composition uses existing card structures and typography. */
@media (min-width: 600px) {
  .home-tool-card:has(> .fff-illustration) {
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-content: normal;
    gap: 16px;
    padding: 20px;
  }
  .home-tool-card:has(> .fff-illustration) > div { min-width: 0; }
  .home-tool-card:has(> .fff-illustration) .home-tool-card__category { margin: 0 0 8px; }
  .home-tool-card:has(> .fff-illustration) h3 { margin: 0 0 8px; }
  .home-tool-card:has(> .fff-illustration) p:not(.home-tool-card__category) { margin-bottom: 0; }
  .home-tool-card:has(> .fff-illustration) > a { margin: 0; }
  .toolsx-product:has(> .fff-illustration) { padding: 20px; }
  .toolsx-product:has(> .fff-illustration) h3 { margin: 12px 0 0; }
  .toolsx-product:has(> .fff-illustration) p { margin: 8px 0 16px; }
  .homes-pathway:has(> .fff-illustration) { grid-template-columns: 72px minmax(0, 1fr); }
  .homes-product:has(> .fff-illustration),
  .inv-product-card:has(> .fff-illustration) { grid-template-columns: 72px minmax(0, 1fr); column-gap: 20px; }
  /* Insets belong to the card, so the tile and text share one composition. */
  .homes-product:has(> .fff-illustration) { padding: 32px 32px 20px; align-content: stretch; }
  .homes-product:has(> .fff-illustration) > span:last-child { display: flex; flex-direction: column; }
  .homes-product:has(> .fff-illustration) b { margin-top: auto; padding-top: 1.3rem; }
  .inv-account-card:has(> .fff-illustration) { grid-template-columns: 72px minmax(0, 1fr); }
  .inv-product-card:has(> .fff-illustration) { min-height: 220px; padding: 24px 24px 12px; }
  .inv-product-card:has(> .fff-illustration) > .inv-product-card__body { min-height: 0; padding: 0; }
}
/* Keep the existing three-column band readable before it stacks at 768px. */
@media (min-width: 769px) and (max-width: 1100px) {
  .inv-product-card:has(> .fff-illustration) { padding-inline: 12px; column-gap: 14px; }
}
@media (min-width: 600px) and (max-width: 768px) {
  .homes-product:has(> .fff-illustration) { padding: 28px 24px 24px; }
}
.home-tool-card--finances > .fff-illustration { --fff-ill-background: #e7f3f1; --fff-ill-edge: rgba(255,255,255,.32); }
.homes-pathway > .fff-illustration { grid-area: icon; align-self: start; }
.inv-pathway-card > .fff-illustration { justify-self: center; }
.learn-feature:has(> .fff-illustration) .learn-feature__topic { margin-top: 12px; }
.learn-shelf__intro > .fff-illustration + .home-eyebrow { margin-top: 16px; }
.learn-shelf__intro .learn-shelf__tool.fff-illustrated-link { margin-top: 16px; }

.fff-illustrated-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  vertical-align: middle;
}
.learn-guide-list .fff-illustrated-link { align-items: flex-start; gap: 12px; padding-block: 14px; }
.learn-guide-list .fff-illustrated-link > span:not(.fff-illustration) { flex: 1; min-width: 0; padding-top: 5px; }
.learn-guide-list .fff-illustrated-link > b { padding-top: 5px; }
.inv-learn-grid > a:has(> .fff-illustration) { grid-template-columns: 36px minmax(0, 1fr) auto; }
.inv-learn-grid > a > .fff-illustration { width: var(--fff-ill-size); height: var(--fff-ill-size); border-radius: var(--fff-ill-radius); background: var(--fff-ill-background); }

/* Existing related-tool modules become calm mini-features. */
.article-tools:has(.fff-illustrated-link) { padding: 24px; border: 1px solid #dfe9e6; border-radius: 16px; background: #f6f9f7; }
.article-tools:has(.fff-illustrated-link) > h3 { margin: 0 0 8px; }
.article-tools:has(.fff-illustrated-link) > p { margin: 0 0 16px; }
.article-tools > .fff-illustrated-link { display: flex; width: fit-content; margin: 12px 0 0; gap: 12px; }
.x1-next > .fff-illustrated-link { gap: 12px; }
/* The 32px cue occupies the former 24px glyph's flow footprint, keeping
   eyebrow wrapping, title starts and the form/result relationship unchanged. */
.x1-eyebrow > .fff-illustration--inline { --fff-ill-size: 32px; --fff-ill-radius: 8px; margin: -4px; }
.fff-overview-art { display: grid; place-items: center; background: #edf5f3; }
.fff-overview-art > .fff-illustration--feature { --fff-ill-size: 128px; --fff-ill-radius: 26px; }
.fff-decision-art { display: grid; justify-items: center; align-content: start; gap: 8px; }

@media (max-width: 820px) {
  .fff-overview-art { display: none; }
}
@media (max-width: 599px) {
  .fff-illustration--feature { --fff-ill-size: 64px; --fff-ill-radius: 16px; }
  .fff-illustration--card { --fff-ill-size: 48px; --fff-ill-radius: 12px; }
  .fff-illustration--row { --fff-ill-size: 32px; --fff-ill-radius: 8px; }
  .fff-illustration--inline { --fff-ill-size: 44px; --fff-ill-radius: 11px; }
  .home-tool-card:has(> .fff-illustration) { grid-template-columns: 48px minmax(0, 1fr) 24px; }
  .toolsx-product:has(> .fff-illustration) { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .toolsx-product > .fff-illustration { grid-area: 1 / 1 / 3 / 2; }
  .homes-product:has(> .fff-illustration) { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 20px 18px 14px; }
  .inv-product-card:has(> .fff-illustration) { grid-template-columns: 48px minmax(0, 1fr) 22px; padding: .85rem 10px .85rem 18px; }
  .inv-learn-grid > a:has(> .fff-illustration) { grid-template-columns: 32px minmax(0, 1fr) 18px; }
  .learn-guide-list .fff-illustrated-link { gap: 10px; padding-block: 12px; }
  .learn-guide-list .fff-illustrated-link > span:not(.fff-illustration),
  .learn-guide-list .fff-illustrated-link > b { padding-top: 4px; }
  .article-tools:has(.fff-illustrated-link) { padding: 20px; }
  .x1-eyebrow > .fff-illustration--inline { --fff-ill-size: 32px; --fff-ill-radius: 8px; }
}
@media (max-width: 340px) {
  .homes-product:has(> .fff-illustration) { padding-inline: 16px; }
}
