/* ==============================================================
   Clash安装官网 · base.css
   「信任白皮书」浅色金融科技设计系统
   —— 设计令牌 / 骨架排版 / 按钮 / 页头页脚 / 滚动淡入 / 响应式
   ============================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  /* 色彩 */
  --paper: #FFFFFF;          /* 全站主底 */
  --paper-tint: #F3F6FB;     /* 浅灰蓝分区底 */
  --paper-tint2: #E8EEF7;    /* 更深一档的面板底 */
  --hairline: #D9E2EF;       /* 分隔线 / 描边 */
  --brand: #1B3B6F;          /* 品牌藏蓝(主按钮/选中态/关键数据) */
  --brand-deep: #122A52;     /* 藏蓝深色变体(hover) */
  --link-blue: #2F6FE4;      /* 亮蓝,仅用于链接与行内高亮 */
  --ink: #1A2333;            /* 主文字 */
  --ink-soft: #5B6B84;       /* 次要文字(细体灰蓝) */
  --ok: #1E8A5F;             /* 成功 */
  --amber: #B97F14;          /* 警告 */
  --danger: #C23A3A;         /* 错误 */

  /* 字体 */
  --ff-display: "Inter", "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --ff-body: "Inter", "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --ff-mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;

  /* 形状 / 阴影 / 间距 */
  --r-pill: 999px;                                   /* 胶囊全圆角 */
  --r-card: 12px;                                    /* 卡片圆角 */
  --r-tag: 6px;                                      /* 小标签圆角 */
  --shadow-soft: 0 6px 24px rgba(27, 59, 111, 0.08); /* 浅投影(卡片,无描边) */
  --shadow-lift: 0 12px 36px rgba(27, 59, 111, 0.14);/* 抬升投影(浮层/示意卡) */
  --gutter: clamp(16px, 4vw, 32px);                  /* 版心左右留白,窄屏不小于 16px */
  --head-h: 64px;                                    /* 页头高度 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

html.nav-open {
  overflow: hidden;
}

/* ---------- 文档骨架 ---------- */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::selection {
  background: var(--paper-tint2);
  color: var(--brand-deep);
}

:focus-visible {
  outline: 2px solid var(--link-blue);
  outline-offset: 2px;
}

hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 32px 0;
}

/* ---------- 排版层级 ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--ff-display);
  color: var(--ink);
  line-height: 1.3;
  margin: 0 0 0.6em;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
}

h2 {
  font-size: clamp(24px, 3.4vw, 34px);
}

h3 {
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
}

h4 {
  font-size: 16px;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.4em;
}

a {
  color: var(--link-blue);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

a:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

strong {
  font-weight: 700;
  color: var(--ink);
}

/* 副标 / 引言:细体灰蓝 */
.lede {
  color: var(--ink-soft);
  font-weight: 300;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.8;
}

/* 小型章节前导词 */
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.muted {
  color: var(--ink-soft);
}

/* 关键数据强调:藏蓝加粗等宽 */
.num-key {
  font-family: var(--ff-mono);
  font-weight: 700;
  color: var(--brand);
}

/* ---------- 代码 ---------- */
code,
kbd,
pre {
  font-family: var(--ff-mono);
  font-size: 0.88em;
}

code {
  background: var(--paper-tint);
  border: 1px solid var(--hairline);
  border-radius: var(--r-tag);
  padding: 2px 6px;
  color: var(--brand-deep);
  word-break: break-all;
}

pre {
  background: var(--paper-tint);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 18px 22px;
  overflow-x: auto;
  line-height: 1.7;
  margin: 0 0 1.2em;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  word-break: normal;
}

/* ---------- 版心与分区节奏 ---------- */
.shell {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-inline: var(--gutter);
}

.shell-narrow {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding-inline: var(--gutter);
}

/* 区块节奏:只声明纵向,严禁 padding 简写覆盖版心留白 */
.strip {
  padding-top: clamp(56px, 9vw, 104px);
  padding-bottom: clamp(56px, 9vw, 104px);
}

.strip-tint {
  background: var(--paper-tint);
}

.strip-tint2 {
  background: var(--paper-tint2);
}

