/*
 * qinghai.video - CSS Optimization Patch
 * 像素级优化补丁 - Append to main CSS
 * Targets existing classes for refinement
 */

/* ============================================
   1. 光影逻辑自然化 - Unified Shadow System
   ============================================ */

/* Override existing shadow classes */
.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(220, 13%, 46%, 0.04),
              0 1px 1px -1px rgba(220, 13%, 46%, 0.02) !important;
}

.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(220, 13%, 46%, 0.04),
              0 2px 4px -2px rgba(220, 13%, 46%, 0.02) !important;
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(220, 13%, 46%, 0.05),
              0 4px 6px -4px rgba(220, 13%, 46%, 0.02) !important;
}

.shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(220, 13%, 46%, 0.06),
              0 8px 10px -6px rgba(220, 13%, 46%, 0.03) !important;
}

/* Card hover shadows */
.hover\:shadow-lg:hover {
  box-shadow: 0 12px 18px -3px rgba(220, 13%, 46%, 0.06),
              0 5px 8px -4px rgba(220, 13%, 46%, 0.03) !important;
}

/* ============================================
   2. 边缘处理精细化 - Refined Border Radius
   ============================================ */

/* Cards and containers */
.rounded-xl {
  border-radius: 1rem !important;
}

.rounded-2xl,
[class*="rounded-2xl"] {
  border-radius: 1.5rem !important;
}

.rounded-3xl {
  border-radius: 2rem !important;
}

/* Ensure consistent card styling */
[class*="rounded-2xl"],
[class*="rounded-3xl"] {
  overflow: hidden;
}

/* ============================================
   3. 动态反馈细腻化 - Smooth Interactions
   ============================================ */

/* Smooth transitions on interactive elements */
a, button, [role="button"] {
  transition: 
    color 150ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 150ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Button hover enhancement */
[class*="bg-["] button:hover,
[class*="bg-slate"] button:hover,
[class*="bg-white"] button:hover {
  transform: translateY(-1px);
}

/* Card hover effects */
[class*="group"]:hover [class*="hover\:scale"],
[class*="group"]:hover [class*="group-hover"] {
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Image zoom on hover */
[class*="group"]:hover img {
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ============================================
   4. 加载体验优雅化 - Loading States
   ============================================ */

/* Skeleton shimmer overlay */
[class*="bg-slate-200"][class*="animate-pulse"],
[class*="bg-gray-200"][class*="animate-pulse"] {
  background: linear-gradient(
    90deg,
    rgba(226, 232, 240, 0.6) 0%,
    rgba(241, 245, 249, 0.8) 50%,
    rgba(226, 232, 240, 0.6) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.5s infinite linear !important;
}

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

/* ============================================
   5. 响应式美感完美化 - Golden Ratio Spacing
   ============================================ */

/* Section spacing adjustments */
@media (max-width: 639px) {
  [class*="py-"],
  [class*="pt-"],
  [class*="pb-"] {
    --section-spacing: 2rem;
  }
  
  .py-16 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
  .py-20 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
  .py-24 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
}

@media (min-width: 640px) and (max-width: 767px) {
  .py-16 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
  .py-20 { padding-top: 5rem !important; padding-bottom: 5rem !important; }
}

@media (min-width: 768px) {
  /* Optimal retail density for tablet/laptop */
  [class*="py-24"] { padding-top: 6rem !important; padding-bottom: 6rem !important; }
}

@media (min-width: 1024px) {
  /* Grand space for desktop */
  [class*="py-24"] { padding-top: 7rem !important; padding-bottom: 7rem !important; }
}

@media (min-width: 1280px) {
  /* Luxurious spacing for large screens */
  [class*="py-24"] { padding-top: 8rem !important; padding-bottom: 8rem !important; }
}

/* ============================================
   6. Typography Refinements
   ============================================ */

/* Improved line height for body text */
p, [class*="text-slate-600"] {
  line-height: 1.7 !important;
}

/* Refined heading spacing */
h1, h2, h3, h4, h5, h6,
[class*="text-2xl"],
[class*="text-3xl"],
[class*="text-4xl"] {
  letter-spacing: -0.02em !important;
  line-height: 1.2 !important;
}

/* ============================================
   7. Glass Morphism for Headers
   ============================================ */

header, nav {
  transition: 
    background-color 300ms cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 300ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 300ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ============================================
   8. Gradient Text Enhancement
   ============================================ */

/* Safely enhance text-gradient classes */
[class*="bg-clip-text"][class*="text-transparent"] {
  -webkit-background-clip: text !important;
  background-clip: text !important;
}

/* ============================================
   9. Backdrop Filter Support
   ============================================ */

@supports (backdrop-filter: blur(20px)) {
  .backdrop-blur-xl {
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  }
  
  .backdrop-blur-md {
    backdrop-filter: blur(12px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(150%) !important;
  }
}

/* ============================================
   10. Focus State Improvements
   ============================================ */

/* Consistent focus styles */
:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.5) !important;
  outline-offset: 2px !important;
}

/* Button focus states */
button:focus-visible,
[role="button"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

/* ============================================
   11. Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* ============================================
   12. 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;
  }
  
  [class*="animate-pulse"] {
    animation: none !important;
  }
}

/* ============================================
   13. Image Loading States
   ============================================ */

img {
  opacity: 1;
  transition: opacity 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded,
img.loaded {
  opacity: 1;
}

/* ============================================
   14. Card Depth Hierarchy
   ============================================ */

/* Subtle depth for all cards */
[class*="bg-white"][class*="rounded"] {
  transition: 
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

[class*="bg-white"][class*="rounded"]:hover {
  transform: translateY(-2px);
}
