/*
 * NiagaHub shared neon effects.
 * Load with: <link rel="stylesheet" href="<?= h($assetsBase); ?>/css/neon.css">
 */

:root {
  --nh-neon-primary: #0ab39c;
  --nh-neon-primary-rgb: 10, 179, 156;
  --nh-neon-teal: #02a8b5;
  --nh-neon-cyan: #4de7ee;
  --nh-neon-gold: #f7b84b;
  --nh-neon-dark: #1d2b3a;
  --nh-neon-light: #ffffff;
}

/* Buttons */
.nh-neon-btn {
  --nh-neon-btn-angle: 0deg;
  position: relative;
  isolation: isolate;
  overflow: visible;
  z-index: 0;
}

.nh-neon-btn::before,
.nh-neon-btn::after {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from var(--nh-neon-btn-angle),
    rgba(var(--nh-neon-primary-rgb), 0) 110deg,
    var(--nh-neon-primary) 210deg,
    var(--nh-neon-cyan) 285deg,
    var(--nh-neon-gold) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nh-neon-btn-rotate 2.8s linear infinite;
}

.nh-neon-btn::before {
  z-index: -1;
}

.nh-neon-btn::after {
  inset: -6px;
  padding: 6px;
  filter: blur(14px);
  opacity: 0.55;
  z-index: -2;
}

.nh-neon-btn:hover::before,
.nh-neon-btn:hover::after,
.nh-neon-btn:focus::before,
.nh-neon-btn:focus::after {
  animation-play-state: paused;
  background: linear-gradient(var(--nh-neon-cyan), var(--nh-neon-cyan));
}

.nh-neon-btn:hover,
.nh-neon-btn:focus {
  background-color: var(--nh-neon-dark) !important;
  border-color: var(--nh-neon-cyan) !important;
  color: var(--nh-neon-light) !important;
}

.nh-neon-btn:hover::after,
.nh-neon-btn:focus::after {
  opacity: 0.75;
  filter: blur(16px);
}

.nh-neon-btn-light {
  --nh-neon-btn-light-angle: 0deg;
  position: relative;
  isolation: isolate;
  overflow: visible;
  z-index: 0;
  border-width: 1px;
  border-color: rgba(var(--nh-neon-primary-rgb), 0.35) !important;
  background-color: var(--nh-neon-light) !important;
  color: var(--nh-neon-dark) !important;
  font-weight: 700;
  text-shadow: none !important;
}

.nh-neon-btn-light:visited,
.nh-neon-btn-light:active {
  background-color: var(--nh-neon-light) !important;
  color: var(--nh-neon-dark) !important;
}

.nh-neon-btn-light::before,
.nh-neon-btn-light::after {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from var(--nh-neon-btn-light-angle),
    rgba(var(--nh-neon-primary-rgb), 0) 100deg,
    var(--nh-neon-primary) 205deg,
    var(--nh-neon-teal) 275deg,
    var(--nh-neon-cyan) 330deg,
    var(--nh-neon-gold) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nh-neon-btn-light-rotate 3.2s linear infinite;
}

.nh-neon-btn-light::before {
  z-index: -1;
}

.nh-neon-btn-light::after {
  inset: -5px;
  padding: 5px;
  filter: blur(12px);
  opacity: 0.5;
  z-index: -2;
}

.nh-neon-btn-light:hover::before,
.nh-neon-btn-light:hover::after,
.nh-neon-btn-light:focus::before,
.nh-neon-btn-light:focus::after {
  animation-play-state: paused;
  background: linear-gradient(var(--nh-neon-cyan), var(--nh-neon-cyan));
}

.btn.nh-neon-btn-light:hover,
.btn.nh-neon-btn-light:focus,
.btn.nh-neon-btn-light:active {
  background-color: var(--nh-neon-dark) !important;
  border-color: var(--nh-neon-cyan) !important;
  color: var(--nh-neon-light) !important;
  -webkit-text-fill-color: var(--nh-neon-light) !important;
  text-shadow: none !important;
  opacity: 1 !important;
  filter: none !important;
}

