/* Sawtix 官网样式表。
   配色直接取自 app 的色板 lib/core/theme/app_colors.dart —— 深紫底、品牌粉、
   紫罗兰 —— 这样网站和 app 内看到的是同一套颜色。App 是纯深色主题，站点
   也就只做深色一套，不跟随系统切浅色。 */

:root {
  color-scheme: dark;

  /* 底色与面板：app 的 bgDarkPurple / partyCardBg / meCardBg / inputDark */
  --night: #0B0725;        /* 比 app 底色再深一档，给页面留出层次 */
  --bg: #120933;           /* AppColors.bgDarkPurple */
  --surface: #181133;      /* AppColors.partyCardBg */
  --surface-2: #140D2F;    /* AppColors.meCardBg */
  --raise: #29224D;        /* AppColors.inputDark */
  --line: #2A2150;

  /* 品牌粉两档（AppColors.brandPink / brandPinkLight） */
  --pink: #FB1B77;
  --pink-lite: #FF7DB4;

  /* 图标上那颗蓝紫气泡、PK 蓝、在线绿 */
  --violet: #7A5CFF;
  --blue: #2099FC;
  --mint: #18F8B1;         /* AppColors.onlineGreen，只用在锚点命中的高亮上 */

  --text: #FFFFFF;
  /* app 内的 textSecondary 是 #736C92，压在深紫上只有 3.2:1，网页正文读不动。
     提亮到 6.2:1 再用，颜色关系不变。 */
  --muted: #A79FC8;
  --link: #D8D2F5;         /* AppColors.textLinkLight */

  --glow: linear-gradient(100deg, var(--blue), var(--violet) 38%,
                          var(--pink) 74%, var(--pink-lite));

  --r: 14px;
  --r-sm: 10px;
  --shell: 1060px;
  --measure: 70ch;

  --lift: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(122, 92, 255, 0.28);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Roboto, "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif;
}

a { color: var(--pink-lite); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #fff; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------ 顶部导航 --
   深紫通栏 + 粉色底边，滚动时吸顶。 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 2px solid rgba(251, 27, 119, 0.55);
  transition: box-shadow 0.28s var(--ease), background-color 0.28s var(--ease);
}

/* 滚动离开顶部后加半透明 + 模糊，让正文从导航底下穿过时有层次。
   `is-stuck` 由 sawtix.js 挂上，没有 JS 时导航就是原来的实心通栏。 */
.topbar.is-stuck {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

/* 阅读进度条：贴在导航粉色底边上。法务长文里最有用 ——
   它同时充当「这份文件还剩多少」的提示。 */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 2px;
  width: var(--progress, 0%);
  background: var(--glow);
  transition: width 0.1s linear;
}

.topbar .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* 站标用真正的 App 图标（tool/site_brand.py 从 assets/icon/app_icon.png 生成），
   而不是一个抽象色点 —— 网页上的形象要和用户手机桌面上的一致。
   放在伪元素里是为了每个页面的 HTML 一行都不用改。 */
.wordmark::before {
  content: "";
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: url("brand/icon-32.png") center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16),
              0 4px 16px rgba(251, 27, 119, 0.45);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.wordmark:hover::before {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24),
              0 6px 22px rgba(251, 27, 119, 0.6);
}

.wordmark .age {
  margin-left: 2px;
  padding: 1px 7px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.topnav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

.topnav a {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  text-decoration: none;
}

.topnav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.topnav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--pink); }

/* --------------------------------------------------------------- 标题区 --
   两颗气泡：图标上那颗品红的和那颗蓝紫的，放大成背景柔光缓慢漂移。
   画在 .masthead 自己的 background 里而不是覆盖一层 mix-blend-mode 伪元素 ——
   后者会让浏览器把整个标题区合成为一个混合层，右侧卡片在某些视口高度下会被裁掉。 */

.masthead {
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(44% 58% at 50% 50%, rgba(251, 27, 119, 0.5), transparent 68%),
    radial-gradient(40% 52% at 50% 50%, rgba(122, 92, 255, 0.46), transparent 70%),
    radial-gradient(38% 48% at 50% 50%, rgba(32, 153, 252, 0.26), transparent 70%);
  background-repeat: no-repeat;
  /* 光斑压在两侧和下方：标题和正文落在左中，那里要留住深紫底才有对比度。
     实测最亮的光斑处白字仍有 7.4:1（AA 要 4.5），调透明度时要一并复核。 */
  background-size: 92% 108%, 86% 104%, 70% 90%;
  background-position: 108% -18%, 96% 96%, -14% 118%;
  animation: drift 32s var(--ease) infinite alternate;
}

/* 只动光斑位置，各走各的方向，看不出周期 */
@keyframes drift {
  from { background-position: 108% -18%, 96% 96%, -14% 118%; }
  to   { background-position: 96% -6%, 106% 84%, -4% 104%; }
}

