/* ==========================================================================
   Cursore custom, attivo solo su desktop con puntatore di precisione.
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor {
    cursor: default;
  }

  .cb-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99990;
    pointer-events: none;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    mix-blend-mode: normal;
  }

  .cb-cursor.-visible {
    opacity: 1;
  }

  /* Cerchio centrale */
  .cb-cursor::before {
    content: "";
    position: absolute;
    top: -22px;
    left: -22px;
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transform: scale(0.22);
    background: var(--color-primary);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                background 0.25s ease, 
                opacity 0.2s ease,
                box-shadow 0.25s ease;
  }

  /* Click */
  .cb-cursor.-active::before {
    transform: scale(0.16);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  }

  /* Hover su link e bottoni */
  .cb-cursor.-pointer::before {
    transform: scale(0.75);
    background: rgba(245, 158, 11, 0.25);
    border: 1.5px solid var(--color-primary);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  }

  /* Varianti exclusion/opaque per sfondi chiari e testo */
  .cb-cursor.-exclusion,
  .cb-cursor.-opaque {
    mix-blend-mode: exclusion;
  }

  .cb-cursor.-exclusion::before,
  .cb-cursor.-opaque::before {
    background: #FFFFFF;
    box-shadow: none;
    transform: scale(1.1);
  }

  /* Badge con testo (data-cursor-text) */
  .cb-cursor.-text::before {
    background: rgba(11, 25, 44, 0.92);
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 8px 32px rgba(11, 25, 44, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: scale(2.05);
    opacity: 1;
  }

  .cb-cursor-text {
    position: absolute;
    top: -24px;
    left: -24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #FFFFFF;
    text-align: center;
    line-height: 1;
    transform: scale(0);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    user-select: none;
  }

  .cb-cursor.-text .cb-cursor-text {
    opacity: 1;
    transform: scale(1);
    color: var(--color-primary-softer);
  }

  /* Nascosto quando il mouse esce dalla pagina */
  .cb-cursor.-hidden::before {
    transform: scale(0);
  }
}

/* Su touch il cursore custom è disattivato */
@media (hover: none) or (pointer: coarse) {
  .cb-cursor {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-cursor {
    display: none !important;
  }
}
