/**
 * Public profile header card: avatar + metrics + tagline + bio.
 * Used on u.html and My Playlists public profile preview.
 */

/* Gradient typography (matches homepage / public profile) */
.hero-headline {
    font-weight: 900;
    background: linear-gradient(180deg, rgb(0 0 0) 0%, rgb(24 24 27) 35%, rgb(63 63 70) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.dark .hero-headline {
    background: linear-gradient(180deg, rgb(250 250 250) 0%, rgb(212 212 216) 40%, rgb(161 161 170) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.hero-subhead {
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, rgb(148 163 184) 0%, rgb(100 116 139) 25%, rgb(51 65 85) 50%, rgb(30 41 59) 85%, rgb(15 23 42) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.dark .hero-subhead {
    background: linear-gradient(90deg, rgb(248 250 252) 0%, rgb(203 213 225) 35%, rgb(148 163 184) 65%, rgb(71 85 105) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* Public profile card: no divider between header block and tagline/bio */
#u-profile .card > .card-header.u-profile-header,
#mpl-public-profile-preview .card > .card-header.u-profile-header {
    border-bottom: none;
    padding-bottom: 0.25rem;
}
#u-profile .card > .card-content,
#mpl-public-profile-preview .card > .card-content {
    padding-top: 0.5rem;
}

/* Public profile: avatar + title side-by-side on phones (avoid stacking below thumbnail). */
.u-profile-header {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
}
.u-profile-header--stacked-stats {
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
}
.u-profile-header-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}
@media (min-width: 640px) {
    .u-profile-header { gap: 1rem; }
    .u-profile-header-row { gap: 1rem; }
    .u-profile-header--stacked-stats { gap: 0.875rem; }
}
.u-profile-header-text { min-width: 0; flex: 1; }
.u-profile-header #u-header-avatar-mount,
.u-profile-header #mpl-preview-avatar-mount {
    flex-shrink: 0;
}
.u-profile-header .playlists-profile-avatar-wrap {
    width: 72px;
    max-width: 72px;
}
@media (min-width: 640px) {
    .u-profile-header .playlists-profile-avatar-wrap {
        width: 96px;
        max-width: 96px;
    }
}
.u-profile-header #u-username,
.u-profile-header #mpl-preview-username {
    font-size: 1.125rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
@media (min-width: 640px) {
    .u-profile-header #u-username,
    .u-profile-header #mpl-preview-username { font-size: 1.875rem; line-height: 1.15; }
}
@media (min-width: 1024px) {
    .u-profile-header #u-username,
    .u-profile-header #mpl-preview-username { font-size: 2.25rem; }
}
.u-profile-header #u-subhead {
    font-size: 0.75rem;
    line-height: 1.35;
    margin-top: 0.375rem;
}
@media (min-width: 640px) {
    .u-profile-header #u-subhead { font-size: 1.125rem; margin-top: 0.5rem; }
}
.u-profile-subcopy,
.u-profile-header .u-profile-metric-item {
    font-size: 0.75rem;
    line-height: 1.35;
    margin-top: 0.375rem;
}
@media (min-width: 640px) {
    .u-profile-subcopy,
    .u-profile-header .u-profile-metric-item { font-size: 1.125rem; margin-top: 0.5rem; }
}
.u-profile-subcopy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 1rem;
    margin-top: 0.375rem;
}

/* Staging / extended profile: title + social row + curated row (Lists live in stats grid). */
.u-profile-metrics--stacked {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
    margin-top: 0.375rem;
}
.u-profile-metrics-social {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.375rem 1.25rem;
}
.u-profile-metrics-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    max-width: 100%;
}
.u-profile-metrics-actions__group {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    max-width: 100%;
}
.u-profile-metrics-actions .pls-media-act-btn,
.u-profile-metrics-actions .u-profile-follow-btn,
.u-profile-metrics-actions .u-profile-share-btn {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    display: inline-flex;
}
.u-profile-metrics-actions .pls-media-act-btn {
    min-height: 2rem;
}
.u-profile-follow-btn,
.u-profile-share-btn {
    flex-shrink: 0;
    min-height: 2rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}
