/* ========================================
 * base.css - 全局重置 + 排版 + 布局基线
 * 依赖 theme.css 的 CSS 变量
 * ======================================== */

/* --- 重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --- 排版 --- */
h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 2rem; font-weight: 700; line-height: 1.25; }
h3 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h4 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }

p { margin-bottom: 1rem; }

a { color: var(--foreground); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875em;
}

/* --- 容器 --- */
.container {
  width: 100%;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- 布局 --- */
main {
  flex: 1;
  min-width: 0;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

/* --- App 布局 (sidebar + content) --- */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 120px);
}

.app-sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
}

.app-content { padding: 2rem 1.5rem; }

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
}

/* --- 工具类 --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.text-muted { color: var(--muted-foreground); }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
