/* Additional animations and effects for the Royal Code website */

/* Particle Effects */
.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.6);
    pointer-events: none;
    z-index: 1;
}

/* Glowing Text Effect */
.glow-text {
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.7),
                 0 0 20px rgba(124, 58, 237, 0.5),
                 0 0 30px rgba(124, 58, 237, 0.3);
    animation: pulse-glow 3s infinite alternate;
}

@keyframes pulse-glow {
    0% {
        text-shadow: 0 0 10px rgba(124, 58, 237, 0.7),
                     0 0 20px rgba(124, 58, 237, 0.5),
                     0 0 30px rgba(124, 58, 237, 0.3);
    }
    100% {
        text-shadow: 0 0 15px rgba(124, 58, 237, 0.9),
                     0 0 25px rgba(124, 58, 237, 0.7),
                     0 0 35px rgba(124, 58, 237, 0.5);
    }
}

/* Neon Border Effect */
.neon-border {
    border: 2px solid transparent;
    border-image: linear-gradient(45deg, var(--primary), var(--primary-light), var(--primary), var(--primary-light));
    border-image-slice: 1;
    animation: border-rotate 6s linear infinite;
}

@keyframes border-rotate {
    0% {
        border-image: linear-gradient(0deg, var(--primary), var(--primary-light), var(--primary), var(--primary-light));
        border-image-slice: 1;
    }
    100% {
        border-image: linear-gradient(360deg, var(--primary), var(--primary-light), var(--primary), var(--primary-light));
        border-image-slice: 1;
    }
}

/* Hover Lift Effect with Shadow */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(124, 58, 237, 0.3);
}

/* Rotating Gear Animation */
.rotating-gear {
    animation: rotate-gear 10s linear infinite;
}

@keyframes rotate-gear {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Typing Text Animation */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary) }
}

/* Floating Elements with Parallax Effect */
.parallax-float {
    transform: translateZ(0);
    transition: transform 0.3s ease;
}

.parallax-float-1 {
    animation: float-parallax-1 6s infinite ease-in-out;
}

.parallax-float-2 {
    animation: float-parallax-2 8s infinite ease-in-out;
}

.parallax-float-3 {
    animation: float-parallax-3 10s infinite ease-in-out;
}

@keyframes float-parallax-1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10px, -15px); }
}

@keyframes float-parallax-2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-15px, -10px); }
}

@keyframes float-parallax-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(15px, 10px); }
}

/* Reveal Animation on Scroll */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Reveal for Multiple Elements */
.stagger-reveal > * {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-reveal.revealed > *:nth-child(1) {
    animation: stagger-fade-in 0.5s 0.1s forwards;
}

.stagger-reveal.revealed > *:nth-child(2) {
    animation: stagger-fade-in 0.5s 0.2s forwards;
}

.stagger-reveal.revealed > *:nth-child(3) {
    animation: stagger-fade-in 0.5s 0.3s forwards;
}

.stagger-reveal.revealed > *:nth-child(4) {
    animation: stagger-fade-in 0.5s 0.4s forwards;
}

.stagger-reveal.revealed > *:nth-child(5) {
    animation: stagger-fade-in 0.5s 0.5s forwards;
}

.stagger-reveal.revealed > *:nth-child(6) {
    animation: stagger-fade-in 0.5s 0.6s forwards;
}

@keyframes stagger-fade-in {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse Animation */
.pulse-animation {
    animation: pulse-effect 2s infinite;
}

@keyframes pulse-effect {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    }
}

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shimmer-effect 3s infinite;
}

@keyframes shimmer-effect {
    0% {
        transform: rotate(30deg) translateX(-100%);
    }
    100% {
        transform: rotate(30deg) translateX(100%);
    }
}

/* 3D Flip Card Effect */
.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 300px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
}

