/* ==========================================================================
   GPT68 · Base
   全局 reset + 移动端关键属性。
   现代浏览器 (iOS Safari 14+ / Chrome 90+) only,放弃 IE 兼容。
   ========================================================================== */

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

/* ---------- HTML root: 移动端硬伤修复集中地 ---------- */
html {
  /* 防止 iOS 横屏后自动放大字号 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  /* 平滑滚动(锚点跳转用) */
  scroll-behavior: smooth;

  /* 锚点跳转时为顶栏留 80px,不再被遮挡(替代 JS 手动 offset) */
  scroll-padding-top: 80px;

  /* iOS 点击高亮去掉,改用 :active 自定义反馈 */
  -webkit-tap-highlight-color: transparent;

  /* 防 iOS 橡皮筋滚动穿透到容器外 */
  overscroll-behavior-y: none;
}

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

/* ---------- Body ---------- */
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* 用 dvh 替代 100vh:iOS Safari 工具栏伸缩时不会溢出 */
  min-height: 100dvh;
  position: relative;

  /* 适配 iPhone 横屏时的安全区左右内边距 */
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ---------- Media defaults ---------- */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 行内 SVG 防御性兜底 */
svg:not([width]):not([height]) {
  max-width: 100%;
  max-height: 2.5em;
}

h1, h2, h3, h4, p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
  /* 关键移动端属性:消除 iOS 点击 300ms 延迟 + 防止双击缩放 */
  touch-action: manipulation;
}

button {
  font-family: inherit;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  /* 同上 */
  touch-action: manipulation;
}

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

/* ---------- Accessibility ---------- */
.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;
}

.sr-only:focus,
.sr-only:focus-visible {
  position: fixed; top: 12px; left: 12px;
  width: auto; height: auto; padding: 10px 16px;
  background: var(--ink-1); color: #fff;
  border-radius: var(--radius-sm);
  clip: auto; z-index: 1000;
}

::selection { background: var(--blue-100); color: var(--ink-1); }

/* ---------- Focus ring 可见性(键盘用户) ---------- */
:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ==========================================================================
   全局触控热区保障
   所有按钮、链接、菜单项至少 44×44 的可点击区域。
   移动端用 :where() 降低优先级,允许组件覆盖。
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  :where(.btn, .btn-sm, .nav-cta, .blog-nav-cta, .mobile-bar-item, .faq-trigger) {
    min-height: var(--touch-target);
  }
}

/* ---------- 打印样式 ---------- */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .topnote, .bg-deco, .cta-qr, .mobile-bar { display: none; }
  a { color: inherit; text-decoration: underline; }
}

/* ==========================================================================
   性能优化
   ========================================================================== */

/* 视口外的复杂区域跳过渲染,提升滚动帧率 */
.wechat-scroll,
.section-wechat,
.section-cta {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

/* 触控设备 / 弱机器 / 用户偏好低动效时:关掉背景大动画 */
@media (prefers-reduced-motion: reduce) {
  .bg-mesh { animation: none !important; }
}

/* 低数据偏好(手机省流量模式):背景渐变退化为纯色 */
@media (prefers-reduced-data: reduce) {
  .bg-mesh { background: var(--bg-base) !important; animation: none !important; }
  .bg-deco::after { display: none !important; }
}
