/*
Theme Name: Cougang Power Theme
Theme URI: https://www.cougang.com/
Author: Tuoyang Dev
Description: 专为拓阳电力定制的B2B企业响应式主题。
Version: 1.6.0
*/

:root {
    --primary-color: #00529B;
    --accent-color: #F39C12;
    --text-color: #333333;
    --text-light: #666666;
    --bg-light: #F8F9FA;
    --border-color: #EAEAEA;
    --container-width: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text-color); line-height: 1.6; background: #fff; }
a { text-decoration: none; color: inherit; transition: color 0.3s; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

.container { max-width: var(--container-width); margin: 0 auto; padding: 0 15px; }
.section { padding: 60px 0; }
.bg-light { background-color: var(--bg-light); }

.btn { display: inline-block; padding: 12px 28px; border-radius: 4px; font-weight: bold; font-size: 15px; transition: all 0.3s; cursor: pointer; border: none; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: #003d75; color: #fff; }
.btn-accent { background: var(--accent-color); color: #fff; }
.btn-accent:hover { background: #d68910; color: #fff; }
.btn-outline { border: 2px solid #fff; color: #fff; background: transparent; }
.btn-outline:hover { background: #fff; color: var(--primary-color); }

/* === 头部与导航 === */
.site-header { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; }
.site-logo img { max-height: 50px; }
.main-nav ul { display: flex; gap: 30px; }
.main-nav a { font-size: 16px; font-weight: 500; padding: 10px 0; position: relative; }
.main-nav a:hover, .main-nav .current-menu-item a { color: var(--primary-color); }
.main-nav .current-menu-item a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--primary-color); }

/* === 首页 Hero === */
.hero-section { height: 500px; background-size: cover; background-position: center; display: flex; align-items: center; color: #fff; position: relative; }
.hero-section::before { content: ''; position: absolute; inset: 0; background: rgba(0, 40, 80, 0.6); }
.hero-content { position: relative; z-index: 1; }
.hero-title { font-size: 42px; margin-bottom: 15px; font-weight: 800; }
.hero-subtitle { font-size: 18px; margin-bottom: 30px; opacity: 0.9; }
.hero-content .btn { margin-right: 15px; }

/* === 标题与网格 === */
.section-title { text-align: center; font-size: 28px; margin-bottom: 40px; position: relative; padding-bottom: 15px; }
.section-title::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 60px; height: 3px; background: var(--accent-color); }

.product-grid, .cases-grid, .advantage-grid { display: grid; gap: 25px; }
.product-grid { grid-template-columns: repeat(4, 1fr); }
.cases-grid { grid-template-columns: repeat(4, 1fr); }
.advantage-grid { grid-template-columns: repeat(4, 1fr); }

/* === 全站卡片图片统一为 1:1 正方形 === */
.category-card { 
    background: #fff; border-radius: 8px; overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    transition: transform 0.3s, box-shadow 0.3s; 
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
}
.category-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.card-img-wrap { 
    width: 100%; aspect-ratio: 1 / 1; overflow: hidden; 
    background: #f4f7f6; display: flex; align-items: center; justify-content: center; 
}
.card-img-wrap img { 
    width: 100%; height: 100%; object-fit: contain; 
    padding: 10px; box-sizing: border-box; transition: transform 0.5s ease; 
}
.category-card:hover .card-img-wrap img { transform: scale(1.05); } 
.card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.category-card h3 { 
    font-size: 16px; margin-bottom: 10px; color: #333; line-height: 1.4; 
    height: 44px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
}
.card-desc { 
    font-size: 13px; color: #666; line-height: 1.6; flex: 1; margin: 0; 
    height: 42px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
}

.case-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.3s, box-shadow 0.3s; }
.case-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.case-card img { 
    width: 100%; aspect-ratio: 1 / 1; object-fit: contain; 
    background: #f4f7f6; padding: 10px; box-sizing: border-box; 
}
.case-card h3 { padding: 15px; font-size: 16px; text-align: center; }

.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.news-card { 
    background: #fff; border-radius: 8px; overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    transition: transform 0.3s, box-shadow 0.3s; 
    display: flex; flex-direction: column; 
}
.news-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.news-img { 
    display: block; width: 100%; aspect-ratio: 1 / 1; 
    background: #f4f7f6; overflow: hidden; 
}
.news-img img { 
    width: 100%; height: 100%; object-fit: contain; 
    padding: 10px; box-sizing: border-box; 
}
.news-content { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.news-date { font-size: 13px; color: #999; margin-bottom: 10px; }
.news-date i { margin-right: 5px; color: var(--primary-color); }
.news-content h3 { 
    font-size: 16px; line-height: 1.5; margin-bottom: 12px; 
    height: 48px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
}
.news-content h3 a { color: #333; transition: color 0.2s; }
.news-content h3 a:hover { color: var(--primary-color); }
.news-content p { font-size: 14px; color: #666; line-height: 1.7; flex: 1; margin-bottom: 15px; }
.news-more { font-size: 14px; color: var(--primary-color); font-weight: bold; }
.news-more:hover { color: var(--accent-color); }

.adv-item { text-align: center; padding: 30px 20px; background: #fff; border-radius: 8px; }
.adv-item i { font-size: 40px; color: var(--primary-color); margin-bottom: 15px; display: block; }
.adv-item h3 { font-size: 18px; margin-bottom: 10px; }
.adv-item p { color: var(--text-light); font-size: 14px; }

/* === 列表与详情页 === */
.breadcrumbs { padding: 15px 0; font-size: 14px; color: var(--text-light); border-bottom: 1px solid var(--border-color); margin-bottom: 30px; }
.breadcrumbs a { color: var(--primary-color); }
.page-content, .post-content { line-height: 1.8; font-size: 16px; }

/* ========================================== */
/* === 详情页图片防放大、防失真终极修复 === */
/* ========================================== */

/* 1. 顶部特色大图：保持原图大小，不强制拉伸 */
.single-featured-img {
    width: auto !important;      /* 核心：宽度自适应原图，绝不强行拉宽 */
    max-width: 100% !important;  /* 最大不超过屏幕/容器宽度 */
    max-height: 500px !important;/* 限制最大高度，防止超长图撑爆屏幕 */
    height: auto !important;     /* 高度自适应，绝对不变形 */
    margin: 0 auto 30px;
    border-radius: 8px;
    display: block;
    object-fit: contain; 
}

/* 2. 正文内的插图：覆盖编辑器自动生成的固定宽高属性 */
.page-content img, .post-content img, .entry-content img { 
    width: auto !important;      /* 覆盖编辑器自带的 width="xxx" */
    max-width: 100% !important;  /* 确保不超出屏幕 */
    height: auto !important;     /* 覆盖编辑器自带的 height="xxx" */
    margin: 20px auto; 
    border-radius: 8px; 
    display: block;
}

.page-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.page-content th, .page-content td { border: 1px solid var(--border-color); padding: 10px; text-align: left; }

.pagination { margin-top: 40px; text-align: center; }
.pagination .page-numbers { display: inline-block; padding: 8px 15px; margin: 0 5px; border: 1px solid var(--border-color); border-radius: 4px; }
.pagination .current { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* === 底部 === */
.site-footer { background: #2C3E50; color: #ECF0F1; padding: 40px 0 0; margin-top: 60px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; font-size: 13px; color: #BDC3C7; margin-top: 30px; }
.footer-bottom a { color: #BDC3C7; }
.footer-bottom a:hover { color: #fff; }
.gongan-icon { display: inline-block; width: 16px; height: 16px; vertical-align: middle; margin-right: 5px; }

/* === 悬浮按钮与移动端底栏 === */
.floating-sidebar { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.float-btn { width: 50px; height: 50px; background: var(--primary-color); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); cursor: pointer; border: none; position: relative; }
.float-btn:hover { background: var(--accent-color); }
.wechat-qrcode { display: none; position: absolute; right: 60px; top: 0; background: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); }
.wechat-qrcode img { width: 120px; height: 120px; }
.wechat-btn:hover .wechat-qrcode { display: block; }

.mobile-bottom-bar { display: none; position: fixed; bottom: 0; left: 0; width: 100%; background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 1000; padding: 10px 0; }
.mobile-bottom-bar .container { display: flex; gap: 15px; }
.mobile-bottom-bar a { flex: 1; text-align: center; padding: 10px; border-radius: 4px; font-weight: bold; color: #fff; }
.bar-phone { background: var(--primary-color); }
.bar-wechat { background: #07C160; }

/* === 纯 CSS 汉堡菜单图标 === */
.mobile-toggle { display: none; background: transparent; border: none; cursor: pointer; padding: 10px; z-index: 1001; position: relative; }
.hamburger, .hamburger::before, .hamburger::after {
    content: ''; display: block; width: 24px; height: 3px; background-color: #00529B; border-radius: 2px; transition: all 0.3s; position: relative;
}
.hamburger::before { position: absolute; top: -8px; left: 0; width: 24px; height: 3px; }
.hamburger::after { position: absolute; bottom: -8px; left: 0; width: 24px; height: 3px; }

/* === 响应式 (手机端) === */
@media (max-width: 992px) {
    .product-grid, .cases-grid, .advantage-grid { grid-template-columns: repeat(2, 1fr); }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 28px; }
    .hero-section { height: 350px; }
}

@media (max-width: 768px) {
    .mobile-toggle { 
        display: flex !important; 
        align-items: center; 
        justify-content: center;
        width: 44px; height: 44px;
    }

    .main-nav { 
        display: none !important; 
        position: absolute !important; 
        top: 100% !important; 
        left: 0 !important; 
        width: 100% !important; 
        background: #fff !important; 
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important; 
        z-index: 99998 !important; 
        max-height: 80vh !important; 
        overflow-y: auto !important; 
    }
    
    .main-nav.active { display: block !important; }
    
    .main-nav ul { 
        display: flex !important; 
        flex-direction: column !important; 
        gap: 0 !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        width: 100% !important;
    }
    .main-nav li { 
        border-bottom: 1px solid #f0f2f5 !important; 
        width: 100% !important;
        list-style: none !important;
    }
    .main-nav a { 
        display: block !important; 
        padding: 16px 20px !important; 
        font-size: 15px !important; 
        color: #333 !important;
    }
    .main-nav a:hover, .main-nav .current-menu-item a { 
        background: #f8f9fa !important; 
        color: #00529B !important; 
    }
    .main-nav .current-menu-item a::after { display: none !important; } 
    
    .floating-sidebar { display: none; } 
    .mobile-bottom-bar { display: block; } 
    body { padding-bottom: 70px; } 
    
    .section { padding: 40px 0; }
    .section-title { font-size: 22px; }
}

@media (max-width: 576px) {
    .news-grid { grid-template-columns: 1fr; }
}
