/* Name tag looks from the cat shop (shop-looks.js): name colours, effects, fonts
   and an emoji. The overlay builds each name label as

       <div class="cat-name tag-namecolor-golden tag-effect-glow tag-font-pixel">
           <span class="tag-badge">🐾</span><span class="tag-text" data-text="Ada">Ada</span>
       </div>

   (data-text repeats the name, for effects drawn in the shape of its letters.)

   How strong each effect is comes from the streamer's settings (Shop → Colours and
   tags), as --fx-<effect> on the page: 1 = as designed, 0.25 to 2. The names' size
   is --name-size (overlay.css).

   so every part combines with every other: colours style the name text (not the
   emoji), while effects and fonts apply to the whole label. The app's Shop →
   Colours and tags page uses this same file for its previews. */

/* ── name colours: solid (beat the cat-coloured default set on the label) ── */
.cat-name.tag-namecolor-snow     { color: #ffffff !important; }
.cat-name.tag-namecolor-candy    { color: #ff7ac8 !important; }
.cat-name.tag-namecolor-lilac    { color: #c9a3ff !important; }
.cat-name.tag-namecolor-mint     { color: #7dffc4 !important; }
.cat-name.tag-namecolor-sunny    { color: #ffe14d !important; }
.cat-name.tag-namecolor-ocean    { color: #3fa9ff !important; }
/* near-black letters, so this one is outlined in white */
.cat-name.tag-namecolor-midnight { color: #14102a !important; }
.cat-name.tag-namecolor-midnight .tag-text {
    text-shadow: 0 0 1px #fff, 0 0 2px #fff, 0 0 2px #fff, 0 0 4px rgba(255, 255, 255, 0.8);
}

/* ── name colours: animated ──
   The letters are filled with a moving gradient. A text-shadow would cover that
   fill, so these names are outlined with drop-shadow filters instead. */
.cat-name.tag-namecolor-golden .tag-text,
.cat-name.tag-namecolor-fire .tag-text,
.cat-name.tag-namecolor-ice .tag-text,
.cat-name.tag-namecolor-rainbow .tag-text {
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(2px 0 0 #000) drop-shadow(-2px 0 0 #000) drop-shadow(0 2px 0 #000) drop-shadow(0 -2px 0 #000);
}
.cat-name.tag-namecolor-golden .tag-text {
    background-image: linear-gradient(100deg, #b8860b 0%, #ffd700 30%, #fffbe0 45%, #ffd700 60%, #b8860b 100%);
    background-size: 250% 100%;
    animation: tag-shine 2.8s linear infinite;
}
.cat-name.tag-namecolor-fire .tag-text {
    background-image: linear-gradient(0deg, #d61a00 0%, #ff6a00 40%, #ffd24a 75%, #fff3b0 100%);
    background-size: 100% 200%;
    animation: tag-flicker 0.9s ease-in-out infinite alternate;
}
.cat-name.tag-namecolor-ice .tag-text {
    background-image: linear-gradient(100deg, #3aa8ff 0%, #9be7ff 35%, #ffffff 50%, #9be7ff 65%, #3aa8ff 100%);
    background-size: 250% 100%;
    animation: tag-shine 3.6s linear infinite;
}
.cat-name.tag-namecolor-rainbow .tag-text {
    background-image: linear-gradient(90deg, #ff3b3b, #ff9f1a, #ffe14d, #4dff88, #3fd4ff, #6b6bff, #d36bff, #ff3b3b);
    background-size: 200% 100%;
    animation: tag-slide 2.5s linear infinite;
}
/* what a glow looks like on these (they have no single colour of their own) */
.cat-name.tag-namecolor-golden  { --tag-glow-color: #ffd700; }
.cat-name.tag-namecolor-fire    { --tag-glow-color: #ff6a00; }
.cat-name.tag-namecolor-ice     { --tag-glow-color: #9be7ff; }
.cat-name.tag-namecolor-rainbow { --tag-glow-color: #ffffff; }
@keyframes tag-shine   { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes tag-slide   { from { background-position: 0 0; } to { background-position: 200% 0; } }
@keyframes tag-flicker { from { background-position: 0 0; } to { background-position: 0 100%; } }

/* ── effects (one at a time; to add one, see EFFECTS in shop-looks.js) ── */
/* Glow: a soft halo in the name's colour */
.cat-name.tag-effect-glow {
    filter: drop-shadow(0 0 calc(4px * var(--fx-glow, 1)) var(--tag-glow-color, currentColor))
            drop-shadow(0 0 calc(8px * var(--fx-glow, 1)) var(--tag-glow-color, currentColor));
}

/* Sparkle: a twinkling star either side of the name, and glitter in its letters */
.cat-name.tag-effect-sparkle::before,
.cat-name.tag-effect-sparkle::after {
    content: '\2726';   /* ✦ */
    position: absolute;
    top: -0.4em;
    font-size: calc(0.8em * (0.6 + 0.4 * var(--fx-sparkle, 1)));
    color: #fff6a8;
    animation: tag-twinkle 1.6s ease-in-out infinite;
}
.cat-name.tag-effect-sparkle::before { left: calc(-0.9em * (0.6 + 0.4 * var(--fx-sparkle, 1))); }
.cat-name.tag-effect-sparkle::after  { right: calc(-0.9em * (0.6 + 0.4 * var(--fx-sparkle, 1))); animation-delay: 0.8s; }
@keyframes tag-twinkle { 0%, 100% { opacity: 0.15; transform: scale(0.6) rotate(0deg); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }

/* Bounce: the label hops gently. It's already moved by its own transform (centred
   over the cat), so this uses the separate translate property, which adds to it. */
.cat-name.tag-effect-bounce { animation: tag-bounce 1.2s ease-in-out infinite; }
@keyframes tag-bounce { 0%, 100% { translate: 0 0; } 50% { translate: 0 calc(-6px * var(--fx-bounce, 1)); } }

/* ...and its glitter: specks twinkling in the letters. A copy of the name (data-text)
   sits on top, filled only with specks, so they stay inside the letters' shape. */
.cat-name.tag-effect-sparkle .tag-text { position: relative; }
.cat-name.tag-effect-sparkle .tag-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    color: transparent;
    text-shadow: none;
    filter: none;
    -webkit-background-clip: text;
    background-clip: text;
    background-image:
        radial-gradient(circle, #ffffff 0 calc(0.9px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))), transparent calc(1.4px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7)))),
        radial-gradient(circle, #fff6c2 0 calc(0.8px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))), transparent calc(1.3px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7)))),
        radial-gradient(circle, #ffffff 0 calc(0.7px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))), transparent calc(1.2px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))));
    background-size: 5px 4px, 7px 6px, 9px 7px;
    background-position: 0 0, 3px 2px, 1px 4px;
    opacity: calc(0.15 + 0.25 * min(var(--fx-sparkle, 1), 2));   /* soft: a hint of glitter */
    animation: tag-glitter 0.9s steps(3) infinite;
}
@keyframes tag-glitter {
    0%, 100% { background-position: 0 0, 3px 2px, 1px 4px; }
    50%      { background-position: 2px 1px, 0 4px, 5px 1px; }
}

/* ...and glitter dust drifting up off the name (a .tag-dust with six specks, added by
   the overlay when the name has Sparkle), in the same colours as the cat's */
.cat-name .tag-dust { position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none; }
.cat-name .tag-dust i {
    position: absolute;
    bottom: 35%;
    width: calc(3px * (0.7 + 0.3 * var(--fx-sparkle, 1)));
    height: calc(3px * (0.7 + 0.3 * var(--fx-sparkle, 1)));
    border-radius: 50%;
    opacity: 0;
    animation: tag-dust 2.2s ease-out infinite;
}
.cat-name .tag-dust i:nth-child(1) { left: 8%;  background: #fff;    box-shadow: 0 0 4px #fff;    animation-delay: 0s; }
.cat-name .tag-dust i:nth-child(2) { left: 26%; background: #ffd973; box-shadow: 0 0 4px #ffd973; animation-delay: 0.7s; }
.cat-name .tag-dust i:nth-child(3) { left: 44%; background: #ff9edb; box-shadow: 0 0 4px #ff9edb; animation-delay: 1.5s; }
.cat-name .tag-dust i:nth-child(4) { left: 60%; background: #c9f1ff; box-shadow: 0 0 4px #c9f1ff; animation-delay: 0.35s; }
.cat-name .tag-dust i:nth-child(5) { left: 76%; background: #ffd973; box-shadow: 0 0 4px #ffd973; animation-delay: 1.1s; }
.cat-name .tag-dust i:nth-child(6) { left: 92%; background: #fff;    box-shadow: 0 0 4px #fff;    animation-delay: 1.8s; }
@keyframes tag-dust {
    0%   { opacity: 0; transform: translate(-50%, 0) scale(0.9); }
    15%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, calc(-1.7em * (0.6 + 0.4 * var(--fx-sparkle, 1)))) scale(0.4); }
}

/* Rainbow aura: a glow that cycles through every colour */
.cat-name.tag-effect-aura { animation: tag-aura 3s linear infinite; }
@keyframes tag-aura {
    0%   { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #ff3b3b) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #ff3b3b); }
    17%  { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #ff9f1a) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #ff9f1a); }
    33%  { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #ffe14d) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #ffe14d); }
    50%  { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #4dff88) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #4dff88); }
    67%  { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #3fd4ff) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #3fd4ff); }
    83%  { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #b56bff) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #b56bff); }
    100% { filter: drop-shadow(0 0 calc(5px * var(--fx-aura, 1)) #ff3b3b) drop-shadow(0 0 calc(9px * var(--fx-aura, 1)) #ff3b3b); }
}

/* Burning: flames flickering up behind the name (isolation keeps them inside the
   label, behind its letters) */
.cat-name.tag-effect-burning { isolation: isolate; }
.cat-name.tag-effect-burning::before {
    content: '';
    position: absolute;
    left: -10px;
    right: -10px;
    bottom: -2px;
    height: calc(230% * (0.4 + 0.6 * var(--fx-burning, 1)));
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 14% 55% at 8% 100%,  #ffe27a 0%, #ff7a00 50%, transparent 78%),
        radial-gradient(ellipse 15% 75% at 24% 100%, #fff3b0 0%, #ff9a1a 35%, #ff3d00 60%, transparent 80%),
        radial-gradient(ellipse 14% 62% at 40% 100%, #ffe27a 0%, #ff5a00 50%, transparent 78%),
        radial-gradient(ellipse 15% 82% at 56% 100%, #fff3b0 0%, #ff9a1a 35%, #ff3d00 60%, transparent 80%),
        radial-gradient(ellipse 14% 64% at 73% 100%, #ffe27a 0%, #ff5a00 50%, transparent 78%),
        radial-gradient(ellipse 15% 76% at 90% 100%, #fff3b0 0%, #ff9a1a 35%, #ff3d00 60%, transparent 80%);
    filter: blur(1px) drop-shadow(0 0 calc(4px * var(--fx-burning, 1)) #ff5a00);
    transform-origin: 50% 100%;
    animation: tag-burn 0.45s ease-in-out infinite alternate;
}
@keyframes tag-burn {
    from { transform: scaleY(0.82) skewX(-4deg); opacity: 0.85; }
    to   { transform: scaleY(1.12) skewX(4deg); opacity: 1; }
}

/* Glitch: in short bursts, the name splits into red and blue copies that jump
   sideways in sliced strips and the letters skew, like a broken screen; calm between.
   The copies are the name again (data-text), so this works with any colour and font. */
.cat-name.tag-effect-glitch .tag-text { position: relative; display: inline-block; animation: tag-glitch-skew 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-text::before,
.cat-name.tag-effect-glitch .tag-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    text-shadow: none;
    background: none;
    pointer-events: none;
    clip-path: inset(0 0 100% 0);
}
.cat-name.tag-effect-glitch .tag-text::before { color: #ff2a6d; -webkit-text-fill-color: #ff2a6d; animation: tag-glitch-a 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-text::after  { color: #05d9e8; -webkit-text-fill-color: #05d9e8; animation: tag-glitch-b 3s steps(1) infinite; }
@keyframes tag-glitch-a {
    0%, 24%, 34%, 72%, 80%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
    25% { clip-path: inset(8% 0 58% 0);  transform: translateX(calc(-3px * var(--fx-glitch, 1))); }
    27% { clip-path: inset(62% 0 8% 0);  transform: translateX(calc(3px * var(--fx-glitch, 1))); }
    29% { clip-path: inset(30% 0 40% 0); transform: translateX(calc(-4px * var(--fx-glitch, 1))); }
    31% { clip-path: inset(75% 0 2% 0);  transform: translateX(calc(2px * var(--fx-glitch, 1))); }
    73% { clip-path: inset(20% 0 50% 0); transform: translateX(calc(4px * var(--fx-glitch, 1))); }
    76% { clip-path: inset(55% 0 20% 0); transform: translateX(calc(-3px * var(--fx-glitch, 1))); }
}
@keyframes tag-glitch-b {
    0%, 24%, 34%, 72%, 80%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
    25% { clip-path: inset(50% 0 20% 0); transform: translateX(calc(3px * var(--fx-glitch, 1))); }
    28% { clip-path: inset(12% 0 64% 0); transform: translateX(calc(-3px * var(--fx-glitch, 1))); }
    30% { clip-path: inset(70% 0 6% 0);  transform: translateX(calc(4px * var(--fx-glitch, 1))); }
    32% { clip-path: inset(36% 0 34% 0); transform: translateX(calc(-2px * var(--fx-glitch, 1))); }
    74% { clip-path: inset(5% 0 70% 0);  transform: translateX(calc(-4px * var(--fx-glitch, 1))); }
    77% { clip-path: inset(40% 0 30% 0); transform: translateX(calc(3px * var(--fx-glitch, 1))); }
}
@keyframes tag-glitch-skew {
    0%, 24%, 34%, 72%, 80%, 100% { transform: none; opacity: 1; }
    26% { transform: skewX(calc(-8deg * var(--fx-glitch, 1))) translateX(calc(1px * var(--fx-glitch, 1))); }
    28% { transform: skewX(calc(6deg * var(--fx-glitch, 1))); opacity: 0.75; }
    30% { transform: translateX(calc(-2px * var(--fx-glitch, 1))); opacity: 1; }
    75% { transform: skewX(calc(5deg * var(--fx-glitch, 1))) translateX(calc(2px * var(--fx-glitch, 1))); opacity: 0.8; }
}

/* ── fonts (Google Fonts, loaded by overlay.html) ── */
.cat-name.tag-font-bubbly { font-family: 'Fredoka', 'DynaPuff', cursive; font-weight: 600; }
.cat-name.tag-font-comic  { font-family: 'Bangers', 'DynaPuff', cursive; font-weight: 400; letter-spacing: 1px; }
.cat-name.tag-font-marker { font-family: 'Permanent Marker', 'DynaPuff', cursive; font-weight: 400; }
.cat-name.tag-font-script { font-family: 'Pacifico', 'DynaPuff', cursive; font-weight: 400; }
.cat-name.tag-font-spooky { font-family: 'Creepster', 'DynaPuff', cursive; font-weight: 400; letter-spacing: 1px; }
.cat-name.tag-font-pixel  { font-family: 'Press Start 2P', 'DynaPuff', cursive; font-weight: 400; font-size: calc(11px * var(--name-size, 1)); }

/* ── the emoji (or emote picture) in front of the name ── */
.cat-name .tag-badge { margin-right: 4px; }
.cat-name .tag-badge img { height: 1.4em; width: auto; vertical-align: -0.35em; }

/* Glitch and Sparkle on an emote picture too (the overlay gives its badge the class
   tag-badge-img and its picture as --badge-url). They're drawn in the picture's shape,
   using it as a mask, in the same rhythm as the name's. */
/* the picture as a block in a box its own size, which sits on the line like a plain
   picture would (its bottom edge 0.35em below the text's baseline) */
.cat-name .tag-badge-img { position: relative; display: inline-block; vertical-align: -0.35em; }
.cat-name .tag-badge-img img { display: block; vertical-align: 0; }
.cat-name.tag-effect-glitch .tag-badge-img { animation: tag-glitch-skew 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-badge-img::before,
.cat-name.tag-effect-glitch .tag-badge-img::after,
.cat-name.tag-effect-sparkle .tag-badge-img::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    -webkit-mask: var(--badge-url) center / contain no-repeat;
    mask: var(--badge-url) center / contain no-repeat;
}
.cat-name.tag-effect-glitch .tag-badge-img::before { background: #ff2a6d; opacity: 0.85; clip-path: inset(0 0 100% 0); animation: tag-glitch-a 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-badge-img::after  { background: #05d9e8; opacity: 0.85; clip-path: inset(0 0 100% 0); animation: tag-glitch-b 3s steps(1) infinite; }

/* Glitch on a typed emoji: emojis are colour pictures in the font, so colouring the
   text doesn't tint them; the copies are tinted red and blue with filters instead */
.cat-name.tag-effect-glitch .tag-badge:not(.tag-badge-img):not(.tag-badge-lottie) { position: relative; display: inline-block; animation: tag-glitch-skew 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-badge:not(.tag-badge-img):not(.tag-badge-lottie)::before,
.cat-name.tag-effect-glitch .tag-badge:not(.tag-badge-img):not(.tag-badge-lottie)::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    text-shadow: none;
    pointer-events: none;
    clip-path: inset(0 0 100% 0);
}
.cat-name.tag-effect-glitch .tag-badge:not(.tag-badge-img):not(.tag-badge-lottie)::before { filter: brightness(0.55) sepia(1) saturate(9) hue-rotate(-45deg); animation: tag-glitch-a 3s steps(1) infinite; }
.cat-name.tag-effect-glitch .tag-badge:not(.tag-badge-img):not(.tag-badge-lottie)::after  { filter: brightness(0.75) sepia(1) saturate(9) hue-rotate(140deg); animation: tag-glitch-b 3s steps(1) infinite; }
/* A Lottie animation (.json emote): the player draws it as an SVG in this box, 1.4em
   tall like a picture and as wide as the animation's shape (the overlay sets the width). */
.cat-name .tag-badge-lottie { display: inline-block; width: 1.4em; height: 1.4em; vertical-align: -0.35em; position: relative; }
.cat-name .tag-badge-lottie svg { display: block; }
/* Glitch on one: it can't be used as a mask like a picture, so in the same bursts it
   skews and throws red and blue copies of its outline sideways */
.cat-name.tag-effect-glitch .tag-badge-lottie { animation: tag-glitch-skew 3s steps(1) infinite, tag-glitch-split 3s steps(1) infinite; }
@keyframes tag-glitch-split {
    0%, 24%, 34%, 72%, 80%, 100% { filter: none; }
    25%, 29% { filter: drop-shadow(calc(-3px * var(--fx-glitch, 1)) 0 0 #ff2a6d) drop-shadow(calc(3px * var(--fx-glitch, 1)) 0 0 #05d9e8); }
    27%, 31% { filter: drop-shadow(calc(3px * var(--fx-glitch, 1)) 0 0 #ff2a6d) drop-shadow(calc(-4px * var(--fx-glitch, 1)) 0 0 #05d9e8); }
    73%, 76% { filter: drop-shadow(calc(4px * var(--fx-glitch, 1)) 0 0 #ff2a6d) drop-shadow(calc(-3px * var(--fx-glitch, 1)) 0 0 #05d9e8); }
}
.cat-name.tag-effect-sparkle .tag-badge-img::after {
    background-image:
        radial-gradient(circle, #ffffff 0 calc(0.9px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))), transparent calc(1.4px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7)))),
        radial-gradient(circle, #fff6c2 0 calc(0.8px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))), transparent calc(1.3px * (0.5 + 0.5 * min(var(--fx-sparkle, 1), 1.7))));
    background-size: 5px 4px, 7px 6px;
    background-position: 0 0, 3px 2px;
    opacity: calc(0.25 + 0.3 * min(var(--fx-sparkle, 1), 2));
    animation: tag-glitter 0.9s steps(3) infinite;
}
