/* 
 ---------------------------------
 |   LAST UPDATED: 2026-04-13    |
 ---------------------------------
 */

/* VIEWPORT HEADNOTE: Standard boundaries 1024, 768–1023, <768. No other width bands are used here. */

/* OWNER: post image flow and captions. Keep parse-safe and flow-only. */

/* ==========================================================================
   FEATURE IMAGE (Ghost feature_image in post header)
   ==========================================================================
   The feature image stays above the article body in the header. The article
   body itself remains in normal document flow on every breakpoint.
   ========================================================================== */

.post-main-image .post-feature-image-frame {
    border-top: 1px solid var(--text-color);
    /* border-bottom: 1px solid var(--text-color); */
    width: 100%;
}

.post-main-image .post-feature-image {
    width: 100%;
    height: auto;
}

.post-main-image figcaption {
    font-size: var(--fontSizeBlog);
    line-height: 1.25;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    text-align: left;
    padding-left: 1rem;
}

.post-header .post-main-image {
    flex-shrink: 0;
    max-width: min(55%, 720px);
}

.post-header .post-main-image .post-feature-image {
    width: 100%;
    height: auto;
}

/* ==========================================================================
   INLINE / FIGURE IMAGES
   ==========================================================================
   Images stay in .post-content and use normal flow rules. Figure-wrapped images
   fill the content width; bare inline images keep their inline behavior.
   ========================================================================== */

.post-content figure,
.post-content figure.image-with-caption,
.post-content figure.kg-card.kg-image-card {
    display: block;
    width: fit-content;
    max-width: 100vw;
    margin: 0 0 1.5em;
}

.post-content figure > img,
.post-content figure.image-with-caption > img,
.post-content figure.kg-card.kg-image-card > img {
    display: block;
    width: auto;
    max-width: 90vw;
    height: auto;
    object-fit: contain;
}

/* Author avatars in .excerpt-and-metadata: do not inherit body img rules (contain + auto dims
   caused load-dependent sizing inside the circular .post-author-image clip). */
.post-content .post-author-image img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Override global `p img { max-width: 100% }` so body images can use viewport width */
.post-content p img {
    max-width: 100vw;
    width: auto;
}

/* kg.css loads after post-image.css; keep Koenig card imgs viewport-bound when not full-bleed */
.post-content .kg-image-card:not(.kg-width-full) img {
    max-width: 100vw;
}

/* Caption styling - applies to all captioned images */
.post-content .image-with-caption figcaption,
.post-content > figure.image-with-caption > figcaption,
.post-content figure.image-with-caption > figcaption,
.post-content .image-with-caption > figcaption,
.post-content > figure.kg-card.kg-image-card > figcaption,
.post-content figure.kg-card.kg-image-card > figcaption {
    font-family: var(--etm) !important;
    font-style: italic !important;
    font-size: inherit;
    color: color-mix(in srgb, var(--text-color) 90%, white 10%) !important;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
    line-height: 1.25 !important;
    text-align: left;
    padding-left: 2rem;
    width: 100% !important;
    display: inline-block !important;
}

/* ==========================================================================
   1024px+ DESKTOP
   ========================================================================== */

/* Tablet + desktop (≥768px): cap inline/article images at 800px tall (ISSUES-LIST posts **images**). */
@media (min-width: 768px) {
    .post-content figure,
    .post-content figure.image-with-caption,
    .post-content figure.kg-card.kg-image-card {
        margin: 0 0 1.5em;
    }

    .post-content figure > img,
    .post-content figure.image-with-caption > img,
    .post-content figure.kg-card.kg-image-card > img {
        max-height: 800px;
    }

    .post-content img {
        max-height: 800px;
    }
}

@media (min-width: 1024px) {
    .post-content figure,
    .post-content figure.image-with-caption,
    .post-content figure.kg-card.kg-image-card {
        margin: 0 0 1.75em;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .post-header .post-main-image {
        max-width: 100%;
        margin-bottom: calc(1em * var(--scale));
    }

    .post-main-image .post-feature-image {
        max-height: min(75vh, 600px);
        object-fit: contain;
    }
}

/* ==========================================================================
   <768px MOBILE
   ========================================================================== */

@media (max-width: 767px) {
    .post-header .post-main-image {
        max-width: 100%;
        margin-bottom: calc(1em * var(--scale));
    }

    .post-main-image .post-feature-image {
        max-height: min(75vh, 480px);
        object-fit: contain;
    }

    .post-content figure,
    .post-content figure.image-with-caption,
    .post-content figure.kg-card.kg-image-card {
        margin: 0 0 1.25em;
    }

    .post-content figure > img,
    .post-content figure.image-with-caption > img,
    .post-content figure.kg-card.kg-image-card > img {
        max-height: 600px;
    }

    .post-content img {
        max-height: 600px;
    }
}

/* ISSUES-LIST posts: float figures right >768px; cap width to 70vw; no upscaling; caption 1rem padding-left. */
@media (min-width: 769px) {
    .post-content .footnotes-container figure,
    .post-content section.footnotes figure {
        float: none;
        clear: both;
        max-width: 100%;
        width: auto;
        margin-left: 0;
        margin-right: 0;
    }

    .post-content figure:not(.kg-width-full) {
        float: right;
        clear: right;
        margin: 0 -2rem 1.5em 1.25em;
        max-width: min(65vw, 100%);
        width: fit-content;
        display: block;
    }

    .post-content figure:not(.kg-width-full) > img {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 800px;
        object-fit: contain;
    }

    .post-content figure:not(.kg-width-full) figcaption,
    .post-content figure:not(.kg-width-full) > figcaption {
        text-align: left !important;
        padding-left: 1rem !important;
        display: block !important;
        width: 100%;
        box-sizing: border-box;
    }
}
