:root {
    --highlight-bg: var(--ardoise-40);
    --highlight-progress: var(--ardoise-40);
    --highlight-head: var(--ardoise-40);
    --highlight-color: var(--ardoise-90);
    --highlight-duration: 20s;
    --highlight-transition: 300ms;
}

.home {
    position: relative;

    h1 {
        z-index: 1;
    }

    .presentation {
        font-size: 1.5rem;
        font-weight: 100;
        line-height: 1.25em;
        /*margin-block: 5rem;*/
    }

    .highlighted-series {
        align-items: center;
        background-color: var(--highlight-bg);
        box-shadow: 0 0 4rem 6rem var(--highlight-bg);
        color: var(--highlight-color);
        display: flex;
        gap: 1rem;
        height: 36vw;
        justify-content: center;
        margin-block: 8rem;
        margin-inline: auto;
        position: relative;
        transition: background-color var(--highlight-transition), box-shadow var(--highlight-transition);
        width: 90vw;

        .poster {
            aspect-ratio: 2 / 3;
            flex-shrink: 0;
            height: 115%;
            opacity: 0;
            rotate: 3deg;
            transition: opacity var(--highlight-transition);


            &.show {
                opacity: 1;
            }

            img {
                border: .75rem solid var(--orange-90);
                border-radius: .25rem;
                height: 100%;
                object-fit: cover;
                width: 100%;
            }
        }

        .infos {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            height: 24dvh;
            justify-content: center;

            .details {
                display: flex;
                flex-direction: column;
                gap: 1rem;
                justify-content: center;
                opacity: 0;
                transition: opacity var(--highlight-transition);

                &.show {
                    opacity: 1;
                }

                a {
                    color: var(--highlight-color);

                    .name {
                        font-size: 2rem;
                        font-weight: 100;
                        line-height: 1.25em;
                        padding-inline: 1rem;
                    }
                }

                .overview {
                    font-size: 1.1rem;
                    font-weight: 100;
                    line-height: 1.25em;
                    overflow-y: auto;
                    padding-inline: 1rem;
                }

                .providers {
                    flex-shrink: 0;
                    overflow-x: auto;

                    .wrapper {
                        align-items: center;
                        display: flex;
                        gap: 1rem;
                        justify-content: flex-start;
                        padding-inline: 1rem;

                        .provider {
                            align-items: center;
                            display: flex;
                            flex-shrink: 0;
                            gap: .5rem;
                            height: 4rem;

                            img {
                                border-radius: .25rem;
                                height: clamp(2rem, 5vw, 4rem);
                                object-fit: cover;
                                width: clamp(2rem, 5vw, 4rem);;
                            }

                            .name {
                                font-size: 1.1rem;
                                font-weight: 100;
                                line-height: 1.25em;
                                white-space: nowrap;
                            }
                        }
                    }
                }
            }

            .poster-list {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                width: 100%;

                .item {
                    align-items: center;
                    display: flex;
                    flex-direction: column;
                    gap: .25rem;
                    height: 7vw;
                    max-width: 5vw;

                    &.counter {
                        height: 5vw;
                        margin-block-start: 1vw;
                        margin-inline-end: 1vw;
                        max-width: unset;
                        width: 5vw;

                        div {
                            align-items: center;
                            aspect-ratio: 1;
                            background-color: var(--orange-50);
                            border: .125rem solid var(--orange-90);
                            border-radius: 50%;
                            color: var(--orange-90);
                            display: flex;
                            font-size: 3vw;
                            height: 100%;
                            justify-content: center;
                            margin-inline-end: .25rem;
                            width: 100%;
                        }
                    }

                    .poster-item {
                        border: .125rem solid transparent;
                        border-radius: .375rem;
                        height: 6vw;
                        object-fit: cover;
                        width: 4vw;

                        &.active {
                            border-color: var(--orange-50);
                        }

                        img {
                            border-radius: .25rem;
                            height: calc(6vw - .25rem);
                            object-fit: cover;
                            width: calc(4vw - .25rem);
                        }
                    }

                    .count {
                        display: flex;
                        flex-wrap: wrap;
                        height: .75rem;
                        justify-content: center;
                        width: 100%;

                        > div {
                            background-color: var(--orange-50);
                            border-radius: 50%;
                            height: .25rem;
                            width: .25rem;
                        }
                    }
                }
            }
        }

        .loading {
            align-items: center;
            border-radius: 50%;
            height: 20vw;
            left: 50%;
            opacity: 0;
            position: absolute;
            top: 50%;
            translate: -50% -50%;
            transition: opacity var(--highlight-transition);
            width: 20vw;
            z-index: 1;

            &.show {
                animation: spin 1s linear infinite;
                opacity: 1;
            }

            .loading-item {
                background-color: var(--orange-50);
                border-radius: 50%;
                border-top: .5rem solid;
                height: 2rem;
                position: absolute;
                translate: -50% -50%;
                width: 2rem;

                &:first-child {
                    left: 25%;
                    top: 25%;
                }

                &:nth-child(2) {
                    left: 75%;
                    top: 25%;
                }

                &:nth-child(3) {
                    left: 25%;
                    top: 75%;
                }

                &:nth-child(4) {
                    left: 75%;
                    top: 75%;
                }
            }
        }

        .loading-v2 {
            inset: 0;
            position: absolute;

            .ball-container {
                height: 100%;
                position: relative;
                width: 100%;

                .ball {
                    background-color: var(--orange-50);
                    border-radius: 50%;
                    height: 2rem;
                    position: absolute;
                    width: 2rem;
                }
            }
        }
    }

    .highlight-progress {
        background-color: var(--highlight-progress);
        border-radius: 0 1rem 1rem 0;
        box-shadow: 0 0 3rem 1rem var(--highlight-bg);
        height: 3px;
        left: 0;
        position: absolute;
        top: 1.5rem;
        width: 0;

        &.show {
            transition: width var(--highlight-duration) linear;
            width: 100%;
        }

        .head {
            aspect-ratio: 1;
            background-color: var(--highlight-head);
            border-radius: 50%;
            box-shadow: 0 0 1rem 12px var(--highlight-head);
            height: 100%;
            position: absolute;
            right: 0;
            top: 0;

        }
    }

    .series-status {
        align-items: stretch;
        background-color: var(--orange-40);
        border-radius: 1rem;
        color: var(--orange-80);
        display: flex;
        font-size: 1.5rem;
        font-weight: 600;
        justify-content: center;
        margin-inline: auto;
        overflow: hidden;

        &.vertical {
            flex-direction: column;
        }

        .status-title {
            align-items: center;
            background-color: var(--green);
            display: flex;
            justify-content: center;
            min-height: 100%;
            padding-block: 1vw;
            padding-inline: 2vw;
            text-align: center;
            text-wrap: balance;
        }

        .status-items {
            align-items: center;
            display: flex;
            flex-grow: 1;
            flex-wrap: wrap;
            gap: 1rem;
            justify-content: center;
            padding: 2rem;

            &:not(:has(> .status-item)) {
                flex-direction: column;
            }

            .status-item {
                align-items: center;
                background-color: var(--orange-30);
                border-radius: 1rem;
                display: flex;
                flex-direction: column;
                gap: .5rem;
                justify-content: center;
                padding: 1rem;

                .name {
                    font-size: 1rem;
                    font-weight: 400;
                    line-height: 1.1em;
                    text-transform: uppercase;
                }

                .count {
                    font-size: 3rem;
                    font-weight: 800;
                    line-height: 1.1em;
                }

                .percent {
                    color: var(--orange-90);
                    font-size: 1rem;
                    font-weight: 400;
                    line-height: 1.1em;
                }
            }

            .status-item-line {
                align-items: center;
                display: flex;
                flex-grow: 1;
                flex-wrap: wrap;
                gap: 1rem;
                justify-content: center;
            }
        }
    }

    .home-content {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2rem;
        /*height: 100dvh;
        overflow-y: auto;
        scroll-snap-type: y mandatory;*/

        .highlighted-series {
            /*height: 100dvh;
            margin-bottom: unset;
            padding-block: 6dvh;
            scroll-snap-align: start;*/
        }

        .series-group {
            /*justify-content: center;
            scroll-snap-align: start;
            height: 100dvh;
            margin-top: unset;
            padding-block-start: 8dvh;*/

            h2 {
                /*font-size: 3vw;*/
            }

            .wrapper {
                .content {
                    overflow-x: auto;
                    scroll-snap-type: x mandatory;
                    /*width: 100%;*/

                    .card {
                        scroll-snap-align: start;
                    }
                }
            }
        }
    }
}

