/* ==========================================================================
   ARTWORK CARD ANIMATIONS - branchstone.art
   Premium hover and scroll animations for artwork cards
   ========================================================================== */

/*
 * Artwork Card Animations
 *
 * This file contains hover effects, transitions, and scroll animations.
 * Static/structural styles are in components.css
 */

/* ==========================================================================
   HOVER ANIMATIONS
   ========================================================================== */

/* Enhanced card hover with subtle scale and premium lift effect */
.artwork-card {
  transition: transform var(--duration-slow) var(--ease-spring),
              box-shadow var(--duration-slow) var(--ease-smooth),
              opacity var(--duration-slow) var(--ease-decelerate);
  /* Scroll animation initial state */
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
}

/* Visible state for scroll animations */
.artwork-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Premium hover state - subtle scale + elevated shadow + border glow */
.artwork-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 40px rgba(26, 24, 22, 0.15),
              0 8px 16px rgba(26, 24, 22, 0.1),
              0 0 0 1px rgba(139, 113, 90, 0.2);
  z-index: 10; /* Prevent overlapping adjacent cards */
  position: relative;
}

/* Dark mode shadow enhancements */
[data-theme="dark"] .artwork-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
              0 8px 16px rgba(0, 0, 0, 0.25),
              0 0 0 1px rgba(194, 149, 99, 0.3);
}

/* Smooth image zoom within card bounds + saturation boost */
.artwork-card__image {
  transition: transform var(--duration-slower) var(--ease-spring),
              filter var(--duration-normal) var(--ease-smooth);
  filter: saturate(1);
  will-change: transform;
}

.artwork-card:hover .artwork-card__image {
  transform: scale(1.1);
  filter: saturate(1.1);
}

