/* Streaming-style carousel (ported from UnQbdWeb) */

.streaming-carousel-container { width: 100%; position: relative; padding: 0; }
.streaming-carousel-empty { text-align: center; padding: 3rem 1rem; color: var(--text-color); opacity: 0.7; }
.streaming-carousel-wrapper { position: relative; display: flex; align-items: center; width: 100%; outline: none; }

/* --rail-col / --rail-gap are the rail's column metrics, declared once here and stepped down in
   the media queries below. Every tile width derives from them, so a book cover and a resume tile
   cannot drift apart the way two hand-maintained ladders eventually would. (They never actually
   diverged -- the duplication was a standing risk, not a realized bug.) Discover.razor used to
   carry a second, contradictory ladder of its own (160/180/200/220/240/260) for the arrow scroll
   math; it now measures the rendered track instead, so this file is the only width ladder left.

   The var() fallbacks are the BASE values only: an item rendered outside a .streaming-carousel-track
   would size at 240px/12px at every viewport rather than following the ladder. Nothing renders that
   way today, and the fallbacks exist to avoid an invalid declaration, not to preserve responsive
   behaviour outside a track. */
.streaming-carousel-track {
    --rail-col: 240px;
    --rail-gap: 12px;
    display: flex;
    gap: var(--rail-gap);
    padding: 1.5rem 3.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.streaming-carousel-track::-webkit-scrollbar { display: none; }

.streaming-book-item { flex: 0 0 auto; scroll-snap-align: start; transition: transform 0.25s ease-out, z-index 0s 0.25s; position: relative; z-index: 1; }
.streaming-book-item:first-child { padding-left: 2rem; }
.streaming-book-item:first-child:hover { transform: translateY(-3px); z-index: 10; transition: transform 0.25s ease-out, z-index 0s; }
.streaming-book-item:hover { transform: scale(1.02) translateY(-3px); z-index: 10; transition: transform 0.25s ease-out, z-index 0s; }
.streaming-book-item:focus-within { transform: scale(1.02) translateY(-2px); z-index: 10; }

.streaming-book-item .book-card { width: var(--rail-col, 240px); max-width: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); transition: box-shadow 0.25s ease; }
.streaming-book-item:hover .book-card { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }

.streaming-nav-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    border: none;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, background 0.3s ease;
    background: transparent;
}

.streaming-nav-prev { left: 0; justify-content: flex-start; padding-left: 12px; }
.streaming-nav-next { right: 0; justify-content: flex-end; padding-right: 12px; }

.streaming-nav-btn.hidden { opacity: 0 !important; pointer-events: none; }
.streaming-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.streaming-nav-icon {
    width: 48px;
    height: 48px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b0b0b;
    background: #ffffff;
    border: 2px solid rgba(0,0,0,0.6);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.streaming-nav-btn:hover .streaming-nav-icon {
    background: #f2f2f2;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}

.streaming-nav-btn:focus-visible .streaming-nav-icon {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.streaming-carousel-indicators { display: flex; justify-content: center; gap: 8px; padding: 1rem 0; margin-top: 0.5rem; }
.streaming-indicator { width: 8px; height: 8px; border-radius: 50%; border: none; background: var(--divider-color); cursor: pointer; transition: all 0.3s ease; padding: 0; }
.streaming-indicator:hover { background: var(--primary-color); transform: scale(1.2); }
.streaming-indicator.active { background: var(--primary-color); width: 24px; border-radius: 4px; }
.streaming-indicator:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

@media (max-width: 1200px) { .streaming-carousel-track { --rail-col: 215px; } .streaming-nav-btn { width: 50px; } }
@media (max-width: 992px) {
    .streaming-book-item:first-child { padding-left: 1.5rem; }
    .streaming-carousel-track { padding: 1rem 2.5rem; --rail-col: 200px; --rail-gap: 10px; }
    .streaming-nav-btn { width: 45px; }
    .streaming-nav-icon { width: 36px; height: 36px; }
}
@media (max-width: 768px) {
    .streaming-book-item:first-child { padding-left: 1rem; }
    .streaming-carousel-track { padding: 1rem 1rem; --rail-col: 180px; --rail-gap: 8px; }
    .streaming-nav-btn {
        display: none;
    }
    .streaming-book-item:hover { transform: scale(1.02) translateY(-2px); }
}
@media (max-width: 576px) {
    .streaming-book-item:first-child { padding-left: 1rem; }
    .streaming-carousel-track { padding: 0.75rem 0.5rem; --rail-col: 165px; --rail-gap: 6px; }
    .streaming-nav-btn { 
        display: none;
    }
    .streaming-carousel-indicators { padding: 0.75rem 0; }
    .streaming-indicator { width: 6px; height: 6px; }
    .streaming-indicator.active { width: 18px; }
}

body.dark-mode .streaming-nav-icon {
    background: #ffffff !important;
    color: #111111 !important;
    border: 2px solid rgba(255,255,255,0.9) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6) !important;
    opacity: 1 !important;
}

/* A resume tile (16:9) interleaved into the continue-reading rail (cross-format Entries mode).
   It spans TWO columns plus the gutter between them -- the flex equivalent of the Library's
   `grid-column: span 2` (library.css), so the two surfaces agree. The reason is height, not
   prominence: a 16:9 thumb plus its fixed ~40px meta block at one column's width renders roughly
   half a 5:8 cover's height (measured 49% at a 240px column), leaving more empty column under the
   tile than tile. At two columns it measures 85-91% of a cover -- closest to parity at the narrow
   breakpoints, loosest at the 240px column. Under 576px the cap below trades some of that back for
   a visible next cover, bottoming out near 79% at 360px. The Library's span-2 tile sits in the same
   band.

   This SUPERSEDES the `align-self: center` introduced by #1751, which treated the same complaint
   (the dead gap under a half-height tile) by splitting the gap above and below instead of by
   removing it. With the tile at 85-91% parity there is only ~35-55px of slack left, and centering
   that would push the tile's top edge below the covers' -- the shelf's visual baseline is the top
   of the row, so a centred near-parity tile reads as misaligned rather than as deliberate. Width
   fixes the cause; alignment only redistributed the symptom. Hence flex-start.

   These selectors outrank watch-show.css's own .wsp-continue-card width, so they win wherever the
   tile renders in a carousel without needing !important.

   NOTE on scroll-snap, corrected after measurement: a snap container does NOT simply snap to the
   nearest tile edge. After a layout change it re-snaps to the element it was ALREADY snapped to,
   which is why inserting this tile at index 0 used to scroll it off screen. Discover corrects that
   explicitly via resetCarouselScroll (shared.js); the width here does not depend on it. */
.streaming-book-item-show { align-self: flex-start; }
.streaming-book-item .wsp-continue-card { width: calc(2 * var(--rail-col, 240px) + var(--rail-gap, 12px)); }
@media (max-width: 576px) {
    /* Cap so a book cover always peeks in beside the tile. Uncapped, a two-column tile measures
       336px at a 360px viewport and pushes the first cover 6px off screen, so the rail reads as a
       hero rather than a shelf and hides the fact that it scrolls. vw is used nowhere else in this
       file; it is safe here because the rule is scoped below 576px, where overlay scrollbars are
       the norm and the classic vw-vs-scrollbar discrepancy does not apply. */
    .streaming-book-item .wsp-continue-card {
        width: min(calc(2 * var(--rail-col, 165px) + var(--rail-gap, 6px)), 78vw);
    }
}
