/* ==========================================================================
   A.VATHANA ARCHITECTURAL CAD CROSSHAIR CURSOR
   ========================================================================== */

/* Hide standard Apple/OS pointer on desktop so CAD crosshair cursor takes full control */
@media (pointer: fine) {
  *, *::before, *::after {
    cursor: none !important;
  }
  
  input, textarea, select, [contenteditable="true"] {
    cursor: text !important;
  }
}

/* 1. Crosshair Rays (Terminating cleanly at the dot perimeter with 0 line slice inside) */
.cad-line-left,
.cad-line-right,
.cad-line-top,
.cad-line-bottom {
  position: fixed;
  left: 0;
  top: 0;
  background: rgba(30, 30, 30, 0.12) !important;
  pointer-events: none;
  z-index: 99999990;
  will-change: transform, width, height;
  transition: background-color 0.2s ease;
}

.cad-line-left,
.cad-line-right {
  height: 1px;
}

.cad-line-top,
.cad-line-bottom {
  width: 1px;
}

/* 3. Center Target Dot (Inverting Difference Blend: Black on White, White on Black, Inverted on Photos) */
.cad-crosshair-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999999;
  transform: translate(-50%, -50%);
  will-change: transform;
  mix-blend-mode: difference;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 4. Interactive Badge Label Inside/Over Dot */
.cad-cursor-text {
  font-family: var(--font-mono, "Geist Mono", monospace);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #000000;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  pointer-events: none;
  padding: 0 14px;
}

/* Hover States */
body.cursor-hover-project .cad-crosshair-dot {
  width: 148px;
  height: 38px;
  border-radius: 6px;
  background: #ffffff;
}

body.cursor-hover-project .cad-cursor-text {
  opacity: 1;
}

body.cursor-hover-project .cad-line-left,
body.cursor-hover-project .cad-line-right,
body.cursor-hover-project .cad-line-top,
body.cursor-hover-project .cad-line-bottom {
  opacity: 0.25;
  background: #1E1E1E;
}

/* Hovering Drag / Slider */
body.cursor-hover-drag .cad-crosshair-dot {
  width: 96px;
  height: 34px;
  border-radius: 6px;
  background: #ffffff;
}

body.cursor-hover-drag .cad-cursor-text {
  opacity: 1;
}

/* Hovering Clickable Elements */
body.cursor-hover-clickable .cad-crosshair-dot {
  width: 32px;
  height: 32px;
  background: #ffffff;
}

body.cursor-hover-clickable .cad-line-left,
body.cursor-hover-clickable .cad-line-right,
body.cursor-hover-clickable .cad-line-top,
body.cursor-hover-clickable .cad-line-bottom {
  opacity: 0.25;
  background: #1E1E1E;
}

/* Floating Navbar Hover State: Elegant compact 8px precision dot with clean halo & rays suppressed */
body.cursor-hover-navbar .cad-crosshair-dot,
body:has(.global-floating-nav:hover) .cad-crosshair-dot {
  opacity: 1 !important;
  width: 8px !important;
  height: 8px !important;
  background: #ffffff !important;
  mix-blend-mode: normal !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35) !important;
  pointer-events: none !important;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.15s ease !important;
}

body.cursor-hover-navbar .cad-cursor-text,
body:has(.global-floating-nav:hover) .cad-cursor-text {
  opacity: 0 !important;
  display: none !important;
}

body.cursor-hover-navbar .cad-line-left,
body.cursor-hover-navbar .cad-line-right,
body.cursor-hover-navbar .cad-line-top,
body.cursor-hover-navbar .cad-line-bottom,
body:has(.global-floating-nav:hover) .cad-line-left,
body:has(.global-floating-nav:hover) .cad-line-right,
body:has(.global-floating-nav:hover) .cad-line-top,
body:has(.global-floating-nav:hover) .cad-line-bottom {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Text Selection Dimming */
body.cursor-hover-text .cad-crosshair-dot {
  opacity: 0.15;
}

body.cursor-hover-text .cad-line-left,
body.cursor-hover-text .cad-line-right,
body.cursor-hover-text .cad-line-top,
body.cursor-hover-text .cad-line-bottom {
  opacity: 0.1;
  background: #1E1E1E;
}

/* Global Floating Toast for Copied Email & Actions */
#portfolio-global-toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(21, 21, 24, 0.94);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid rgba(224, 112, 27, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 16px rgba(224, 112, 27, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#portfolio-global-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Hide on Touch Devices */
@media (pointer: coarse), (max-width: 900px) {
  .cad-line-left,
  .cad-line-right,
  .cad-line-top,
  .cad-line-bottom,
  .cad-crosshair-dot {
    display: none !important;
  }
}
