/* =============================================================================
 *  HG-GW 机器人商城 —— 自定义样式
 *  说明：基础排版与栅格由 TailwindCSS 负责，本文件只补充组件级样式与动效。
 *  主题色：#0f0f11 深色背景 / 强调色（默认 #00d8c0 科技青，后台可切换） / 白色文字 / Inter 字体
 * ============================================================================= */

:root {
  --ink:        #0f0f11;   /* 主背景 */
  --ink-2:      #16161a;   /* 次级背景 */
  --ink-3:      #1e1e24;   /* 卡片背景 */
  --line:       rgba(255, 255, 255, .08);
  --accent:     #00d8c0;   /* 主题强调色（后台「主题色」可覆盖） */
  --accent-rgb: 0, 216, 192;
  --accent-dim: rgba(var(--accent-rgb), .12);
  --accent-hover: #22e6cf;
}

/* ------------------------------ 基础 ------------------------------ */
html { scroll-behavior: smooth; }

body {
  background-color: var(--ink);
  color: var(--text);
  /* 字体栈：Inter（拉丁）+ Noto Sans KR（韩文）+ 各系统中文字体，保证多语言下字形正确 */
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'Malgun Gothic', 'Apple SD Gothic Neo', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===========================================================================
   韩文（ko-KR）排版适配
   韩文谚文的字面高度大于拉丁字母，且以空格分词（不在词内换行），
   因此需要：加大行高、放宽字间距、使用 keep-all 断行、避免负字距。
   =========================================================================== */
html[lang="ko-KR"] body {
  line-height: 1.7;
  word-break: keep-all;          /* 韩文按词换行，避免单词被拆断 */
  overflow-wrap: break-word;     /* 超长 URL / 型号仍可强制断行，防溢出 */
}

/* 韩文的字距不宜为负，否则音节会粘连；同时韩文无大小写，取消大写字母的宽字距 */
html[lang="ko-KR"] .hero-title,
html[lang="ko-KR"] .section-title {
  letter-spacing: 0;
  line-height: 1.25;
}

html[lang="ko-KR"] .eyebrow {
  letter-spacing: .02em;
  text-transform: none;
}

/* 韩文正文行高更宽松，便于阅读 */
html[lang="ko-KR"] .rich {
  line-height: 1.95;
}

/* 导航与按钮：韩文比中文更长，略微放宽行高并允许换行，避免文字溢出 */
html[lang="ko-KR"] .nav-link {
  line-height: 1.4;
  white-space: nowrap;
}

html[lang="ko-KR"] .btn {
  line-height: 1.35;
  word-break: keep-all;
}

/* 卡片标题在韩文下可能变长，限制为两行并优雅截断 */
html[lang="ko-KR"] .card-title {
  line-height: 1.45;
  word-break: keep-all;
}

/* 表格单元格：韩文较长时允许换行而不是撑破容器 */
html[lang="ko-KR"] .table-dark td,
html[lang="ko-KR"] .table-dark th {
  word-break: keep-all;
}

/* 深色滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #2a2a32; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a45; }

/* 文字选中 */
::selection { background: var(--accent); color: #04110f; }

/* ------------------------------ 通用组件 ------------------------------ */
.container-x { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* 顶部导航：毛玻璃 */
.nav-bar {
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

/* 导航链接 */
.nav-link {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .5rem .875rem; border-radius: 8px;
  font-size: .875rem; color: var(--text-muted); transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.is-active { color: var(--accent); }
.nav-link.is-active::after {
  content: ''; display: block; position: absolute; bottom: 0; height: 2px; width: 18px;
  background: var(--accent); border-radius: 2px;
}
.nav-link.is-active { position: relative; }

/* 图标按钮 */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  color: var(--text-soft); border: 1px solid transparent; transition: all .2s; cursor: pointer;
  background: transparent;
}
.icon-btn:hover { color: var(--accent); border-color: var(--line); background: var(--surface-hover); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 9999px; font-weight: 600; line-height: 1;
  padding: .75rem 1.5rem; font-size: .875rem;
  transition: all .25s ease; cursor: pointer; border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #04110f; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 10px 30px -10px rgba(var(--accent-rgb), .7); }
.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-dark { background: var(--ink-3); color: var(--text); }
.btn-dark:hover { background: var(--ink-3); opacity: .85; }
.btn-sm { padding: .5rem 1rem; font-size: .8125rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* 卡片：hover 上浮（产品列表要求） */
.card {
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.22,.61,.36,1), border-color .35s, box-shadow .35s;
}
.card:hover {
  transform: translateY(-8px);
  border-color: rgba(var(--accent-rgb), .45);
  box-shadow: 0 24px 50px -24px rgba(var(--accent-rgb), .35);
}
.card:hover .card-img { transform: scale(1.06); }
/* 产品卡主图：完整显示整张图（不裁切），留白处使用白底，与产品图常见的白背景衔接 */
.card-img { transition: transform .6s cubic-bezier(.22,.61,.36,1); background: #fff; }

/* 表单 */
.input-dark {
  width: 100%; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: .7rem .9rem; color: var(--text); font-size: .9rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-dark::placeholder { color: var(--text-faint); }
.input-dark:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); background: var(--ink-3);
}
select.input-dark { appearance: none; background-image: none; }
textarea.input-dark { min-height: 110px; resize: vertical; }
.label-dark { display: block; font-size: .8125rem; color: var(--text-muted); margin-bottom: .4rem; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  border-radius: 9999px; padding: .2rem .6rem;
  font-size: .6875rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent;
}
.badge-accent { background: var(--accent); color: #04110f; }
.badge-outline { border-color: var(--line); color: var(--text-muted); }

/* 购物车角标弹跳 */
@keyframes badgePop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}
.badge-pop { animation: badgePop .38s cubic-bezier(.22,.61,.36,1); }

/* 价格 */
.price-now { color: var(--accent); font-weight: 700; }
.price-old { color: var(--text-faint); text-decoration: line-through; font-size: .8125rem; }

/* 分页 */
.page-btn {
  min-width: 38px; height: 38px; padding: 0 .75rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--text-muted); font-size: .8125rem; transition: all .2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.is-active { background: var(--accent); border-color: var(--accent); color: #04110f; font-weight: 700; }
.page-btn.is-disabled { opacity: .35; pointer-events: none; }
.page-dots { color: var(--text-faint); padding: 0 .25rem; }

/* ------------------------------ 首屏 Banner ------------------------------ */
/* 横幅按原图 1600×593 的比例整幅展示（不裁切），与下方文案上下错开、互不遮挡 */
.hero-banner {
  position: relative; width: 100%; overflow: hidden;
  aspect-ratio: 1600 / 593; background: var(--ink-3);
}
.hero-shot {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: opacity .9s ease;
}
.hero-title { font-size: clamp(2rem, 5.2vw, 4rem); line-height: 1.08; font-weight: 800; letter-spacing: -.02em; }

/* 长标题（如「ZB · 安卓主板 & AIoT 嵌入式解决方案提供商」）：
   平板及以上宽度缩小字号并强制单行，避免折成两行；手机上仍允许换行 */
@media (min-width: 768px) {
  .hero-title--fit {
    font-size: clamp(1.15rem, 2.9vw, 2.1rem);
    line-height: 1.35;
    letter-spacing: 0;
    white-space: nowrap;
  }
}

/* 光晕装饰 */
.glow {
  position: absolute; border-radius: 50%; filter: blur(90px);
  background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 70%);
  pointer-events: none;
}

/* ------------------------------ 滚动进场动画 ------------------------------ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.22,.61,.36,1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* 交错延迟 */
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }

/* ------------------------------ 产品详情图库 ------------------------------ */
.gallery-main {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 18px;
  aspect-ratio: 1 / 1; overflow: hidden;
}
/* 详情页大图同样完整显示（不裁切），比例不符时四周留底色 */
.gallery-main img { width: 100%; height: 100%; object-fit: contain; transition: opacity .3s; }
.gallery-thumb {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  aspect-ratio: 1/1; cursor: pointer; transition: border-color .2s, transform .2s; opacity: .65;
}
.gallery-thumb:hover { opacity: 1; transform: translateY(-2px); }
.gallery-thumb.is-active { border-color: var(--accent); opacity: 1; box-shadow: 0 0 0 2px var(--accent-dim); }

/* 数量步进器 */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button {
  width: 40px; height: 42px; background: var(--ink-2); color: var(--text-soft);
  font-size: 1.1rem; transition: background .2s, color .2s; cursor: pointer;
}
.stepper button:hover { background: var(--ink-3); color: var(--accent); }
.stepper input {
  width: 58px; height: 42px; text-align: center; background: var(--ink);
  border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  color: var(--text); font-size: .9rem;
}
.stepper input:focus { outline: none; }

/* 参数表 */
.spec-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.spec-table tr { border-bottom: 1px solid var(--line); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table th {
  text-align: left; font-weight: 500; color: var(--text-muted);
  padding: .75rem 1rem .75rem 0; width: 40%; vertical-align: top;
}
.spec-table td { padding: .75rem 0; color: var(--text); }
/* 两列参数：每行并排两对「参数名｜参数值」 */
.spec-table-2c th { width: 18%; }
.spec-table-2c td { width: 32%; }
.spec-table-2c th.spec-sep { padding-left: 1.5rem; }
/* 分组小标题行：通栏淡色块 + 强调色标题 */
.spec-table tr.spec-group-row { border-bottom: none; }
.spec-table-2c th.spec-group {
  width: auto; padding: .95rem .9rem .4rem;
  color: var(--accent); font-size: .8125rem; font-weight: 600; letter-spacing: .02em;
  background: rgba(var(--accent-rgb), .1);       /* 淡色块 */
  background-clip: content-box;            /* 背景只覆盖内容区，留出上下间距 */
  border-radius: 8px;
}
.spec-table-2c tr:first-child th.spec-group { padding-top: .1rem; }

/* 富文本详情 */
.rich { color: var(--text-muted); line-height: 1.85; font-size: .9375rem; overflow-wrap: break-word; word-break: break-word; }
.rich p { margin-bottom: 1rem; }
.rich ul { list-style: none; padding-left: 0; margin-bottom: 1rem; }
.rich li { position: relative; padding-left: 1.25rem; margin-bottom: .5rem; }
.rich li::before {
  content: ''; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.rich strong { color: var(--text-strong); }
/* 富文本详情：后台编辑器插入的图文混排内容（标题 / 有序列表 / 引用 / 图片 / 链接） */
.rich h2 { font-size: 1.35rem; font-weight: 700; color: var(--text-strong); margin: 1.5rem 0 .7rem; }
.rich h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-strong); margin: 1.2rem 0 .6rem; }
.rich h4 { font-size: .95rem; font-weight: 600; color: var(--text-strong); margin: 1rem 0 .5rem; }
.rich ol { list-style: decimal; padding-left: 1.4rem; margin-bottom: 1rem; }
.rich ol li { padding-left: 0; }
.rich ol li::before { content: none; }
.rich blockquote { border-left: 3px solid var(--accent); padding-left: .9rem; color: var(--text-muted); margin: 1rem 0; }
.rich > * { max-width: 100%; }
.rich img, .rich video, .rich iframe, .rich svg, .rich canvas { max-width: 100%; height: auto; }
.rich img { border-radius: 12px; margin: .75rem 0; }
/* Word 导入的表格：用 table-layout:fixed 保证列宽比例与原文一致；
   单元格允许长英文/型号折行，避免整表被撑宽 */
.rich table { display: table; width: 100%; max-width: 100%; border-collapse: collapse; }
.rich table.pd-tbl { table-layout: fixed; }
.rich table td, .rich table th { border: 1px solid var(--line); padding: 8px 10px; font-size: .875rem; line-height: 1.6; vertical-align: top; word-break: break-word; }
.rich table th { background: var(--ink-2); font-weight: 600; }
.rich pre { max-width: 100%; overflow-x: auto; }
.rich a { color: var(--accent); text-decoration: underline; word-break: break-all; }
.tab-panel[data-panel="detail"] .card { overflow: visible; }

/* ------------------------------ 页脚 ------------------------------ */
.footer-link { color: var(--text-muted); font-size: .875rem; transition: color .2s, padding-left .2s; display: block; padding: .3rem 0; }
.footer-link:hover { color: var(--accent); padding-left: 4px; }

/* 移动端菜单 */
.mobile-panel {
  max-height: 0; overflow: hidden;
  transition: max-height .4s cubic-bezier(.22,.61,.36,1), opacity .3s;
  opacity: 0;
}
.mobile-panel.is-open { max-height: 70vh; opacity: 1; overflow-y: auto; }

/* 汉堡图标动画 */
.burger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s, opacity .3s; }
.burger span + span { margin-top: 5px; }
.burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 桌面端下拉 */
.dropdown-panel {
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .22s, transform .22s, visibility .22s;
}
.dropdown:hover .dropdown-panel,
.dropdown:focus-within .dropdown-panel { opacity: 1; visibility: visible; transform: none; }

/* 区块标题 */
.section-title { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -.01em; }
.eyebrow { color: var(--accent); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; }

/* 表格（用户中心 / 后台） */
.table-dark { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table-dark thead th {
  text-align: left; color: var(--text-faint); font-weight: 500; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line);
}
.table-dark tbody td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); color: var(--text-soft); }
.table-dark tbody tr { transition: background .2s; }
.table-dark tbody tr:hover { background: var(--surface-hover); }

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===========================================================================
   浅色模式：把 Tailwind 的「浅色文字 / 白色边框 / 白色悬浮背景」反色，
   避免浅色底配浅色字看不见。仅在 html[data-theme="light"] 下生效。
   =========================================================================== */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="light"] .text-white,
