.profile-page {
    container: profile / inline-size;
    max-width: 1320px;
    padding: 0 22px 48px;
    margin: 0 auto;
    font-size: 1rem;
}

.profile-header {
    overflow: hidden;
    border-radius: 0 0 var(--radius-small) var(--radius-small);
}

.profile-banner {
    display: block;
    width: 100%;
    height: clamp(190px, 18cqw, 240px);
    object-fit: cover;
    object-position: center;
}

.profile-identity {
    position: relative;
    display: grid;
    grid-template-columns: 152px minmax(0, 1fr) auto;
    column-gap: 22px;
    row-gap: 7px;
    align-items: start;
    margin-top: -42px;
    padding: 18px 22px 16px;
    background: var(--surface);
}

.profile-portrait {
    position: relative;
    grid-row: 1 / 3;
    width: 152px;
    margin-top: -58px;
}

.profile-portrait>.avatar {
    display: block;
    width: 152px;
    height: 152px;
    border-width: 5px;
}

.profile-portrait-sprout {
    position: absolute;
    width: 48px;
    height: 48px;
    right: 0;
    bottom: 0;
    object-fit: contain;
}

.profile-name {
    grid-column: 2 / -1;
    min-width: 0;
}

.profile-name h1 {
    font-size: 2rem;
    margin: 0 0 2px;
}

.profile-bio {
    grid-column: 2;
    min-width: 0;
}

.profile-bio h2 {
    font-size: 1.5rem;
    margin: 0 0 5px;
}

.profile-bio p {
    margin: 0 0 6px;
    line-height: 1.4;
    color: var(--muted);
    white-space: pre-line;
}

.profile-counts {
    color: var(--muted);
    font-size: .9rem;
}

.profile-counts>span {
    margin: 0 7px;
}

.profile-actions {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.profile-actions .button {
    min-height: 44px;
    font-size: 1rem;
    font-weight: normal;
    box-shadow: none;
}

.profile-actions .icon-button {
    border: 1px solid var(--line-strong);
}

.profile-header .tabs {
    padding: 0 16px;
    gap: 18px;
    border-bottom: 0;
    font-size: 1rem;
    scrollbar-width: thin;
}

.profile-header .tabs>a {
    padding: 12px 10px 10px;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.67fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 14px;
    align-items: start;
}

.profile-main {
    min-width: 0;
    overflow: hidden;
}

.profile-main>.book-grid {
    padding: 16px;
}

.profile-main .post {
    margin: 0 20px;
    padding: 16px 0;
}

.profile-main .post-heading {
    gap: 12px;
    margin-bottom: 6px;
}

.profile-main .post-heading .avatar {
    width: 46px;
    height: 46px;
}

.profile-main .author-name {
    font-size: 1.05rem;
}

.profile-main .post-heading time {
    font-size: .82rem;
}

.profile-main .post-content,
.profile-main .post-content .book-preview {
    margin-left: 0;
}

.profile-main .post-content p {
    font-size: 1rem;
    line-height: 1.35;
}

.profile-main .post-actions {
    margin-top: 8px;
    gap: 28px;
}

.profile-main .article-preview {
    margin: 10px 0 0;
    gap: 20px;
    align-items: start;
}

.profile-main .article-preview>img {
    height: auto;
    aspect-ratio: 1.65;
    object-fit: cover;
}

.profile-main .article-preview h2 {
    font-size: 1.4rem;
    margin: 8px 0;
}

.profile-main .article-preview .button {
    font-weight: normal;
    box-shadow: none;
}

.profile-main .book-preview h2 {
    font-size: 1.4rem;
    margin: 5px 0;
}

@container profile (max-width: 1000px) {
    .profile-identity {
        grid-template-columns: 140px minmax(0, 1fr);
        gap: 8px 20px;
    }
    .profile-portrait, .profile-portrait>.avatar {
        width: 140px;
        height: 140px;
    }
    .profile-actions {
        grid-column: 2;
        grid-row: 3;
        justify-content: flex-start;
        margin-top: 5px;
    }
    .profile-header .tabs {
        gap: 8px;
    }
}

@container profile (max-width: 680px) {
    .profile-banner {
        height: 170px;
        object-position: 42% center;
    }
    .profile-identity {
        grid-template-columns: 88px minmax(0, 1fr);
        padding: 12px 14px 14px;
        margin-top: -24px;
        gap: 12px;
    }
    .profile-portrait {
        grid-row: 1;
        margin-top: -38px;
    }
    .profile-portrait, .profile-portrait>.avatar {
        width: 88px;
        height: 88px;
    }
    .profile-portrait-sprout {
        width: 24px;
        height: 24px;
    }
    .profile-name h1 {
        font-size: 1.6rem;
    }
    .profile-bio, .profile-actions {
        grid-column: 1 / -1;
    }
    .profile-bio h2 {
        font-size: 1.3rem;
    }
    .profile-actions {
        grid-row: auto;
        gap: 8px;
    }
    .profile-actions .button {
        padding: .65rem .8rem;
        font-size: .95rem;
    }
    .profile-header .tabs {
        gap: 4px;
        padding: 0 6px;
    }
    .profile-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .profile-main .post {
        margin: 0 14px;
    }
    .profile-main .post-actions {
        gap: 18px;
    }
}

@media(max-width: 760px) {
    .profile-page { padding: 0 10px 30px; }
}
