/* Modern Enhancements for Rock Movement Site */

/* ============================================
   1. CSS CUSTOM PROPERTIES FOR DARK MODE
   ============================================ */
:root {
  /* Light mode colors (default) */
  --bg-primary: #f8f9fa;
  --bg-secondary: #fefefe;
  --bg-card: rgba(254, 254, 254, 0.95);
  --text-primary: #2c2c2c;
  --text-secondary: #4a4a4a;
  --text-muted: #6c6c6c;
  --border-light: #d1d5db;
  --shadow-sm: 0 2px 10px rgba(44, 44, 44, 0.08);
  --shadow-md: 0 4px 20px rgba(44, 44, 44, 0.12);
  --shadow-lg: 0 8px 30px rgba(44, 44, 44, 0.15);
  --overlay: rgba(0, 0, 0, 0.5);

  /* Animation timing */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
}

/* Dark mode variables */
[data-theme='dark'] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2c2c2c;
  --bg-card: rgba(44, 44, 44, 0.95);
  --text-primary: #f8f9fa;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-light: #374151;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.7);
  --overlay: rgba(0, 0, 0, 0.8);

  /* Adjust gradients for dark mode */
  --canvas-white: #1a1a1a;
  --paper-cream: #2c2c2c;
}

/* Smooth theme transition */
body {
  transition:
    background-color var(--transition-base),
    color var(--transition-base);
}

/* ============================================
   2. PARALLAX HERO SECTION
   ============================================ */
.hero-parallax {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-parallax-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  background-image:
    linear-gradient(180deg, rgba(45, 80, 22, 0.7) 0%, rgba(135, 169, 107, 0.5) 100%),
    url('/images/hero-rocks-bg.svg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  will-change: transform;
  z-index: -1;
}

@supports (-webkit-touch-callout: none) {
  /* iOS doesn't support background-attachment: fixed properly */
  .hero-parallax-bg {
    background-attachment: scroll;
  }
}

.hero-content-enhanced {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  padding: var(--space-2xl);
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   3. SKELETON LOADERS
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(209, 213, 219, 0.3) 25%,
    rgba(209, 213, 219, 0.5) 50%,
    rgba(209, 213, 219, 0.3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

[data-theme='dark'] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(55, 65, 81, 0.3) 25%,
    rgba(55, 65, 81, 0.5) 50%,
    rgba(55, 65, 81, 0.3) 75%
  );
  background-size: 200% 100%;
}

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

.skeleton-card {
  height: 300px;
  border-radius: 15px;
}

.skeleton-text {
  height: 20px;
  margin: 10px 0;
  width: 80%;
}

.skeleton-title {
  height: 30px;
  margin: 15px 0;
  width: 60%;
}

.skeleton-image {
  height: 200px;
  border-radius: 10px;
  margin-bottom: 15px;
}

/* ============================================
   4. DARK MODE TOGGLE
   ============================================ */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d5016, #87a96b);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: all var(--transition-base);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle-icon {
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-base);
}

.theme-toggle-icon svg {
  width: 24px;
  height: 24px;
}

/* Light mode button styling */
[data-theme='light'] .theme-toggle {
  background: linear-gradient(135deg, #2d5016, #87a96b);
}

/* Dark mode button styling */
[data-theme='dark'] .theme-toggle {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   5. FEATURED ROCK CAROUSEL
   ============================================ */
.featured-carousel {
  position: relative;
  overflow: hidden;
  padding: var(--space-2xl) 0;
}

.carousel-container {
  display: flex;
  transition: transform var(--transition-base);
  gap: var(--space-lg);
}

.carousel-slide {
  flex: 0 0 100%;
  max-width: 500px;
}

@media (min-width: 768px) {
  .carousel-slide {
    flex: 0 0 calc(50% - var(--space-lg));
  }
}

@media (min-width: 1024px) {
  .carousel-slide {
    flex: 0 0 calc(33.333% - var(--space-lg));
  }
}

.carousel-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  pointer-events: none;
}

.carousel-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  transition: all var(--transition-base);
}

.carousel-btn:hover {
  background: white;
  transform: scale(1.1);
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-light);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.carousel-dot.active {
  background: var(--forest-green);
  transform: scale(1.3);
}

