/* ============================================================
   clashsdk.com · base.css
   基础层:设计令牌 / 重置 / 排版 / 按钮 / 页头 / 页脚 / 工具类
   设计方向:深墨蓝灰仓库主页复刻风,1px 细描边 + 6px 小圆角,
   禁投影 / 禁发光 / 禁渐变,正文密度偏高、行距紧凑。
   ============================================================ */

/* ── 设计令牌 ─────────────────────────────────────────────── */
:root{
  --bg:#0D141C;              /* 页面底色:深墨蓝灰 */
  --bg-panel:#131C26;        /* 一级面板 */
  --bg-panel2:#1A2532;       /* 二级面板(更浮起) */
  --border:#2B3946;          /* 细描边 / 分割线 */
  --accent:#3FB950;          /* 唯一强调色:低饱和仓库绿 */
  --accent-dark:#2EA043;     /* 强调色深变体(hover / 描边) */
  --text:#E6EDF3;            /* 冷白主文字 */
  --muted:#8DA3B8;           /* 灰蓝次要文字 */
  --link:#6CA4E0;            /* 低饱和蓝链接 */
  --warn:#D9A93E;            /* 警告 */
  --error:#E5645A;           /* 错误 */
  --radius:6px;              /* 全站统一小圆角 */
  --gutter:24px;             /* 版心左右留白(窄屏收到 16px,永不归零) */
  --head-h:58px;             /* 页头高度 */
  --wrap-max:1392px;         /* 版心最大宽 */
  --font-display:'Inter','Noto Sans SC',-apple-system,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;
  --font-body:'Inter','Noto Sans SC',-apple-system,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,Consolas,monospace;
  /* 贡献热力图四档(由强调色与面板色混出,无渐变) */
  --heat-0:var(--bg-panel2);
  --heat-1:color-mix(in srgb, var(--accent) 26%, var(--bg-panel));
  --heat-2:color-mix(in srgb, var(--accent) 48%, var(--bg-panel));
  --heat-3:color-mix(in srgb, var(--accent) 72%, var(--bg-panel));
  --heat-4:var(--accent);
}

/* ── 重置 ─────────────────────────────────────────────────── */
*{margin:0;padding:0;box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto}
}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:14px;
  line-height:1.55;
  position:relative;
}
/* 背景纹理:细点阵网格(小尺寸平铺,纯装饰) */
body::before{
  content:"";
  position:fixed;
  inset:0;
  background-image:radial-gradient(circle, var(--border) 1px, transparent 1.02px);
  background-size:26px 26px;
  opacity:.16;
  pointer-events:none;
  z-index:0;
}
main,header,footer{position:relative;z-index:1}
img{max-width:100%}
button{font-family:inherit;color:inherit}
a{color:var(--link);text-decoration:none}
a:hover{text-decoration:underline}
code,pre,kbd,.mono{font-family:var(--font-mono)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
html.nav-open{overflow:hidden}

/* ── 排版 ─────────────────────────────────────────────────── */
h1,h2,h3,h4{
  font-family:var(--font-display);
  color:var(--text);
  font-weight:700;
  line-height:1.3;
}
h1{font-size:clamp(30px,4.6vw,44px);letter-spacing:-0.02em;line-height:1.12}
h2{font-size:21px}
h3{font-size:16.5px}
p{color:var(--text)}
.sub{color:var(--muted)}

/* ── 工具类 ───────────────────────────────────────────────── */
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.svg-defs{position:absolute;width:0;height:0;overflow:hidden}
.wrap{
  max-width:var(--wrap-max);
  margin-left:auto;
  margin-right:auto;
  padding-inline:var(--gutter);
}
/* 区块节奏:只声明纵向,严禁 padding 简写覆盖版心横向留白 */
.sec{padding-top:52px;padding-bottom:52px}
.sec-tight{padding-top:28px;padding-bottom:28px}

/* ── 按钮 ─────────────────────────────────────────────────── */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border-radius:var(--radius);
  font-family:var(--font-body);
  font-size:14px;
  font-weight:600;
  padding:8px 16px;
  border:1px solid var(--border);
  background:var(--bg-panel2);
  color:var(--text);
  cursor:pointer;
  white-space:nowrap;
}
.btn:hover{text-decoration:none}
.btn .icon{width:16px;height:16px;flex-shrink:0}
.btn-primary{
  background:var(--accent);
  border-color:var(--accent-dark);
  color:var(--bg);
  font-size:15px;
  padding:10px 22px;
}
.btn-primary:hover{background:var(--accent-dark)}
.btn-ghost{
  background:var(--bg-panel2);
  color:var(--text);
  font-size:15px;
  padding:10px 20px;
}
.btn-ghost:hover{border-color:var(--muted)}
.cta-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.cta-note{color:var(--muted);font-size:12px;font-family:var(--font-mono)}

/* ── 页头(header.js 注入 #site-header)─────────────────── */
/* 抽屉(.top-nav)是页头子元素:页头必须显式定位且层级高于遮罩,
   否则遮罩(.nav-veil z-index:64)会压住整个抽屉,菜单点不动 */
