/* Project video dialogs must sit above the fixed navigation and floating widgets. */
#staticBackdrop.modal {
    z-index: 2147483647;
}

body:has(#staticBackdrop.show) > .modal-backdrop {
    z-index: 2147483646;
}

#staticBackdrop .modal-dialog {
    width: calc(100% - 2rem);
    max-width: 800px;
    margin: 1rem auto;
    min-height: calc(100% - 2rem);
    display: flex;
    align-items: center;
}

#staticBackdrop .modal-content {
    width: 100%;
    background: #fff;
    color: #212529;
    border-radius: 0.5rem;
    overflow: hidden;
}

#staticBackdrop .modal-header {
    position: relative;
    width: 100%;
    justify-content: space-between !important;
    padding: 0.75rem 1rem;
    background: #fff;
}

#staticBackdrop .modal-title {
    font-size: 1.25rem;
}

#staticBackdrop .btn-close {
    flex-shrink: 0;
    margin: 0 0 0 1rem;
    padding: 0.75rem;
    opacity: 1;
}

#staticBackdrop .modal-body {
    flex: 0 0 auto;
}

#staticBackdrop .modal-body iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}

/* Keep the entire player and close control visible on short landscape screens. */
@media (max-height: 600px) {
    #staticBackdrop .modal-dialog {
        max-width: min(800px, calc((100dvh - 6rem) * 16 / 9));
    }
}

/* Shared video gallery dialog. */
#exampleModal.modal {
    z-index: 2147483647;
}

body:has(#exampleModal.show) > .modal-backdrop {
    z-index: 2147483646;
}

#exampleModal .modal-dialog {
    width: calc(100% - 2rem);
    max-width: 900px;
    margin: 1rem auto;
    min-height: calc(100% - 2rem);
    display: flex;
    align-items: center;
}

#exampleModal .modal-content {
    width: 100%;
    background: #fff;
    color: #212529;
    border: 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

#exampleModal .modal-header {
    position: relative;
    inset: auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between !important;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #dee2e6 !important;
    z-index: 2;
}

#exampleModal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

#exampleModal .btn-close {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    margin: 0 0 0 1rem;
    padding: 0.75rem;
    opacity: 1;
    background-color: transparent;
}

#exampleModal .modal-body {
    flex: 0 0 auto;
    width: 100%;
    padding: 0 !important;
}

#exampleModal .modal-body iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}

@media (max-height: 600px) {
    #exampleModal .modal-dialog {
        max-width: min(900px, calc((100dvh - 6rem) * 16 / 9));
    }
}
