/* ===== Public profile ===== */
.profile-page {
    padding-bottom: 64px;
}

.profile-hero {
    position: relative;
    margin-bottom: 0;
}

.profile-hero__cover {
    height: clamp(140px, 22vw, 220px);
    background:
        linear-gradient(135deg, rgba(124, 106, 255, 0.45) 0%, rgba(90, 69, 224, 0.35) 40%, rgba(255, 107, 53, 0.15) 100%),
        linear-gradient(180deg, var(--bg-elevated, #1a1a2e) 0%, var(--bg-base, #0f0f13) 100%);
    position: relative;
    overflow: hidden;
    /* Dissolve the banner into the page where the avatar/name straddle it,
       so there's no hard seam line cutting through the header content. */
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.profile-hero__cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.6;
}

.profile-hero__inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px clamp(28px, 4vw, 40px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px 28px;
    align-items: end;
    margin-top: -56px;
}

.profile-hero__avatar {
    flex-shrink: 0;
}

.profile-hero__avatar img,
.profile-hero__avatar .avatar-placeholder {
    width: clamp(100px, 14vw, 128px);
    height: clamp(100px, 14vw, 128px);
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-base, #08080c);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.profile-hero__avatar .avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent, #8b7cff), var(--accent-dim, #5c4fd4));
    color: #fff;
}

.profile-hero__main {
    min-width: 0;
    padding-bottom: 4px;
}

.profile-hero__name {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary, #f4f4f8);
    line-height: 1.15;
    margin-bottom: 4px;
}

.profile-hero__handle {
    font-size: 0.95rem;
    color: var(--text-muted, #6b6b7d);
    margin-bottom: 10px;
}

.profile-hero__handle a {
    color: var(--text-secondary, #a8a8b8);
}

.profile-hero__handle a:hover {
    color: var(--accent-text);
}

.profile-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-secondary, #a8a8b8);
}

.profile-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-hero__meta .fa-inline {
    margin-right: 0;
    color: var(--accent-text);
    opacity: 0.85;
}

.profile-active-dot {
    font-size: 0.45em;
    color: #4ade80;
    vertical-align: 0.15em;
}

.profile-hero__bio {
    margin-top: 14px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary, #a8a8b8);
    max-width: 560px;
}

.profile-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 8px;
}

.profile-hero__actions .btn {
    white-space: nowrap;
}

.profile-follow-form {
    margin: 0;
}

/* Stats grid */
.profile-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(28px, 4vw, 40px) 20px 0;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 16px;
    background: var(--bg-surface, rgba(18, 18, 26, 0.65));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-default, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md, 14px);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s var(--ease-out, ease), box-shadow 0.2s;
}

a.profile-stat:hover {
    border-color: var(--border-accent, rgba(124, 106, 255, 0.35));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 8px 32px rgba(0, 0, 0, 0.35));
    color: inherit;
}

.profile-stat__value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary, #fff);
    line-height: 1.1;
}

.profile-stat__label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #6b6b7d);
}

.profile-stat--highlight .profile-stat__value {
    color: var(--accent-text);
}

.profile-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 16px 20px;
    margin-bottom: 36px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-md, 14px);
    font-size: 0.85rem;
    color: var(--text-muted, #6b6b7d);
}

.profile-meta-bar strong {
    color: var(--text-secondary, #a8a8b8);
    font-weight: 600;
}

/* Listings section */
.profile-section {
    margin-top: 8px;
}

.profile-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.profile-section__head h2 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-section__head h2 i {
    color: var(--accent-text);
    font-size: 1rem;
}

.profile-section__link {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary, #a8a8b8);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-section__link:hover {
    color: var(--accent-text);
}

.profile-empty {
    text-align: center;
    padding: 56px 24px;
    background: var(--bg-surface, rgba(18, 18, 26, 0.5));
    border: 1px dashed var(--border-default, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-lg, 20px);
    color: var(--text-muted, #6b6b7d);
}

.profile-empty i {
    font-size: 2rem;
    color: var(--accent-text);
    opacity: 0.5;
    margin-bottom: 12px;
}

.profile-empty p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* Own profile badge */
.profile-badge-self {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-left: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: rgba(124, 106, 255, 0.15);
    border: 1px solid var(--border-accent, rgba(124, 106, 255, 0.3));
    border-radius: 999px;
    vertical-align: middle;
}

/* ===== Followers / following list ===== */
.profile-subpage {
    padding-bottom: 64px;
}

.profile-subpage__hero {
    padding: clamp(24px, 4vw, 36px) 20px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    background: var(--bg-surface, rgba(18, 18, 26, 0.65));
    backdrop-filter: blur(12px);
}

.profile-subpage__hero .container {
    max-width: 720px;
    margin: 0 auto;
}

.profile-subpage__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary, #a8a8b8);
    margin-bottom: 16px;
}

.profile-subpage__back:hover {
    color: var(--accent-text);
}

.profile-subpage__title {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary, #fff);
    margin-bottom: 6px;
}

.profile-subpage__count {
    font-size: 0.9rem;
    color: var(--text-muted, #6b6b7d);
}

.profile-subpage__body {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 20px;
}

.profile-subpage .follow-list__item {
    background: var(--bg-surface, rgba(18, 18, 26, 0.65));
    backdrop-filter: blur(8px);
    border-color: var(--border-default, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md, 14px);
    transition: border-color 0.2s, transform 0.15s;
}

.profile-subpage .follow-list__item:hover {
    border-color: var(--border-accent, rgba(124, 106, 255, 0.3));
}

.profile-subpage .follow-list__avatar img,
.profile-subpage .follow-list__avatar .avatar-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-subpage .follow-list__avatar .avatar-placeholder {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .profile-hero__inner {
        grid-template-columns: 1fr;
        text-align: center;
        margin-top: -48px;
    }

    .profile-hero__avatar {
        justify-self: center;
    }

    .profile-hero__main {
        text-align: center;
    }

    .profile-hero__bio {
        margin-left: auto;
        margin-right: auto;
    }

    .profile-hero__meta {
        justify-content: center;
    }

    .profile-hero__actions {
        justify-content: center;
        width: 100%;
    }

    .profile-hero__actions .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .profile-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
