.modal{
    width: 100%;
    height: 100vh;
    position: fixed;
    inset: 0;
    z-index: 199;
    border: none;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal[open]{
    display: flex;
}

.modal__container{
    width: 90%;
    max-width: 500px;
    container-type: inline-size;
    container-name: modal;
}

.modal__card{
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(16, 24, 64, .5);
    scale: 1;
}

.modal[open] .modal__card{
    animation: opening .3s ease-in-out forwards;
}

.modal[open].closing .modal__card{
    animation: closing .3s ease-in-out forwards;
}

.modal__header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 16px 20px;
}

.modal__heading{
    font-weight: 600;
    font-size: 1.125em;
    line-height: 152%;
    color: var(--dark-gray);
}

.modal__close{
    font-size: 24px;
    border: none;
    background: none;
    cursor: pointer;
}

.modal__footer{
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 20px;
    gap: 8px;
    border-top: 1px solid rgba(34, 34, 38, 0.08);
}

.modal__button{
    padding: 8px 16px;
    background-color: #fff;
    border: 1px solid #B7B7B7;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875em;
    box-shadow: 0px 1px 2px rgba(135, 43, 247, .4);
    transition: .3s ease-in-out scale;
}

.modal__button--primary{
    border: 1px solid var(--primary);
    background-color: var(--primary);
    color: #fff;
}

.modal__button:hover, .modal__button:focus{
    scale: 1.03;
}

@container modal (min-width: 400px){
    .modal__heading{
        font-size: 1.25em;
    }

    .modal__main{
        grid-template-columns: repeat(3, 1fr);
    }

    .modal__button{
        font-size: 1em;
    }
}

@container modal (min-width: 500px){
    .modal__heading{
        font-size: 1.375em;
    }

    .modal__main{
        grid-template-columns: repeat(3, 1fr);
    }
}

@keyframes opening {
    from{
        opacity: 0;
    }
    
    to{
        opacity: 1;
    }
}

@keyframes closing {
    0%{
        opacity: 1;
    }

    100%{
        opacity: 0;
    }
}

/* @keyframes closing {
    0%{
        scale: 1;
    }

    25%{
        scale: 1.1;
    }

    100%{
        scale: 0;
    }
} */