/* ============================================================
   BILHON OS Design System v2.0 — Effects & Animations
   Keyframes, animation utilities, text effects, glass,
   background effects, scroll progress, hover 3D tilt.
   Prefix: .bl-
   Author: Homer (Romulo Henricco)
   ============================================================ */

/* ── Keyframes ── */

@keyframes bl-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bl-fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bl-fade-in-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bl-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes bl-slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes bl-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes bl-glow-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(var(--bl-accent-rgb), 0.3); }
  50%      { box-shadow: 0 0 20px rgba(var(--bl-accent-rgb), 0.6), 0 0 40px rgba(var(--bl-accent-rgb), 0.2); }
}

@keyframes bl-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes bl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes bl-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes bl-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes bl-border-rotate {
  0%   { --bl-border-angle: 0deg; }
  100% { --bl-border-angle: 360deg; }
}

@keyframes bl-tech-glow {
  0%, 100% { text-shadow: 0 0 6px rgba(var(--bl-accent-rgb), 0.4), 0 0 12px rgba(var(--bl-accent-rgb), 0.2); }
  50%      { text-shadow: 0 0 12px rgba(var(--bl-accent-rgb), 0.7), 0 0 24px rgba(var(--bl-accent-rgb), 0.35), 0 0 48px rgba(var(--bl-accent-rgb), 0.15); }
}

@keyframes bl-orb-drift {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(30px, -20px) scale(1.05); }
  50%  { transform: translate(-10px, -40px) scale(0.98); }
  75%  { transform: translate(-30px, -10px) scale(1.03); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes bl-wave {
  0%, 100% { transform: translateY(0); }
  25%      { transform: translateY(-4px); }
  75%      { transform: translateY(4px); }
}

/* ── Animation Utilities ── */

.bl-animate-fade-in        { animation: bl-fade-in var(--bl-duration-base) var(--bl-ease) both; }
.bl-animate-fade-in-up     { animation: bl-fade-in-up var(--bl-duration-slow) var(--bl-ease) both; }
.bl-animate-fade-in-down   { animation: bl-fade-in-down var(--bl-duration-slow) var(--bl-ease) both; }
.bl-animate-scale-in       { animation: bl-scale-in var(--bl-duration-slow) var(--bl-ease) both; }
.bl-animate-slide-in-right { animation: bl-slide-in-right var(--bl-duration-slow) var(--bl-ease) both; }
.bl-animate-pulse          { animation: bl-pulse 2s ease-in-out infinite; }
.bl-animate-glow-pulse     { animation: bl-glow-pulse 2s ease-in-out infinite; }
.bl-animate-shimmer        { animation: bl-shimmer 2s linear infinite; }
.bl-animate-spin           { animation: bl-spin 1s linear infinite; }
.bl-animate-blink          { animation: bl-blink 1s step-end infinite; }
.bl-animate-float          { animation: bl-float 3s ease-in-out infinite; }
.bl-animate-tech-glow      { animation: bl-tech-glow 2.5s ease-in-out infinite; }
.bl-animate-orb-drift      { animation: bl-orb-drift 20s ease-in-out infinite; }
.bl-animate-wave           { animation: bl-wave 2s ease-in-out infinite; }

/* ── Stagger Reveal ── */

.bl-stagger > * {
  opacity: 0;
  animation: bl-fade-in-up var(--bl-duration-slow) var(--bl-ease) both;
}

.bl-stagger > *:nth-child(1)  { animation-delay: 0ms; }
.bl-stagger > *:nth-child(2)  { animation-delay: 60ms; }
.bl-stagger > *:nth-child(3)  { animation-delay: 120ms; }
.bl-stagger > *:nth-child(4)  { animation-delay: 180ms; }
.bl-stagger > *:nth-child(5)  { animation-delay: 240ms; }
.bl-stagger > *:nth-child(6)  { animation-delay: 300ms; }
.bl-stagger > *:nth-child(7)  { animation-delay: 360ms; }
.bl-stagger > *:nth-child(8)  { animation-delay: 420ms; }
.bl-stagger > *:nth-child(9)  { animation-delay: 480ms; }
.bl-stagger > *:nth-child(10) { animation-delay: 540ms; }
.bl-stagger > *:nth-child(11) { animation-delay: 600ms; }
.bl-stagger > *:nth-child(12) { animation-delay: 660ms; }

/* ── Text Effects ── */

.bl-text-shimmer {
  background: linear-gradient(
    90deg,
    var(--bl-text-dim) 0%,
    var(--bl-text-primary) 40%,
    rgba(var(--bl-accent-rgb), 0.8) 60%,
    var(--bl-text-dim) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bl-shimmer 3s linear infinite;
}

.bl-text-tech-glow {
  color: rgba(var(--bl-accent-rgb), 0.95);
  animation: bl-tech-glow 2.5s ease-in-out infinite;
}

.bl-text-cursor::after {
  content: "|";
  display: inline-block;
  color: rgba(var(--bl-accent-rgb), 0.8);
  font-weight: 300;
  animation: bl-blink 1s step-end infinite;
  margin-left: 1px;
}

.bl-text-wavy-underline {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: rgba(var(--bl-accent-rgb), 0.4);
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  transition: text-decoration-color var(--bl-duration-base) var(--bl-ease);
}

.bl-text-wavy-underline:hover {
  text-decoration-color: rgba(var(--bl-accent-rgb), 0.8);
}

/* ── Glass Effects ── */

.bl-glass {
  position: relative;
  background: var(--bl-glass-bg);
  backdrop-filter: blur(var(--bl-glass-blur)) saturate(var(--bl-glass-saturate));
  -webkit-backdrop-filter: blur(var(--bl-glass-blur)) saturate(var(--bl-glass-saturate));
  border: 1px solid var(--bl-border-2);
  border-radius: var(--bl-radius-lg);
  overflow: hidden;
}

.bl-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 1;
}

/* .bl-border-glow REMOVIDO — nao faz parte do DS Bilhon OS (AP: glow verde na frente de cards) */

/* ── Background Effects ── */

.bl-noise {
  position: relative;
}

.bl-noise::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.bl-bg-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, var(--bl-grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, var(--bl-grid-opacity)) 1px, transparent 1px);
  background-size: var(--bl-grid-size) var(--bl-grid-size);
}

