: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: 78 / 117;
            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;

        }
    }

    .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 (orientation: portrait) {
    .home {
        .highlighted-series {
            flex-direction: column;
            height: auto;
            width: 90vw;

            .poster {
                aspect-ratio: 78 / 117;
                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 {
            display: flex;
            gap: .25rem;
            flex-shrink: 0;
            justify-content: flex-start;
            margin: 0 auto;
            padding-block: 1rem;

            &.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%;
            }

            .card {
                background-color: var(--ardoise-90);
                border-radius: .25rem;
                color: var(--ardoise-10);
                height: 18rem;
                width: 10rem;

                a {
                    display: flex;
                    flex-direction: column;
                    height: 100%;
                    width: 100%;

                    .poster {
                        align-items: center;
                        aspect-ratio: 78 / 117;
                        background-color: var(--ardoise-80);
                        border-radius: .25rem .25rem 0 0;
                        color: var(--ardoise-10);
                        display: flex;
                        flex-shrink: 0;
                        height: 15rem;/* 75dvh;*/
                        justify-content: center;
                        /*overflow: hidden;*/
                        position: relative;
                        width: 10rem;

                        img {
                            aspect-ratio: 78 / 117;
                            border-radius: .25rem .25rem 0 0;
                            height: 15rem; /* 75dvh;*/
                            object-fit: cover;
                            width: 10rem; /*auto;*/
                        }

                        .air-at {
                            background-color: hsla(from var(--ardoise-80) h s l / .9);
                            border-radius: .25rem;
                            color: var(--ardoise-10);
                            font-size: 1rem;
                            font-weight: 600;
                            padding: 0 .25rem;
                            position: absolute;
                            left: .25rem;
                            top: .25rem;
                        }

                        .series-infos {
                            align-items: center;
                            bottom: 1rem;
                            display: flex;
                            flex-wrap: wrap;
                            gap: .25rem;
                            justify-content: flex-end;
                            left: .25rem;
                            position: absolute;
                            right: .25rem;

                            .providers {
                                overflow-x: auto;
                                padding: 0 .25rem;

                                &:has(.provider:hover) {
                                    transition: all .25s ease-in-out;
                                    transform: scale(2);
                                }

                                .provider-content {
                                    display: flex;
                                    gap: .25rem;

                                    .provider {
                                        background-color: var(--navbar-bg);
                                        border-radius: .25rem;
                                        height: 2rem;
                                        width: 2rem;

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

                            .favorite, .quick-watcher {
                                align-items: center;
                                background-color: hsla(from var(--ardoise-80) h s l / .5);
                                border-radius: .25rem;
                                color: var(--favorite-series);
                                display: flex;
                                height: 2rem;
                                justify-content: center;
                                width: 2rem;
                            }

                            .episode-number {
                                background-color: hsla(from var(--ardoise-80) h s l / .9);
                                border-radius: .25rem;
                                color: var(--ardoise-10);
                                padding: .25rem;
                                font-size: 1.5rem;
                                font-weight: 400;
                                width: fit-content;

                                &.watched {
                                    background-color: var(--green-60);
                                    color: var(--green-10);
                                }
                            }

                            .date {
                                background-color: hsla(from var(--ardoise-80) h s l / .9);
                                border-radius: .25rem;
                                color: var(--ardoise-10);
                                padding: .25rem;
                                font-size: .875rem;
                                font-weight: 300;
                                width: fit-content;
                            }
                        }

                        .status {
                            background-color: var(--orange-40);
                            border-radius: .25rem;
                            bottom: .25rem;
                            color: var(--orange-80);
                            left: .25rem;
                            position: absolute;
                            right: .25rem;

                            &.coming-soon {
                                background-color: cadetblue;
                                bottom: -.75rem;
                                color: var(--ardoise-10);
                            }
                        }

                        .progress {
                            background-color: var(--orange-20);
                            border: 2px solid var(--orange-40);
                            border-radius: .5rem;
                            height: 1rem;
                            left: .5rem;
                            overflow: hidden;
                            position: absolute;
                            bottom: -.5rem;
                            width: calc(100% - 1rem);

                            &.start-this-series {
                                border-color: var(--start-this-series);
                            }

                            &.up-to-date {
                                background-color: var(--up-to-date-series-bg);
                                border-color: var(--up-to-date-series-border);

                                .progress-bar {
                                    background-color: var(--up-to-date-series);
                                }
                            }

                            &.that-s-all-folks {
                                border-color: var(--that-s-all-folks-border);

                                .progress-bar {
                                    background-color: var(--that-s-all-folks);
                                }
                            }

                            .progress-bar {
                                background: var(--orange-50);
                                height: .875rem;
                                transition: width 20s linear;
                                width: 0;
                            }
                        }

                        .up-to-date-mask {
                            border-radius: .25rem;
                            height: 5rem;
                            left: 5rem;
                            overflow: hidden;
                            position: absolute;
                            right: -1px;
                            top: -1px;

                            .up-to-date-banner {
                                background-color: var(--up-to-date-series);
                                color: var(--green-10);
                                font-weight: 600;
                                padding: .125rem;
                                position: absolute;
                                right: -3rem;
                                top: 1rem;
                                transform: rotate(45deg) translate(0px,-1px);
                                width: 10rem;

                                &.premiere {
                                    background-color: var(--orange-50);
                                    color: var(--orange-90);
                                }

                                &.ended {
                                    background-color: var(--that-s-all-folks);
                                    color: var(--green-10);
                                }
                            }
                        }
                    }

                    .name {
                        align-items: center;
                        background-color: cadetblue;
                        border-radius: 0 0 .25rem .25rem;
                        display: flex;
                        flex-shrink: 0;
                        font-size: 1rem;
                        font-weight: 500;
                        height: 3rem;
                        justify-content: center;
                        line-height: 1rem;
                        overflow-y: auto;
                        padding-block: .125rem;
                        padding-inline: .5rem;
                        text-align: center;
                        text-wrap: balance;
                        width: 10rem;

                        &.added {
                            background-color: var(--orange-50);
                            color: var(--green-10);
                        }
                    }
                }
            }

            .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: -6rem;
                    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;
}
