/* =========================================================
   设计令牌 · 基础层
   尚美利 SML — 2026 高端品牌视觉体系
   ========================================================= */

:root {
  /* 品牌色 */
  --c-ink: #0b0c0e;
  --c-ink-soft: #16181c;
  --c-ink-mute: #2a2d33;
  --c-gold: #c9a96a;
  --c-gold-light: #e6d3a8;
  --c-gold-deep: #a8874b;
  --c-cream: #fbfaf7;
  --c-cream-2: #f4f1ea;
  --c-line: #e6e1d6;
  --c-text: #23262b;
  --c-text-soft: #5d626b;
  --c-text-faint: #8b909a;
  --c-white: #ffffff;
  --c-rose: #b76e79;

  /* 语义色 */
  --bg: var(--c-cream);
  --bg-alt: var(--c-cream-2);
  --bg-dark: var(--c-ink);
  --fg: var(--c-text);
  --fg-soft: var(--c-text-soft);
  --accent: var(--c-gold);
  --border: var(--c-line);

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Optima", "Palatino Linotype", Georgia, "Songti SC", "SimSun",
    "Noto Serif CJK SC", "Source Han Serif SC", "Hiragino Mincho ProN", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 字阶 */
  --fs-hero: clamp(2.4rem, 5.6vw, 5rem);
  --fs-h2: clamp(1.75rem, 3.2vw, 2.75rem);
  --fs-h3: clamp(1.15rem, 1.6vw, 1.4rem);
  --fs-body: clamp(0.95rem, 1.05vw, 1.0625rem);
  --fs-small: 0.875rem;
  --fs-tiny: 0.78rem;

  /* 间距 */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;

  /* 圆角 */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(11, 12, 14, 0.05), 0 2px 8px rgba(11, 12, 14, 0.04);
  --sh-md: 0 4px 16px rgba(11, 12, 14, 0.08), 0 12px 32px rgba(11, 12, 14, 0.06);
  --sh-lg: 0 18px 48px rgba(11, 12, 14, 0.14);
  --sh-gold: 0 10px 30px rgba(201, 169, 106, 0.28);

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 180ms;
  --dur: 320ms;
  --dur-slow: 620ms;

  /* 布局 */
  --container: 1320px;
  --header-h: 76px;
  /* 安全区：iPhone 刘海 / 底部横条，微信内置浏览器同样生效。
     三连写法（定值 → constant() → env()）是长效兼容：
     · 完全不认识安全区 API 的内核保留 0px（否则变量无效 → 所有 calc(...) 连带失效）；
     · iOS 11.0–11.2 只认 constant()；iOS 11.2+ / 现代内核只认 env()。 */
  --safe-t: 0px;
  --safe-t: constant(safe-area-inset-top);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: 0px;
  --safe-b: constant(safe-area-inset-bottom);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --z-header: 80;
  --z-panel: 90;
  --z-modal: 100;
}

/* ---------- 重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 手机 / 平板：更小的头部与标题字号，适配 360–430px 常见机型 */
@media (max-width: 640px) {
  :root {
    --header-h: 62px;
    --fs-hero: clamp(1.9rem, 7.4vw, 2.6rem);
    --fs-h2: clamp(1.4rem, 6vw, 1.9rem);
  }
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* 微信 / 移动端点按不出现灰色高亮块 */
  -webkit-tap-highlight-color: transparent;
  /* 减弱微信下拉露白 / 橡皮筋回弹对观感的影响。
     必须写在 html（真正的视口滚动根）上：写在 body 上不生效。 */
  overscroll-behavior-y: contain;
}

/* 横向溢出只约束 html（见 pages.css「横向滚动根治」注释）。
   body 绝不设 overflow-x:hidden：与 html 双重设置会让 body 沦为嵌套滚动容器，
   iOS / 微信 X5 内核把滚动委托给 body 而页面实际滚 html，二者错位 → 手机端整页无法下滑。 */
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 触屏设备无需 hover 动效，避免点按后样式残留 */
@media (hover: none) {
  .card:hover,
  .product-card:hover {
    transform: none;
    box-shadow: none;
  }
  .btn:hover {
    transform: none;
    box-shadow: none;
  }
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 内联图标精灵统一为「描边」风格（sprite 内均为描边路径，避免渲染成实心块） */
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg use {
  fill: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

[dir="rtl"] {
  text-align: right;
}

/* ---------- 排版工具 ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.14;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--fs-tiny);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--c-gold-deep);
  font-weight: 600;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.lead {
  color: var(--fg-soft);
  font-size: clamp(0.95rem, 1.1vw, 1.08rem);
}

/* ---------- 布局工具 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3rem);
}

.section {
  position: relative;
  padding-block: clamp(3.5rem, 8vw, 7rem);
}

.section--tight {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
}

.section--dark {
  background: var(--bg-dark);
  color: rgba(255, 255, 255, 0.86);
}

.section--alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.85rem;
}

.section--dark .section-head .eyebrow {
  color: var(--c-gold-light);
}

/* ---------- 无障碍 ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--c-gold);
  outline-offset: 3px;
}

/*
 * 跳转链接（可访问性）：隐藏方式必须是「不产生可滚动溢出」的那种。
 * 旧写法 position:absolute + left:-9999px 在 RTL（阿拉伯语）下会把负 x 方向算进
 * documentElement.scrollWidth（实测 11156），使「无横向溢出」断言永远失败；
 * 改用 fixed + 顶部外侧：既脱离文档流不参与横向滚动计算，也不影响键盘可达。
 */
.skip-link {
  position: fixed;
  top: -120px;
  left: 1rem;
  z-index: 200;
  background: var(--c-ink);
  color: #fff;
  padding: 0.6rem 1rem;
}

[dir="rtl"] .skip-link {
  left: auto;
  right: 1rem;
}

.skip-link:focus {
  top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