/* 顶部一层极淡的星点，呼应图标里的星空底。数量克制到 7 颗，多了像噪点 */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 28% 68%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 46% 14%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 62% 82%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(2px 2px at 76% 30%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 88% 60%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 94% 12%, rgba(255, 255, 255, 0.6), transparent);
}

.masthead .shell {
  position: relative;
  z-index: 1;
  padding-top: 56px;
  padding-bottom: 56px;
}

.masthead.slim .shell { padding-top: 36px; padding-bottom: 32px; }

.masthead h1 {
  max-width: 22ch;
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.masthead.slim h1 { max-width: none; font-size: clamp(26px, 4vw, 34px); margin-bottom: 8px; }

.masthead p { max-width: var(--measure); color: rgba(255, 255, 255, 0.84); }
.masthead .lede { font-size: 18px; }
.masthead a { color: #fff; }

/* 首页 h1 里被 <em> 圈住的那半句走渐变，一屏里只此一处，多了就廉价。
   不支持 background-clip 的浏览器退回白色。 */
.masthead h1 em {
  font-style: normal;
  background: var(--glow);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hue 14s linear infinite;
}

@supports not (background-clip: text) {
  .masthead h1 em { color: var(--pink-lite); }
}

@keyframes hue {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

.kicker {
  display: inline-block;
  margin: 0 0 14px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-split { display: grid; gap: 32px; }

@media (min-width: 900px) {
  .hero-split { grid-template-columns: 1.35fr 1fr; align-items: start; }
}

/* App 图标本体：站点上唯一一处让它占大面积的地方 */
.applogo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
}

.applogo img {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18),
              0 18px 46px rgba(251, 27, 119, 0.5),
              0 6px 20px rgba(122, 92, 255, 0.4);
  animation: float 7s var(--ease) infinite alternate;
}

.applogo b { display: block; font-size: 20px; letter-spacing: -0.01em; }
.applogo span { color: rgba(255, 255, 255, 0.72); font-size: 14px; }

@keyframes float {
  from { transform: translateY(-3px); }
  to   { transform: translateY(3px); }
}

.factsheet {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--r);
  padding: 4px 18px;
  /* 半透明夜色垫一层，把清单从背后的光斑里托出来。
     这里故意不用 backdrop-filter：参考站在同一位置栽过一次 —— 标题区带
     overflow:hidden 又在动背景，给右侧卡片加合成层容易在某些视口高度下被裁掉。
     深色底上一层 rgba 的观感差别很小，不值得冒这个险。 */
  background: rgba(11, 7, 37, 0.42);
}

.factsheet dl { margin: 0; }
.factsheet div { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.factsheet div:last-child { border-bottom: 0; }

.factsheet dt {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.factsheet dd { margin: 2px 0 0; font-size: 15px; }

/* ----------------------------------------------------------------- 正文 --*/

main .shell { padding-top: 48px; padding-bottom: 24px; }

section { margin-bottom: 44px; }
section > p, section > ul, section > ol, section > table { max-width: var(--measure); }

h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* 编号小节：法务页靠它做锚点标题 */
h2 .num {
  display: inline-block;
  min-width: 26px;
  margin-right: 10px;
  padding: 1px 0;
  border-bottom: 2px solid var(--pink);
  color: var(--pink-lite);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
}

h3 { margin: 0 0 6px; font-size: 16px; }
p { margin: 0 0 14px; }

.lede { font-size: 18px; }
.muted, .meta, .note { color: var(--muted); font-size: 14px; }
.note { max-width: var(--measure); }

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stamp b { color: #fff; font-weight: 600; }
.stamp span { opacity: 0.5; }

/* 主按钮。白字压在粉紫渐变上最低 3.2:1，按 WCAG 大号文字（≥18.66px 粗体）
   的 3:1 门槛来用，所以字号锁在 19px/700，不要调小。 */
.cta {
  display: inline-block;
  margin: 4px 10px 8px 0;
  padding: 13px 26px;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--pink), var(--violet));
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(251, 27, 119, 0.36);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.cta:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(251, 27, 119, 0.5);
}

.cta.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: none;
  font-size: 19px;
}

.cta.ghost:hover { border-color: var(--pink-lite); box-shadow: none; }

/* ----------------------------------------------------------------- 卡片 --*/

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pink);
  border-radius: var(--r);
  padding: 18px 20px;
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease);
}

/* hover 时左侧粉条换成渐变、卡片浮起来。用伪元素铺渐变而不是直接改
   border-left-color，是因为 border 不吃渐变。 */
.card::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -1px;
  bottom: -1px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--glow);
  opacity: 0;
  transition: opacity 0.32s var(--ease);
}

.card:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.card:hover::before { opacity: 1; }

.card p { color: var(--muted); font-size: 15px; }
.card p:last-child { margin-bottom: 0; }

