/* ============================================================
   GBlog-Go 公共基础层 — CSS 重置与基础样式
   所有主题共享，主题层可覆盖
   ============================================================ */

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

/* --- 基础排版 --- */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  line-height: var(--line-height, 1.7);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --- 链接与图片 --- */
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* --- 标题默认 --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* --- 文本选中 --- */
::selection {
  background: var(--accent, #d4a04a);
  color: var(--bg, #08080a);
}

/* --- 滚动条 --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg, #08080a);
}
::-webkit-scrollbar-thumb {
  background: var(--surface-2, #1e1e26);
  border-radius: 4px;
  transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent, #d4a04a);
}

/* --- 容器 --- */
.container {
  max-width: var(--maxw, 960px);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- 键盘焦点可见性 --- */
:focus-visible {
  outline: 2px solid var(--accent, #d4a04a);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* --- 通用工具类 --- */
.hidden { display: none !important; }
.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;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }

/* --- 无障碍：尊重用户动画偏好 --- */
@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;
  }
}

/* --- 表格重置 --- */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95em;
}
th, td {
  padding: var(--space-3, 12px) var(--space-4, 16px);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
  border-bottom: 2px solid var(--border, #1e1e26);
}

/* --- 表单元素重置 --- */
input, textarea, select, button {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
}
textarea {
  resize: vertical;
  min-height: 80px;
}

/* --- 打印样式 --- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .site-header, .site-footer, .sidebar, .announcement-bar,
  .back-to-top, .reading-progress, .share-buttons { display: none !important; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  a[href^="#"]::after { content: ""; }
}
