/* ===========================================
   Homepage Specific Styles
   Optimized for Performance & Mobile
============================================= */

/* Hero Section Optimizations */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.1)); /* Brighter overlay */
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Optimize video playback */
.hero-video.loaded {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.hero-video.buffering {
    opacity: 0.5;
    filter: blur(2px);
}

/* Mobile-specific video adjustments - Using same video for all devices */
@media (max-width: 768px) {
    .hero-video {
        object-position: center;
    }
     /* Ensure typing animation doesn't cause layout issues on mobile */
    .typing-text {
        animation: none !important;
        border-right: none !important;
        width: auto !important;
        display: block;
    }
}

/* Hero Content Animations */
.hero-content {
    opacity: 0;
    animation: heroFadeIn 1s ease 0.3s forwards;
}

@keyframes heroFadeIn {
    to {
        opacity: 1;
    }
}

.hero-title {
    animation: titleSlideUp 1s ease 0.5s both;
}

@keyframes titleSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    animation: subtitleSlideUp 1s ease 0.8s both;
}

@keyframes subtitleSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-buttons {
    animation: buttonsSlideUp 1s ease 1s both;
}

@keyframes buttonsSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Stats Animation */
.stat-number {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stat-number.counted {
    opacity: 1;
    transform: translateY(0);
}

/* Image Hover Effects */
.image-main,
.image-secondary,
.project-image {
    position: relative;
    overflow: hidden;
}

.image-main img,
.image-secondary img,
.project-image img {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.image-main:hover img,
.image-secondary:hover img,
.project-image:hover img {
    transform: scale(1.05);
}

/* Project Card Overlay Animation */
.project-overlay {
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.8) 0%, 
        rgba(0, 0, 0, 0.6) 50%, /* Brighter overlay */
        transparent 100%);
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease;
    opacity: 1;
}

.project-card:hover .project-overlay {
    transform: translateY(0);
}

/* Service Card Hover Effects */
.service-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        var(--primary-color) 0%, 
        transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.service-card:hover::before {
    opacity: 0.1;
}

.service-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* Process Step Hover Effects */
.process-step {
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.process-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.process-step:hover::before {
    opacity: 0.05;
}

/* Form Input Animations */
.form-group input,
.form-group select,
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.1);
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    to {
        left: 100%;
    }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-content {
        animation: none;
        opacity: 1;
    }
    
    .hero-video {
        animation: none;
    }
    
    .typing-text {
        animation: none !important;
        border-right: none !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .service-card:hover,
    .process-step:hover,
    .contact-card:hover {
        transform: none;
    }
    
    .project-overlay {
        opacity: 1;
        transform: translateY(0);
    }
    
    .image-overlay {
        opacity: 1;
        transform: translateY(0);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .hero-title .highlight {
        color: #ff0000;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
}

/* Reduced Data Mode */
@media (prefers-reduced-data: reduce) {
    .hero-video {
        display: none !important;
    }
    
    .video-container {
        background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    }
    
    .hero {
        background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .service-card,
    .process-step,
    .contact-card,
    .contact-form-container {
        background-color: #1a1a1a;
        color: #f0f0f0;
    }
    
    .service-card h3,
    .process-step h3,
    .contact-card h4 {
        color: #f0f0f0;
    }
    
    .service-card p,
    .process-step p,
    .contact-card p {
        color: #b0b0b0;
    }
}

/* Print Optimizations */
@media print {
    .hero {
        height: auto;
        min-height: auto;
        background: none !important;
        color: #000;
    }
    
    .video-container {
        display: none !important;
    }
    
    .hero-stats,
    .scroll-indicator {
        display: none !important;
    }
    
    .btn {
        display: none !important;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-transparency: reduce) {
    .header,
    .video-overlay {
        background: var(--white);
        backdrop-filter: none;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Selection Color */
::selection {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Focus Styles for Accessibility */
:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Image Loading States */
img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

/* Placeholder Loading */
.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loadingPlaceholder 1.5s infinite;
}

@keyframes loadingPlaceholder {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Smooth Image Reveal */
.reveal-image {
    clip-path: inset(0 100% 0 0);
    animation: revealImage 1.5s ease forwards;
}

@keyframes revealImage {
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* Mobile Touch Feedback */
@media (max-width: 768px) {
    .btn:active {
        transform: scale(0.98);
    }
    
    .nav-link:active {
        opacity: 0.7;
    }
}

/* Performance: Hardware Acceleration */
.hardware-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce layout shift */
.aspect-ratio-box {
    position: relative;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
}

.aspect-ratio-box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}