.u-profile-follow-btn .pls-media-act-btn__label,
.u-profile-share-btn .pls-media-act-btn__label {
    display: inline;
}
.u-profile-follow-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.u-profile-follow-btn .pls-media-act-btn__icon .pls-lucide-icon,
.u-profile-share-btn .pls-media-act-btn__icon .pls-lucide-icon {
    width: 16px;
    height: 16px;
}
@media (min-width: 769px) {
    body:not(.mobile-tab-bar-viewport) .u-profile-metrics-actions__group {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem 0.75rem;
    }

    body:not(.mobile-tab-bar-viewport) .u-profile-metrics-actions .u-profile-follow-btn,
    body:not(.mobile-tab-bar-viewport) .u-profile-metrics-actions .u-profile-share-btn {
        width: auto;
        max-width: none;
        flex: 0 0 auto;
    }
}
@media (min-width: 640px) {
    .u-profile-metrics-actions .pls-media-act-btn {
        min-height: 2.125rem;
    }
    .u-profile-follow-btn,
    .u-profile-share-btn {
        min-height: 2.125rem;
        padding: 0.3125rem 0.75rem;
        font-size: 0.8125rem;
    }
    .u-profile-follow-btn .pls-media-act-btn__icon .pls-lucide-icon,
    .u-profile-share-btn .pls-media-act-btn__icon .pls-lucide-icon {
        width: 18px;
        height: 18px;
    }
}
.u-profile-metrics--stacked .u-profile-metric-item {
    margin-top: 0;
}
@media (min-width: 640px) {
    .u-profile-metrics--stacked {
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    .u-profile-metrics-social {
        gap: 0.5rem 1.5rem;
    }
}
@media (min-width: 640px) {
    .u-profile-subcopy-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem 1.25rem;
        margin-top: 0.5rem;
    }
    .u-profile-subcopy-grid .u-profile-metric-item { margin-top: 0; }
}
@media (min-width: 1024px) {
    .u-profile-subcopy-grid { flex-wrap: nowrap; gap: 0.5rem 1.5rem; }
}
#u-tagline,
#mpl-preview-tagline {
    font-size: 0.75rem;
    line-height: 1.35;
    margin: 0;
}
@media (min-width: 640px) {
    #u-tagline,
    #mpl-preview-tagline { font-size: 1.125rem; }
}

/* My Playlists: labeled preview above the public-profile mirror card */
.mpl-public-preview-label-wrap {
    margin-bottom: 1.5rem;
}

.mpl-public-preview-label-wrap.hidden {
    display: none;
}

.mpl-public-preview-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    min-width: 0;
}

.mpl-public-preview-label-wrap .card-title,
#mpl-public-preview-label.card-title {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
}

.mpl-public-preview-label-note {
    margin: 0.35rem 0 0;
}

.mpl-public-preview-label-note.hidden {
    display: none;
}

