/* ===== 优化后的CSS文件 ===== */
:root {
  /* 颜色变量 - 使用OKLCH色域实现更广色域支持 */
  --primary: oklch(65% 0.25 250); /* 蓝 */
  --primary-dark: oklch(55% 0.25 250);
  --secondary: oklch(65% 0.25 25); /* 红 */
  --light: oklch(98% 0.01 250);
  --dark: oklch(25% 0.01 250);
  --gray: oklch(95% 0.01 250);
  
  /* 字体栈 - 支持现代字体特性 */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, 
               "Segoe UI", "Microsoft YaHei", sans-serif;
  
  /* 间距系统 */
  --space-unit: 1rem;
  --space-xs: calc(0.5 * var(--space-unit));
  --space-sm: calc(0.75 * var(--space-unit));
  --space-md: var(--space-unit);
  --space-lg: calc(1.5 * var(--space-unit));
  
  /* 动画曲线 */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

/* 使用:where降低特异性 */
:where(html) {
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-md);
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

:where(body) {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--dark);
  background: var(--light);
  min-height: 100dvh; /* 动态视口单位 */
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ===== 排版系统 ===== */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  max-inline-size: 60ch; /* 字符限制 */
}

p, li {
  max-inline-size: 75ch;
}

/* ===== 布局系统 ===== */
.container {
  --gutter: var(--space-md);
  width: min(100% - 2 * var(--gutter), 1200px);
  margin-inline: auto;
}

/* ===== 组件样式 ===== */
.btn {
  --btn-bg: var(--primary);
  --btn-text: white;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0.5em;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-weight: 500;
  transition: 
    background 200ms var(--ease-in-out),
    transform 100ms var(--ease-in-out);
  
  &:hover {
    background: color-mix(in oklch, var(--btn-bg), black 10%);
    transform: translateY(-2px);
  }
  
  &:active {
    transform: translateY(0);
  }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  :root {
    --space-unit: 0.875rem;
  }
  
  .container {
    --gutter: var(--space-sm);
  }
}

/* ===== 现代特性支持 ===== */
@supports (scrollbar-gutter: stable) {
  html {
    scrollbar-gutter: stable;
  }
}

@supports (height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

/* ===== 性能优化 ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== 打印样式 ===== */
@media print {
  :root {
    --light: white;
    --dark: black;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .btn {
    display: none;
  }
}