/* ==========================================================================
   base.css — reset、字体阶梯、间距网格、布局骨架
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  transition: background-color var(--dur-input) var(--ease),
    color var(--dur-input) var(--ease);
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p { margin: 0; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

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

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

::selection {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
}

/* 滚动条：细、灰、不抢眼 */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--foreground) 20%, transparent) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--foreground) 18%, transparent);
  border: 3px solid var(--background);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--foreground) 32%, transparent);
}

/* ---------- 布局骨架 ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  padding: 32px 40px 80px;
  max-width: 1120px;
  width: 100%;
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 12px 16px;
  }
  .sidebar .nav-group-title { display: none; }
  .sidebar .nav-list { display: flex; gap: 4px; }
  .content { padding: 24px 20px 64px; }
}

/* ---------- 通用工具 ---------- */

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.grow { flex: 1 1 auto; }
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.text-muted { color: var(--muted-foreground); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.lead { font-size: 15px; line-height: 1.65; color: var(--muted-foreground); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* 区块 */
.section { margin-bottom: 56px; scroll-margin-top: 88px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { margin-bottom: 6px; }
.section-head p { color: var(--muted-foreground); font-size: 13.5px; }

.demo-surface {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 24px;
}
.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.demo-row + .demo-row { margin-top: 16px; }
.demo-label {
  width: 100%;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: -4px;
}
