/* ══════════════════════════════════════════════════════════════════
   FLOATING TELEGRAM BUTTON  (partials/tg_float)

   SafeAsset's own (mockup/telegram/float.html A, "gold coin and a purple
   card"): a milled gold coin with the Telegram plane on a purple face,
   floating bottom right on the landing page, the sign-in pages and the member
   area. With two or more links it opens a purple card with a gold edge: the
   support account and the community group, each with its Telegram photo (the
   vault medals), its @name and a gold arrow. One widget on a page, not two.

   Self-contained colours, as all three layouts load this file and name their
   tokens differently.

   Under the member area's sheets and their scrim (44+), so it never covers a
   panel that is open; above the phone's bottom bar there, and above the
   landing's cookie card.
   ══════════════════════════════════════════════════════════════════ */

.tg-fab { position: fixed; right: 20px; bottom: 20px; z-index: 42; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }

/* the coin: a milled gold rim round a purple face, the plane struck in champagne */
.tg-btn { position: relative; display: grid; place-items: center; width: 62px; height: 62px; padding: 5px; border: 0; border-radius: 50%; color: #FDF0C9; cursor: pointer;
    background: radial-gradient(circle at 36% 28%, #7C3AED, #3B0F7A 60%, #1C0B3C) content-box, repeating-conic-gradient(from 2deg, #FFF1C6 0 5deg, #B07A2C 5deg 10deg) padding-box;
    box-shadow: 0 0 0 1px #4A2C08, 0 4px 0 #8A5A1C, 0 6px 0 #4A2C08, 0 18px 30px -8px rgba(0, 0, 0, .8), 0 0 0 8px rgba(232, 184, 95, .14);
    animation: tg-float 3.2s ease-in-out infinite; transition: transform .2s, box-shadow .2s; }
.tg-btn svg { width: 26px; height: 26px; margin-left: -3px; fill: currentColor; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .5)); transition: transform .25s, opacity .2s; }
.tg-btn:hover { box-shadow: 0 0 0 1px #4A2C08, 0 4px 0 #8A5A1C, 0 6px 0 #4A2C08, 0 22px 36px -8px rgba(0, 0, 0, .85), 0 0 0 10px rgba(232, 184, 95, .22); }
.tg-btn:focus-visible { outline: 3px solid #E8B85F; outline-offset: 4px; }
/* a gold ring going out from it, now and then */
.tg-btn::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #E8B85F; opacity: 0; animation: tg-ring 3.2s ease-out infinite; pointer-events: none; }
/* open: the plane turns into a close mark */
.tg-btn .tg-x { position: absolute; width: 22px; height: 22px; margin: 0; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; opacity: 0; transform: rotate(-90deg); filter: none; }
.tg-fab.is-open .tg-btn { animation: none; }
.tg-fab.is-open .tg-btn::before { animation: none; }
.tg-fab.is-open .tg-btn svg:first-child { opacity: 0; transform: rotate(90deg) scale(.6); }
.tg-fab.is-open .tg-btn .tg-x { opacity: 1; transform: none; }

/* the card: deep purple, a gold foil edge, a light from above */
.tg-menu { width: min(310px, calc(100vw - 40px)); padding: 16px; border: 1.5px solid transparent; border-radius: 24px; color: #FFFFFF;
    background: radial-gradient(90% 60% at 50% 0, rgba(232, 184, 95, .16), transparent 70%) padding-box, linear-gradient(180deg, #2E1561, #170A33) padding-box,
                linear-gradient(160deg, #FDF0C9, rgba(232, 184, 95, .35) 35%, rgba(139, 92, 246, .5) 70%, #E8B85F) border-box;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .9); transform-origin: 100% 100%; animation: tg-pop .22s cubic-bezier(.2, .7, .2, 1); }
.tg-menu[hidden] { display: none; }
.tg-head { display: flex; align-items: center; gap: 10px; margin: 2px 4px 12px; color: #E8B85F; font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .22em; text-transform: uppercase; }
.tg-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(232, 184, 95, .5), transparent); }
.tg-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; color: #FFFFFF; text-decoration: none;
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(232, 184, 95, .14); transition: background-color .2s, border-color .2s, transform .2s; }
.tg-item + .tg-item { margin-top: 8px; }
.tg-item:hover, .tg-item:focus-visible { background: rgba(232, 184, 95, .1); border-color: rgba(232, 184, 95, .45); outline: 0; transform: translateX(-2px); }
.tg-item img { flex: none; width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(232, 184, 95, .5), 0 8px 14px -6px rgba(0, 0, 0, .8); }
.tg-item span { flex: 1; min-width: 0; line-height: 1.25; }
.tg-item b { display: block; font-size: 14.5px; font-weight: 800; }
.tg-item small { display: block; overflow: hidden; color: #F3D48F; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tg-go { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #FDF0C9 0%, #E8B85F 40%, #C88D38 75%, #9A6420 100%); }
.tg-go svg { width: 14px; height: 14px; fill: none; stroke: #2A1600; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tg-foot { margin: 12px 4px 0; color: #A99CC9; font-size: 11.5px; line-height: 1.3; text-align: center; }

@media (max-width: 600px) {
    .tg-fab { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); }
    .tg-btn { width: 56px; height: 56px; padding: 4px; }
    .tg-btn svg { width: 23px; height: 23px; }
    /* the member area's bottom bar */
    body:has(.dock) .tg-fab { bottom: calc(96px + env(safe-area-inset-bottom)); }
    /* the cookie card, while it is up */
    body:has(#lpCookie.on) .tg-fab { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* out of the way while the member area's side menu is open over the page */
body:has([data-sb-open][aria-expanded="true"]) .tg-fab { visibility: hidden; }

@keyframes tg-float { 50% { transform: translateY(-6px); } }
@keyframes tg-ring { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.45); } }
@keyframes tg-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
    .tg-btn, .tg-btn::before, .tg-menu { animation: none; }
}
