#hgbp-modal {
    position: fixed;
    inset: 0;
    width: fit-content;
    height: fit-content;
    max-width: calc(100% - 24px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 12px 45px rgb(0 0 0 / 40%);
    overflow: hidden;
}

#hgbp-modal:not([open]) {
    display: none;
}

#hgbp-modal::backdrop {
    background: rgb(0 0 0 / 65%);
}

#hgbp-modal .hgbp-link {
    display: block;
}

#hgbp-modal .hgbp-link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -4px;
}

#hgbp-modal .hgbp-link img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(600px, calc(100vw - 24px));
    max-height: min(640px, 76vh);
    max-height: min(640px, 76dvh);
    object-fit: contain;
}

#hgbp-modal .hgbp-dismiss {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    margin: 0;
}

#hgbp-modal .hgbp-close {
    position: relative;
    isolation: isolate;
    display: grid;
    width: 44px;
    height: 44px;
    min-height: 0;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: 700 17px/1 system-ui, sans-serif;
    cursor: pointer;
}

#hgbp-modal .hgbp-close::before {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: -1;
    border-radius: 50%;
    background: #e80818;
    box-shadow: 0 2px 8px rgb(0 0 0 / 35%);
}

#hgbp-modal .hgbp-close:focus-visible {
    outline: none;
}

#hgbp-modal .hgbp-close:focus-visible::before {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    #hgbp-modal[open] {
        animation: hgbp-enter 180ms ease-out both;
    }

    #hgbp-modal[open].hgbp-closing {
        animation: hgbp-exit 150ms ease-in both;
    }

    #hgbp-modal[open]::backdrop {
        animation: hgbp-backdrop-in 180ms ease-out both;
    }

    #hgbp-modal[open].hgbp-closing::backdrop {
        animation: hgbp-backdrop-out 150ms ease-in both;
    }
}

@keyframes hgbp-enter {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
}

@keyframes hgbp-exit {
    to {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
}

@keyframes hgbp-backdrop-in {
    from { opacity: 0; }
}

@keyframes hgbp-backdrop-out {
    to { opacity: 0; }
}
