/*
 * YouTube-Box – Darstellung
 *
 * Das Video füllt die Breite der Box im Format 16:9. Darunter laufen die
 * weiteren Videos als Vorschaubilder.
 */

.ytb {
    --ytb-line: rgba(128, 128, 128, .28);
    --ytb-accent: var(--accent, var(--rs-accent, #ff0000));
    color: inherit;
}

.ytb * { box-sizing: border-box; }
.ytb-empty p { margin: 0; opacity: .8; }

/* -------------------------------------------------- Hauptvideo */

.ytb-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.ytb-stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ytb .ytb-cover {
    position: absolute;
    inset: 0;
    display: block;
    color: #fff !important;
    text-decoration: none !important;
    cursor: pointer;
}

.ytb-cover img,
.ytb-item-pic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
    max-width: none;
}

.ytb-noimg {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #3a3f55, #111);
}

.ytb-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    line-height: 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45));
    transition: transform .15s ease;
}

.ytb-cover:hover .ytb-play,
.ytb-cover:focus-visible .ytb-play { transform: translate(-50%, -50%) scale(1.1); }
.ytb-cover:focus-visible { outline: 3px solid var(--ytb-accent); outline-offset: -3px; }

.ytb-cover-title {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: 14px 16px 30px;
    background: linear-gradient(rgba(0, 0, 0, .75), transparent);
    font-weight: 700;
    font-size: 1.02em;
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.ytb-cover-title[hidden] { display: none; }

.ytb-privacy { margin: 8px 2px 0; font-size: .78em; opacity: .65; line-height: 1.45; }
.ytb[data-ytb-playing="1"] .ytb-privacy { display: none; }

/* ------------------------------------------------ Weitere Videos */

.ytb-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    gap: 10px;
    margin-top: 12px;
    padding-bottom: 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.ytb .ytb-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: inherit !important;
    text-decoration: none !important;
    scroll-snap-align: start;
}

.ytb-item-pic {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 9px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 0 2px transparent;
    transition: box-shadow .15s ease;
}

.ytb-item.is-active .ytb-item-pic { box-shadow: 0 0 0 3px var(--ytb-accent); }
.ytb-item:hover .ytb-item-pic { box-shadow: 0 0 0 2px var(--ytb-line); }
.ytb-item.is-active:hover .ytb-item-pic { box-shadow: 0 0 0 3px var(--ytb-accent); }

.ytb-item-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.6);
    line-height: 0;
    opacity: .9;
}

.ytb-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .85em;
    font-weight: 600;
    line-height: 1.35;
}

.ytb-item.is-active .ytb-item-title { color: var(--ytb-accent); }

.ytb-more { margin: 10px 0 0; text-align: right; font-weight: 700; }
