/* PHOTO -> IMPACT STORY LINKS (inc/cae-render-links.php, cae_story_photo_link; PM photo rule 2026-11-29).
 * A business or farm photo with an Impact Story is wrapped in a.cae-story-photo-link. The link takes the place the photo had
 * in its box so the look does not change; the photo inside keeps its own rules. Enqueued only on a page that prints one. */

a.cae-story-photo-link { display: block; color: inherit; text-decoration: none; }

/* FFBR Clients card logo box: the link fills the box; the logo inside keeps the box rules of
 * kate-global-rules-cae.css ("[data-cae-prod-text] > div:first-child > figure > img.cae-recgrid-prod__logo"), restated for
 * the logo one level down. */
[data-cae-prod-card="client"] > div:first-child > figure > a.cae-story-photo-link { width: 100%; height: 100%; }
[data-cae-prod-card="client"] > div:first-child > figure > a.cae-story-photo-link > img.cae-recgrid-prod__logo { box-sizing: border-box; display: block; width: 100% !important; height: 100% !important; max-width: none !important; padding: 12px !important; object-fit: contain !important; object-position: center; background: #fff; }

/* FFBR Farm / Food Business Advising photo postcards (.cae-fba-pc .fh-pc, a flex column: photo, caption, credit): the link
 * is the flex item the photo was (fix-ffbrfarm-cae.css / fix-ffbrfood-cae.css: grow into the card's height, 10 px under
 * it); the photo fills the link. The card itself still opens the photo pop-up from its caption, magnifier and keyboard. */
body .cae-fba-pc .fh-pc > a.cae-story-photo-link { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; width: 100%; margin: 0 0 10px; }
body .cae-fba-pc .fh-pc > a.cae-story-photo-link > img.fh-pc__img { flex: 1 1 0; min-height: 0; margin: 0; }
@media (max-width: 599.98px) {
  /* stacked: the photo keeps its natural proportions (the page sheets set it flex: none; height: auto) */
  body .cae-fba-pc .fh-pc > a.cae-story-photo-link { flex: none; display: block; }
  body .cae-fba-pc .fh-pc > a.cae-story-photo-link > img.fh-pc__img { flex: none; }
}

/* jz22 (PM photo rule sitewide, 2026-11-30): rules the theme writes for a photo as the direct child of its box, restated for the
 * photo one level down inside its story link (each measured as lost by the wrap; the link fills the box the photo filled). */
/* VFVC landing, Barred Woods photo box */
body.cae-page--cae-flow-programs-services-vfvc-landingpage .cae-website-redesign-cae-flow-programs-services-vfvc-landingpage-frame-1261152270-generic__media-figma-image-14258-14702 > a.cae-story-photo-link { width: 100%; height: 100%; }
body.cae-page--cae-flow-programs-services-vfvc-landingpage .cae-website-redesign-cae-flow-programs-services-vfvc-landingpage-frame-1261152270-generic__media-figma-image-14258-14702 > a.cae-story-photo-link > img { width: 100%; height: 100%; object-fit: cover; }
/* Subscribe side photo (scale layer) */
body.cae-page--cae-flow-subscribe-form .wp-block-cae-website-redesign-cae-flow-subscribe-form-cae-subscribe-image01 > [class*="__scale-layer"] > a.cae-story-photo-link { width: 100%; height: 100%; }
body.cae-page--cae-flow-subscribe-form .wp-block-cae-website-redesign-cae-flow-subscribe-form-cae-subscribe-image01 > [class*="__scale-layer"] > a.cae-story-photo-link > img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center center; }
/* Farm Connex Our Producers + FFBR Clients card logo box */
body:is(.cae-page--cae-flow-programs-services-farmconnex-ourproducers, .cae-page--cae-flow-programs-services-ffbr-services-clients) [data-cae-prod-text] > div:first-child > figure > a.cae-story-photo-link { width: 100%; height: 100%; }
body:is(.cae-page--cae-flow-programs-services-farmconnex-ourproducers, .cae-page--cae-flow-programs-services-ffbr-services-clients) [data-cae-prod-text] > div:first-child > figure > a.cae-story-photo-link > img.cae-recgrid-prod__logo { box-sizing: border-box; display: block; object-position: center center; background: rgb(255, 255, 255); width: 100% !important; height: 100% !important; max-width: none !important; padding: 12px !important; object-fit: contain !important; }
/* generic card media boxes (Just Cut partner cards), tablet and phone */
@media (max-width: 1023.98px) {
  .wp-site-blocks:not(#cae-m) [class*="-generic__card-"] > [class*="-generic__media-"] > a.cae-story-photo-link > img { max-width: stretch; }
}
/* records-grid card photo box (Our Borrowers): the figure stays the positioning box for its credit pill */
figure:has(> a.cae-story-photo-link > img.cae-recgrid__photo) { position: relative; }
/* Photo Postcard frame (photo-postcard-cae.js moves the story link into .cae-jcf-pc__photo with its photo): the link takes the
 * place of the photo; the photo keeps the postcard's fill (fixed-ratio cards) or natural-height (float intro postcards) rule. */
body figure.cae-postcard.cae-jcf-pc > .cae-jcf-pc__photo > a.cae-story-photo-link { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
body figure.cae-postcard.cae-jcf-pc > .cae-jcf-pc__photo > a.cae-story-photo-link > img { position: absolute; inset: 0px; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
body figure.cae-postcard.cae-postcard--float.cae-jcf-pc > .cae-jcf-pc__photo > a.cae-story-photo-link { position: static; display: block; width: 100%; height: auto; }
body figure.cae-postcard.cae-postcard--float.cae-jcf-pc > .cae-jcf-pc__photo > a.cae-story-photo-link > img,
body figure.cae-postcard.cae-postcard--float.cae-jcf-pc > .cae-jcf-pc__photo > a.cae-story-photo-link > picture > img { position: static; display: block; width: 100%; height: auto; max-height: none; aspect-ratio: auto; object-fit: contain; }
/* a photo link is not text: the phone text-width cap on links inside Figma sections does not apply to it */
.wp-site-blocks a.cae-story-photo-link:not(#cae-spl) { max-width: none !important; }
/* a photo link is clickable wherever it sits: bands and accordion rows that make their photos pointer-transparent
 * (pointer-events: none: the Subscribe side band at desktop, the Ways to Give accordion rows) take clicks on the link again */
.wp-site-blocks a.cae-story-photo-link[href]:not(#cae-spl),
.wp-site-blocks a.cae-story-photo-link[href]:not(#cae-spl) > img { pointer-events: auto !important; }
/* a fixed-height figure whose photo filled it (height: 100%, the borrower cards, Ways to Give, ...): the link fills it in the
 * photo's place, so the photo's 100% still resolves against the figure (an auto figure leaves this auto) */
figure > a.cae-story-photo-link { height: 100%; }
