/* ========================================
   汉堡 AI 空间 - 全局样式
   ======================================== */

/* CSS Variables */
:root {
  --color-bg: #0a0820;
  --color-purple: #7c3aed;
  --color-magenta: #db2777;
  --color-brown: #b45309;
  --color-cyan: #06b6d4;
  --color-white: #ffffff;
  --color-muted: #94a3b8;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-hover: rgba(124, 58, 237, 0.45);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --mouse-x: 50%;
  --mouse-y: 50%;
}

/* Base */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-white);
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
  background-color: rgba(124, 58, 237, 0.4);
  color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Animated Ambient Background
   ======================================== */

#ambient-bg {
  background: radial-gradient(ellipse at 50% 0%, #1a1040 0%, #0a0820 50%, #050314 100%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  will-change: transform;
}

.orb-1 {
  width: 700px;
  height: 700px;
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.45) 0%, rgba(124, 58, 237, 0) 70%);
  animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
  width: 600px;
  height: 600px;
  top: 20%;
  right: -15%;
  background: radial-gradient(circle, rgba(219, 39, 119, 0.35) 0%, rgba(219, 39, 119, 0) 70%);
  animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
  width: 500px;
  height: 500px;
  bottom: 10%;
  left: 20%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, rgba(6, 182, 212, 0) 70%);
  animation: orbFloat3 22s ease-in-out infinite;
}

.orb-4 {
  width: 400px;
  height: 400px;
  bottom: 30%;
  right: 25%;
  background: radial-gradient(circle, rgba(180, 83, 9, 0.22) 0%, rgba(180, 83, 9, 0) 70%);
  animation: orbFloat4 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.1); }
  66% { transform: translate(40px, 120px) scale(0.95); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, 80px) scale(1.05); }
  66% { transform: translate(-100px, 40px) scale(0.95); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(70px, -50px) scale(1.08); }
  66% { transform: translate(30px, -90px) scale(0.98); }
}

@keyframes orbFloat4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -60px) scale(1.12); }
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(0,0,0,0.6) 0%, transparent 50%);
  -webkit-mask-image: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(0,0,0,0.6) 0%, transparent 50%);
  transition: mask-image 0.1s ease, -webkit-mask-image 0.1s ease;
}

/* ========================================
   Mouse Follow Spotlight
   ======================================== */

.mouse-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, rgba(219, 39, 119, 0.06) 35%, transparent 70%);
  transform: translate(calc(var(--mouse-x) - 50%), calc(var(--mouse-y) - 50%));
  transition: transform 0.15s ease-out;
  will-change: transform;
  mix-blend-mode: screen;
}

/* ========================================
   Glassmorphism Cards
   ======================================== */

.glass-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.4s var(--transition-smooth),
    box-shadow 0.4s var(--transition-smooth),
    border-color 0.4s var(--transition-smooth);
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.03), rgba(124,58,237,0.1));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.4s var(--transition-smooth);
}

.glass-card:hover {
  transform: translateY(-8px);
  border-color: var(--glass-border-hover);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    0 20px 60px rgba(124, 58, 237, 0.2),
    0 0 40px rgba(219, 39, 119, 0.1);
}

.glass-card:hover::before {
  opacity: 1;
}

/* Header glass effect when scrolled */
header.scrolled {
  background: rgba(10, 8, 32, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Language toggle */
.lang-toggle {
  position: relative;
  overflow: hidden;
}

.lang-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(124,58,237,0.2), rgba(219,39,119,0.2));
  opacity: 0;
  transition: opacity 0.3s var(--transition-smooth);
}

.lang-toggle:hover::before {
  opacity: 1;
}

.lang-toggle > * {
  position: relative;
  z-index: 1;
}

/* ========================================
   Hero Load Animations
   ======================================== */

.hero-reveal {
  opacity: 0;
  transform: translateY(30px) rotateX(8deg);
  filter: blur(4px);
  animation: heroReveal 0.8s var(--transition-smooth) forwards;
  animation-delay: var(--delay, 0s);
  perspective: 1000px;
}

@keyframes heroReveal {
  0% {
    opacity: 0;
    transform: translateY(30px) rotateX(8deg);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
    filter: blur(0);
  }
}

