/* =========================================== */
/* MOBILE PERFORMANCE OPTIMIZATIONS */
/* Critical CSS for mobile UX/UI & performance */
/* =========================================== */

@media (max-width: 768px) {
  /* ===== REDUCE REPAINTS/REFLOWS ===== */
  /* Use GPU acceleration for transforms */
  .artwork-card,
  .category-card,
  .artwork-grid-item,
  .bento-card {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
  }
  
  /* Contain layout calculations */
  .artwork-image-container,
  .category-card-image,
  .bento-card-image {
    contain: layout style paint;
  }
  
  /* ===== OPTIMIZE SCROLL PERFORMANCE ===== */
  html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* ===== REDUCE ANIMATION COMPLEXITY ===== */
  /* Simplify animations on mobile */
  * {
    animation-duration: calc(var(--animation-duration, 1s) * 1.15) !important;
    transition-duration: calc(var(--transition-duration, 0.3s) * 1.15) !important;
  }
  
  /* Disable expensive effects */
  .ken-burns-animation,
  .parallax-bg,
  .parallax-layer {
    animation: none !important;
    transform: none !important;
    will-change: auto !important;
  }
  
  /* Simplify hover effects */
  .artwork-card:hover,
  .category-card:hover {
    transform: translateY(-2px) scale(1.01) !important;
  }
  
  /* ===== IMAGE OPTIMIZATION ===== */
  /* Prevent layout shift - width/height attributes handled in HTML */
  img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  
  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  /* ===== TOUCH OPTIMIZATIONS ===== */
  /* Larger touch targets */
  button,
  .btn,
  .nav-link,
  .category-card,
  .artwork-card,
  .fancybox__toolbar button {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
  }
  
  /* Prevent text selection on interactive elements */
  .artwork-card,
  .category-card,
  .bento-card {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  
  /* Allow selection for text content */
  .artwork-title,
  .artwork-description,
  .caption-text,
  p,
  span {
    -webkit-user-select: text;
    user-select: text;
  }
  
  /* ===== REDUCE COMPOSITE LAYERS ===== */
  /* Limit number of composited layers */
  .fancybox__container,
  .fancybox__slide,
  .fancybox__content {
    transform: translateZ(0);
    will-change: transform;
  }
  
  /* ===== FONT RENDERING OPTIMIZATION ===== */
  body {
    text-rendering: optimizeSpeed;
  }
  
  /* ===== REDUCE PARTICLE COUNT ===== */
  .particle:nth-child(n+6) {
    display: none !important;
  }
  
  .hero-particle:nth-child(n+4) {
    display: none !important;
  }
  
  /* ===== DISABLE EXPENSIVE CSS EFFECTS ===== */
  /* Backdrop filters are expensive on mobile */
  .navbar-enhanced,
  .fancybox__caption,
  .mobile-bottom-nav {
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
  }
  
  /* Simplify gradients */
  .hero-section::before {
    background: linear-gradient(135deg, #000 0%, #1a1a2e 100%) !important;
  }
}

/* ===== VERY SMALL SCREENS ===== */
@media (max-width: 375px) {
  /* Further reduce animations */
  * {
    animation-duration: calc(var(--animation-duration, 1s) * 1.3) !important;
    transition-duration: calc(var(--transition-duration, 0.3s) * 1.3) !important;
  }
  
  /* Disable all non-essential animations */
  .particle,
  .hero-particle,
  .drone-particle {
    display: none !important;
  }
}

/* ===== 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;
  }
}

