/* 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 {
    aspect-ratio: 16 / 10;
    --bs-aspect-ratio: 62.5%;
    height: auto;
}

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

.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;
}

/* The former fixed 340px portrait block was taller than adjacent cards.
   Keep its overlay layout, but give every item the same landscape frame. */
.section-cat-block-1 .post-item-vr {
    height: auto;
    aspect-ratio: 4 / 3;
    background-color: var(--fx-gray-800, #343a40);
}
.section-cat-block-1 .post-item-vr .image {
    aspect-ratio: 4 / 3;
    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: clamp(320px, 38vw, 480px); }
.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%, 960px);
    height: auto;
    max-height: 480px;
    aspect-ratio: 16 / 9;
    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 { min-height: 240px; }
    .featured-section .area-main,
    .featured-section-news .area-main {
        aspect-ratio: 16 / 10;
        min-height: 240px;
        max-height: 480px;
    }
}

/* 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;
}
