/* GothamDev — Curseur personnalisé Mosa v2 */

@media (hover: hover) and (pointer: fine) {
  :is(.home-mosa, .site-mosa).mosa-cursor-active,
  :is(.home-mosa, .site-mosa).mosa-cursor-active * {
    cursor: none !important;
  }

  :is(.home-mosa, .site-mosa).mosa-cursor-active input:not([type="checkbox"]):not([type="radio"]),
  :is(.home-mosa, .site-mosa).mosa-cursor-active textarea,
  :is(.home-mosa, .site-mosa).mosa-cursor-active select,
  :is(.home-mosa, .site-mosa).mosa-cursor-active [contenteditable="true"] {
    cursor: text !important;
  }

  .mosa-cursor {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
  }

  .mosa-cursor.is-visible {
    opacity: 1;
  }

  .mosa-cursor-dot,
  .mosa-cursor-ring,
  .mosa-cursor-glow,
  .mosa-cursor-ripple {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
  }

  /* Point central — instantané */
  .mosa-cursor-dot {
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    background: #fff;
    box-shadow:
      0 0 0 1px rgba(0, 0, 0, 0.35),
      0 0 16px rgba(125, 255, 154, 0.55);
    transition:
      width 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      height 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      margin 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      background 0.2s ease,
      box-shadow 0.2s ease,
      opacity 0.2s ease;
  }

  /* Anneau principal — suit avec inertie */
  .mosa-cursor-ring {
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 1px solid rgba(125, 255, 154, 0.45);
    background: rgba(125, 255, 154, 0.03);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition:
      width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      margin 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      border-color 0.25s ease,
      border-width 0.25s ease,
      background 0.25s ease,
      opacity 0.25s ease;
  }

  /* Halo diffus */
  .mosa-cursor-glow {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    background: radial-gradient(circle, rgba(125, 255, 154, 0.22) 0%, transparent 68%);
    opacity: 0.45;
    filter: blur(6px);
    transition:
      width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      margin 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.35s ease;
  }

  /* Ripple au clic */
  .mosa-cursor-ripple {
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 1.5px solid rgba(125, 255, 154, 0.7);
    background: transparent;
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .mosa-cursor-ripple.is-active {
    animation: mosa-cursor-ripple 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  @keyframes mosa-cursor-ripple {
    0% {
      opacity: 0.65;
      transform: translate3d(var(--rx, 0), var(--ry, 0), 0) scale(1);
    }
    100% {
      opacity: 0;
      transform: translate3d(var(--rx, 0), var(--ry, 0), 0) scale(2.4);
    }
  }

  /* Idle — halo pulsant (position gérée en JS) */
  .mosa-cursor.is-idle:not(.is-hover):not(.is-click):not(.is-grab) .mosa-cursor-glow {
    animation: mosa-cursor-glow-idle 2.8s ease-in-out infinite;
  }

  @keyframes mosa-cursor-glow-idle {
    0%,
    100% {
      opacity: 0.32;
    }
    50% {
      opacity: 0.62;
    }
  }

  /* Hover — liens & boutons */
  .mosa-cursor.is-hover .mosa-cursor-dot {
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    background: #7dff9a;
    box-shadow:
      0 0 0 1px rgba(0, 0, 0, 0.2),
      0 0 22px rgba(125, 255, 154, 0.75);
  }

  .mosa-cursor.is-hover .mosa-cursor-ring {
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-width: 1.5px;
    border-color: rgba(125, 255, 154, 0.85);
    background: rgba(125, 255, 154, 0.06);
  }

  .mosa-cursor.is-hover .mosa-cursor-glow {
    width: 62px;
    height: 62px;
    margin: -31px 0 0 -31px;
    opacity: 0.5;
  }

  /* Grandes cartes — discret, sans halo */
  .mosa-cursor.is-card.is-hover .mosa-cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: #7dff9a;
    box-shadow:
      0 0 0 1px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(125, 255, 154, 0.5);
  }

  .mosa-cursor.is-card.is-hover .mosa-cursor-ring {
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-width: 1px;
    border-color: rgba(125, 255, 154, 0.55);
    background: transparent;
  }

  .mosa-cursor.is-card .mosa-cursor-glow,
  .mosa-cursor.is-card.is-hover .mosa-cursor-glow {
    opacity: 0 !important;
    width: 0;
    height: 0;
    margin: 0;
  }

  .mosa-cursor.is-card.is-click .mosa-cursor-ring {
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border-color: #7dff9a;
    background: rgba(125, 255, 154, 0.1);
  }

  /* Lien externe */
  .mosa-cursor.is-external .mosa-cursor-dot {
    background: #fff;
    box-shadow:
      0 0 0 1px rgba(0, 0, 0, 0.25),
      0 0 18px rgba(125, 255, 154, 0.6);
  }

  .mosa-cursor.is-external .mosa-cursor-ring {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.04);
  }

  .mosa-cursor.is-external.is-hover .mosa-cursor-ring {
    border-color: rgba(125, 255, 154, 0.95);
    background: rgba(125, 255, 154, 0.1);
  }

  /* Clic */
  .mosa-cursor.is-click .mosa-cursor-dot {
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    background: #fff;
  }

  .mosa-cursor.is-click .mosa-cursor-ring {
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border-width: 2px;
    border-color: #7dff9a;
    background: rgba(125, 255, 154, 0.18);
  }

  .mosa-cursor.is-click .mosa-cursor-glow {
    opacity: 0.35;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
  }

  /* Zone scrollable (aperçus live) */
  .mosa-cursor.is-grab .mosa-cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: rgba(255, 255, 255, 0.85);
  }

  .mosa-cursor.is-grab .mosa-cursor-ring {
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.4);
    background: transparent;
    animation: none;
  }

  .mosa-cursor.is-grab.is-click .mosa-cursor-ring,
  .mosa-cursor.is-grabbing .mosa-cursor-ring {
    border-style: solid;
    border-color: #7dff9a;
    background: rgba(125, 255, 154, 0.06);
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
  }

  /* Champs de saisie — curseur natif */
  .mosa-cursor.is-hidden {
    opacity: 0 !important;
  }

  .mosa-cursor.is-hidden .mosa-cursor-dot,
  .mosa-cursor.is-hidden .mosa-cursor-ring,
  .mosa-cursor.is-hidden .mosa-cursor-glow {
    opacity: 0;
  }
}

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