/* ==========================================================================
   base.css —— reset + 排版基线 + 无障碍
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 移动端：打开时不要双击缩放放大整页（iOS 会自作主张把宽内容放大） */
  touch-action: pan-x pan-y;
}

body,
h1, h2, h3, h4,
p, figure, blockquote,
dl, dd,
ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;   /* 移动浏览器地址栏收起/展开时，100vh 会把内容顶出去 */
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* 长英文/域名/版本号不要撑破容器 */
  overflow-wrap: break-word;
  /* 点击时不要出现 iOS 那种灰色矩形高亮（给品牌色淡底代替） */
  -webkit-tap-highlight-color: rgba(224, 69, 94, 0.18);
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

img { height: auto; }

a {
  color: var(--brand-ink);
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  /* 必须显式清零：UA 默认的 1px 6px 会把卡片内的图挤出 6px 内缩 */
  padding: 0;
  cursor: pointer;
}

/* 移动端：可点元素的点击延迟与双指缩放行为收敛一下 */
a,
button,
summary,
label,
select,
input,
[role="button"] {
  touch-action: manipulation;
}

dialog {
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
}

/* 组件自己写了 display 时，UA 的 [hidden] 打不过它 —— 必须提高优先级 */
[hidden] { display: none !important; }

/* ---- 排版元件 ---------------------------------------------------------- */
h1, h2, h3, h4 {
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.t-display { font-size: var(--fs-display); }
.t-banner  { font-size: var(--fs-banner); }
.t-dl      { font-size: var(--fs-dl); }
.t-h2      { font-size: var(--fs-h2); }
.t-h3      { font-size: var(--fs-h3); }
.t-name    { font-size: var(--fs-name); }

/* 中文标题里夹的拉丁串 */
.latin {
  font-family: var(--font-latin);
  font-weight: 500;
  letter-spacing: 0.16em;
}

/* 唯一的阅读宽度档：一个元素只挂一个宽度类 */
.prose { max-width: var(--w-prose); }

/* ---- 焦点可见 / 跳转链接 ---------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 200;
  padding: 10px 18px;
  color: var(--text-on-brand);
  background: var(--brand);
  border-radius: var(--r-sm);
  transition: top 0.2s;
}

.skip-link:focus { top: var(--sp-4); }

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

/* ---- 尊重减弱动效偏好 -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