@media (width <= 52rem) {
    .home {
        .series-status {
            flex-direction: column;

            .status-items {
                padding: 1rem;

                .status-item {
                    .name {
                        font-size: max(.75rem, 2vw);
                    }
                    .count {
                        font-size: max(2rem, 5vw);
                    }
                }
            }
        }
    }
}

@media (orientation: portrait) {
    .home {
        .highlighted-series {
            flex-direction: column;
            height: auto;
            width: 90vw;

            .poster {
                aspect-ratio: 2 / 3;
                height: 64dvh;
                max-width: 90vw;
                width: auto;
            }

            .details {
                height: auto;
                width: 90vw;

                .name {
                    font-size: 3rem;
                    line-height: 1.25em;
                }

                .overview {
                    align-items: flex-start;
                    display: flex;
                    font-size: 1.5rem;
                    max-height: unset;
                    line-height: 1.25em;
                    overflow-y: auto;
                }
            }
        }
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.series-group {
    align-items: flex-start;
    //background-color: var(--ardoise-80);
    border-radius: .25rem;
    color: var(--ardoise-10);
    display: flex;
    flex-direction: column;
    font-weight: 300;
    justify-content: flex-start;
    margin-top: 2rem;
    //padding: 1rem;
    text-align: center;
    transition: background-color .250ms, color .250ms;

    .header {
        align-items: center;
        display: flex;
        gap: 1rem;
        justify-content: flex-start;
        padding-block: 0;
        padding-inline: 0;
        width: 100%;

        .logo {
            height: 2em;
            width: 2em;

            img {
                border-radius: .25rem;
                height: 2rem;
                object-fit: cover;
                width: 2rem;
            }
        }

        label {
            gap: 1rem;

            select {
                color: var(--ardoise-10);
            }
        }
    }

    &.user {
        margin-block-start: 1rem;

        .wrapper {
            display: flex;
            justify-content: center;
            overflow-x: unset;
            padding-block: unset;

            .content {
                flex-wrap: wrap;
                width: 100%;
            }
        }
    }

    .wrapper {
        display: flex;
        overflow-x: auto;
        width: 100%;

        .content {
            align-items: stretch;
            display: flex;
            gap: 1rem;
            flex-shrink: 0;
            justify-content: flex-start;
            margin: 0 auto;
            padding-block: 1rem;

            &:has(.tmdb) {
                align-items: stretch;
            }

            &.center {
                width: round(down, 100%, 10.25rem); /* 10rem (card) + 0.25rem (gap) */
            }

            h3 {
                background-color: var(--orange-40);
                border-radius: .25rem;
                padding: .25rem .5rem;
                text-align: left;
                width: 100%;
            }

            .episode-block {
                display: flex;
                gap: .25rem;
                margin-inline-end: .5rem;

                > div:first-child {
                    box-shadow: .25rem 0 .5rem .125rem #0000007f;
                }

                > div:last-child {
                    filter: brightness(.75);
                    margin-block-start: -.25rem;
                    margin-inline-start: clamp(-8rem, calc(-0.1 * max(18rem, 24vmax)), -11rem);
                    transform: rotate(3deg);
                    z-index: -1;
                }
            }
        }
    }
}

.video-background {
    height: calc(900vw / 16);
    /* Used to position the video and content */
    position: relative;
}

.video-background__inner {
    /* Positioned at the top left corner */
    left: 0;
    position: absolute;
    top: 0;

    /* Take full size */
    height: 100%;
    width: 100%;

    /* Hide the scrollbar */
    overflow: hidden;
}

.video-background__video {
    object-fit: cover;

    /* Take full width */
    height: 100%;
    width: 100%;
}

.video-background__content {
    /* Positioned at the top left corner */
    left: 0;
    position: absolute;
    top: 0;

    /* Take full size */
    height: 100%;
    width: 100%;

    /* Center the content */
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
