/* Editorial accents only: do not override REHub navigation, logo, header or footer colors. */
body.aotw-wildlife-surface {
    --aotw-green: #356746;
    --aotw-green-dark: #245034;
    --aotw-border: #dce7d9;
    --aotw-background-image: url('botanical.svg');
    --aotw-background-size: 440px 440px;
    --aotw-background-repeat: repeat;
}
/* Background is limited to the content surface, rather than the entire body/header. */
body.aotw-wildlife-surface:not(.dark_body):not(.aotw-no-pattern) .rh-outer-wrap > .rh-container:has(> .rh-content-wrap) {
    background-color: #f4f7f1;
    background-image: var(--aotw-background-image);
    background-size: var(--aotw-background-size);
    background-repeat: var(--aotw-background-repeat);
    background-position: center top;
}
/* Article card: deliberately preserve a clean reading surface. */
body.aotw-editorial:not(.dark_body) .main-side.single > .rh-post-wrapper {
    --aotw-bleed: 25px;
    background: #fff;
    border: 1px solid var(--aotw-border);
    padding: 25px;
    box-shadow: 0 2px 12px rgba(29,60,36,.045);
    overflow: visible;
}
body.aotw-editorial .main-side.single { --aotw-bleed: 0px; }
body.aotw-editorial .main-side.single.post-readopt { --aotw-bleed: 0px; }
body.aotw-editorial:not(.dark_body) .main-side.single.post-readopt { background-color: #fff; }
/* Only the primary article title, not titles over photos or menu labels. */
body.aotw-editorial:not(.dark_body) .main-side.single .title_single_area h1,
body.aotw-editorial:not(.dark_body) #rh_p_l_fullwidth_opt .title_single_area h1 {
    color: #151815 !important;
}
body.aotw-editorial:not(.dark_body) .main-side.single #rh_post_layout_inimage .title_single_area h1 { color: #fff !important; }
/* Standalone photos and galleries: expand from the text column to the article edge.
   Do not target images in custom cards, shortcodes, float-aligned blocks or nested layouts. */
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > :is(figure.top_featured_image, .wp-block-image, .wp-block-gallery, figure.gallery, div.gallery):not(.alignleft):not(.alignright):not(.alignfull):not(.is-resized):not(.size-thumbnail):not(.size-medium) {
    width: calc(100% + 2 * var(--aotw-bleed, 0px)) !important;
    max-width: none !important;
    margin-inline: calc(-1 * var(--aotw-bleed, 0px)) !important;
}
/* REHub's own alignfull JS is retained for reading layouts; only override default wrapper. */
body.aotw-editorial .rh-post-wrapper article.post > :is(.wp-block-image, .wp-block-gallery, .wp-block-columns).alignfull,
body.aotw-editorial .rh-post-wrapper article.post > :is(.wp-block-image, .wp-block-gallery, .wp-block-columns).alignwide {
    width: calc(100% + 2 * var(--aotw-bleed, 0px)) !important;
    max-width: none !important;
    margin-inline: calc(-1 * var(--aotw-bleed, 0px)) !important;
}
/* Images preserve their natural proportions. Transparent illustrations nested in widgets are untouched. */
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > figure.top_featured_image img,
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > .wp-block-image:not(.alignleft):not(.alignright):not(.is-resized):not(.size-thumbnail):not(.size-medium) img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 0;
}
/* The two-photo layout expands as a single unit, with the columns still paired on mobile. */
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > .wp-block-columns:has(> .wp-block-column:nth-child(2)):not(:has(> .wp-block-column:nth-child(3))):has(> .wp-block-column:first-child > .wp-block-image):has(> .wp-block-column:nth-child(2) > .wp-block-image):not(:has(> .wp-block-column > :not(.wp-block-image))) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
    width: calc(100% + 2 * var(--aotw-bleed, 0px)) !important;
    max-width: none !important;
    margin-inline: calc(-1 * var(--aotw-bleed, 0px)) !important;
    align-items: start !important;
}
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > .wp-block-columns:has(> .wp-block-column:nth-child(2)):not(:has(> .wp-block-column:nth-child(3))):has(> .wp-block-column:first-child > .wp-block-image):has(> .wp-block-column:nth-child(2) > .wp-block-image):not(:has(> .wp-block-column > :not(.wp-block-image))) > .wp-block-column {
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
}
body.aotw-editorial .main-side.single .wp-block-columns > .wp-block-column > .wp-block-image { max-width: 100%; }
body.aotw-editorial .main-side.single .wp-block-columns > .wp-block-column > .wp-block-image:not(.is-resized) img { max-width: 100%; height: auto; }
/* Let Gutenberg retain gallery cropping, image counts, links and lightbox behavior. */
body.aotw-editorial .main-side.single .wp-block-gallery { --wp--style--unstable-gallery-gap: 10px; }
body.aotw-editorial .main-side.single :is(.wp-block-image, .wp-block-gallery, figure.top_featured_image) > figcaption {
    color: #526158;
    font-size: 14px;
    line-height: 1.5;
    margin: 9px 12px 16px;
    text-align: center;
}
/* Green underlines on editorial text links only, never buttons, badges or menu links. */
body.aotw-editorial:not(.dark_body) .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > :is(p, ul.wp-block-list, ol.wp-block-list) a:not([class]) {
    color: var(--aotw-green-dark) !important;
    text-decoration: underline !important;
    text-decoration-color: #91b49b !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 3px;
}
body.aotw-editorial:not(.dark_body) .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > :is(p, ul.wp-block-list, ol.wp-block-list) a:not([class]):hover { text-decoration-color: var(--aotw-green-dark) !important; }
body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > hr.wp-block-separator:not(.is-style-dots) { border-color: var(--aotw-border); }
/* Mobile: container removes its 15px padding; text gets a 16px inset, media reaches both edges. */
@media (max-width: 767px) {
    body.aotw-editorial:not(.dark_body) .rh-outer-wrap > .rh-container:has(> .rh-content-wrap > .main-side.single > .rh-post-wrapper) {
        padding-inline: 0 !important;
    }
    body.aotw-editorial:not(.dark_body) .main-side.single > .rh-post-wrapper {
        --aotw-bleed: 16px;
        padding: 18px 16px !important;
        border: 0;
        box-shadow: none;
    }
    body.aotw-editorial:not(.dark_body) .rh-content-wrap > .sidebar { padding-inline: 15px; }
    body.aotw-editorial .main-side.single.post-readopt { --aotw-bleed: 15px; }
    body.aotw-editorial .main-side.single .wp-block-gallery { --wp--style--unstable-gallery-gap: 6px; }
    body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > .wp-block-columns:has(> .wp-block-column:nth-child(2)):not(:has(> .wp-block-column:nth-child(3))):has(> .wp-block-column:first-child > .wp-block-image):has(> .wp-block-column:nth-child(2) > .wp-block-image):not(:has(> .wp-block-column > :not(.wp-block-image))) { gap: 6px !important; }
    body.aotw-editorial .main-side.single :is(article.post, .post-inner, .post-inner-wrapper) > figure.top_featured_image { margin-bottom: 24px; }
}
/* Thin, non-interactive reading progress, only added by the child on posts. */
#aotw-reading-progress { position: fixed; z-index: 99999; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; background: transparent; }
#aotw-reading-progress > span { display: block; width: 100%; height: 100%; background: #477b51; transform: scaleX(0); transform-origin: left center; }
body.rtl #aotw-reading-progress > span { transform-origin: right center; }
body.admin-bar #aotw-reading-progress { top: 32px; }
@media (max-width: 782px) { body.admin-bar #aotw-reading-progress { top: 46px; } }
@media (max-width: 600px) { body.admin-bar #aotw-reading-progress { top: 0; } }
body.aotw-progress-active .rh-progress-bar { display: none !important; }
