/* Final refinements for the public profile page.
 * Loaded only on users:user_view after the global theme and profile stylesheet.
 */

.public-profile-page .profile-overview-stats {
    align-items: stretch;
}

.public-profile-page .profile-overview-stat {
    position: relative;
    isolation: isolate;
    min-height: 5.35rem;
    overflow: hidden;
    padding: 0.78rem 0.9rem;
    border-color: rgba(32, 36, 40, 0.1);
    background:
        radial-gradient(circle at 100% 0%, rgba(46, 111, 149, 0.06), transparent 5.5rem),
        linear-gradient(145deg, #ffffff, #f7fafc);
    box-shadow: 0 0.45rem 1.2rem rgba(32, 36, 40, 0.055);
}

.public-profile-page .profile-overview-stat::after {
    position: absolute;
    z-index: -1;
    right: -1.7rem;
    bottom: -2.1rem;
    width: 5rem;
    height: 5rem;
    border: 1px solid rgba(46, 111, 149, 0.08);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.public-profile-page .profile-overview-stat__icon {
    position: relative;
    width: 3.05rem;
    height: 3.05rem;
    flex: 0 0 3.05rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 1rem;
    box-shadow:
        0 0.55rem 1.15rem rgba(32, 36, 40, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.public-profile-page .profile-overview-stat__icon::after {
    position: absolute;
    inset: 0.28rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.76rem;
    content: "";
    pointer-events: none;
}

.public-profile-page .profile-overview-stat__icon svg {
    position: relative;
    z-index: 1;
    width: 1.45rem;
    height: 1.45rem;
    stroke-width: 2.05;
}

.public-profile-page .profile-overview-stat:nth-child(1) .profile-overview-stat__icon {
    background: linear-gradient(145deg, #4d91b7, #245a78);
    color: #ffffff;
}

.public-profile-page .profile-overview-stat:nth-child(2) .profile-overview-stat__icon {
    background: linear-gradient(145deg, #cf4050, #901720);
    color: #ffffff;
    box-shadow:
        0 0.55rem 1.15rem rgba(181, 30, 42, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.public-profile-page .profile-overview-stat:nth-child(3) .profile-overview-stat__icon {
    background: linear-gradient(145deg, #35424a, #1d4963);
    color: #ffffff;
}

.public-profile-page .profile-overview-stat > div:last-child {
    min-width: 0;
}

.public-profile-page .profile-overview-stat strong {
    font-size: 1.15rem;
    line-height: 1.1;
}

.public-profile-page .profile-overview-stat > div:last-child > span {
    margin-top: 0.24rem;
    color: #69757e;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.3;
}

/* Keep the active share menu above every sibling card and outside paint containment. */
.public-profile-page .profile-section-card:has(.profile-post-share[open]),
.public-profile-page .profile-section-card.is-share-open {
    position: relative;
    z-index: 45;
    overflow: visible;
    content-visibility: visible;
    contain: none;
}

.public-profile-page .profile-post-list {
    position: relative;
    isolation: isolate;
    overflow: visible;
}

.public-profile-page .profile-post-card {
    isolation: isolate;
}

.public-profile-page .profile-post-card:has(.profile-post-share[open]),
.public-profile-page .profile-post-card.is-share-open {
    z-index: 80;
    overflow: visible;
    transform: none;
}

.public-profile-page .profile-post-card.is-share-open:hover,
.public-profile-page .profile-post-card.is-share-open:focus-within {
    transform: none;
}

.public-profile-page .profile-post-share {
    z-index: 2;
}

.public-profile-page .profile-post-share[open],
.public-profile-page .profile-post-card.is-share-open .profile-post-share {
    z-index: 100;
}

.public-profile-page .profile-post-share[open] > summary {
    border-color: rgba(46, 111, 149, 0.4);
    background: var(--profile-blue-soft);
    color: var(--profile-blue-deep);
    box-shadow: 0 0 0 0.2rem rgba(46, 111, 149, 0.09);
}

.public-profile-page .profile-post-share__menu {
    z-index: 120;
    width: min(13.5rem, calc(100vw - 2rem));
    max-height: min(19rem, calc(100vh - 2rem));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-color: rgba(32, 36, 40, 0.14);
    background: rgba(255, 255, 255, 0.995);
    box-shadow: 0 1.15rem 2.8rem rgba(24, 31, 36, 0.22);
    scrollbar-width: thin;
}

.public-profile-page .profile-post-share.is-dropup .profile-post-share__menu {
    top: auto;
    bottom: calc(100% + 0.48rem);
}

.public-profile-page .profile-post-share:not(.is-dropup) .profile-post-share__menu {
    top: calc(100% + 0.48rem);
    bottom: auto;
}

.public-profile-page .profile-post-share__menu a {
    position: relative;
    z-index: 1;
    min-height: 2.55rem;
    padding-inline: 0.7rem;
}

@media (max-width: 575.98px) {
    .public-profile-page .profile-overview-stat {
        min-height: 4.85rem;
    }

    .public-profile-page .profile-overview-stat__icon {
        width: 2.8rem;
        height: 2.8rem;
        flex-basis: 2.8rem;
    }

    .public-profile-page .profile-post-share__menu {
        right: 0;
        width: min(14rem, calc(100vw - 1.5rem));
    }
}

@media (forced-colors: active) {
    .public-profile-page .profile-overview-stat__icon,
    .public-profile-page .profile-post-share__menu {
        border: 1px solid CanvasText;
        forced-color-adjust: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-profile-page .profile-post-card.is-share-open {
        transform: none;
    }
}
