/* ========================================================================
   components.css — 复用组件：顶栏 / 导航 / 按钮 / 卡片 / Hero / Footer
   ======================================================================== */

/* 语言切换器 - 下拉框样式 */
.lang-switch { position: relative; display: inline-block; }
.lang-switch-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--c-white); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; padding: 5px 10px; border-radius: 6px;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.lang-switch-btn:hover { background: var(--bg-soft); border-color: var(--brand); }
.lang-switch-btn .flag { font-size: 16px; line-height: 1; }
.lang-switch-btn .arrow { font-size: 10px; opacity: .7; transition: transform .2s; }
.lang-switch.open .lang-switch-btn .arrow { transform: rotate(180deg); }
.lang-switch-list {
  display: none; position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--c-white); border: 1px solid var(--c-gray-100); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 1000;
  min-width: 180px; max-height: 360px; overflow-y: auto;
  padding: 4px 0; margin: 0;
}
.lang-switch.open .lang-switch-list { display: block; }
.lang-switch-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--c-gray-700);
  transition: background .1s; border: 0; background: none; width: 100%; text-align: left;
}
.lang-switch-option:hover { background: var(--c-gray-50); }
.lang-switch-option.active { background: var(--c-blue-50-4); color: var(--c-blue-500-2); font-weight: 600; }
.lang-switch-option .flag { font-size: 18px; line-height: 1; }
.lang-switch-option .name { flex: 1; }
.lang-switch-option .code { font-size: 11px; color: var(--c-gray-400); text-transform: uppercase; }
.lang-sep { display: none; }

/* ---------- 主头部 Header ---------- */
.header {
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.95);
  backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border);
}
.header .container { display: flex; align-items: center; gap: 20px; height: var(--header-h); max-width: none; padding: 0 32px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--brand); font-size: 1.15rem; }
.logo img { height: 36px; width: auto; }
.logo .logo-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--brand); color: var(--c-white); display: grid; place-items: center; font-size: 1rem; }
/* Logo 图片（<img class="logo-mark">）：方形透明 PNG，保留透明、不裁圆、不变形 */
.logo img.logo-mark { object-fit: contain; width: 36px; height: 36px; background: transparent; }

.main-nav { margin-left: auto; display: flex; gap: 4px; }
.main-nav a {
  color: var(--text); font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 6px;
}
.main-nav a:hover, .main-nav a.is-active { color: var(--brand); background: var(--brand-light); }

.header-actions { display: flex; align-items: center; gap: 14px; margin-left: 8px; }
.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text); border: 1px solid var(--border); background: var(--c-white); transition: var(--t); }
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.cart-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: var(--c-white); font-size: .7rem; font-weight: 700; border-radius: 999px;
  display: grid; place-items: center; line-height: 1;
}

/* 账户图标两态（未登录=默认白底线性人形；已登录=.is-authed 品牌色底+徽标点）。
   类由 main.js syncAuthUI() 切换；徽标锚点 .account-dot 由壳层 build-core 烘焙、默认 hidden。 */
.account-dot {
  position: absolute; top: 1px; right: 1px; width: 10px; height: 10px;
  background: var(--c-emerald-600); border: 2px solid var(--c-white); border-radius: 50%;
}
.icon-btn.is-authed { background: var(--brand); border-color: var(--brand); color: var(--c-white); }
.icon-btn.is-authed:hover { filter: brightness(1.08); color: var(--c-white); }
.icon-btn.is-authed svg { fill: currentColor; }

/* dashboard hero 两栏布局 + 深色 hero 上的退出按钮（account/dashboard.html，
   退出逻辑 = dashboard.js #logoutBtn 清 token 跳首页；文案由 dashboard.js 经
   account.locale 的 account.logout 键本地化，17 语言齐）。
   2026-09-16 客户裁定：默认白底实心，悬停反转为描边透明。 */
