/* Luban Engineering Ltd. - Beautiful Modern Styles - FIXED */

/* CSS Variables for consistent theming */
:root {
    --luban-blue: #0F4C75;
    --luban-navy: #003554;
    --luban-light: #F8FAFC;
    --luban-accent: #3B82F6;
    --luban-gold: #F59E0B;
    --luban-green: #10B981;
    --vh: 1vh;
}

/* Base styles and resets */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-display: swap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* Enhanced Typography */
.font-serif h1,
.font-serif h2,
.font-serif h3 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

/* Beautiful button animations */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: none; /* Removed white highlight */
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Custom card hover effects */
.service-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(229, 231, 235, 0.8);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--luban-blue), var(--luban-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-color: var(--luban-accent);
}

/* Team member card animations */
.team-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-card:hover {
    transform: translateY(-4px);
}

.team-card img {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(20%);
}

.team-card:hover img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* Enhanced FAQ styling - FIXED */
.faq-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.faq-item:hover {
    background: rgba(15, 76, 117, 0.02);
    border-color: rgba(15, 76, 117, 0.1);
}

.faq-content {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.faq-content.hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.faq-content:not(.hidden) {
    max-height: 300px;
    opacity: 1;
}

/* Floating animation for hero stats */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.floating-stat {
    animation: float 6s ease-in-out infinite;
}

.floating-stat:nth-child(2) {
    animation-delay: -2s;
}

.floating-stat:nth-child(3) {
    animation-delay: -4s;
}

/* Enhanced form styling */
.form-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    outline: none;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Loading states */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid transparent;
    border-top: 2px solid var(--luban-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* SAFE Scroll-triggered animations - FIXED TO PREVENT CONTENT DISAPPEARING */
.scroll-reveal {
    opacity: 1 !important; /* Ensure content is always visible */
    transform: translateY(0) !important; /* Ensure content is in position */
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Only apply reveal animation on large screens where it works properly */
@media (min-width: 1024px) {
    .scroll-reveal {
        opacity: 0;
        transform: translateY(30px);
    }
    
    .scroll-reveal.revealed {
        opacity: 1;
        transform: translateY(0);
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--luban-blue), var(--luban-accent));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--luban-navy);
}

/* Mobile-first responsive optimizations */
@media (max-width: 768px) {
    /* Improve touch targets */
    button, 
    .btn, 
    a[role="button"] {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 24px;
    }
    
    /* Optimize form fields for mobile */
    input, 
    select, 
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px;
    }
    
    /* Mobile hero adjustments */
    .hero-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
        line-height: 1.1;
    }
    
    /* Disable animations on mobile to prevent issues */
    .floating-stat {
        animation: none;
    }
    
    .service-card:hover {
        transform: none;
    }
}

@media (max-width: 640px) {
    /* Disable all transforms on very small screens */
    .scroll-reveal,
    .service-card,
    .team-card {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Focus indicators for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--luban-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-stat {
        animation: none;
    }
    
    /* Ensure content is always visible when animations are disabled */
    .scroll-reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary,
    .service-card {
        border: 2px solid currentColor !important;
    }
}

/* Enhanced error and success states */
.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    animation: shake 0.5s ease-in-out;
}

.success {
    border-color: var(--luban-green) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    animation: success-pulse 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Print styles */
@media print {
    .no-print,
    header,
    footer,
    .cta-section,
    button {
        display: none !important;
    }
    
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Ensure all content is visible by default */
section,
div,
main,
article {
    opacity: 1;
    transform: none;
    visibility: visible;
}

/* PREMIUM PROFESSIONAL ANIMATIONS */

/* Subtle entrance animations for sections */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    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);
    }
}

/* Staggered animation for service cards */
.service-card:nth-child(1) {
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.service-card:nth-child(2) {
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.service-card:nth-child(3) {
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

/* Team member staggered entrance */
.team-card:nth-child(1) {
    animation: fadeInLeft 0.8s ease-out 0.2s both;
}

.team-card:nth-child(2) {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.team-card:nth-child(3) {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.team-card:nth-child(4) {
    animation: fadeInRight 0.8s ease-out 0.8s both;
}

/* Enhanced logo and header animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    animation: slideInDown 0.6s ease-out;
}

/* Hero section elements animation */
@keyframes heroTitleReveal {
    from {
        opacity: 0;
        transform: translateY(50px);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes heroImageSlide {
    from {
        opacity: 0;
        transform: translateX(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Professional pulse for important elements */
@keyframes professionalPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(15, 76, 117, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(15, 76, 117, 0);
    }
}

/* Subtle background patterns animation */
@keyframes patternFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(1deg);
    }
    66% {
        transform: translateY(5px) rotate(-0.5deg);
    }
}

/* Enhanced CTA button animations */
.premium-cta {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: none; /* Removed white highlight */
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-cta:hover::before {
    left: 100%;
}

.premium-cta:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(15, 76, 117, 0.4);
}

/* Icon animations */
@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.icon-float {
    animation: iconFloat 3s ease-in-out infinite;
}

/* Sophisticated hover effects for project images */
.project-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 76, 117, 0.8), rgba(59, 130, 246, 0.6));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.project-image-container:hover::before {
    opacity: 1;
}

.project-image-container::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 24px;
    color: white;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 2;
}

.project-image-container:hover::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Smooth number counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number {
    animation: countUp 0.6s ease-out;
}

/* Professional loading animation for sections */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
    background-size: 600px;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Enhanced FAQ icon rotation */
.faq-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

/* Subtle border animations */
@keyframes borderGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(15, 76, 117, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(15, 76, 117, 0.2);
    }
}

.border-glow:hover {
    animation: borderGlow 2s ease-in-out infinite;
}

/* Smooth page transitions */
.page-transition {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Professional form field animations */
.form-field {
    position: relative;
}

.form-field input:focus + label,
.form-field input:not(:placeholder-shown) + label {
    transform: translateY(-25px) scale(0.85);
    color: var(--luban-blue);
}

.form-field label {
    position: absolute;
    top: 12px;
    left: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    color: #666;
}

/* Responsive animation controls */
@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .service-card:nth-child(1),
    .service-card:nth-child(2),
    .service-card:nth-child(3),
    .team-card:nth-child(1),
    .team-card:nth-child(2),
    .team-card:nth-child(3),
    .team-card:nth-child(4) {
        animation-duration: 0.4s;
        animation-delay: 0.1s;
    }
    
    .premium-cta:hover {
        transform: none;
    }
}

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

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