/* Highlights Carousel — Hybrid scroll-snap + Clone-Wraparound */

#highlights-slider {
    display: flex !important;
    grid-template-columns: none !important;
    transform: none !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: auto;
    gap: 1rem;
    padding-inline: clamp(1rem, 4vw, 3rem);
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start;
    overscroll-behavior-y: auto;
}
#highlights-slider::-webkit-scrollbar {
    display: none;
}

#highlights-slider .highlight-card {
    scroll-snap-align: start;
    flex: 0 0 auto;
}

#highlights-slider .highlight-card.is-clone {
    pointer-events: none;
}

.highlights__slider-controls {
    display: flex !important;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

#highlights-prev,
#highlights-next {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

#highlights-prev:hover,
#highlights-next:hover {
    background: var(--color-primary);
}

#highlights-prev[disabled],
#highlights-next[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.highlights__dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.highlights__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.3);
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
}

.highlights__dot[aria-current="true"] {
    background: var(--color-primary);
    transform: scale(1.3);
}

@media (min-width: 768px) and (max-width: 1023px) {
    #highlights-slider {
        padding-inline: 1.5rem;
    }
}

/* Desktop: Karten etwas schmaler, damit 4 voll + Peek reinpassen.
   styles.css setzt 270px — hier 255px für Standard-Desktop, auf breiten
   Viewports (≥1400px) zurück auf komfortable Größe. */
@media (min-width: 1024px) {
    #highlights-slider .highlight-card {
        width: 255px;
    }
}
@media (min-width: 1400px) {
    #highlights-slider .highlight-card {
        width: 265px;
    }
}

@media (max-width: 768px) {
    #highlights-slider {
        justify-content: flex-start !important;
    }
}

.highlight-card__placeholder {
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* ============================================================
   Mobile (Portrait & Landscape): Grid 1 Spalte mit allen 12 Karten.
   Kein Carousel, kein Swipe — normaler vertikaler Page-Scroll.
   Selector mit #highlights #highlights-slider (Spezifität 0,2,x,y)
   übersteuert mobile-highlights-final-working.css (0,1,x,y).
   ============================================================ */
@media (max-width: 1023px) {
    #highlights #highlights-slider {
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: none !important;
        gap: 1rem !important;
        padding: 1rem !important;
        overflow: visible !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        scroll-snap-type: none !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: stretch !important;
        align-items: stretch !important;
        transform: none !important;
        touch-action: auto !important;
        -webkit-overflow-scrolling: auto !important;
    }

    #highlights #highlights-slider .highlight-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 400px !important;
        min-height: 400px !important;
        max-height: 400px !important;
        scroll-snap-align: none !important;
        flex: 0 0 auto !important;
        padding: 0.85rem !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* Video-Container: feste Höhe, alle Karten identisch */
    #highlights #highlights-slider .highlight-card .highlight-card__video-container,
    #highlights #highlights-slider .highlight-card .highlight-card__placeholder {
        height: 200px !important;
        min-height: 200px !important;
        max-height: 200px !important;
        flex: 0 0 200px !important;
        width: 100% !important;
        margin-bottom: 0.75rem !important;
        overflow: hidden !important;
        border-radius: var(--border-radius, 8px) !important;
    }

    #highlights #highlights-slider .highlight-card .highlight-card__video {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Content-Bereich */
    #highlights #highlights-slider .highlight-card .highlight-card__content {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.4rem !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Titel: max 2 Zeilen, nur an Wortgrenzen umbrechen */
    #highlights #highlights-slider .highlight-card .highlight-card__title {
        font-size: 1.05rem !important;
        line-height: 1.25 !important;
        margin: 0 !important;
        height: auto !important;
        max-height: 2.5em !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        hyphens: none !important;
    }

    #highlights #highlights-slider .highlight-card .highlight-card__category {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.6rem !important;
        align-self: center !important;
        margin: 0 auto !important;
        height: auto !important;
        min-height: 0 !important;
        text-align: center !important;
    }

    /* Beschreibung: großzügig genug für komplette Texte */
    #highlights #highlights-slider .highlight-card .highlight-card__description {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        margin: 0 !important;
        height: auto !important;
        flex: 1 1 auto !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 5 !important;
        line-clamp: 5 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    /* Clones im Grid-Modus ausblenden */
    #highlights #highlights-slider .highlight-card.is-clone {
        display: none !important;
    }

    /* Carousel-Controls im Grid-Modus komplett ausblenden */
    #highlights .highlights__slider-controls,
    #highlights .highlights__slider-wrapper + .highlights__slider-controls,
    #highlights .highlights__container > .highlights__slider-controls,
    #highlights .highlights__dots,
    #highlights #highlights-prev,
    #highlights #highlights-next {
        display: none !important;
    }

    /* Wrapper darf nichts abschneiden/overflow-auto haben im Grid-Modus */
    #highlights .highlights__slider-wrapper,
    #highlights .highlights__container {
        overflow: visible !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ============================================================
   Mobile Landscape: Karten schmaler + niedriger, damit eine
   Kachel ohne vertikales Scrollen auf den Bildschirm passt.
   ============================================================ */
