/* ==========================================================================
   B 版 · 动效层
   技术栈：jQuery 3.7 + GSAP 3 / ScrollTrigger / Flip + Lenis + Swiper 11 + Animate.css 4
   --------------------------------------------------------------------------
   本轮重点（对应反馈）：
   1. Hero 由 fade 改为 Swiper 的真实滑动切换，带图片视差；
   2. hover 去掉「大模糊阴影逐帧重绘」，改为 opacity 合成层 + Animate.css 慢缓动；
   3. 导航下拉由纯 CSS 瞬时切换，改为带意图延迟的展开 + 子项级联；
   4. 吸顶改为「负 top 粘性」，滚动过程中不改变文档高度 —— 从原理上消除忽闪。
   ========================================================================== */

/* ---------- 0. Lenis 必需样式 ---------- */
html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-scrolling iframe { pointer-events: none; }

/* ---------- 1. 吸顶：负 top 粘性，不触发任何重排 ----------
   原来靠 is-compact 折叠 header-top 的 height：每次切换都会让整页内容
   上下跳 100px，滚动到临界点时就会反复触发，看起来就是「忽闪忽现」。
   现在 header 整体 sticky，top 设为 -(header 高度)：顶部区块自然滚走，
   导航条正好停在视觉顶部。整个过程没有任何高度变化，也就没有抖动。 */
.site-header {
    position: sticky;
    top: calc(-1 * var(--header-h));
    background: #fff;
}
.main-nav { position: relative; }

/* 吸顶后导航的细节：加深阴影 + 中央小 Logo */
.site-header .main-nav { transition: box-shadow .45s var(--ease); }
.site-header.is-stuck .main-nav { box-shadow: 0 8px 28px rgba(6, 26, 18, .22); }

.nav-gap { position: relative; }
.nav-brand {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    display: block;
    transform: translate(-50%, -50%) scale(.72);
    opacity: 0;
    visibility: hidden;
    transition: opacity .42s var(--ease), transform .5s var(--ease), visibility .42s;
    will-change: transform;
}
.nav-brand img { width: 100%; height: auto; }
.site-header.is-stuck .nav-brand {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ---------- 2. 导航：滑动高亮胶囊 ---------- */
.nav-list { position: relative; z-index: 2; }
.nav-pill {
    position: absolute;
    left: 0;
    top: 0;
    height: var(--nav-h);
    width: 120px;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, .13);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
    will-change: transform, width;
}
/* 胶囊接管悬停底色，避免两层底色叠加深浅不一 */
.nav-item:hover > a { background: transparent; }
.nav-item > a { transition: color .3s var(--ease); }
.nav-item:hover > a { color: #fff; }

/* ---------- 3. 下拉：意图延迟 + 子项级联 ----------
   base.css 里原本是 .nav-item:hover 直接切换，鼠标一扫就闪。
   这里把它压掉，改由 JS 打 is-open 控制（带 140ms 离开缓冲）。 */
.site-header .nav-item:hover .nav-sub,
.site-header .nav-item:focus-within .nav-sub {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(14px) scale(.985);
}
.nav-sub {
    transition: opacity .3s var(--ease), transform .42s var(--ease), visibility .3s;
    transform-origin: top center;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 18px 40px rgba(10, 26, 18, .16), 0 2px 0 rgba(15, 122, 77, .0);
    padding: 8px 8px 10px;
}
.site-header .nav-item .nav-sub.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
    transition: opacity .34s var(--ease), transform .46s var(--ease), visibility .34s;
}
/* 顶部绿线从中间展开 */
.nav-sub::before {
    transition: transform .42s var(--ease);
    transform: scaleX(0);
    transform-origin: center;
}
.nav-item .nav-sub.is-open::before { transform: scaleX(1); }

/* 子项：文字级联 + 左侧短杠 */
.nav-sub a {
    padding: 9px 14px;
    transition: background-color .3s var(--ease), color .3s var(--ease), transform .35s var(--ease);
    --animate-duration: .72s;
}
.nav-sub a::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 2px;
    background: var(--green);
    transform: translateY(-50%);
    transition: height .32s var(--ease);
}
.nav-sub a { position: relative; }
.nav-sub a:hover {
    padding-left: 14px;
    transform: translateX(6px);
    background: var(--green-soft);
}
.nav-sub a:hover::before { height: 15px; }

/* 产品中心有 11 个分类，单列会拉出 400px 长条，这里改成双列面板 */
.nav-sub--wide {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 2px 4px;
    min-width: 352px;
    padding: 10px 12px 12px;
}

/* ---------- 4. Hero：真实滑动切换 ---------- */
.hero { isolation: isolate; }
.hero-swiper,
.hero-swiper .swiper-wrapper,
.hero-swiper .swiper-slide { height: 100%; }
.hero-swiper .swiper-slide { overflow: hidden; }

