/* ============================================================
   导航站样式
   - 修改配色：调整下面 :root 与 [data-theme="dark"] 中的变量即可
   - 响应式断点：900px（平板/手机侧栏改为横向标签）、560px（手机细节）
   ============================================================ */

:root {
  --header-h: 60px;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --field-bg: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --header-bg: rgba(255, 255, 255, 0.82);
  --shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.35);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #131b2e;
  --field-bg: #1b2439;
  --text: #e6edfb;
  --muted: #93a4bf;
  --border: #22304a;
  --accent: #6b9bff;
  --accent-soft: rgba(107, 155, 255, 0.14);
  --header-bg: rgba(11, 17, 32, 0.84);
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 420px at 85% -10%, var(--accent-soft), transparent 65%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--field-bg);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  background: var(--accent);
  color: #fff;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ---------- 顶部栏 ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.7);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-kbd {
  position: absolute;
  right: 10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ---------- 侧栏分类 ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-link {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.16s ease, background 0.16s ease;
}

.side-link::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.side-link:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.side-link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.side-link.is-active::before {
  opacity: 1;
  transform: scale(1.3);
}

.side-tip {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

/* ---------- 内容区 ---------- */
.content {
  min-width: 0;
}

.section {
  margin-bottom: 34px;
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.section.is-hidden {
  display: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h2 {
  position: relative;
  margin: 0;
  padding-left: 11px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), #7c3aed);
}

.count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card:active {
  transform: translateY(0);
}

.card.is-hidden {
  display: none;
}

.logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c1, #2563eb), var(--c2, #7c3aed));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
  user-select: none;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.card-title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-desc {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- 空状态 ---------- */
.empty {
  display: none;
  padding: 64px 20px;
  text-align: center;
}

.empty.show {
  display: block;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.empty-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, color 0.2s ease;
}

.to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  color: var(--accent);
}

.to-top svg {
  width: 18px;
  height: 18px;
}

/* ---------- 页脚 ---------- */
.footer {
  padding: 26px 24px 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-bottom: 10px;
  font-size: 12px;
}

.footer-stats span {
  white-space: nowrap;
}

.stat-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.footer-beian {
  margin-top: 8px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 900px) {
  .layout {
    display: block;
    padding: 0 16px 40px;
  }

  .header-inner {
    gap: 10px;
    padding: 0 16px;
  }

  .brand-name {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: var(--header-h);
    z-index: 30;
    margin: 0 -16px;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .side-nav {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-link {
    flex: none;
    padding: 6px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    white-space: nowrap;
  }

  .side-link::before {
    display: none;
  }

  .side-link.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }

  .side-tip {
    display: none;
  }

  .content {
    padding-top: 20px;
  }

  .section {
    scroll-margin-top: calc(var(--header-h) + 62px);
  }
}

@media (max-width: 560px) {
  .search-kbd {
    display: none;
  }

  .search input {
    padding-right: 12px;
    font-size: 13.5px;
  }

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

  .section-head h2 {
    font-size: 16px;
  }

  .footer {
    padding-bottom: 28px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
