/* ═══════════════════════════════════════════════════════════════════
   user-profile.css — /Users/Profile (profilo pubblico dell'utente)

   Stessa famiglia del profilo issuer (pages/issuer-profile.css) ma con una
   testata piu' compatta: avatar e azioni social sulla stessa riga, niente
   divisore orizzontale, fascia con l'accento del tenant.

   Le primitive (card, chip, bottoni icona, stato vuoto) arrivano da
   assets/css/user-pages.css, che va caricato prima di questo foglio.
   Tutte le animazioni sono disattivate sotto prefers-reduced-motion,
   in fondo al file.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   ANIMAZIONI
   ═══════════════════════════════════════════════ */

@keyframes usr-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes usr-pop {
    from {
        opacity: 0;
        transform: scale(0.86);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes usr-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════ */

.usr-hero {
    margin-bottom: 36px;
    animation: usr-rise 0.5s cubic-bezier(.2, .7, .3, 1) both;
    transition: box-shadow 0.25s ease;
}

    .usr-hero:hover {
        box-shadow: 0 10px 40px rgba(26, 26, 24, 0.07);
    }

/* fascia: sfumatura costruita sull'accento del tenant, cosi' cambia col tema.
   La prima dichiarazione e' il fallback per i browser senza color-mix(). */
.usr-hero-banner {
    position: relative;
    height: 124px;
    overflow: hidden;
    background: #f1f4fb;
    background: radial-gradient(120% 150% at 10% 0%, color-mix(in srgb, var(--up-accent) 24%, #fff) 0%, transparent 62%), radial-gradient(90% 130% at 92% 8%, color-mix(in srgb, var(--up-accent) 13%, #fff) 0%, transparent 58%), linear-gradient(135deg, color-mix(in srgb, var(--up-accent) 9%, #fff), color-mix(in srgb, var(--up-accent) 3%, #fff));
}

    /* trama a puntini, appena percettibile */
    .usr-hero-banner::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: radial-gradient(circle, color-mix(in srgb, var(--up-accent) 26%, transparent) 1px, transparent 1px);
        background-size: 18px 18px;
        opacity: 0.3;
    }

.usr-hero-body {
    padding: 0 36px 32px;
    position: relative;
}

/* ── testata: avatar a sinistra, social a destra ── */
.usr-hero-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.usr-avatar {
    display: inline-flex;
    margin-top: -52px;
    position: relative;
    z-index: 2;
    animation: usr-pop 0.55s cubic-bezier(.2, .9, .3, 1.15) 0.08s both;
}

    .usr-avatar img {
        width: 108px;
        height: 108px;
        object-fit: cover;
        border-radius: 50%;
        border: 4px solid #fff;
        background: #fff;
        box-shadow: 0 10px 28px rgba(26, 26, 24, 0.14);
        display: block;
        transition: transform 0.25s cubic-bezier(.2, .7, .3, 1), box-shadow 0.25s ease;
    }

    .usr-avatar:hover img {
        transform: scale(1.04);
        box-shadow: 0 14px 32px rgba(26, 26, 24, 0.18);
    }

/* ── nome, ruolo, bio ── */
.usr-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--up-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 8px;
    animation: usr-rise 0.5s ease 0.12s both;
}

.usr-job {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--up-accent);
    margin-bottom: 14px;
    animation: usr-rise 0.5s ease 0.16s both;
}

    /* pallino d'accento al posto del vecchio divisore */
    .usr-job::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
        flex-shrink: 0;
    }

.usr-about {
    font-size: 14px;
    color: var(--up-text-soft);
    line-height: 1.75;
    max-width: 620px;
    margin: 0 0 22px;
    animation: usr-rise 0.5s ease 0.2s both;
}

/* ── chip di contatto ── */
.usr-chips {
    margin-bottom: 4px;
}

    .usr-chips .up-chip {
        transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s cubic-bezier(.2, .7, .3, 1);
        animation: usr-rise 0.45s ease both;
    }

        .usr-chips .up-chip:hover {
            transform: translateY(-2px);
        }

        .usr-chips .up-chip:nth-child(1) {
            animation-delay: 0.24s;
        }

        .usr-chips .up-chip:nth-child(2) {
            animation-delay: 0.29s;
        }

        .usr-chips .up-chip:nth-child(3) {
            animation-delay: 0.34s;
        }

/* ── social ── */
.usr-social {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

    .usr-social > * {
        animation: usr-rise 0.45s ease both;
    }

        .usr-social > *:nth-child(1) {
            animation-delay: 0.18s;
        }

        .usr-social > *:nth-child(2) {
            animation-delay: 0.22s;
        }

        .usr-social > *:nth-child(3) {
            animation-delay: 0.26s;
        }

        .usr-social > *:nth-child(4) {
            animation-delay: 0.3s;
        }

        .usr-social > *:nth-child(5) {
            animation-delay: 0.34s;
        }

        .usr-social > *:nth-child(6) {
            animation-delay: 0.38s;
        }

.usr-social-btn {
    transition: transform 0.2s cubic-bezier(.2, .7, .3, 1), background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.2s;
}

    /* sull'hover prende l'accento del tenant, non il nero del componente base */
    .usr-social-btn:hover {
        transform: translateY(-3px);
        background: var(--up-accent);
        border-color: var(--up-accent);
        color: #fff;
        box-shadow: 0 8px 18px color-mix(in srgb, var(--up-accent) 30%, transparent);
    }

/* ── copia link: il bottone stesso diventa la conferma ── */
.usr-copy-btn {
    transition: transform 0.2s cubic-bezier(.2, .7, .3, 1), background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.2s;
}

    .usr-copy-btn:hover {
        transform: translateY(-3px);
        background: var(--up-text);
        border-color: var(--up-text);
        color: #fff;
    }

    .usr-copy-btn .usr-copy-idle,
    .usr-copy-btn .usr-copy-done {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
    }

    .usr-copy-btn .usr-copy-done {
        display: none;
    }

    .usr-copy-btn.is-copied .usr-copy-idle {
        display: none;
    }

    .usr-copy-btn.is-copied .usr-copy-done {
        display: inline-flex;
        animation: usr-pop 0.3s cubic-bezier(.2, .9, .3, 1.3) both;
    }

    .usr-copy-btn.is-copied,
    .usr-copy-btn.is-copied:hover {
        background: var(--up-success);
        border-color: var(--up-success);
        color: #fff;
        transform: none;
        box-shadow: none;
    }

/* ═══════════════════════════════════════════════
   BADGE: etichetta, caricamento, contenuto
   ═══════════════════════════════════════════════ */

.usr-badges-label {
    margin-bottom: 10px;
    animation: usr-rise 0.45s ease 0.3s both;
}

#assertionsShowcase {
    animation: usr-rise 0.5s ease 0.34s both;
    min-height: 160px;
}