/* Enhanced content slide-up animation */
.artwork-card__content {
  transform: translateY(20px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide base content when overlay appears on hover to prevent text overlap */
.artwork-card:hover .artwork-card__content {
  opacity: 0;
  pointer-events: none;
}

/* Title slide animation */
.artwork-card__title {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Collection/metadata subtle slide */
.artwork-card__collection {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}

.artwork-card:hover .artwork-card__collection {
  transform: translateY(-2px);
}

/* Price element slide animation */
.artwork-card__price {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s,
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.artwork-card:hover .artwork-card__price {
  transform: translateY(-2px);
}

/* ==========================================================================
   OVERLAY ANIMATIONS
   ========================================================================== */

/* Overlay fade-in on hover */
.artwork-card__overlay {
  opacity: 0;
  transition: opacity 0.35s ease-out;
}

.artwork-card:hover .artwork-card__overlay {
  opacity: 1;
}

/* Overlay title slide-up animation */
.artwork-card__overlay-title {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s,
              opacity 0.4s ease-out 0.05s;
}

.artwork-card:hover .artwork-card__overlay-title {
  transform: translateY(0);
  opacity: 1;
}

/* Overlay collection slide-up animation */
.artwork-card__overlay-collection {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s,
              opacity 0.4s ease-out 0.1s;
}

.artwork-card:hover .artwork-card__overlay-collection {
  transform: translateY(0);
  opacity: 1;
}

/* Overlay CTA button slide-up and hover animations */
.artwork-card__overlay-cta {
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
              opacity 0.4s ease-out 0.15s,
              background 0.3s ease;
}

.artwork-card:hover .artwork-card__overlay-cta {
  transform: translateY(0);
  opacity: 1;
}

.artwork-card__overlay-cta:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   SCROLL-TRIGGERED ANIMATIONS
   ========================================================================== */

/* Stagger animation for cards in grid */
.artwork-card:nth-child(1) { transition-delay: 0.05s; }
.artwork-card:nth-child(2) { transition-delay: 0.1s; }
.artwork-card:nth-child(3) { transition-delay: 0.15s; }
.artwork-card:nth-child(4) { transition-delay: 0.2s; }
.artwork-card:nth-child(5) { transition-delay: 0.25s; }
.artwork-card:nth-child(6) { transition-delay: 0.3s; }
.artwork-card:nth-child(7) { transition-delay: 0.35s; }
.artwork-card:nth-child(8) { transition-delay: 0.4s; }
.artwork-card:nth-child(9) { transition-delay: 0.45s; }
.artwork-card:nth-child(10) { transition-delay: 0.5s; }
.artwork-card:nth-child(11) { transition-delay: 0.55s; }
.artwork-card:nth-child(12) { transition-delay: 0.6s; }

/* ==========================================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================================== */

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .artwork-card {
    opacity: 1;
    transform: none;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
  }

  .artwork-card.is-visible {
    opacity: 1;
    transform: none;
  }

  .artwork-card:hover {
    transform: none;
    box-shadow: 0 8px 16px rgba(26, 24, 22, 0.12),
                0 0 0 1px rgba(139, 113, 90, 0.15);
  }

  [data-theme="dark"] .artwork-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(194, 149, 99, 0.2);
  }

  .artwork-card__image {
    transition: filter 0.3s ease;
  }

  .artwork-card:hover .artwork-card__image {
    transform: none;
    filter: saturate(1.05);
  }

  .artwork-card__content {
    transition: opacity 0.2s ease;
  }

  .artwork-card:hover .artwork-card__title,
  .artwork-card:hover .artwork-card__collection,
  .artwork-card:hover .artwork-card__price {
    transform: none;
  }

  .artwork-card:nth-child(n) {
    transition-delay: 0s;
  }

  /* Simplify overlay animations */
  .artwork-card__overlay {
    transition: opacity 0.2s ease;
  }

  .artwork-card__overlay-title,
  .artwork-card__overlay-collection,
  .artwork-card__overlay-cta {
    transform: none;
    transition: opacity 0.2s ease;
  }

  /* Disable pulse animation */
  .artwork-card__favorite.is-favorited {
    animation: none;
  }

  /* Simplify favorites button */
  .artwork-card__favorite {
    transition: opacity 0.2s ease, background 0.2s ease;
  }

  .artwork-card__favorite:hover {
    transform: none;
  }

  .artwork-card__favorite-icon {
    transition: color 0.2s ease, fill 0.2s ease;
  }

  .artwork-card__favorite:hover .artwork-card__favorite-icon {
    transform: none;
  }
}

/* ==========================================================================
   MOBILE OPTIMIZATIONS
   ========================================================================== */

/* Reduce motion intensity on mobile */
@media (max-width: 767px) {
  .artwork-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 28px rgba(26, 24, 22, 0.12),
                0 4px 12px rgba(26, 24, 22, 0.08),
                0 0 0 1px rgba(139, 113, 90, 0.15);
  }

  [data-theme="dark"] .artwork-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3),
                0 4px 12px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(194, 149, 99, 0.25);
  }

  .artwork-card:hover .artwork-card__image {
    transform: scale(1.05);
    filter: saturate(1.05);
  }

  /* Reset delays on mobile for instant appearance */
  .artwork-card:nth-child(n) {
    transition-delay: 0.05s;
  }

  /* Reduce overlay animation complexity on mobile */
  .artwork-card__overlay-title,
  .artwork-card__overlay-collection,
  .artwork-card__overlay-cta {
    transition-duration: 0.3s;
    transition-delay: 0s;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .artwork-card:hover {
    transform: translateY(0) scale(1);
  }

  /* Completely hide overlay on touch devices - show content instead */
  .artwork-card__overlay,
  .artwork-card:hover .artwork-card__overlay,
  .artwork-card:focus .artwork-card__overlay,
  .artwork-card:active .artwork-card__overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Always show base content on touch devices since overlay is hidden */
  .artwork-card__content,
  .artwork-card:hover .artwork-card__content {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* Mobile screen overlay hiding - belt and suspenders */
@media (max-width: 767px) {
  .artwork-card__overlay,
  .artwork-card:hover .artwork-card__overlay {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Always show base content on mobile since overlay is hidden */
  .artwork-card__content,
  .artwork-card:hover .artwork-card__content {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}
