/*
 * Banner Parallax Styles
 * Issue #547: Site Style Enhancements
 *
 * Features:
 * - Full-width banner images with parallax scrolling effect
 * - Automatic text contrast based on image brightness
 * - Responsive sizing for mobile devices
 * - Gradient overlay for text readability
 *
 * IMPORTANT: After modifying this file, run `python manage.py collectstatic`
 * CSS changes are NOT visible until collected!
 */

/* ==========================================================================
   BANNER CONTAINER
   ========================================================================== */

.page-banner {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    height: 300px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    /* Extra height for parallax movement */
    /* Issue #570: Changed from 'cover' to 'contain' to show full banner image without cropping
     * cover = fills container but crops image to fit aspect ratio (zooms in)
     * contain = shows full image, may leave empty space but no cropping
     * This ensures user's carefully composed banner images are fully visible.
     */
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    /* Use scroll instead of fixed to prevent cropping issues.
     * background-attachment: fixed positions the image relative to the viewport,
     * which causes background-size: cover to scale based on viewport dimensions
     * rather than the banner element, resulting in only showing the top-left corner.
     *
     * For parallax effect, we use a JavaScript-based transform instead (see banner-brightness-detection.js),
     * which handles both brightness detection and parallax. This provides better cross-browser compatibility
     * and correct image scaling.
     */
    background-attachment: scroll;
    z-index: 1;
    /* Enable smooth parallax via JavaScript transform */
    will-change: transform;
}

/* Respect user's motion preferences - disable parallax for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .page-banner-image {
        background-attachment: scroll;
    }
}

/* Gradient overlay for text readability */
.page-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.3) 0%,
            rgba(0, 0, 0, 0.5) 50%,
            rgba(0, 0, 0, 0.3) 100%);
    z-index: 2;
}

/* Banner content (title) */
.page-banner-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 1rem 2rem;
    max-width: 90%;
}

.page-banner-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #fff;
    /* Default to white, will be overridden by auto-contrast */
}

/* Auto-contrast classes set by JavaScript */
.page-banner.light-text .page-banner-title {
    color: #fff;
}

.page-banner.dark-text .page-banner-title {
    color: #212529;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.page-banner.dark-text .page-banner-overlay {
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0.2) 100%);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 991.98px) {
    .page-banner {
        height: 200px;
    }

    .page-banner-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 575.98px) {
    .page-banner {
        height: 150px;
    }

    .page-banner-title {
        font-size: 1.5rem;
    }

    .page-banner-content {
        padding: 0.5rem 1rem;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .page-banner {
        display: none;
    }
}
