/* Civilization Gateway - Phase 1 Token System */
/* Run Up Studio - Year 3025 Vision - 10% Implementation */

:root {
  /* ===== 文明色彩系统 ===== */

  /* 主色调 - Pearl White 系列 */
  --pearl-white: #fafaf9;
  --pearl-warm: #f8f6f3;
  --cloud-gray: rgba(245, 245, 243, 0.6);
  --mist: rgba(250, 250, 249, 0.85);

  /* 点缀色 - Crystal 系列 */
  --crystal-blue: rgba(200, 220, 255, 0.15);
  --crystal-violet: rgba(220, 210, 255, 0.12);
  --lavender-mist: rgba(230, 220, 255, 0.08);
  --aurora-glow: rgba(187, 217, 239, 0.2);

  /* 深色 - 半透明而非纯黑 */
  --ink-soft: rgba(10, 9, 18, 0.85);
  --ink-medium: rgba(10, 9, 18, 0.5);
  --ink-whisper: rgba(10, 9, 18, 0.3);
  --ink-ghost: rgba(10, 9, 18, 0.08);

  /* 强调色 - 温和版本 */
  --accent-lavender: #a49aef;
  --accent-ice: #b9d9ef;
  --accent-rose: #e6a9c0;
  --accent-mint: #b9ded5;

  /* ===== 流体圆角系统 ===== */
  --radius-fluid: 24px;
  --radius-portal: 32px;
  --radius-breath: 28px;
  --radius-organic: 50%;

  /* ===== 空间系统 ===== */
  --space-whisper: 8px;
  --space-breath: 16px;
  --space-float: 32px;
  --space-drift: 64px;
  --space-horizon: 120px;

  /* ===== 动效时间 ===== */
  --breathe-slow: 4s;
  --breathe-medium: 2.5s;
  --breathe-fast: 1.8s;
  --float-gentle: 6s;
  --transition-smooth: 0.8s;
  --transition-silk: 1.2s;

  /* ===== 动效曲线 ===== */
  --ease-organic: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-gentle: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-breathe: cubic-bezier(0.45, 0, 0.55, 1);

  /* ===== 模糊与玻璃效果 ===== */
  --glass-blur: blur(12px);
  --glass-blur-heavy: blur(24px);
  --frosted-bg: rgba(255, 255, 255, 0.7);
  --frosted-border: rgba(255, 255, 255, 0.3);

  /* ===== 阴影系统（5层渐进） ===== */
  --shadow-whisper: 0 1px 3px rgba(10, 9, 18, 0.02), 0 1px 2px rgba(10, 9, 18, 0.03);
  --shadow-breath: 0 2px 8px rgba(10, 9, 18, 0.03), 0 1px 4px rgba(10, 9, 18, 0.04);
  --shadow-float: 0 4px 16px rgba(10, 9, 18, 0.04), 0 2px 8px rgba(10, 9, 18, 0.05);
  --shadow-drift: 0 8px 32px rgba(10, 9, 18, 0.05), 0 4px 16px rgba(10, 9, 18, 0.06);
  --shadow-portal: 0 16px 64px rgba(10, 9, 18, 0.06), 0 8px 32px rgba(10, 9, 18, 0.08);

  /* ===== 字体系统 ===== */
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;

  /* ===== 层级系统 ===== */
  --z-floor: 0;
  --z-surface: 10;
  --z-float: 20;
  --z-portal: 30;
  --z-sky: 40;
  --z-cosmos: 50;
}

/* ===== 全局呼吸动效 ===== */

@keyframes breathe {
  0%, 100% {
    opacity: 0.95;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.002);
  }
}

@keyframes float-gentle {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  33% {
    transform: translateY(-8px) translateX(4px);
  }
  66% {
    transform: translateY(-4px) translateX(-4px);
  }
}

