/* Liquid Glass Button — drop-in component
   Variants: .liquid-btn (base) + .liquid-primary | .liquid-secondary | .liquid-aqua
   Add .liquid-pulse for animated LED dot.
   Requires liquid-button.js for ripple + cursor highlight tracking. */

:root {
  --lq-cyan: #00FFFF;
  --lq-cyan-soft: rgba(0, 255, 255, 0.55);
  --lq-cyan-glow: rgba(0, 255, 255, 0.35);
  --lq-aqua-deep: #0fa3ff;
  --lq-aqua-glow: rgba(15, 163, 255, 0.45);
  --lq-violet: #7B5CF0;
  --lq-glass-surface: rgba(255, 255, 255, 0.06);
  --lq-glass-edge: rgba(255, 255, 255, 0.18);
  --lq-glass-highlight: rgba(255, 255, 255, 0.45);
  --lq-text: #f8fafc;
}

.liquid-btn {
  --lq-mx: 50%;
  --lq-my: 50%;
  --lq-ring: var(--lq-cyan-glow);
  --lq-accent: var(--lq-cyan);
  --lq-h: 52px;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;

  min-height: var(--lq-h);
  min-width: 44px;
  padding: 0 1.75rem;

  font: 600 0.95rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.01em;
  color: var(--lq-text);
  text-decoration: none;
  white-space: nowrap;

  background:
    radial-gradient(120% 140% at var(--lq-mx) var(--lq-my),
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.03) 40%,
      transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--lq-glass-surface);

  border: 1px solid var(--lq-glass-edge);
  border-radius: 999px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);

  box-shadow:
    inset 0 1px 0 var(--lq-glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 12px 32px -12px var(--lq-ring),
    0 0 32px -8px var(--lq-ring);

  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  transition:
    transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 240ms cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 240ms ease;
}

.liquid-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(60% 80% at var(--lq-mx) var(--lq-my),
    rgba(255, 255, 255, 0.22) 0%,
    transparent 60%);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  z-index: 1;
}

.liquid-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg,
    transparent 0%,
    transparent 55%,
    var(--lq-accent) 100%);
  opacity: 0.18;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
}

.liquid-btn > * { position: relative; z-index: 2; }

.liquid-btn:hover {
  transform: translateY(-1px) scale(1.015);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow:
    inset 0 1px 0 var(--lq-glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 18px 40px -14px var(--lq-ring),
    0 0 48px -6px var(--lq-ring);
}

.liquid-btn:hover::before { opacity: 1; }

.liquid-btn:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 90ms;
}

.liquid-btn:focus-visible {
  outline: 2px solid var(--lq-accent);
  outline-offset: 3px;
}

.liquid-btn[disabled],
.liquid-btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  filter: saturate(0.5);
}

/* ===== Variants ===== */

.liquid-primary {
  --lq-accent: var(--lq-cyan);
  --lq-ring: var(--lq-cyan-glow);
  background:
    radial-gradient(120% 140% at var(--lq-mx) var(--lq-my),
      rgba(255, 255, 255, 0.22) 0%,
      rgba(0, 255, 255, 0.10) 40%,
      transparent 70%),
    linear-gradient(180deg, rgba(0, 255, 255, 0.12) 0%, rgba(123, 92, 240, 0.10) 100%),
    var(--lq-glass-surface);
}

.liquid-secondary {
  --lq-accent: rgba(255, 255, 255, 0.6);
  --lq-ring: rgba(255, 255, 255, 0.12);
  color: var(--lq-text);
  box-shadow:
    inset 0 1px 0 var(--lq-glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 6px 20px -10px rgba(0, 0, 0, 0.5);
}

.liquid-aqua {
  --lq-accent: var(--lq-aqua-deep);
  --lq-ring: var(--lq-aqua-glow);
  background:
    radial-gradient(120% 140% at var(--lq-mx) var(--lq-my),
      rgba(165, 240, 255, 0.30) 0%,
      rgba(15, 163, 255, 0.18) 40%,
      transparent 75%),
    linear-gradient(180deg, rgba(15, 163, 255, 0.22) 0%, rgba(0, 60, 120, 0.18) 100%),
    var(--lq-glass-surface);
}

.liquid-aqua::after {
  background: linear-gradient(180deg,
    transparent 0%,
    transparent 50%,
    var(--lq-aqua-deep) 100%);
  opacity: 0.28;
}

/* ===== Pulse LED dot ===== */

.liquid-pulse::part(led),
.liquid-pulse .lq-led {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lq-accent);
  box-shadow: 0 0 12px var(--lq-accent), 0 0 24px var(--lq-ring);
  flex-shrink: 0;
}

.liquid-pulse .lq-led::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--lq-accent);
  opacity: 0.35;
  animation: lq-led-pulse 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes lq-led-pulse {
  0%   { transform: scale(0.8); opacity: 0.55; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ===== Ripple ===== */

.lq-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.18) 30%,
    transparent 70%);
  mix-blend-mode: screen;
  z-index: 3;
  animation: lq-ripple 620ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes lq-ripple {
  to {
    transform: translate(-50%, -50%) scale(3.4);
    opacity: 0;
  }
}

/* ===== Accessibility ===== */

@media (prefers-reduced-motion: reduce) {
  .liquid-btn,
  .liquid-btn::before,
  .liquid-pulse .lq-led::before {
    transition: none !important;
    animation: none !important;
  }
  .lq-ripple { display: none !important; }
  .liquid-btn:hover { transform: none; }
}

/* Light theme override (only if site exposes [data-theme="light"]) */
[data-theme="light"] .liquid-btn {
  --lq-text: #0b1535;
  --lq-glass-surface: rgba(255, 255, 255, 0.55);
  --lq-glass-edge: rgba(15, 35, 80, 0.14);
  --lq-glass-highlight: rgba(255, 255, 255, 0.85);
  color: #0b1535;
}
