/* R8: profile links. Brand hex lives only here (CSP: no inline styles) —
   each platform sets --brand, and chips/rows read it. Keys mirror
   SocialPlatform::DEFS and BrandIcon::PATHS; keep the three in sync.

   Values are each brand's official hex where that hex is legible on our dark
   surface. Four marks are near-black by brand (X, GitHub, Steam, Tumblr), so
   dark theme carries a lightened stand-in and the light-theme block below
   restores the real one. */

.social-brand--reddit { --brand: #ff4500; }
.social-brand--instagram { --brand: #ff0069; }
.social-brand--tiktok { --brand: #fe2c55; }
.social-brand--youtube { --brand: #ff0000; }
.social-brand--twitch { --brand: #9146ff; }
.social-brand--bluesky { --brand: #1185fe; }
.social-brand--mastodon { --brand: #6364ff; }
.social-brand--discord { --brand: #5865f2; }
.social-brand--spotify { --brand: #1db954; }
.social-brand--kofi { --brand: #ff5e5b; }
.social-brand--website { --brand: var(--color-accent); }

/* Near-black brands: readable stand-ins for the dark theme. */
.social-brand--x { --brand: #e7e9ea; }
.social-brand--github { --brand: #e6edf3; }
.social-brand--steam { --brand: #66c0f4; }
.social-brand--tumblr { --brand: #8ea9c9; }

[data-theme="light"] .social-brand--x { --brand: #000000; }
[data-theme="light"] .social-brand--github { --brand: #181717; }
[data-theme="light"] .social-brand--steam { --brand: #1b2838; }
[data-theme="light"] .social-brand--tumblr { --brand: #36465d; }
/* Pure red burns on a white background; YouTube's own light-mode red. */
[data-theme="light"] .social-brand--youtube { --brand: #e60000; }
/* Spotify green and Ko-fi coral fall under 3:1 on a near-white surface,
   so the light theme takes a deeper shade of each. */
[data-theme="light"] .social-brand--spotify { --brand: #158f40; }
[data-theme="light"] .social-brand--kofi { --brand: #d94b48; }

/* --- Chips on the public profile --- */

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.social-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-family: var(--font-body);
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition), transform var(--transition);
}

.social-chip:hover,
.social-chip:focus-visible {
    border-color: var(--brand, var(--color-accent));
    background-color: var(--color-surface-hover);
    /* A wash of the brand, not the brand itself — the chip stays ours. */
    background-color: color-mix(in srgb, var(--brand, var(--color-accent)) 12%, var(--color-surface));
    transform: translateY(-1px);
}

.social-chip__icon {
    width: 16px;
    height: 16px;
    color: var(--brand, var(--color-accent));
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .social-chip {
        transition: none;
    }

    .social-chip:hover,
    .social-chip:focus-visible {
        transform: none;
    }
}

.social-chip__label {
    font-weight: 600;
}

.social-chip__handle {
    color: var(--color-text-muted);
    max-width: 16ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Editor rows on /account --- */

.link-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.link-editor__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
}

.link-editor__label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    width: 8.5rem;
    flex-shrink: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

.link-editor__icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(var(--color-surface-rgb), 0.9);
    border: 1px solid var(--color-border);
}

.link-editor__icon {
    width: 15px;
    height: 15px;
    color: var(--brand, var(--color-accent));
}

.link-editor__input {
    flex: 1 1 12rem;
    min-width: 0;
}

.link-editor__input:focus {
    border-color: var(--brand, var(--color-accent));
}

/* Save button only matters once the field differs from what is stored. */
.link-editor__save {
    visibility: hidden;
}

.link-editor__row--dirty .link-editor__save {
    visibility: visible;
}

/* A filled-in row reads as active: its mark sits on a wash of its own brand. */
.link-editor__row--saved .link-editor__icon-wrap {
    border-color: var(--brand, var(--color-accent));
    background-color: color-mix(in srgb, var(--brand, var(--color-accent)) 14%, var(--color-surface));
}

@media (max-width: 600px) {
    .link-editor__label {
        width: 100%;
    }

    .link-editor__save {
        visibility: visible;
    }
}
