/* ============================================================================
   知萃 DistillAI — 基础样式复位
   版本: v2.7
   用途: CSS Reset + Design Token 引入 + 全局 Typography/容器/滚动条/响应式断点
   依赖: distillai-design-tokens.css（本文件第一行 @import）
   ============================================================================ */

@import url("./distillai-design-tokens.css");

/* ==========================================================================
   §1 CSS Reset / 归一化
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--zd-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--zd-text);
  background-color: var(--zd-cloud);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--zd-sky-500);
  text-decoration: none;
  transition: color var(--zd-duration-fast) var(--zd-ease-out);
}

a:hover {
  text-decoration: underline;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--zd-ink);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  color: var(--zd-text);
}

small,
.text-muted {
  color: var(--zd-muted);
  font-size: 0.875rem;
}

/* 选中文本高亮 */
::selection {
  background-color: var(--zd-mint-100);
  color: var(--zd-ink);
}

/* ==========================================================================
   §2 代码块样式
   ========================================================================== */

code,
kbd,
samp,
pre {
  font-family: var(--zd-mono);
}

code {
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background-color: var(--zd-line);
  color: var(--zd-ink);
}

pre {
  background-color: var(--zd-navy-900);
  color: var(--zd-mint-300);
  padding: var(--zd-space-4);
  border-radius: var(--zd-radius-sm);
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.875rem;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ==========================================================================
   §3 滚动条美化 — Mint 色调细滚动条
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--zd-mint-500);
  border-radius: var(--zd-radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--zd-mint-600);
}

/* Firefox 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--zd-mint-500) transparent;
}

/* ==========================================================================
   §4 容器与响应式断点
   ========================================================================== */

/* 基础容器 — 居中 + 水平内边距 */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--zd-space-6);
  padding-right: var(--zd-space-6);
}

/* Desktop ≥ 1200px — 最大宽 1260px */
@media (min-width: 1200px) {
  .container {
    max-width: 1260px;
  }
}

/* Tablet 768–1199px — 自适应宽度，保留内边距 */
@media (min-width: 768px) and (max-width: 1199px) {
  .container {
    max-width: none;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.375rem; }
}

/* Mobile ≤ 767px — 全宽，收紧内边距 */
@media (max-width: 767px) {
  .container {
    padding-left: var(--zd-space-4);
    padding-right: var(--zd-space-4);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }

  body {
    font-size: 15px;
  }

  pre {
    padding: var(--zd-space-3);
    font-size: 0.8125rem;
  }
}

/* Compact ≤ 420px — 极紧凑 */
@media (max-width: 420px) {
  .container {
    padding-left: var(--zd-space-3);
    padding-right: var(--zd-space-3);
  }

  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }

  body {
    font-size: 14px;
  }
}

/* ==========================================================================
   §5 工具类 — 最小集合
   ========================================================================== */

.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;
}


/* ==========================================================================
   无障碍 — 键盘焦点可见样式
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--zd-mint-500, #62E3A7);
  outline-offset: 2px;
  border-radius: 4px;
}
/* ==========================================================================
   无障碍 — 尊重用户动效偏好
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