/* ============================================
   6. MICRO-INTERACTIONS
   ============================================ */
.btn-pulse {
  position: relative;
  overflow: hidden;
}

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

.btn-pulse:hover::before {
  width: 300px;
  height: 300px;
}

/* Magnetic button effect */
.btn-magnetic {
  position: relative;
  transition: transform var(--transition-fast);
}

/* Card tilt effect */
.card-tilt {
  transition: transform var(--transition-base);
  transform-style: preserve-3d;
}

.card-tilt:hover {
  transform: perspective(1000px) rotateY(5deg) rotateX(-5deg) translateZ(20px);
}

/* Bounce animation for CTAs */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.bounce-on-hover:hover {
  animation: bounce 0.5s ease-in-out;
}

/* Glow effect for featured items */
.glow {
  box-shadow: 0 0 20px rgba(135, 169, 107, 0.5);
  transition: box-shadow var(--transition-base);
}

.glow:hover {
  box-shadow: 0 0 30px rgba(135, 169, 107, 0.8);
}

/* ============================================
   7. IMAGE LIGHTBOX
   ============================================ */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 40px;
  height: 40px;
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform var(--transition-base);
}

.lightbox-close:hover {
  transform: rotate(90deg) scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

/* ============================================
   8. PROGRESS INDICATORS
   ============================================ */
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  position: relative;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}

.progress-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.progress-step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all var(--transition-base);
}

.progress-step.active .progress-step-circle {
  background: var(--forest-green);
  color: white;
  border-color: var(--forest-green);
  transform: scale(1.2);
}

.progress-step.completed .progress-step-circle {
  background: var(--sage-green);
  color: white;
  border-color: var(--sage-green);
}

.progress-step-label {
  margin-top: var(--space-sm);
  font-size: 1rem; /* 16px - iOS minimum */
  color: var(--text-muted);
  text-align: center;
}

.progress-step.active .progress-step-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* Progress bar variant */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-lg) 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-earth);
  border-radius: 4px;
  transition: width var(--transition-slow) ease-out;
}

/* ============================================
   9. VISUAL JOURNEY MAP
   ============================================ */
.journey-map {
  position: relative;
  padding: var(--space-2xl);
  background: var(--bg-card);
  border-radius: 20px;
  overflow: hidden;
}

.journey-timeline {
  position: relative;
  padding-left: 40px;
}

.journey-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--forest-green) 0%,
    var(--sage-green) 50%,
    var(--clay-red) 100%
  );
}

.journey-point {
  position: relative;
  margin-bottom: var(--space-2xl);
  animation: slideInLeft 0.5s ease-out;
  animation-fill-mode: both;
}

.journey-point:nth-child(1) {
  animation-delay: 0.1s;
}
.journey-point:nth-child(2) {
  animation-delay: 0.2s;
}
.journey-point:nth-child(3) {
  animation-delay: 0.3s;
}
.journey-point:nth-child(4) {
  animation-delay: 0.4s;
}
.journey-point:nth-child(5) {
  animation-delay: 0.5s;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.journey-marker {
  position: absolute;
  left: -30px;
  top: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--forest-green);
  z-index: 1;
  transition: all var(--transition-base);
}

.journey-point:hover .journey-marker {
  transform: scale(1.3);
  box-shadow: 0 0 20px rgba(45, 80, 22, 0.5);
}

.journey-content {
  background: white;
  padding: var(--space-lg);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.journey-content:hover {
  transform: translateX(10px);
  box-shadow: var(--shadow-md);
}

.journey-date {
  font-size: 1rem; /* 16px - iOS minimum */
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.journey-location {
  font-weight: 600;
  color: var(--forest-green);
  margin-bottom: var(--space-sm);
}

.journey-distance {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--gradient-earth);
  color: white;
  border-radius: 20px;
  font-size: 1rem; /* 16px - iOS minimum */
  margin-top: var(--space-sm);
}

/* ============================================
   10. SOCIAL SHARING BUTTONS
   ============================================ */
.social-share {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}

.share-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  color: white;
  position: relative;
  overflow: hidden;
}

.share-btn::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: all 0.5s;
}

.share-btn:hover::before {
  width: 100px;
  height: 100px;
}

