/* Article captions and document references. */
.sg-main {
    --sg-caption-color: #70757c;
    --sg-source-label: #acb0b5;
    --sg-source-size: 12.8px;
}

.sg-main figure.sg-hero-image:has(+ :is(.sg-photo-caption, .sg-cover-caption)),
.sg-main figure.wp-block-post-featured-image:has(+ :is(.sg-photo-caption, .sg-cover-caption)) {
    margin-block-end: 14px !important;
}

.sg-main figure + :is(.sg-photo-caption, .sg-cover-caption) {
    margin-block-start: 0 !important;
}

.sg-main :is(.sg-photo-caption, .sg-cover-caption),
.sg-main .wp-block-post-content figure figcaption,
.sg-main .wp-block-post-content figure figcaption.sg-article-image-credit {
    font-size: var(--sg-source-size) !important;
    line-height: 1.55 !important;
    text-align: right !important;
}

.sg-main .wp-block-post-content figure figcaption {
    margin-block-start: 5px !important;
}

.sg-main .wp-block-post-content figcaption[style*="font-size:0.85em"] {
    margin-block-start: 4px !important;
}

.sg-main .wp-block-post-content figure.sgr-test > figcaption {
    margin-block-start: 0 !important;
}

.sg-main :is(.sg-photo-caption, .sg-cover-caption, figure figcaption),
.sg-main :is(.sg-photo-caption, .sg-cover-caption, figure figcaption) a {
    color: var(--sg-caption-color) !important;
}

.sg-main .wp-block-post-content .sg-article-sources,
.sg-main .wp-block-post-content .sg-article-sources :is(ul, ol, li, p, a, strong, span),
.sg-main .wp-block-post-content :is(p, li).sg-article-image-credit,
.sg-main .wp-block-post-content :is(p, li).sg-article-image-credit :is(a, span) {
    font-size: var(--sg-source-size) !important;
    color: var(--sg-caption-color) !important;
    overflow-wrap: anywhere;
    text-align: right !important;
}

body.single-post .sg-main .wp-block-post-content .sg-article-sources :is(h2, h3, h4),
body.single-post .sg-main .wp-block-post-content p.sg-article-sources > :is(strong, .sg-article-source-label) {
    font-size: var(--sg-source-size) !important;
    color: var(--sg-source-label) !important;
    text-align: right !important;
}

.sg-main .wp-block-post-content p.sgr-source.sg-article-sources {
    --sg-source-size: 9.6px;
}

.sg-main .wp-block-post-content .sg-article-sources :is(ul, ol) {
    padding-inline-start: 0;
    list-style-position: inside;
}

.sg-main .wp-block-post-content .sg-article-sources :is(ul, ol) > li {
    padding-inline-start: 0;
}

.sg-main .wp-block-post-content .sg-article-sources ul > li::marker {
    content: "";
}

.sg-main .wp-block-post-content .sg-article-sources > p.sg-article-image-credit:last-child {
    margin-block-end: 0;
}

@media (max-width: 600px) {
    .sg-main {
        --sg-source-size: 12px;
    }
}
/* Keep captions and source links at the same reading size. */
.sg-main:has(.sgr-source.sg-article-sources):not(:has(.sg-article-sources:not(.sgr-source))) {
    --sg-source-size: 9.6px;
}

.sg-main :is(.sg-photo-caption, .sg-cover-caption) {
    margin-block-end: 28px !important;
}

.sg-main .wp-block-post-content figure:not(.sg-editorial-image, .sgr-product > figure):has(> figcaption:last-child) {
    margin-block-end: 48px !important;
}

.sg-main .wp-block-post-content figure.sg-editorial-image:has(> figcaption:last-child) {
    margin-block-end: 44px !important;
}

@media (max-width: 620px) {
    .sg-main .wp-block-post-content .sgr-product:has(> figure > figcaption:last-child) {
        row-gap: 32px !important;
    }
}

