/* ==========================================================================
   主题核心变量与基础重置 (Base & Variables)
   ========================================================================== */
:root {
    --yy-primary: #0056b3;
    --yy-primary-hover: #004494;
    --yy-text: #333;
    --yy-text-muted: #666;
    --yy-bg: #fff;
    --yy-gray: #f5f5f5;
    --yy-font: system-ui, -apple-system, sans-serif;
    --yy-transition: all 0.3s ease;
}

body {
    font-family: var(--yy-font);
    color: var(--yy-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.yy-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==========================================================================
   全局通用组件 (Grid, Buttons, Cards, Carousel, Video)
   ========================================================================== */
/* 网格布局 */
.yy-grid { display: grid; gap: 20px; }
.yy-grid-2 { grid-template-columns: repeat(2, 1fr); }
.yy-grid-3 { grid-template-columns: repeat(3, 1fr); }
.yy-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 按钮组件 */
.yy-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 4px;
    transition: var(--yy-transition);
}
.yy-btn-primary {
    background: var(--yy-primary);
    color: #fff;
}
.yy-btn-primary:hover {
    background: var(--yy-primary-hover);
}

/* 卡片组件 */
.yy-card {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: 0.3s;
}
.yy-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.yy-card-content {
    padding: 15px;
}

/* YouTube 延迟加载视频组件 */
.yy-yt-lazy {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}
.yy-yt-lazy iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}
.yy-yt-lazy::before {
    content: "▶";
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 36px; color: rgba(255,255,255,0.9); background: rgba(0,0,0,0.5);
    width: 70px; height: 70px; line-height: 70px; text-align: center;
    border-radius: 50%; transition: var(--yy-transition); z-index: 2;
}
.yy-yt-lazy:hover::before {
    color: #fff; background: var(--yy-primary);
}

/* 多列轮播组件 (Carousel) */
.yy-carousel-container {
    position: relative; width: 100%; padding: 0 45px; box-sizing: border-box;
}
.yy-carousel-wrapper {
    overflow: hidden; width: 100%; padding-bottom: 10px;
}
.yy-carousel-track {
    display: flex; transition: transform 0.4s ease-in-out; will-change: transform; gap: 20px;
}
.yy-carousel-slide {
    flex: 0 0 calc(25% - 15px); min-width: 0; box-sizing: border-box;
} /* 默认PC端4列 */