.share-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.share-facebook {
  background: #1877f2;
}

.share-twitter {
  background: #1da1f2;
}

.share-instagram {
  background: linear-gradient(
    45deg,
    #f09433 0%,
    #e6683c 25%,
    #dc2743 50%,
    #cc2366 75%,
    #bc1888 100%
  );
}

.share-whatsapp {
  background: #25d366;
}

.share-email {
  background: #ea4335;
}

.share-copy {
  background: var(--gradient-earth);
}

/* Tooltip for copy confirmation */
.share-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 5px;
  font-size: 1rem; /* 16px - iOS minimum */
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.share-tooltip.show {
  opacity: 1;
}

.share-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text-primary);
}

/* ============================================
   11. INFINITE SCROLL
   ============================================ */
.infinite-scroll-container {
  min-height: 100vh;
}

.infinite-scroll-loader {
  text-align: center;
  padding: var(--space-2xl);
  display: none;
}

.infinite-scroll-loader.active {
  display: block;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-light);
  border-top-color: var(--forest-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.infinite-scroll-end {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   12. NAVIGATION ENHANCEMENTS
   ============================================ */
.nav-menu a {
  position: relative;
}

/* Active state indicator */
.nav-menu a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--gradient-earth);
  border-radius: 3px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    width: 0;
  }
  to {
    width: 30px;
  }
}

/* Mobile menu slide animation */
@media (max-width: 768px) {
  .nav-menu {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .nav-menu.active {
    transform: translateX(0);
  }
}

/* Dropdown animation */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-base);
  min-width: 200px;
  padding: var(--space-sm);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ============================================
   13. ACCESSIBILITY IMPROVEMENTS
   ============================================ */
/* Focus visible states */
*:focus-visible {
  outline: 3px solid var(--forest-green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--forest-green);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  text-decoration: none;
  border-radius: 0 0 10px 0;
  transition: top var(--transition-base);
  z-index: 2000;
}

.skip-to-content:focus {
  top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid currentColor;
  }

  .btn-primary,
  .btn-secondary {
    border: 2px solid currentColor;
  }
}

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

/* ============================================
   14. LOADING ANIMATIONS
   ============================================ */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  transition: opacity var(--transition-base);
}

.page-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-rock {
  width: 80px;
  height: 80px;
  background: var(--gradient-earth);
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
  animation: rockBounce 1.5s ease-in-out infinite;
}

@keyframes rockBounce {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(90deg);
  }
  50% {
    transform: translateY(0) rotate(180deg);
  }
  75% {
    transform: translateY(-10px) rotate(270deg);
  }
}

/* Lazy loading placeholder */
.lazy-load-placeholder {
  background: var(--border-light);
  position: relative;
  overflow: hidden;
}

.lazy-load-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  animation: sweep 2s infinite;
}

@keyframes sweep {
  to {
    left: 100%;
  }
}

/* ============================================
   15. CONTAINER QUERIES & MODERN LAYOUTS
   ============================================ */
@container (min-width: 400px) {
  .card-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@container (min-width: 700px) {
  .card-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Modern grid with subgrid */
.modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

@supports (grid-template-rows: subgrid) {
  .modern-grid-item {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
  }
}

/* Masonry layout fallback */
.masonry {
  columns: 300px;
  column-gap: var(--space-lg);
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: var(--space-lg);
}

/* ============================================
   16. PERFORMANCE OPTIMIZATIONS
   ============================================ */
/* Hardware acceleration for animations */
.will-animate {
  will-change: transform, opacity;
}

/* Optimize font loading */
.fonts-loaded body {
  font-family: 'Quicksand', sans-serif;
}

.fonts-loaded h1,
.fonts-loaded h2,
.fonts-loaded h3,
.fonts-loaded h4,
.fonts-loaded h5,
.fonts-loaded h6 {
  font-family: 'Playfair Display', serif;
}

/* Image optimization */
.responsive-image {
  width: 100%;
  height: auto;
  display: block;
}

picture {
  display: block;
}

/* WebP support with fallback */
.webp-support {
  background-image: url('/images/hero-rocks-bg.svg');
}

.no-webp .webp-support {
  background-image: url('/images/hero-rocks-bg.svg');
}
