/* ==========================================================================
   基础样式：重置、排版、通用工具
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

dl,
dd,
dt {
  margin: 0;
}

p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--head);
}

blockquote {
  margin: 0;
}

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

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

/* ---- 布局容器 ---- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section-note {
  margin-top: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.section-note .icon {
  color: var(--accent);
  width: 16px;
  height: 16px;
  flex: none;
}

.section-more {
  margin-top: 2.5rem;
}

/* ---- 通用文本 ---- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-head {
  max-width: 68ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head.is-center {
  margin-inline: auto;
  text-align: center;
}

.section-title {
  font-size: var(--fs-h2);
}

.section-desc {
  margin-top: 1rem;
  color: var(--text-2);
  font-size: 1.02rem;
  max-width: 62ch;
}

.section-head.is-center .section-desc {
  margin-inline: auto;
}

/* ---- 图标 ---- */
.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---- 链接箭头 ---- */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--accent);
  transition: gap var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.link-arrow .icon {
  width: 15px;
  height: 15px;
}

a:hover > .link-arrow,
.link-arrow:hover {
  gap: 0.8rem;
}

/* ---- 滚动揭示 ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* 带 --i 的子项按顺序错峰入场 */
[data-reveal] [style*='--i'] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

[data-reveal].is-visible [style*='--i'] {
  opacity: 1;
  transform: none;
}

/* ---- 无障碍 ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.7rem 1.2rem;
  border-radius: 0 0 var(--r-sm) 0;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- 背景网格（用于多次复用的装饰） ---- */
.bg-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal],
  [data-reveal] [style*='--i'] {
    opacity: 1;
    transform: none;
  }
}
