/* Korsakow Scroll Interface styles. All selectors scoped under
 * .ScrollPlayer (added to #korsakow-root by org.korsakow.scroll.Bootstrap)
 * so this file can never affect the classic click-based player when it's
 * the one that's active. korsakow.css is always loaded too and already
 * supplies the generic .scalingPolicy-* / .MediaUI rules this file relies
 * on (object-fit + show-once-loaded), reused as-is rather than redefined.
 */

.ScrollPlayer {
    background-color: #000;
}

.ScrollBoot {
    position: relative;
    width: 100%;
    height: 100%;
}

.ScrollFeed {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    /* Without this, overscrolling past the last card (e.g. a single-card
       feed with no links yet) rubber-bands and briefly reveals the black
       .ScrollPlayer background behind the feed, reading as "screen goes
       black" rather than as "nothing more to scroll to yet". */
    overscroll-behavior-y: contain;
}

.ScrollCard {
    position: relative;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background-color: #111;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.ScrollCard .mainMediaContainer,
.ScrollCard .teaser {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.ScrollCard .teaser {
    z-index: 2;
}

/* Explicit stacking for the teaser's image/video: previously it relied on
   the browser's default static-vs-positioned stacking (an unpositioned
   .MediaUI naturally renders below a positioned, z-indexed sibling like
   .teaserText) -- correct per spec, but some Android browsers give an
   autoplaying <video> its own hardware compositing layer that ignores
   normal DOM stacking and paints on top regardless (Florian, 2026-08-24:
   video preview hides the text; on desktop this was never visible since
   desktop browsers don't hardware-overlay muted inline video the same
   way). Pinning both layers to an explicit z-index removes the ambiguity
   either way. */
.ScrollCard .teaser .MediaUI {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.ScrollCard .SubtitlesWidget {
    z-index: 2;
    box-sizing: border-box;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    padding: 0 0.5em 0.5em;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    overflow: hidden;
}
.ScrollCard .SubtitlesWidget .subtitleLine {
    margin: 0.2em 0;
}

.ScrollCard .teaserText {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    box-sizing: border-box;
    padding: 1.5em 1.25em calc(1.5em + env(safe-area-inset-bottom, 0px));
    color: #fff;
    font-size: 1.1em;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    pointer-events: none;
    /* Explicit z-index alone (added 2026-08-24) wasn't enough to keep
       this above an autoplaying <video> preview on Android -- some mobile
       browsers give hardware-accelerated video its own compositing
       surface that can still paint above a plain (non-composited) sibling
       regardless of z-index. Forcing this element onto its own GPU
       compositing layer too (a translateZ(0)/will-change hack, the
       standard workaround for this exact "video ignores z-index on
       Android" class of bug) makes the browser composite both layers
       through the same pipeline, where z-index is actually honored. */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Only added when a SWIPE-Interface Preview widget's settings are actually
   being applied (see Card.showTeaser) -- switches to a full-height table,
   with .content as its table-cell, so the Interface Editor's "Align
   Vertical" setting (an inline vertical-align style) actually has an
   effect: vertical-align is a no-op on a plain block box, same
   table/table-cell pattern the classic player's own .Preview .previewText /
   .content already uses (see korsakow.css). Kept as an opt-in modifier, not
   the unconditional default, so exports/SNUs with no SWIPE-Interface Preview
   widget to style keep their original tight bottom-gradient look
   unchanged. */
.ScrollCard .teaserText.styled {
    top: 0;
    display: table;
    width: 100%;
    height: 100%;
    padding: 0;
    background: none;
}
.ScrollCard .teaserText.styled .content {
    display: table-cell;
    vertical-align: bottom;
    box-sizing: border-box;
    padding: 1.5em 1.25em calc(1.5em + env(safe-area-inset-bottom, 0px));
    color: #fff;
    font-size: 1.1em;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}

.ScrollCard .UnmuteAffordance {
    position: absolute;
    right: 1em;
    bottom: calc(1.5em + env(safe-area-inset-bottom, 0px));
    z-index: 4;
    width: 2.2em;
    height: 2.2em;
    line-height: 2.2em;
    text-align: center;
    font-size: 1.2em;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    cursor: pointer;
}
