/*
 * Tiny Lux Support launcher.
 * Tokens follow the storefront: navy chrome (#000080), the logo's
 * violet-to-sky gradient (#774fec -> #5aa2fb) and its four-point sparkle.
 * Tokens are scoped to the widget root so the theme's :root is untouched.
 * Anchored bottom-left: the theme's Back to Top button owns bottom-right.
 */
.tinylux-support {
  --tl-support-navy: #000080;
  --tl-support-navy-deep: #000057;
  --tl-support-navy-lift: #1f1fb0;
  --tl-support-violet: #774fec;
  --tl-support-sky: #5aa2fb;
  --tl-support-ink: #0d0d3f;
  --tl-support-paper: #ffffff;
  --tl-support-glyph: #ffffff;
  --tl-support-sparkle: #9fd0ff;
  --tl-support-focus: #2467d1;
  --tl-support-size: 60px;
  --tl-support-gutter: 20px;
  --tl-support-ease: cubic-bezier(.16, 1, .3, 1);
  --tl-support-fast: 180ms;
  --tl-support-normal: 320ms;

  position: fixed;
  left: max(var(--tl-support-gutter), env(safe-area-inset-left));
  bottom: max(var(--tl-support-gutter), env(safe-area-inset-bottom));
  z-index: 900;
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: min(360px, calc(100vw - 32px));
  color: var(--tl-support-ink);
  font-family: inherit;
}

.tinylux-support *,
.tinylux-support *::before,
.tinylux-support *::after {
  box-sizing: border-box;
}

.tinylux-support__launcher,
.tinylux-support__fallback {
  min-width: 44px;
  min-height: 44px;
  font: inherit;
}

/* Launcher: navy disc, gradient hairline ring, icon only. */
.tinylux-support__launcher {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tl-support-size);
  height: var(--tl-support-size);
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 28% 22%, var(--tl-support-navy-lift) 0%, var(--tl-support-navy) 48%, var(--tl-support-navy-deep) 100%) padding-box,
    linear-gradient(140deg, var(--tl-support-violet), var(--tl-support-sky)) border-box;
  color: var(--tl-support-glyph);
  box-shadow:
    0 1px 2px rgba(0, 0, 60, .18),
    0 10px 24px -6px rgba(0, 0, 87, .38);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--tl-support-normal) var(--tl-support-ease);
  animation: tl-support-arrive 520ms var(--tl-support-ease) 240ms backwards;
}

/* Deeper hover shadow lives on a layer so only opacity animates. */
.tinylux-support__launcher::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 16px 34px -8px rgba(60, 40, 200, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tl-support-normal) var(--tl-support-ease);
}

/* Soft halo used while chat is loading. */
.tinylux-support__launcher::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 2px solid var(--tl-support-sky);
  opacity: 0;
  transform: scale(.9);
  pointer-events: none;
}

/* Two classes: the storefront theme sizes every svg:not(:root) to 300px. */
.tinylux-support .tinylux-support__icon {
  display: block;
  width: 30px;
  height: 30px;
  overflow: visible;
}

.tinylux-support__bubble {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tinylux-support__sparkle {
  fill: var(--tl-support-sparkle);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform var(--tl-support-normal) var(--tl-support-ease);
}

/* Accessible name stays in the DOM for assistive tech, never on screen. */
.tinylux-support__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (hover: hover) {
  .tinylux-support__launcher:hover:not(:disabled) {
    transform: translateY(-2px);
  }

  .tinylux-support__launcher:hover:not(:disabled)::after {
    opacity: 1;
  }

  .tinylux-support__launcher:hover:not(:disabled) .tinylux-support__sparkle {
    transform: rotate(90deg) scale(1.18);
  }
}

.tinylux-support__launcher:active:not(:disabled) {
  transform: scale(.94);
  transition-duration: var(--tl-support-fast);
}

/* Chat open: keep the ring lit so the launcher reads as the active control. */
.tinylux-support__launcher[aria-expanded="true"]::before {
  opacity: .55;
  transform: scale(1);
  transition:
    opacity var(--tl-support-normal) var(--tl-support-ease),
    transform var(--tl-support-normal) var(--tl-support-ease);
}

/* Loading: sparkle twinkles and a halo breathes instead of greying out. */
.tinylux-support__launcher:disabled {
  cursor: wait;
}

.tinylux-support__launcher:disabled .tinylux-support__sparkle {
  animation: tl-support-twinkle 1.2s ease-in-out infinite;
}

.tinylux-support__launcher:disabled::before {
  animation: tl-support-halo 1.6s var(--tl-support-ease) infinite;
}

.tinylux-support__status {
  max-width: 300px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 128, .12);
  border-radius: 14px 14px 14px 4px;
  background: var(--tl-support-paper);
  color: var(--tl-support-ink);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 87, .35);
  font-size: 14px;
  line-height: 1.45;
  animation: tl-support-rise var(--tl-support-normal) var(--tl-support-ease) both;
}

.tinylux-support__status:empty {
  display: none;
}

.tinylux-support__fallback {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border: 1.5px solid var(--tl-support-navy);
  border-radius: 999px;
  background: var(--tl-support-paper);
  color: var(--tl-support-navy);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition:
    background-color var(--tl-support-fast) ease,
    color var(--tl-support-fast) ease;
}

/* Theme a:focus recolours links; keep the pill on-brand when focused. */
.tinylux-support__fallback:focus {
  color: var(--tl-support-navy);
}

.tinylux-support__fallback:hover {
  background: var(--tl-support-navy);
  color: var(--tl-support-paper);
  text-decoration: none;
}

.tinylux-support__fallback[hidden] {
  display: none;
}

/* White gap + blue ring keeps focus visible over light pages and dark imagery. */
.tinylux-support__launcher:focus-visible,
.tinylux-support__fallback:focus-visible {
  outline: 3px solid var(--tl-support-focus);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px var(--tl-support-paper);
}

@keyframes tl-support-arrive {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.82);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tl-support-twinkle {
  0%, 100% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
  50% {
    opacity: .55;
    transform: rotate(90deg) scale(.78);
  }
}

@keyframes tl-support-halo {
  0% {
    opacity: .6;
    transform: scale(.92);
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@keyframes tl-support-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .tinylux-support {
    --tl-support-size: 54px;
    --tl-support-gutter: 14px;
    max-width: calc(100vw - 28px);
  }

  .tinylux-support .tinylux-support__icon {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tinylux-support__launcher[aria-expanded="true"]::before,
  .tinylux-support__launcher,
  .tinylux-support__launcher::after,
  .tinylux-support__sparkle,
  .tinylux-support__status {
    animation: none;
    transition: none;
  }

  .tinylux-support__launcher:hover:not(:disabled),
  .tinylux-support__launcher:active:not(:disabled),
  .tinylux-support__launcher:hover:not(:disabled) .tinylux-support__sparkle {
    transform: none;
  }

  /* Loading still needs a non-moving cue: a steady lit ring. */
  .tinylux-support__launcher:disabled::before {
    animation: none;
    opacity: .55;
    transform: none;
  }

  .tinylux-support__launcher:disabled .tinylux-support__sparkle {
    animation: none;
    opacity: .6;
  }
}

@media (forced-colors: active) {
  .tinylux-support__launcher {
    border-color: ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }

  .tinylux-support__sparkle {
    fill: ButtonText;
  }
}
