/* Profile page: two-column identity rail + content column.
   Reuses blueprint tokens (color-*, font-mono, status-pill, tab, state-card,
   card-surface, button) from theme/base/browse/cards CSS. */

.profile-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(0.75rem, 2vw, 1.75rem) clamp(1rem, 3vw, 2.5rem);
}

.profile-nav {
    margin-bottom: 0.9rem;
}

.profile-nav a {
    color: var(--color-secondary);
    font-size: 0.875rem;
}

.profile-shell {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* Two-column layout: narrow identity rail + wide content. */

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
    gap: clamp(1rem, 2.5vw, 2rem);
    align-items: start;
}

@media (max-width: 52rem) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

/* Identity rail */

.profile-rail {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: clamp(1rem, 2vw, 1.4rem);
}

@media (min-width: 52rem) {
    .profile-rail {
        position: sticky;
        top: 1rem;
    }
}

.profile-rail .profile-avatar {
    width: 7rem;
    height: 7rem;
    object-fit: cover;
    border: 1px solid var(--color-border);
}

.profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-overlay);
    color: var(--color-primary);
    font-family: var(--font-heading, var(--font-ui));
    font-size: 2.5rem;
    font-weight: 700;
}

.profile-rail-identity {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-rail-identity h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    line-height: 1.12;
    color: var(--color-emphasis);
    letter-spacing: -0.02em;
    word-break: break-word;
}

.profile-handle {
    margin: 0;
    color: var(--color-secondary);
    font-size: 0.95rem;
    word-break: break-word;
}

.profile-pronouns {
    color: var(--color-muted);
}

.profile-bsky-note {
    align-self: flex-start;
    margin-top: 0.15rem;
    padding: 0.15rem 0.45rem;
    border: 1px dashed var(--color-border);
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* Dashed section dividers within the rail (blueprint rhythm). */

.profile-stats,
.profile-bio,
.profile-rail-links {
    padding-top: 0.8rem;
    border-top: 1px dashed var(--color-border);
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.9rem;
    color: var(--color-subtle);
    font-size: 0.9rem;
}

.profile-rail-action {
    display: flex;
}

.profile-rail-action .profile-follow-form {
    width: 100%;
    margin: 0;
}

.profile-rail-action .button {
    width: 100%;
    justify-content: center;
}

.profile-bio {
    margin: 0;
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.profile-bio a {
    color: var(--color-link);
}

.profile-rail-links {
    list-style: none;
    margin: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-rail-links a {
    color: var(--color-link);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    word-break: break-all;
}

/* Content column */

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
}

.profile-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.profile-tab-content {
    min-height: 12rem;
}

.profile-things-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
    align-content: start;
}

.profile-placeholder-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 2rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
}

/* About tab */

.profile-about {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.profile-about-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    margin: 0;
}

.profile-about-meta div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.profile-about-meta dt {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.profile-about-meta dd {
    margin: 0;
    color: var(--color-text);
}

.profile-about-links h2 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--color-subtle);
}

.profile-about-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-about-links a {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.profile-about-fallback-note {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.875rem;
}

.profile-muted {
    color: var(--color-muted);
}

/* Sign-in CTA */

.profile-sign-in {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.profile-sign-in h1 {
    margin: 0;
    color: var(--color-emphasis);
}

/* Creator links on cards and detail */

.thing-card-creator-link,
.thing-detail-creator-link {
    color: var(--color-secondary);
}

.thing-card-creator-link:hover,
.thing-detail-creator-link:hover {
    color: var(--color-link);
}

/* Signed-in account chrome: avatar trigger + click-to-open dropdown menu. */

.account-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.account-menu > summary {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

.account-menu > summary:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
    outline-offset: 2px;
}

.session-avatar {
    display: block;
    width: 2.12rem;
    height: 2.12rem;
    object-fit: cover;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.session-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-overlay);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 30;
    min-width: 13rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.4rem;
}

.account-menu-identity {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.35rem 0.5rem 0.5rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px dashed var(--color-border);
}

.account-menu-identity strong {
    color: var(--color-text);
}

.account-menu-handle {
    color: var(--color-muted);
    font-size: 0.8rem;
    word-break: break-word;
}

.account-menu-form {
    margin: 0;
}

.account-menu-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
}

.account-menu-item:hover {
    background-color: var(--color-overlay);
    text-decoration: none;
}

.account-menu-signout {
    color: var(--color-error);
}