.strip-head {
  max-width: 640px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

/* ---------- 按钮:胶囊全圆角 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 30px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-family: var(--ff-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn-solid {
  background: var(--brand);
  color: var(--paper);
}

.btn-solid:hover {
  background: var(--brand-deep);
  color: var(--paper);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.btn-solid:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-line {
  background: var(--paper);
  color: var(--brand);
  border-color: var(--hairline);
}

.btn-line:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

.btn-sm {
  min-height: 40px;
  padding: 8px 20px;
  font-size: 14px;
}

/* ---------- 通用白卡(浅投影无描边) ---------- */
.sheet {
  background: var(--paper);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  padding: 28px;
}

/* ---------- 页头 ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}

.mh-inner {
  display: flex;
  align-items: center;
  min-height: var(--head-h);
  gap: 8px;
}

.mh-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mh-brand:hover {
  text-decoration: none;
  color: var(--brand);
}

.mh-brand img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* 纯文字导航:靠间距与字重区分 */
.mh-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 34px);
  margin-left: clamp(24px, 4vw, 56px);
  min-width: 0;
}

.mh-nav a {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
  padding-top: 6px;
  padding-bottom: 6px;
}

.mh-nav a:hover {
  color: var(--brand);
  text-decoration: none;
}

.mh-nav a.is-here {
  color: var(--brand);
  font-weight: 700;
}

/* 工具区自身贴最右:任何断点都不依赖导航条的 auto 边距 */
.mh-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 语言切换下拉 */
.lang-pick {
  position: relative;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--ff-body);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.lang-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.lang-btn .lang-caret {
  flex-shrink: 0;
  transition: transform 0.18s var(--ease);
}

.lang-pick.open .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 148px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--paper);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lift);
  display: none;
  z-index: 10;
}

.lang-pick.open .lang-menu {
  display: block;
}

.lang-menu a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--r-tag);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.lang-menu a:hover {
  background: var(--paper-tint);
  text-decoration: none;
}

.lang-menu a.lang-now {
  color: var(--brand);
  font-weight: 700;
  background: var(--paper-tint);
}

/* 汉堡按钮:桌面隐藏 */
.mh-burger {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  flex-shrink: 0;
}

.mh-burger svg {
  flex-shrink: 0;
}

/* 移动端点击遮罩:层级必须低于抽屉 */
.mh-veil {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--head-h);
  bottom: 0;
  background: rgba(18, 42, 82, 0.32);
  z-index: 1;
}

html.nav-open .mh-veil {
  display: block;
}

/* ---------- 页脚 ---------- */
.groundwork {
  background: var(--paper-tint);
  border-top: 1px solid var(--hairline);
  padding-top: clamp(48px, 7vw, 72px);
  padding-bottom: 32px;
  color: var(--ink-soft);
  font-size: 14px;
}

.gw-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
}

.gw-grid > * {
  min-width: 0;
}

.gw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 14px;
}

.gw-brand img {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.gw-intro {
  line-height: 1.8;
  max-width: 300px;
}

.gw-col h4 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  margin-bottom: 16px;
}

.gw-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gw-col li {
  margin-bottom: 10px;
}

.gw-col a {
  color: var(--ink-soft);
}

.gw-col a:hover {
  color: var(--brand);
}

.gw-legal {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.gw-legal-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.gw-legal a {
  color: var(--ink-soft);
}

.gw-legal a:hover {
  color: var(--brand);
}

/* ---------- 表格 ---------- */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 0 0 1.2em;
}

.grid-table th {
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--hairline);
  padding: 10px 14px;
  white-space: nowrap;
}

.grid-table td {
  border-bottom: 1px solid var(--hairline);
  padding: 10px 14px;
  color: var(--ink-soft);
  vertical-align: top;
}

.grid-table tbody tr:hover {
  background: var(--paper-tint);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 滚动淡入 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.shown {
  opacity: 1;
  transform: none;
}

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

  html {
    scroll-behavior: auto;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .gw-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  /* 导航收进抽屉:实色背景 / 整行可点 / 可滚不穿透 */
  .mh-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--head-h);
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-lift);
    padding-top: 8px;
    padding-bottom: 16px;
    padding-inline: var(--gutter);
    max-height: calc(100dvh - var(--head-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 5;
  }

  html.nav-open .mh-nav {
    display: flex;
  }

  .mh-nav a {
    display: block;
    width: 100%;
    padding-top: 13px;
    padding-bottom: 13px;
    font-size: 16px;
    border-bottom: 1px solid var(--hairline);
  }

  .mh-nav a:last-child {
    border-bottom: none;
  }

  .mh-burger {
    display: inline-flex;
  }

  /* 窄屏工具区自补 auto 边距,防悬空 */
  .mh-tools {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  body {
    font-size: 15px;
  }

  .gw-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .gw-legal {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn {
    padding: 12px 24px;
  }

  pre {
    padding: 14px 16px;
  }
}