/**
 * 优化后的主样式文件
 * 减少冗余，提高性能
 */

/* ==================== CSS变量 ==================== */
:root {
  /* 颜色 */
  --color-primary: #287CFA;
  --color-primary-dark: #1E2A4A;
  --color-text: #333333;
  --color-text-secondary: #666F83;
  --color-border: #495670;
  --color-white: #ffffff;
  
  /* 间距 */
  --header-height: 60px;
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  
  /* 过渡 */
  --transition: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* 断点 */
  --breakpoint-md: 768px;
  
  /* 字体 */
  --font-primary: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Alibaba PuHuiTi 3.0", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ==================== 全局重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-primary);
  color: var(--color-text);
  background: var(--color-white);
  line-height: 1.6;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

body.loaded {
  opacity: 1;
}

a {
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.8;
}

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

/* 隐藏滚动条但保持功能 */
::-webkit-scrollbar {
  display: none;
}

html {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==================== 响应式字体 ==================== */
@media screen and (min-width: 320px) {
  html, body { font-size: 3px; }
  div { font-size: 3rem; }
}

@media screen and (min-width: 768px) {
  html, body { font-size: 4px; }
  div { font-size: 4rem; }
}

/* ==================== 头部导航 ==================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  transition: transform var(--transition), background-color var(--transition), color var(--transition);
}

.site-header__bar,
.site-header__inner {
  height: var(--header-height);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.site-header__logo-icon {
  width: 42px !important;
  height: 42px !important;
  flex-shrink: 0;
  object-fit: contain;
}

.site-header__logo-text {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 60px;
}

.site-header__nav > a {
  position: relative;
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  white-space: nowrap;
}

.site-header__nav > a.navigatorSelect,
.site-header__nav > a.navigatorActive {
  font-weight: 700;
}

.site-header__nav > a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -19px;
  transform: translateX(-50%);
  width: 0;
  height: 4px;
  background-color: currentColor;
  transition: width var(--transition);
}

.site-header__nav > a.navigatorSelect::after,
.site-header__nav > a.navigatorActive::after {
  width: 32px;
}

.site-header__menu-toggle {
  cursor: pointer;
  flex-shrink: 0;
}

.site-header__menu-icon {
  width: 40px !important;
  height: 40px !important;
  object-fit: contain;
}

/* 头部状态变化 */
.site-header--top {
  background: rgba(255, 255, 255, 0.8);
  color: var(--color-text);
}

.site-header--scrolled {
  background: transparent;
  color: var(--color-text);
}

.site-header--scroll-up-hidden {
  transform: translateY(-100%);
}

.site-header--pinned {
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
}

.site-header--scrolled .site-header__menu-icon {
  filter: brightness(0) invert(1);
}

/* ==================== 悬浮组件 ==================== */
.appCode,
.wechatCode {
  display: none;
}

/* ==================== 移动端导航 ==================== */
.mobile-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: var(--color-white);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile-nav-open {
  overflow: hidden;
}

/* ==================== 响应式断点 ==================== */
@media screen and (min-width: 768px) {
  .site-header__inner {
    padding: 0;
  }
}

@media (max-width: 767px) {
  .site-header__bar .site-header__logo-text {
    display: none;
  }
  
  .site-header__logo-text--mobile {
    font-size: 22px !important;
  }
  
  .site-header__brand--mobile .site-header__logo-icon--mobile {
    width: 36px !important;
    height: 36px !important;
  }
}

/* ==================== 打印样式 ==================== */
@media print {
  .site-header,
  .floating-actions,
  .mobile-nav-panel {
    display: none !important;
  }
}

/* ==================== 性能优化 ==================== */
/* 减少动画（尊重用户偏好） */
@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;
  }
}