.hero-image-wrapper {
  opacity: 0;
  transform: translateY(40px) scale(0.96);
  animation: heroImageReveal 1s var(--transition-smooth) forwards;
  animation-delay: 0.5s;
  perspective: 1000px;
}

@keyframes heroImageReveal {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */

.reveal {
  opacity: 0;
  transform: translateY(40px) rotateX(6deg);
  filter: blur(2px);
  transition: opacity 0.7s var(--transition-smooth),
              transform 0.7s var(--transition-smooth),
              filter 0.7s var(--transition-smooth);
  transition-delay: var(--delay, 0s);
  perspective: 1000px;
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0) rotateX(0deg);
  filter: blur(0);
}

/* Stagger for grids */
.reveal-parent .reveal:nth-child(1) { --delay: 0.1s; }
.reveal-parent .reveal:nth-child(2) { --delay: 0.2s; }
.reveal-parent .reveal:nth-child(3) { --delay: 0.3s; }
.reveal-parent .reveal:nth-child(4) { --delay: 0.4s; }

/* ========================================
   3D Card Hover Effect
   ======================================== */

.tilt-card {
  transform-style: preserve-3d;
}

/* ========================================
   Hero Image Glow
   ======================================== */

.hero-image-wrapper {
  position: relative;
}

.hero-image-wrapper::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(219, 39, 119, 0.2), rgba(6, 182, 212, 0.1));
  border-radius: inherit;
  z-index: -1;
  filter: blur(20px);
  opacity: 0.6;
}

/* ========================================
   Button Gradient Animation
   ======================================== */

.btn-gradient {
  position: relative;
  background: linear-gradient(90deg, var(--color-purple), var(--color-magenta));
  background-size: 200% 100%;
  transition: all 0.3s var(--transition-smooth);
}

.btn-gradient:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.4);
}

/* ========================================
   QR Code Popups
   ======================================== */

.qr-trigger-wrapper {
  position: relative;
  display: block;
}

.qr-trigger {
  position: relative;
  z-index: 2;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}

.qr-popup {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(10px);
  width: 180px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.04) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 30px rgba(124,58,237,0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s var(--transition-smooth);
  z-index: 10;
}

@media (min-width: 769px) {
  .qr-popup {
    left: auto;
    right: 0;
    transform: translateY(10px);
  }
}

.qr-popup img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.qr-popup span {
  display: block;
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: #e2e8f0;
}

.qr-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: rgba(255,255,255,0.1) transparent transparent transparent;
}

.qr-trigger-wrapper:hover .qr-popup,
.qr-trigger:focus + .qr-popup,
.qr-popup:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
  .qr-trigger-wrapper:hover .qr-popup,
  .qr-trigger:focus + .qr-popup,
  .qr-popup:focus-within {
    transform: translateY(0);
  }
}

/* ========================================
   Mobile Menu
   ======================================== */

#mobile-menu {
  transition: opacity 0.3s var(--transition-smooth);
}

#mobile-menu.hidden {
  opacity: 0;
  pointer-events: none;
}

#mobile-menu:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
  .mouse-spotlight,
  .ambient-grid {
    display: none;
  }

  .hero-reveal {
    transform: translateY(20px) rotateX(4deg);
  }

  .reveal {
    transform: translateY(30px) rotateX(4deg);
  }

  .glass-card:hover {
    transform: translateY(-4px);
  }

  .qr-popup {
    left: 0;
    transform: translateX(0) translateY(10px);
    width: 160px;
  }

  .qr-trigger-wrapper:hover .qr-popup,
  .qr-trigger:focus + .qr-popup,
  .qr-popup:focus-within {
    transform: translateX(0) translateY(0);
  }
}

@media (max-width: 480px) {
  .qr-popup {
    left: auto;
    right: 0;
  }
}

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

@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;
  }

  .hero-reveal,
  .reveal,
  .hero-image-wrapper {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }

  .mouse-spotlight {
    display: none;
  }
}

/* ========================================
   Focus Styles
   ======================================== */

a:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.8);
  outline-offset: 2px;
}
