/**
 * 立臻科技网站优化 - 样式文件
 */

/* ========================================
   基础优化
======================================== */

/* 键盘导航焦点样式 */
.keyboard-nav *:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* 图片加载占位 */
img {
    background: #f5f5f5;
}

img[loading="lazy"] {
    min-height: 100px;
}

/* ========================================
   跳转链接
======================================== */

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #0073aa;
    color: #fff;
    padding: 10px 20px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* ========================================
   回到顶部按钮
======================================== */

.lizkj-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa, #005177);
    color: #fff;
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.4);
}

.lizkj-back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.5);
}

.lizkj-back-to-top:active {
    transform: translateY(-1px);
}

.lizkj-back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   图片优化
======================================== */

/* 图片响应式 */
img {
    max-width: 100%;
    height: auto;
}

/* 图片加载错误样式 */
img.lizkj-image-error {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

/* ========================================
   性能优化
======================================== */

/* 动画性能优化 */
.animated,
.wow {
    will-change: transform, opacity;
    animation-duration: 0.6s !important;
}

/* 减少 GPU 占用 */
.animated.infinite {
    animation-iteration-count: 3;
}

/* ========================================
   移动端优化
======================================== */

@media (max-width: 767px) {
    /* 移动端回到顶部按钮位置调整 */
    .lizkj-back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    .lizkj-back-to-top svg {
        width: 20px;
        height: 20px;
    }

    /* 移动端菜单优化 */
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(10px);
    }

    /* 移动端图片优化 */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========================================
   无障碍优化
======================================== */

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .lizkj-back-to-top {
        background: #000;
        border: 2px solid #fff;
    }

    .skip-link {
        background: #000;
        border: 2px solid #fff;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .lizkj-back-to-top {
        transition: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    img {
        background: #1a1a1a;
    }

    img.lizkj-image-error {
        background: #2a2a2a;
        color: #666;
    }
}

/* ========================================
   打印优化
======================================== */

@media print {
    .lizkj-back-to-top,
    .skip-link {
        display: none !important;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ========================================
   页面加载优化
======================================== */

/* 页面加载动画 */
body.lizkj-loading {
    overflow: hidden;
}

.lizkj-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.3s ease;
}

.lizkj-page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ========================================
   CLS 优化 - 为常见元素预留空间
======================================== */

/* Hero 区域 */
.hero-section,
.banner-section,
[class*="hero"],
[class*="banner"] {
    min-height: 300px;
}

/* 产品卡片 */
.product-card,
[class*="product-item"],
[class*="post-item"] {
    min-height: 300px;
}

/* 图片容器 */
.thumbnail,
[class*="thumbnail"],
[class*="image-wrapper"] {
    aspect-ratio: 16/9;
    background: #f5f5f5;
}

/* ========================================
   字体优化
======================================== */

/* 避免字体闪烁 */
body {
    font-display: swap;
}

/* 系统字体优先 */
.font-primary,
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}