.hero-flex { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.btn--hero { background: var(--c-white); border-color: var(--c-white); color: var(--brand-dark); }
.btn--hero:hover { background: transparent; color: var(--c-white); border-color: rgba(255,255,255,.85); }

/* 移动端汉堡 */
.nav-toggle { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius); font-weight: 700; font-size: .95rem;
  border: 1px solid transparent; transition: var(--t); cursor: pointer; white-space: nowrap;
  flex: 0 0 auto;
}
.btn--primary { background: var(--brand); color: var(--c-white); }
.btn--primary:hover { background: var(--brand-dark); color: var(--c-white); }
.btn--outline { background: var(--c-white); color: var(--brand); border-color: var(--brand); }
.btn--outline:hover { background: var(--brand-light); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: .85rem; }

/* ---------- Hero ---------- */
.hero { position: relative; color: var(--c-white); overflow: hidden; }
.hero__slide {
  position: relative; min-height: 130px; display: flex; align-items: flex-end; overflow: hidden;
  background: linear-gradient(120deg, var(--brand-dark) 0%, var(--brand) 60%, var(--c-blue-500) 100%);
}
.hero__inner { max-width: var(--container); margin: 0 auto; padding: 20px 20px; width: 100%; }
.hero__content { max-width: 620px; }
.hero h1 { color: var(--c-white); font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 16px; }
.hero p { font-size: 1.12rem; color: rgba(255,255,255,.9); margin-bottom: 28px; }
.hero .btn-row { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn--outline { color: var(--c-white); background: transparent; border-color: rgba(255,255,255,.6); }
.hero .btn--outline:hover { background: rgba(255,255,255,.12); }
.hero__deco { position: absolute; right: -5%; top: 50%; transform: translateY(-50%); width: 50%; max-width: 550px; height: auto; pointer-events: none; }
/* 世界地图网络（首页 Hero 右侧装饰，图案见 tools/build/gen-hero-worldmap.py）
   —— 1) 正文层抬到图案之上：装饰是 <img> 且位于 DOM 靠后，不抬会被它盖住；
         2) 图案「右缘对齐内容盒 + 宽度只占正文右侧空档 + 左侧短渐隐」三者合起来，
            保证【不被 hero 的 overflow:hidden 裁掉】+【正文与图案之间不留大片空档】
            +【不压正文】同时成立。三个量的实测推导见下面 .hero__deco--map 的注释。 */
.hero__inner { position: relative; z-index: 1; }
.hero__deco--map {
  /* 右缘对齐「正文所在的内容盒」右缘，而不是 hero 的全幅右缘。
     hero 是全幅的，而 .hero__inner 有 max-width(--container = 1440px) 且居中 ⇒
     若把装饰锚在 hero 右缘，视口越宽装饰越往右跑，被 hero 的 overflow:hidden 裁掉：
     实测 vw1440 裁 101px、vw1920 裁 134px，且正文与图案之间的空档同步拉大。
     max(20px, …) 的语义：视口 ≤1440 时退化为「距右缘一个内边距」（与 .hero__inner 的
     左右 padding 对齐）；视口 >1440 时自动跟随内容盒居中。 */
  right: max(20px, calc((100% - var(--container)) / 2 + 20px));
  /* 宽度 = 「正文盒右缘 → 内容盒右缘」那段空档，而不是视口的固定百分比。
     660px = .hero__content 的 max-width 620 + .hero__inner 的左 padding 20 ⇒
     视口 ≤1440 时图案恰好只占正文右侧的空白带，**正文与图案之间的大空档被结构性消掉**，
     不必靠拉长渐隐去凑；同时也避免视口越窄、图案相对内容盒占比越大而压到标题。
     （实测 width:62% 在 vw1092 时图案 677px 反压正文盒 245px —— 那是最初的缺陷形态。）
     视口 >1440 时 calc 超出 800px，由 max-width 封顶，回到与历史一致的尺寸。 */
  width: min(62%, calc(100% - 660px));
  max-width: 800px;
  /* 左侧渐隐四档：0% 全透明 → 7% 只留 6% → 14% 半透 → 24% 全显。
     24%（而非上一版的 48%）配合上面的「填满空档」宽度，使正文墨迹右界到图案实心处
     只剩一两百像素的过渡带；正文墨迹始终落在近乎全透明的区间内。
     只用到 alpha（mask 对渐变按 alpha 取值），故四档统一写 rgba(0,0,0,·)：
     既让"渐隐程度"一眼可读，也避免在令牌管理的样式表里留裸 hex（V5）。 */
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .06) 7%, rgba(0, 0, 0, .55) 14%, rgba(0, 0, 0, 1) 24%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .06) 7%, rgba(0, 0, 0, .55) 14%, rgba(0, 0, 0, 1) 24%);
}