.site-head{
  position:sticky;
  top:0;
  z-index:70;
  border-bottom:1px solid var(--border);
  background:var(--bg-panel);
}
.head-inner{
  max-width:var(--wrap-max);
  margin:0 auto;
  padding:0 var(--gutter);
  height:var(--head-h);
  display:flex;
  align-items:center;
  gap:28px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--text);
  font-weight:600;
  font-size:15px;
  font-family:var(--font-display);
  flex-shrink:0;
}
.brand:hover{text-decoration:none}
.brand-mark{width:30px;height:30px;display:block;flex-shrink:0}
.top-nav{
  display:flex;
  align-items:stretch;
  gap:4px;
  height:var(--head-h);
}
.top-nav a{
  display:flex;
  align-items:center;
  padding:0 14px;
  color:var(--muted);
  font-size:14px;
  position:relative;
  white-space:nowrap;
}
.top-nav a:hover{color:var(--text);text-decoration:none}
.top-nav a.is-on{color:var(--text);font-weight:600}
.top-nav a.is-on::after{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  bottom:0;
  height:2px;
  background:var(--accent);
  border-radius:2px 2px 0 0;
}
.head-tools{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}
.lang-box{position:relative}
.lang-switch{
  background:var(--bg-panel2);
  border:1px solid var(--border);
  border-radius:var(--radius);
  color:var(--muted);
  font-family:var(--font-body);
  font-size:13px;
  padding:6px 12px;
  cursor:pointer;
  white-space:nowrap;
}
.lang-switch:hover{color:var(--text);border-color:var(--muted)}
.lang-switch .caret{font-size:11px}
.lang-menu{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  min-width:152px;
  list-style:none;
  background:var(--bg-panel2);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:5px;
  z-index:72;
}
.lang-menu a{
  display:block;
  padding:8px 12px;
  border-radius:4px;
  color:var(--muted);
  font-size:13px;
}
.lang-menu a:hover{background:var(--bg-panel);color:var(--text);text-decoration:none}
.lang-menu .is-cur a{color:var(--text);font-weight:600}
.nav-burger{
  display:none;
  min-width:44px;
  min-height:44px;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:4px;
  background:none;
  border:1px solid var(--border);
  border-radius:var(--radius);
  cursor:pointer;
}
.burger-bar{
  display:block;
  width:18px;
  height:2px;
  background:var(--text);
  border-radius:1px;
}
.nav-veil{
  position:fixed;
  top:var(--head-h);
  left:0;
  right:0;
  bottom:0;
  background:color-mix(in srgb, var(--bg) 72%, transparent);
  z-index:64;
}

/* ── 页脚(footer.js 注入 #site-footer)─────────────────── */
.site-foot{
  border-top:1px solid var(--border);
  background:var(--bg-panel);
  margin-top:64px;
}
.foot-grid{
  display:grid;
  grid-template-columns:1.3fr .7fr 1.3fr .7fr;
  gap:32px;
  padding-top:44px;
  padding-bottom:36px;
}
.foot-grid > *{min-width:0}
.foot-brand .brand{margin-bottom:12px}
.foot-tag{color:var(--muted);font-size:13px;max-width:36ch}
.foot-title{
  font-family:var(--font-display);
  font-size:13px;
  font-weight:700;
  color:var(--text);
  margin-bottom:12px;
}
.foot-list{list-style:none}
.foot-list li{margin-bottom:8px}
.foot-list li:last-child{margin-bottom:0}
.foot-list a{color:var(--muted);font-size:13px}
.foot-list a:hover{color:var(--link)}
.hot-list{
  list-style:none;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.hot-list a{
  display:inline-block;
  max-width:100%;
  overflow:hidden;
  white-space:nowrap;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--bg-panel2);
  color:var(--muted);
  font-size:12px;
  padding:4px 12px;
}
.hot-list a:hover{color:var(--text);border-color:var(--muted);text-decoration:none}
.foot-base{
  border-top:1px solid var(--border);
  padding-top:18px;
  padding-bottom:22px;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  color:var(--muted);
  font-size:12px;
}
.foot-legal a{color:var(--muted);margin-left:14px}
.foot-legal a:first-child{margin-left:0}
.foot-legal a:hover{color:var(--link)}

/* ── 通用面板 / 卡片 ──────────────────────────────────────── */
.panel-card{
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px 20px;
}
.panel-card:hover{border-color:var(--muted)}
a.panel-card{display:block;color:var(--text)}
a.panel-card:hover{text-decoration:none}

/* ── 滚动淡入(reveal.js 驱动)────────────────────────────── */
.reveal{
  opacity:0;
  transform:translateY(14px);
  transition:opacity .5s ease, transform .5s ease;
}
.reveal.shown{opacity:1;transform:none}
@media (prefers-reduced-motion: reduce){
  .reveal{opacity:1;transform:none;transition:none}
}

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width:940px){
  .head-inner{gap:14px}
  /* 导航收进抽屉:实色面板 + 整行可点 + 限高内滚 */
  .top-nav{
    display:none;
    position:fixed;
    top:var(--head-h);
    left:0;
    right:0;
    height:auto;
    flex-direction:column;
    gap:0;
    background:var(--bg-panel);
    border-bottom:1px solid var(--border);
    max-height:calc(100dvh - var(--head-h));
    overflow-y:auto;
    overscroll-behavior:contain;
    z-index:66;
  }
  .top-nav.open{display:flex}
  .top-nav a{
    display:flex;
    width:100%;
    padding:13px var(--gutter);
    min-height:44px;
    border-top:1px solid var(--border);
    font-size:15px;
  }
  .top-nav a.is-on::after{
    left:0;
    right:auto;
    top:0;
    bottom:0;
    width:2px;
    height:auto;
    border-radius:0;
  }
  /* 工具区在窄屏必须仍贴最右(抽屉化后导航不再占位) */
  .head-tools{margin-left:auto}
  .nav-burger{display:inline-flex}
}
@media (max-width:900px){
  .foot-grid{grid-template-columns:1fr 1fr;gap:28px}
}
@media (max-width:640px){
  :root{--gutter:16px}
  body{font-size:13.5px}
  .sec{padding-top:38px;padding-bottom:38px}
  .foot-grid{grid-template-columns:1fr;gap:24px}
  .foot-base{flex-direction:column;align-items:flex-start}
}