/* ==========================================================================
   AuthNexus Design · 官网样式（docs site）
   --------------------------------------------------------------------------
   站点自身由本设计系统搭建：颜色/圆角/动效全部走 tokens.css 的令牌，
   明暗双主题自动跟随。ds- 前缀为本文件私有（不进入资产命名空间）。
   ========================================================================== */

/* 双语：由 html[data-lang] 控制显隐 */
html[data-lang='zh'] .t-en { display: none; }
html[data-lang='en'] .t-zh { display: none; }

body { background: var(--page); }

/* 跳到正文（无障碍） */
.ds-skip { position: absolute; left: -9999px; top: 0; z-index: 300; padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: 0 0 var(--r-sm) 0; }
.ds-skip:focus { left: 0; }

/* ---------------------------------------------------------------- 顶栏 */
.ds-topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--page) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
}
.ds-topbar__in { max-width: 1180px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 18px; }
.ds-logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.ds-logo__text { font-size: 15px; }
.ds-logo__text em { font-style: normal; font-weight: 500; color: var(--muted-text); margin-left: 5px; }
.ds-nav { display: flex; gap: 2px; margin-left: 8px; flex: 1; }
.ds-nav a { padding: 7px 12px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--muted-text); text-decoration: none; transition: color var(--t), background var(--t); }
.ds-nav a:hover { color: var(--ink); background: var(--bone); }
.ds-nav a.is-active { color: var(--ink); font-weight: 600; }
.ds-tools { display: flex; align-items: center; gap: 8px; }
.ds-tbtn {
  height: 32px; min-width: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface, var(--paper)); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.ds-tbtn:hover { border-color: var(--border-strong); background: var(--bone); }
.ds-tbtn:active { transform: scale(.97); }
.ds-tbtn--icon { min-width: 34px; padding: 0; }
html[data-theme='light'] .ds-ic-moon { display: none; }
html[data-theme='dark'] .ds-ic-sun { display: none; }

/* ---------------------------------------------------------------- 布局 */
.ds-wrap { max-width: 1180px; margin: 0 auto; padding: 40px 20px 72px; }
.ds-wrap--doc { max-width: 880px; }
.ds-sec { max-width: 1180px; margin: 0 auto; padding: 40px 20px; }
.ds-sec__head { margin-bottom: 22px; }
.ds-sec__head h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
.ds-sec__head p { margin: 0; color: var(--muted-text); font-size: 14.5px; max-width: 720px; }
.ds-sec__more { margin-top: 22px; }

/* ---------------------------------------------------------------- 首页 hero */
.ds-hero { position: relative; max-width: 1180px; margin: 0 auto; padding: 84px 20px 20px; text-align: center; overflow: hidden; }
.ds-hero__glow {
  position: absolute; inset: -160px 0 auto 50%; width: 720px; height: 420px; transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--acid) 30%, transparent), transparent);
  filter: blur(28px); pointer-events: none; opacity: .55;
}
.ds-hero__badge { display: inline-block; margin: 0 0 18px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--muted-text); background: color-mix(in srgb, var(--paper) 70%, transparent); position: relative; }
.ds-hero h1 { position: relative; margin: 0 0 16px; font-size: clamp(34px, 5.4vw, 54px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; }
.ds-hero__sub { position: relative; margin: 0 auto 26px; max-width: 640px; color: var(--muted-text); font-size: 16px; line-height: 1.7; }
.ds-hero__actions { position: relative; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ds-hero__stats { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 720px; margin: 44px auto 0; }
.ds-hero__stats > div { padding: 14px 10px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface, var(--paper)); }
.ds-hero__stats dt { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ds-hero__stats dd { margin: 2px 0 0; font-size: 12px; color: var(--muted-text); }

/* ---------------------------------------------------------------- 浏览器框（实时预览） */
.ds-browser { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.ds-browser__bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); background: var(--bone); }
.ds-browser__bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }
.ds-browser__bar i:nth-child(1) { background: #F97066; }
.ds-browser__bar i:nth-child(2) { background: #FDB022; }
.ds-browser__bar i:nth-child(3) { background: #78EA57; }
.ds-browser__url { flex: 1; margin-left: 8px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--muted-text); }
.ds-browser__open { font-size: 12.5px; color: var(--link-text, var(--ink)); text-decoration: none; }
.ds-browser iframe { display: block; width: 100%; height: 560px; border: 0; background: var(--page); }

/* ---------------------------------------------------------------- 特性网格 */
.ds-fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ds-fcard { padding: 18px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface, var(--paper)); }
.ds-fcard h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.ds-fcard p { margin: 0; font-size: 13.5px; color: var(--muted-text); line-height: 1.65; }
.ds-fcard code { font-size: 12px; }

/* ---------------------------------------------------------------- 组件条（首页） */
.ds-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 26px; }
.ds-strip__group h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-text); font-weight: 600; }
.ds-strip__group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ds-strip__group a { display: inline-flex; align-items: baseline; gap: 8px; padding: 3px 0; color: var(--ink); text-decoration: none; font-size: 13.5px; border-radius: 6px; }
.ds-strip__group a:hover { color: var(--acid-ink, var(--ink)); }
.ds-strip__group a code { font-size: 11.5px; color: var(--muted-text); }

