/* Footer styles: red background, white text, darker yellow link */
.site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #a60000;
    color: #fff;
    height: 30px; /* reduced ~40% from 48px */
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
    z-index: 9999;
    white-space: nowrap;
    overflow: hidden;
}

/* Footer background image shown as an inline image so the full picture is
   always visible and scales with the browser width. */
/* Desktop: CSS-based parallax using `background-attachment: fixed`.
   `background-size: contain` ensures the entire image fits within the container.
   Height is set in viewport units to present the full image area; adjust if needed. */
.site-footer-bg {
    display: block;
    width: 100%;
    height: auto;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: #ceae21; /* darker yellow */
    font-weight: bold;
}

.site-footer a:hover {
    color: #222;
    text-decoration: underline;
}

/* Footer image wrap: align image start with main/article content (same horizontal padding)
   and limit the image width to a 4:3-based maximum to avoid overly wide images on
   very wide screens. */
.footer-image-wrap {
    padding: 0 20px; /* same horizontal spacing as main/article */
    box-sizing: border-box;
    max-width: min(1200px, calc((4/3) * 100vh));
    margin-left: auto;
    margin-right: auto;
}

.footer-image-wrap .site-footer-bg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0; /* left-aligned within the padded wrapper */
}

/* Constrain footer text so it lines up with main content width */
.site-footer p {
    max-width: min(1200px, calc((4/3) * 100vh));
    margin: 0 auto;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    padding: 0 12px; /* keep same internal padding */
    font-size: 12px; /* fixed small size to avoid sudden wrapping */
    line-height: 30px; /* vertically center within fixed footer height */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Small-screen responsive adjustments: reduce footer height and make image edge-to-edge */
@media (max-width: 700px) {
    /* Keep footer height fixed on small screens to avoid layout jumps
       caused by occasional font-size adjustments. */
    .site-footer {
        height: 30px;
        padding: 0 8px;
        width: 100vw;
        box-sizing: border-box;
        padding-left: calc(8px + env(safe-area-inset-left));
        padding-right: calc(8px + env(safe-area-inset-right));
        justify-content: center;
    }

    .site-footer p {
        font-size: 11px;
        line-height: 30px;
        padding: 0 8px;
    }

    .site-footer a {
        display: inline;
    }

    /* Footer image spans full viewport width on phones */
    .footer-image-wrap {
        padding: 0; /* remove side padding so image reaches edges */
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .footer-image-wrap .site-footer-bg {
        width: 100vw; /* full viewport width */
        max-width: 100vw;
        margin-left: calc((100% - 100vw) / 2); /* visually center the full-width image */
        height: auto;
        display: block;
    }
}

/* Mobile landscape: make footer background image match main content width
   (account for safe-area insets and camera cutout) so it doesn't shrink due
   to the short viewport height in landscape. */
@media (orientation: landscape) and (max-height: 700px) {
    .footer-image-wrap {
        max-width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right));
        margin-left: auto;
        margin-right: auto;
        padding: 0;
        box-sizing: border-box;
    }

    .footer-image-wrap .site-footer-bg {
        width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right));
        max-width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right));
        height: auto;
        display: block;
        margin: 0;
    }
}
