/* ===========================================================
   MODULE: PARALLAX DIVIDER
   Full-bleed decorative image band with parallax effect
   =========================================================== */

/*
Structure rendered by parallax-divider.php:

<section class="atx-parallax-divider"
         style="--pd-height-mobile:30vh; --pd-height-desktop:50vh;"
         data-shift="200"
         data-nudge="-20px">
    <div class="atx-parallax-divider__bg"
         style="background-image:url('...'); --pd-initial-nudge:-20px;">
    </div>
</section>

JS (parallax-divider.js) will:
 - read data-shift and data-nudge
 - update --pd-shift on scroll for each instance
 - apply a base offset (nudge) to hide black edges
*/

/* ==============
   Wrapper
   ==============

   - full-bleed 100vw band that escapes the theme's content container
   - fixed height from inline CSS vars
*/
.atx-parallax-divider {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);

    overflow: hidden;   /* hide bg overscan */
    isolation: isolate;

    /* mobile/default height */
    height: var(--pd-height-mobile, 30vh);
    min-height: var(--pd-height-mobile, 30vh);

    /* fallback bg to avoid flashing page bg while image loads */
    background-color: var(--are-black);
}

@media (min-width: 768px) { /* matches --bp-md */
    .atx-parallax-divider {
        height: var(--pd-height-desktop, 50vh);
        min-height: var(--pd-height-desktop, 50vh);
    }
}

/* if config wasn't loaded, PHP will output .atx-parallax-divider--error */
.atx-parallax-divider--error {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: 20vh;
    font-size: 0.875rem;
    font-family: var(--font-body-family);
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==============
   Background layer
   ==============

   We oversize it vertically using negative inset values. The extra bleed
   lets the image move under parallax without exposing black edges.

   Mobile/tablet: less bleed
   Desktop: more bleed
*/
.atx-parallax-divider__bg {
    position: absolute;

    /* bleed so the image can move without showing gaps */
    inset: -20vh 0;

    /* only the image for this screen width is downloaded */
    background-image: var(--pd-image-mobile, var(--pd-image));
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;

    will-change: transform;

    /*
     * --pd-shift is updated by JS on scroll.
     * --pd-initial-nudge is set inline by PHP (same as data-nudge).
     * We add them together.
     *
     * calc() note:
     *   translateY(calc(A + B)) is supported in modern browsers.
     */
    transform: translateY(calc(var(--pd-shift, 0px) + var(--pd-initial-nudge, 0px)));
}

@media (min-width: 768px) { /* matches --bp-md */
    .atx-parallax-divider__bg {
        inset: -25vh 0; /* more bleed on desktop for stronger parallax motion */
        background-image: var(--pd-image);
    }
}

/* ==============
   Optional overlay content (not currently used, but kept for future)
   ==============

   If we later want text over the divider, we can render .atx-parallax-divider__inner
   inside <section>. This sits above the bg.
*/
.atx-parallax-divider__inner {
    position: relative;
    z-index: 2;
    color: #fff;
    text-align: center;
    padding: var(--pd-content-pad-block, var(--gap-lg)) var(--wrap-pad-x);
    font-family: inherit;
}

.atx-parallax-divider__title {
    font-size: clamp(1.25rem, 1vw + 1rem, 2rem);
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 4px 16px rgba(0,0,0,0.6);
    margin: 0;
}

.atx-parallax-divider__subtitle {
    margin-top: 0.5rem;
    font-size: clamp(0.9rem, 0.4vw + 0.8rem, 1.125rem);
    line-height: 1.4;
    font-weight: 400;
    text-shadow: 0 3px 12px rgba(0,0,0,0.6);
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
}
