/* ============================================================
   base.css —— 重置、排版、自定义光标
   ============================================================ */

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

/* 背景色必须设在 html 上，不只设在 body 上，否则 body 外区域会闪白 */
html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 排版 ---------- */

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.9rem, 5.2vw, 3rem);
  letter-spacing: -0.025em;
  font-weight: 650;
}

h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
h3 { font-size: 1.05rem; }

p { color: var(--text-2); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--text); }

strong { color: var(--text); font-weight: 600; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* 跳转到主内容——键盘用户按 Tab 第一下就能跳过导航 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
}
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

/* ============================================================
   自定义鼠标光标
   三态：默认箭头 / 悬停链接变圆环 / 悬停文字变 I 形
   仅在精确指针设备启用，触屏和「减弱动态效果」下自动跳过
   ============================================================ */

.cursor-fx {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}
.cursor-fx.on { opacity: 1; }

.cursor-fx .cf-arrow {
  display: block;
  margin: -3px 0 0 -4px;
  transform-origin: 4px 3px;
}
.cursor-fx .cf-arrow path {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2.2;
  stroke-linejoin: round;
  paint-order: stroke;
}

.cursor-fx i {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  opacity: 0;
  transform: scale(.5);
}

/* 悬停链接/按钮 → 圆环 */
.cursor-fx .cf-ring {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
}

/* 悬停正文 → I 形光标 */
.cursor-fx .cf-text {
  width: 2px;
  height: 20px;
  margin: -10px 0 0 -1px;
  border-radius: 2px;
  background: var(--accent);
}

.cursor-fx .cf-arrow,
.cursor-fx i {
  transition: opacity .12s ease-out, transform .12s ease-out;
}

.cursor-fx.is-link .cf-arrow,
.cursor-fx.is-text .cf-arrow { opacity: 0; transform: scale(.5); }

.cursor-fx.is-link .cf-ring,
.cursor-fx.is-text .cf-text { opacity: 1; transform: scale(1); }

/* 只在启用时才隐藏原生光标——JS 没跑起来就不会走到这里 */
html.has-cursor-fx,
html.has-cursor-fx * { cursor: none !important; }

/* 输入框保留原生光标，否则打字时看不见插入点在哪 */
html.has-cursor-fx input[type="text"],
html.has-cursor-fx input[type="search"],
html.has-cursor-fx textarea,
html.has-cursor-fx [contenteditable="true"] { cursor: auto !important; }

@media (prefers-reduced-motion: reduce) {
  .cursor-fx { display: none !important; }
}
