/* ============================================================================
   咔嗒 KADA · base.css
   只做全站共用：设计令牌 / 重置 / 排版 / 容器 / 按钮 / 动效基元 / 响应式基线
   色板取自产品设计规范：墨色 #111318 / 品牌红 #D51F2C / 奶油 #FCFBFA
   规则：品牌红只给「可点击 / 正在进行」，不用于装饰
   ========================================================================== */

/* ---------------------------------------------------------------- 1. 令牌 */
:root {
  /* 表面 —— 墨色系，取自桌面端深色主题 */
  --ink-900: #111318;
  --ink-850: #15181e;
  --ink-800: #1a1e25;
  --ink-750: #20252d;
  --ink-700: #262c35;
  --paper: #fcfbfa;
  --paper-2: #f1efed;

  /* 文字 */
  --text: #f2f3f5;
  --text-2: #a7aeb8;
  --text-3: #6e7480;
  --ink-text: #111318;
  --ink-text-2: #4b515c;

  /* 品牌红（规范内唯一色值，未新增） */
  --brand: #d51f2c;
  --brand-deep: #b3161f;
  --brand-2: #e63946;
  --brand-3: #f26b74;
  --brand-4: #f7a3a8;
  --heat: linear-gradient(90deg, #7d1017 0%, #b3161f 42%, #d51f2c 74%, #e8555f 100%);
  --heat-soft: linear-gradient(90deg, rgba(179, 22, 31, .5), rgba(213, 31, 44, .34) 66%, rgba(232, 85, 95, .2));

  /* 预检语义色（规范已有：成功 / 警告 / 拦截） */
  --ok: #1e7a46;
  --warn: #b26b00;
  --danger: #d51f2c;

  /* 描边 */
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --line-dark: rgba(17, 19, 24, .13);
  --line-dark-2: rgba(17, 19, 24, .26);

  /* 字体 —— 零外部字体：系统中文字 + 等宽做"仪表"气质 */
  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Source Han Sans SC",
    "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas,
    "Liberation Mono", monospace;

  /* 半径 —— 克制的三种，不出现第四种 */
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;

  /* 节奏 */
  --gut: clamp(20px, 4.6vw, 56px);
  --max: 1240px;
  --row: 34px; /* 桌面端列表行高，站点复用同一节奏 */

  /* 动效 */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-out: cubic-bezier(.2, 0, 0, 1);
  --t-fast: 160ms;
  --t-base: 280ms;
  --t-slow: 640ms;
}

/* ---------------------------------------------------------------- 2. 重置 */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }

::selection {
  background: rgba(225, 29, 46, .32);
  color: #fff;
}

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

/* ---------------------------------------------------------------- 3. 排版 */
.h1 {
  font-size: clamp(32px, 4.6vw, 64px);
  line-height: 1.04;
  letter-spacing: -.035em;
  font-weight: 800;
}

.h2 {
  font-size: clamp(26px, 3.3vw, 46px);
  line-height: 1.1;
  letter-spacing: -.032em;
  font-weight: 800;
}

.h3 {
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.35;
  letter-spacing: -.018em;
  font-weight: 700;
}

.lead {
  font-size: clamp(15px, 1.15vw, 17.5px);
  line-height: 1.75;
  color: var(--ink-text-2);
}

.body-s { font-size: 14.5px; line-height: 1.72; color: var(--ink-text-2); }
.muted { color: var(--ink-text-2); opacity: .7; }

/* 等宽小标签：全站编号、版本号、指标都用它，形成"仪表"语汇 */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: .02em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--heat);
}

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

/* ---------------------------------------------------------------- 4. 布局 */
.wrap {
  width: min(var(--max), 100% - var(--gut) * 2);
  margin-inline: auto;
}

.sec {
  position: relative;
  padding: clamp(64px, 8vw, 128px) 0;
}

.sec--tight { padding: clamp(44px, 5vw, 72px) 0; }
.sec--paper { background: var(--paper); color: var(--ink-text); }

.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .82fr);
  gap: clamp(20px, 3vw, 56px);
  align-items: end;
  margin-bottom: clamp(32px, 4.2vw, 60px);
}

.sec-head__l { display: flex; flex-direction: column; gap: 16px; }
.sec-head .lead { max-width: 46ch; }