.yy-carousel-btn {
    position: absolute; top: calc(50% - 20px); transform: translateY(-50%);
    background: transparent; color: #999; border: none; font-size: 40px; cursor: pointer;
    z-index: 10; transition: color 0.3s; padding: 0; line-height: 1; font-weight: 300;
}
.yy-carousel-btn:hover { color: #d32f2f; }
.yy-carousel-btn.prev { left: -10px; }
.yy-carousel-btn.next { right: -10px; }

.yy-carousel-dots {
    display: flex; justify-content: center; gap: 8px; margin-top: 25px;
}
.yy-carousel-dots span {
    display: block; width: 8px; height: 8px; border-radius: 50%; background: #ccc; cursor: pointer; transition: 0.3s;
}
.yy-carousel-dots span.active {
    background: #333; width: 20px; border-radius: 4px;
}

/* 通用内页顶部 Banner */
.yy-com-banner {
    position: relative;
    width: 100%;
    font-size: 0; /* 消除 img 标签底部自带的默认空白间隙 */
    line-height: 0;
}
.yy-banner-img {
    width: 100%;
    height: auto; /* 高度自适应，完全由图片自身比例决定 */
    display: block;
    object-fit: cover; /* 确保图片不变形 */
}

/* ==========================================================================
   头部结构 (Header: Topbar, Main, Navbar)
   ========================================================================== */
.yy-header-wrapper {
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 9999;
    transition: all 0.3s ease;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

/* 向下滚动后的粘性状态 (美化) */
.yy-header-wrapper.is-scrolled {
    background: rgba(246, 246, 246, 0.7); /* 75% 透明度纯白 */
    backdrop-filter: blur(10px); /* 强烈建议加上这个，毛玻璃效果更显高级 */
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #f0f0f0; /* 顶部 1px 细线 */
    border-bottom: 1px solid #e0e0e0; /* 底部 1px 细线 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); /* 非常微弱的底部立体阴影 */
}

.yy-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px; /* 强制固定高度，保证粘性时的稳定性 */
}

/* 1. Logo 区域 */
.yy-logo-area {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.yy-logo-link { display: block; }
.yy-logo-img { max-height: 45px; width: auto; display: block; }
.yy-logo-text { font-size: 24px; font-weight: bold; color: var(--yy-text); }

/* 2. 主导航菜单 (Navbar) */
.yy-nav-bar {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end; /* 让菜单靠右，贴近工具区 */
    padding-left: 80px;
    padding-right: 50px; /* 与右侧工具区保持距离 */
}
.yy-menu { display: flex; list-style: none; margin: 0; padding: 0; align-items: center; }
.yy-menu > li { margin: 0; padding: 0; }
.yy-menu > li > a {
    display: flex;
    align-items: center;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 600;
    padding: 0 18px; /* 根据菜单项多少动态调整 */
    height: 80px; /* 让点击区域撑满整个 Header 高度 */
    text-decoration: none;
    transition: color 0.3s;
    white-space: nowrap;
}
.yy-menu > li > a:hover,
.yy-menu > li.current-menu-item > a {
    color: var(--yy-primary);
}

/* 菜单下拉指示器 */
.yy-menu .menu-item-has-children > a::after,
.yy-menu .has-mega-menu > a::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 6px;
    margin-top: -3px; /* 微调垂直对齐 */
    transition: transform 0.3s;
}
.yy-menu li:hover > a::after {
    transform: rotate(-135deg);
    margin-top: 3px;
}

/* 3. 工具区 (搜索 & 多语言) */
.yy-header-tools {
    display: flex;
    align-items: center;
    gap: 25px; /* 工具之间的间距 */
    flex-shrink: 0;
}

/* --- 搜索模块 --- */
.yy-search-module { position: relative; }
.yy-search-trigger {
    background: none; border: none; padding: 5px; cursor: pointer; color: #1a1a1a; display: flex; align-items: center;
}
.yy-search-trigger:hover { color: var(--yy-primary); }

.yy-search-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 15px;
    background: #fff; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 15px; width: 300px;
    opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease;
    z-index: 10000; /* 必须在最高层 */
    border: 1px solid #eee;
}
.yy-search-module.active .yy-search-dropdown {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.yy-search-form { display: flex; border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.yy-search-field { flex-grow: 1; border: none; padding: 10px 15px; font-size: 14px; outline: none; }
.yy-search-submit { background: var(--yy-primary); color: #fff; border: none; padding: 0 15px; cursor: pointer; display: flex; align-items: center; }

/* --- 语言切换器--- */
.yy-lang-switch { position: relative; display: inline-block; cursor: pointer; padding: 5px 0; }
.yy-lang-trigger { display: flex; align-items: center; gap: 5px; color: #1a1a1a; font-size: 14px; font-weight: 500; }
.yy-lang-trigger .yy-arrow { transition: transform 0.3s ease; }
.yy-lang-switch:hover .yy-lang-trigger { color: var(--yy-primary); }
.yy-lang-switch:hover .yy-arrow { transform: rotate(180deg); }

.yy-lang-dropdown {
    position: absolute; top: 100%; right: 0; min-width: 120px; z-index: 10000;
    background: #fff; border: 1px solid #eee; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s;
}
.yy-lang-switch:hover .yy-lang-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.yy-lang-list { list-style: none; margin: 0; padding: 5px 0; }
.yy-lang-list a { display: block; padding: 10px 20px; color: #444; font-size: 13px; text-decoration: none; white-space: nowrap; }
.yy-lang-list a:hover { background: #f8fafe; color: var(--yy-primary); }

.yy-mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 5px; margin-left: 10px; }

/* 4. 原生多级下拉菜单 (Sub-menu) */
.yy-menu li { position: relative; }
.yy-menu ul.sub-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: #fff; min-width: 220px; box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    padding: 10px 0; margin: 0; list-style: none; z-index: 9999; border-top: 2px solid var(--yy-primary);
}
.yy-menu li:hover > ul.sub-menu { display: block; }
.yy-menu ul.sub-menu a { display: block; padding: 10px 20px; color: #444; font-size: 14px; font-weight: 500; transition: color 0.2s; }
.yy-menu ul.sub-menu a:hover { color: var(--yy-primary); background: #fcfcfc; padding-left: 25px; }

/* ==========================================================================
   巨型菜单扩展组件 (Mega Menu)
   ========================================================================== */
/* 必须保持 relative 以定位 mega menu */
.has-mega-menu { position: static !important; }
.yy-mega-menu {
    background: #fff; border-top: 2px solid var(--yy-primary); box-shadow: 0 10px 30px rgba(0,0,0,0.08); z-index: 9999;
    position: absolute; top: 100%; left: 0; width: 100%;
    opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease;
}
.has-mega-menu:hover .yy-mega-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.yy-mega-grid { display: flex; justify-content: space-between; padding: 40px 15px; gap: 40px; max-width: 1500px; margin: 0 auto; }
.yy-mega-col { flex: 1; }
.yy-mega-title { font-size: 1.15rem; font-weight: bold; color: var(--yy-text); margin: 0 0 15px 0; display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; }
.yy-mega-title svg { color: var(--yy-primary); }
.yy-mega-links { list-style: none; padding: 0; margin: 0; text-align: left; }
.yy-mega-links li { margin-bottom: 12px; }
.yy-mega-links a { color: #555; text-decoration: none; font-size: 14px; transition: color 0.2s; display: block; }
.yy-mega-links a:hover { color: var(--yy-primary); padding-left: 5px; }


/* ==========================================================================
   页脚结构 (Footer)
   ========================================================================== */
.yy-footer-wrapper {
    background-color: #12151c; /* 略微提亮的深邃蓝灰，不再是死黑 */
    color: #a0aabf; /* 字体改用高级的银灰色，提升亮度 */
    font-size: 15px; /* 基础字号放大，告别小气 */
    margin-top: 20px;
    border-top: 3px solid var(--yy-primary); /* 顶部增加品牌色高亮线条，打破单调 */
}

/* 顶部链接区 */
.yy-footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    gap: 40px 30px; /* 增加列间距让排版呼吸感更强 */
    padding: 70px 15px;
}

/* 标题高大上改造 */
.yy-ft-title {
    color: #ffffff;
    font-size: 18px; /* 标题放大 */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 12px;
    letter-spacing: 0.5px;
}
/* 标题下方的精致短横线装饰 */
.yy-ft-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 3px;
    background: var(--yy-primary);
    border-radius: 2px;
}

.yy-footer-top ul { list-style: none; padding: 0; margin: 0; }

/* 联系方式区块优化 */
.yy-contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    line-height: 1.6;
    color: #d1d6e0; /* 联系方式比普通链接更亮一点 */
}
.yy-contact-list svg {
    flex-shrink: 0;
    margin-top: 4px;
    color: var(--yy-primary); /* 图标使用主色调，点亮黑色背景 */
    width: 18px;
    height: 18px;
}
/* 强力高亮电话号码 */
.yy-contact-list li:nth-child(2) span {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    font-family: Arial, sans-serif;
    letter-spacing: 0.5px;
}

/* 链接悬浮的高级交互效果 */
.yy-ft-links li { margin-bottom: 16px; }
.yy-ft-links a {
    color: #a0aabf;
    transition: all 0.3s ease;
    display: inline-block;
}
.yy-ft-links a:hover {
    color: #ffffff;
    transform: translateX(6px); /* 悬浮时向右平滑移动，大厂常用质感 */
}

/* Footer Social Media */
.yy-social-list { display: flex; gap: 12px; margin-top: 18px; }
.yy-social-link { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; transition: .3s; }
.yy-social-link svg { width: 19px; height: 19px; fill: currentColor; }
.yy-social-link:hover { background: #fff; color: #1d75bd; transform: translateY(-3px); }

/* 底部版权区层次分离 */
.yy-footer-bottom {
    background-color: #0b0d12; /* 使用极深的黑色与上面分离层次 */
    padding: 25px 0;
    font-size: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05); /* 极其微弱的分割线 */
}

.yy-bottom-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.yy-divider { margin: 0 12px; color: #3a3f51; }
.yy-footer-bottom a { color: #8c94a5; transition: color 0.3s; }
.yy-footer-bottom a:hover { color: #ffffff; }
.yy-friend-links { margin-top: 5px; }
.yy-friend-links span { color: #5c6275; }
.yy-friend-links a { margin: 0 10px; }


/* -----------------------------------------
   [电脑端 >= 992px]
----------------------------------------- */
@media (min-width: 993px) {
    /* -----------------------------------------
       [中等电脑屏幕流式计算区 993px - +]
       利用 clamp() 实现间距随屏幕宽度无缝动态伸缩
    ----------------------------------------- */
    .yy-menu {
        width: 100%;
        justify-content: space-between; /* 保留：依靠它来自动平分各项之间的间距 */
    }

    /* 2. 移除强制均分，让菜单项按文字长度自然撑开 */
    .yy-menu > li {
        /* 删除了 flex: 1; */
        /* 删除了 text-align: center; (不强制均分宽度后，居中也就不需要了) */
    }

    /* 3. 恢复舒适的点击热区 */
    .yy-menu > li > a {
        padding-left: clamp(10px, 0.8vw, 15px); /* 修改：改用流式 padding，保证基础点击热区 */
        padding-right: clamp(10px, 0.8vw, 15px);
        /* 删除了 width: 100%; (让 a 标签随内容和 padding 自然撑开) */
        box-sizing: border-box;
        font-size: clamp(14px, 1.1vw + 3px, 16px);
        white-space: nowrap;
    }
}


/* -----------------------------------------
   [移动端 <= 992px]
----------------------------------------- */
@media (max-width: 992px) {
    /* 1. 头部粘性与隐藏区块重置 */
    .yy-header-inner { height: 70px; }
    .yy-logo-img { max-height: 35px; }

    /* 移动端菜单抽屉 */
    .yy-nav-bar {
        display: none;
        background: #fff;
        border-top: 1px solid #eee;
        padding-right: 0;
        padding-left: 0; /* 修复根源：清除继承自全局的 80px 左内边距 */
    }
    .yy-nav-bar.active {
        display: block !important;
        position: fixed;
        top: 70px;
        left: 0;
        width: 80%; /* 修改：宽度改为 80%，即五分之四 */
        height: calc(100vh - 70px);
        background: #ffffff;
        z-index: 9998;
        overflow-y: auto;
        /* 修改阴影：让右侧产生明显的边界感 */
        box-shadow: 10px 0 20px rgba(0,0,0,0.1);
    }

    .yy-header-tools { gap: 15px; }
    .yy-mobile-toggle { display: block; }

    /* 移动端搜索框全宽 */
    .yy-search-dropdown {
        position: fixed;
        top: 70px;
        left: 10%;
        width: 80%; /* 总宽度 100% 减去左右各 10% */
        box-sizing: border-box;
        margin-top: 0;
    }

    /* 菜单列表重置为垂直 */
    .yy-menu { flex-direction: column; align-items: stretch; }
    .yy-menu > li > a {
        height: auto;
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
        justify-content: flex-start; /* 修改：取消 space-between，让文字靠左 */
        color: #333;
        font-weight: 500;
    }

    /* 移动端子菜单重置 */
    .yy-menu li.menu-item-has-children > a::after,
    .yy-menu li.has-mega-menu > a::after {
        content: "";
        display: inline-block;
        width: 6px;
        height: 6px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        margin-left: auto; /* 靠右对齐 */
        margin-top: -3px;
        transition: transform 0.3s ease;
    }

    /* 当菜单通过 JS 打开时，旋转提示图标 */
    .yy-menu li.mobile-sub-open > a::after,
    .has-mega-menu.mobile-mega-open > a::after {
        transform: rotate(-135deg);
        margin-top: 3px;
        color: var(--yy-primary);
    }

    .yy-nav-bar .yy-menu ul.sub-menu { display: none; position: static; box-shadow: none; background: #fafafa; padding: 0 0 0 20px; border-top: none; min-width: auto; }
    .yy-menu li:hover > ul.sub-menu { display: none; } /* 阻断电脑端 hover 的干扰 */
    .yy-nav-bar .yy-menu li.mobile-sub-open > ul.sub-menu { display: block; } /* 完全交由 JS 控制 */

    /* 移动端 Mega Menu 重置 */
    .yy-mega-menu { display: none; position: relative; width: 100%; background: #f8fbff; border-top: none; box-shadow: none; }
    .has-mega-menu.mobile-mega-open .yy-mega-menu { display: block; }
    .yy-mega-grid { flex-direction: column; padding: 20px; gap: 25px; }

    /* 5. 轮播图与内边距缩减 */
    .yy-carousel-container { padding: 0; }
    .yy-carousel-slide { flex: 0 0 calc(50% - 10px); }
    .yy-carousel-btn { display: none; }

    .yy-home-partner, .yy-home-news, .yy-home-factory, .yy-home-cert, .yy-home-solutions {
        padding-top: 40px !important; padding-bottom: 40px !important;
    }

    /* 6. 页脚重排 */
    .yy-footer-top {
        grid-template-columns: repeat(2, 1fr); gap: 40px 10px; padding: 40px 15px;
    }
    .yy-ft-contact { grid-column: 1 / -1; }
    .yy-social-list { display: grid; grid-template-columns: repeat(2, 40px); gap: 12px; margin-top: 18px; }
    .yy-bottom-inner { gap: 15px; }
    .yy-divider { display: none; }
    .yy-copyright a { display: block; margin-top: 5px; }

    /* 证书模块 隐藏第5个及之后的证书 */
    .yy-cert-grid .yy-cert-card:nth-child(n+5) {
        display: none;
    }

}
