/* ============================================
   墨香书阁 - 全局样式
   ============================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  background: #FAFAF7;
  color: #1A1A1A;
  line-height: 1.75;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 衬线体 ── */
.serif {
  font-family: 'Noto Serif SC', Georgia, serif;
}

/* ── 文本截断 ── */
.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 隐藏滚动条 ── */
.hscroll::-webkit-scrollbar { display: none; }
.hscroll { -ms-overflow-style: none; scrollbar-width: none; }

/* ── 导航链接 ── */
.nav-link {
  position: relative;
}

/* ═══════════════════════════════════
   动画
   ═══════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

.anim-fade { animation: fadeIn 300ms ease-out; }
.anim-slide { animation: slideIn 280ms ease-out; }
.t-in { animation: toastIn 250ms ease-out; }
.t-out { animation: toastOut 200ms ease-in forwards; }

/* ═══════════════════════════════════
   交互增强
   ═══════════════════════════════════ */

/* 按钮点击反馈 */
button:active {
  transform: scale(0.98);
}

/* 链接下划线动画 */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #C85A3A;
  transition: width 200ms ease-out;
}

.link-underline:hover::after {
  width: 100%;
}

/* ═══════════════════════════════════
   响应式微调
   ═══════════════════════════════════ */

@media (max-width: 640px) {
  body { font-size: 14px; }
}

/* ── 焦点可见性 ── */
:focus-visible {
  outline: 2px solid #C85A3A;
  outline-offset: 2px;
}

/* ── 选择文字 ── */
::selection {
  background: rgba(200, 90, 58, 0.12);
  color: #1A1A1A;
}

/* ── 图片懒加载占位 ── */
.img-placeholder {
  background: linear-gradient(135deg, #E8E5DE 0%, #FAFAF7 100%);
}

/* ── 页脚链接分隔 ── */
footer a + a::before {
  content: '·';
  margin-right: 0;
}
