/**
 * Base — 重置 + 全局排版
 *
 * 引用 Token 变量，禁止硬编码。
 */

/* ── Reset ──────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--en-font-primary);
  font-size: var(--en-fs-p);
  line-height: var(--en-lh-body);
  color: var(--en-color-text);
  background-color: var(--en-color-bg);
  overflow-x: hidden;
  /* Sticky Footer 布局 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* 中英文混排盘古之白 (实验性属性但优雅降级) */
  text-autospace: ideograph-alpha;
}

/* 主内容区弹性填充 */
.site-main {
  flex: 1;
}

/* ── Typography Scale & Utilities ─────────────────────────── */

.en-type-d1 { font-size: var(--en-fs-d1); line-height: var(--en-lh-tight);   font-weight: var(--en-fw-bold); margin-bottom: var(--en-spacing-mb-heading); letter-spacing: -0.02em; }
.en-type-d2 { font-size: var(--en-fs-d2); line-height: var(--en-lh-tight);   font-weight: var(--en-fw-bold); margin-bottom: var(--en-spacing-mb-heading); letter-spacing: -0.01em; }

.en-type-h1, h1 { font-size: var(--en-fs-h1); line-height: var(--en-lh-heading); font-weight: var(--en-fw-semibold); margin-bottom: var(--en-spacing-mb-heading); letter-spacing: -0.01em; }
.en-type-h2, h2 { font-size: var(--en-fs-h2); line-height: var(--en-lh-heading); font-weight: var(--en-fw-semibold); margin-bottom: var(--en-spacing-mb-heading); }
.en-type-h3, h3 { font-size: var(--en-fs-h3); line-height: var(--en-lh-heading); font-weight: var(--en-fw-medium);   margin-bottom: var(--en-spacing-mb-heading); }
.en-type-h4, h4 { font-size: var(--en-fs-h4); line-height: var(--en-lh-heading); font-weight: var(--en-fw-medium);   margin-bottom: var(--en-spacing-mb-heading); }
.en-type-h5, h5 { font-size: var(--en-fs-h5); line-height: var(--en-lh-heading); font-weight: var(--en-fw-medium);   margin-bottom: var(--en-spacing-mb-heading); }
.en-type-h6, h6 { font-size: var(--en-fs-h6); line-height: var(--en-lh-heading); font-weight: var(--en-fw-bold);     margin-bottom: var(--en-spacing-mb-heading); }

.en-type-p-lg   { font-size: var(--en-fs-p-lg);  line-height: var(--en-lh-body); font-weight: var(--en-fw-normal); margin-bottom: var(--en-spacing-mb-body); }
.en-type-p, p   { font-size: var(--en-fs-p);     line-height: var(--en-lh-body); font-weight: var(--en-fw-normal); margin-bottom: var(--en-spacing-mb-body); }
.en-type-p-sm   { font-size: var(--en-fs-p-sm);  line-height: var(--en-lh-body); font-weight: var(--en-fw-normal); margin-bottom: var(--en-spacing-mb-body); }
.en-type-caption, small { font-size: var(--en-fs-caption); line-height: var(--en-lh-body); font-weight: var(--en-fw-normal); margin-bottom: var(--en-spacing-mb-body); color: var(--en-color-muted); }

/* Remove margin from last children to prevent layout shifts */
h1:last-child, h2:last-child, h3:last-child, h4:last-child, h5:last-child, h6:last-child, p:last-child, small:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--en-t-fast);
}

a:hover {
  color: var(--en-color-text-muted);
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* ── Selection ──────────────────────────── */
::selection {
  background-color: var(--en-color-text);
  color: var(--en-color-bg);
}

/* ── Utilities ──────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
