/* A ficha flutua fora do feed para escapar de recortes e colunas. */
.profile-peek {
    position: fixed;
    inset: auto;
    z-index: 12000;
    width: min(348px, calc(100vw - 32px));
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    /* A inclinação e a sombra não devem criar rolagem no popover nativo. */
    overflow: visible;
    color: var(--text, #d6d9de);
    font-family: var(--font, system-ui, sans-serif);
    text-align: left;
    perspective: 1100px;
    isolation: isolate;
    --peek-rx: 0deg;
    --peek-ry: 0deg;
    --peek-light-x: 25%;
    --peek-light-y: 0%;
}

.profile-peek[hidden] { display: none !important; }
.profile-peek::backdrop { background: transparent; pointer-events: none; }
.profile-peek__entrance { transform-origin: 20% 0%; }
.profile-peek[data-side="above"] .profile-peek__entrance { transform-origin: 20% 100%; }
.profile-peek.is-visible .profile-peek__entrance {
    animation: peek-unfold 520ms cubic-bezier(.16, 1, .3, 1) both;
}

.profile-peek__paper {
    position: relative;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid color-mix(in srgb, var(--accent, #6fa0e8) 18%, var(--border, #313844));
    border-radius: 24px;
    background: var(--surface, #1e2126);
    box-shadow: 0 28px 70px -18px rgba(12, 23, 42, .38),
                0 8px 22px -9px rgba(12, 23, 42, .18),
                0 0 0 1px color-mix(in srgb, var(--surface, #1e2126) 65%, transparent);
    transform: rotateX(var(--peek-rx)) rotateY(var(--peek-ry));
    transition: transform 180ms ease-out;
    scrollbar-width: none;
}

/* Em janelas baixas o conteúdo continua rolável, sem uma barra sobre o card. */
.profile-peek__paper::-webkit-scrollbar { display: none; }

.profile-peek__paper::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(ellipse at var(--peek-light-x) var(--peek-light-y),
        rgba(255,255,255,.14), transparent 58%);
    opacity: .55;
    transition: opacity 250ms ease;
}

.profile-peek:hover .profile-peek__paper::after { opacity: 1; }
.profile-peek a { color: inherit; text-decoration: none; }
.profile-peek button { font: inherit; }
.profile-peek a:focus-visible,
.profile-peek button:focus-visible {
    outline: 3px solid var(--accent, #6fa0e8);
    outline-offset: 4px;
}

.profile-peek__cover {
    position: relative;
    height: 122px;
    overflow: hidden;
    background: radial-gradient(ellipse at 8% 15%, #b4ddd2 0, transparent 52%),
                radial-gradient(ellipse at 90% 90%, #99b6e7 0, transparent 55%),
                linear-gradient(125deg, #607fb8, #b8c8ee 55%, #e4d1eb);
}

.profile-peek__cover::before {
    content: "";
    position: absolute;
    width: 230px;
    height: 230px;
    right: -65px;
    top: -156px;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 50%;
    box-shadow: 0 0 0 26px rgba(255,255,255,.09), 0 0 0 55px rgba(255,255,255,.06);
}

.profile-peek__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-peek__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 38%, rgba(12,23,42,.23));
}

.profile-peek__online {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 999px;
    background: rgba(20,38,43,.6);
    color: #fff;
    font-size: 10px;
    font-weight: 650;
    backdrop-filter: blur(12px);
}

.profile-peek__online::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #79eab5;
    box-shadow: 0 0 0 3px rgba(121,234,181,.13);
}

.profile-peek__body { position: relative; z-index: 1; padding: 0 22px 20px; }
.profile-peek__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.profile-peek__avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 82px;
    height: 82px;
    margin-top: -36px;
    border: 4px solid var(--surface, #1e2126);
    border-radius: 26px;
    background: var(--surface-2, #262a31);
    color: var(--accent, #6fa0e8);
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 5px 14px rgba(12,23,42,.12);
}
.profile-peek__avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.profile-peek__eyebrow {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-bottom: 7px;
    color: var(--text-2, #9aa2ae);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
}
.profile-peek__eyebrow svg { width: 13px; height: 13px; color: var(--accent, #6fa0e8); }
.profile-peek__identity { margin-top: 13px; }
.profile-peek__name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    color: var(--text-1, #eceef2);
    font-size: 20px;
    font-weight: 750;
    letter-spacing: -.6px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.profile-peek__name > a:hover { color: var(--accent, #6fa0e8); }
.profile-peek__badges { display: inline-flex; align-items: center; gap: 3px; }
.profile-peek__handle { display: inline-block; margin-top: 4px; color: var(--text-2, #9aa2ae) !important; font-size: 12px; }
.profile-peek__bio {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin: 13px 0 0;
    color: var(--text, #d6d9de);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.profile-peek__location { display: flex; align-items: center; gap: 5px; margin-top: 10px; color: var(--text-2, #9aa2ae); font-size: 11px; line-height: 1.4; }
.profile-peek__location svg { width: 13px; height: 13px; flex-shrink: 0; }
.profile-peek__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 17px 0 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border, #313844);
    border-bottom: 1px solid var(--border, #313844);
}
.profile-peek__stat { display: flex; flex-direction: column; text-align: center; }
.profile-peek__stat + .profile-peek__stat { border-left: 1px solid var(--border, #313844); }
.profile-peek__stat dt { order: 2; color: var(--text-2, #9aa2ae); font-size: 10px; }
.profile-peek__stat dd { margin: 0 0 3px; color: var(--text-1, #eceef2); font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.profile-peek__actions { display: flex; gap: 9px; }
.profile-peek__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 1;
    min-height: 41px;
    padding: 8px 12px;
    border: 1px solid var(--border, #313844);
    border-radius: 13px;
    background: var(--surface-2, #262a31);
    color: var(--text-1, #eceef2) !important;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    transition: background 180ms, box-shadow 180ms, transform 180ms;
}
.profile-peek__button svg { width: 16px; height: 16px; flex-shrink: 0; }
.profile-peek__button:hover { transform: translateY(-1px); background: var(--nav-hover, #23272e); }
.profile-peek__button--primary {
    border-color: transparent;
    background: var(--accent, #6fa0e8);
    color: var(--bg, #141619) !important;
    box-shadow: 0 4px 12px var(--accent-soft, rgba(111,160,232,.14));
}
:root[data-theme="light"] .profile-peek__button--primary { color: #fff !important; }
.profile-peek__button--primary:hover { background: var(--accent, #6fa0e8); box-shadow: 0 5px 17px var(--accent-glow, rgba(111,160,232,.3)); }
.profile-peek__button:disabled,
.profile-peek__button[aria-disabled="true"] { opacity: .6; cursor: wait; transform: none; }
.profile-peek__button.is-declined { opacity: 1; cursor: default; color: var(--text-2); transform: none; box-shadow: none; }
.profile-peek__button.is-friend { color: var(--accent, #6fa0e8) !important; background: var(--accent-soft, rgba(111,160,232,.14)); }
.profile-peek__joined { margin-top: 13px; color: var(--text-2, #9aa2ae); font-size: 10px; text-align: center; }
.profile-peek__status { margin-top: 10px; color: var(--text-2, #9aa2ae); font-size: 12px; line-height: 1.5; }
.profile-peek__error { padding: 25px 22px; }
.profile-peek__error p { margin-bottom: 15px; font-size: 13px; line-height: 1.6; }
.profile-peek__loading { padding: 18px 22px 22px; }
.profile-peek__skeleton {
    border-radius: 8px;
    background: linear-gradient(105deg, var(--surface-2, #262a31) 30%, var(--border-hover, #39414f) 50%, var(--surface-2, #262a31) 70%);
    background-size: 220% 100%;
    animation: peek-shimmer 1.5s linear infinite;
}
.profile-peek__skeleton--avatar { width: 76px; height: 76px; margin-top: -50px; margin-bottom: 17px; border: 4px solid var(--surface, #1e2126); border-radius: 24px; position: relative; }
.profile-peek__skeleton--name { width: 58%; height: 18px; margin-bottom: 10px; }
.profile-peek__skeleton--line { height: 10px; margin-bottom: 12px; }
.profile-peek__skeleton--short { width: 76%; }
.profile-peek__skeleton--button { height: 41px; margin-top: 20px; }
.profile-peek__sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes peek-unfold {
    0% { opacity: 0; transform: translateY(12px) rotateX(-14deg) rotateY(-9deg) rotateZ(-1.5deg) scale(.96); }
    65% { opacity: 1; transform: translateY(-2px) rotateX(2deg) rotateY(1deg) rotateZ(.3deg) scale(1); }
    100% { opacity: 1; transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0) scale(1); }
}
@keyframes peek-shimmer { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) {
    .profile-peek *, .profile-peek *::after { animation: none !important; transition: none !important; }
    .profile-peek__paper, .profile-peek__button:hover { transform: none; }
}
