/* ============================================
   XINGJIA DESIGN SYSTEM — BASE
   基础重置、无障碍、减少动效、图片兜底
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  text-size-adjust: 100%;
}

body {
  font-family: var(--xj-font-sans);
  font-size: var(--xj-text-base);
  line-height: var(--xj-leading-relaxed);
  color: var(--xj-text);
  background-color: var(--xj-bg);
  overflow-x: hidden;
}

/* 图片：默认占位与错误兜底 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

img.xj-img,
video.xj-img,
.xj-img img,
.xj-img video {
  background-color: var(--xj-surface);
  object-fit: cover;
}

img.xj-img-contain,
.xj-img-contain img {
  object-fit: contain;
}

img.is-error,
img[data-error="true"] {
  opacity: 0 !important;
  visibility: hidden;
}

.xj-img-wrap {
  position: relative;
  background-color: var(--xj-surface);
  overflow: hidden;
}

.xj-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.25) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: xj-shimmer 1.6s infinite;
  pointer-events: none;
}

.xj-img-wrap.is-loaded::after {
  display: none;
}

[data-theme="dark"] .xj-img-wrap::after {
  background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.06) 50%, transparent 60%);
  background-size: 200% 100%;
}

@keyframes xj-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 链接与按钮基础 */
a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* 焦点样式：高对比度可见 */
:focus-visible {
  outline: 2px solid var(--xj-accent);
  outline-offset: 2px;
  border-radius: var(--xj-radius-sm);
}

/* 减少动效 */
@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;
  }
}

/* 隐藏但可被屏幕阅读器读取 */
.xj-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;
}

/* 选中文字颜色 */
::selection {
  background-color: var(--xj-accent);
  color: var(--xj-text-inverse);
}
