/* ---------- Blurred full-bleed backdrop (fills the space beyond the page frame) ---------- */
.page-backdrop {
    position: fixed;
    inset: -60px; /* overscan so the blur never reveals a hard edge */
    z-index: -1;
    background-size: cover;
    background-position: center;
    filter: blur(50px);
}

.page-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35); /* keeps the white page frame readable on top */
}

/* ---------- Page boundary (caps the whole page on ultrawide instead of an endless gray canvas) ---------- */
.page-wrapper {
    max-width: 1400px;
    min-height: 100vh;
    margin: 0 auto;
    background-color: var(--surface-page);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.06);
}

.profile-container {
    background-color: var(--surface-page);
    /* flex so margins don't collapse */
    display: flex;
    flex-direction: column;
}

/* ---------- Header row ---------- */
.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px 4px 16px;
    box-sizing: content-box;
}

.profile-header-spacer {
    width: 48px;
    height: 48px;
}

.profile-header-button {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-brand);
    cursor: pointer;
}

.profile-header-button svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* ---------- Info (avatar, username, bio) ---------- */
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
    margin-bottom: 8px;
}

.profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-username {
    color: var(--text-primary);
    margin-top: 20px;
}

.profile-bio {
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 8px;
}

/* ---------- Actions (follow button, social icons) ---------- */
.profile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.profile-follow-button {
    min-width: 145px;
    height: 44px;
    padding: 0 24px;
    border-radius: 9999px;
    border: none;
    background-color: var(--surface-primary);
    color: var(--text-inverse);
    cursor: pointer;
}

.profile-social-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-social-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-page-secondary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.profile-social-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* ---------- Stats ---------- */
.profile-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.profile-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-stat-value {
    color: var(--text-primary);
}

.profile-stat-label {
    color: var(--text-secondary);
}

.profile-stat-divider {
    width: 2px;
    height: 36px;
    background-color: var(--border-primary);
}

.profile-section-divider {
    height: 12px;
    margin-bottom: 12px;
    background-color: var(--surface-page-secondary);
}

/* ---------- Tabs ---------- */
.profile-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.profile-tab {
    padding: 8px 24px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
}

.profile-tab.active {
    border-bottom-color: var(--surface-primary);
    color: var(--text-primary);
}

/* ---------- Sort row ---------- */
.profile-sort {
    display: flex;
    justify-content: flex-end;
    padding: 0 16px 12px 16px;
}

.profile-sort-button {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-brand);
    cursor: pointer;
}

.profile-sort-button svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* ---------- Post grid ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 8px 16px 40px 16px;
}

/* An <a> to the post, so display is explicit and link styling is kept off the tile. */
.profile-post-card {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--surface-page);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    color: inherit;
}

.profile-post-image {
    width: 100%;
    height: 30vh;
    min-height: 200px;
    max-height: 320px;
    object-fit: cover;
    display: block;
}

/* ---------- Desktop: bigger paddings, bigger avatar, a wrapping post grid instead of a fixed 2-col ---------- */
@media (min-width: 900px) {
    .profile-info {
        padding: 24px 40px 0 40px;
    }

    .profile-header {
        padding-left: 40px;
        padding-right: 40px;
    }

    .profile-avatar {
        width: 160px;
        height: 160px;
    }

    .profile-username {
        margin-top: 24px;
    }

    .profile-actions,
    .profile-stats {
        padding-left: 40px;
        padding-right: 40px;
    }

    .profile-stats {
        margin-top: 32px;
        margin-bottom: 24px;
    }

    .profile-tabs {
        padding-top: 8px;
    }

    .profile-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 24px;
        padding: 24px 40px 40px 40px;
    }

    .profile-post-card {
        border-radius: 16px;
    }

    .profile-post-image {
        height: 280px;
    }
}
