/* ══════════════════════════════════════════════════
   NANO MAGIC — Premium Micro-Interaction Layer
   AetherLink.ai | Subtle. Alive. Verbluffend.
   ══════════════════════════════════════════════════ */

/* ── Film Grain Overlay ── */
.nm-grain::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.028;
  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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ── Smooth Scroll ── */
html.nm-smooth {
  scroll-behavior: smooth;
}

/* ── Text Split Reveal ── */
.nm-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.nm-word--visible {
  opacity: 1;
  transform: translateY(0);
}
.nm-word--space {
  width: 0.3em;
  opacity: 1;
  transform: none;
}

/* ── Stagger Grid Items ── */
.nm-stagger-item {
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.nm-stagger-item--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Number Counter ── */
.nm-counter {
  font-variant-numeric: tabular-nums;
}

/* ── Image Unveil ── */
.nm-unveil {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.nm-unveil--visible {
  clip-path: inset(0 0% 0 0);
}

/* ── Premium Button Hover ── */
.nm-btn-glow {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s ease;
}
.nm-btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--nm-btn-angle, 0deg),
    transparent 0%,
    rgba(0, 212, 255, 0.3) 10%,
    rgba(139, 92, 246, 0.3) 20%,
    transparent 30%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  animation: nm-btn-spin 4s linear infinite;
}
.nm-btn-glow:hover::before {
  opacity: 1;
}
.nm-btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -4px rgba(0, 212, 255, 0.2),
              0 4px 16px -2px rgba(139, 92, 246, 0.15);
}
@keyframes nm-btn-spin {
  to { --nm-btn-angle: 360deg; }
}
@property --nm-btn-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* ── Section Divider Glow ── */
.nm-section-glow {
  position: relative;
}
.nm-section-glow::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 212, 255, 0.15) 20%,
    rgba(139, 92, 246, 0.2) 50%,
    rgba(0, 223, 162, 0.15) 80%,
    transparent
  );
  opacity: 0;
  transition: opacity 0.8s ease;
}
.nm-section-glow--visible::after {
  opacity: 1;
}

/* ── Parallax Depth Layer ── */
.nm-parallax {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ── Floating Label Effect ── */
.nm-float {
  animation: nm-float 6s ease-in-out infinite;
}
.nm-float:nth-child(2n) {
  animation-delay: -2s;
  animation-duration: 7s;
}
.nm-float:nth-child(3n) {
  animation-delay: -4s;
  animation-duration: 8s;
}
@keyframes nm-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Scroll Progress Sections ── */
.nm-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nm-progress-dot--active {
  background: var(--cyan);
  transform: scale(1.4);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

/* ── Smooth Underline Links ── */
.nm-link {
  background-image: linear-gradient(var(--cyan), var(--cyan));
  background-size: 0% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.nm-link:hover {
  background-size: 100% 1px;
}

/* ── Light Mode Adjustments ── */
[data-theme="light"] .nm-grain::before {
  opacity: 0.018;
  mix-blend-mode: multiply;
}
[data-theme="light"] .nm-section-glow::after {
  background: linear-gradient(90deg,
    transparent,
    rgba(0, 200, 235, 0.12) 20%,
    rgba(139, 92, 246, 0.15) 50%,
    rgba(0, 210, 160, 0.12) 80%,
    transparent
  );
}
[data-theme="light"] .nm-progress-dot {
  background: rgba(139, 92, 246, 0.15);
}
[data-theme="light"] .nm-progress-dot--active {
  background: #7c3aed;
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}
[data-theme="light"] .nm-btn-glow::before {
  background: conic-gradient(
    from var(--nm-btn-angle, 0deg),
    transparent 0%,
    rgba(0, 200, 235, 0.25) 10%,
    rgba(139, 92, 246, 0.25) 20%,
    transparent 30%
  );
}
[data-theme="light"] .nm-btn-glow:hover {
  box-shadow: 0 8px 30px -4px rgba(139, 92, 246, 0.15),
              0 4px 16px -2px rgba(0, 200, 235, 0.1);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .nm-word,
  .nm-stagger-item,
  .nm-unveil,
  .nm-btn-glow,
  .nm-float,
  .nm-parallax {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    animation: none !important;
    transition: none !important;
  }
  .nm-grain::before {
    display: none;
  }
}
