/**
 * Star Photo Share System
 * Base CSS - 基础样式重置与全局排版
 * Version 1.0
 * 2026-07-17
 *
 * 功能：CSS Reset、全局排版、基础元素样式
 */

/* ========================================
   CSS Reset
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-zh), var(--font-en);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--bg-deep-space);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   可访问性 - 焦点样式
   ======================================== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================
   链接
   ======================================== */
a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

a:visited {
  color: var(--secondary-light);
}

/* ========================================
   标题
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-md); }

/* ========================================
   段落
   ======================================== */
p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* ========================================
   图片
   ======================================== */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--transition-normal);
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ========================================
   列表
   ======================================== */
ul, ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ========================================
   分割线
   ======================================== */
hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-6) 0;
}

/* ========================================
   选中文本
   ======================================== */
::selection {
  background: rgba(37, 99, 235, 0.4);
  color: var(--text-primary);
}

/* ========================================
   滚动条
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ========================================
   通用工具类
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   动画减弱偏好
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