/* 外层给 Swiper 做视差，左右各留 9% 余量防止露边 */
.hero__slide-media {
    position: absolute;
    inset: 0 -9%;
    transform: none;
    background: none;
    will-change: transform;
}
/* 内层负责 Ken Burns，与外层视差的 transform 互不干扰 */
.hero__slide-img {
    position: absolute;
    inset: 0;
    background: no-repeat center / cover;
    transform: translate3d(0, 0, 0) scale(1.04);
    backface-visibility: hidden;
}
/* 压掉 base.css 里绑在 media 上的旧缩放动画 */
.hero .swiper-slide-active .hero__slide-media { animation: none; }
.hero .swiper-slide-active .hero__slide-img {
    animation: heroKen 8.6s linear both;
}
@keyframes heroKen {
    from { transform: translate3d(0, 0, 0) scale(1.04); }
    to   { transform: translate3d(0, 0, 0) scale(1.12); }
}
.hero__slide-media a { position: absolute; inset: 0; z-index: 2; }

/* ===== banner 文字层（左文右图·营销横幅） ===== */
.hero-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    display: flex;
    align-items: center;
    pointer-events: none;
}
.hero-content__inner {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 60px);
}
.hero-content__box {
    max-width: 560px;
    pointer-events: auto;
}
/* 左侧深色渐变遮罩，保证文字可读 */
.hero-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 62%;
    height: 100%;
    background: linear-gradient(90deg, rgba(5, 18, 13, .82) 0%, rgba(5, 18, 13, .55) 45%, rgba(5, 18, 13, 0) 100%);
    z-index: -1;
}
.hero-content__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 122, 77, .18);
    border: 1px solid rgba(63, 174, 125, .5);
    color: #7ee0ae;
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 18px;
    backdrop-filter: blur(4px);
}
.hero-content__badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3fae7d;
    box-shadow: 0 0 0 3px rgba(63, 174, 125, .3);
}
.hero-content__title {
    font-size: clamp(30px, 4.4vw, 54px);
    font-weight: 800;
    line-height: 1.16;
    color: #fff;
    letter-spacing: 1px;
    margin: 0 0 16px;
    text-shadow: 0 4px 24px rgba(0, 0, 0, .35);
}
.hero-content__title .hl {
    color: #3fae7d;
    position: relative;
}
.hero-content__sub {
    font-size: clamp(15px, 1.6vw, 18px);
    color: rgba(255, 255, 255, .86);
    line-height: 1.7;
    margin: 0 0 22px;
    max-width: 480px;
}
.hero-content__points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}
.hero-content__points span {
    padding: 6px 13px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #eaf6f0;
    font-size: 13px;
    backdrop-filter: blur(4px);
}
.hero-content__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 30px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    transition: background-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s;
    box-shadow: 0 10px 28px rgba(15, 122, 77, .4);
}
.hero-content__cta:hover {
    background: #0a6b42;
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 122, 77, .5);
}
.hero-content__cta svg { width: 18px; height: 18px; }

/* 文字入场动画（跟随 Swiper 当前 slide） */
.hero-content__badge,
.hero-content__title,
.hero-content__sub,
.hero-content__points,
.hero-content__cta {
    opacity: 0;
    transform: translateY(26px);
}
html.js .hero .swiper-slide-active .hero-content__badge,
html.js .hero .swiper-slide-active .hero-content__title,
html.js .hero .swiper-slide-active .hero-content__sub,
html.js .hero .swiper-slide-active .hero-content__points,
html.js .hero .swiper-slide-active .hero-content__cta {
    animation: heroTextIn .7s var(--ease) forwards;
}
html.js .hero .swiper-slide-active .hero-content__title { animation-delay: .25s; }
html.js .hero .swiper-slide-active .hero-content__sub { animation-delay: .35s; }
html.js .hero .swiper-slide-active .hero-content__points { animation-delay: .45s; }
html.js .hero .swiper-slide-active .hero-content__cta { animation-delay: .55s; }
html.js .hero .swiper-slide-active .hero-content__badge { animation-delay: .15s; }
@keyframes heroTextIn {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 底部压暗，保证控件可读 */
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    background: linear-gradient(to top, rgba(6, 20, 14, .58), rgba(6, 20, 14, 0));
    pointer-events: none;
    z-index: 3;
}

/* 左右箭头：常显 + 玻璃质感 */
.hero__arrow {
    width: 56px;
    height: 56px;
    margin-top: -28px;
    border-radius: 50%;
    opacity: .88;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background-color .42s var(--ease), border-color .42s var(--ease),
                transform .5s var(--ease), opacity .3s;
}
.hero:hover .hero__arrow { opacity: 1; }
.hero__arrow:hover {
    background: var(--green);
    border-color: var(--green);
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(4, 24, 16, .3);
}
.hero__arrow:active { transform: scale(.94); transition-duration: .12s; }
.hero__arrow--prev { left: clamp(14px, 2.4vw, 34px); }
.hero__arrow--next { right: clamp(14px, 2.4vw, 34px); }
.hero-swiper { cursor: grab; }
.hero-swiper:active { cursor: grabbing; }

