/* Profile: a centred community hub with clear public and private areas. */
.wisetl-profile-container {
    max-width: 980px;
}

.wisetl-profile-hero,
.wisetl-profile-activity,
.wisetl-profile-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.wisetl-profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 34px;
}

.wisetl-profile-identity {
    display: flex;
    align-items: center;
    gap: 22px;
    min-width: 0;
}

.wisetl-profile-avatar {
    width: 112px;
    height: 112px;
    flex: 0 0 112px;
    border: 4px solid var(--gold-tint);
    border-radius: 50%;
    background: var(--bg-color);
}

.wisetl-profile-heading h1 {
    margin: 3px 0 4px;
    font-size: clamp(2rem, 5vw, 3rem);
}

.wisetl-profile-username {
    margin: 0;
    color: var(--text-soft);
    font-size: .92rem;
}

.wisetl-profile-username span {
    padding: 0 4px;
    color: var(--gold-primary);
}

.wisetl-profile-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
}

.wisetl-profile-action {
    min-height: 42px;
    padding: 10px 15px;
    border-radius: 10px;
    font-family: var(--ui-font);
    font-size: .84rem;
    font-weight: 750;
}

.wisetl-profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 32px;
}

.wisetl-profile-stat {
    min-height: 126px;
    padding: 22px 18px;
    border-radius: var(--radius-md);
}

.wisetl-profile-stat strong {
    color: var(--gold-primary);
    font-size: 2rem;
}

.wisetl-profile-stat span {
    margin-top: 5px;
    font-family: var(--ui-font);
    font-size: .8rem;
    font-weight: 700;
}

.wisetl-profile-activity,
.wisetl-profile-editor {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 22px;
    padding: 28px;
}

.wisetl-profile-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.wisetl-profile-section-heading p {
    margin: 0 0 5px;
    color: var(--gold-primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
}

.wisetl-profile-section-heading h2 {
    margin: 0;
    font-size: 1.4rem;
}

.wisetl-profile-section-heading > span {
    color: var(--text-soft);
    font-size: .8rem;
    white-space: nowrap;
}

.wisetl-profile-comments {
    display: grid;
    gap: 10px;
}

.wisetl-profile-comment {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 16px 17px;
    border: 1px solid var(--border-color);
    border-radius: 13px;
    background: var(--bg-color);
}

.wisetl-profile-comment-top {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.wisetl-profile-comment-top a {
    min-width: 0;
    overflow: hidden;
    color: var(--text-color);
    font-size: .88rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wisetl-profile-comment-top a:hover {
    color: var(--gold-primary);
}

.wisetl-profile-comment time {
    flex: 0 0 auto;
    color: var(--text-soft);
    font-size: .75rem;
}

.wisetl-profile-comment p,
.wisetl-profile-empty {
    margin: 8px 0 0;
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1.55;
}

.wisetl-profile-empty {
    margin: 0;
    padding: 32px 18px;
    border: 1px dashed var(--border-color);
    border-radius: 13px;
    text-align: center;
}

.wisetl-profile-form {
    display: grid;
    gap: 15px;
}

.wisetl-profile-form > label {
    display: grid;
    gap: 7px;
    color: var(--text-soft);
    font-size: .8rem;
    font-weight: 750;
}

.wisetl-profile-form input[type="text"] {
    min-height: 43px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-color);
    font: inherit;
}

/* Profile activity is a compact summary, so long comment text remains one
 * line and never widens the page on a phone. */
.wisetl-profile-comment p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wisetl-profile-form input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-soft);
    font: inherit;
    font-size: .8rem;
}

.wisetl-profile-form > label small {
    color: var(--text-soft);
    font-size: .74rem;
    font-weight: 400;
}

.wisetl-profile-private-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-soft);
    font-size: .86rem;
}

.wisetl-profile-private-row strong {
    max-width: 65%;
    color: var(--text-color);
    overflow-wrap: anywhere;
    text-align: right;
}

.wisetl-profile-form fieldset {
    display: grid;
    gap: 11px;
    margin: 3px 0 0;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.wisetl-profile-form legend {
    padding: 0 5px;
    color: var(--gold-primary);
    font-size: .78rem;
    font-weight: 800;
}

.wisetl-profile-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--text-color);
    font-size: .86rem;
    line-height: 1.45;
}

.wisetl-profile-check input {
    accent-color: var(--gold-primary);
    margin-top: 3px;
}

.wisetl-profile-save {
    justify-self: start;
    min-height: 42px;
    padding: 9px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--gold-primary);
    color: #17120a;
    font: 750 .85rem var(--ui-font);
    cursor: pointer;
}

.wisetl-profile-updated {
    margin: -7px 0 17px;
    color: var(--gold-primary);
    font-size: .85rem;
    font-weight: 700;
}

body.dark-mode .wisetl-profile-hero,
body.dark-mode .wisetl-profile-activity,
body.dark-mode .wisetl-profile-editor,
body.dark-mode .wisetl-profile-comment,
body.dark-mode .wisetl-profile-form input[type="text"] {
    background: var(--surface-color);
    border-color: var(--border-color);
}

body.dark-mode .wisetl-profile-stat,
body.dark-mode .wisetl-profile-avatar {
    background: var(--surface-color);
    border-color: var(--border-color);
}

