/*!
 * base.css · 重置与排版基线
 * 依赖：tokens.css
 */

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol, li,
form, fieldset, legend,
input, button, select, textarea {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--brand-gold);
  text-decoration: none;
}

a:hover {
  color: var(--brand-gold-light);
  text-decoration: underline;
}

/* ---------- 页面基线 ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--font-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image: var(--bg-page-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

/* 顶部 2px 红金渐变装饰线（PRD §4.1） */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bg-deco-line);
  z-index: var(--z-sticky);
  pointer-events: none;
}

/* ---------- 排版 ---------- */
h1, .h1 {
  font-size: var(--font-title);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: 0.5px;
}

h2, .h2 {
  font-size: var(--font-section);
  font-weight: 600;
  line-height: var(--lh-snug);
}

h3, .h3 {
  font-size: var(--font-card);
  font-weight: 600;
  line-height: var(--lh-snug);
}

.h4 {
  font-size: var(--font-body);
  font-weight: 600;
  line-height: var(--lh-snug);
}

.note {
  font-size: var(--font-note);
  line-height: var(--lh-note);
  color: var(--text-secondary);
}

.muted {
  color: var(--text-muted);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.text-gold { color: var(--brand-gold); }
.text-red  { color: var(--brand-red); }
.text-ok   { color: var(--status-ok); }
.text-err  { color: var(--status-err); }
.text-warn { color: var(--status-warn); }

/* ---------- 焦点可见性（键盘可达）---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---------- 滚动条（仅 WebKit，装饰性）---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-gold);
}

/* ---------- 选中 ---------- */
::selection {
  background: var(--brand-red);
  color: var(--text-on-brand);
}

/* ---------- 无障碍：隐藏但可读 ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* ---------- 打印 ---------- */
@media print {
  body::before,
  .kernel-bar,
  .toast-host,
  .modal-scrim {
    display: none !important;
  }

  body {
    background: #FFFFFF;
    color: #000000;
  }
}
