/* ==========================================================================
   TKL Trading · base.css —— 重置、排版基准、容器、栅格、响应式变量
   --------------------------------------------------------------------------
   规则（design-spec §0 / §6）：
   1. 所有颜色、字号、间距、圆角、阴影来自 tokens.css 的变量。
      本文件与 components.css / pages.css 不出现裸 HEX。
   2. 移动优先：本文件在 :root 重赋"移动值"，@media (min-width:768px) 起回到
      桌面值。组件里一律只写 font-size: var(--fs-*)。
   3. 断点只有四个：480 / 768 / 1024 / 1280，全部用 min-width 递进。
   ========================================================================== */

/* ------------------------------------------------------------------ 变量覆盖 */
/* tokens.css 给的是桌面基准值；窄屏在这里整体下调，避免组件内写死字号 */
:root {
  --fs-display: 40px;   --lh-display: 1.15;
  --fs-h1: 34px;        --lh-h1: 1.25;
  --fs-h2: 28px;        --lh-h2: 1.3;
  --fs-h3: 22px;        --lh-h3: 1.35;
  --fs-h4: 18px;        --lh-h4: 1.4;
  --fs-lead: 17px;      --lh-lead: 1.6;
  --fs-price: 28px;
  --section-y: 48px;
  --container-pad: 16px;
  --header-h: 56px;
}

@media (min-width: 480px) {
  :root { --container-pad: 20px; }
}

@media (min-width: 768px) {
  :root {
    --fs-display: 48px;
    --fs-h1: 40px;      --lh-h1: 1.22;
    --fs-h2: 32px;      --lh-h2: 1.24;
    --fs-h3: 26px;
    --fs-h4: 19px;
    --fs-lead: 18px;
    --fs-price: 30px;
    --section-y: 64px;
    --container-pad: 24px;
    --header-h: 72px;
  }
}

@media (min-width: 1024px) {
  :root {
    --fs-h1: 46px;
    --fs-h2: 36px;
    --fs-h3: 27px;
    --section-y: 80px;
  }
}

@media (min-width: 1280px) {
  :root {
    --fs-display: 64px;
    --fs-h1: 52px;      --lh-h1: 1.15;
    --fs-h2: 40px;      --lh-h2: 1.2;
    --fs-h3: 28px;
    --fs-h4: 20px;
    --fs-lead: 19px;
    --fs-price: 32px;
    --section-y: 96px;
  }
}

/* ------------------------------------------------------------------ 重置 */
*,
*::before,
*::after { box-sizing: border-box; }

/* hidden 必须压倒组件上的 display（价格门控、空态、抽屉都靠它切态） */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  /* 图片不超过容器，避免小屏横向滚动（design-spec §6.3①） */
  overflow-x: hidden;
}

img,
svg,
video { max-width: 100%; }

img {
  height: auto;
  border-style: none;
}

/* 容器负责比例（aspect-ratio），图片在容器内 100% 填充 + object-fit。
   不再用 img[width][height]{height:auto}——那会压掉组件里的 height:100%，
   导致封面与产品图按原始比例铺开、被容器裁切。 */

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  color: var(--c-text);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-semibold); letter-spacing: var(--ls-h3); }
h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: var(--fw-semibold); letter-spacing: var(--ls-h4); }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; }

a {
  color: var(--c-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-base) var(--ease);
}

a:hover { color: var(--c-link-hover); }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

/* 数字对齐：规格、编码、价格一律 tabular（§2.3 字距规则） */
.num,
time,
.tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* ------------------------------------------------------------------ 焦点 */
:focus-visible {
  outline: var(--bw-thick) solid var(--c-focus);
  outline-offset: 2px;
  border-radius: inherit;
  box-shadow: var(--shadow-focus);
}

:focus:not(:focus-visible) { outline: none; }

/* 深色底上焦点环换金色（6.29:1，§7.2） */
.on-deep :focus-visible,
.footer :focus-visible,
.cta-band :focus-visible,
.select-bar :focus-visible {
  outline-color: var(--c-gold-light);
}

/* --------------------------------------------------------------- 跳过链接 */
.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-toast);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  background: var(--c-primary);
  color: var(--c-on-deep);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-md);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--c-on-deep);
}

/* ------------------------------------------------------------------ 容器 */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow { max-width: 860px; }

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) * 0.66);
}

.section--alt { background: var(--c-bg-alt); }

.section--deep {
  background: var(--c-deep);
  color: var(--c-on-deep);
}

.prose { max-width: var(--prose-max); }

/* ------------------------------------------------------------ 排版小工具 */
.eyebrow {
  display: block;
  margin: 0 0 var(--sp-3);
  color: var(--c-gold-text);
  font-family: var(--font-sans);
  font-size: var(--fs-cap);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-cap);
  line-height: var(--lh-cap);
  text-transform: uppercase;
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--c-n600);
}

.text-muted { color: var(--c-text-muted); }
.text-sm { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.text-meta { font-size: var(--fs-meta); line-height: var(--lh-meta); }

/* 正文内链接必须有下划线，不能只靠颜色（§7.6） */
.link {
  color: var(--c-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 布局工具 */
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }
.stack-xl > * + * { margin-top: var(--sp-8); }

.section-head {
  display: grid;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.section-head__aside { color: var(--c-text-muted); font-size: var(--fs-body); }

@media (min-width: 768px) {
  .section-head--split {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
  }
  .section-head__aside { justify-self: end; max-width: 42ch; text-align: right; }
}

/* 区块分隔线（纯装饰） */
.rule {
  height: 1px;
  background: var(--c-border);
  border: 0;
  margin: 0;
}

/* 减少动效偏好已在 tokens.css 兜底；此处只确保过渡不做位移动画 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
