/*!
 * NEXUS Cursor Studio — cursor styles
 * Everything here is inert until cursor.js adds classes, so a failed script
 * never hides the native cursor.
 */

/* -------------------------------------------------------------------------
 * Native cursor handling (classes are added by cursor.js on the host element)
 * ---------------------------------------------------------------------- */
.nxcs-hide-native:not(.nxcs-native-zone),
.nxcs-hide-native:not(.nxcs-native-zone) * {
	cursor: none !important;
}

/* -------------------------------------------------------------------------
 * Root & layers
 * ---------------------------------------------------------------------- */
.nxcs {
	--nxcs-s-hover: 1;
	--nxcs-s-press: 1;
	--nxcs-d-hover: 1;
	--nxcs-t: calc(0.28s / var(--nxcs-speed, 1));
	position: fixed;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	z-index: 2147483646;
	pointer-events: none;
	opacity: 0;
	mix-blend-mode: var(--nxcs-blend, normal);
	transition: opacity 0.2s ease;
	contain: layout style;
}

.nxcs.is-visible {
	opacity: var(--nxcs-op, 1);
}

.nxcs.is-native,
.nxcs.is-keyboard,
.nxcs.is-suspended {
	opacity: 0;
}

.nxcs *,
.nxcs *::before,
.nxcs *::after {
	box-sizing: border-box;
	pointer-events: none;
}

.nxcs-canvas {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 2147483645;
	pointer-events: none;
}

.nxcs-dot,
.nxcs-ring {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	will-change: transform;
}

/* Dot (precise pointer) */
.nxcs-dot-inner {
	position: absolute;
	width: var(--nxcs-dot);
	height: var(--nxcs-dot);
	margin-left: calc(var(--nxcs-dot) / -2);
	margin-top: calc(var(--nxcs-dot) / -2);
	border-radius: 50%;
	background: var(--nxcs-c1);
	transform: scale(calc(var(--nxcs-d-hover) * var(--nxcs-s-press)));
	transition: transform var(--nxcs-t) cubic-bezier(.2, .8, .2, 1), opacity var(--nxcs-t) ease, background-color var(--nxcs-t) ease;
}

.nxcs.has-glow .nxcs-dot-inner {
	box-shadow: 0 0 var(--nxcs-glow) var(--nxcs-c1), 0 0 calc(var(--nxcs-glow) * 2) var(--nxcs-c1-soft);
}

.nxcs.has-gradient .nxcs-dot-inner {
	background: linear-gradient(135deg, var(--nxcs-c1), var(--nxcs-c2));
}

/* Follower ring */
.nxcs-ring-stretch {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
}

.nxcs-ring-inner {
	position: absolute;
	width: var(--nxcs-w);
	height: var(--nxcs-h);
	margin-left: calc(var(--nxcs-w) / -2);
	margin-top: calc(var(--nxcs-h) / -2);
	border: var(--nxcs-bw) solid var(--nxcs-c1);
	border-radius: 50%;
	transform: scale(calc(var(--nxcs-s-hover) * var(--nxcs-s-press)));
	transition:
		transform var(--nxcs-t) cubic-bezier(.2, .8, .2, 1),
		width var(--nxcs-t) cubic-bezier(.2, .8, .2, 1),
		height var(--nxcs-t) cubic-bezier(.2, .8, .2, 1),
		margin var(--nxcs-t) cubic-bezier(.2, .8, .2, 1),
		border-radius var(--nxcs-t) ease,
		background-color var(--nxcs-t) ease,
		border-color var(--nxcs-t) ease,
		opacity var(--nxcs-t) ease;
}

.nxcs.has-glow .nxcs-ring-inner {
	box-shadow: 0 0 var(--nxcs-glow) var(--nxcs-c1-soft), inset 0 0 calc(var(--nxcs-glow) * 0.6) var(--nxcs-c1-soft);
}

.nxcs-ring-deco {
	position: absolute;
	inset: calc(var(--nxcs-bw) * -1);
	border-radius: inherit;
	display: none;
}

/* Gradient ring: masked gradient border, falls back to the solid border. */
@supports ((mask: radial-gradient(#000, transparent)) or (-webkit-mask: radial-gradient(#000, transparent))) {
	.nxcs.has-gradient .nxcs-ring-inner {
		border-color: transparent;
	}
	.nxcs.has-gradient .nxcs-ring-deco {
		display: block;
		background: linear-gradient(135deg, var(--nxcs-c1), var(--nxcs-c2));
		-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 0.5px), #000 calc(100% - var(--nxcs-bw)));
		mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 0.5px), #000 calc(100% - var(--nxcs-bw)));
	}
}