@media (max-width: 700px) {
    .wisetl-profile-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 24px 18px;
        text-align: center;
    }

    .wisetl-profile-identity {
        flex-direction: column;
        gap: 13px;
    }

    .wisetl-profile-avatar {
        width: 96px;
        height: 96px;
        flex-basis: 96px;
    }

    .wisetl-profile-heading h1 {
        font-size: 2.2rem;
    }

    .wisetl-profile-hero-actions {
        justify-content: center;
        margin-top: 6px;
    }

    .wisetl-profile-action {
        flex: 1;
        justify-content: center;
    }

    .wisetl-profile-stats {
        gap: 8px;
        margin: 14px 0 24px;
    }

    .wisetl-profile-stat {
        min-height: 104px;
        padding: 16px 7px;
    }

    .wisetl-profile-stat strong {
        font-size: 1.55rem;
    }

    .wisetl-profile-stat span {
        font-size: .7rem;
    }

    .wisetl-profile-activity,
    .wisetl-profile-editor {
        margin-top: 16px;
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    .wisetl-profile-comment-top { align-items: center; flex-direction: row; gap: 10px; min-width: 0; }
    .wisetl-profile-comment-top a { flex: 1 1 auto; width: auto; min-width: 0; }
}

/* Patreon stays an account-only feature: it is never shown on public profiles. */
.wisetl-profile-patreon { margin-top: 26px; padding: 28px 32px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--surface-color); box-shadow: var(--shadow-soft); }
.wisetl-patreon-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wisetl-patreon-panel strong { color: var(--text-color); font-size: 1.02rem; }
.wisetl-patreon-panel p { max-width: 480px; margin: 7px 0 0; color: var(--text-soft); font-size: .88rem; line-height: 1.55; }
.wisetl-patreon-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.wisetl-patreon-actions form { margin: 0; }
.wisetl-profile-action.linked, .wisetl-profile-action.muted { display: inline-flex; align-items: center; min-height: 40px; cursor: default; }
.wisetl-profile-action.linked { border-color: var(--gold-outline); background: var(--gold-soft); color: var(--gold-primary); }
.wisetl-profile-action.muted { opacity: .64; }
.wisetl-profile-text-action { padding: 7px 2px; border: 0; background: transparent; color: var(--text-soft); font: 700 .78rem var(--ui-font); cursor: pointer; }
.wisetl-profile-text-action:hover { color: #b94a4a; }
.wisetl-profile-status { margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-color); color: var(--text-soft); font-size: .84rem; line-height: 1.45; }
.wisetl-profile-status.success { border-color: var(--gold-outline); color: var(--gold-primary); }
.wisetl-profile-status.error { border-color: #c47979; color: #b24d4d; }
.wisetl-profile-security { display: grid; gap: 8px; }
.wisetl-profile-security p { margin: 0; color: var(--text-soft); font-size: .84rem; line-height: 1.5; }
.wisetl-profile-password-link { display: inline-flex; width: fit-content; color: var(--gold-primary); font-size: .86rem; font-weight: 750; }
.wisetl-profile-delete-form { margin-top: 16px; }.wisetl-profile-delete-form fieldset { border-color: rgba(180, 73, 61, .45); background: rgba(180, 73, 61, .045); }.wisetl-profile-delete-form p { margin: 0 0 12px; color: var(--text-soft); font-size: .84rem; line-height: 1.5; }.wisetl-profile-delete-form > fieldset > label:not(.wisetl-profile-check) { display: grid; gap: 7px; margin-top: 12px; color: var(--text-color); font-size: .84rem; font-weight: 700; }.wisetl-profile-delete-form input[type="text"] { width: 100%; min-height: 38px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color); color: var(--text-color); }.wisetl-profile-delete-button { min-height: 39px; margin-top: 14px; padding: 0 14px; border: 1px solid #b94e43; border-radius: 8px; background: transparent; color: #b94e43; font-weight: 800; cursor: pointer; }.wisetl-profile-delete-error { padding: 9px 11px; border-radius: 7px; background: rgba(180, 73, 61, .12); color: #b94e43 !important; font-weight: 700; }

@media (max-width: 700px) {
    .wisetl-profile-patreon { margin-top: 16px; padding: 20px 16px; border-radius: var(--radius-md); }
    .wisetl-patreon-panel { align-items: flex-start; flex-direction: column; gap: 16px; }
    .wisetl-patreon-actions { justify-content: flex-start; }
}

/* Centre the profile canvas itself, not only the cards inside it. */
.wisetl-profile-page {
    display: flex;
    justify-content: center;
    width: 100%;
}

.wisetl-profile-container {
    width: min(980px, 100%);
    margin-right: auto;
    margin-left: auto;
}

.wisetl-profile-hero-actions .wisetl-profile-action {
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* The editor is deliberately separate from the public profile surface. */
.wisetl-profile-editor {
    width: min(560px, calc(100% - 32px));
    max-height: min(720px, calc(100vh - 48px));
    margin: auto;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.wisetl-profile-editor::backdrop {
    background: rgba(17, 14, 8, .58);
    backdrop-filter: blur(5px);
}

.wisetl-profile-editor-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.wisetl-profile-editor .wisetl-profile-section-heading {
    flex: 1;
}

.wisetl-profile-modal-close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.wisetl-profile-modal-close:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

body.dark-mode .wisetl-profile-editor,
body.dark-mode .wisetl-profile-modal-close {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

@media (max-width: 700px) {
    .wisetl-profile-page {
        padding-right: 16px;
        padding-left: 16px;
    }

    .wisetl-profile-editor {
        width: min(100% - 20px, 560px);
        max-height: calc(100vh - 24px);
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }
}

