/* Performance optimization styles for mobile and LINE */

/* Image loading optimization */
img {
    max-width: 100%;
    height: auto;
}

/* Lazy loading placeholder */
img[loading="lazy"],
img.lazy-loading {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

img[loading="lazy"].loaded,
img.lazy-loaded {
    opacity: 1;
    background: none;
    animation: none;
}

/* Critical images should load immediately */
img[loading="eager"] {
    opacity: 1;
}

/* Error state */
img.lazy-error {
    opacity: 0.5;
    background-color: #ffebee;
    border: 1px dashed #f44336;
}

/* Shimmer animation for loading state */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Company History Timeline Styles */
.methodology-timeline {
    position: relative;
    padding: 2rem 0;
}

.methodology-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-color), var(--heading-color));
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-marker {
    position: relative;
    z-index: 2;
    width: 80px;
    height: 80px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 2rem;
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.3);
}

.timeline-marker .phase-number {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}

.timeline-content {
    flex: 1;
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--accent-color);
}

.timeline-item:nth-child(even) .timeline-content {
    border-left: none;
    border-right: 4px solid var(--accent-color);
}

.timeline-content h4 {
    color: var(--heading-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.timeline-content p {
    color: var(--default-color);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.phase-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.phase-features li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--default-color);
}

.phase-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .methodology-timeline::before {
        left: 30px;
    }
    
    .timeline-item {
        flex-direction: column !important;
        align-items: flex-start;
        padding-left: 60px;
    }
    
    .timeline-marker {
        position: absolute;
        left: -40px;
        width: 60px;
        height: 60px;
        margin: 0;
    }
    
    .timeline-marker .phase-number {
        font-size: 0.8rem;
    }
    
    .timeline-content {
        width: 100%;
        margin-top: 1rem;
        border-left: 4px solid var(--accent-color) !important;
        border-right: none !important;
    }
}

/* Preload critical resources */
.preload-critical {
    font-display: swap;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* LINE WebView specific optimizations */
@media (max-width: 480px) {
    /* Further reduce animations for LINE */
    [data-aos] {
        animation-duration: 0.2s !important;
    }
    
    /* Optimize font loading */
    body {
        font-display: swap;
    }
}

/* Preloader optimization */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s, visibility 0.5s;
}