/* Idle pulse (uses a pseudo element so it never fights hover transforms) */
.nxcs.has-pulse .nxcs-ring-inner::after {
	content: "";
	position: absolute;
	inset: calc(var(--nxcs-bw) * -1);
	border-radius: inherit;
	border: 1px solid var(--nxcs-c1);
	animation: nxcs-pulse calc(2.2s / var(--nxcs-speed)) ease-out infinite;
}

@keyframes nxcs-pulse {
	0% { transform: scale(1); opacity: 0.7; }
	100% { transform: scale(1.7); opacity: 0; }
}

/* Labels */
.nxcs-label {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	align-items: center;
	gap: 4px;
	transform: translate(-50%, -50%) scale(0.6);
	opacity: 0;
	white-space: nowrap;
	color: var(--nxcs-label-fg);
	font: 600 11px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	transition: opacity var(--nxcs-t) ease, transform var(--nxcs-t) cubic-bezier(.2, .8, .2, 1);
}

.nxcs-label-icon:empty {
	display: none;
}

.nxcs-label-icon svg {
	display: block;
}

.nxcs.has-label .nxcs-label {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Extra attribute selector raises specificity above effect and style rules. */
.nxcs.nxcs.has-label[data-nxcs-effect] .nxcs-ring-inner {
	--nxcs-s-hover: max(var(--nxcs-hover-scale), 2.2);
	background-color: var(--nxcs-c1-fill);
	border-color: var(--nxcs-c1);
	opacity: 1;
	animation: none;
}

.nxcs.nxcs.has-label[data-nxcs-effect] .nxcs-ring-deco {
	opacity: 0;
}

.nxcs.nxcs.has-label[data-nxcs-effect] .nxcs-dot-inner {
	--nxcs-d-hover: 0;
}

/* HUD readout (only visible for the HUD style) */
.nxcs-readout {
	position: absolute;
	top: calc(var(--nxcs-ring) / 2 + 8px);
	left: calc(var(--nxcs-ring) / 2 + 4px);
	display: none;
	color: var(--nxcs-c1);
	font: 500 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	letter-spacing: 0.1em;
	white-space: pre;
	text-shadow: 0 0 6px var(--nxcs-c1-soft);
	opacity: 0.85;
}

/* Click effects */
.nxcs-click {
	position: absolute;
	top: 0;
	left: 0;
	border: 2px solid var(--nxcs-c1);
	border-radius: 50%;
	opacity: 0;
	box-shadow: 0 0 calc(var(--nxcs-glow) * 0.8) var(--nxcs-c1-soft);
}

/* -------------------------------------------------------------------------
 * Hover effects
 * ---------------------------------------------------------------------- */
.nxcs[data-nxcs-effect="expand"] .nxcs-ring-inner { --nxcs-s-hover: var(--nxcs-hover-scale); }
.nxcs[data-nxcs-effect="expand"] .nxcs-dot-inner { --nxcs-d-hover: 0.5; }

.nxcs[data-nxcs-effect="shrink"] .nxcs-ring-inner { --nxcs-s-hover: 0.55; }
.nxcs[data-nxcs-effect="shrink"] .nxcs-dot-inner { --nxcs-d-hover: 1.5; }

.nxcs[data-nxcs-effect="fill"] .nxcs-ring-inner {
	--nxcs-s-hover: var(--nxcs-hover-scale);
	background-color: var(--nxcs-c1-soft);
}
.nxcs[data-nxcs-effect="fill"] .nxcs-dot-inner { --nxcs-d-hover: 0; }

.nxcs[data-nxcs-effect="lock"] .nxcs-ring-inner {
	--nxcs-s-hover: 1;
	border-radius: 6px;
}
.nxcs[data-nxcs-effect="lock"] .nxcs-dot-inner { --nxcs-d-hover: 0.6; }

.nxcs[data-nxcs-effect="hide"] .nxcs-ring-inner { opacity: 0; }
.nxcs[data-nxcs-effect="hide"] .nxcs-dot-inner { --nxcs-d-hover: 1.6; }

.nxcs.is-down { --nxcs-s-press: var(--nxcs-press-scale); }

/* -------------------------------------------------------------------------
 * Styles
 * ---------------------------------------------------------------------- */

/* Minimal Dot: the dot carries all hover feedback. */
.nxcs[data-nxcs-style="dot"] .nxcs-ring-inner { opacity: 0; }
.nxcs[data-nxcs-style="dot"].has-label .nxcs-ring-inner { opacity: 1; }
.nxcs[data-nxcs-style="dot"][data-nxcs-effect="expand"] .nxcs-dot-inner,
.nxcs[data-nxcs-style="dot"][data-nxcs-effect="fill"] .nxcs-dot-inner,
.nxcs[data-nxcs-style="dot"][data-nxcs-effect="lock"] .nxcs-dot-inner { --nxcs-d-hover: calc(var(--nxcs-hover-scale) * 2.2); }
.nxcs[data-nxcs-style="dot"][data-nxcs-effect="shrink"] .nxcs-dot-inner { --nxcs-d-hover: 0.5; }
.nxcs[data-nxcs-style="dot"][data-nxcs-effect="hide"] .nxcs-dot-inner { --nxcs-d-hover: 0; }

/* Neon Orbit: rotating arc with a faint full track. */
.nxcs[data-nxcs-style="orbit"] .nxcs-ring-inner {
	border-color: var(--nxcs-c1-soft);
}
.nxcs[data-nxcs-style="orbit"] .nxcs-ring-deco {
	display: block;
	background: conic-gradient(from 0deg, transparent 0 30%, var(--nxcs-c2) 60%, var(--nxcs-c1) 85%, transparent 86%);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 1.5px), #000 calc(100% - var(--nxcs-bw) - 1px));
	mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 1.5px), #000 calc(100% - var(--nxcs-bw) - 1px));
	inset: calc(var(--nxcs-bw) * -1 - 1px);
	animation: nxcs-spin calc(1.6s / var(--nxcs-speed)) linear infinite;
}

