/*
 * Pure CSS Interactions
 * Replaces JavaScript interactions with CSS-only implementations
 */

/* ===== Base Animation Styles ===== */
:root {
  --animation-duration: 0.3s;
  --animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --stagger-delay: 0.1s;
}

/* ===== Hover Effects ===== */

/* 3D Tilt Effect for Category Cards */
.category-card {
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--animation-duration) var(--animation-easing);
}

.category-card:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) scale3d(1.05, 1.05, 1.05);
}

/* Wallpaper Card Hover Effects */
.wallpaper-card {
  position: relative;
  transition: transform var(--animation-duration) var(--animation-easing),
    box-shadow var(--animation-duration) var(--animation-easing);
}

.wallpaper-card:hover {
  transform: perspective(1000px) rotateX(2.5deg) rotateY(-2.5deg) scale3d(1.05, 1.05, 1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Tag Card Hover Effects */
.tag-card {
  position: relative;
  transition: all 0.3s ease-in-out;
}

.tag-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.tag-card:hover .tag-count {
  transform: scale(1.1);
}

.tag-count {
  transition: transform 0.3s ease-in-out;
}

/* Taxonomy Term Card Hover Effects */
.taxonomy-term-card {
  position: relative;
  transition: transform var(--animation-duration) var(--animation-easing),
    box-shadow var(--animation-duration) var(--animation-easing);
}

.taxonomy-term-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

/* ===== Ripple Effect for Tag Cards ===== */
.tag-card {
  overflow: hidden;
}

.tag-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.tag-card:active::before {
  width: 300px;
  height: 300px;
}

/* ===== Parallax Hero Section ===== */
.hero-section {
  transform: translateY(0);
  transition: transform 0.1s ease-out;
}

/* Simulate parallax on scroll using CSS */
@supports (animation-timeline: scroll()) {
  .hero-section {
    animation: parallax linear;
    animation-timeline: scroll();
  }

  @keyframes parallax {
    from {
      transform: translateY(0);
    }

    to {
      transform: translateY(-50vh);
    }
  }
}

/* Fallback for browsers without scroll timeline support */
@media (prefers-reduced-motion: no-preference) {
  body:not(.no-js) .hero-section {
    animation: subtle-parallax 1s ease-out;
  }

  @keyframes subtle-parallax {
    0% {
      transform: translateY(0);
    }

    100% {
      transform: translateY(-10px);
    }
  }
}

/* ===== Smooth Scrolling ===== */
html {
  scroll-behavior: smooth;
}

/* ===== Loading Animation ===== */
body {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

body.loaded {
  opacity: 1;
}

/* ===== Glassmorphism Enhancements ===== */
.glass-card {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--animation-duration) var(--animation-easing);
}

.glass-card:hover {
  backdrop-filter: blur(15px);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== Responsive Interactions ===== */
@media (hover: none) and (pointer: coarse) {

  .category-card:hover,
  .wallpaper-card:hover,
  .tag-card:hover,
  .taxonomy-term-card:hover {
    transform: none;
    box-shadow: none;
  }

  .category-card:active,
  .wallpaper-card:active,
  .tag-card:active,
  .taxonomy-term-card:active {
    transform: scale(0.98);
  }
}

/* ===== Focus States for Accessibility ===== */
.category-card:focus-visible,
.wallpaper-card:focus-visible,
.tag-card:focus-visible,
.taxonomy-term-card:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {

  .wallpaper-card,
  .category-card,
  .tag-card,
  .taxonomy-term-card,
  section,
  .hero-section {
    transition: none;
    animation: none;
  }

  .wallpaper-card:hover,
  .category-card:hover,
  .tag-card:hover,
  .taxonomy-term-card:hover {
    transform: none;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .wallpaper-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }

  .tag-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  }

  .taxonomy-term-card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
  }
}

/* ===== Print Styles ===== */
@media print {
  .wallpaper-card,
  .category-card,
  .tag-card,
  .taxonomy-term-card {
    transition: none;
    box-shadow: none;
    transform: none;
  }
}