/* 分页条：短杠，激活时变长（宽度过渡只影响自身，不引发页面重排） */
/* 玻璃胶囊托底：无论 banner 明暗，分页条都清晰可读 */
.hero .hero__dots {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
    bottom: 22px;
    gap: 9px;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(8, 24, 18, .32);
    border: 1px solid rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hero__dots .swiper-pagination-bullet {
    position: relative;
    width: 26px;
    height: 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .46);
    opacity: 1;
    transition: width .5s var(--ease), background-color .4s var(--ease), box-shadow .4s;
}
.hero__dots .swiper-pagination-bullet-active {
    width: 76px;
    background: #fff;
    box-shadow: 0 0 16px rgba(255, 255, 255, .55);
}
.hero__dots .swiper-pagination-bullet:hover { background: rgba(255, 255, 255, .78); }

/* 左下角序号 */
.hero__index {
    position: absolute;
    left: clamp(20px, 4vw, 58px);
    bottom: 26px;
    z-index: 4;
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: #fff;
    line-height: 1;
    pointer-events: none;
}
.hero__index::before {
    content: "";
    position: absolute;
    left: -15px;
    top: 3px;
    bottom: 1px;
    width: 2px;
    background: var(--green-l);
}
.hero__index b {
    font-family: Impact, "Arial Black", sans-serif;
    font-weight: 400;
    font-size: 32px;
    letter-spacing: 1px;
    display: inline-block;
}
.hero__index span {
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, .62);
}

/* ---------- 5. hover：换成零重绘的实现 ----------
   阴影不再用 box-shadow 过渡（那会每帧重绘整卡）。
   但也不能把 overflow 改成 visible —— 那会让图片放大溢出、圆角失效，
   是上一版「产品展示错位」的根因。这里保留 overflow:hidden 的圆角裁剪，
   阴影交给独立伪元素 ::after 只过渡 opacity（合成层），卡片只做位移。 */
.product-card {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    transition: transform .55s var(--ease);
    backface-visibility: hidden;
}
.product-card:hover { transform: translate3d(0, -7px, 0); }
/* 阴影层：覆盖在卡片内容之上（z-index 靠前），用 box-shadow 描出外轮廓，
   内容本身被 overflow:hidden 裁切，阴影不参与重绘，只切 opacity */
.product-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 3px;
    box-shadow: 0 20px 38px rgba(6, 28, 18, .34);
    opacity: 0;
    pointer-events: none;
    transition: opacity .55s var(--ease);
    z-index: 2;
}
.product-card:hover::after { opacity: 1; }
.product-card__img {
    position: relative;
    overflow: hidden;
}
.product-card__img img {
    transform: translate3d(0, 0, 0) scale(1);
    transition: transform .85s var(--ease);
    backface-visibility: hidden;
}
.product-card:hover .product-card__img img { transform: translate3d(0, 0, 0) scale(1.055); }

/* 右下角「查看」圆钮，由 JS 注入，hover 时用 Animate.css 慢速弹入 */
.product-card__go {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--green);
    box-shadow: 0 6px 16px rgba(6, 40, 24, .3);
    opacity: 0;
    pointer-events: none;
    --animate-duration: .62s;
}
.product-card__go svg { width: 14px; height: 14px; }

/* 四大优势卡：去掉大阴影过渡，改为外发光环 + 内部错峰入场 */
.adv-card { transition: transform .6s var(--ease); }
.adv-card:hover { transform: translateY(-9px); box-shadow: none; }
.adv-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 22px 40px rgba(4, 24, 16, .26);
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s var(--ease);
}
.adv-card:hover::after { opacity: 1; }
.adv-card__img img { transition: transform 1.1s var(--ease); }
.adv-card:hover .adv-card__img img { transform: scale(1.05); }
.adv-card__hover {
    transform: translateY(10px);
    transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.adv-card__hover > i,
.adv-card__hover > h3,
.adv-card__hover > p { --animate-duration: .95s; }

/* 新闻卡：左侧竖条生长替代阴影 */
.news-card {
    position: relative;
    transition: border-color .4s var(--ease), transform .5s var(--ease);
}
.news-card:hover { transform: translateY(-4px); box-shadow: none; }
.news-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--green);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform .5s var(--ease);
    z-index: 2;
}
.news-card:hover::before { transform: scaleY(1); }
.news-card__img img { transition: transform .95s var(--ease); }

