/* Unlockable profile pictures: a worn avatar wherever a player's picture shows (.avatar.art, ui/parts.js avatar), the
   picker sheet (ui/avatar-picker.js: .av-*), the profile picture button and the "New picture unlocked!" toast.
   Two-tone art sits on its set's brand circle (--av-bg, from web/js/avatar-catalog.js colour). */

/* A worn avatar: the art inside its brand circle at every size. Beats the profile's cyan xl background (more.css). */
.avatar.art, .more-profile .m-id .avatar.xl.art { background: var(--av-bg, var(--cyan)) !important; }
/* Each file is already laid out for its circle (scripts/build-avatars.mjs): an inner disc at --av-disc of the radius, centred,
   and nothing past the edge, so it fills the circle and is never cropped. The set colour shows as one even ring round the disc. */
.avatar.art { --av-disc: 86%; position: relative; isolation: isolate; } /* layers stay inside: a badge on the picture (Home streak) is never covered */
.avatar.art img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: fill; }
/* A worn frame REPLACES that ring: the set colour goes and the frame paints the same band (art poking out stays on top). */
.avatar.art[data-frame] { background: transparent !important; outline: none; box-shadow: none; }
.avatar.art[data-frame]::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  -webkit-mask: radial-gradient(closest-side, transparent calc(var(--av-disc) - 1%), #000 calc(var(--av-disc) - .5%));
  mask: radial-gradient(closest-side, transparent calc(var(--av-disc) - 1%), #000 calc(var(--av-disc) - .5%));
  background: var(--frame-paint, var(--av-bg));
}
.avatar.art[data-frame="reel"] { --frame-paint: repeating-conic-gradient(var(--cream) 0 12deg, #26304d 12deg 20deg); }
.avatar.art[data-frame="marquee"] { --frame-paint: repeating-conic-gradient(var(--gold) 0 7deg, #3a2e14 7deg 15deg); }
.avatar.art[data-frame="star"] { --frame-paint: radial-gradient(closest-side, var(--gold) 90.5%, #3a2e14 0 95.5%, var(--gold) 0); }
.avatar.art[data-frame="flame"] { --frame-paint: radial-gradient(closest-side, #ffb18c 93%, #793c29 0); }
.avatar.art[data-frame="velvet"] { --frame-paint: radial-gradient(closest-side, #c4122f 93%, #f2b233 0); }
.avatar.art[data-frame="threestrip"] { --frame-paint: conic-gradient(#1aa6c7 0 33.3%, #c42d53 0 66.6%, #f2b233 0); }
.avatar.art[data-frame="searchlights"] { --frame-paint: conic-gradient(from 0deg, #1b2450, #fff6c8 6%, #1b2450 14%, #1b2450 50%, #fff6c8 56%, #1b2450 64%, #1b2450); }
.avatar.art[data-frame="flashbulb"] { --frame-paint: repeating-conic-gradient(#f2b233 0 8deg, #fffdf2 8deg 12deg, #f2b233 12deg 30deg); }

/* Profile: the big picture is a button that opens the picker. */
.av-pick-btn { position: relative; display: inline-grid; place-items: center; padding: 0; border: 0; background: none; color: inherit;
  border-radius: 50%; cursor: pointer; min-width: 44px; min-height: 44px; }
.av-pick-btn .av-edit { position: absolute; right: 2px; bottom: 2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold); color: var(--text-inverse); box-shadow: 0 0 0 3px var(--bg); }
.av-pick-btn .av-edit svg { width: 16px; height: 16px; }
.av-pick-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* The picker sheet */
.av-sheet { padding-bottom: var(--s4); }
.av-top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.av-top .av-tile { flex: none; width: clamp(76px, 22vw, 96px); }
.av-intro { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.35; }
.av-set + .av-set { margin-top: clamp(var(--s4), 3dvh, var(--s6)); }
.av-h { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 var(--s3); font: 600 var(--fs-lg)/1.2 var(--font-display); }
.av-count { color: var(--text-2); font: 600 var(--fs-sm) var(--font-body); }
/* Columns follow the width: 3 on the smallest phones, 4 on most phones, more on tablets (the sheet caps its width). */
.av-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(8px, 2.4vw, 14px);
  grid-template-columns: repeat(auto-fill, minmax(clamp(68px, 19vw, 96px), 1fr)); }
.av-grid > li { min-width: 0; }
.av-tile { position: relative; width: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 3px 8px; border: 0; container-type: inline-size; border-radius: var(--radius); background: var(--bg-inset); color: var(--text); cursor: pointer;
  font: inherit; -webkit-tap-highlight-color: transparent; transition: transform var(--dur-fast, .12s), background var(--dur-fast, .12s); }
.av-tile:active { transform: scale(.96); }
.av-tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.av-art { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--av-bg); overflow: hidden; }
.av-art img { width: 100%; height: 100%; } /* laid out for its circle (scripts/build-avatars.mjs) */
.av-art.av-photo { background: var(--bg-card); color: var(--text-2); box-shadow: inset 0 0 0 2px var(--line-strong); }
.av-art.av-photo svg { width: 42%; height: 42%; }
.av-art.sm { width: 48px; flex: none; }
/* Names shrink with the tile (container units) so the longest word ("Projectionist") never breaks mid-word. */
.av-name { width: 100%; font-size: clamp(9.5px, 12.5cqi, var(--fs-xs)); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; text-align: center; overflow-wrap: normal; }
/* Wearing it: a gold ring. */
.av-tile[aria-pressed="true"] { background: var(--gold-tint); }
.av-tile[aria-pressed="true"] .av-art { box-shadow: 0 0 0 3px var(--bg-inset), 0 0 0 6px var(--gold); }
/* Locked: dimmed art, a lock, how far along. */
.av-tile[data-state="locked"] .av-art, .av-tile[data-state="stubs"] .av-art { filter: grayscale(.85) brightness(.55); }
.av-tile[data-state="locked"] .av-name, .av-tile[data-state="stubs"] .av-name { color: var(--text-2); }
.av-lock { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); color: var(--text); box-shadow: 0 0 0 2px var(--line-strong); }
.av-lock svg { width: 13px; height: 13px; }
.av-tile[data-state="stubs"] .av-lock { color: var(--gold); }
.av-bar { display: block; width: 80%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.av-bar > i { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.av-price { font-size: var(--fs-xs); font-weight: 800; color: var(--gold); }
/* Choosing: a quick pop. */
.av-pop .av-art, .av-art.av-pop { animation: av-pop .42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes av-pop { 0% { transform: scale(.82); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* The detail strip pinned under the grid: how to unlock, or Buy. */
.av-foot:empty { display: none; }
.av-detail { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0 calc(var(--s2) + var(--safe-bottom, 0px)); border-top: 1px solid var(--line); }
.av-detail .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.av-detail .s { color: var(--text-2); font-size: var(--fs-sm); }
.av-detail .av-bar { width: 100%; height: 6px; }
.av-detail .btn { flex: none; min-height: 44px; }

/* The unlock toast */
.av-signup .av-intro { margin-bottom: var(--s3); }
.av-signup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.av-signup-actions { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0 calc(var(--s3) + var(--safe-bottom, 0px)); }
.av-signup-actions .btn { flex: 1; }
.av-signup-actions .link-btn { min-width: 64px; min-height: 44px; }
@media (max-height: 600px) {
  .av-signup-grid .av-art { max-width: 70px; }
  .av-signup-grid .av-tile { padding: 6px 3px; }
}

.av-toast { display: flex; align-items: center; gap: var(--s3); text-align: left; }
.av-toast .av-art.sm { width: 44px; }

/* Settings row picture */
.m-row .av-row-pic { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .av-pop .av-art, .av-art.av-pop { animation: none; }
  .av-tile { transition: none; }
}

/* Golden shimmer (catalog fx 'gold', the Typewriter): a gold ring instead of the set colour and a slow sweep of light
   over the picture. A worn frame still replaces the ring; the sweep stays. */
[data-av-fx="gold"] { --av-bg: linear-gradient(135deg, #a8740f, #ffe28a 40%, #f2b233 55%, #a8740f) !important; background: var(--av-bg) !important;
  position: relative; overflow: hidden; border-radius: 50%; }
.avatar.art[data-av-fx="gold"][data-frame] { background: transparent !important; overflow: visible; }
[data-av-fx="gold"]::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 240, 180, .65) 48%, rgba(255, 255, 255, .85) 50%, rgba(255, 240, 180, .65) 52%, transparent 65%) no-repeat;
  background-size: 260% 100%; mix-blend-mode: screen; animation: av-gold-sweep 3.2s ease-in-out infinite; }
@keyframes av-gold-sweep { 0%, 30% { background-position: 130% 0; } 75%, 100% { background-position: -30% 0; } }
@media (prefers-reduced-motion: reduce) { [data-av-fx="gold"]::after { animation: none; background-position: 50% 0; opacity: .5; } }
