/* ==========================================================================
   Kaakatiya Group — Custom Cursor (cursor.css)
   --------------------------------------------------------------------------
   Two-part cursor: an instant 8px copper dot + a 40px gradient ring that
   trails with easing. State morphs: link / view / text-bar / brand-mark,
   click pulse + ripple, particle trail (markup for fx is spawned by JS).

   Include AFTER the main stylesheet:
     <link rel="stylesheet" href="/cursor.css" />
     <script defer src="/cursor.js"></script>
   ========================================================================== */

/* The layer stays hidden until cursor.js adds .kg-cursor-on to <html>
   (only on fine-pointer devices without prefers-reduced-motion). */
.kg-cursor,
.kg-cursor-fx {
  display: none;
}

/* Suppress the system cursor everywhere while the custom one is active. */
html.kg-cursor-on,
html.kg-cursor-on * {
  cursor: none !important;
}

html.kg-cursor-on .kg-cursor,
html.kg-cursor-on .kg-cursor-fx {
  display: block;
}

/* --- Layers: fixed, click-through, above every widget ------------------ */
.kg-cursor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000; /* near max-int: above modals, chat widgets, toasts */
  transition: opacity 0.25s ease; /* fade out/in when leaving the window */
}
.kg-cursor.is-hidden {
  opacity: 0;
}
.kg-cursor-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147482999; /* ripples & particles sit just under the cursor */
}

/* --- Inner dot: 8px solid copper, positioned instantly by JS ----------- */
.kg-cur-dot {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.kg-cur-dot i {
  display: block;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px; /* center on the pointer */
  border-radius: 50%;
  background: #e67e00;
  box-shadow: 0 0 10px rgba(230, 126, 0, 0.55); /* soft glow, true on dark */
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.kg-cursor.kg-m-link .kg-cur-dot i {
  transform: scale(0.55); /* dot shrinks over links/buttons */
}
.kg-cursor.kg-m-text .kg-cur-dot i {
  opacity: 0; /* caret bar replaces the dot over text/inputs */
}

/* --- Outer ring: 40px, 1.5px copper→rust gradient border ---------------- */
/* JS translates the wrapper; the core carries all visual morphs so the
   two never fight over the same property. */
.kg-cur-ring {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.kg-cur-ring-core {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border: 1.5px solid transparent;
  border-radius: 999px;
  /* gradient border that keeps a (translucent) interior fill possible:
     fill layer clipped to padding-box, gradient clipped to border-box */
  background:
    linear-gradient(rgba(230, 126, 0, 0), rgba(230, 126, 0, 0)) padding-box,
    linear-gradient(135deg, #f28c00, #8b2500) border-box;
  box-shadow: 0 0 14px rgba(230, 126, 0, 0.18); /* faint premium glow */
  transition:
    width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s ease,
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hover: links & buttons → 70px ring with translucent copper fill */
.kg-cursor.kg-m-link .kg-cur-ring-core {
  width: 70px;
  height: 70px;
  background:
    linear-gradient(rgba(230, 126, 0, 0.15), rgba(230, 126, 0, 0.15)) padding-box,
    linear-gradient(135deg, #f28c00, #8b2500) border-box;
}

/* Hover: property cards & images → 90px ring + "View" label */
.kg-cursor.kg-m-view .kg-cur-ring-core {
  width: 90px;
  height: 90px;
  background:
    linear-gradient(rgba(20, 14, 8, 0.35), rgba(20, 14, 8, 0.35)) padding-box,
    linear-gradient(135deg, #f28c00, #8b2500) border-box;
}
.kg-cur-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-indent: 0.32em; /* balances the letter-spacing */
  color: #fff;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.kg-cursor.kg-m-view .kg-cur-label {
  opacity: 1;
  transform: scale(1);
}

/* Hover: text & inputs → ring morphs into a thin vertical caret bar */
.kg-cursor.kg-m-text .kg-cur-ring-core {
  width: 3px;
  height: 34px;
  border-radius: 2px;
  border-color: transparent;
  background: linear-gradient(180deg, #f28c00, #8b2500);
  box-shadow: 0 0 10px rgba(230, 126, 0, 0.4);
}

/* Hover: logo / hero → circle dissolves into the K chevron brand mark */
.kg-cur-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%) scale(0.4) rotate(-12deg);
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(230, 126, 0, 0.45));
  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.kg-cursor.kg-m-brand .kg-cur-ring-core {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
}
.kg-cursor.kg-m-brand .kg-cur-mark {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

/* Click: quick shrink, rebound handled by JS removing the class */
.kg-cursor.kg-down .kg-cur-ring-core {
  transition-duration: 0.12s;
  transform: translate(-50%, -50%) scale(0.82);
}
.kg-cursor.kg-down .kg-cur-dot i {
  transition-duration: 0.12s;
  transform: scale(0.5);
}

/* --- Ripple of copper light on click (expands + fades in 0.5s) --------- */
.kg-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 140, 0, 0.9);
  box-shadow: 0 0 18px rgba(230, 126, 0, 0.35);
  animation: kgRipple 0.5s ease-out forwards;
}
@keyframes kgRipple {
  from {
    transform: scale(0.4);
    opacity: 0.9;
  }
  to {
    transform: scale(9);
    opacity: 0;
  }
}

/* --- Particle trail: small fading copper dots behind fast movement ----- */
.kg-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(242, 140, 0, 0.85);
  box-shadow: 0 0 8px rgba(242, 140, 0, 0.5);
  animation: kgParticle 0.4s ease-out forwards; /* gone within 400ms */
}
@keyframes kgParticle {
  from {
    opacity: 0.9;
    transform: scale(1) translate(0, 0);
  }
  to {
    opacity: 0;
    transform: scale(0.3) translate(var(--dx, 0px), var(--dy, 6px));
  }
}
