/* ==========================================================
   DimosTV FE-06A — Responsive Rails & Continue Watching
   Final cascade layer. It stabilizes existing components only.
========================================================== */

/* Rails must remain a single horizontal track at every breakpoint. */
.dtv-carousel-section .dtv-carousel-row {
    display: flex !important;
    flex-flow: row nowrap !important;
    grid-template-columns: none !important;
    align-items: stretch;
    justify-content: flex-start !important;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.dtv-carousel-section .dtv-carousel-row > .dtv-video-card {
    flex-shrink: 0 !important;
    min-width: 0;
}

/* Tablet: predictable complete cards, with no cloned-looking second row. */
@media (min-width: 769px) and (max-width: 899px) {
    .dtv-carousel-section[data-dtv-section-layout="short"] .dtv-carousel-row {
        gap: 20px !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="short"] .dtv-video-card--short {
        flex: 0 0 calc((100% - 20px) / 2) !important;
        width: calc((100% - 20px) / 2) !important;
        max-width: none !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="landscape"] .dtv-video-card--landscape {
        flex: 0 0 min(72vw, 620px) !important;
        width: min(72vw, 620px) !important;
        max-width: none !important;
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .dtv-carousel-section[data-dtv-section-layout="short"] .dtv-carousel-row {
        gap: 20px !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="short"] .dtv-video-card--short {
        flex: 0 0 calc((100% - 40px) / 3) !important;
        width: calc((100% - 40px) / 3) !important;
        max-width: none !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="landscape"] .dtv-video-card--landscape {
        flex: 0 0 calc((100% - 20px) / 2) !important;
        width: calc((100% - 20px) / 2) !important;
        max-width: none !important;
    }
}

@media (max-width: 768px) {
    /* Native swipe is the primary mobile interaction. */
    .dtv-carousel-section .dtv-carousel-shell {
        width: 100%;
        padding: 0 0 12px !important;
        overflow: hidden !important;
    }

    .dtv-carousel-section .dtv-carousel-shell::before,
    .dtv-carousel-section .dtv-carousel-shell::after {
        display: none !important;
    }

    .dtv-carousel-section .dtv-carousel-row {
        width: 100%;
        gap: 16px !important;
        padding: 8px max(18px, calc((100vw - 100%) / 2)) 18px !important;
        scroll-padding-inline: 18px;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
        border: 0 !important;
        box-shadow: none !important;
    }

    .dtv-carousel-section .dtv-carousel-row::before,
    .dtv-carousel-section .dtv-carousel-row::after {
        display: none !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="short"] .dtv-video-card--short,
    .dtv-carousel-section .dtv-video-card--poster {
        flex: 0 0 82vw !important;
        width: 82vw !important;
        max-width: 360px !important;
    }

    .dtv-carousel-section[data-dtv-section-layout="landscape"] .dtv-video-card--landscape {
        flex: 0 0 84vw !important;
        width: 84vw !important;
        max-width: 520px !important;
    }

    .dtv-carousel-section .dtv-carousel-arrow,
    .dtv-carousel-section .dtv-carousel-shell > button.dtv-carousel-arrow {
        display: none !important;
    }

    .dtv-carousel-section .dtv-carousel-progress {
        height: 3px;
        margin: 0 18px !important;
        background: rgba(26, 46, 74, .12);
    }

    /* One Show fills its panel and does not imply an unavailable next item. */
    .dtv-carousel-section[data-dtv-section-key="shows"][data-dtv-item-count="1"] .dtv-video-card--landscape {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Continue Watching mirrors the same swipe rhythm. */
    .dtv-continue-watching__row {
        display: flex !important;
        flex-flow: row nowrap !important;
        gap: 16px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 8px 18px 20px !important;
        scroll-padding-inline: 18px;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .dtv-continue-card {
        flex: 0 0 82vw !important;
        width: 82vw !important;
        max-width: 380px !important;
    }

    /* Mobile Live: preview → identity → single primary action. */
    .dtv-live-strip {
        gap: 14px !important;
        margin: -20px 0 48px !important;
        padding: 16px !important;
        border-radius: 20px !important;
    }

    .dtv-live-strip__status {
        gap: 12px;
    }

    .dtv-live-strip__status p {
        display: none;
    }

    .dtv-live-strip__label {
        font-size: 17px !important;
    }

    .dtv-live-strip__current {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .dtv-live-strip__thumb {
        width: 100%;
        height: auto !important;
        aspect-ratio: 16 / 9;
    }

    .dtv-live-strip__info :is(h2, h4) {
        font-size: clamp(21px, 6.2vw, 27px) !important;
        line-height: 1.08;
    }

    .dtv-live-strip__source-name {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
    }

    .dtv-live-strip__watch {
        width: 100%;
        min-height: 48px;
        margin-top: 12px;
    }

    .dtv-live-strip:not(.dtv-live-strip--upcoming) .dtv-live-strip__epg {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dtv-carousel-section .dtv-carousel-row,
    .dtv-continue-watching__row {
        scroll-behavior: auto !important;
    }
}
