/* base.css — 重置、排版基元、布局容器 */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection);
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0 0 1em;
}
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.35;
}
p:last-child {
  margin-bottom: 0;
}

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

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* 行内元素：等宽数据 / 衬线叙事 */
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.serif {
  font-family: var(--font-serif);
}
.dim {
  color: var(--fg-dim);
}
.faint {
  color: var(--fg-faint);
}

/* 链接化的可点击行：继承文字色、去掉下划线，hover 交给组件 */
.rowlink {
  display: block;
  color: inherit;
}
.rowlink:hover {
  text-decoration: none;
}

/* 内容容器：940px 档案宽 */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* 正文排版（详情页/卡片正文） */
.article-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}
.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

/* 行数截断基元 */
.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp.expanded {
  -webkit-line-clamp: unset;
}

/* 视图切换入场 */
.view {
  animation: arc-fade 0.5s var(--ease);
}
@keyframes arc-fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* 悬浮层入场 */
.pop {
  animation: arc-pop 0.4s var(--ease);
}
@keyframes arc-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: 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;
}

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