/**
 * 彩途金属官网 - 主样式文件
 * Caitu Metal - Main Stylesheet
 */

/* ========================================
   1. CSS变量定义
   ======================================== */
:root {
    /* 品牌色彩 */
    --primary-color: #013D8D;
    --primary-dark: #02336B;
    --primary-light: #0250B8;
    --secondary-color: #FFB800;
    --accent-color: #E74C3C;
    
    /* 中性色 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    --border-color: #E5E5E5;
    
    /* 字体 */
    --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-heading: "思源黑体 CN", "Source Han Sans CN", var(--font-primary);
    
    /* 字体大小 */
    --font-size-base: 16px;
    --font-size-small: 14px;
    --font-size-large: 18px;
    --font-size-h1: 36px;
    --font-size-h2: 28px;
    --font-size-h3: 24px;
    --font-size-h4: 20px;
    
    /* 间距 */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --spacing-xxl: 64px;
    
    /* 布局 */
    --container-max-width: 1200px;
    --header-height: 80px;
    --header-height-mobile: 60px;
    
    /* 动画 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
}

/* ========================================
   2. 全局重置和基础样式
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 英文版字体调整 */
body:lang(en) {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   3. 排版
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   4. 布局组件
   ======================================== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.section {
    padding: var(--spacing-xxl) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-title h2 {
    position: relative;
    display: inline-block;
    padding-bottom: var(--spacing-sm);
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

/* ========================================
   5. 网格系统
   ======================================== */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   6. 头部导航
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: all var(--transition-normal);
}

.header.scrolled {
    height: 60px;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    height: 50px;
}

.logo img {
    height: 100%;
    width: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-link {
    font-weight: 500;
    color: var(--text-primary);
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* 语言切换器 */
.language-switcher {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.lang-btn {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-small);
}

.lang-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
}

/* 汉堡菜单 */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: all var(--transition-fast);
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translateY(8px);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translateY(-8px);
}

/* ========================================
   7. 主页Hero区域
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('/assets/images/applications/perforated-facade.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--bg-white);
    position: relative;
    overflow: hidden;
}

/* Hero overlay for better text readability */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 20, 50, 0.6) 100%);
    z-index: 1;
}

/* Animated metal shine effect */
.hero::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translateX(-100%);
    z-index: 1;
    animation: metalShine 8s infinite;
}

@keyframes metalShine {
    0% {
        transform: rotate(45deg) translateX(-100%);
    }
    100% {
        transform: rotate(45deg) translateX(100%);
    }
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: var(--spacing-md);
    color: var(--bg-white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: heroTextSlide 0.8s ease-out both;
}

.hero-subtitle {
    font-size: var(--font-size-large);
    margin-bottom: var(--spacing-lg);
    animation: heroSubtitleFade 0.8s ease-out 0.2s both;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
    animation: heroButtonsFade 0.8s ease-out 0.4s both;
}

/* Hero text animations */
@keyframes heroTextSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes heroSubtitleFade {
    to {
        opacity: 0.9;
    }
}

@keyframes heroButtonsFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   8. 按钮样式
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    border-color: var(--bg-white);
    color: var(--bg-white);
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-outline:hover {
    background-color: var(--bg-white);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* ========================================
   9. 卡片组件
   ======================================== */
.card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.card-title {
    font-size: var(--font-size-h4);
    margin-bottom: var(--spacing-sm);
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* ========================================
   10. 产品展示
   ======================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.product-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.product-info {
    padding: var(--spacing-md);
}

.product-category {
    font-size: var(--font-size-small);
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.product-name {
    font-size: var(--font-size-h4);
    margin-bottom: var(--spacing-sm);
}

.product-description {
    color: var(--text-secondary);
    font-size: var(--font-size-small);
}

/* ========================================
   11. 页脚
   ======================================== */
.footer {
    background-color: var(--text-primary);
    color: var(--bg-white);
    padding: var(--spacing-xl) 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h4 {
    color: var(--bg-white);
    margin-bottom: var(--spacing-md);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-xs);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-section a:hover {
    color: var(--bg-white);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: var(--font-size-small);
    color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   12. 响应式设计
   ======================================== */
@media (max-width: 768px) {
    :root {
        --header-height: var(--header-height-mobile);
    }
    
    .header {
        height: var(--header-height-mobile);
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--header-height-mobile);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height-mobile));
        background-color: var(--bg-white);
        flex-direction: column;
        justify-content: flex-start;
        padding: var(--spacing-lg);
        transition: left var(--transition-normal);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .language-switcher {
        margin-top: var(--spacing-lg);
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero {
        background-attachment: scroll; /* Disable fixed background on mobile for performance */
    }
    
    .hero::after {
        animation: none; /* Disable shine animation on mobile for performance */
    }
    
    .section {
        padding: var(--spacing-xl) 0;
    }
}

/* ========================================
   13. 工具类
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hidden { display: none; }
.visible { display: block; }

/* ========================================
   14. 动画
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* ========================================
   15. 图片懒加载状态
   ======================================== */
img[data-src] {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

img.lazy-loaded {
    opacity: 1;
}

img.lazy-loading {
    background-color: var(--bg-light);
}

img.lazy-error {
    opacity: 0.5;
}

/* ========================================
   16. 返回顶部按钮
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
}

/* ========================================
   17. 无障碍访问
   ======================================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--bg-white);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

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

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0033CC;
        --text-primary: #000000;
        --bg-light: #FFFFFF;
    }
}

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

/* ========================================
   18. 打印样式
   ======================================== */
@media print {
    .header,
    .footer,
    .back-to-top,
    .language-switcher {
        display: none;
    }
    
    body {
        font-size: 12pt;
    }
    
    a {
        text-decoration: underline;
    }
}