/**
 * Splatoon 3 Hub - Common Styles
 * 统一基础样式系统 - 设计令牌 + 工具类 + 重置样式
 * v3.0.0 - 2025-02-14
 */

/* ============================================
   1. 设计令牌 - CSS变量系统
   ============================================ */

:root {
  /* --- 品牌色系统 --- */
  --ink-primary: #ff3e8c;
  --ink-primary-dark: #E6007E;
  --ink-secondary: #00e5ff;
  --ink-secondary-dark: #00A0E9;
  --ink-tertiary: #ffeb3b;
  --ink-tertiary-dark: #FFF000;
  --ink-purple: #9c27b0;
  --ink-purple-dark: #6B2C91;
  --ink-orange: #ff9800;
  --ink-green: #76ff03;
  
  /* --- 霓虹发光色 --- */
  --neon-pink: #FF00FF;
  --neon-cyan: #00FFFF;
  --neon-yellow: #FFFF00;
  --neon-purple: #9c27b0;
  
  /* --- 故障艺术色 --- */
  --glitch-cyan: #00ffff;
  --glitch-red: #ff0000;
  --glitch-green: #00ff00;
  --glitch-offset: 2px;
  
  /* --- 背景色系统 --- */
  --bg-dark: #1a1a2e;
  --bg-darker: #0f0f1a;
  --bg-card: #16213e;
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --bg-overlay: rgba(15, 15, 26, 0.7);
  --bg-polaroid: #f5f5f5;
  
  /* --- 文字色系统 --- */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-dark: #333333;
  --text-ink-primary: #E6007E;
  --text-ink-secondary: #00A0E9;
  
  /* --- 间距系统 (8px基准) --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* --- 圆角系统 --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* --- 阴影系统 --- */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-pink: 0 0 20px rgba(255, 0, 255, 0.6), 0 0 40px rgba(255, 0, 255, 0.3);
  --shadow-glow-cyan: 0 0 20px rgba(0, 255, 255, 0.6), 0 0 40px rgba(0, 255, 255, 0.3);
  --shadow-polaroid: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-polaroid-hover: 0 25px 60px rgba(0, 0, 0, 0.5);
  
  /* --- 过渡动画 --- */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* --- 字体系统 --- */
  --font-display: 'AsiaKCUBE-R', 'AsiaKERIN-M', 'Noto Sans SC', sans-serif;
  --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-number: 'NinSplatoonSdodrNumber-Reg', 'AsiaKCUBE-R', monospace;
  
  /* --- 字体大小 (rem基准16px) --- */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 2rem;      /* 32px */
  --text-4xl: 2.5rem;    /* 40px */
  --text-5xl: 3rem;      /* 48px */
  
  /* --- 响应式断点 (用于JS检测) --- */
  --breakpoint-xs: 320px;
  --breakpoint-sm: 375px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1440px;
  --breakpoint-2xl: 1920px;
  
  /* --- 安全区域 (iPhone刘海屏等) --- */
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
  
  /* --- Z-index层级 --- */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  
  /* --- 布局常量 --- */
  --container-max: 1400px;
  --container-narrow: 1000px;
  --nav-height: 60px;
  --touch-target: 44px;
}

/* ============================================
   2. CSS重置 - Normalize + 自定义
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-dark);
  overflow-x: hidden;
  min-height: 100vh;
  /* 安全区域适配 */
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
}

/* 禁用文本选择（游戏风格） */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* 例外：允许选择的区域 */
.copyable, .contact-info, .polaroid-info, pre, code {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* 移动端优化 */
input, button, textarea, select {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* ============================================
   3. 字体工具类
   ============================================ */

.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-number { 
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   4. 布局工具类
   ============================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.container-narrow {
  max-width: var(--container-narrow);
}

.container-full {
  max-width: none;
}

/* Flex布局 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }

/* Grid布局 */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 间距工具类 */
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ============================================
   5. 响应式断点工具类
   ============================================ */

/* 隐藏/显示工具类 */
.hide { display: none !important; }

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
  .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }
}

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
  .show-desktop { display: block !important; }
}

/* ============================================
   6. 触摸优化工具类
   ============================================ */

/* 最小触摸区域 44x44px */
.touch-target {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 禁用hover效果（触摸设备） */
@media (hover: none) and (pointer: coarse) {
  .no-hover-touch:hover {
    transform: none !important;
  }
  
  /* 增大触摸目标 */
  button, a, .clickable {
    min-height: var(--touch-target);
  }
}

/* ============================================
   7. 可访问性
   ============================================ */

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* 焦点样式 */
:focus-visible {
  outline: 2px solid var(--ink-primary);
  outline-offset: 2px;
}

/* 屏幕阅读器专用 */
.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;
}

/* ============================================
   8. 性能优化类
   ============================================ */

/* GPU加速 */
.gpu-accelerate {
  transform: translateZ(0);
  will-change: transform;
}

/* 内容可见性优化 */
.content-visibility-auto {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/* 图片懒加载占位 */
.lazy-placeholder {
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.05) 25%, 
    rgba(255,255,255,0.1) 50%, 
    rgba(255,255,255,0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* ============================================
   9. 工具函数类
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

/* 圆角工具类 */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* 阴影工具类 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-glow-pink { box-shadow: var(--shadow-glow-pink); }
.shadow-glow-cyan { box-shadow: var(--shadow-glow-cyan); }
