/* =====================
   PERFORMANCE OPTIMIZED STYLES
   ===================== */

/* Critical CSS - Load First */
:root {
    --color-primary: #ff3a3a;
    --color-corporate: #3a86ff;
    --color-dark-bg: #0a0a0a;
    --color-light-bg: #ffffff;
    --color-dark-text: #ffffff;
    --color-light-text: #0a0a0a;
    --hover-easing: cubic-bezier(0.23, 1, 0.32, 1);
    --return-easing: cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

/* Base Styles */
html, body {
    height: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Raleway", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-light-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Loading Screen - Optimized */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    color: white;
    font-size: 18px;
    margin-top: 20px;
    font-family: 'Raleway', sans-serif;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.welcome-message {
    color: #fff;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 18px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.18);
    letter-spacing: 0.03em;
}

.welcome-desc {
    color: #f3f3f3;
    font-family: 'Raleway', sans-serif;
    font-size: 1.02rem;
    font-weight: 400;
    margin-bottom: 18px;
    text-align: center;
    text-shadow: 0 1px 6px rgba(0,0,0,0.13);
    letter-spacing: 0.01em;
}

/* Logo Styles */
.logo-wrapper-right {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.logo-wrapper-right:hover {
    transform: scale(1.05);
}

.logo-link-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    position: relative;
}

#logo-3d-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    object-fit: cover;
}

.logo-home-text {
    font-size: 0.8rem;
    margin-top: 5px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.logo-link-overlay:hover #logo-3d-photo {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.logo-link-overlay:hover .logo-home-text {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.services-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.services-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.services-subtitle {
    font-family: 'Raleway', sans-serif;
    font-size: 1.2rem;
    color: #bfc9e0;
    margin-bottom: 0;
    text-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

/* Services Grid - Optimized */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Card Styles - Optimized */
.card-wrap {
    margin: 0;
    transform: perspective(800px);
    transform-style: preserve-3d;
    cursor: pointer;
    transition: transform 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    opacity: 1;
    animation: fadeInUp 0.6s ease forwards;
}

.card-wrap:nth-child(1) { animation-delay: 0.1s; }
.card-wrap:nth-child(2) { animation-delay: 0.2s; }
.card-wrap:nth-child(3) { animation-delay: 0.3s; }
.card-wrap:nth-child(4) { animation-delay: 0.4s; }

.card {
    position: relative;
    width: 100%;
    height: 480px;
    background-color: #333;
    overflow: hidden;
    border-radius: 15px;
    box-shadow:
        rgba(0, 0, 0, 0.66) 0 30px 60px 0,
        inset #333 0 0 0 5px,
        inset rgba(255, 255, 255, 0.5) 0 0 0 6px;
    transition: 1s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    border: 2px solid #fff;
}

.card-bg {
    opacity: 0.5;
    position: absolute;
    top: -20px;
    left: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    transition:
        1s cubic-bezier(0.445, 0.05, 0.55, 0.95),
        opacity 5s 1s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    pointer-events: none;
}

.card-info {
    padding: 20px;
    position: absolute;
    bottom: 0;
    color: #fff;
    transform: translateY(40%);
    transition: 0.6s 1.6s cubic-bezier(0.215, 0.61, 0.355, 1);
    width: 100%;
    box-sizing: border-box;
}

.card-info h1 {
    font-family: "Playfair Display", serif;
    font-size: 1.45rem;
    font-weight: 700;
    text-shadow: rgba(0, 0, 0, 0.5) 0 10px 10px;
    margin-bottom: 0.3em;
}

.card-info p {
    font-size: 1.02rem;
    margin-bottom: 0;
    opacity: 0;
    text-shadow: rgba(0, 0, 0, 1) 0 2px 3px;
    transition: 0.6s 1.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Hover Effects - Optimized */
.card-wrap:hover {
    transform: translateY(-10px);
}

.card-wrap:hover .card-info {
    transform: translateY(0);
}

.card-wrap:hover .card-info p {
    opacity: 1;
}

.card-wrap:hover .card-bg {
    opacity: 0.8;
}

.card-wrap:hover .card {
    box-shadow:
        rgba(255, 255, 255, 0.2) 0 0 40px 5px,
        rgba(255, 255, 255, 1) 0 0 0 1px,
        rgba(0, 0, 0, 0.66) 0 30px 60px 0,
        inset #333 0 0 0 5px,
        inset rgba(255, 255, 255, 0.5) 0 0 0 6px;
}

/* Animations - Optimized */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: perspective(800px) translateY(30px) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: perspective(800px) translateY(0) rotateX(0deg);
    }
}

/* Footer - Optimized */
.site-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    text-align: center;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.site-footer a {
    color: #bfc9e0;
    margin: 0 15px;
    font-size: 1.2rem;
    transition: color 0.3s ease;
    text-decoration: none;
}

.site-footer a:hover {
    color: #fff;
}

.site-footer span {
    color: #bfc9e0;
    font-size: 0.9rem;
    margin-left: 20px;
}

/* Responsive Design - Optimized */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        gap: 1.5rem;
    }
    
    .services-title {
        font-size: 2rem;
    }
    
    .card {
        height: 400px;
    }
    
    .card-info h1 {
        font-size: 1.3rem;
    }
    
    .card-info p {
        font-size: 0.95rem;
    }
    
    .logo-wrapper-right {
        top: 15px;
        right: 15px;
    }
    
    #logo-3d-photo {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .services-grid {
        padding: 0 0.5rem;
        gap: 1rem;
    }
    
    .card {
        height: 350px;
    }
    
    .card-info {
        padding: 15px;
    }
    
    .card-info h1 {
        font-size: 1.2rem;
    }
    
    .card-info p {
        font-size: 0.9rem;
    }
    
    .services-title {
        font-size: 1.8rem;
    }
    
    .services-subtitle {
        font-size: 1rem;
    }
}

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

/* Reduce repaints */
.card-wrap {
    will-change: transform;
}

.card-bg {
    will-change: transform, opacity;
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
