/*!
 * TYPNI Niaje Preloader System
 * "Niaje Niaje!" -> Logo Preloader -> Website
 * Version: 1.0
 */

/* Hide everything during NIaje display except NIaje and confetti */
body.niaje-active {
    overflow: hidden !important;
}

body.niaje-active > *:not(.niaje-container):not(.confetti-container):not(script) {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* NIaje Niaje Animation Container */
.niaje-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff;
    z-index: 9999998;
    display: none;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.niaje-container.show {
    display: flex !important;
    animation: niajeShow 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes niajeShow {
    0% { 
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(5deg);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.niaje-container.hide {
    animation: niajeHide 0.6s ease-in forwards;
}

@keyframes niajeHide {
    0% { 
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% { 
        opacity: 0;
        transform: scale(1.3) rotate(10deg);
    }
}

/* NIaje Text Styling */
.niaje-text {
    font-size: clamp(40px, 12vw, 150px);
    font-weight: 900;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(45deg, #390099, #4D1AA3, #FF0054, #390099);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: niajeGradient 1.5s ease-in-out infinite, niajeFloat 2s ease-in-out infinite;
    text-align: center;
    position: relative;
    padding: 0 20px;
    word-break: keep-all;
}

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

@keyframes niajeFloat {
    0%, 100% { 
        transform: translateY(0px) rotateZ(0deg);
    }
    25% { 
        transform: translateY(-10px) rotateZ(1deg);
    }
    75% { 
        transform: translateY(5px) rotateZ(-1deg);
    }
}

/* Sparkle effects for NIaje */
.niaje-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FF0054;
    border-radius: 50%;
    opacity: 0;
    animation: sparkleAnimation 2s ease-in-out infinite;
}

.sparkle:nth-child(odd) {
    background: #390099;
}

.sparkle:nth-child(3n) {
    background: #4D1AA3;
}

@keyframes sparkleAnimation {
    0% { 
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% { 
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
    100% { 
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}

/* Confetti Animation Styles */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    animation: confettiFall 4s linear;
}

.confetti-piece.square {
    width: 10px;
    height: 10px;
}

.confetti-piece.circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.confetti-piece.rectangle {
    width: 12px;
    height: 6px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100px) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotateZ(360deg);
        opacity: 0;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .niaje-text {
        font-size: clamp(32px, 10vw, 100px);
        padding: 0 15px;
        line-height: 1.1;
    }
    
    .confetti-piece {
        width: 8px;
        height: 8px;
    }
    
    .confetti-piece.rectangle {
        width: 6px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .niaje-text {
        font-size: clamp(28px, 9vw, 80px);
        padding: 0 10px;
    }
    
    .confetti-piece {
        width: 6px;
        height: 6px;
    }
    
    .confetti-piece.rectangle {
        width: 4px;
        height: 8px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .niaje-text {
        animation: none !important;
    }
    
    .niaje-container.show {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .confetti-piece {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .niaje-container {
        background: #fff;
        border: 2px solid #000;
    }
    
    .niaje-text {
        background: #000 !important;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
}