@keyframes glow-pulse {
  0%, 100% {
    opacity: 0.6;
    filter: blur(8px);
  }
  50% {
    opacity: 0.9;
    filter: blur(12px);
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 实用类（Phase 1 快速应用） ===== */

.breathe {
  animation: breathe var(--breathe-slow) ease-in-out infinite;
}

.float-gentle {
  animation: float-gentle var(--float-gentle) ease-in-out infinite;
}

.fade-in {
  animation: fade-in-up 0.8s var(--ease-organic) both;
}

.glass-surface {
  background: var(--frosted-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--frosted-border);
}

.shadow-float {
  box-shadow: var(--shadow-float);
}

.transition-smooth {
  transition: all var(--transition-smooth) var(--ease-organic);
}

/* ===== 空间辅助类 ===== */

.space-horizon { padding: var(--space-horizon); }
.space-drift { padding: var(--space-drift); }
.space-float { padding: var(--space-float); }
.space-breath { padding: var(--space-breath); }

.gap-horizon { gap: var(--space-horizon); }
.gap-drift { gap: var(--space-drift); }
.gap-float { gap: var(--space-float); }

/* ===== 圆角辅助类 ===== */

.radius-fluid { border-radius: var(--radius-fluid); }
.radius-portal { border-radius: var(--radius-portal); }
.radius-breath { border-radius: var(--radius-breath); }
.radius-organic { border-radius: var(--radius-organic); }

/* ===== Scroll-triggered Animations ===== */

.fade-in-when-visible {
  opacity: 0;
  transform: translateY(32px);
  transition: 
    opacity 1000ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in-when-visible.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Loading States ===== */

.loading-shimmer {
  background: linear-gradient(
    90deg,
    rgba(250, 250, 249, 0) 0%,
    rgba(250, 250, 249, 0.8) 50%,
    rgba(250, 250, 249, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

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

/* ===== Focus Styles (Accessibility) ===== */

*:focus-visible {
  outline: 2px solid rgba(164, 154, 239, 0.6);
  outline-offset: 3px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline-color: rgba(164, 154, 239, 0.8);
}

/* ===== Reduced Motion Support ===== */

@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;
  }
  
  .breathe,
  .float-gentle {
    animation: none !important;
  }
}

/* ===== Reduced Transparency Support ===== */

@media (prefers-reduced-transparency: reduce) {
  html .site-header,
  html .side-rail,
  html .info-rail,
  html .creator-mode,
  html .rail-toggle,
  html .toast,
  html .catalog-header,
  html .glass-surface {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html .room-page .site-header { background: rgba(10, 9, 18, .97) !important; }
  html .site-header { background: rgba(248, 245, 242, .97) !important; }
  html .side-rail,
  html .info-rail { background: rgba(250, 250, 249, .98) !important; }
  html .creator-mode,
  html .catalog-header { background: rgba(255, 255, 255, .98) !important; }
  html .toast { background: rgba(255, 255, 255, .99) !important; }
}

/* ===== High Contrast Mode Support ===== */

@media (prefers-contrast: high) {
  :root {
    --ink-soft: rgba(10, 9, 18, 1);
    --ink-whisper: rgba(10, 9, 18, 0.6);
  }
  
  .side-nav a {
    opacity: 0.5 !important;
  }
  
  .side-nav a:hover,
  .side-nav a.is-current {
    opacity: 1 !important;
  }
}

/* ===== Print Styles ===== */

@media print {
  .side-rail,
  .hero-tools,
  .menu-button {
    display: none !important;
  }
  
  .breathe,
  .float-gentle {
    animation: none !important;
  }
  
  * {
    background: white !important;
    color: black !important;
  }
}

/* ===== Utility: Smooth Reveal ===== */

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal-item 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-stagger > *:nth-child(1) { animation-delay: 0ms; }
.reveal-stagger > *:nth-child(2) { animation-delay: 100ms; }
.reveal-stagger > *:nth-child(3) { animation-delay: 200ms; }
.reveal-stagger > *:nth-child(4) { animation-delay: 300ms; }
.reveal-stagger > *:nth-child(5) { animation-delay: 400ms; }
.reveal-stagger > *:nth-child(6) { animation-delay: 500ms; }

@keyframes reveal-item {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Low-end Device Optimizations ===== */
.low-end-device .breathe,
.low-end-device .float-gentle,
.low-end-device .atlas-orb {
  animation: none !important;
}

.low-end-device .product-card {
  transition-duration: 300ms !important;
}

.low-end-device * {
  will-change: auto !important;
}