.flip-card-front {
    background: var(--background-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
}

.flip-card-back {
    background: var(--background-tertiary);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Gradient Text Animation */
.animated-gradient-text {
    background: linear-gradient(
        to right,
        var(--primary) 0%,
        var(--primary-light) 25%,
        var(--secondary) 50%,
        var(--primary-light) 75%,
        var(--primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-text-animation 4s linear infinite;
}

@keyframes gradient-text-animation {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Spotlight Hover Effect */
.spotlight-effect {
    position: relative;
    overflow: hidden;
}

.spotlight-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at var(--x, 50%) var(--y, 50%),
        rgba(124, 58, 237, 0.3) 0%,
        rgba(124, 58, 237, 0) 50%
    );
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
    pointer-events: none;
}

.spotlight-effect:hover::before {
    opacity: 1;
}

/* Magnetic Button Effect */
.magnetic-button {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

/* Glitch Effect */
.glitch-text {
    position: relative;
    animation: glitch-skew 1s infinite linear alternate-reverse;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 var(--primary);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-1 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 var(--secondary);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(0deg); }
    24% { transform: skew(-2deg); }
    28% { transform: skew(0deg); }
    70% { transform: skew(0deg); }
    74% { transform: skew(2deg); }
    78% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

@keyframes glitch-anim-1 {
    0% { clip: rect(30px, 9999px, 10px, 0); }
    10% { clip: rect(55px, 9999px, 70px, 0); }
    20% { clip: rect(18px, 9999px, 90px, 0); }
    30% { clip: rect(32px, 9999px, 23px, 0); }
    40% { clip: rect(92px, 9999px, 62px, 0); }
    50% { clip: rect(82px, 9999px, 33px, 0); }
    60% { clip: rect(63px, 9999px, 41px, 0); }
    70% { clip: rect(15px, 9999px, 28px, 0); }
    80% { clip: rect(33px, 9999px, 77px, 0); }
    90% { clip: rect(94px, 9999px, 19px, 0); }
    100% { clip: rect(67px, 9999px, 54px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(96px, 9999px, 78px, 0); }
    10% { clip: rect(23px, 9999px, 32px, 0); }
    20% { clip: rect(45px, 9999px, 12px, 0); }
    30% { clip: rect(67px, 9999px, 89px, 0); }
    40% { clip: rect(12px, 9999px, 34px, 0); }
    50% { clip: rect(78px, 9999px, 55px, 0); }
    60% { clip: rect(34px, 9999px, 12px, 0); }
    70% { clip: rect(23px, 9999px, 67px, 0); }
    80% { clip: rect(56px, 9999px, 78px, 0); }
    90% { clip: rect(12px, 9999px, 45px, 0); }
    100% { clip: rect(67px, 9999px, 90px, 0); }
}

/* Liquid Button Effect */
.liquid-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.liquid-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 40%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 1s ease-out;
    z-index: -1;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Cyberpunk Glowing Lines */
.cyberpunk-lines {
    position: relative;
    overflow: hidden;
}

.cyberpunk-lines::before,
.cyberpunk-lines::after {
    content: '';
    position: absolute;
    background: var(--primary);
}

.cyberpunk-lines::before {
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateX(-100%);
    animation: cyberpunk-line-x 3s infinite;
}

.cyberpunk-lines::after {
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    transform: translateY(-100%);
    animation: cyberpunk-line-y 3s 1.5s infinite;
}

@keyframes cyberpunk-line-x {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes cyberpunk-line-y {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Holographic Card Effect */
.holographic-card {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(124, 58, 237, 0.1) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 200%;
    animation: holographic-shift 5s ease infinite;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.holographic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 200%;
    animation: holographic-shine 5s ease infinite;
}

@keyframes holographic-shift {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

@keyframes holographic-shine {
    0% { background-position: 200% 0%; }
    100% { background-position: -200% 0%; }
}

/* Cosmic Background */
.cosmic-bg {
    position: relative;
    overflow: hidden;
}

.cosmic-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    z-index: -1;
    animation: cosmic-drift 60s linear infinite;
}

@keyframes cosmic-drift {
    0% { background-position: 0 0, 40px 60px, 130px 270px; }
    100% { background-position: 550px 550px, 390px 410px, 380px 520px; }
}

/* Digital Rain Effect (Matrix-like) */
.digital-rain {
    position: relative;
    overflow: hidden;
}

.digital-rain::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, 
        rgba(124, 58, 237, 0) 0%, 
        rgba(124, 58, 237, 0.2) 75%, 
        rgba(124, 58, 237, 0) 100%);
    animation: digital-rain-fall 2s linear infinite;
    z-index: -1;
}

@keyframes digital-rain-fall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Futuristic Scanner Effect */
.scanner-effect {
    position: relative;
    overflow: hidden;
}

.scanner-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, 
        transparent 0%, 
        var(--primary) 50%, 
        transparent 100%);
    box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    animation: scanner-move 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes scanner-move {
    0%, 100% { top: 0; }
    50% { top: 100%; }
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--background-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary), var(--primary-light));
    border-radius: 10px;
    border: 3px solid var(--background-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--primary-dark), var(--primary));
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .animated-gradient-text,
    .glitch-text,
    .cyberpunk-lines {
        animation: none;
    }
    
    .cosmic-bg::before,
    .digital-rain::before,
    .scanner-effect::before {
        display: none;
    }
}

/* Dark Mode Enhancements */
.dark-mode .glow-text {
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.7),
                 0 0 20px rgba(139, 92, 246, 0.5),
                 0 0 30px rgba(139, 92, 246, 0.3);
}

.dark-mode .neon-border {
    border-image: linear-gradient(45deg, var(--primary-dark), var(--primary), var(--primary-dark), var(--primary));
    border-image-slice: 1;
}

.dark-mode .holographic-card {
    background: linear-gradient(
        135deg,
        rgba(20, 20, 20, 0.2) 0%,
        rgba(139, 92, 246, 0.1) 50%,
        rgba(20, 20, 20, 0.2) 100%
    );
}

/* Print Mode Optimizations */
@media print {
    .glow-text,
    .neon-border,
    .shimmer,
    .animated-gradient-text,
    .glitch-text,
    .cyberpunk-lines,
    .holographic-card,
    .cosmic-bg::before,
    .digital-rain::before,
    .scanner-effect::before {
        animation: none !important;
        text-shadow: none !important;
        background: none !important;
        border: 1px solid #ccc !important;
    }
    
    .parallax-float,
    .parallax-float-1,
    .parallax-float-2,
    .parallax-float-3 {
        transform: none !important;
        animation: none !important;
    }
}