/* ---------- 分类卡片 ---------- */
.cat-card {
  position: relative; display: block; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); background: var(--c-white); transition: var(--t); aspect-ratio: 4 / 3;
}
.cat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); }
.cat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.cat-card:hover img { transform: scale(1.06); }
.cat-card__overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0) 60%);
  color: var(--c-white);
}
.cat-card__name { font-weight: 700; font-size: 1.05rem; }
.cat-card__count { font-size: .8rem; opacity: .85; }

/* ---------- 产品卡片 ---------- */
.product-card {
  background: var(--c-white); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column; transition: var(--t);
}
.product-card:hover { box-shadow: var(--shadow-hover); border-color: var(--c-gray-100-3); transform: translateY(-3px); }
.product-card__media { position: relative; aspect-ratio: 1 / 1; background: var(--bg-soft); overflow: hidden; }
.product-card__media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; transition: transform .4s ease; }
.product-card:hover .product-card__media img { transform: scale(1.05); }
.product-card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-card__cat { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; }
.product-card__title { font-size: 1rem; font-weight: 700; line-height: 1.35; margin: 0; flex: 1; overflow: hidden; max-height: 1.35em; }
.product-card__title a { color: var(--text); }
.product-card__title a:hover { color: var(--brand); }
.product-card__price { color: var(--text); font-weight: 800; font-size: 1.15rem; }
.product-card__stock { font-size: .8rem; padding: 2px 8px; border-radius: 4px; display: inline-block; }
.product-card__stock.out { background: var(--c-red-50-2); color: var(--c-red-500); }
.product-card__stock.low { background: var(--c-amber-100); color: var(--c-orange-600-2); }
.product-card__foot { display: flex; gap: 8px; margin-top: 6px; }
.product-card__foot .btn { flex: 1; }

/* 营销信息丰富版（参考图布局） */
.product-card__promo { font-size: .82rem; font-weight: 700; color: var(--brand); margin: 0; }
.product-card__intro { font-size: .82rem; color: var(--muted); line-height: 1.5; margin: 0; }
.product-card__pricebox { display: flex; align-items: baseline; gap: 6px; padding: 7px 0 2px; border-top: 1px dashed var(--border); }
.product-card__price { color: var(--text); font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.product-card__fob { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.product-card__specs { list-style: none; margin: 4px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.product-card__specs li { display: flex; flex-direction: column; gap: 1px; }
.product-card__specs li span { font-size: .68rem; color: var(--muted); }
.product-card__specs li b { font-size: .8rem; color: var(--text); font-weight: 700; }

/* ---------- 品牌优势 info-box ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature { text-align: center; padding: 12px; }
.feature__icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand); display: grid; place-items: center;
}
.feature__icon svg { width: 28px; height: 28px; }
.feature h3 { font-size: 1.05rem; margin: 0 0 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------- CTA 横幅 ---------- */
.cta-banner {
  background: linear-gradient(120deg, var(--brand-dark), var(--brand));
  color: var(--c-white); border-radius: var(--radius-lg); padding: 48px; text-align: center;
}
.cta-banner h2 { color: var(--c-white); }
.cta-banner p { color: rgba(255,255,255,.9); max-width: 560px; margin: 0 auto 24px; }
.cta-banner .btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: nowrap; align-items: center; }
.cta-banner .btn-row .btn,
.cta-banner .btn-row .btn--whatsapp { flex: 0 0 auto; max-width: none; }
.btn--whatsapp {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-emerald-500); color: var(--c-white); border: none;
  padding: 11px 22px; border-radius: var(--radius); font-size: .95rem; font-weight: 700;
  transition: filter .2s; cursor: pointer; text-decoration: none; white-space: nowrap;
  flex: 0 0 auto;
}
.btn--whatsapp:hover { filter: brightness(0.92); color: var(--c-white); }
.btn--whatsapp svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; display: block; }

