/* ==========================================================================
   Discography — assets/css/templates/discography.css
   (loaded automatically by css('@auto') in the header snippet)
   ========================================================================== */

main {
    width: 100%;
    height: auto;
}

h1 {
    color: var(--color-coconut-white);
    mix-blend-mode: difference;
    text-transform: uppercase;
    position: fixed;
    left: 50%;
    top: 1rem;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
}

h1 span {
    font-weight: normal;
}


/* ==========================================================================
   Layout
   ========================================================================== */

.video-container {
    height: 100vh;
    height: 100dvh;                   /* mobile: ignore the browser bars */
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}


/* ==========================================================================
   Carousel — fallback (no JavaScript): plain horizontal snap-scroll list
   ========================================================================== */

.carousel {
    grid-row: 2 / 4;
    position: relative;
    container-type: size;             /* lets the slides size themselves to this box */
    column-gap: 1rem;                 /* read by carousel.js as the gap between slides */
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    width: max-content;
    padding-inline: 7.5vw;
}

.video {
    flex: 0 0 auto;
    position: relative;
    width: min(85vw, calc((100vh - 1rem) / 2 * 16 / 9));
    width: min(85cqw, 100cqh * 16 / 9);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1pt var(--color-coconut-white) solid;
    background-color: var(--color-licorice-black);
    scroll-snap-align: center;
}


/* ==========================================================================
   Carousel — JavaScript running (.is-ready)
   ========================================================================== */

.carousel.is-ready {
    overflow: hidden;
    scroll-snap-type: none;
    touch-action: pan-y;              /* sideways gestures go to the carousel */
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.carousel.is-ready.is-dragging,
.carousel.is-ready.is-dragging * {
    cursor: grabbing;
}

.carousel.is-ready .carousel-track {
    display: block;
    width: 100%;
    padding: 0;
}

/* Every slide sits in the centre; carousel.js moves it sideways */
.carousel.is-ready .video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
    filter: blur(8px);
    transition:
        filter 0.25s ease-out,
        border-color var(--transition-fade) ease-in-out;
}

.carousel.is-ready .video.is-active {
    filter: none;
}


/* ==========================================================================
   Thumbnail, play button, player
   ========================================================================== */

.video-poster {
    position: absolute;
    inset: 0;
    display: block;
    cursor: pointer;
    -webkit-user-drag: none;
}

.video-poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;                /* also crops YouTube's black bars */
    pointer-events: none;
}

.video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4rem;
    height: 4rem;
    transform: translate(-50%, -50%);
    border: 2pt var(--color-coconut-white) solid;
    border-radius: 50%;
    background-color: var(--color-licorice-black);
    color: var(--color-coconut-white);
    opacity: 0;
    transition:
        opacity 0.25s ease-out,
        color var(--transition-fade) ease-in-out,
        background-color var(--transition-fade) ease-in-out;
}

/* Triangle */
.video-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 54%;
    width: 1.1rem;
    height: 1.3rem;
    transform: translate(-50%, -50%);
    background-color: currentColor;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Without JS the play button is always shown; with JS only on the centred video */
.carousel:not(.is-ready) .video-play,
.video.is-active .video-play {
    opacity: 1;
}

.video-poster:hover .video-play,
.video-poster:focus-visible .video-play {
    color: var(--color-licorice-black);
    background-color: var(--color-coconut-white);
}

.video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video.is-playing .video-poster {
    visibility: hidden;
}


/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {}

/* Mobile */
@media (max-width: 640px) {

    .video-play {
        width: 3rem;
        height: 3rem;
    }

    .video-play::before {
        width: 0.85rem;
        height: 1rem;
    }

}