/* =========================================================
   3348.cc · 设计令牌（Design Tokens）
   设计语言：Apple Store
   - 白 / 浅灰双层底色，弱边框，无重阴影
   - SF Pro 无衬线字体栈，靠字重与字距建立层级
   - 单一强调色 #0071e3，只用于可点击行动点
   - 大圆角（12/18/28/980）与克制的动效曲线
   本文件是唯一变量来源，其余样式表只消费不定义。
   ========================================================= */

:root {
  /* ---------- 颜色：浅色层 ---------- */
  --bg-page: #ffffff;
  --bg-subtle: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-inset: #fafafa;
  --bg-dark: #0e2323;          /* 深墨绿，仅用于品牌锚点区块 */

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-on-dark: #f5f5f7;
  --text-on-dark-dim: #a1a1a6;

  --line: #d2d2d7;
  --line-soft: rgba(0, 0, 0, 0.08);
  --line-strong: #86868b;

  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.08);
  --green: #1d8a4e;
  --amber: #b45309;
  --red: #d70015;

  /* ---------- 颜色：语义别名（兼容旧类名） ---------- */
  --ink: var(--text-primary);
  --ink-2: var(--text-secondary);
  --muted: var(--text-tertiary);
  --bg: var(--bg-page);
  --bg-2: var(--bg-subtle);
  --card: var(--bg-elevated);
  --brand: var(--text-primary);
  --brand-2: #000000;
  --brand-soft: var(--bg-subtle);
  --accent: var(--blue);
  --accent-2: var(--blue);
  --accent-soft: var(--blue-soft);
  --ok: var(--green);
  --warn: var(--amber);
  --danger: var(--red);
  --primary: var(--blue);
  --text: var(--text-primary);

  /* ---------- 字体 ---------- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --font-num: var(--font-display);
  --font-serif: var(--font-display); /* 兼容旧引用：不再使用衬线体 */

  /* ---------- 字号阶梯 ---------- */
  --fs-display: clamp(2.5rem, 5.4vw, 4.5rem);
  --fs-h1: clamp(2rem, 3.6vw, 3rem);
  --fs-h2: clamp(1.5rem, 2.4vw, 2rem);
  --fs-h3: 1.25rem;
  --fs-body: 1.0625rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;

  /* ---------- 圆角 ---------- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 28px;
  --r-pill: 980px;
  /* 兼容旧变量 */
  --radius: var(--r-md);
  --radius-lg: var(--r-lg);

  /* ---------- 阴影 ---------- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.16);

  /* ---------- 动效 ---------- */
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 480ms;

  /* ---------- 布局 ---------- */
  --wrap: 1180px;
  --wrap-wide: 1440px;
  --nav-h: 52px;
  --gutter: 22px;
}

/* ---------- 深色模式：黑底 + 抬升卡片 ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #000000;
    --bg-subtle: #1d1d1f;
    --bg-elevated: #1d1d1f;
    --bg-inset: #161617;
    --bg-dark: #050d0d;

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #86868b;

    --line: #424245;
    --line-soft: rgba(255, 255, 255, 0.1);

    --blue: #2997ff;
    --blue-hover: #51a9ff;
    --blue-soft: rgba(41, 151, 255, 0.14);
    --green: #30d158;
    --amber: #ffd60a;
    --red: #ff453a;

    --brand: var(--text-primary);
    --brand-2: #ffffff;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 34px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.7);
  }
}

/* =========================================================
   基础重置
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration: none; transition: color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}

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

/* ---------- 可访问性：键盘焦点环 ---------- */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 999;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- 容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap-wide {
  width: 100%;
  max-width: var(--wrap-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* =========================================================
   通用控件：按钮 / 分段控件 / 输入框
   ========================================================= */
.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-size: var(--fs-body);
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); color: #fff; }

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--line-soft); color: var(--text-primary); }

.btn-outline {
  border: 1px solid var(--line);
  color: var(--text-primary);
  background: transparent;
}
.btn-outline:hover { background: var(--bg-subtle); color: var(--text-primary); }

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: var(--fs-body);
}
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.btn-sm { --btn-h: 34px; padding: 0 16px; font-size: var(--fs-sm); }
.btn-lg { --btn-h: 50px; padding: 0 30px; font-size: 1.0625rem; }

/* 分段控件（Apple segmented control） */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }

.segmented > button {
  flex: 0 0 auto;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.segmented > button:hover { color: var(--text-primary); }
.segmented > button[aria-pressed="true"],
.segmented > button.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

/* 文本输入 */
.field {
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-page);
  font-size: var(--fs-body);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.field::placeholder { color: var(--text-tertiary); }
.field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

/* 徽标 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* ---------- 动效：尊重系统偏好 ---------- */
@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;
  }
}
