/* ============================================
   WERKZ DESQUARE - PREMIUM CUSTOM STYLES
   ============================================ */

/* CSS Custom Properties */
:root {
    --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 200ms;
    --transition-medium: 400ms;
    --transition-slow: 700ms;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4A9FD4, #2B6B9C);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6BB8E8, #4A9FD4);
}

/* Selection */
::selection {
    background: rgba(74, 159, 212, 0.3);
    color: #E8E9EB;
}

/* Focus styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #4A9FD4;
    outline-offset: 2px;
}

/* ============================================
   PRELOADER
   ============================================ */

#preloader.loaded {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   CURSOR (Desktop)
   ============================================ */

#cursor,
#cursor-trail {
    transition: transform 0.15s ease-out, opacity 0.3s ease;
}

#cursor.hover {
    transform: scale(2);
    background: rgba(74, 159, 212, 0.8);
}

#cursor-trail.hover {
    transform: scale(1.5);
    border-color: rgba(74, 159, 212, 0.6);
}

/* ============================================
   NAVIGATION
   ============================================ */

#navbar.scrolled {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

#navbar.scrolled::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(74, 159, 212, 0.2), transparent);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #4A9FD4;
    transition: width var(--transition-medium) var(--ease-premium);
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile menu */
#mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #0A0A0A;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow: hidden;
}

#mobile-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#mobile-menu .mobile-nav-link {
    opacity: 0;
    transform: translateY(20px);
    transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    display: block;
}

#mobile-menu.active .mobile-nav-link {
    opacity: 1;
    transform: translateY(0);
}

#mobile-menu.active .mobile-nav-link:nth-of-type(1) { transition-delay: 0.10s; }
#mobile-menu.active .mobile-nav-link:nth-of-type(2) { transition-delay: 0.15s; }
#mobile-menu.active .mobile-nav-link:nth-of-type(3) { transition-delay: 0.20s; }
#mobile-menu.active .mobile-nav-link:nth-of-type(4) { transition-delay: 0.25s; }
#mobile-menu.active .mobile-nav-link:nth-of-type(5) { transition-delay: 0.30s; }
#mobile-menu.active .mobile-nav-link:nth-of-type(6) { transition-delay: 0.35s; }

body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-animate {
    animation: fadeUp 0.8s var(--ease-premium) forwards;
}

/* Scroll indicator animation */
@keyframes slideDown {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateY(200%);
        opacity: 0;
    }
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-premium), transform 0.8s var(--ease-premium);
}

.scroll-animate.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */

.counter {
    display: inline-block;
}

/* ============================================
   SERVICE CARDS
   ============================================ */

.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 159, 212, 0.03) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-medium) ease;
}

.service-card:hover::before {
    opacity: 1;
}

/* ============================================
   PORTFOLIO
   ============================================ */

.portfolio-item {
    position: relative;
    overflow: hidden;
}

.portfolio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(74, 159, 212, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-medium) ease;
    z-index: 1;
}

.portfolio-item:hover::before {
    opacity: 1;
}

/* ============================================
   PROJECT MODAL
   ============================================ */

#project-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#project-modal #modal-content {
    opacity: 0;
    transform: translateY(30px);
    transition: all var(--transition-slow) var(--ease-premium);
    transition-delay: 0.2s;
}

#project-modal.active #modal-content {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   TESTIMONIALS SLIDER
   ============================================ */

.testimonials-slider {
    overflow: hidden;
}

.testimonial-slide {
    opacity: 0.3;
    transform: scale(0.95);
    transition: all var(--transition-slow) var(--ease-premium);
}

.testimonial-slide.active {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-group input,
.form-group select,
.form-group textarea {
    transition: border-color var(--transition-medium) ease, 
                box-shadow var(--transition-medium) ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: rgba(74, 159, 212, 0.5);
    box-shadow: 0 0 0 4px rgba(74, 159, 212, 0.1);
}

/* Select arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238A8F98'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-position: right 1.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

/* ============================================
   CTA BACKGROUND
   ============================================ */

.cta-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ============================================
   BACK TO TOP
   ============================================ */

#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   LOADING STATES
   ============================================ */

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .scroll-animate {
        transform: translateY(20px);
    }
    
    /* Disable cursor effects on mobile */
    #cursor,
    #cursor-trail {
        display: none !important;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    #preloader,
    #cursor,
    #cursor-trail,
    #back-to-top,
    #navbar {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ============================================
   TEXTURE OVERLAYS
   ============================================ */

/* Noise texture overlay */
.noise-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 9999;
}

/* ============================================
   IMAGE LOADING STATES
   ============================================ */

img {
    opacity: 1;
    transition: opacity var(--transition-medium) ease;
}

img[data-src] {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

/* ============================================
   GLITCH EFFECT (Optional - for creative sections)
   ============================================ */

.glitch {
    position: relative;
}

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

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #4A9FD4;
    animation: glitch-1 2s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    left: -2px;
    text-shadow: 1px 0 #4A9FD4;
    animation: glitch-2 3s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%, 100% { transform: none; opacity: 1; }
    10% { transform: skew(0.2deg); }
    20% { transform: none; }
    30% { transform: skew(-0.2deg); }
    40% { transform: none; }
    50% { transform: skew(0.2deg); }
    60% { transform: none; }
}

@keyframes glitch-2 {
    0%, 100% { transform: none; opacity: 1; }
    15% { transform: skew(-0.3deg); }
    30% { transform: none; }
    45% { transform: skew(0.3deg); }
    60% { transform: none; }
}

/* Nuclear blend - forces transparency */
/* Ultra clean blend */
#navbar a.group img,
footer a.group img {
    mix-blend-mode: lighten;
    filter: brightness(2) contrast(2) saturate(1.3);
    transition: all 0.3s ease;
}
/* Fullscreen Image Viewer */
.fullscreen-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.fullscreen-viewer.active {
    opacity: 1;
    pointer-events: auto;
}

.fullscreen-viewer img#fullscreen-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.fullscreen-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.8);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 101;
}

.fullscreen-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.8);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 101;
}

.fullscreen-prev {
    left: 20px;
}

.fullscreen-next {
    right: 20px;
}

.fullscreen-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    letter-spacing: 0.2em;
    background: rgba(0,0,0,0.8);
    padding: 10px 20px;
    z-index: 101;
}

/* Mobile fullscreen */
@media (max-width: 768px) {
    .fullscreen-viewer img#fullscreen-image {
        max-width: 95vw;
        max-height: 70vh;
    }
    
    .fullscreen-nav {
        width: 40px;
        height: 40px;
    }
    
    .fullscreen-prev {
        left: 10px;
    }
    
    .fullscreen-next {
        right: 10px;
    }
    
    .fullscreen-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .fullscreen-counter {
        bottom: 20px;
    }
}

/* Modal image fix */
#modal-main-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 16/10;
}

@media (max-width: 768px) {
    #modal-main-image {
        aspect-ratio: 4/3;
        object-fit: cover;
    }
}

/* Ongoing Projects Carousel 
@keyframes scrollLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.animate-scroll-left {
    animation: scrollLeft 30s linear infinite;
}

.animate-scroll-left.paused {
    animation-play-state: paused;
} */

@media (max-width: 768px) {
    .animate-scroll-left {
        animation-duration: 15s;
    }
}