.mpl-public-preview-view-link {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: rgb(var(--primary));
    text-decoration: underline;
    text-underline-offset: 4px;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Narrow phones: stack label + link so they never overlap */
@media (max-width: 430px) {
    .mpl-public-preview-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

.mpl-public-preview-view-link.hidden {
    display: none;
}

.mpl-public-preview-view-link:hover {
    opacity: 0.8;
}

/* Staging / extended public profile: stats breakdown grid — full width below avatar row */
.u-profile-highlights-mount {
    margin-top: 0.5rem;
    width: 100%;
    min-width: 0;
}
.u-profile-highlights-mount--full {
    margin-top: 0;
    padding-top: 0.625rem;
    border-top: 1px solid rgb(var(--border));
}
.u-profile-stats-grid-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
    body.has-tab-bar .u-profile-stats-grid-wrap,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid-wrap {
        overflow: visible;
    }
    body.has-tab-bar .u-profile-stats-grid thead,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid thead {
        position: relative;
        z-index: 2;
    }
    body.has-tab-bar .u-profile-stats-grid th,
    body.has-tab-bar .u-profile-stats-grid td,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid th,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid td {
        padding: 0.3rem 0.0625rem;
    }
    body.has-tab-bar .u-profile-stats-grid thead th:first-child,
    body.has-tab-bar .u-profile-stats-grid tbody th[scope='row'],
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid thead th:first-child,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid tbody th[scope='row'] {
        width: 24%;
        padding-right: 0.25rem;
    }
}
.u-profile-stats-grid {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.8125rem;
    line-height: 1.4;
}
@media (min-width: 640px) {
    .u-profile-stats-grid { font-size: 0.9375rem; }
}
@media (min-width: 768px) {
    .u-profile-stats-grid { font-size: 1.0625rem; line-height: 1.45; }
}
.u-profile-stats-grid th,
.u-profile-stats-grid td {
    padding: 0.375rem 0.25rem;
    text-align: center;
    border-bottom: 1px solid rgb(var(--border));
    vertical-align: middle;
}
@media (min-width: 640px) {
    .u-profile-stats-grid th,
    .u-profile-stats-grid td { padding: 0.5rem 0.375rem; }
}
.u-profile-stats-grid thead th {
    font-weight: 700;
    color: rgb(var(--muted-foreground));
    white-space: nowrap;
}
.u-profile-stats-col-label {
    display: inline;
}
.u-profile-stats-col-icon-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: rgb(var(--muted-foreground));
}
.u-profile-stats-col-icon-wrap .pls-lucide-icon {
    display: block;
    flex-shrink: 0;
}
.u-profile-stats-col-header {
    position: relative;
}
/* Visible column header tips — icon mode only (native title is delayed / absent on touch) */
@media (max-width: 768px) {
    @media (hover: hover) and (pointer: fine) {
        body.has-tab-bar .u-profile-stats-col-header::after {
            content: attr(data-col-tip);
            position: absolute;
            left: 50%;
            top: auto;
            bottom: calc(100% + 0.3rem);
            transform: translateX(-50%);
            padding: 0.2rem 0.45rem;
            font-size: 0.6875rem;
            font-weight: 600;
            line-height: 1.2;
            white-space: nowrap;
            background: rgb(24 24 27);
            color: rgb(250 250 250);
            border: 1px solid rgb(63 63 70);
            border-radius: 0.25rem;
            box-shadow: 0 2px 8px rgb(0 0 0 / 0.22);
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.12s ease, visibility 0.12s ease;
            z-index: 50;
        }
        .dark body.has-tab-bar .u-profile-stats-col-header::after {
            background: rgb(244 244 245);
            color: rgb(24 24 27);
            border-color: rgb(212 212 216);
        }
        body.has-tab-bar .u-profile-stats-col-header:hover::after,
        body.has-tab-bar .u-profile-stats-col-header:focus-visible::after {
            opacity: 1;
            visibility: visible;
        }
    }
    body.has-tab-bar .u-profile-stats-col-header.u-profile-stats-col-header--show-tip::after {
        content: attr(data-col-tip);
        position: absolute;
        left: 50%;
        top: auto;
        bottom: calc(100% + 0.3rem);
        transform: translateX(-50%);
        padding: 0.2rem 0.45rem;
        font-size: 0.6875rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        background: rgb(24 24 27);
        color: rgb(250 250 250);
        border: 1px solid rgb(63 63 70);
        border-radius: 0.25rem;
        box-shadow: 0 2px 8px rgb(0 0 0 / 0.22);
        opacity: 1;
        visibility: visible;
        pointer-events: none;
        z-index: 50;
    }
    .dark body.has-tab-bar .u-profile-stats-col-header.u-profile-stats-col-header--show-tip::after {
        background: rgb(244 244 245);
        color: rgb(24 24 27);
        border-color: rgb(212 212 216);
    }
}
@media (hover: hover) and (pointer: fine) {
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header::after {
        content: attr(data-col-tip);
        position: absolute;
        left: 50%;
        top: auto;
        bottom: calc(100% + 0.3rem);
        transform: translateX(-50%);
        padding: 0.2rem 0.45rem;
        font-size: 0.6875rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        background: rgb(24 24 27);
        color: rgb(250 250 250);
        border: 1px solid rgb(63 63 70);
        border-radius: 0.25rem;
        box-shadow: 0 2px 8px rgb(0 0 0 / 0.22);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.12s ease, visibility 0.12s ease;
        z-index: 50;
    }
    .dark body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header::after {
        background: rgb(244 244 245);
        color: rgb(24 24 27);
        border-color: rgb(212 212 216);
    }
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header:hover::after,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header:focus-visible::after {
        opacity: 1;
        visibility: visible;
    }
}
body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header.u-profile-stats-col-header--show-tip::after {
    content: attr(data-col-tip);
    position: absolute;
    left: 50%;
    top: auto;
    bottom: calc(100% + 0.3rem);
    transform: translateX(-50%);
    padding: 0.2rem 0.45rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    background: rgb(24 24 27);
    color: rgb(250 250 250);
    border: 1px solid rgb(63 63 70);
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.22);
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    z-index: 50;
}
.dark body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-header.u-profile-stats-col-header--show-tip::after {
    background: rgb(244 244 245);
    color: rgb(24 24 27);
    border-color: rgb(212 212 216);
}
/* Icon column headers — mobile tab bar only (<768px) */
@media (max-width: 768px) {
    body.has-tab-bar .u-profile-stats-col-label {
        display: none;
    }
    body.has-tab-bar .u-profile-stats-col-icon-wrap {
        display: inline-flex;
    }
    body.has-tab-bar .u-profile-stats-grid thead th.u-profile-stats-col-header {
        width: 2rem;
        min-width: 2rem;
        padding-left: 0.125rem;
        padding-right: 0.125rem;
        cursor: help;
    }
}
body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-label {
    display: none;
}
body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-icon-wrap {
    display: inline-flex;
}
body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-grid thead th.u-profile-stats-col-header {
    width: 2rem;
    min-width: 2rem;
    padding-left: 0.125rem;
    padding-right: 0.125rem;
    cursor: help;
}
@media (min-width: 640px) and (max-width: 768px) {
    body.has-tab-bar .u-profile-stats-col-icon-wrap .pls-lucide-icon,
    body.mobile-tab-bar-viewport.has-tab-bar .u-profile-stats-col-icon-wrap .pls-lucide-icon {
        width: 18px;
        height: 18px;
    }
}
.u-profile-stats-grid thead th:first-child,
.u-profile-stats-grid tbody th[scope='row'] {
    text-align: left;
    padding-left: 0;
    width: 28%;
}
.u-profile-stats-grid thead th:last-child,
.u-profile-stats-grid tbody td:last-child {
    text-align: right;
    padding-right: 0;
}
.u-profile-stats-grid tbody th[scope='row'] {
    font-weight: 600;
    color: rgb(var(--foreground));
    white-space: nowrap;
    padding-right: 0.5rem;
}
.u-profile-stats-grid tbody td:not(:last-child) {
    text-align: center;
}
.u-profile-stats-link,
.u-profile-stats-media-link,
.u-profile-metric-link {
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: rgb(var(--primary));
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.u-profile-stats-link {
    font-size: 1.05em;
}
.u-profile-stats-media-link {
    font-size: inherit;
    font-weight: 600;
    text-align: left;
}
.u-profile-stats-link:hover,
.u-profile-stats-media-link:hover,
.u-profile-metric-link:hover {
    opacity: 0.85;
}
.u-profile-stats-zero {
    color: rgb(var(--muted-foreground));
    opacity: 0.75;
    font-size: 0.95em;
}
.u-profile-metric-link {
    text-decoration: underline;
}

/* Stats grid / metric links scroll to section title (Favorites, Watchlist, …). */
#u-library-root [data-section-key] > .card-header.u-profile-section-scroll-target,
#mpl-library-root [data-section-key] > .card-header.u-profile-section-scroll-target,
#u-library-root [data-section-key] .lane-header,
#mpl-library-root [data-section-key] .lane-header,
#u-library-root [data-section-key] [data-media-type],
#mpl-library-root [data-section-key] [data-media-type] {
    scroll-margin-top: var(--profile-library-toolbar-offset, 6.5rem);
}