.slab {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
}

.slab > :last-child { margin-bottom: 0; }
.slab h2 { margin-top: 0; }

.tinted { background: var(--raise); border-color: transparent; }

/* 强调条：用于「没有账号删除入口」这类需要一眼看到的句子 */
.rulebar {
  border-left: 3px solid var(--pink);
  background: var(--surface);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 14px 18px;
  max-width: var(--measure);
  font-weight: 500;
}

/* ------------------------------------------------------------- 列表/表格 --*/

.ticks { list-style: none; margin: 0 0 14px; padding: 0; max-width: var(--measure); }

.ticks li { position: relative; margin-bottom: 10px; padding-left: 26px; }

.ticks li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--pink);
}

.terms { margin: 0; max-width: var(--measure); }
.terms dt { margin-top: 14px; font-weight: 600; }
.terms dt:first-child { margin-top: 0; }
.terms dd { margin: 2px 0 0; color: var(--muted); }

.rows { width: 100%; border-collapse: collapse; }

.rows th, .rows td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rows th {
  width: 38%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--raise);
  color: var(--link);
  font-size: 13px;
}

/* -------------------------------------------------------------- 文档索引 --*/

.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.docs li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease),
              border-color 0.32s var(--ease);
}

.docs li:hover { transform: translateY(-3px); border-color: transparent; box-shadow: var(--lift); }
.docs a { font-size: 18px; font-weight: 650; text-decoration: none; }
.docs .meta { display: block; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.docs p { margin: 0; color: var(--muted); font-size: 15px; }

/* ------------------------------------------------------ 法务页双栏 + 目录 --*/

.withtoc { display: block; }

@media (min-width: 960px) {
  .withtoc { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 48px; align-items: start; }
  .toc { position: sticky; top: 88px; }
}

.toc { margin-bottom: 32px; }

.toc h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }

.toc a {
  display: block;
  position: relative;
  padding: 6px 0 6px 26px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: border-left-color 0.24s var(--ease), color 0.24s var(--ease);
}

.toc a::before {
  content: counter(toc);
  position: absolute;
  left: 10px;
  color: var(--pink);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.toc a:hover { border-left-color: var(--pink); color: #fff; }

/* 当前正在读的章节。`is-active` 由 sawtix.js 按滚动位置挂上，
   没有 JS 时目录仍是一个可点的普通列表。 */
.toc a.is-active {
  border-left-color: transparent;
  color: #fff;
  font-weight: 600;
  /* 竖直方向的一小段渐变，横向的 --glow 在 2px 宽的条上看不出颜色 */
  background: linear-gradient(180deg, var(--blue), var(--pink)) left / 2px 100% no-repeat;
}

.toc a.is-active::before { color: var(--pink-lite); }

.doc section { scroll-margin-top: 88px; }
.doc section:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- 页脚 --*/

footer.sitefoot {
  position: relative;
  overflow: hidden;
  margin-top: 40px;
  background: #07051A;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  border-top: 1px solid var(--line);
}

/* 右下角一枚极淡的图标水印，和顶部站标呼应，不抢正文 */
footer.sitefoot::before {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -46px;
  width: 210px;
  height: 210px;
  background: url("brand/icon-192.png") center / contain no-repeat;
  opacity: 0.09;
  pointer-events: none;
}

footer.sitefoot .shell { position: relative; padding-top: 32px; padding-bottom: 40px; }

footer.sitefoot .rule {
  max-width: var(--measure);
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 500;
}

footer.sitefoot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; }
footer.sitefoot a { color: rgba(255, 255, 255, 0.78); text-decoration: none; }
footer.sitefoot a:hover { color: #fff; text-decoration: underline; }
footer.sitefoot .fine { margin: 0; color: rgba(255, 255, 255, 0.45); font-size: 13px; }

/* ----------------------------------------------------------------- 动效 --
   两条底线：没有 JS 也能完整阅读（渐显的隐藏样式只在脚本加上 `.js` 类后
   才生效），系统开了「减弱动态效果」就全部关掉。 */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

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

/* 同一组里的卡片依次进场，差 60ms，够看出先后又不至于让人等 */
.js [data-reveal][style*="--i"] { transition-delay: calc(var(--i) * 60ms); }

h2 .num { transition: color 0.24s var(--ease), border-bottom-color 0.24s var(--ease); }
section:hover > h2 .num { border-bottom-color: var(--violet); }

/* 锚点跳转后短暂高亮目标章节，长文里不容易跟丢 */
.doc section:target > h2 .num { border-bottom-color: var(--mint); color: var(--mint); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .masthead,
  .masthead h1 em,
  .applogo img { animation: none; }

  .js [data-reveal] { opacity: 1; transform: none; transition: none; }

  .card:hover,
  .docs li:hover,
  .cta:hover { transform: none; }

  * { transition-duration: 0.01ms !important; }
}
