/*
Theme Name: My Theme
Theme URI: https://example.com
Author: Your Name
Author URI: https://example.com
Description: B2B product showcase WordPress theme (XIGIFT style), built-in product system (no WooCommerce).
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: my-theme
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============= 变量 ============= */
:root {
    --c-primary: #e60012;
    --c-primary-dark: #c00010;
    --c-nav: #3c4858;
    --c-nav-hover: #2a3340;
    --c-bg: #f5f7fa;
    --c-card: #ffffff;
    --c-border: #e8e8e8;
    --c-text: #333333;
    --c-text-2: #666666;
    --c-text-3: #999999;
    --c-success: #16a34a;
    --c-warning: #f59e0b;
    --c-link: #2563eb;
    --c-tag: #16a34a;
    --c-tag-bg: #ecfdf5;
    --c-secured: #16a34a;
    --c-orange: #ff6a00;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 4px;
    --radius-lg: 8px;
    --max-width: 1440px;
    --header-h: 110px;
    --nav-h: 44px;
}

/* ============= Reset ============= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* 始终预留滚动条槽位：切到内容较少的分类/页面时滚动条消失，整页会横向跳约 15px（抖动） */
html { font-size: 14px; -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
/* 老浏览器（不支持 scrollbar-gutter）退化方案：常驻显示滚动条轨道 */
@supports not (scrollbar-gutter: stable) {
    html { overflow-y: scroll; }
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--c-link); text-decoration: none; }
a:hover { color: var(--c-primary); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }
table { border-collapse: collapse; width: 100%; }

/* SVG 与文字垂直对齐 */
svg { vertical-align: middle; }
h1, h2, h3, h4, h5, h6 { display: flex; align-items: center; gap: 8px; }
h1 svg, h2 svg, h3 svg, h4 svg, h5 svg, h6 svg { flex-shrink: 0; }

/* ============= 通用容器 ============= */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 15px; }
.clearfix::after { content: ''; display: table; clear: both; }