/* Cyber HUD: corner brackets, dashed inner reticle, live coordinates. */
.nxcs[data-nxcs-style="hud"] .nxcs-ring-inner {
	border-color: transparent;
	border-radius: 2px;
	box-shadow: none;
}
.nxcs[data-nxcs-style="hud"] .nxcs-ring-deco {
	display: block;
	inset: calc(var(--nxcs-bw) * -1);
	border-radius: 0;
	--l: 28%;
	--g: linear-gradient(var(--nxcs-c1), var(--nxcs-c1));
	background:
		var(--g) left top / var(--l) var(--nxcs-bw) no-repeat,
		var(--g) left top / var(--nxcs-bw) var(--l) no-repeat,
		var(--g) right top / var(--l) var(--nxcs-bw) no-repeat,
		var(--g) right top / var(--nxcs-bw) var(--l) no-repeat,
		var(--g) left bottom / var(--l) var(--nxcs-bw) no-repeat,
		var(--g) left bottom / var(--nxcs-bw) var(--l) no-repeat,
		var(--g) right bottom / var(--l) var(--nxcs-bw) no-repeat,
		var(--g) right bottom / var(--nxcs-bw) var(--l) no-repeat;
	transition: transform var(--nxcs-t) ease;
}
.nxcs.has-glow[data-nxcs-style="hud"] .nxcs-ring-deco {
	filter: drop-shadow(0 0 calc(var(--nxcs-glow) * 0.5) var(--nxcs-c1));
}
.nxcs[data-nxcs-style="hud"] .nxcs-ring-inner::before {
	content: "";
	position: absolute;
	inset: 22%;
	border: 1px dashed var(--nxcs-c2);
	border-radius: 50%;
	opacity: 0.8;
	animation: nxcs-spin calc(6s / var(--nxcs-speed)) linear infinite;
}
.nxcs[data-nxcs-style="hud"].is-hover .nxcs-ring-deco { transform: rotate(45deg) scale(0.9); }
.nxcs[data-nxcs-style="hud"][data-nxcs-effect="lock"] .nxcs-ring-deco { transform: none; }
.nxcs[data-nxcs-style="hud"] .nxcs-readout { display: block; }
.nxcs[data-nxcs-style="hud"].has-label .nxcs-ring-inner::before,
.nxcs[data-nxcs-style="hud"].is-hover .nxcs-readout { opacity: 0; }