.btn.nh-neon-btn-light i,
.btn.nh-neon-btn-light:hover i,
.btn.nh-neon-btn-light:focus i,
.btn.nh-neon-btn-light:active i {
  color: currentColor !important;
  opacity: 1 !important;
}

/* Panels */
.nh-neon-panel-spin {
  --nh-neon-panel-angle: 0deg;
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(var(--nh-neon-primary-rgb), 0.2);
  box-shadow: 0 10px 24px rgba(var(--nh-neon-primary-rgb), 0.18);
}

.nh-neon-panel-spin::before,
.nh-neon-panel-spin::after {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from var(--nh-neon-panel-angle),
    rgba(var(--nh-neon-primary-rgb), 0) 110deg,
    var(--nh-neon-primary) 210deg,
    var(--nh-neon-cyan) 290deg,
    var(--nh-neon-gold) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nh-neon-panel-spin 3.8s linear infinite;
}

.nh-neon-panel-spin::before {
  z-index: -1;
}

.nh-neon-panel-spin::after {
  display: none;
}

.nh-neon-panel-flow {
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(var(--nh-neon-primary-rgb), 0.2);
  box-shadow: 0 10px 24px rgba(var(--nh-neon-primary-rgb), 0.18);
}

.nh-neon-panel-flow::before,
.nh-neon-panel-flow::after {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(var(--nh-neon-primary-rgb), 0.12) 0%,
    var(--nh-neon-primary) 22%,
    var(--nh-neon-teal) 48%,
    var(--nh-neon-cyan) 72%,
    var(--nh-neon-gold) 92%,
    rgba(var(--nh-neon-primary-rgb), 0.12) 100%
  );
  background-size: 220% 220%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nh-neon-panel-flow 3.6s ease-in-out infinite;
}

.nh-neon-panel-flow::before {
  z-index: -1;
}

.nh-neon-panel-flow::after {
  display: none;
}

.nh-neon-panel-breathe {
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(var(--nh-neon-primary-rgb), 0.2);
  box-shadow: 0 10px 24px rgba(var(--nh-neon-primary-rgb), 0.18);
}

.nh-neon-panel-breathe::before,
.nh-neon-panel-breathe::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from 210deg,
    rgba(var(--nh-neon-primary-rgb), 0.15) 0deg,
    var(--nh-neon-primary) 110deg,
    var(--nh-neon-teal) 205deg,
    var(--nh-neon-cyan) 285deg,
    var(--nh-neon-gold) 340deg,
    rgba(var(--nh-neon-primary-rgb), 0.15) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: nh-neon-panel-breathe 2.4s ease-in-out infinite;
}

.nh-neon-panel-breathe::before {
  z-index: 1;
}

.nh-neon-panel-breathe::after {
  display: none;
}

.nh-neon-panel-breathe > * {
  position: relative;
  z-index: 2;
}

/* Animations */
@keyframes nh-neon-btn-rotate {
  to {
    --nh-neon-btn-angle: 360deg;
  }
}

@keyframes nh-neon-btn-light-rotate {
  to {
    --nh-neon-btn-light-angle: 360deg;
  }
}

@keyframes nh-neon-panel-spin {
  to {
    --nh-neon-panel-angle: 360deg;
  }
}

@keyframes nh-neon-panel-flow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes nh-neon-panel-breathe {
  0%,
  100% {
    opacity: 0.56;
    filter: saturate(0.95) brightness(0.92);
  }

  50% {
    opacity: 1;
    filter: saturate(1.15) brightness(1.08);
  }
}

@property --nh-neon-btn-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --nh-neon-btn-light-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --nh-neon-panel-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .nh-neon-btn::before,
  .nh-neon-btn::after,
  .nh-neon-btn-light::before,
  .nh-neon-btn-light::after,
  .nh-neon-panel-spin::before,
  .nh-neon-panel-spin::after,
  .nh-neon-panel-flow::before,
  .nh-neon-panel-flow::after,
  .nh-neon-panel-breathe::before,
  .nh-neon-panel-breathe::after {
    animation: none;
  }
}