/* ---------------------------------------------------------------- 组件总览 */
.ds-phead { margin-bottom: 26px; }
.ds-phead h1 { margin: 0 0 10px; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.ds-phead p { margin: 0; color: var(--muted-text); font-size: 14.5px; max-width: 760px; }
.ds-note-inline { margin-top: 8px !important; font-size: 12.5px !important; }
.ds-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface, var(--paper)); max-width: 460px; margin-bottom: 30px; color: var(--muted-text); }
.ds-search:focus-within { border-color: var(--ink); }
.ds-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); }
.ds-search__n { font-size: 12px; }
.ds-cgroup { margin-bottom: 34px; }
.ds-cgroup h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.ds-cgroup__n { font-size: 11.5px; font-weight: 600; color: var(--muted-text); border: 1px solid var(--hairline); border-radius: 999px; padding: 1px 8px; }
.ds-cgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ds-card { position: relative; display: block; padding: 16px 34px 16px 16px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface, var(--paper)); text-decoration: none; color: var(--ink); transition: border-color var(--t), transform var(--t), box-shadow var(--t); }
.ds-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-1, 0 4px 14px rgba(0,0,0,.06)); }
.ds-card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.ds-card__label { font-weight: 650; font-size: 14.5px; }
.ds-card__code { font-size: 11.5px; color: var(--muted-text); }
.ds-card__sum { margin: 0; font-size: 12.5px; color: var(--muted-text); line-height: 1.6; min-height: 20px; }
.ds-card__go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--border-strong); transition: transform var(--t), color var(--t); }
.ds-card:hover .ds-card__go { color: var(--ink); transform: translateY(-50%) translateX(2px); }
.ds-empty { text-align: center; color: var(--muted-text); padding: 60px 0; }

