/* ==========================================================================
   南京应天信息技术有限公司 · 官网
   base.css —— 设计令牌 / 重置 / 排版 / 基础组件 / 通用工具 / 无障碍
   依赖顺序：base.css → layout.css → components.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 设计令牌 (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* 品牌色：取自企业演示文稿主题色（科技蓝 #4874CB / 深墨 #0F1423 / 青 #30C0B4）*/
  --brand-50:  #eef4ff;
  --brand-100: #dbe7fe;
  --brand-200: #bed3fd;
  --brand-300: #91b6f9;
  --brand-400: #5d92f2;
  --brand-500: #2f6ee4;
  --brand-600: #1b5fd9;
  --brand-700: #1449ae;
  --brand-800: #0e3fa0;
  --brand-900: #0d2f72;
  --brand-950: #081c46;

  --accent-400: #2fd4be;
  --accent-500: #17b8a6;
  --accent-600: #0d9384;

  --gold-400: #f2a93b;
  --gold-500: #d98a15;

  /* 中性色 */
  --navy-900: #0a1a2f;
  --navy-800: #0f2540;
  --navy-700: #17324f;
  --ink-900:  #0f1423;
  --ink-700:  #33415c;
  --ink-500:  #64748b;
  --ink-400:  #8a97ab;
  --ink-200:  #dbe2ec;
  --ink-100:  #eaeef4;
  --paper:    #ffffff;
  --paper-2:  #f6f8fc;
  --paper-3:  #eef2f8;

  /* 语义化表面令牌（暗色模式仅覆盖这组变量）*/
  --bg-page:        #ffffff;
  --bg-elevated:    #ffffff;
  --bg-subtle:      #f6f8fc;
  --bg-muted:       #eef2f8;
  --bg-inverse:     #0a1a2f;
  --bg-inverse-2:   #0f2540;
  --text-primary:   #0f1423;
  --text-secondary: #47546b;
  --text-tertiary:  #7b8798;
  --text-inverse:   #eaf0f9;
  --text-inverse-dim: #a9b8cd;
  --border-default: #e2e8f1;
  --border-strong:  #cbd5e3;

  /* 状态色 */
  --success: #17a673;
  --danger:  #d9534f;
  --warning: #d98a15;

  /* 排版 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* 流式字号（clamp：最小值 → 视口缩放 → 最大值）*/
  --fs-xs:   clamp(0.75rem,   0.72rem + 0.14vw, 0.8125rem);
  --fs-sm:   clamp(0.8125rem, 0.79rem + 0.16vw, 0.9rem);
  --fs-base: clamp(0.9375rem, 0.9rem + 0.2vw,  1rem);
  --fs-md:   clamp(1.0625rem, 1rem + 0.3vw,    1.1875rem);
  --fs-lg:   clamp(1.25rem,   1.15rem + 0.5vw, 1.5rem);
  --fs-xl:   clamp(1.5rem,    1.32rem + 0.9vw, 2rem);
  --fs-2xl:  clamp(1.875rem,  1.55rem + 1.6vw, 2.75rem);
  --fs-3xl:  clamp(2.25rem,   1.7rem  + 2.6vw, 3.75rem);

  /* 间距 */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem;  --sp-8: 2rem;    --sp-10: 2.5rem;
  --sp-12: 3rem;   --sp-16: 4rem;   --sp-20: 5rem;   --sp-24: 6rem;

  /* 圆角 */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 999px;

  /* 阴影 */
  --sh-xs: 0 1px 2px rgba(13, 34, 66, 0.06);
  --sh-sm: 0 2px 8px rgba(13, 34, 66, 0.07);
  --sh-md: 0 8px 24px rgba(13, 34, 66, 0.09);
  --sh-lg: 0 18px 48px rgba(13, 34, 66, 0.13);
  --sh-brand: 0 12px 30px rgba(27, 95, 217, 0.24);

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms; --dur: 260ms; --dur-slow: 520ms;

  /* 布局 */
  --container: 1200px;
  --container-narrow: 860px;
  --gutter: clamp(1.125rem, 0.6rem + 2.4vw, 2.5rem);
  --header-h: 68px;
  --section-y: clamp(3.5rem, 2rem + 6vw, 7rem);
}

