[data-profile-photo][data-profile-url],
[data-profile-gallery-photo] {
    cursor: pointer;
}

.profile-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: none;
    align-items: center;
    justify-content: center;

    padding:
        calc(var(--topbar-height, 55px) + 24px)
        24px
        24px
        24px;

    background: rgba(0, 0, 0, 0.82);
    box-sizing: border-box;
}

.profile-photo-viewer--open {
    display: flex;
}

.profile-photo-viewer__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

.profile-photo-viewer__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: calc(100vh - var(--topbar-height, 55px) - 48px);
}

.profile-photo-viewer__image {
    display: block;
    max-width: 92vw;
    max-height: calc(100vh - var(--topbar-height, 55px) - 48px);
    border-radius: 18px;
    object-fit: contain;
}

.profile-photo-viewer__close {
    position: fixed;
    top: calc(var(--topbar-height, 55px) + 24px);
    right: 22px;
    z-index: 20;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.profile-photo-viewer__close:focus-visible,
[data-profile-photo]:focus-visible,
[data-profile-gallery-photo]:focus-visible {
    outline: 3px solid #ff7a3d;
    outline-offset: 3px;
}

@media (max-width: 860px) {
    .profile-photo-viewer {
        align-items: flex-start;

        padding:
            calc(var(--topbar-height, 55px) + 16px)
            2vw
            20px
            2vw;

        background: rgba(0, 0, 0, 0.88);
        overflow: hidden;
    }

    .profile-photo-viewer__content {
        max-width: 96vw;
        max-height: 70vh;
    }

    .profile-photo-viewer__image {
        width: auto;
        max-width: 96vw;
        max-height: 70vh;
        border-radius: 18px;
        object-fit: contain;

        touch-action: pinch-zoom;
        user-select: none;
        -webkit-user-drag: none;
    }

    .profile-photo-viewer__close {
        position: fixed;
        top: calc(var(--topbar-height, 55px) + 12px);
        right: 2vw;

        width: 46px;
        height: 46px;
        z-index: 20;

        background: rgba(255, 255, 255, 0.94);
        color: #111;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }
}

@media (max-width: 768px) {
    .profile-photo-viewer {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overscroll-behavior-x: none;
        touch-action: pan-y;
    }
}