/* ---------------------------------------------------------------- 详情页 */
.ds-crumb { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted-text); margin-bottom: 20px; }
.ds-crumb a { color: var(--muted-text); text-decoration: none; }
.ds-crumb a:hover { color: var(--ink); }
.ds-dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--hairline); margin-bottom: 8px; }
.ds-dhead h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ds-dhead__code { font-size: 15px; font-weight: 500; color: var(--muted-text); }
.ds-dhead__sum { margin: 0; color: var(--muted-text); font-size: 14.5px; max-width: 560px; }
.ds-dhead__meta { display: flex; gap: 8px; flex-shrink: 0; }
.ds-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--acid); color: var(--on-acid, #1A1A1A); }
.ds-tag--ghost { background: transparent; border: 1px solid var(--border); color: var(--muted-text); font-weight: 500; }
.ds-block { padding: 26px 0; border-bottom: 1px solid var(--hairline); }
.ds-block:last-of-type { border-bottom: 0; }
.ds-block h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.ds-block__n { font-size: 11.5px; font-weight: 600; color: var(--muted-text); border: 1px solid var(--hairline); border-radius: 999px; padding: 1px 8px; }
.ds-step { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 700; }
.ds-dim { color: var(--muted-text); font-size: 13.5px; margin: 0 0 12px; line-height: 1.7; }
.ds-dim--sm { font-size: 12.5px; margin-top: 14px; }
.ds-list { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.9; }
.ds-list--tight { margin-top: 8px; line-height: 1.7; }
.ds-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.ds-chip { padding: 3px 9px; border: 1px solid var(--hairline); border-radius: 8px; font-size: 12px; color: var(--ink); background: var(--bone); }
.ds-chip--alt { color: var(--muted-text); background: transparent; }
.ds-note { color: var(--muted-text); font-size: 12.5px; }
.ds-ghlink { font-size: 12.5px; text-decoration: none; margin-left: 6px; }
.ds-req { font-size: 11px; color: var(--danger, #D92D20); }
.ds-lv { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.ds-lv--err { background: color-mix(in srgb, var(--danger, #D92D20) 14%, transparent); color: var(--danger, #D92D20); }
.ds-lv--warn { background: color-mix(in srgb, #FDB022 20%, transparent); color: #93610A; }
html[data-theme='dark'] .ds-lv--warn { color: #FDB022; }

/* 实时预览卡（详情页 CTA） */
.ds-preview { margin: 26px 0 4px; padding: 22px; border: 1px dashed var(--border); border-radius: var(--r); background: color-mix(in srgb, var(--acid) 7%, transparent); }
.ds-preview__hint { margin: 0 0 14px; color: var(--muted-text); font-size: 13.5px; line-height: 1.7; }
.ds-preview__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }

/* ---------------------------------------------------------------- 表格 */
.ds-tablewrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r); }
.ds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-table th, .ds-table td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.ds-table thead th { font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted-text); background: var(--bone); font-weight: 600; white-space: nowrap; }
.ds-table tbody tr:last-child td { border-bottom: 0; }
.ds-table code { font-size: 12px; }
.ds-table .ds-type { white-space: nowrap; color: var(--link-text, var(--ink)); }
.ds-table--kv td:first-child { width: 210px; white-space: nowrap; }

/* ---------------------------------------------------------------- 代码块 */
.ds-code { border: 1px solid var(--code-border, var(--hairline)); border-radius: var(--r); overflow: hidden; margin: 12px 0; background: var(--code-bg, var(--bone)); }
.ds-code__bar { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; border-bottom: 1px solid var(--code-border, var(--hairline)); font-size: 11.5px; color: var(--muted-text); font-family: var(--font-mono, ui-monospace, monospace); }
.ds-code pre { margin: 0; padding: 13px 14px; overflow-x: auto; }
.ds-code code { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, monospace); font-size: 12.5px; line-height: 1.7; color: var(--code-ink, var(--ink)); }
.ds-copybtn { border: 1px solid var(--border); background: transparent; color: var(--muted-text); border-radius: 7px; font-size: 11px; padding: 2px 9px; cursor: pointer; transition: all var(--t); }
.ds-copybtn:hover { color: var(--ink); border-color: var(--border-strong); }
.ds-copybtn.is-done { color: var(--ok, #12805C); border-color: var(--ok, #12805C); }

/* ---------------------------------------------------------------- 工具卡（AI 专区） */
.ds-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 18px; }
.ds-tool { padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface, var(--paper)); }
.ds-tool__head code { font-size: 13.5px; font-weight: 600; }
.ds-tool__desc { margin: 9px 0 0; font-size: 12.5px; color: var(--muted-text); line-height: 1.7; }

/* ---------------------------------------------------------------- markdown 文章 */
.ds-md { font-size: 14.5px; line-height: 1.8; }
.ds-md h2 { margin: 34px 0 12px; font-size: 22px; font-weight: 750; letter-spacing: -.01em; border-bottom: 1px solid var(--hairline); padding-bottom: 8px; }
.ds-md h3 { margin: 26px 0 10px; font-size: 17px; font-weight: 700; }
.ds-md h4 { margin: 20px 0 8px; font-size: 15px; font-weight: 700; }
.ds-md p { margin: 0 0 12px; color: var(--ink); }
.ds-md ul, .ds-md ol { padding-left: 22px; margin: 0 0 14px; }
.ds-md li { margin: 3px 0; }
.ds-md blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--acid); background: var(--bone); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--muted-text); }
.ds-md hr { border: 0; border-top: 1px solid var(--hairline); margin: 28px 0; }
.ds-md code { font-size: 12.5px; }
.ds-md .ds-code { margin: 14px 0; }

/* ---------------------------------------------------------------- 页脚 */
.ds-foot { border-top: 1px solid var(--hairline); margin-top: 40px; }
.ds-foot__in { max-width: 1180px; margin: 0 auto; padding: 30px 20px 44px; display: grid; gap: 12px; }
.ds-foot__brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; }
.ds-foot__links { display: flex; gap: 16px; flex-wrap: wrap; }
.ds-foot__links a { color: var(--muted-text); text-decoration: none; font-size: 13px; }
.ds-foot__links a:hover { color: var(--ink); }
.ds-foot__note { margin: 6px 0 0; color: var(--muted-text); font-size: 12px; line-height: 1.7; max-width: 720px; }

/* ---------------------------------------------------------------- 实时示例 */
.ds-embed { border: 1px solid var(--hairline); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.ds-embed iframe { display: block; width: 100%; border: 0; background: var(--paper); }
.ds-demo-surface { border: 1px solid var(--hairline); border-radius: var(--r); padding: 22px; background: var(--paper); }
.ds-demo-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ds-icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 4px; }
.ds-icon {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  margin: 0; padding: 13px 4px 10px; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--ink); transition: border-color var(--t), background var(--t);
}
.ds-icon:hover { border-color: var(--hairline); background: var(--bone); }
.ds-icon figcaption { font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px; color: var(--muted-text); }

/* ---------------------------------------------------------------- 404 */
.ds-404 { text-align: center; padding-block: 96px 120px; }
.ds-404__code { margin: 0; font-size: clamp(88px, 18vw, 160px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--hairline); }
.ds-404 h1 { margin: 14px 0 0; }
.ds-404__text { max-width: 46ch; margin: 12px auto 0; color: var(--muted-text); }
.ds-404__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 960px) {
  .ds-fgrid, .ds-cgrid, .ds-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-tools { grid-template-columns: 1fr; }
  .ds-browser iframe { height: 460px; }
}
@media (max-width: 640px) {
  .ds-nav { display: none; }
  .ds-nav a { padding: 6px 8px; font-size: 13px; }
  .ds-fgrid, .ds-cgrid, .ds-strip { grid-template-columns: 1fr; }
  .ds-hero__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-dhead { flex-direction: column; }
  .ds-browser iframe { height: 380px; }
}
