/* ============================================================
   JAY.EXE — OVERLAY UI THEME (scrollbar + custom cursor)
   ============================================================
   One file that owns ALL styling for the page scrollbar and the
   custom mouse cursor. Everything is driven by the custom
   properties below — edit ONLY this file to re-theme either one.

   How to tune:
   - Colors: change the --ui-* values in :root.
   - Sizes:  --ui-cursor-ring-size, --ui-cursor-dot-size,
             --ui-scrollbar-width.
   - Behavior: comment out the hover/active blocks, or the
     whole "custom cursor" section, to disable pieces.

   Loaded AFTER components.css so these rules win without
   needing !important. Markup lives in index.html:
   <div id="custom-cursor" class="cursor">…</div>
   ============================================================ */

:root {
  /* ---- scrollbar tokens ---- */
  --ui-scrollbar-width: 10px;          /* webkit track thickness   */
  --ui-scrollbar-thumb: var(--accent-cyan);        /* thumb color  */
  --ui-scrollbar-thumb-hover: var(--accent-hot);   /* hover color  */
  --ui-scrollbar-thumb-alpha: 0.45;    /* resting opacity          */
  --ui-scrollbar-thumb-alpha-hover: 0.85;
  --ui-scrollbar-track: rgba(4, 7, 15, 0.6);       /* track color  */
  --ui-scrollbar-radius: 999px;

  /* ---- cursor tokens ---- */
  --ui-cursor-arrow-size: 26px;
  --ui-cursor-arrow-body: #0b1524;          /* dark arrow body      */
  --ui-cursor-arrow-outline: #4db8ff;       /* cyan neon rim        */
  --ui-cursor-accent: #ff9a3c;              /* orange accent        */
  --ui-cursor-arrow-glow: rgba(77, 184, 255, 0.65);
  --ui-cursor-trail-size: 5px;
  --ui-cursor-trail-color: rgba(255, 176, 87, 0.85);
  --ui-cursor-trail-glow: rgba(255, 140, 41, 0.7);
  --ui-cursor-trail-life: 0.45s;
}

/* ============================================================
   SCROLLBAR (page + inner scroll areas)
   ============================================================ */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(58, 160, 255, var(--ui-scrollbar-thumb-alpha)) var(--ui-scrollbar-track);
}

/* WebKit / Chromium / Edge */
::-webkit-scrollbar {
  width: var(--ui-scrollbar-width);
  height: var(--ui-scrollbar-width);
}
::-webkit-scrollbar-track {
  background: var(--ui-scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--ui-scrollbar-thumb);
  opacity: var(--ui-scrollbar-thumb-alpha);
  border-radius: var(--ui-scrollbar-radius);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 6px rgba(58, 160, 255, 0.35);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ui-scrollbar-thumb-hover);
  background-clip: padding-box;
  box-shadow: 0 0 10px rgba(92, 214, 255, 0.5);
}
::-webkit-scrollbar-corner { background: transparent; }

/* ============================================================
   CUSTOM CURSOR — glowing arrow + minimal trail
   The real pointer is hidden by body.has-custom-cursor; the JS
   writes translate3d synchronously on mousemove (zero delay).
   ============================================================ */

/* hide the OS cursor only where the custom one is active */
body.has-custom-cursor,
body.has-custom-cursor a,
body.has-custom-cursor button,
body.has-custom-cursor [role='button'],
body.has-custom-cursor input,
body.has-custom-cursor textarea {
  cursor: none;
}

/* container: rides exactly at the pointer (JS writes the transform) */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
}

/* the arrow glyph — dark body, cyan neon outline, orange accent,
   exactly like the reference art */
.cursor-arrow {
  position: absolute;
  top: 0; left: 0;
  width: var(--ui-cursor-arrow-size);
  height: var(--ui-cursor-arrow-size);
  transform: translate(-22%, -14%); /* hotspot at the arrow's tip */
  transition: transform 0.15s ease;
}
.cursor-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter:
    drop-shadow(0 0 3px var(--ui-cursor-arrow-glow))
    drop-shadow(0 0 10px var(--ui-cursor-arrow-glow));
}
.cursor-arrow-body {
  fill: var(--ui-cursor-arrow-body);
  stroke: var(--ui-cursor-arrow-outline);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.cursor-arrow-accent {
  fill: var(--ui-cursor-accent);
}

/* click feedback: orbit ring + orbiting dot flare around the tip,
   like the reference's "Click" state */
.cursor-orbit {
  position: absolute;
  top: 0; left: 0;
  width: 34px; height: 34px;
  margin: -17px 0 0 -6px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.cursor-orbit-dot {
  position: absolute;
  top: -2px; left: 50%;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--ui-cursor-accent);
  box-shadow: 0 0 6px var(--ui-cursor-accent);
}
.cursor.pressed .cursor-orbit {
  animation: cursor-orbit-flare 0.5s ease-out;
}
@keyframes cursor-orbit-flare {
  0%   { opacity: 1; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* states */
.cursor.active .cursor-arrow { transform: translate(-22%, -14%) scale(1.18); }
.cursor.active .cursor-arrow-body { stroke: var(--ui-cursor-accent); }
.cursor.text .cursor-arrow { transform: translate(-22%, -14%) scale(0.75); opacity: 0.65; }
.cursor.pressed .cursor-arrow { transform: translate(-22%, -14%) scale(0.85); }

/* trail layer: fixed, out of the arrow's transform */
.cursor-trail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 1);
}
.cursor-trail-dot {
  position: absolute;
  width: var(--ui-cursor-trail-size);
  height: var(--ui-cursor-trail-size);
  margin: calc(var(--ui-cursor-trail-size) / -2) 0 0 calc(var(--ui-cursor-trail-size) / -2);
  border-radius: 50%;
  background: var(--ui-cursor-trail-color);
  box-shadow: 0 0 6px var(--ui-cursor-trail-glow);
  animation: cursor-trail-fade var(--ui-cursor-trail-life) ease-out forwards;
}
@keyframes cursor-trail-fade {
  from { opacity: 0.7; transform: scale(1); }
  to   { opacity: 0;    transform: scale(0.2); }
}

/* ============================================================
   ENABLE / DISABLE
   The cursor JS adds .has-custom-cursor to <body> when the
   custom cursor is actually running (fine pointer + motion OK),
   and leaves it off for touch/reduced-motion users.
   ============================================================ */
@media (pointer: coarse) {
  .cursor { display: none; }
}