.usr-loading {
    text-align: center;
    padding: 56px 24px;
}

    .usr-loading p {
        font-size: 13px;
        color: var(--up-text-faint);
        margin: 16px 0 0;
    }

.usr-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    border: 3px solid var(--up-border);
    border-top-color: var(--up-accent);
    border-radius: 50%;
    animation: usr-spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════════
   GALLERIA BADGE
   Markup iniettato via AJAX da Views/Shared/_UserBadgesGallery.cshtml.
   Ha preso il posto della timeline verticale con le tab.
   ═══════════════════════════════════════════════ */

.usr-gallery-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.usr-gallery-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--up-text-soft);
}

    .usr-gallery-count i {
        color: var(--up-accent);
    }

/* ── filtro per anno: controllo segmentato ── */
.usr-years {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    background: var(--up-surface-chip);
    border: 1px solid var(--up-border);
    border-radius: 999px;
}

.usr-year {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--up-text-soft);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

    .usr-year:hover {
        color: var(--up-text);
    }

    .usr-year.is-active {
        background: var(--up-surface);
        color: var(--up-accent);
        box-shadow: 0 1px 3px rgba(26, 26, 24, 0.12);
    }

    .usr-year:focus-visible {
        outline: 2px solid var(--up-accent);
        outline-offset: 2px;
    }

/* ── griglia ── */
.usr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
    gap: 16px;
}

.usr-badge-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 26px 16px 18px;
    background: var(--up-surface);
    border: 1px solid var(--up-border);
    border-radius: var(--up-radius-md);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(.2, .7, .3, 1), border-color 0.25s, box-shadow 0.25s;
    animation: usr-rise 0.45s ease both;
    animation-delay: min(calc(var(--usr-i, 0) * 45ms), 540ms);
}

    /* alone d'accento che si accende dietro il badge */
    .usr-badge-card::before {
        content: "";
        position: absolute;
        top: -28%;
        left: 50%;
        width: 170px;
        height: 170px;
        border-radius: 50%;
        background: radial-gradient(circle, color-mix(in srgb, var(--up-accent) 24%, transparent) 0%, transparent 70%);
        transform: translateX(-50%) scale(0.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s cubic-bezier(.2, .7, .3, 1);
    }

    .usr-badge-card:hover {
        transform: translateY(-6px);
        border-color: color-mix(in srgb, var(--up-accent) 45%, var(--up-border));
        box-shadow: 0 14px 30px rgba(26, 26, 24, 0.10);
    }

        .usr-badge-card:hover::before {
            opacity: 1;
            transform: translateX(-50%) scale(1);
        }

    .usr-badge-card:focus-visible {
        outline: 2px solid var(--up-accent);
        outline-offset: 3px;
    }

    .usr-badge-card.is-hidden {
        display: none;
    }

.usr-badge-art {
    position: relative;
    z-index: 1;
    margin-bottom: 14px;
}

    .usr-badge-art img {
        display: block;
        width: 94px;
        height: 94px;
        object-fit: contain;
        filter: drop-shadow(0 6px 12px rgba(26, 26, 24, 0.14));
        transition: transform 0.25s cubic-bezier(.2, .7, .3, 1), filter 0.25s ease;
    }

.usr-badge-card:hover .usr-badge-art img {
    transform: scale(1.07);
    filter: drop-shadow(0 10px 18px rgba(26, 26, 24, 0.2));
}

.usr-badge-title {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--up-text);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.usr-badge-date {
    position: relative;
    z-index: 1;
    margin-top: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--up-text-faint);
    text-transform: capitalize;
}

/* ── nessun risultato dopo il filtro ── */
.usr-grid-empty {
    padding: 48px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--up-text-faint);
    border: 1px dashed var(--up-border-strong);
    border-radius: var(--up-radius-md);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 600px) {
    .usr-hero-body {
        padding: 0 20px 26px;
    }

    .usr-hero-banner {
        height: 100px;
    }

    .usr-hero-top {
        gap: 12px;
        margin-bottom: 14px;
    }

    .usr-avatar {
        margin-top: -42px;
    }

        .usr-avatar img {
            width: 86px;
            height: 86px;
            border-width: 3px;
        }

    .usr-name {
        font-size: 21px;
    }

    .usr-social {
        gap: 6px;
    }

    .usr-grid {
        grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
        gap: 12px;
    }

    .usr-badge-art img {
        width: 78px;
        height: 78px;
    }

    .usr-gallery-bar {
        gap: 10px;
    }
}

/* ═══════════════════════════════════════════════
   MOVIMENTO RIDOTTO
   ═══════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .usr-profile *,
    .usr-profile *::before,
    .usr-profile *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