/* 实力卡 / 方案卡 / 关于我们：慢一档，避免「唰」一下 */
.st-card:hover .st-card__img img,
.sol-card:hover .sol-card__img img,
.about-block:hover .about-block__img img {
    transform: scale(1.045);
}
.st-card__img img,
.sol-card__img img,
.about-block__img img { transition: transform 1.2s var(--ease); }

/* 分类 / 标签按钮：只过渡颜色与位移 */
.cat-panel__list button,
.cat-panel__list a { transition: background-color .35s var(--ease), color .35s var(--ease), padding-left .35s var(--ease); }
.news-tabs button { transition: background-color .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease), transform .35s var(--ease); }
.news-tabs button:not(.is-active):hover { transform: translateY(-2px); }

/* 方案切换按钮：默认对比度略提，悬停给一个方向感 */
.sol-nav button { border-color: #d9dfdb; color: #39424f; }
.sol-nav button:active { transform: scale(.95); }

/* ---------- 6. Animate.css 全局节奏 ---------- */
:root { --animate-duration: .9s; }
/* 通用「入场后保持」：Animate.css 自带 both，这里只补一个统一的收尾缓动 */
.animate__animated { animation-timing-function: cubic-bezier(.22, 1, .36, 1); }

/* ---------- 7. 杂项 ---------- */
/* 入场：CSS 关键帧驱动。fill-mode 用 backwards 而不是 both，
   这样动画结束就回到元素自身的自然状态，不会锁住 hover 的位移。 */
html.js .reveal { opacity: 0; }
html.js .reveal.is-in {
    opacity: 1;
    animation-name: v2Reveal;
    animation-duration: .92s;
    animation-timing-function: cubic-bezier(.22, 1, .36, 1);
    animation-fill-mode: backwards;
    animation-delay: calc(var(--d, 0s) + var(--rd, 0s));
}
@keyframes v2Reveal {
    from { opacity: 0; transform: translate3d(0, 28px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* 公司优势的大编号：随卡片一起入场，做一个轻微放大 */
html.js .st-card__no { opacity: 0; }
.st-card.is-in .st-card__no {
    animation: noIn .95s cubic-bezier(.22, 1, .36, 1) .12s forwards;
}
@keyframes noIn {
    from { opacity: 0; transform: scale(.76); }
    to   { opacity: 1; transform: scale(1); }
}
.product-card[hidden] { display: none !important; }
.product-grid .grid-empty { display: none; }
.product-grid .grid-empty.is-show { display: block; }
body.menu-open { overflow: hidden; }
.drawer__sub { transition: max-height .34s var(--ease); }
.cta-band__bg { top: -9%; bottom: -9%; }

/* ---------- 8. 响应式 ---------- */
@media (max-width: 992px) {
    /* 移动端只有 68px 的头部，整体吸顶即可 */
    .site-header { position: sticky; top: 0; }
    .nav-pill { display: none; }
    .hero__index { display: none; }
}

@media (max-width: 768px) {
    .hero .hero__dots { bottom: 16px; gap: 7px; padding: 7px 11px; }
    .hero__dots .swiper-pagination-bullet { width: 18px; height: 3px; }
    .hero__dots .swiper-pagination-bullet-active { width: 44px; }
    .hero::after { height: 38%; }
    /* banner 文字层：窄屏整体铺一层遮罩，文字居中偏左 */
    .hero-content::before { width: 100%; background: linear-gradient(90deg, rgba(5,18,13,.8), rgba(5,18,13,.5) 55%, rgba(5,18,13,.2)); }
    .hero-content__box { max-width: 100%; padding-right: 16px; }
    .hero-content__title { font-size: 28px; }
    .hero-content__sub { font-size: 14px; max-width: 100%; word-break: break-word; }
    .hero-content__points span { font-size: 12px; padding: 5px 10px; }
    .hero-content__cta { padding: 11px 24px; font-size: 14px; }
}

@media (max-width: 480px) {
    .hero__dots .swiper-pagination-bullet { width: 14px; }
    .hero__dots .swiper-pagination-bullet-active { width: 34px; }
}

/* 触屏：不做 hover 位移，避免误触后卡片停留在抬起状态 */
@media (hover: none) {
    .product-card:hover { transform: none; }
    .product-card:hover::after { opacity: 0; }
    .news-card:hover { transform: none; }
}

/* ---------- 9. 无障碍降级 ---------- */
@media (prefers-reduced-motion: reduce) {
    html.js .reveal { opacity: 1 !important; transform: none !important; }
    .hero .swiper-slide-active .hero__slide-img { animation: none; }
    /* 文字层直接可见，不做位移动画 */
    .hero-content__badge,
    .hero-content__title,
    .hero-content__sub,
    .hero-content__points,
    .hero-content__cta {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}
