/* ═══════════════════════════════════════════════════════════════
   Profile Customization — settings UI
   ═══════════════════════════════════════════════════════════════ */

.profile-customization-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
}

.profile-customization-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.profile-customization-title .ui-icon,
.profile-customization-title svg {
    width: 15px;
    height: 15px;
    color: var(--profile-custom-accent, var(--c-basic));
}

.profile-customization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.profile-customization-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}

.profile-customization-field .profile-input {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
}

.profile-customization-badge {
    display: none; /* shown via JS when text is set */
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--profile-custom-accent-soft, rgba(16, 185, 129, 0.14));
    border: 1px solid color-mix(in srgb, var(--profile-custom-accent, var(--c-basic)) 36%, transparent);
    color: var(--profile-custom-accent, var(--c-basic));
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

#profile-customization-badge {
    flex-shrink: 0;
}

.pp-customization-badge {
    flex: 0 1 auto;
    max-width: min(100%, 180px);
    min-height: 22px;
    margin: 0;
    padding: 3px 9px;
    font-size: 11px;
    line-height: 1.2;
}

.partner-profile-modal .pp-title-row {
    flex-wrap: wrap;
    justify-content: center;
}

.partner-profile-modal .pp-name {
    flex: 0 1 auto;
    max-width: 100%;
}

/* ── Nick row: badge sits inline after the nickname ──────────── */
.profile-hero-nick-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.profile-hero-nick-row .profile-hero-nick {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Settings preview badge row ───────────────────────────────── */
.profile-settings-preview-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
    margin-top: 2px;
}

.profile-settings-preview-badge {
    flex-shrink: 0;
    font-size: 11px;
    min-height: 20px;
    padding: 2px 8px;
}

body.light .profile-customization-settings {
    background: var(--surface-2);
    border-color: var(--border);
}

body.light .profile-customization-badge {
    background: color-mix(in srgb, var(--profile-custom-accent, var(--c-basic)) 12%, white);
}

@media (max-width: 560px) {
    .profile-customization-grid {
        grid-template-columns: 1fr;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Profile Cover System
   ---------------------------------------------------------------
   Architecture (static, zero-animation profile covers):

   Each card/modal gets position: relative + overflow: hidden.

   ::before  — generated WebP artwork (no animation, painted once)
   ::after   — static readability/accent layer

   Isolation:
     contain: layout style paint  → limits repaint scope to card

   Covers are intentionally static: no drift, no scroll-time hiding,
   no transition or animation work inside profile surfaces.
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared cover infrastructure ──────────────────────────────── */

.profile-card {
    /* The non-scrolling card can safely isolate cover paints. The partner modal
       is the scroll container and must not be promoted into one giant paint box. */
    contain: style paint;
    overflow: hidden;
}

/* children stay above the cover layers */
.profile-card > *,
.partner-profile-modal > * {
    position: relative;
    z-index: 1;
}

/* Base (::before) + accent (::after) cover layers */
.profile-card[data-profile-cover]:not([data-profile-cover="none"])::before,
.partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::before,
.profile-card[data-profile-cover]:not([data-profile-cover="none"])::after,
.partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::after {
    content: "";
    position: absolute;
    /* Constrain to top ~180px — covers fade out naturally,
       so no overflow:hidden needed on the scrollable modal */
    inset: 0 0 auto 0;
    height: 180px;
    width: 100%;
    pointer-events: none;
    border-radius: inherit;
}

/* Generated artwork: painted once, no animation. The URL comes only from the
   shared allow-listed contract; profile JSON is never interpolated into CSS. */
.profile-card[data-profile-cover]:not([data-profile-cover="none"])::before,
.partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::before {
    z-index: 0;
    background-image:
        linear-gradient(180deg, rgba(5, 8, 14, 0.08) 0%, rgba(5, 8, 14, 0.18) 44%, rgba(5, 8, 14, 0.92) 100%),
        var(--profile-cover-image);
    background-position: center 38%;
    background-repeat: no-repeat;
    background-size: cover;
    /* The first background gradient performs the fade. Do not add a CSS mask here:
       this pseudo-element lives inside the scrolling partner profile and browser
       engines otherwise software-rasterize the mask again on every scroll frame. */
    opacity: 0.94;
}

.profile-customization-help {
    display: block;
    color: var(--text-3, rgba(255, 255, 255, 0.58));
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}

/* The selected accent gently ties the artwork, frame, and controls together. */
.profile-card[data-profile-cover]:not([data-profile-cover="none"])::after,
.partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::after {
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 95% at 12% 8%, color-mix(in srgb, var(--profile-custom-accent) 22%, transparent) 0%, transparent 62%),
        radial-gradient(ellipse 72% 88% at 88% 12%, color-mix(in srgb, var(--profile-custom-accent-end) 20%, transparent) 0%, transparent 65%);
    opacity: 0.72;
}


/* ── "none" preset: no cover layers at all ──────────────────── */
.profile-card[data-profile-cover="none"]::before,
.partner-profile-modal[data-profile-cover="none"]::before,
.profile-card[data-profile-cover="none"]::after,
.partner-profile-modal[data-profile-cover="none"]::after {
    content: none;
}


/* ── Light mode: de-saturate slightly so covers don't overpower ─ */
body.light .profile-card[data-profile-cover]:not([data-profile-cover="none"])::before,
body.light .partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::before {
    opacity: 0.45;
}
body.light .profile-card[data-profile-cover]:not([data-profile-cover="none"])::after,
body.light .partner-profile-modal[data-profile-cover]:not([data-profile-cover="none"])::after {
    opacity: 0.30;
}

/* Profile surfaces are intentionally static. Hover/focus states may still
   change immediately, but no CSS animation or transition should run inside profiles. */
.profile-card,
.profile-card *,
.profile-card::before,
.profile-card::after,
.profile-card *::before,
.profile-card *::after,
.profile-settings-avatar,
.profile-settings-avatar *,
.profile-settings-avatar::before,
.profile-settings-avatar::after,
.profile-settings-avatar *::before,
.profile-settings-avatar *::after,
.partner-profile-overlay,
.partner-profile-overlay *,
.partner-profile-overlay::before,
.partner-profile-overlay::after,
.partner-profile-overlay *::before,
.partner-profile-overlay *::after,
.partner-profile-modal,
.partner-profile-modal *,
.partner-profile-modal::before,
.partner-profile-modal::after,
.partner-profile-modal *::before,
.partner-profile-modal *::after,
.pp-photo-context-menu,
.pp-photo-context-menu *,
.pp-photo-context-menu::before,
.pp-photo-context-menu::after,
.pp-photo-context-menu *::before,
.pp-photo-context-menu *::after {
    animation: none !important;
    transition: none !important;
}
