/*
 * Part 2.3B — customer-facing profile/account mobile polish.
 * Loaded only by account dashboard/editor and public profile views.
 * No authentication, RBAC, routes, persistence or profile data behavior is changed here.
 */

:where(.tna-profile-v3, .tna-profile-editor, .tna-account-home) {
    --profile-surface: color-mix(in srgb, var(--tnx-surface, #0b1020) 92%, transparent);
    --profile-surface-soft: color-mix(in srgb, var(--tnx-card, rgba(255,255,255,.055)) 92%, transparent);
    --profile-line: var(--tnx-line, rgba(226,232,240,.13));
    --profile-line-strong: var(--tnx-line-strong, rgba(226,232,240,.22));
    --profile-text: var(--tnx-text, #f8fafc);
    --profile-muted: var(--tnx-muted, #a9b5c8);
    --profile-gold: var(--tnx-accent, #e9bb63);
    --profile-cyan: var(--tnx-secondary, #62d8ff);
}

:where(.tna-profile-v3, .tna-profile-editor, .tna-account-home) :where(a, button, input, select, textarea, summary) {
    -webkit-tap-highlight-color: transparent;
}

:where(.tna-profile-editor, .tna-account-home) .tna-btn,
.tna-profile-v3 .tna-btn {
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

/* ---------- Public profile ---------- */
.tna-profile-v3 .tna-container {
    max-width: 1180px;
}

.tna-profile-v3-hero {
    isolation: isolate;
}

.tna-profile-v3-name {
    overflow-wrap: anywhere;
}

.tna-profile-v3-handle,
.tna-profile-v3-headline,
.tna-profile-v3-link-card,
.tna-profile-v4-description,
.tna-profile-v3-about {
    overflow-wrap: anywhere;
}

.tna-profile-v3-actions > form {
    display: contents;
}

.tna-profile-v3-actions .tna-btn {
    min-width: 0;
}

.tna-profile-v3-stat {
    min-width: 0;
}

.tna-profile-v3-stat strong,
.tna-profile-v3-stat span {
    overflow-wrap: anywhere;
}

.tna-profile-v3-card,
.tna-profile-v4-item,
.tna-profile-v3-post {
    scroll-margin-top: 150px;
}

.tna-profile-v5-jumpnav {
    position: sticky;
    inset-block-start: 82px;
    z-index: 22;
    display: flex;
    gap: 8px;
    margin: 14px 0 20px;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border: 1px solid var(--profile-line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--tnx-surface-strong, #0a0f1d) 90%, transparent);
    box-shadow: 0 14px 38px rgba(0,0,0,.16);
    backdrop-filter: blur(18px) saturate(135%);
}

.tna-profile-v5-jumpnav::-webkit-scrollbar {
    display: none;
}

.tna-profile-v5-jumpnav a {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--profile-muted);
    text-decoration: none;
    font-size: .86rem;
    font-weight: 750;
    white-space: nowrap;
}

.tna-profile-v5-jumpnav a:hover,
.tna-profile-v5-jumpnav a:focus-visible {
    color: var(--profile-text);
    border-color: color-mix(in srgb, var(--profile-gold) 30%, var(--profile-line));
    background: color-mix(in srgb, var(--profile-gold) 9%, transparent);
}

/* The legacy profile was visually dark even when the site was light. */
html[data-tna-theme="light"] .tna-profile-v3-hero {
    border-color: rgba(164, 119, 24, .22);
    background:
        radial-gradient(circle at 12% 14%, rgba(212,175,55,.16), transparent 31%),
        radial-gradient(circle at 90% 10%, rgba(0,172,193,.11), transparent 28%),
        linear-gradient(145deg, rgba(255,255,255,.94), rgba(246,248,252,.82));
    box-shadow: 0 24px 70px rgba(15,23,42,.10), 0 0 0 1px rgba(255,255,255,.7) inset;
}

html[data-tna-theme="light"] .tna-profile-v3-hero::after {
    background: radial-gradient(ellipse at center, rgba(0,172,193,.10), transparent 67%);
}

html[data-tna-theme="light"] .tna-profile-v3-avatar-wrap {
    background: linear-gradient(135deg, rgba(212,175,55,.72), rgba(0,172,193,.35), rgba(255,255,255,.85));
    box-shadow: 0 18px 45px rgba(164,119,24,.13);
}

html[data-tna-theme="light"] .tna-profile-v3-avatar-wrap img,
html[data-tna-theme="light"] .tna-profile-v3-avatar-fallback {
    background: linear-gradient(145deg, #fff, #eef2f7);
    border-color: rgba(15,23,42,.10);
    color: #9a6c0b;
}

html[data-tna-theme="light"] :is(
    .tna-profile-v3-card,
    .tna-profile-v3-stat,
    .tna-profile-v4-item,
    .tna-profile-v3-post,
    .tna-profile-v3-link-card
) {
    border-color: rgba(15,23,42,.10);
    background: rgba(255,255,255,.78);
    box-shadow: 0 18px 48px rgba(15,23,42,.075);
}

html[data-tna-theme="light"] .tna-profile-v3-card {
    background:
        radial-gradient(circle at 8% 0%, rgba(212,175,55,.065), transparent 30%),
        rgba(255,255,255,.82);
}

html[data-tna-theme="light"] .tna-profile-v3-badge,
html[data-tna-theme="light"] .tna-profile-v3-skill {
    color: #243044;
    border-color: rgba(15,23,42,.12);
    background: rgba(255,255,255,.72);
}

html[data-tna-theme="light"] .tna-profile-v3-skill {
    border-color: rgba(0,128,150,.18);
    background: rgba(0,172,193,.055);
}

html[data-tna-theme="light"] .tna-profile-v3-progress {
    background: rgba(15,23,42,.08);
}

html[data-tna-theme="light"] .tna-profile-v5-jumpnav {
    background: rgba(255,255,255,.88);
    box-shadow: 0 12px 34px rgba(15,23,42,.08);
}

/* ---------- Profile/account editor ---------- */
.tna-profile-editor__header {
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid var(--profile-line);
    border-radius: 26px;
    background:
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--profile-gold) 11%, transparent), transparent 34%),
        var(--profile-surface);
    box-shadow: 0 22px 70px rgba(0,0,0,.16);
}

.tna-profile-editor__header-actions .tna-btn {
    flex: 1 1 auto;
}

.tna-profile-editor__tabs {
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    box-shadow: 0 10px 32px rgba(0,0,0,.11);
}

.tna-profile-editor__tabs::-webkit-scrollbar {
    display: none;
}

.tna-profile-editor__tabs a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    scroll-snap-align: start;
}

.tna-profile-editor__panel {
    overflow: clip;
}

.tna-form-grid > label > span,
.tna-field-label {
    color: var(--profile-text);
    font-weight: 720;
}

.tna-form-grid :is(input, select, textarea),
.tna-skill-editor :is(input, select),
.tna-avatar-editor input[type="file"] {
    font-size: 16px;
}

.tna-form-grid :is(input, select, textarea)::placeholder,
.tna-skill-editor input::placeholder {
    color: color-mix(in srgb, var(--profile-muted) 72%, transparent);
}

.tna-avatar-editor {
    min-width: 0;
}

.tna-avatar-editor > div:last-child {
    min-width: 0;
}

.tna-avatar-editor input[type="file"] {
    max-width: 100%;
}

.tna-skill-editor__row {
    position: relative;
}

.tna-skill-editor__row button,
.tna-professional-row__checks button {
    min-height: 44px;
}

.tna-professional-group summary {
    min-height: 58px;
}

.tna-professional-group summary strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tna-professional-row {
    min-inline-size: 0;
}

.tna-profile-editor__savebar .tna-btn-primary {
    min-width: 150px;
}

html[data-tna-theme="light"] :is(
    .tna-profile-editor__header,
    .tna-profile-editor__panel,
    .tna-professional-group,
    .tna-professional-row
) {
    box-shadow: 0 18px 55px rgba(15,23,42,.07);
}

/* ---------- Account dashboard ---------- */
.tna-account-home__hero,
.tna-account-home__card,
.tna-account-home__completion,
.tna-account-home__stats article {
    overflow: hidden;
}

.tna-account-home__hero h1,
.tna-account-home__card h2,
.tna-account-home__stats strong {
    overflow-wrap: anywhere;
}

.tna-account-home__actions .tna-btn,
.tna-account-home__inline-actions .tna-btn,
.tna-account-home__footer-actions .tna-btn {
    min-height: 46px;
}

html[data-tna-theme="light"] :is(
    .tna-account-home__hero,
    .tna-account-home__card,
    .tna-account-home__completion,
    .tna-account-home__stats article
) {
    border-color: rgba(15,23,42,.10);
    background-color: rgba(255,255,255,.78);
    box-shadow: 0 18px 50px rgba(15,23,42,.065);
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
    .tna-profile-v3-top {
        grid-template-columns: 112px minmax(0, 1fr) !important;
        align-items: start;
        gap: 20px;
    }

    .tna-profile-v3-avatar-wrap {
        width: 112px !important;
        border-radius: 28px;
        padding: 5px;
    }

    .tna-profile-v3-avatar-wrap img,
    .tna-profile-v3-avatar-fallback {
        border-radius: 23px;
    }

    .tna-profile-v3-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .tna-profile-v3-grid {
        grid-template-columns: 1fr !important;
    }

    .tna-profile-v3-grid > aside {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tna-account-home__grid {
        grid-template-columns: 1fr !important;
    }

    .tna-account-home__grid .is-primary {
        grid-column: auto !important;
    }
}

/* ---------- Phone-first usability ---------- */
@media (max-width: 680px) {
    .tna-profile-v3,
    .tna-profile-editor,
    .tna-account-home {
        padding-block-start: 18px;
    }

    :is(.tna-profile-v3, .tna-profile-editor, .tna-account-home) .tna-container {
        width: min(100% - 22px, 1180px);
    }

    .tna-profile-v3-hero {
        border-radius: 24px !important;
        padding: 18px !important;
    }

    .tna-profile-v3-top {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .tna-profile-v3-avatar-wrap {
        width: 92px !important;
        border-radius: 24px;
    }

    .tna-profile-v3-avatar-wrap img,
    .tna-profile-v3-avatar-fallback {
        border-radius: 19px;
        font-size: 38px;
    }

    .tna-profile-v3-title-row {
        gap: 6px;
    }

    .tna-profile-v3-title-row .tna-badge {
        padding: 6px 9px;
        font-size: .72rem;
    }

    .tna-profile-v3-name {
        margin-block: 10px 4px;
        font-size: clamp(1.85rem, 9.5vw, 2.8rem) !important;
        line-height: 1.12;
    }

    .tna-profile-v3-handle {
        margin-block: 0 7px;
        font-size: .94rem;
    }

    .tna-profile-v3-headline {
        margin-block: 0;
        font-size: .96rem;
        line-height: 1.75;
    }

    .tna-profile-v3-badges {
        margin-top: 13px;
        gap: 6px;
    }

    .tna-profile-v3-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 16px;
    }

    .tna-profile-v3-actions .tna-btn {
        width: 100%;
        padding-inline: 10px;
        font-size: .84rem;
        text-align: center;
    }

    .tna-profile-v3-actions .tna-btn-primary:first-child,
    .tna-profile-v3-actions > a:only-child {
        grid-column: 1 / -1;
    }

    .tna-profile-v3-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px;
        margin-top: 18px !important;
    }

    .tna-profile-v3-stat {
        border-radius: 16px !important;
        padding: 12px !important;
    }

    .tna-profile-v3-stat strong {
        font-size: 1.2rem !important;
    }

    .tna-profile-v5-jumpnav {
        inset-block-start: 72px;
        margin: 10px 0 14px;
        padding: 6px;
        border-radius: 15px;
        scroll-snap-type: inline proximity;
    }

    .tna-profile-v5-jumpnav a {
        min-height: 38px;
        padding-inline: 11px;
        font-size: .8rem;
    }

    .tna-profile-v3-grid {
        gap: 12px !important;
        margin-top: 0 !important;
    }

    .tna-profile-v3-stack,
    .tna-profile-v3-grid > aside {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .tna-profile-v3-card {
        border-radius: 20px !important;
        padding: 17px !important;
    }

    .tna-profile-v3-section-head {
        align-items: stretch !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
    }

    .tna-profile-v3-section-head .tna-btn {
        width: 100%;
    }

    .tna-profile-v3-about,
    .tna-profile-v4-description {
        font-size: .93rem !important;
        line-height: 1.85 !important;
    }

    .tna-profile-v3-skills {
        gap: 7px !important;
    }

    .tna-profile-v3-skill {
        padding: 7px 10px !important;
        font-size: .82rem;
    }

    .tna-profile-v4-item,
    .tna-profile-v3-post {
        border-radius: 18px !important;
        padding: 15px !important;
    }

    .tna-profile-v4-item h3,
    .tna-profile-v3-post h3 {
        font-size: 1.05rem !important;
        line-height: 1.55;
    }

    .tna-profile-v4-meta,
    .tna-profile-v3-post-meta {
        gap: 6px !important;
    }

    .tna-profile-v4-meta .tna-badge,
    .tna-profile-v3-post-meta .tna-badge {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .tna-profile-v3-link-card {
        min-width: 0;
        padding: 12px !important;
        border-radius: 15px !important;
    }

    .tna-profile-v3-link-card > :first-child {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* Editor */
    .tna-profile-editor__header {
        align-items: stretch !important;
        margin-bottom: 12px !important;
        padding: 17px;
        border-radius: 21px;
    }

    .tna-profile-editor__header h1 {
        font-size: clamp(1.8rem, 9vw, 2.55rem) !important;
        line-height: 1.18;
    }

    .tna-profile-editor__header p {
        font-size: .91rem;
        line-height: 1.78;
    }

    .tna-profile-editor__header-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .tna-profile-editor__header-actions .tna-btn {
        width: 100%;
    }

    .tna-profile-editor__tabs {
        top: 72px !important;
        margin-inline: -1px;
        margin-bottom: 12px !important;
        padding: 6px !important;
        border-radius: 15px !important;
        scroll-snap-type: inline proximity;
    }

    .tna-profile-editor__tabs a {
        min-height: 40px;
        padding: 8px 11px !important;
        font-size: .8rem !important;
    }

    .tna-profile-editor__panel {
        padding: 16px !important;
        margin-bottom: 12px !important;
        border-radius: 20px !important;
        scroll-margin-top: 128px !important;
    }

    .tna-profile-editor__section-head {
        gap: 12px !important;
        margin-bottom: 18px !important;
    }

    .tna-profile-editor__section-head > div {
        align-items: flex-start !important;
    }

    .tna-profile-editor__section-head > div > span {
        width: 34px !important;
        height: 34px !important;
        flex: 0 0 34px;
    }

    .tna-profile-editor__section-head h2 {
        font-size: 1.12rem !important;
        line-height: 1.55;
    }

    .tna-profile-editor__section-head p {
        font-size: .86rem !important;
        line-height: 1.75 !important;
    }

    .tna-avatar-editor {
        grid-template-columns: 72px minmax(0, 1fr) !important;
        gap: 12px !important;
        padding: 12px !important;
        border-radius: 17px !important;
    }

    .tna-avatar-editor__preview {
        width: 72px !important;
        height: 72px !important;
        border-radius: 18px !important;
        font-size: 1.8rem !important;
    }

    .tna-form-grid {
        gap: 12px !important;
    }

    .tna-form-grid > label {
        gap: 7px !important;
    }

    .tna-form-grid :is(input, select, textarea),
    .tna-skill-editor :is(input, select),
    .tna-avatar-editor input[type="file"] {
        min-height: 48px !important;
        border-radius: 12px !important;
    }

    .tna-skill-editor__row {
        grid-template-columns: minmax(0, 1fr) 44px !important;
        gap: 8px !important;
    }

    .tna-skill-editor__row select {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
    }

    .tna-skill-editor__row button {
        min-width: 44px;
        width: 44px;
    }

    .tna-professional-group {
        border-radius: 16px !important;
    }

    .tna-professional-group summary {
        grid-template-columns: minmax(0, 1fr) 32px !important;
        gap: 8px !important;
        padding: 13px !important;
    }

    .tna-professional-group summary > span {
        grid-column: 1;
        font-size: .68rem !important;
    }

    .tna-professional-group summary > strong {
        grid-column: 1;
        grid-row: 2;
        line-height: 1.45;
    }

    .tna-professional-group summary > em {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: center;
    }

    .tna-professional-group__rows {
        padding: 0 9px 9px !important;
    }

    .tna-professional-row {
        padding: 12px !important;
        border-radius: 14px !important;
    }

    .tna-professional-row__checks {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px !important;
        align-items: center;
    }

    .tna-professional-row__checks .tna-check {
        width: 100% !important;
        margin: 0 !important;
    }

    .tna-professional-row__checks .tna-btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .tna-profile-editor__savebar {
        gap: 10px !important;
        margin-top: 16px !important;
        padding-top: 14px !important;
    }

    .tna-profile-editor__savebar .tna-btn {
        width: 100%;
    }

    /* Dashboard */
    .tna-account-home__hero {
        padding: 18px !important;
        border-radius: 22px !important;
        gap: 18px !important;
    }

    .tna-account-home__hero h1 {
        margin-block: 8px;
        font-size: clamp(1.85rem, 9vw, 2.55rem) !important;
        line-height: 1.18 !important;
    }

    .tna-account-home__hero p {
        font-size: .92rem;
        line-height: 1.8 !important;
    }

    .tna-account-home__actions {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100%;
        max-width: none !important;
    }

    .tna-account-home__actions .tna-btn,
    .tna-account-home__inline-actions .tna-btn {
        width: 100%;
    }

    .tna-account-home__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .tna-account-home__stats article {
        padding: 13px !important;
        border-radius: 16px !important;
    }

    .tna-account-home__stats strong {
        font-size: .98rem !important;
    }

    .tna-account-home__grid {
        gap: 10px !important;
    }

    .tna-account-home__card,
    .tna-account-home__completion {
        padding: 17px !important;
        border-radius: 20px !important;
    }

    .tna-account-home__card p {
        min-height: 0 !important;
        font-size: .9rem;
        line-height: 1.75 !important;
    }

    .tna-account-home__completion {
        gap: 13px !important;
    }

    .tna-account-home__checks {
        gap: 6px !important;
    }

    .tna-account-home__checks span {
        padding: 6px 8px !important;
        font-size: .72rem !important;
    }

    .tna-account-home__footer-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px !important;
    }

    .tna-account-home__footer-actions > *,
    .tna-account-home__footer-actions .tna-btn {
        width: 100%;
    }

    .tna-account-home__footer-actions form {
        display: block;
    }
}

@media (max-width: 380px) {
    .tna-profile-v3-actions,
    .tna-profile-v3-stats,
    .tna-account-home__stats,
    .tna-professional-row__checks {
        grid-template-columns: 1fr !important;
    }

    .tna-profile-v3-actions > *,
    .tna-profile-v3-actions .tna-btn {
        grid-column: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tna-profile-v5-jumpnav,
    .tna-profile-editor__tabs {
        scroll-behavior: auto;
    }
}
