/* LDBadges (badges.js): tier rings + emblems on avatars, emblems after
 * usernames, site-wide. --ld-tier is the tier accent ("r,g,b");
 * --ld-avatar the avatar's rendered width. Tier mockups: profile, image viewer. */
.ld-avatar { position: relative; line-height: 0; }
/* Ring outside the avatar with a thin dark gap, as drawn (2px on small
 * avatars; the profile's large one is thicker and glows). */
.ld-avatar > .ld-ring { box-shadow: 0 0 0 2px #0b0d13, 0 0 0 4px rgb(var(--ld-tier)); }
.ld-avatar.is-large > .ld-ring { box-shadow: 0 0 0 5px rgb(var(--ld-tier)), 0 0 40px rgba(var(--ld-tier), .32); }
.ld-avatar-emblem { position: absolute; right: -5px; bottom: -5px; /* no z-index: it would paint over dropdowns (notifications) */ display: flex; align-items: center; justify-content: center;
  width: max(14px, calc(var(--ld-avatar, 32px) * .5)); height: max(14px, calc(var(--ld-avatar, 32px) * .5));
  border-radius: 50%; background: #0b0d13; pointer-events: none; }
.ld-avatar-emblem img { display: block; width: 94%; height: 94%; }
.ld-avatar.is-large .ld-avatar-emblem { right: 4px; bottom: 4px; width: calc(var(--ld-avatar) * .29); height: calc(var(--ld-avatar) * .29); background: #050608; }
/* The username (with its emblem) sits beside this avatar: ring only. */
.ld-avatar.is-named .ld-avatar-emblem { display: none; }
.ld-name-badged { white-space: nowrap; }
.ld-name-emblem { display: inline-block; width: 1em; height: 1em; margin-left: .3em; vertical-align: -.14em; }
@media (prefers-reduced-motion: reduce) { .ld-name-emblem, .ld-avatar-emblem img { animation: none !important; } }

/* ---- Profile (tier mockups profile-desktop|mobile), views/user.php ----
 * Avatar centred over the cover, name + chip on the left, counts on the
 * right; on phones one centred column. Uses Chevereto's own markup; the
 * credentials box is dissolved into the grid with display: contents. */
.ld-profile-cover { height: 170px; background: linear-gradient(135deg, #2a2d33, #15171b); border-bottom: 2px solid #2a2f37; }
#background-cover:has(+ .content-width #top-user.ld-profile) { min-height: 170px; }
#top-user.ld-profile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr); column-gap: 20px;
  align-items: start; min-height: 0; height: auto; padding: 18px 0 0; }
#top-user.ld-profile > .top-user-credentials { display: contents; }
#top-user.ld-profile .top-user-credentials > * { grid-column: 1; margin-left: 0; margin-right: 0; }
/* Peafowl positions the avatar absolutely (left: 0, or left: 50% plus
 * offsets when the profile has a cover); in this grid it is a normal item in
 * every case, including the owner's view with the cover editor. */
#top-user.ld-profile { padding-inline-start: 0 !important; padding-inline-end: 0 !important; }
#top-user.ld-profile .top-user-avatar { position: relative !important; left: auto !important; right: auto !important; top: auto !important;
  margin-inline-start: 0 !important; margin-inline-end: 0 !important;
  grid-column: 2; grid-row: 1 / span 8; justify-self: center; margin-top: -93px; float: none; }
#top-user.ld-profile .top-user-avatar .user-image { width: 150px !important; height: 150px !important; font-size: 150px; border: 0 !important; margin: 0 !important; float: none; background: #0b0d13; }
#top-user.ld-profile .top-user-avatar .default-user-image .icon { font-size: 150px; }
#top-user.ld-profile > .header-content-right { grid-column: 3; grid-row: 1 / span 8; position: static; text-align: right; }
#top-user.ld-profile h1 { margin: 0; font: 700 22px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#top-user.ld-profile h1 a { display: inline-flex; align-items: center; color: #fff; }
#top-user.ld-profile h1 .ld-name-emblem { width: 20px; height: 20px; margin-left: 8px; }
.ld-profile-chip { justify-self: start; width: max-content; max-width: 100%; margin: 6px 0 8px; padding: 3px 10px; border-radius: 12px;
  background: rgba(var(--ld-tier), .14); border: 1px solid rgba(var(--ld-tier), .4); font: 600 11.5px -apple-system, sans-serif; color: rgb(var(--ld-tier)); }
.ld-profile-chip.is-free { --ld-tier: 138, 146, 156; color: #9aa3ad; }
.ld-profile-nudge { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 24px 0 0; padding: 16px 20px; border-radius: 12px;
  background: radial-gradient(100% 160% at 100% 0%, rgba(14, 229, 155, .14), rgba(14, 229, 155, 0) 60%), #0f1216; border: 1px solid rgba(14, 229, 155, .25); }
.ld-profile-nudge-text { display: flex; align-items: center; gap: 14px; }
.ld-profile-nudge-text img { flex: none; }
.ld-profile-nudge-text strong { display: block; margin-bottom: 3px; font: 700 14px "Archivo", -apple-system, sans-serif; color: #fff; }
.ld-profile-nudge-text span { font: 400 12.5px/1.4 -apple-system, sans-serif; color: #9aa3ad; }
.ld-profile-nudge-btn { min-height: 40px; display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 9px; background: #0ee59b; color: #06231a !important; font: 700 13px -apple-system, sans-serif; text-decoration: none; }
.ld-profile-nudge-btn:hover { background: #37f0ae; }

@media (max-width: 720px) {
  .ld-profile-cover { height: 220px; }
  #background-cover:has(+ .content-width #top-user.ld-profile) { min-height: 220px; }
  #top-user.ld-profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 0; }
  #top-user.ld-profile .top-user-avatar { margin-top: -120px !important; }
  #top-user.ld-profile .top-user-avatar .user-image { width: 180px !important; height: 180px !important; font-size: 180px; }
  #top-user.ld-profile .top-user-avatar .default-user-image .icon { font-size: 180px; }
  #top-user.ld-profile h1 { margin-top: 18px; font-size: 30px; }
  #top-user.ld-profile h1 .ld-name-emblem { width: 24px; height: 24px; }
  .ld-profile-chip { justify-self: center; align-self: center; margin: 8px auto; font-size: 12px; padding: 4px 12px; border-radius: 14px; }
  #top-user.ld-profile > .header-content-right { width: 100%; margin-top: 14px; text-align: center; }
  #top-user.ld-profile > .header-content-right .text-align-right { text-align: center; }
  .ld-profile-nudge { display: block; margin: 16px 0 20px; padding: 16px; }
  .ld-profile-nudge-text { margin-bottom: 12px; text-align: left; }
  .ld-profile-nudge-btn { width: 100%; justify-content: center; min-height: 44px; }
}

/* ---- Image viewer (tier mockups image-viewer-desktop|mobile) ----
 * The owner card gains the username (+ emblem) and a "Tier member" label. */
.ld-owner-card { display: inline-flex !important; align-items: center; gap: 12px; }
.ld-owner-text { display: flex; flex-direction: column; line-height: 1.25; }
.ld-owner-name { font: 700 13.5px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #eceef1 !important; text-decoration: none; }
.ld-owner-label { font: 400 11.5px -apple-system, sans-serif; color: rgb(var(--ld-tier)); }
.ld-adfree-nudge { background: linear-gradient(90deg, rgba(14, 229, 155, .12), rgba(14, 229, 155, .03)); border-top: 1px solid rgba(14, 229, 155, .25); border-bottom: 1px solid rgba(14, 229, 155, .25); }
.ld-adfree-nudge-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.ld-adfree-nudge-text { display: flex; align-items: center; gap: 10px; font: 400 12.5px/1.4 -apple-system, sans-serif; color: #c3c9d0; }
.ld-adfree-nudge-text img { flex: none; }
.ld-adfree-nudge-btn { flex: none; min-height: 34px; display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 7px; background: #0ee59b; color: #06231a !important; font: 700 12.5px -apple-system, sans-serif; text-decoration: none; }
.ld-adfree-nudge-btn:hover { background: #37f0ae; }
.ld-adfree-short { display: none; }
@media (max-width: 720px) {
  .ld-adfree-long { display: none; }
  .ld-adfree-short { display: inline; }
  .ld-adfree-nudge-text { font-size: 12px; }
}
