/**
 * Omar Techfolio - Scroll Effects Stylesheet
 *
 * Apple-style animations with developer/cyberpunk aesthetic
 *
 * @package OmarTechfolio
 */

/* ==========================================================================
   1. Scroll Progress Indicator
   ========================================================================== */

.scroll-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	z-index: 10000;
	background: rgba(255, 255, 255, 0.05);
	pointer-events: none;
}

.scroll-progress__bar {
	height: 100%;
	width: 0%;
	background: var(--gradient-neon);
	box-shadow: 0 0 20px rgba(230, 237, 245, 0.5), 0 0 40px rgba(143, 163, 184, 0.35);
	transition: width 0.1s ease-out;
}

/* ==========================================================================
   2. Custom Cursor
   ========================================================================== */

/* Hide default cursor globally */
body,
body * {
	cursor: none !important;
}

.custom-cursor {
	position: fixed;
	top: 0;
	left: 0;
	pointer-events: none;
	z-index: 9999;
	width: 28px;
	height: 28px;
	background: transparent;
	border: 1.5px solid rgba(255, 255, 255, 0.5);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.custom-cursor.cursor-hover {
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.7);
}

/* Hide custom cursor follower (not used anymore) */
.custom-cursor-follower {
	display: none;
}

/* Hide custom cursor on touch devices and restore default cursor */
@media (hover: none) {
	.custom-cursor,
	.custom-cursor-follower {
		display: none;
	}

	/* Restore default cursor on touch devices */
	body,
	body * {
		cursor: auto !important;
	}
}

/* Light mode cursor */
[data-theme="light"] .custom-cursor {
	border-color: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .custom-cursor.cursor-hover {
	background: rgba(0, 0, 0, 0.04);
	border-color: rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   3. Card 3D Tilt Effects
   ========================================================================== */

.project-card,
.card,
.glass {
	transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1),
				box-shadow 0.3s cubic-bezier(0.23, 1, 0.32, 1);
	transform-style: preserve-3d;
	will-change: transform;
}

.project-card:hover,
.card:hover,
.glass:hover {
	box-shadow:
		var(--shadow-xl),
		0 0 40px rgba(230, 237, 245, 0.35),
		0 0 80px rgba(143, 163, 184, 0.3);
}

/* ==========================================================================
   4. Magnetic Elements
   ========================================================================== */

.btn,
.chip,
.social-links a {
	transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
	will-change: transform;
}

/* ==========================================================================
   5. Parallax Elements
   ========================================================================== */

[data-parallax] {
	will-change: transform;
	transition: transform 0.1s ease-out;
}

/* Background grid parallax */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: radial-gradient(circle at 1px 1px, var(--color-text-muted) 1px, transparent 1px);
	background-size: 32px 32px;
	opacity: 0.3;
	z-index: -1;
	pointer-events: none;
	will-change: transform;
}

/* ==========================================================================
   6. Glitch Effects
   ========================================================================== */

[data-glitch] {
	position: relative;
}

.glitch-active::before,
.glitch-active::after {
	content: attr(data-glitch);
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0.8;
}

.glitch-active::before {
	animation: glitch-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
	color: var(--color-accent-light);
	z-index: -1;
}


.glitch-active::after {
	animation: glitch-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
	color: var(--color-accent-steel);
	z-index: -2;
}

@keyframes glitch-1 {
	0%, 100% {
		transform: translate(0);
		clip-path: inset(0 0 0 0);
	}
	20% {
		transform: translate(-2px, 2px);
		clip-path: inset(10% 0 20% 0);
	}
	40% {
		transform: translate(-2px, -2px);
		clip-path: inset(20% 0 10% 0);
	}
	60% {
		transform: translate(2px, 2px);
		clip-path: inset(30% 0 40% 0);
	}
	80% {
		transform: translate(2px, -2px);
		clip-path: inset(40% 0 30% 0);
	}
}

@keyframes glitch-2 {
	0%, 100% {
		transform: translate(0);
		clip-path: inset(0 0 0 0);
	}
	20% {
		transform: translate(2px, -2px);
		clip-path: inset(20% 0 10% 0);
	}
	40% {
		transform: translate(2px, 2px);
		clip-path: inset(10% 0 20% 0);
	}
	60% {
		transform: translate(-2px, -2px);
		clip-path: inset(40% 0 30% 0);
	}
	80% {
		transform: translate(-2px, 2px);
		clip-path: inset(30% 0 40% 0);
	}
}

