/* =========================================================
   Helora button.css — premium button motion
   Inspired by 21st.dev / Magic UI shimmer + magnetic patterns
   ========================================================= */

.btn {
  --btn-x: 50%;
  --btn-y: 50%;
  --mx: 0px;
  --my: 0px;
  --shine: -130%;
  --press: 1;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform:
    translate3d(var(--mx), var(--my), 0)
    scale(var(--press));
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s ease,
    background 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease,
    filter 0.35s ease;
  will-change: transform;
}

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

/* Override main.css flat hover so magnetic + lift work together */
.btn:hover {
  transform:
    translate3d(var(--mx), calc(var(--my) - 4px), 0)
    scale(calc(var(--press) * 1.035));
  filter: brightness(1.05);
}

.btn:active {
  --press: 0.95;
  transition-duration: 0.1s;
}

/* ---------- Diagonal shine sweep ---------- */
.btn::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 55%;
  z-index: 2;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 35%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.08) 65%,
    transparent 100%
  );
  transform: translateX(var(--shine)) skewX(-20deg);
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.btn:hover::before,
.btn.is-shine::before {
  --shine: 220%;
}

/* ---------- Primary / shimmer: animated gradient border + pulse ---------- */
.btn-primary,
.btn-shimmer {
  border: 1px solid transparent;
  background:
    linear-gradient(135deg, var(--amber) 0%, var(--amber-deep) 55%, #ffc27a 100%) padding-box,
    linear-gradient(
      var(--border-angle, 120deg),
      #ffe7bd,
      var(--amber),
      var(--teal-bright, #1fa8a6),
      var(--amber-deep),
      #ffe7bd
    ) border-box;
  background-size: 100% 100%, 300% 300%;
  color: #1a140e;
  box-shadow:
    0 14px 34px rgba(217, 137, 58, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation:
    btn-border-flow 4s linear infinite,
    btn-ambient 3.4s ease-in-out infinite;
}

.btn-primary:hover,
.btn-shimmer:hover {
  box-shadow:
    0 24px 52px rgba(217, 137, 58, 0.48),
    0 0 0 6px rgba(242, 166, 90, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: btn-border-flow 2s linear infinite;
}

/* Spinning edge glow under the fill (masked to rim) */
.btn-primary::after,
.btn-shimmer::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  z-index: 0;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(255, 255, 255, 0.85) 8%,
    transparent 18%,
    transparent 50%,
    rgba(255, 236, 200, 0.7) 58%,
    transparent 70%
  );
  animation: btn-spin 2.4s linear infinite;
  opacity: 0.7;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2px;
}

.btn-primary:hover::after,
.btn-shimmer:hover::after {
  opacity: 1;
  animation-duration: 1.2s;
}

/* ---------- Ghost (hero secondary) ---------- */
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.2),
    0 0 32px rgba(126, 212, 208, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.btn-ghost::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  left: var(--btn-x);
  top: var(--btn-y);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 65%);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
  pointer-events: none;
}

.btn-ghost:hover::after {
  opacity: 1;
}

/* ---------- Secondary / outline ---------- */
.btn-secondary,
.btn-outline-glow {
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal-deep);
  border: 1px solid rgba(14, 124, 123, 0.18);
  box-shadow: 0 10px 28px rgba(14, 124, 123, 0.08);
}

.btn-secondary:hover,
.btn-outline-glow:hover {
  border-color: rgba(14, 124, 123, 0.5);
  box-shadow:
    0 20px 44px rgba(14, 124, 123, 0.16),
    0 0 0 5px rgba(14, 124, 123, 0.08);
  background: #fff;
}

.btn-secondary::after,
.btn-outline-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    160px circle at var(--btn-x) var(--btn-y),
    rgba(31, 168, 166, 0.2),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.btn-secondary:hover::after,
.btn-outline-glow:hover::after {
  opacity: 1;
}

/* ---------- Icon slide ---------- */
.btn .icon-sm,
.btn svg.icon-sm {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}

.btn:hover .icon-sm,
.btn:hover svg.icon-sm {
  transform: translateX(5px);
}

.btn-icon-left:hover .icon-sm,
.btn-icon-left:hover svg.icon-sm {
  transform: translateX(-4px) scale(1.1);
}

/* ---------- Click ripple ---------- */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 4;
  animation: btn-ripple 0.7s ease-out forwards;
}

.btn-secondary .btn-ripple,
.btn-outline-glow .btn-ripple {
  background: rgba(14, 124, 123, 0.25);
}

/* ---------- Keyframes ---------- */
@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes btn-border-flow {
  0% {
    background-position: 0 0, 0% 50%;
  }
  100% {
    background-position: 0 0, 100% 50%;
  }
}

@keyframes btn-ambient {
  0%,
  100% {
    box-shadow:
      0 14px 34px rgba(217, 137, 58, 0.28),
      0 0 0 0 rgba(242, 166, 90, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow:
      0 18px 42px rgba(217, 137, 58, 0.42),
      0 0 0 10px rgba(242, 166, 90, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
}

@keyframes btn-ripple {
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-primary,
  .btn-shimmer {
    animation: none !important;
    transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease !important;
    transform: none !important;
  }

  .btn::before,
  .btn::after,
  .btn-primary::after,
  .btn-shimmer::after {
    animation: none !important;
    opacity: 0 !important;
    transition: none !important;
  }

  .btn:hover .icon-sm,
  .btn:hover svg.icon-sm {
    transform: none !important;
  }
}