/* 锚点定位补给吸顶导航的高度 */
[id] { scroll-margin-top: 86px; }

/* 行内代码：只在正文里出现，代码块样式见 components.css */
code {
  font-family: var(--mono);
  font-size: .9em;
  background: rgba(255, 255, 255, .07);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: .01em;
}

.sec--paper code { background: rgba(17, 20, 26, .07); }

.sec-idx {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--text-3);
}

@media (max-width: 820px) {
  .sec-head { grid-template-columns: 1fr; align-items: start; }
}

/* ---------------------------------------------------------------- 5. 按钮 */
.btn {
  --btn-h: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border-radius: var(--r-m);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out),
    background-color var(--t-fast) linear, border-color var(--t-fast) linear,
    box-shadow var(--t-fast) linear, color var(--t-fast) linear;
}

.btn--sm { --btn-h: 38px; padding: 0 16px; font-size: 13.5px; }
.btn--lg { --btn-h: 52px; padding: 0 28px; font-size: 15.5px; }
.btn--block { width: 100%; }

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset,
    0 12px 28px -14px rgba(225, 29, 46, .9);
}

.btn--primary:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .24) inset,
    0 18px 36px -14px rgba(255, 59, 71, .85);
}

.btn--primary:active { transform: translateY(0); }

/* 次级按钮默认按浅色区设计，深色区在下面翻转 */
.btn--ghost {
  border: 1px solid var(--line-dark-2);
  color: var(--ink-text);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--ink-text);
  background: rgba(17, 19, 24, .045);
}

.hero .btn--ghost,
.cta .btn--ghost,
.nav .btn--ghost,
.sec--ink .btn--ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, .02);
}

.hero .btn--ghost:hover,
.cta .btn--ghost:hover,
.nav .btn--ghost:hover,
.sec--ink .btn--ghost:hover {
  border-color: rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .055);
}

.btn--dark {
  background: var(--ink-text);
  color: #fff;
}

.btn--dark:hover { background: #232833; transform: translateY(-1px); }

.btn--outline-dark {
  border: 1px solid var(--line-dark-2);
  color: var(--ink-text);
}

.btn--outline-dark:hover { background: rgba(17, 20, 26, .06); }

.btn__meta {
  font-family: var(--mono);
  font-size: 11px;
  opacity: .62;
  padding-left: 9px;
  margin-left: 2px;
  border-left: 1px solid currentColor;
  line-height: 1;
}

/* 文本链接：红色下划线，悬停时箭头右移 */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-text);
  border-bottom: 1px solid rgba(213, 31, 44, .45);
  padding-bottom: 2px;
  transition: border-color var(--t-fast) linear, gap var(--t-fast) var(--ease-out);
}

.tlink::after { content: "→"; font-family: var(--mono); font-size: 13px; color: var(--brand); }
.tlink:hover { border-color: var(--brand); gap: 11px; }

/* ---------------------------------------------------------------- 6. 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-text-2);
  line-height: 1.5;
}

.tag--brand {
  border-color: rgba(255, 59, 71, .38);
  color: #ff8b8f;
  background: rgba(225, 29, 46, .09);
}

.tag--paper {
  border-color: var(--line-dark);
  color: var(--ink-text-2);
}

/* ---------------------------------------------------------------- 7. 动效基元 */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}

.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- 8. 无障碍 */
.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 {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 999;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--r-s);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform var(--t-fast) var(--ease-out);
}

.skip:focus { transform: none; }

/* ---------------------------------------------------------------- 9. 滚动条 */
@supports (scrollbar-width: thin) {
  html { scrollbar-width: thin; scrollbar-color: #2a2f38 var(--ink-900); }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-900); }
::-webkit-scrollbar-thumb {
  background: #2a2f38;
  border: 2px solid var(--ink-900);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: #3a3f4a; }

/* ---------------------------------------------------------------- 10. 断点 */
/* 1080 / 820 / 520 三档，与 RedAI 主站保持一致 */
@media (max-width: 1080px) {
  body { font-size: 15.5px; }
}

@media (max-width: 820px) {
  .sec { padding: clamp(52px, 9vw, 88px) 0; }
  .btn { --btn-h: 44px; }
}

@media (max-width: 520px) {
  :root { --gut: 18px; }
  .sec-head { gap: 18px; }
  .btn--lg { --btn-h: 48px; width: 100%; }
}
