/* Click-to-preview lightbox for profile pictures - see
   bn-avatar-lightbox.js. Loaded sitewide (not scoped to .p2p-dash or any
   one page's design system classes) since avatars needing this appear
   across the dashboard, profile settings, and public profile pages. */

/* Trigger button - wraps an existing avatar <img>/preview without
   changing how it looks; only adds interaction affordance. */
.bn-avatar-lightbox-trigger {
    all: unset;
    display: block;
    /* Explicit 100%, not just `display: block` - the profile settings
       preview (.profilePicPreview) sizes itself with width/height: 100%
       against its *immediate* parent, which used to be an absolutely-
       positioned wrapper with a definite size. Inserting this button
       as the new immediate parent with only `display: block` (auto
       height) broke that chain - percentage heights resolve against an
       auto-height container per spec, so the preview silently collapsed
       to 0 height and the photo disappeared. Every other avatar spot
       this trigger wraps also expects a full-bleed child, so this is
       the correct default everywhere it's used, not a one-off fix. */
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    border-radius: inherit;
    position: relative;
}

.bn-avatar-lightbox-trigger img,
.bn-avatar-lightbox-trigger {
    border-radius: inherit;
}

.bn-avatar-lightbox-trigger:focus-visible {
    outline: 2px solid rgba(236, 196, 108, 0.7);
    outline-offset: 2px;
}

/* A subtle zoom-icon hint on hover/focus so the affordance is discoverable
   without adding permanent visual noise to every avatar on the page. */
.bn-avatar-lightbox-trigger::after {
    content: "\f00e"; /* la-search-plus (Line Awesome) glyph */
    font-family: "Line Awesome Free";
    font-weight: 900;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1em;
    background: rgba(0, 0, 0, 0.38);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.bn-avatar-lightbox-trigger:hover::after,
.bn-avatar-lightbox-trigger:focus-visible::after {
    opacity: 1;
}

@media (hover: none) {
    /* No hover on touch devices - the affordance would otherwise stay
       permanently invisible with no way to discover it. */
    .bn-avatar-lightbox-trigger::after {
        opacity: 0;
    }
}

/* Overlay */
.bn-avatar-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5vh 5vw;
    background: rgba(8, 6, 4, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bn-avatar-lightbox[hidden] {
    display: none;
}

.bn-avatar-lightbox.is-open {
    opacity: 1;
}

html.bn-avatar-lightbox-open {
    overflow: hidden;
}

.bn-avatar-lightbox__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: min(90vw, 640px);
    max-height: 90vh;
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.bn-avatar-lightbox.is-open .bn-avatar-lightbox__dialog {
    transform: scale(1);
}

.bn-avatar-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    background: #1c1712;
    object-fit: contain;
}

.bn-avatar-lightbox__caption {
    margin: 0;
    color: #fff;
    font-family: Sora, system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.bn-avatar-lightbox__caption:empty {
    display: none;
}

.bn-avatar-lightbox__close {
    position: absolute;
    top: -46px;
    right: -8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.bn-avatar-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.32);
}

.bn-avatar-lightbox__close:focus-visible {
    outline: 2px solid rgba(236, 196, 108, 0.7);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .bn-avatar-lightbox__close {
        top: -44px;
        right: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bn-avatar-lightbox,
    .bn-avatar-lightbox__dialog,
    .bn-avatar-lightbox__close {
        transition: none;
    }
}
