/* 图片优化和响应式处理 CSS */

/* 基础图片样式 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 懒加载图片样式 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy-image.loaded {
    opacity: 1;
}

/* 图片加载占位符 */
.image-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Logo 样式 */
.logo {
    width: auto;
    height: 40px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .logo {
        height: 32px;
    }
}

/* 英雄区域图片 */
.hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .hero-image {
        height: 250px;
    }
}

/* 产品展示图片 */
.product-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.product-image:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .product-image {
        height: 200px;
    }
}

/* 团队照片 */
.team-photo {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .team-photo {
        height: 180px;
    }
}

/* 案例展示图片 */
.case-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .case-image {
        height: 150px;
    }
}

/* 新闻缩略图 */
.news-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
}

.featured-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .news-thumbnail {
        height: 120px;
    }
    
    .featured-img {
        height: 200px;
    }
}

/* 图标样式 */
.icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.service-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 16px;
}

.culture-img,
.support-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .icon {
        width: 32px;
        height: 32px;
    }
    
    .service-icon {
        width: 48px;
        height: 48px;
    }
    
    .culture-img,
    .support-img {
        width: 60px;
        height: 60px;
    }
}

/* 背景图片 */
.bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* WebP 支持检测 */
.webp .hero-image {
    background-image: url('../assets/hero-image.webp');
}

.no-webp .hero-image {
    background-image: url('../assets/hero-image.jpg');
}

/* 图片容器 */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.image-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 宽高比 */
}

.image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片网格布局 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
}

/* 图片画廊 */
.gallery-image {
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 图片模态框 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* 图片加载错误处理 */
.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    color: #999;
    font-size: 14px;
    min-height: 200px;
    border-radius: 8px;
}

/* 打印样式 */
@media print {
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    .hero-image,
    .bg-image {
        display: none;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .lazy-image,
    .product-image,
    .gallery-image {
        transition: none;
    }
    
    .image-placeholder {
        animation: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .image-placeholder {
        background: #000;
    }
    
    .image-error {
        background-color: #fff;
        color: #000;
        border: 2px solid #000;
    }
}