/* ==========================================================================
   7. Scroll Assembly Animations
   ========================================================================== */

[data-assembly-part] {
	opacity: 0;
	transform: translateY(40px) scale(0.95);
	transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
				transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

[data-assembly-part].assembled {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ==========================================================================
   8. Staggered Animations - Apple Style with Scaling
   ========================================================================== */

[data-stagger] > * {
	opacity: 0;
	transform: translateY(35px) scale(0.97);
	transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
				transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-stagger] > *.stagger-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* Prominent stagger delays - Apple timing */
[data-stagger] > *:nth-child(1) { transition-delay: 0.1s; }
[data-stagger] > *:nth-child(2) { transition-delay: 0.25s; }
[data-stagger] > *:nth-child(3) { transition-delay: 0.4s; }
[data-stagger] > *:nth-child(4) { transition-delay: 0.55s; }
[data-stagger] > *:nth-child(5) { transition-delay: 0.7s; }
[data-stagger] > *:nth-child(6) { transition-delay: 0.85s; }
[data-stagger] > *:nth-child(7) { transition-delay: 1s; }
[data-stagger] > *:nth-child(8) { transition-delay: 1.15s; }

/* ==========================================================================
   9. Reveal Animations - Apple Style
   ========================================================================== */

.fade-in,
[data-reveal] {
	opacity: 0;
	transform: translateY(56px) scale(0.98);
	transition: opacity 1.45s cubic-bezier(0.16, 1, 0.3, 1),
				transform 1.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.revealed,
[data-reveal].revealed {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* Glitch reveal effect */
.reveal-glitch {
	animation: reveal-glitch 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes reveal-glitch {
	0%, 100% {
		opacity: 1;
	}
	10%, 30%, 50%, 70%, 90% {
		opacity: 0.8;
		transform: translate(2px, 0);
	}
	20%, 40%, 60%, 80% {
		opacity: 0.9;
		transform: translate(-2px, 0);
	}
}

/* ==========================================================================
   10. Scanline Effect (Terminal Aesthetic)
   ========================================================================== */

.terminal,
[data-scanline] {
	position: relative;
	overflow: hidden;
}

.terminal::before,
[data-scanline]::before {
	content: '';
	position: absolute;
	top: -100%;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(
		to bottom,
		transparent,
		rgba(230, 237, 245, 0.4),
		transparent
	);
	animation: scanline 4s linear infinite;
	pointer-events: none;
	z-index: 2;
}

@keyframes scanline {
	0% {
		top: -10%;
	}
	100% {
		top: 110%;
	}
}

/* ==========================================================================
   11. Background Color Morphing
   ========================================================================== */

:root {
	--dynamic-bg: var(--color-bg);
}

body {
	background: var(--dynamic-bg);
	transition: background 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ==========================================================================
   12. Glow Pulse Effect
   ========================================================================== */

.glow-pulse {
	animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
	0%, 100% {
		box-shadow: 0 0 20px rgba(230, 237, 245, 0.5);
	}
	50% {
		box-shadow: 0 0 40px rgba(230, 237, 245, 0.8),
					0 0 60px rgba(143, 163, 184, 0.6);
	}
}

/* ==========================================================================
   13. Text Shimmer Effect
   ========================================================================== */

.text-shimmer {
	background: linear-gradient(
		90deg,
		var(--color-text) 0%,
		var(--color-accent-light) 50%,
		var(--color-accent-steel) 75%,
		var(--color-text) 100%
	);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* ==========================================================================
   14. Animated Live Background (Matrix/Particles Style)
   ========================================================================== */

/* Animated gradient background - no grid */
.animated-bg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
	background: #000;
	overflow: hidden;
}

.animated-bg::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: radial-gradient(circle at 50% 30%, rgba(230, 237, 245, 0.12) 0%, transparent 28%);
	animation: gradient-shift 30s ease-in-out infinite;
}

@keyframes gradient-shift {
	0%, 100% {
		transform: translate(0, 0) rotate(0deg);
	}
	33% {
		transform: translate(-5%, 5%) rotate(120deg);
	}
	66% {
		transform: translate(5%, -5%) rotate(240deg);
	}
}

/* Light mode animated background */
[data-theme="light"] .animated-bg {
	background: linear-gradient(to bottom, #f0f9ff, #f7fafc);
}

[data-theme="light"] .animated-bg::before {
	background: radial-gradient(circle at 20% 50%, rgba(143, 163, 184, 0.08) 0%, transparent 30%),
				radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.06) 0%, transparent 30%),
				radial-gradient(circle at 50% 10%, rgba(143, 163, 184, 0.05) 0%, transparent 25%);
}

/* Particle container */
.particle-container {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
	overflow: hidden;
}

/* Individual particles */
.particle {
	position: absolute;
	background: var(--color-accent-light);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
}

.particle:nth-child(1) {
	width: 3px;
	height: 3px;
	left: 10%;
	animation: particle-float-1 15s ease-in-out infinite;
}

.particle:nth-child(2) {
	width: 2px;
	height: 2px;
	left: 30%;
	animation: particle-float-2 18s ease-in-out infinite;
	animation-delay: 2s;
}

.particle:nth-child(3) {
	width: 4px;
	height: 4px;
	left: 50%;
	animation: particle-float-3 20s ease-in-out infinite;
	animation-delay: 4s;
}

.particle:nth-child(4) {
	width: 2px;
	height: 2px;
	left: 70%;
	animation: particle-float-1 16s ease-in-out infinite;
	animation-delay: 6s;
}

.particle:nth-child(5) {
	width: 3px;
	height: 3px;
	left: 90%;
	animation: particle-float-2 19s ease-in-out infinite;
	animation-delay: 8s;
}

.particle:nth-child(6) {
	width: 2px;
	height: 2px;
	left: 15%;
	background: var(--color-accent-steel);
	animation: particle-float-3 17s ease-in-out infinite;
	animation-delay: 1s;
}

.particle:nth-child(7) {
	width: 3px;
	height: 3px;
	left: 45%;
	background: var(--color-accent-steel);
	animation: particle-float-1 21s ease-in-out infinite;
	animation-delay: 3s;
}

.particle:nth-child(8) {
	width: 2px;
	height: 2px;
	left: 75%;
	background: var(--color-accent-steel);
	animation: particle-float-2 14s ease-in-out infinite;
	animation-delay: 5s;
}

@keyframes particle-float-1 {
	0%, 100% {
		transform: translateY(100vh) translateX(0);
		opacity: 0;
	}
	10% {
		opacity: 0.4;
	}
	90% {
		opacity: 0.4;
	}
	50% {
		transform: translateY(0) translateX(30px);
	}
	100% {
		transform: translateY(-20vh) translateX(60px);
	}
}

@keyframes particle-float-2 {
	0%, 100% {
		transform: translateY(100vh) translateX(0);
		opacity: 0;
	}
	10% {
		opacity: 0.5;
	}
	90% {
		opacity: 0.5;
	}
	50% {
		transform: translateY(50vh) translateX(-30px);
	}
	100% {
		transform: translateY(-20vh) translateX(-60px);
	}
}

@keyframes particle-float-3 {
	0%, 100% {
		transform: translateY(100vh) translateX(0) scale(1);
		opacity: 0;
	}
	10% {
		opacity: 0.3;
	}
	50% {
		opacity: 0.6;
		transform: translateY(50vh) translateX(20px) scale(1.5);
	}
	90% {
		opacity: 0.3;
	}
	100% {
		transform: translateY(-20vh) translateX(40px) scale(1);
	}
}

/* Glowing orbs in background - Liquid Glass Bokeh */
.bg-orb {
	position: absolute;
	border-radius: 50%;
	filter: blur(100px);
	opacity: 0.08;
	pointer-events: none;
	animation: orb-pulse 10s ease-in-out infinite;
	mix-blend-mode: screen;
}

.bg-orb-1 {
	width: 500px;
	height: 500px;
	background: radial-gradient(circle, rgba(230, 237, 245, 0.45) 0%, rgba(230, 237, 245, 0) 70%);
	top: 15%;
	left: 10%;
	animation-delay: 0s;
}

.bg-orb-2,
.bg-orb-3 {
	display: none;
}

@keyframes orb-pulse {
	0%, 100% {
		transform: scale(1) translateY(0) translateX(0);
		opacity: 0.06;
	}
	33% {
		transform: scale(1.15) translateY(-40px) translateX(20px);
		opacity: 0.12;
	}
	66% {
		transform: scale(0.95) translateY(20px) translateX(-20px);
		opacity: 0.09;
	}
}

/* Additional smaller bokeh particles for depth */
.bokeh-particle {
	position: absolute;
	border-radius: 50%;
	filter: blur(40px);
	pointer-events: none;
	animation: bokeh-float 12s ease-in-out infinite;
	opacity: 0.15;
}

.bokeh-particle-1 {
	width: 150px;
	height: 150px;
	background: radial-gradient(circle, rgba(230, 237, 245, 0.4), transparent);
	top: 25%;
	right: 30%;
	animation-delay: 1s;
}

.bokeh-particle-2 {
	width: 120px;
	height: 120px;
	background: radial-gradient(circle, rgba(143, 163, 184, 0.4), transparent);
	bottom: 30%;
	left: 25%;
	animation-delay: 4s;
}

.bokeh-particle-3 {
	width: 180px;
	height: 180px;
	background: radial-gradient(circle, rgba(230, 237, 245, 0.35), transparent);
	top: 60%;
	left: 15%;
	animation-delay: 7s;
}

@keyframes bokeh-float {
	0%, 100% {
		transform: translateY(0) scale(1);
		opacity: 0.1;
	}
	50% {
		transform: translateY(-50px) scale(1.3);
		opacity: 0.2;
	}
}

/* ==========================================================================
   15. Smooth Scroll Behavior
   ========================================================================== */

html {
	scroll-behavior: smooth;
}

/* Enhanced for modern browsers */
@supports (scroll-behavior: smooth) {
	html {
		scroll-padding-top: var(--header-height);
	}
}

/* ==========================================================================
   16. Performance Optimizations
   ========================================================================== */

/* Use GPU acceleration for transforms */
.project-card,
.card,
.glass,
.btn,
.chip,
[data-parallax],
[data-assembly-part],
.fade-in,
[data-reveal] {
	transform: translateZ(0);
	backface-visibility: hidden;
}

/* ==========================================================================
   17. Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.custom-cursor,
	.custom-cursor-follower,
	.scroll-progress,
	.glitch-active::before,
	.glitch-active::after,
	.terminal::before,
	[data-scanline]::before {
		display: none !important;
	}
}

/* ==========================================================================
   18. Loading States
   ========================================================================== */

.loading-pulse {
	animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* ==========================================================================
   19. Floating Elements Animation (Zanjeel-style)
   ========================================================================== */

@keyframes float-up-down {
	0%, 100% {
		transform: translateY(-15px);
	}
	50% {
		transform: translateY(15px);
	}
}

@keyframes float-slow {
	0%, 100% {
		transform: translateY(-20px);
	}
	50% {
		transform: translateY(20px);
	}
}

@keyframes float-rotate {
	0%, 100% {
		transform: translateY(-10px) rotate(0deg);
	}
	50% {
		transform: translateY(10px) rotate(5deg);
	}
}

.floating {
	animation: float-up-down 4s ease-in-out infinite;
}

.floating-slow {
	animation: float-slow 6s ease-in-out infinite;
	animation-delay: 1s;
}

.floating-rotate {
	animation: float-rotate 5s ease-in-out infinite;
	animation-delay: 0.5s;
}

/* ==========================================================================
   20. Radial Gradient Backgrounds
   ========================================================================== */

.bg-radial-blue {
	background: radial-gradient(ellipse 200% 100% at bottom left, rgba(230, 237, 245, 0.18), #000000 100%);
}

.bg-radial-light {
	background: radial-gradient(ellipse 200% 100% at bottom left, rgba(230, 237, 245, 0.14), #000000 100%);
}

.bg-radial-steel {
	background: radial-gradient(ellipse 200% 100% at top right, rgba(143, 163, 184, 0.15), #000000 100%);
}

.bg-radial-mixed {
	background: radial-gradient(ellipse 150% 80% at 20% 50%, rgba(230, 237, 245, 0.1), transparent),
				radial-gradient(ellipse 150% 80% at 80% 50%, rgba(143, 163, 184, 0.1), transparent),
				radial-gradient(ellipse 120% 60% at 50% 30%, rgba(230, 237, 245, 0.05), transparent),
				var(--color-bg);
}

/* Mesh gradient background - modern, no grid */
.bg-mesh {
	background:
		radial-gradient(at 40% 20%, rgba(230, 237, 245, 0.12) 0px, transparent 50%),
		radial-gradient(at 80% 0%, rgba(143, 163, 184, 0.1) 0px, transparent 50%),
		radial-gradient(at 0% 50%, rgba(230, 237, 245, 0.08) 0px, transparent 50%),
		radial-gradient(at 80% 100%, rgba(143, 163, 184, 0.08) 0px, transparent 50%),
		radial-gradient(at 0% 100%, rgba(230, 237, 245, 0.05) 0px, transparent 50%),
		#000000;
}

/* Aurora background - flowing, organic */
.bg-aurora {
	background:
		linear-gradient(180deg, #000000 0%, #000a0f 100%),
		radial-gradient(ellipse at top, rgba(230, 237, 245, 0.15), transparent 60%),
		radial-gradient(ellipse at bottom, rgba(143, 163, 184, 0.1), transparent 60%);
}

/* Spotlight background - dramatic focus */
.bg-spotlight {
	background:
		radial-gradient(circle at center, rgba(230, 237, 245, 0.08) 0%, transparent 40%),
		radial-gradient(ellipse at 20% 80%, rgba(143, 163, 184, 0.06), transparent 50%),
		#000000;
}

/* Light mode versions */
[data-theme="light"] .bg-radial-mixed {
	background: radial-gradient(ellipse 150% 80% at 20% 50%, rgba(143, 163, 184, 0.06), transparent),
				radial-gradient(ellipse 150% 80% at 80% 50%, rgba(20, 184, 166, 0.05), transparent),
				radial-gradient(ellipse 120% 60% at 50% 30%, rgba(143, 163, 184, 0.04), transparent),
				linear-gradient(to bottom, #f0f9ff, #f7fafc);
}

[data-theme="light"] .bg-mesh {
	background:
		radial-gradient(at 40% 20%, rgba(143, 163, 184, 0.08) 0px, transparent 50%),
		radial-gradient(at 80% 0%, rgba(20, 184, 166, 0.06) 0px, transparent 50%),
		radial-gradient(at 0% 50%, rgba(143, 163, 184, 0.05) 0px, transparent 50%),
		radial-gradient(at 80% 100%, rgba(20, 184, 166, 0.05) 0px, transparent 50%),
		radial-gradient(at 0% 100%, rgba(143, 163, 184, 0.04) 0px, transparent 50%),
		linear-gradient(to bottom, #f0f9ff, #ffffff);
}

[data-theme="light"] .bg-aurora {
	background:
		linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%),
		radial-gradient(ellipse at top, rgba(143, 163, 184, 0.1), transparent 60%),
		radial-gradient(ellipse at bottom, rgba(20, 184, 166, 0.08), transparent 60%);
}

[data-theme="light"] .bg-spotlight {
	background:
		radial-gradient(circle at center, rgba(143, 163, 184, 0.06) 0%, transparent 40%),
		radial-gradient(ellipse at 20% 80%, rgba(20, 184, 166, 0.05), transparent 50%),
		linear-gradient(to bottom, #f0f9ff, #ffffff);
}

/* ==========================================================================
   21. Hover Distortion (Glassmorphism)
   ========================================================================== */

.glass:hover {
	backdrop-filter: blur(24px);
	-webkit-backdrop-filter: blur(24px);
	background: rgba(17, 17, 17, 0.6);
	border-color: rgba(230, 237, 245, 0.45);
	transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] .glass:hover {
	background: rgba(255, 255, 255, 0.75);
	border-color: rgba(0, 150, 200, 0.5);
}

/* ==========================================================================
   20. Terminal Cursor Blink Enhancement
   ========================================================================== */

.caret {
	animation: blink 1s step-end infinite, glow 2s ease-in-out infinite;
}

@keyframes glow {
	0%, 100% {
		box-shadow: 0 0 5px var(--color-accent-light);
	}
	50% {
		box-shadow: 0 0 20px var(--color-accent-light),
					0 0 40px var(--color-accent-light);
	}
}

/* Remove all animated backgrounds */
#hero-particles { display: none !important; }
.animated-bg    { display: none !important; }
