@import url('https://fonts.googleapis.com/css2?family=Spicy+Rice&display=swap');
body{
    background-color: gainsboro;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    width: auto;
    margin: 0;
    background: url("../src/img/background.jpg") no-repeat;
    background-size: 100% auto;
}

.container {
    position: absolute;
    width: 60%;
    height: 70%;
    /* bottom: 0; */
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background-color: black;
    padding: 2px;
    top: 18%;
    /* align-self: center;
    justify-self: center; */
}

/* positon where dotation move for animation */
.centered{
    position: absolute;
    top: 50%;
    left: 50%;
}

.case {
    border: 1px solid white;
    border-right: 1.5px solid white;
    margin: 1%;
    height: 96%;

    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;

    position: relative;
    background-color: white;
}

.hidden{
    visibility: hidden;
}

.left{
    height: 100%;
    width: 100%;
    z-index: 3;
}

.right{
    height: 100%;
    width: 100%;
    z-index: 3;
}

.door {
    height: 100%;
    width: 100%;
    font-size: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    z-index: 1;

    /* modify number of cases */
    font-family: "Spicy Rice", serif;
    color: black;
}

#left-door {
    left: 0;
    border-right: 1px solid black;
    height: 100%;
    transform-origin: left;
    background: var(--casesImgUrl) left no-repeat;
    /* background-color: #266cb4; */
    background-size: 200% 100%;
}

#right-door {
    top: 0;
    right: 0;
    border-left: 1px solid black;
    transform-origin: right;
    background: var(--casesImgUrl) right no-repeat;
    /* background-color: #266cb4; */
    background-size: 200% 100%;
}

.left .open{
    animation: openingLeft .5s forwards;
}
  
.right .open{
    animation: openingRight .5s forwards;
}

.imgCases{
    position: absolute;
    height: 100%;
}

.number{
    /* remove comment to hide number */
    /* display: none !important;  */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d9ac42;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dotation{
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.dotation img{
    width: 100%;
    position: absolute;
}

.container .shake{
    animation: shakeCase .5s forwards;
}

.reveal{
    position: fixed;
    top: var(--start-Xcenter);
    left: var(--start-Ycenter);
    height: var(--heightImg);
}

.container .anim{
    animation: showDotation 3s forwards;   
}

/* define variable modify in JS */
:root {
    --start-Xcenter: 0px;
    --start-Ycenter: 0px;
    --end-Xcenter: 0px;
    --end-Ycenter: 0px;
    --widthImg: 0px;
    --heightImg: 0px;
    --dotationImgUrl: url("../src/img/lot/loose.png");
    --shakingAmplitude: 2px;
    --casesImgUrl: url("../src/img/cases/1.jpeg");
}

@keyframes showDotation {
    0% {
        transform: scale(1);
        top: var(--start-Xcenter);
        left: var(--start-Ycenter);
    }
    50%{
        transform: scale(2);
        top: var(--end-Xcenter);
        left: var(--end-Ycenter);
    }    
    100% {
        transform: scale(1);
        top: var(--start-Xcenter);
        left: var(--start-Ycenter);
    }
    
}

@keyframes openingLeft {
    0% {
        transform: rotateY(0px);
    }
    100%{
        transform: rotateY(-110deg);
    }
}

@keyframes openingRight {
    0% {
        transform: rotateY(0px);
    }
    100%{
        transform: rotateY(110deg);
    }
}

@keyframes shakeCase {
    0% { transform: translateX(0) }
    25% { transform: translateX(var(--shakingAmplitude)) }
    50% { transform: translateX(calc(var(--shakingAmplitude)*-1)) }
    75% { transform: translateX(var(--shakingAmplitude)) }
    100% { transform: translateX(0) }
}

@media (max-width: 480px) {
    body{
        height: 90vh;
    }
    .container{
        grid-template-columns: repeat(3, 1fr);
        width: 75%;
        height: 85%;
        top: 7.5%;
    }
    .number{
        width: 25px;
        height: 25px;
    }
    .door {
        font-size: 20px;
    }
}