@media (max-width: 1023px) and (orientation: landscape) {
    #highlights #highlights-slider {
        max-width: 460px !important;
        margin: 0 auto !important;
    }

    #highlights #highlights-slider .highlight-card {
        height: 320px !important;
        min-height: 320px !important;
        max-height: 320px !important;
        padding: 0.7rem !important;
    }

    #highlights #highlights-slider .highlight-card .highlight-card__video-container,
    #highlights #highlights-slider .highlight-card .highlight-card__placeholder {
        height: 170px !important;
        min-height: 170px !important;
        max-height: 170px !important;
        flex: 0 0 170px !important;
        margin-bottom: 0.5rem !important;
    }

    #highlights #highlights-slider .highlight-card .highlight-card__title {
        font-size: 0.95rem !important;
    }

    #highlights #highlights-slider .highlight-card .highlight-card__description {
        font-size: 0.78rem !important;
        -webkit-line-clamp: 3 !important;
        line-clamp: 3 !important;
    }
}


/* ============================================================
   Desktop / Tablet: Pfeile als seitliches Overlay, Dots unterhalb
   Mobile (≤768px) wird durch mobile-highlights-final-working.css
   gesteuert — daher bewusst ab 769px greifend.
   ============================================================ */
@media (min-width: 769px) {
    .highlights__container {
        position: relative;
    }

    .highlights__slider-wrapper {
        position: relative;
    }

    /* Controls-Container wird transparenter Overlay über dem Slider.
       pointer-events: none, damit der Scroll-Bereich nicht blockiert wird;
       die Pfeil-Buttons reaktivieren pointer-events für sich selbst. */
    .highlights__slider-wrapper + .highlights__slider-controls,
    .highlights__container > .highlights__slider-controls {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        height: 100%;
        margin: 0;
        padding: 0;
        pointer-events: none;
        background: transparent;
        gap: 0;
        z-index: 10;
    }

    /* Pfeile seitlich vertikal zentriert über dem Slider. */
    #highlights-prev,
    #highlights-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: auto;
        z-index: 11;
    }
    #highlights-prev { left: -2.485rem; }
    #highlights-next { right: -2.485rem; }

    /* Dots wandern aus dem Overlay-Container heraus unter den Slider. */
    .highlights__dots {
        position: absolute;
        left: 50%;
        bottom: -2.25rem;
        transform: translateX(-50%);
        pointer-events: auto;
        z-index: 11;
        margin: 0;
    }

    /* Spielraum unter dem Wrapper, damit die absolut positionierten Dots
       nicht den nachfolgenden Content überlappen. */
    .highlights__container {
        margin-bottom: 2.5rem;
    }
}