/* 暗色模式：跟随系统偏好，仅重映射语义令牌 */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-page:          #071324;
    --bg-elevated:      #0d1e34;
    --bg-subtle:        #102338;
    --bg-muted:         #14293f;
    --bg-inverse:       #040d1a;
    --bg-inverse-2:     #0b1c31;
    --text-primary:     #e8eef8;
    --text-secondary:   #b3c1d6;
    --text-tertiary:    #8b9bb3;
    --text-inverse:     #eaf0f9;
    --text-inverse-dim: #9db0c9;
    --border-default:   #1d3450;
    --border-strong:    #2a4a6d;
    --brand-50:         #102a4d;
    --brand-100:        #16385f;
    --brand-600:        #4b85ec;
    --brand-700:        #6d9ff2;
    --accent-600:       #2fd4be;
    --gold-500:         #f2a93b;
    --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-sm: 0 2px 8px rgba(0, 0, 0, .42);
    --sh-md: 0 8px 24px rgba(0, 0, 0, .46);
    --sh-lg: 0 18px 48px rgba(0, 0, 0, .52);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl, dd {
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

ul[class], ol[class] { list-style: none; }

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--brand-500); }

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

/* 注意：不对全局 svg 强制 fill，否则会覆盖装饰性 SVG 根节点上的 fill="none"，
   使本应仅描边的圆形/线条被填成实心。图标统一由 .i / .icon-box svg 控制。*/

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

button {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: var(--sp-6) 0;
}

::selection {
  background: var(--brand-600);
  color: #fff;
}

/* 滚动条（仅对支持的浏览器生效）*/
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid var(--bg-page);
}

/* --------------------------------------------------------------------------
   3. 无障碍 (Accessibility)
   -------------------------------------------------------------------------- */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 999;
  transform: translateY(-160%);
  background: var(--brand-800);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-weight: 600;
  box-shadow: var(--sh-md);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); color: #fff; }

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

/* 尊重「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   4. 基础组件
   -------------------------------------------------------------------------- */

/* 按钮 */
.btn {
  --btn-py: 0.72em;
  --btn-px: 1.5em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: var(--btn-py) var(--btn-px);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
  will-change: transform;
}
.btn:active { transform: translateY(1px) scale(0.995); }

.btn--primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
  color: #fff;
  box-shadow: var(--sh-brand);
}
.btn--primary:hover { color: #fff; box-shadow: 0 16px 36px rgba(27, 95, 217, .34); transform: translateY(-2px); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn--ghost:hover {
  border-color: var(--brand-500);
  color: var(--brand-600);
  background: var(--brand-50);
}

.btn--onDark {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .34);
  color: #fff;
  backdrop-filter: blur(6px);
}
.btn--onDark:hover { background: rgba(255, 255, 255, .2); border-color: rgba(255,255,255,.6); color: #fff; }

.btn--sm { --btn-py: 0.5em; --btn-px: 1.05em; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

/* 标签 / 徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .22em .7em;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}
.tag--accent { background: rgba(23, 184, 166, .1); color: var(--accent-600); border-color: rgba(23, 184, 166, .26); }
.tag--gold   { background: rgba(242, 169, 59, .14); color: var(--gold-500); border-color: rgba(242, 169, 59, .3); }
.tag--plain  { background: var(--bg-muted); color: var(--text-secondary); border-color: var(--border-default); }

/* 章节眉标 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand-600);
}
.eyebrow::before {
  content: "";
  width: 26px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-600), var(--accent-500));
}

/* 图标容器 */
.icon-box {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brand-50), rgba(23, 184, 166, .12));
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}
.icon-box svg { width: 24px; height: 24px; fill: none; stroke: currentColor; }

/* 通用内联图标 */
.i {
  width: 1em; height: 1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.14em;
}
.i--fill { fill: currentColor; stroke: none; }

/* --------------------------------------------------------------------------
   5. 通用工具类
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-brand  { color: var(--brand-600); }
.text-dim    { color: var(--text-tertiary); }
.text-accent { color: var(--accent-600); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }

.stack-xs > * + * { margin-top: var(--sp-2); }
.stack > * + *    { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-8); }

/* 渐显动效（由 main.js 添加 .is-visible）*/
.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* JS 未启用 / 未加载时保持内容完全可见 */
.no-js .reveal { opacity: 1; transform: none; }
