﻿[role="dialog"] {
    box-sizing: border-box;
    padding: 15px;
    border: 1px solid #000;
    background-color: #fff;
    min-height: 100vh;    
}

@media screen and (min-width: 640px) {
    [role="dialog"] {
        position: absolute;
        top: 2rem;
        left: 50vw; /* move to the middle of the screen (assumes relative parent is the body/viewport) */
        transform: translateX( -50% ); /* move backwards 50% of this element's width */

        min-width: calc(640px - (15px * 2)); /* == breakpoint - left+right margin */
        min-height: auto;
        box-shadow: 0 19px 38px rgb(0 0 0 / 12%), 0 15px 12px rgb(0 0 0 / 22%);
        border-radius: 0.5rem;
    }
}

.dialog_label {
    text-align: center;
}

.dialog_form {
    margin: 15px;
}

.dialog_form_actions {
    text-align: right;
    padding: 0 20px 20px;
}

    .dialog_form_actions button {
        margin-left: 5px;
    }

.dialog_close_button {
    float: right;
    position: absolute;
    top: 10px;
    left: 92%;
    height: 25px;
}

    .dialog_close_button img {
        border: 0;
    }

.dialog_desc {
    padding: 10px 20px;
}

/* native <dialog> element uses the ::backdrop pseudo-element */

/* dialog::backdrop, */
.dialog-backdrop {
    display: none;
    position: fixed;
    overflow-y: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000;
}

@media screen and (min-width: 640px) {
    .dialog-backdrop {
        background: rgb(0 0 0 / 30%);
    }
}

.dialog-backdrop.active {
    display: block;
}

.no-scroll {
    overflow-y: auto !important;
}

/* this is added to the body when a dialog is open */
.has-dialog {
    overflow: hidden;
}
