:root {
    --height: 600px;
    --width: 450px;
}

.carousel {
    display: grid;
    transform: translate3d(0, 0, 0.1px);
}

.carousel__list {
    display: flex;
    overflow: hidden;
    list-style: none;
    padding: 2em 0 3em;
    margin: 0;
    contain: layout;
    isolation: isolate;
}

.carousel__item {
    display: grid;
    position: relative;
    align-content: start;
    padding: 0;
    flex: 1 1 10%;
    height: var(--height);
    overflow: hidden;
    background: rgba(255, 255, 255, .2);
    transform: translate3d(0, 0, 0.1px);
    contain: layout;
    isolation: isolate;
    cursor: pointer;
}
.carousel__item::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
    transition: all .66s cubic-bezier(.55,.24,.18,1);
}
.carousel__item[data-active]::after {
    background: unset;
}
.carousel__item, .carousel__item * {
    transition: all .6s cubic-bezier(.55, .24, .18, 1);
    user-select: none;
}

.carousel__image, .carousel__contents {
    width: var(--width);
    height: auto;
}

.craousel_img {
    width: 480px;
    height: 720px;
}

.carousel__item:hover {
    transition: all .3s ease;
}

.carousel__item[data-active] {
    flex-basis: var(--width);
    flex-grow: 0;
}

@media screen and (max-width: 800px) {
    .carousel__item {
        flex-basis: 10%;
    }
    .carousel__item[data-active] .carousel__contents {
        width: 100%;
    }
}

@media screen and (max-width: 600px) {
    .carousel__item {
        flex-basis: 10%;
        margin: 0 5px;
        border-radius: 8px;
        font-size: 3vw;
    }
    
    .carousel__item[data-active] {
        flex-basis: 98%;
        flex-grow: 0;
    }
    .carousel__item:nth-child(3), .carousel__item:nth-child(7) {
        flex: 0 0 10px;
    }
    .carousel__item:nth-child(2), .carousel__item:nth-child(8) {
        flex: 0 0 5px;
        transform: translateX(-50px);
    }
    .carousel__item:nth-child(8) {
        transform: translateX(50px);
    }
    .carousel__item:nth-child(1), .carousel__item:nth-child(n+9) {
        flex: 0 0 0px;
        margin: 0;
        box-shadow: none;
        opacity: 0 !important;
    }
    .carousel__item:not(:nth-child(n+5)) img, .carousel__item:nth-child(n+7) img {
        opacity: .8;
    }
    .carousel__item:not(:nth-child(n+4)) *, .carousel__item:nth-child(n+7) * {
        opacity: 0 !important;
    }
}

@media screen and (min-width: 600px) {
    .carousel__item:nth-child(3), .carousel__item:nth-child(10) {
        flex: 0 0 10px;
    }
    .carousel__item:nth-child(2), .carousel__item:nth-child(11) {
        flex: 0 0 5px;
        transform: translateX(-50px);
    }
    .carousel__item:nth-child(11) {
        transform: translateX(50px);
    }
    .carousel__item:nth-child(1), .carousel__item:nth-child(n+12) {
        flex: 0 0 0px;
        margin: 0;
        box-shadow: none;
        opacity: 0 !important;
    }
    .carousel__item:not(:nth-child(n+5)) img, .carousel__item:nth-child(n+9) img {
        opacity: .8;
    }
    .carousel__item:not(:nth-child(n+4)) *, .carousel__item:nth-child(n+10) * {
        opacity: 0 !important;
    }
}

.carousel__item img {
    display: block;
    position: absolute;
    width: var(--width);
    height: 100%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.carousel__item[data-active], .carousel__item[data-active] * {
    opacity: 1;
    filter: none;
}

.carousel__contents {
    display: flex;
    flex-direction: column-reverse;
    justify-content: end;
    align-items: center;
    min-height: 100px;
    padding: 20px 0 30px 0;
    z-index: 2;
    background-size: 170% 200px;
    background-repeat: no-repeat;
    position: absolute;
    bottom: 0;
    left: 0;
}

.carousel__item[data-active] .carousel__contents {
    background: white;
}

.carousel__contents .user__name {
    color: #000;
    text-align: center;
    font-family: "Montserrat", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 32px; /* 200% */
    letter-spacing: 0.16px;
}

.carousel__contents .user__title {
    color: #000;
    text-align: center;
    font-family: 'Times New Roman Cyr';
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: 32px; /* 160% */
    letter-spacing: 0.2px;
    opacity: .85;
    text-wrap: balance;
    margin-bottom: .5em;
}

.carousel__contents .user__title, .carousel__contents .user__name {
    margin: 0;
    opacity: 0;
    transform: translateX(-200px);
    transition-duration: 1s;
}

@media screen and (max-width: 800px) {
    /* .carousel__item img {
        width: calc(var(--width) * .5);
    } */
    /* .carousel__contents {
        transform: translateX(-100%) rotate(90deg);
        transform-origin: bottom right;
        align-items: end;
        justify-content: end;
        background-image: radial-gradient(ellipse at 100% 100%, rgba(0, 0, 0, .4) 0%, transparent 50%);
        background-position: -100% 100%;
        flex-direction: column;
        position: absolute;
        bottom: 0;
        left: 0;
        text-align: right;
    } */
    [data-active] .carousel__contents {
        background-position: 100% 100%;
    }
    .carousel__contents .user__title, .carousel__contents .user__name {
        max-width: 70vh;
        transform: translateX(200px);
    }
}

[data-active] .carousel__contents * {
    transform: translateX(0px);
    transition-duration: .66s;
    opacity: 1;
}

[data-active] .carousel__contents .user__name {
    transition-delay: .1s;
}

[data-active] .carousel__contents .user__title {
    opacity: .85;
    transition-delay: .05s;
}

.carousel__nav {
    padding: 1em;
    justify-self: end;
    grid-row: 1;
    display: flex;
    justify-content: center;
    gap: 50px;
}

.button {
    background-color: transparent;
    cursor: pointer;
}