.bl-glow-orb--green {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--bl-accent-rgb), 0.12) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  animation: bl-orb-drift 20s ease-in-out infinite;
}

.bl-glow-orb--purple {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.10) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  animation: bl-orb-drift 25s ease-in-out infinite reverse;
}

/* ── Scroll Progress ── */

.bl-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(var(--bl-accent-rgb), 0.8), rgba(var(--bl-accent-rgb), 0.4));
  z-index: 10001;
  transform-origin: left;
  transition: transform 50ms linear;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(var(--bl-accent-rgb), 0.4);
}

/* ── Scroll to Top ── */

.bl-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bl-glass-bg-heavy);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--bl-border-2);
  border-radius: var(--bl-radius-md);
  color: var(--bl-text-secondary);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--bl-duration-base) var(--bl-ease),
              visibility var(--bl-duration-base) var(--bl-ease),
              transform var(--bl-duration-base) var(--bl-ease),
              background var(--bl-duration-fast) var(--bl-ease),
              color var(--bl-duration-fast) var(--bl-ease);
  z-index: 9998;
}

.bl-scroll-top.bl-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bl-scroll-top:hover {
  background: rgba(var(--bl-accent-rgb), 0.15);
  color: var(--bl-text-primary);
  border-color: rgba(var(--bl-accent-rgb), 0.3);
}

/* ── Hover 3D Tilt ── */

.bl-tilt {
  transform-style: preserve-3d;
  transition: transform var(--bl-duration-slow) var(--bl-ease);
  will-change: transform;
}

.bl-tilt:hover {
  transform: perspective(800px) rotateY(var(--bl-tilt-x, 2deg)) rotateX(var(--bl-tilt-y, -2deg));
}

/* ── Reduced Motion ── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .bl-stagger > * {
    animation: none;
    opacity: 1;
  }

  .bl-text-shimmer {
    animation: none;
    background: none;
    -webkit-text-fill-color: var(--bl-text-primary);
  }

  .bl-text-tech-glow {
    animation: none;
    text-shadow: none;
  }

  .bl-animate-float,
  .bl-animate-orb-drift,
  .bl-animate-wave,
  .bl-animate-pulse,
  .bl-animate-glow-pulse,
  .bl-animate-shimmer,
  .bl-animate-spin,
  .bl-animate-blink {
    animation: none;
  }

  .bl-glow-orb--green,
  .bl-glow-orb--purple {
    animation: none;
  }

  .bl-tilt:hover {
    transform: none;
  }
}
