/**
 * 浏览器兼容性修复文件
 * 解决各种浏览器兼容性问题
 * 包含IE、Edge、Safari、Chrome、Firefox等浏览器的兼容性处理
 */

/* ==========================================================================
   CSS变量兼容性处理
   ========================================================================== */

/* 为不支持CSS变量的浏览器提供回退值 */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* IE11兼容性处理 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE11特定样式 */
    .vlt-fullpage-slider {
        display: -ms-flexbox;
        -ms-flex-direction: column;
    }
    
    .vlt-section {
        display: -ms-flexbox;
        -ms-flex: 1 1 auto;
        -ms-flex-direction: column;
    }
    
    /* IE11不支持object-fit，使用背景图片替代 */
    .team-card-single .thumb img {
        display: none;
    }
    
    .team-card-single .thumb {
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    /* IE11的Grid布局回退 */
    .privilege-grid {
        display: -ms-flexbox;
        -ms-flex-wrap: wrap;
        -ms-flex-pack: justify;
    }
    
    .privilege-item {
        -ms-flex: 0 0 calc(25% - 20px);
        margin: 10px;
    }
}

/* ==========================================================================
   Flexbox兼容性处理
   ========================================================================== */

/* 确保所有flexbox属性都有完整的前缀 */
.vlt-fullpage-slider {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
}

.vlt-section {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* ==========================================================================
   Transform兼容性处理
   ========================================================================== */

/* 确保所有transform属性都有完整的前缀 */
.vlt-animated-block {
    -webkit-transform: translateY(6.25rem);
    -moz-transform: translateY(6.25rem);
    -ms-transform: translateY(6.25rem);
    -o-transform: translateY(6.25rem);
    transform: translateY(6.25rem);
}

.vlt-animated-block.animated {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
}

/* ==========================================================================
   Transition兼容性处理
   ========================================================================== */

/* 确保所有transition属性都有完整的前缀 */
.privilege-item {
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.modern-repo-card {
    -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease;
    -moz-transition: transform 0.3s ease, box-shadow 0.3s ease;
    -ms-transition: transform 0.3s ease, box-shadow 0.3s ease;
    -o-transition: transform 0.3s ease, box-shadow 0.3s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   Filter兼容性处理
   ========================================================================== */

/* 为不支持filter的浏览器提供回退 */
.blur-effect {
    -webkit-filter: blur(5px);
    -moz-filter: blur(5px);
    -ms-filter: blur(5px);
    -o-filter: blur(5px);
    filter: blur(5px);
    /* IE回退 */
    filter: progid:DXImageTransform.Microsoft.Blur(pixelradius=5);
}

/* ==========================================================================
   Grid布局兼容性处理
   ========================================================================== */

/* 为不支持Grid的浏览器提供Flexbox回退 */
.privilege-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

/* 支持Grid的浏览器使用Grid布局 */
@supports (display: grid) {
    .privilege-grid {
        display: grid;
        /* grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); */
        gap: 10px;
    }
}

/* ==========================================================================
   Backdrop-filter兼容性处理
   ========================================================================== */

/* 为不支持backdrop-filter的浏览器提供回退 */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* 不支持backdrop-filter的浏览器使用半透明背景 */
@supports not (backdrop-filter: blur(10px)) {
    .glass-effect {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* ==========================================================================
   Sticky定位兼容性处理
   ========================================================================== */

/* 为不支持sticky的浏览器提供回退 */
.sticky-element {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
}

/* 不支持sticky的浏览器使用fixed定位 */
@supports not (position: sticky) {
    .sticky-element {
        position: fixed;
        z-index: 1000;
    }
}

/* ==========================================================================
   Scroll-behavior兼容性处理
   ========================================================================== */

/* 平滑滚动兼容性 */
html {
    scroll-behavior: smooth;
}

/* 为不支持scroll-behavior的浏览器提供JavaScript回退 */
@supports not (scroll-behavior: smooth) {
    html {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   Object-fit兼容性处理
   ========================================================================== */

/* 为不支持object-fit的浏览器提供回退 */
.image-cover {
    object-fit: cover;
    object-position: center;
    font-family: 'object-fit: cover; object-position: center;';
}

/* ==========================================================================
   Appearance兼容性处理
   ========================================================================== */

/* 移除默认样式的兼容性处理 */
.custom-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    -ms-appearance: none;
    appearance: none;
}

.custom-button {
    -webkit-appearance: none;
    -moz-appearance: none;
    -ms-appearance: none;
    appearance: none;
}

/* ==========================================================================
   User-select兼容性处理
   ========================================================================== */

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ==========================================================================
   Box-sizing兼容性处理
   ========================================================================== */

/* 确保所有元素使用border-box */
*, *::before, *::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* ==========================================================================
   Calc()兼容性处理
   ========================================================================== */

/* 为不支持calc()的浏览器提供回退值 */
.responsive-width {
    width: 90%; /* 回退值 */
    width: -webkit-calc(100% - 40px);
    width: -moz-calc(100% - 40px);
    width: calc(100% - 40px);
}

/* ==========================================================================
   Viewport单位兼容性处理
   ========================================================================== */

/* 为不支持vh/vw的浏览器提供回退 */
.full-height {
    height: 100%; /* 回退值 */
    height: 100vh;
    /* iOS Safari修复 */
    height: -webkit-fill-available;
}

.full-width {
    width: 100%; /* 回退值 */
    width: 100vw;
}

/* ==========================================================================
   CSS自定义属性兼容性处理
   ========================================================================== */

/* 为不支持CSS变量的浏览器提供具体值 */
.primary-color {
    color: #007bff; /* 回退值 */
    color: var(--primary-color, #007bff);
}

.secondary-color {
    color: #6c757d; /* 回退值 */
    color: var(--secondary-color, #6c757d);
}

/* ==========================================================================
   Flexbox Gap兼容性处理
   ========================================================================== */

/* 为不支持gap的浏览器提供margin回退 */
.flex-gap {
    gap: 20px;
}

/* 不支持gap的浏览器使用margin */
@supports not (gap: 20px) {
    .flex-gap > * {
        margin: 10px;
    }
    
    .flex-gap {
        margin: -10px;
    }
}

/* ==========================================================================
   Aspect-ratio兼容性处理
   ========================================================================== */

/* 为不支持aspect-ratio的浏览器提供padding-top回退 */
.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
    .aspect-ratio-16-9 {
        position: relative;
        height: 0;
        padding-top: 56.25%; /* 16:9 = 56.25% */
    }
    
    .aspect-ratio-16-9 > * {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ==========================================================================
   Clamp()兼容性处理
   ========================================================================== */

/* 为不支持clamp()的浏览器提供回退 */
.responsive-font {
    font-size: 16px; /* 最小值回退 */
    font-size: clamp(16px, 4vw, 24px);
}

@supports not (font-size: clamp(16px, 4vw, 24px)) {
    .responsive-font {
        font-size: 4vw;
        min-font-size: 16px;
        max-font-size: 24px;
    }
}

/* ==========================================================================
   浏览器特定修复
   ========================================================================== */

/* Safari特定修复 */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        .safari-fix {
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }
    }
}

/* Firefox特定修复 */
@-moz-document url-prefix() {
    .firefox-fix {
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Edge特定修复 */
@supports (-ms-ime-align:auto) {
    .edge-fix {
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }
}