/* Anchor cropped reporting photographs at the top of the source image. */
#main .front-edition :is(.justice-grid, .coverage-lead, .conflict-lead, .bantaba-grid) img,
.jfj-inner #main :is(.category-lead-image, .story-image, .person-card) img {
    object-fit: cover;
    object-position: center top;
}

/* Preserve the full lead artwork, inline exhibits, portraits and report pages. */
#main .front-edition .front-track .front-hero-photo img,
#main .front-edition .publication-shelf-cover img,
.jfj-inner #main :is(.article-lead-image, .article-body, .publication-reader, .person-profile) img,
.jfj-inner #main .category-lead-image img.publication-image,
.jfj-inner #main .category-grid .story-image img.publication-image {
    object-fit: contain;
    object-position: center top;
}

.jfj-inner #main img.publication-image {
    background-color: #f6f5f1;
}

.jfj-home .nav-brand-home img {
    object-fit: contain;
}

/* Keep the caption on the page beneath the image, including carousel slides. */
.jfj-home #main figcaption.photo-caption {
    display: block;
    padding: .45rem 0 .3rem;
    max-inline-size: 100%;
    margin: 0;
    background: transparent;
    color: #4c504e;
    font: italic .875rem/1.5 var(--editorial-sans);
    text-align: left;
    overflow-wrap: anywhere;
}
.jfj-home #main figcaption.photo-caption > span { display: block; margin: 0; font: inherit; }
.jfj-home #main figcaption.photo-caption .photo-credit {
    display: block;
    color: #525753;
    font-size: .8125rem;
}
#main .front-edition .front-hero-photo > a,
#main .front-edition .coverage-lead > a:has(img) {
    display: block;
}
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) {
    #main .front-track .front-hero-photo .photo-caption { padding-inline: var(--gutter); }
}

.jfj-inner #main :is(.article-body, .publication-reader .story-body) .story-photo {
    display: block;
    clear: both;
    float: none;
    inline-size: fit-content;
    max-inline-size: min(100%, 46rem, var(--photo-width, 100%));
    margin: clamp(1.25rem, 3vw, 2rem) auto;
}
.jfj-inner #main :is(.article-body, .publication-reader .story-body) .story-photo-portrait {
    max-inline-size: min(100%, var(--photo-width), 35rem, calc(76svh * var(--photo-ratio)));
}
.jfj-inner #main .story-photo > a { display: block; }
.jfj-inner #main .story-photo img {
    display: block;
    float: none;
    width: auto;
    max-width: 100%;
    height: auto;
    aspect-ratio: auto;
    margin: 0 auto;
}

/* Reserve the photo's real proportions before a lazy image below the fold has loaded. */
.jfj-inner #main :is(.article-body, .publication-reader .story-body) .story-photo:has(img[width][height]) {
    inline-size: var(--photo-width);
}
.jfj-inner #main .story-photo img[width][height] {
    width: 100%;
    aspect-ratio: auto var(--photo-ratio);
}
