/* ===================================
   MOBILE GALLERY - Vertical Card Stack (Optimized)
   =================================== */

/* Mobile Gallery Container */
.mobile-gallery {
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 6rem 1.5rem 4rem;
  position: relative;
  z-index: 1;
  contain: layout style;
}

.mobile-gallery-content {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Mobile Gallery Card - OPTIMIZED with CSS Containment */
.mobile-card {
  width: 100%;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 0;
  transform: translateY(50px);
  filter: blur(12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  contain: layout style paint;
  will-change: opacity, transform, filter;
}

.mobile-card.visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0px);
}

.mobile-card:active {
  transform: scale(0.98);
}

/* Card Link */
.mobile-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.mobile-card-link::after {
  display: none;
}

/* Card Image Container */
.mobile-card-image-container {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
  background-color: #000000;
  contain: layout style paint;
}

/* OPTIMIZED: Reduced gradient blur */
.mobile-card-image-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
  z-index: 2;
  pointer-events: none;
}

.mobile-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translate3d(0, 0, 0);
}

.mobile-card:active .mobile-card-image {
  transform: scale(1.05) translate3d(0, 0, 0);
}

/* Card Content */
.mobile-card-content {
  padding: 1.5rem;
  position: relative;
  z-index: 3;
}

.mobile-card-title {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.mobile-card-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em;
}

/* Show on Mobile Only */
@media (max-width: 768px) {
  .mobile-gallery {
    display: block;
  }
  
  body:not(.project-page) .container {
    display: none;
  }
  
  body:not(.project-page) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    position: static !important;
  }
  
  body:not(.project-page) .container .footer {
    display: none;
  }
  
  .footer-mobile {
    display: none;
  }
  
  body:not(.project-page) .footer-mobile {
    display: grid;
    position: relative;
    bottom: auto;
    margin-top: 2rem;
  }
}

/* Smooth scroll for mobile */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }
  
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* OPTIMIZED: Animation delays with reduced durations */
.mobile-card:nth-child(1) {
  transition-delay: 0s;
}

.mobile-card:nth-child(2) {
  transition-delay: 0.12s;
}

.mobile-card:nth-child(3) {
  transition-delay: 0.24s;
}

.mobile-card:nth-child(4) {
  transition-delay: 0.36s;
}

.mobile-card:nth-child(5) {
  transition-delay: 0.48s;
}

.mobile-card:nth-child(6) {
  transition-delay: 0.6s;
}

.mobile-card:nth-child(7) {
  transition-delay: 0.72s;
}

.mobile-card:nth-child(8) {
  transition-delay: 0.84s;
}

.mobile-card:nth-child(9) {
  transition-delay: 0.96s;
}

/* Prevent touch callout on iOS */
.mobile-card {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* OPTIMIZED: Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .mobile-card {
    transition-duration: 0.01ms !important;
    filter: blur(0px) !important;
  }
  
  .mobile-card-image {
    transition-duration: 0.01ms !important;
  }
}