html[data-theme="light"] .text-zinc-100 { color: #1a1a1e !important; }
html[data-theme="light"] .text-zinc-200 { color: #2a2a30 !important; }
html[data-theme="light"] .text-zinc-300 { color: #3a3a42 !important; }
html[data-theme="light"] .text-zinc-400 { color: #4a4a52 !important; }
html[data-theme="light"] .text-zinc-500 { color: #6b6b78 !important; }
html[data-theme="light"] .text-zinc-600 { color: #7a7a86 !important; }

html[data-theme="light"] .border-white,
html[data-theme="light"] .border-white\/5  { border-color: rgba(0, 0, 0, .06) !important; }
html[data-theme="light"] .border-white\/8,
html[data-theme="light"] .border-white\/10 { border-color: rgba(0, 0, 0, .1) !important; }
html[data-theme="light"] .border-white\/15 { border-color: rgba(0, 0, 0, .13) !important; }
html[data-theme="light"] .border-white\/20 { border-color: rgba(0, 0, 0, .16) !important; }

html[data-theme="light"] .bg-white\/5,
html[data-theme="light"] .bg-white\/\[0\.03\],
html[data-theme="light"] .bg-white\/\[0\.04\],
html[data-theme="light"] .bg-white\/\[0\.05\],
html[data-theme="light"] .bg-white\/\[0\.06\] { background: rgba(0, 0, 0, .04) !important; }

html[data-theme="light"] .hover\:bg-white\/5:hover,
html[data-theme="light"] .hover\:bg-white\/\[0\.03\]:hover,
html[data-theme="light"] .hover\:bg-white\/\[0\.05\]:hover { background: rgba(0, 0, 0, .05) !important; }

html[data-theme="light"] .divide-white\/5 > * + * { border-color: rgba(0, 0, 0, .06) !important; }
html[data-theme="light"] .ring-white\/10 { --tw-ring-color: rgba(0, 0, 0, .1) !important; }

/* 浅色模式下产品卡主图白底与页面白底过于融合，给一点描边区分 */
html[data-theme="light"] .card-img { box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