/* ============= 顶部条（Logo + 搜索）============= */
.top-bar { background: #fff; padding: 18px 0; }
.top-bar-inner { display: flex; align-items: center; gap: 30px; }
.site-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.site-logo .logo-img { width: 60px; height: 60px; }
.site-logo .logo-text { font-size: 20px; font-weight: 700; color: var(--c-text); line-height: 1.2; }
.site-logo .logo-text small { display: block; font-size: 12px; font-weight: 400; color: var(--c-text-2); margin-top: 2px; }
.site-logo .custom-logo-img { display: block; }
.site-logo .site-title { display: block; }
.site-search { flex: 1; max-width: 720px; margin: 0 auto; }
.site-search form { display: flex; height: 38px; border: 2px solid var(--c-primary); border-radius: var(--radius); overflow: hidden; }
.site-search select { padding: 0 10px; border: none; border-right: 1px solid #eee; background: #f8f8f8; font-size: 13px; }
.site-search input[type=search] { flex: 1; padding: 0 12px; border: none; outline: none; }
.site-search button { background: var(--c-primary); color: #fff; padding: 0 18px; font-size: 14px; font-weight: 500; }
.site-search button:hover { background: var(--c-primary-dark); }
.post-sourcing-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--c-primary); color: var(--c-primary); border-radius: 20px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.post-sourcing-btn:hover { background: var(--c-primary); color: #fff; }
/* 注意：这里刻意不用 display:flex。
   一旦它是 flex 容器，唯一的子元素 .container 会退化成 flex item —— 宽度收缩到内容宽
   （而不是撑满到 --max-width），再被 margin:0 auto 居中，结果整条顶栏内容飘在页面中间，
   既不与站点主体左对齐、也不右对齐。（2026-09-17 修复） */
.top-bar-meta { padding: 8px 0; font-size: 12px; color: var(--c-text-3); border-bottom: 1px solid var(--c-border); }
.top-bar-meta .verified { color: var(--c-success); }
.top-bar-meta .stars { color: #ff9900; }
/* 左右 padding 归零，让社交图标与主体容器右边缘（以及其他区块）严格对齐 */
.top-bar-meta .top-bar-social { padding: 2px 0; display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; line-height: 1; min-width: 150px; }
.top-bar-meta .top-bar-social .social-label { color: var(--c-text-3); margin-right: 2px; }
.top-bar-meta .top-bar-social a { color: var(--c-text-3); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.top-bar-meta .top-bar-social a:hover { color: var(--c-primary); }
.top-bar-meta .top-bar-social svg { width: 14px; height: 14px; display: block; flex-shrink: 0; }

/* ============= 主导航 ============= */
.main-nav { background: var(--c-nav); }
.main-nav ul { display: flex; }
.main-nav li { position: relative; }
.main-nav a { display: block; padding: 0 28px; line-height: var(--nav-h); color: #fff; font-size: 15px; font-weight: 500; transition: background .2s; }
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current_page_item > a { background: var(--c-nav-hover); text-decoration: none; }
.main-nav .menu-item-has-children > a::after { content: '▾'; margin-left: 6px; font-size: 10px; opacity: 0.7; }
.main-nav .sub-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; min-width: 240px; box-shadow: var(--shadow-md); z-index: 100; }
.main-nav .menu-item-has-children:hover > .sub-menu { display: block; }
.main-nav .sub-menu a { color: var(--c-text); padding: 10px 20px; line-height: 1.4; font-size: 14px; }
.main-nav .sub-menu a:hover { background: var(--c-bg); color: var(--c-primary); }

/* ============= 面包屑 ============= */
.breadcrumb { padding: 12px 0; font-size: 12px; color: var(--c-text-3); }
.breadcrumb a { color: var(--c-text-3); }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb .sep { margin: 0 6px; color: #ccc; }

/* ============= 按钮 ============= */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 18px; border-radius: 4px; font-size: 14px; font-weight: 500; line-height: 1.4; transition: all .2s; cursor: pointer; border: 1px solid transparent; text-decoration: none; gap: 6px; }
.btn svg { flex-shrink: 0; vertical-align: middle; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--c-primary); border-color: var(--c-primary); }
.btn-outline:hover { background: var(--c-primary); color: #fff; }
/* WhatsApp 按钮：绿色与页脚 badge-whatsapp 保持一致 */
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-whatsapp:hover { background: #128c3e; color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ============= 通用 ============= */
.card { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section { padding: 30px 0; }
.section-title { font-size: 20px; font-weight: 700; color: var(--c-text); margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--c-primary); display: inline-block; }

/* ============= 页脚 ============= */
.site-footer { background: #2a3340; color: #94a3b8; padding: 30px 0 20px; margin-top: 40px; font-size: 12px; }
.footer-links { text-align: center; padding-bottom: 16px; border-bottom: 1px solid #3c4858; }
.footer-links a { color: #cbd5e1; margin: 0 8px; }
.footer-links a:hover { color: #fff; }
.footer-lang { padding: 14px 0; border-bottom: 1px solid #3c4858; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 18px; }
.footer-lang a { color: #94a3b8; font-size: 13px; }
.footer-lang a:hover { color: #fff; }
.footer-lang .label { color: #64748b; font-size: 13px; margin-right: 4px; }
.footer-copyright { text-align: center; padding: 16px 0 8px; }
.footer-copyright a { color: #cbd5e1; }
.footer-copyright a:hover { color: #fff; }
.footer-copyright-links { color: #64748b; }
.footer-cert { text-align: center; padding: 12px 0; }
.footer-cert .badge { display: inline-inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 4px; margin: 0 6px; font-size: 13px; font-weight: 500; text-decoration: none; transition: all 0.2s; }
.footer-cert .badge svg { vertical-align: middle; }
.footer-cert .badge-email { background: #e60012; color: #fff; }
.footer-cert .badge-email:hover { background: #c00010; color: #fff; }
.footer-cert .badge-whatsapp { background: #16a34a; color: #fff; }
.footer-cert .badge-whatsapp:hover { background: #128c3e; color: #fff; }

/* ============= 文章/页面 ============= */
.page-content { background: #fff; padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.entry-content { font-size: 14px; line-height: 1.8; color: var(--c-text); }
.entry-content p { margin-bottom: 1em; }
.entry-content h2, .entry-content h3 { margin: 1.5em 0 0.8em; color: var(--c-text); }
.entry-content img { border-radius: 4px; margin: 1em 0; }
.entry-content ul, .entry-content ol { padding-left: 2em; margin-bottom: 1em; }
.entry-content ul li { list-style: disc; }
.entry-content ol li { list-style: decimal; }

/* ============= 工具类 ============= */
.text-center { text-align: center; }
.text-primary { color: var(--c-primary); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }
/* ============ Mobile Menu Toggle (Hamburger) ============ */
/* Hidden on desktop by default - shown only at <=768px */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    vertical-align: middle;
}
.hamburger-icon { display: block; }
.hamburger-icon .bar-top,
.hamburger-icon .bar-mid,
.hamburger-icon .bar-bottom {
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}
.menu-toggle.active .hamburger-icon .bar-top    { transform: translateY(6px) rotate(45deg); }
.menu-toggle.active .hamburger-icon .bar-mid    { opacity: 0; }
.menu-toggle.active .hamburger-icon .bar-bottom { transform: translateY(-6px) rotate(-45deg); }

/* ============ 1024 Breakpoint (iPad Landscape) ============ */
@media (max-width: 1024px) {
    /* Fold sidebars on all pages */
    .post-layout,
    .blog-layout,
    .featured-row,
    .single-layout {
        grid-template-columns: 1fr !important;
    }
    
    /* Adjust grid columns */
    .product-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .product-groups-grid { grid-template-columns: repeat(4, 1fr) !important; }
    
    /* Header search narrower */
    .site-search { max-width: 400px; }
}

/* ============ 768 Breakpoint (Mobile) ============ */
@media (max-width: 768px) {
    :root { --header-h: auto; }
    
    /* Top bar stack */
    .top-bar-inner { flex-direction: column; align-items: stretch; gap: 12px; }
    .site-search { max-width: 100%; }
    .post-sourcing-btn { width: 100%; text-align: center; }
    
    /* Mobile hamburger menu */
    .main-nav .container { position: relative; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .main-nav ul.menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--c-nav);
        z-index: 9999;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    .main-nav ul.menu.active { display: flex; }
    .main-nav a {
        padding: 12px 20px;
        font-size: 14px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .main-nav li:last-child a { border-bottom: none; }
    .main-nav .sub-menu {
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,0.2);
    }
    .main-nav .sub-menu a {
        padding-left: 40px;
        color: #fff;
    }
    
    /* Grids to 2 columns */
    .product-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .product-groups-grid { grid-template-columns: repeat(3, 1fr) !important; }
    
    /* Touch targets >= 44px */
    .btn,
    .post-sourcing-btn,
    .menu-toggle,
    .faq-tab {
        min-height: 44px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    /* About/Solutions/Discover content */
    .page-content { padding: 20px 0; }
}

/* ============ 480 Breakpoint (Small Mobile) ============ */
@media (max-width: 480px) {
    /* Grids to 1-2 columns */
    .product-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .product-groups-grid { grid-template-columns: repeat(2, 1fr) !important; }
    
    /* Smaller text */
    .main-nav a { font-size: 13px; padding: 10px 16px; }
    
    /* Logo smaller */
    .site-logo .logo-img { width: 40px; height: 40px; font-size: 16px; }
    .site-logo .site-title { font-size: 16px; }
    .site-logo small { font-size: 10px; }
    
    /* Touch targets */
    .btn,
    .post-sourcing-btn,
    button[type="submit"] {
        min-height: 44px;
    }
}
