/* Custom CSS for Ziyani Mouad Portfolio - Optimized Lightweight Design */

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0B0F19;
    color: #FFFFFF;
    overflow-x: hidden;
    line-height: 1.6;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #991b1b, #dc2626);
}

/* Navigation */
#navbar {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

#navbar.scrolled {
    background: rgba(17, 24, 39, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #7f1d1d, #b91c1c);
    transition: width 0.3s ease;
}

.nav-link:hover::before,
.nav-link.text-red-500::before {
    width: 100%;
}

/* Mobile Menu */
#mobile-menu {
    transition: all 0.3s ease;
}

/* Hero Section */
.hero-title {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(185, 28, 28, 0.3);
}

.btn-secondary {
    border: 2px solid #b91c1c;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #b91c1c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(185, 28, 28, 0.3);
}

/* Cards */
.card {
    background: #1F2937;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Project Cards */
.project-card {
    background: #111827;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.project-card img {
    transition: transform 0.3s ease;
}

.project-card:hover img {
    transform: scale(1.05);
}

/* Timeline */
.timeline-line {
    background: linear-gradient(180deg, #7f1d1d, #b91c1c);
}

.timeline-dot {
    background: #b91c1c;
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.5);
}

/* Contact Form */
.form-input {
    background: #1F2937;
    border: 1px solid #374151;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

/* Notification System */
.notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Fade In Animation */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* Fix mobile scroll issues */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        overflow-x: hidden;
        position: relative;
    }
    
    /* Prevent horizontal scroll on mobile */
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Fix mobile menu scroll */
    #mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(17, 24, 39, 0.98);
        z-index: 50;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #mobile-menu.hidden {
        display: none;
    }
}

@media (max-width: 768px) {
    .timeline-line {
        left: 20px;
    }
    
    .timeline-dot {
        left: 16px;
    }
    
    /* Optimize animations for mobile */
    .card {
        transition: all 0.2s ease;
    }
    
    .project-card {
        transition: all 0.2s ease;
    }
}

/* Accessibility */
*:focus {
    outline: 2px solid #b91c1c;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    nav,
    #mobile-menu,
    footer {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Fix scroll performance */
body {
    overflow-x: hidden;
    position: relative;
}

/* Ensure smooth scrolling works properly */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Fix for scroll snap issues */
section {
    scroll-snap-align: start;
}

/* Optimize scroll animations */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Selection color */
::selection {
    background: rgba(185, 28, 28, 0.3);
    color: white;
}

/* Focus styles for better accessibility */
button:focus,
a:focus,
input:focus,
textarea:focus {
    outline: 2px solid #b91c1c;
    outline-offset: 2px;
}