/* ---------- 页脚 Footer ---------- */
.footer { background: var(--bg-soft); color: var(--text); font-size: .9rem; }
.footer .container { max-width: none; padding: 0 32px; }
.footer a { color: var(--brand); }
.footer a:hover { color: var(--brand-dark); }
.footer__top { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 56px 0; justify-items: start; }
.footer__brand .logo { color: var(--brand); margin-bottom: 14px; }
.footer__brand p { max-width: 320px; }
.footer h4 { color: var(--text); font-size: .95rem; margin: 0 0 16px; }
.footer__col ul { display: grid; gap: 10px; }
.footer__contact li { display: flex; gap: 8px; align-items: flex-start; }
.footer__bottom {
  border-top: 1px solid var(--border); padding: 20px 0; display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; font-size: .82rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .footer__top { grid-template-columns: 1fr 1fr; }
  .main-nav { display: none; }
  .nav-toggle { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); background: var(--c-white); border-radius: 8px; margin-left: auto; }
  .main-nav.is-open {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--c-white); padding: 12px 20px; box-shadow: var(--shadow); border-top: 1px solid var(--border);
  }
  /* 移动端按钮触摸优化 */
  .btn { min-height: 44px; padding: 12px 24px; }
  .icon-btn { width: 44px; height: 44px; }
  /* 世界地图网络：窄屏下右侧装饰的绝对定位必然横穿正文，故改落位为「整幅底纹」——
     居中放大到 192%、关掉左侧渐隐（留着只剩右半张，像图坏了），
     并把图案自身压暗（蓝色渐变背景保持原样，不叠蒙版）。 */
  .hero__deco--map {
    right: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 192%; max-width: none; opacity: .24;
    -webkit-mask-image: none; mask-image: none;
  }
}
@media (max-width: 640px) {
  /* 超小屏幕优化 */
  :root {
    --header-h: 56px;
  }
  .footer__top { grid-template-columns: 1fr; }
  .section { padding: 32px 16px; }
  .hero__slide { min-height: 140px; }
  .hero__inner { padding: 24px 16px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: .95rem; }
  .hero .btn-row { flex-direction: column; }
  .hero .btn-row .btn { width: 100%; }
  .cta-banner { padding: 32px 20px; }
  .cta-banner h2 { font-size: 1.3rem; }
  .cta-banner p { font-size: .9rem; }
  /* 产品卡片移动端 */
  .product-card__body { padding: 12px; }
  .product-card__title { font-size: .9rem; }
  .product-card__price { font-size: 1rem; }
  .product-card__foot .btn { font-size: .85rem; padding: 10px 12px; }
  /* 分类卡片移动端 */
  .cat-card__overlay { padding: 14px; }
  .cat-card__name { font-size: .95rem; }
  .cat-card__count { font-size: .75rem; }
  /* 导航链接移动端 */
  .main-nav a { padding: 12px 16px; font-size: 1rem; }
  /* 页脚移动端 */
  .footer { font-size: .85rem; }
  .footer h4 { font-size: .9rem; }
  .footer__bottom { flex-direction: column; text-align: center; }
  /* 产品详情页移动端 */
  .pd-gallery__thumbs { flex-wrap: wrap; }
  .pd-gallery__thumbs img { width: 60px; height: 60px; }
  .pd-price { font-size: 1.5rem; }
  .pd-actions { flex-direction: column; }
  .pd-actions .btn { min-width: auto; }
}

/* About 页面动态内容加载 - 隐藏静态占位，由 JS 接管渲染 */
.about-intro.js-dynamic-hide,
.timeline.js-dynamic-hide,
.cert-grid.js-dynamic-hide,
.grid.grid--3.js-dynamic-hide {
  display: none;
}
