﻿#hvmodal[hidden] {
    display: none !important;
}

#hvmodal {
    position: fixed;
    z-index: 99999;
    inset: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    text-align: center;
}

#hvmodal #hvmodalwrapper {
    position: relative;
    max-width: 100%;
}

#hvmodal #hvmodalimg,
#hvmodal #hvmodalvideo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    max-height: min(80vh, calc(100dvh - 4rem));
    object-fit: contain;
}

#hvmodal #hvmodalwrapper.hvmodal-html {
    width: 48rem;
}

#hvmodalcontent {
    box-sizing: border-box;
    padding: 2rem;
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    overflow: auto;
    overflow-wrap: anywhere;
    background-color: #fff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #222;
    text-align: left;
}

#hvmodalcontent img,
#hvmodalcontent video {
    max-width: 100%;
    height: auto;
}

#hvmodalcontent.hvmodal-video-background {
    position: relative;
}

#hvmodal #hvmodalcontent > #hvmodalvideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    pointer-events: none;
    z-index: 0;
}

#hvmodalcontent > .hvmodal-html-content {
    position: relative;
    z-index: 1;
}

#hvmodal .hvmodal-video-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: #fff;
    text-decoration: underline;
}

#hvmodal #hvmodalclose {
    display: block;
    position: absolute;
    z-index: 2;
    right: -1rem;
    top: -1rem;
    box-sizing: border-box;
    width: 4rem;
    height: 4rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: red url(cross.png) center / 1.5rem no-repeat;
}

#hvmodal a:focus-visible,
#hvmodal #hvmodalvideo:focus-visible {
    outline: 3px solid white;
    outline-offset: 3px;
}

#hvmodal #hvmodalclose:focus,
#hvmodal #hvmodalclose:focus-visible {
    border: 0;
    outline: none;
    box-shadow: none;
}
