/* Chapter art for Scripture pages.
   Wide screens: images flank the reading column, fading into the dark.
   Phones/tablets: flanks hide; the same images appear inline after their verse.
   Used by faith/scripture/<book>/<n>.html pages built with
   tools/add_chapter_art.py. Decorative only: never God's face. */

.ch-flank, .ch-flank-tag { display: none; }
.ch-art-inline { display: block; }

@media (min-width: 1200px) {
    /* Each flank takes the shape of a tall (9:16) picture, sized to the screen height,
       and sits right beside the reading column with a small gap. */
    .ch-flank {
        --ch-w: min(620px,
                    calc((100vw - var(--ch-col, 42rem)) / 2 - 1.5rem),
                    calc((100vh - 150px) * 0.5625));
        display: block; position: fixed; top: 150px; bottom: 0; z-index: 0;
        width: var(--ch-w);
        background-size: cover; background-position: center center; background-repeat: no-repeat;
        opacity: .6; pointer-events: none;
    }
    .ch-flank-left  { right: calc(50% + var(--ch-col, 42rem) / 2 + .5rem); }
    .ch-flank-right { left:  calc(50% + var(--ch-col, 42rem) / 2 + .5rem); }
    .ch-flank-left {
        -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 70%, transparent),
                            linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
        mask-image: linear-gradient(to right, transparent, #000 12%, #000 70%, transparent),
                    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
        -webkit-mask-composite: source-in; mask-composite: intersect;
    }
    .ch-flank-right {
        -webkit-mask-image: linear-gradient(to left, transparent, #000 12%, #000 70%, transparent),
                            linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
        mask-image: linear-gradient(to left, transparent, #000 12%, #000 70%, transparent),
                    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
        -webkit-mask-composite: source-in; mask-composite: intersect;
    }
    /* A flank with several scenes: each scene fades in as the reader reaches its verse. */
    .ch-scene {
        position: absolute; inset: 0;
        background-size: cover; background-position: center center; background-repeat: no-repeat;
        opacity: 0; transition: opacity .9s ease;
    }
    .ch-scene.on { opacity: 1; }

    /* Verse tag sits under its own picture. */
    .ch-flank-tag {
        --ch-w: min(620px,
                    calc((100vw - var(--ch-col, 42rem)) / 2 - 1.5rem),
                    calc((100vh - 150px) * 0.5625));
        display: block; position: fixed; bottom: 1.25rem; z-index: 1;
        width: var(--ch-w); pointer-events: none;
        font-family: 'Crimson Text', serif; font-style: italic; font-size: .85rem;
        color: rgba(219,171,68,.75); transition: opacity .4s ease;
    }
    .ch-flank-tag-left  { right: calc(50% + var(--ch-col, 42rem) / 2 + .5rem); text-align: right; padding-right: 1rem; }
    .ch-flank-tag-right { left:  calc(50% + var(--ch-col, 42rem) / 2 + .5rem); text-align: left;  padding-left: 1rem; }
    main { position: relative; z-index: 1; }
    .ch-art-inline { display: none; }
}

.ch-art-inline img {
    width: 100%; max-width: 420px; margin: 1.5rem auto .5rem; display: block;
    border-radius: .75rem; border: 1px solid rgba(55,65,81,.6);
}
.ch-art-inline figcaption {
    text-align: center; font-size: .8rem; color: #9ca3af; font-style: italic;
    padding: 0 1rem;
}

/* Pages with a wider reading column (e.g. margin notes): flanks need more room. */
.ch-wide { --ch-col: 56rem; }
@media (min-width: 1200px) and (max-width: 1439px) {
    .ch-flank.ch-wide, .ch-flank-tag.ch-wide { display: none; }
    .ch-art-inline.ch-wide { display: block; }
}

/* Scroll-driven scenes: opacity is set as you scroll; a short ease smooths wheel steps. */
.ch-flank[data-mode="scroll"] .ch-scene { transition: opacity .25s linear; }