/* Holographic: iridescent conic ring with a pearl sheen. */
.nxcs[data-nxcs-style="holo"] .nxcs-ring-inner {
	border-color: transparent;
	background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.22), transparent 60%);
}
.nxcs[data-nxcs-style="holo"] .nxcs-ring-deco {
	display: block;
	background: conic-gradient(var(--nxcs-c1), #ff7ad9, #7afcff, #fff59d, var(--nxcs-c2), var(--nxcs-c1));
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 0.5px), #000 calc(100% - var(--nxcs-bw)));
	mask: radial-gradient(farthest-side, transparent calc(100% - var(--nxcs-bw) - 0.5px), #000 calc(100% - var(--nxcs-bw)));
	animation: nxcs-spin calc(4s / var(--nxcs-speed)) linear infinite, nxcs-hue calc(6s / var(--nxcs-speed)) linear infinite;
}
.nxcs[data-nxcs-style="holo"] .nxcs-dot-inner {
	background: radial-gradient(circle at 35% 35%, #fff, var(--nxcs-c2));
}
.nxcs[data-nxcs-style="holo"].has-label .nxcs-ring-inner {
	background-color: var(--nxcs-c1-fill);
}

/* Target Lock: crosshair ticks, rotating reticle. */
.nxcs[data-nxcs-style="target"] .nxcs-ring-inner {
	border-width: 1px;
	border-style: dashed;
}
.nxcs[data-nxcs-style="target"] .nxcs-ring-deco {
	display: block;
	inset: -6px;
	border-radius: 0;
	--g: linear-gradient(var(--nxcs-c1), var(--nxcs-c1));
	background:
		var(--g) center top / var(--nxcs-bw) 30% no-repeat,
		var(--g) center bottom / var(--nxcs-bw) 30% no-repeat,
		var(--g) left center / 30% var(--nxcs-bw) no-repeat,
		var(--g) right center / 30% var(--nxcs-bw) no-repeat;
	-webkit-mask: radial-gradient(circle, transparent 30%, #000 31%);
	mask: radial-gradient(circle, transparent 30%, #000 31%);
	animation: nxcs-spin calc(8s / var(--nxcs-speed)) linear infinite;
	transition: opacity var(--nxcs-t) ease;
}
.nxcs[data-nxcs-style="target"][data-nxcs-effect="lock"] .nxcs-ring-inner {
	border-style: solid;
	border-width: var(--nxcs-bw);
}
.nxcs[data-nxcs-style="target"].is-hover .nxcs-ring-deco { opacity: 0; }

/* Digital Pixel: square geometry, position snapping happens in JS. */
.nxcs[data-nxcs-style="pixel"] .nxcs-dot-inner,
.nxcs[data-nxcs-style="pixel"] .nxcs-ring-inner,
.nxcs[data-nxcs-style="pixel"] .nxcs-click {
	border-radius: 0;
}
.nxcs[data-nxcs-style="pixel"] .nxcs-ring-inner {
	transition-timing-function: steps(4, end);
}
.nxcs[data-nxcs-style="pixel"] .nxcs-dot-inner {
	animation: nxcs-blink calc(1.4s / var(--nxcs-speed)) steps(1, end) infinite;
}

/* Liquid Motion: morphing blob; stretch is applied in JS. */
.nxcs[data-nxcs-style="liquid"] .nxcs-ring-inner {
	border-color: transparent;
	background: radial-gradient(circle at 40% 35%, var(--nxcs-c1-soft), var(--nxcs-c2-soft));
	box-shadow: inset 0 0 0 var(--nxcs-bw) var(--nxcs-c1);
	animation: nxcs-blob calc(7s / var(--nxcs-speed)) ease-in-out infinite;
}
.nxcs.has-glow[data-nxcs-style="liquid"] .nxcs-ring-inner {
	box-shadow: inset 0 0 0 var(--nxcs-bw) var(--nxcs-c1), 0 0 var(--nxcs-glow) var(--nxcs-c1-soft);
}
.nxcs[data-nxcs-style="liquid"][data-nxcs-effect="lock"] .nxcs-ring-inner { animation: none; }
.nxcs[data-nxcs-style="liquid"] .nxcs-ring-stretch { transition: none; }

/* Glitch Mode: RGB-split duplicates with stepped jitter. */
.nxcs[data-nxcs-style="glitch"] .nxcs-ring-inner::before,
.nxcs[data-nxcs-style="glitch"] .nxcs-ring-inner::after {
	content: "";
	position: absolute;
	inset: calc(var(--nxcs-bw) * -1);
	border: var(--nxcs-bw) solid var(--nxcs-c2);
	border-radius: inherit;
	opacity: 0.75;
	mix-blend-mode: screen;
	animation: nxcs-glitch-a calc(2.4s / var(--nxcs-speed)) steps(1, end) infinite;
}
.nxcs[data-nxcs-style="glitch"] .nxcs-ring-inner::after {
	border-color: var(--nxcs-c1);
	animation-name: nxcs-glitch-b;
	animation-delay: calc(-0.7s / var(--nxcs-speed));
}
.nxcs[data-nxcs-style="glitch"] .nxcs-dot-inner {
	box-shadow: calc(-2px * var(--nxcs-int)) 0 0 var(--nxcs-c2), calc(2px * var(--nxcs-int)) 0 0 var(--nxcs-c1);
	animation: nxcs-glitch-dot calc(3s / var(--nxcs-speed)) steps(1, end) infinite;
}

/* Magnetic Cursor: thicker ring that fills as it snaps to targets. */
.nxcs[data-nxcs-style="magnetic"] .nxcs-ring-inner {
	border-width: calc(var(--nxcs-bw) + 1px);
}
.nxcs[data-nxcs-style="magnetic"].is-hover .nxcs-ring-inner {
	background-color: var(--nxcs-c1-soft);
}

/* Custom Image */
.nxcs[data-nxcs-style="image"] .nxcs-ring-inner { opacity: 0; }
.nxcs[data-nxcs-style="image"].has-label .nxcs-ring-inner { opacity: 1; }
.nxcs[data-nxcs-style="image"] .nxcs-dot-inner {
	width: var(--nxcs-img);
	height: var(--nxcs-img);
	margin-left: calc(var(--nxcs-img) / -2);
	margin-top: calc(var(--nxcs-img) / -2);
	background: none;
	box-shadow: none;
	border-radius: 0;
}
.nxcs[data-nxcs-style="image"] .nxcs-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.nxcs[data-nxcs-style="image"][data-nxcs-effect="expand"] .nxcs-dot-inner,
.nxcs[data-nxcs-style="image"][data-nxcs-effect="fill"] .nxcs-dot-inner,
.nxcs[data-nxcs-style="image"][data-nxcs-effect="lock"] .nxcs-dot-inner { --nxcs-d-hover: 1.3; }

/* -------------------------------------------------------------------------
 * Keyframes
 * ---------------------------------------------------------------------- */
@keyframes nxcs-spin {
	to { transform: rotate(360deg); }
}

@keyframes nxcs-hue {
	to { filter: hue-rotate(360deg); }
}

@keyframes nxcs-blink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

@keyframes nxcs-blob {
	0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
	25% { border-radius: 58% 42% 55% 45% / 45% 58% 42% 55%; }
	50% { border-radius: 45% 55% 42% 58% / 56% 44% 56% 44%; }
	75% { border-radius: 54% 46% 60% 40% / 42% 55% 45% 58%; }
}

@keyframes nxcs-glitch-a {
	0%, 62%, 70%, 100% { transform: translate(0, 0); clip-path: none; }
	64% { transform: translate(calc(-3px * var(--nxcs-int)), 1px); clip-path: inset(10% 0 55% 0); }
	66% { transform: translate(calc(3px * var(--nxcs-int)), -1px); clip-path: inset(60% 0 8% 0); }
	68% { transform: translate(calc(-2px * var(--nxcs-int)), 0); clip-path: inset(30% 0 35% 0); }
}

@keyframes nxcs-glitch-b {
	0%, 40%, 47%, 100% { transform: translate(0, 0); clip-path: none; }
	42% { transform: translate(calc(3px * var(--nxcs-int)), 0); clip-path: inset(50% 0 20% 0); }
	45% { transform: translate(calc(-3px * var(--nxcs-int)), 1px); clip-path: inset(5% 0 70% 0); }
}

@keyframes nxcs-glitch-dot {
	0%, 80%, 86%, 100% { translate: 0 0; }
	82% { translate: calc(2px * var(--nxcs-int)) 0; }
	84% { translate: calc(-2px * var(--nxcs-int)) 1px; }
}

/* -------------------------------------------------------------------------
 * Reduced motion & media fallbacks
 * ---------------------------------------------------------------------- */
.nxcs.is-reduced *,
.nxcs.is-reduced *::before,
.nxcs.is-reduced *::after {
	animation: none !important;
	transition-duration: 0.01ms !important;
}

/* cursor.js also refuses to start (and tears down) under forced colors. */
@media (forced-colors: active) {
	.nxcs,
	.nxcs-canvas {
		display: none !important;
	}
}

@media print {
	.nxcs,
	.nxcs-canvas {
		display: none !important;
	}
}
