/* Public editorial images. Branding, advertising assets and album lightboxes
   deliberately keep their own dimensions. Original uploads are never changed. */
:root {
    --fx-article-image-height: min(65vh, 560px);
}

@supports (height: 1svh) {
    :root { --fx-article-image-height: min(65svh, 560px); }
}

/* A thumbnail reserves its space before lazy loading, irrespective of whether
   the source is a portrait, landscape or a square. */
.post-item .image.ratio {
    width: min(100%, var(--fx-home-cards-width, 416px));
    aspect-ratio: var(--fx-home-cards-ratio, 416 / 260);
    height: auto;
    margin-inline: auto;
}

.post-item .image.ratio::before { display: none; }

/* Category carousels must grow with configured card ratios and their captions. */
.section-cat-slider .section-content { height: auto; }

.post-item .image > a,
.post-item-small .image > a {
    display: block;
    width: 100%;
    height: 100%;
}

.post-item .image img,
.post-item-small .image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Small frames use proportional sizing even in narrow sidebars. Footer and
   sidebar are separate controls; no generic image rule reaches logos or ads. */
.col-sidebar .post-item-small .image {
    width: var(--fx-home-sidebar-width, 112px);
    max-width: 40%;
    height: auto;
    aspect-ratio: var(--fx-home-sidebar-ratio, 112 / 80);
    align-self: flex-start;
}
.footer-widget .footer-posts .post-item-small .image {
    width: var(--fx-home-footer-width, 96px);
    max-width: 40%;
    height: auto;
    aspect-ratio: var(--fx-home-footer-ratio, 96 / 68);
    align-self: flex-start;
}

.section-cat-block-1 .post-item-vr {
    width: min(100%, var(--fx-home-spotlight-width, 306px));
    height: auto;
    aspect-ratio: var(--fx-home-spotlight-ratio, 306 / 230);
    margin-inline: auto;
    background-color: var(--fx-gray-800, #343a40);
}
.section-cat-block-1 .post-item-vr .image {
    aspect-ratio: var(--fx-home-spotlight-ratio, 306 / 230);
    height: auto;
}
.section-cat-block-1 .post-item-vr .image > a {
    position: absolute;
    inset: 0;
}

/* Home hero height follows the available width instead of the source image.
   The featured-section-single marker is set when there is no side column. */
.featured-section { --fs-height-desktop: var(--fx-home-hero-height, 360px); }
.featured-section .fs-grid-wrapper {
    width: min(100%, var(--fx-home-hero-width, 960px));
    margin-inline: auto;
}
.featured-section .fs-grid-item,
.featured-section .main-slider-wrapper,
.featured-section .main-slider { min-width: 0; }
.featured-section .fs-img { object-fit: cover; object-position: center; }

.featured-section .sub-grid > .fs-card:only-child,
.featured-section-news .area-right > .fs-card:only-child { grid-column: 1 / -1; }

@media (min-width: 992px) {
    .featured-section.featured-section-no-bottom:not(.featured-section-single):not(.featured-section-news) .fs-grid-wrapper {
        grid-template-rows: minmax(0, 1fr);
        grid-template-areas: "main sub-top";
    }
    .featured-section-news.featured-section-no-headlines:not(.featured-section-single) .fs-grid-wrapper {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        grid-template-areas: "main sub-top" "main sub-bottom";
    }
}

@media (max-width: 991.98px) {
    .featured-section.featured-section-no-bottom:not(.featured-section-single):not(.featured-section-news) .fs-grid-wrapper {
        grid-template-areas: "main" "sub-top";
    }
    .featured-section-news.featured-section-no-headlines:not(.featured-section-single) .fs-grid-wrapper {
        grid-template-areas: "main" "right";
    }
}

.featured-section.featured-section-single .fs-grid-wrapper {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "main";
    width: min(100%, var(--fx-home-hero-width, 960px));
    height: var(--fx-home-hero-height, 360px);
    max-height: none;
    aspect-ratio: auto;
    margin-inline: auto;
}
.featured-section.featured-section-single .area-main {
    aspect-ratio: auto;
    min-height: 0;
}

@media (max-width: 991.98px) {
    .featured-section.featured-section-single .fs-grid-wrapper {
        height: var(--fx-home-hero-mobile-height, 240px);
        min-height: 0;
    }
    .featured-section .area-main,
    .featured-section-news .area-main,
    .featured-section.featured-section-single .area-main {
        height: var(--fx-home-hero-mobile-height, 240px);
        aspect-ratio: auto;
        min-height: 0;
        max-height: none;
    }
    .featured-section .area-sub-top,
    .featured-section .area-sub-bottom,
    .featured-section-news .area-right {
        height: auto;
        min-height: 0;
        max-height: var(--fx-home-hero-mobile-height, 240px);
        aspect-ratio: 2 / 1;
    }
    .featured-section .sub-grid {
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
    }
}

/* Article photos show the whole image, at most their natural dimensions.
   Numeric HTML width/height hints and old full-column inline styles must not
   stretch portraits. Explicit sizes chosen in the editor have separate rules. */
.post-image-preview,
.post-image-preview > .d-block,
.post-image-preview .post-detail-slider {
    width: 100%;
    min-width: 0;
}

.post-image-preview img,
.post-image-inner > img,
.entry-content img:not(.fx-image-sized):not(.container-bn img):not(.fx-complaint-attachments img) {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: var(--fx-article-image-height) !important;
    object-fit: contain;
    margin-inline: auto;
}

.entry-content img:not(.fx-image-sized):not(.container-bn img):not(.fx-complaint-attachments img) {
    max-width: min(100%, 720px) !important;
}

.post-image-preview .swiper-slide { min-width: 0; }
.post-image-preview .post-detail-slider-nav {
    right: auto;
    inset-inline-end: 1rem;
}

.fx-complaint-attachments img {
    display: block;
    height: auto;
    margin-inline: auto;
}
