/* ==========================================================================
   base.css —— 基础样式：Reset + 排版 + 通用元素
   --------------------------------------------------------------------------
   维护说明：只放"元素级"默认样式，不放任何页面/组件样式。
   ========================================================================== */

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* 锚点跳转时预留固定头部高度，避免标题被遮挡 */
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-bg);
  /* 防止子元素溢出产生横向滚动条 */
  overflow-x: hidden;
}

/* ---- 标题层级：仅定义字号节奏，颜色随分区 ---- */
h1 { font-size: var(--fs-h1); line-height: 1.3; }
h2 { font-size: var(--fs-h2); line-height: 1.35; }
h3 { font-size: var(--fs-h3); line-height: 1.4; }
h4 { font-size: var(--fs-h4); line-height: 1.5; }

p { margin-bottom: var(--space-sm); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-accent-hover); }

ul, ol { padding-left: 1.25em; }

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---- 表格（品牌 / 方案 / 客户列表通用） ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
thead th {
  background: #a6f1f4;
  color: var(--color-primary);
  font-weight: 600;
  white-space: nowrap;
}
/* 芯片代理页专属：表头已与全局统一为 #a6f1f4 */
.page-chip thead th { background: #a6f1f4; }

/* 客户表格专属：tbody 白底 */
.table--white { background: #fff; }
.table--white thead th { background: #a6f1f4; }

/* 小屏下表格允许横向滑动（包裹层），不撑破页面 */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.table-scroll table { min-width: 560px; }
.table-scroll th:first-child,
.table-scroll td:first-child { padding-left: 1.25rem; }

/* ---- 无障碍：仅供屏幕阅读器的文本 ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- 键盘焦点可见性 ---- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---- 用户开启"减少动态效果"时关闭动画 ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
