/* ========================================
   IMAGE GALLERY CSS
   ======================================== */

.image-gallery {
  padding: 4rem 0;
  background-color: #f8f9fa;
  position: relative;
}

.gallery-title {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  margin-bottom: 1rem;
}

.gallery-subtitle {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: #64748b;
  text-align: center;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ========================================
   MASONRY GRID LAYOUT
   ======================================== */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  padding: 1rem 0;
  grid-auto-rows: 200px;
}

/* ========================================
   GALLERY ITEM STYLING
   ======================================== */
.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.6s ease-out;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: block;
  opacity: 0;
  transform: scale(0.8) translateY(30px);
}

.gallery-item.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ========================================
   MASONRY EFFECT - ROW SPANS
   ======================================== */
.gallery-item:nth-child(3n + 1) {
  grid-row: span 2;
}

.gallery-item:nth-child(3n + 2) {
  grid-row: span 1;
}

.gallery-item:nth-child(3n + 3) {
  grid-row: span 3;
}

.gallery-item:nth-child(6n + 1) {
  grid-row: span 1;
}

.gallery-item:nth-child(6n + 2) {
  grid-row: span 2;
}

.gallery-item:nth-child(6n + 3) {
  grid-row: span 3;
}

.gallery-item:nth-child(6n + 4) {
  grid-row: span 2;
}

.gallery-item:nth-child(6n + 5) {
  grid-row: span 1;
}

.gallery-item:nth-child(6n + 6) {
  grid-row: span 2;
}

/* ========================================
   HOVER EFFECTS
   ======================================== */
.gallery-item:hover {
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.18),
    0 4px 12px rgba(0, 0, 0, 0.12);
  transform: scale(1.02) translateY(0);
}

.gallery-item.visible:hover {
  transform: scale(1.02) translateY(0);
}

/* ========================================
   IMAGE STYLING
   ======================================== */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */
@media (max-width: 1200px) {
  .masonry-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-item:nth-child(2n + 1) {
    grid-row: span 2;
  }

  .gallery-item:nth-child(2n + 2) {
    grid-row: span 1;
  }
}

@media (max-width: 768px) {
  .image-gallery {
    padding: 2rem 0;
  }

  .gallery-title {
    font-size: 2rem;
  }

  .gallery-subtitle {
    font-size: 1rem;
  }

  .masonry-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    grid-auto-rows: 250px;
  }

  .gallery-item {
    grid-row: span 1;
    margin-bottom: 20px;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .image-gallery {
    padding: 1rem 0;
  }

  .gallery-item {
    margin-bottom: 16px;
    border-radius: 8px;
  }
}

/* ========================================
   SCREENSHOTS GALLERY SPECIFIC
   ======================================== */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  padding: 2rem 0;
}

.screenshot-wrapper {
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 0 auto;
  max-width: 320px;
}

.screenshot-wrapper.tablet {
  max-width: 600px;
}

/* On larger screens, let tablets span 2 columns if they have space */
@media (min-width: 1024px) {
  .screenshot-wrapper.tablet {
    grid-column: span 2;
    max-width: 100%;
    /* Allow it to fill the span */
  }
}

.screenshot-wrapper.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.screenshot-item {
  border-radius: 36px;
  /* Smooth iOS-like corners */
  overflow: hidden;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.15),
    0 5px 15px rgba(0, 0, 0, 0.1);
  background: #000;
  border: 8px solid #1e293b;
  /* Sleek device-like frame */
  transition: all 0.3s ease;
  display: block;
  position: relative;
}

.screenshot-item img {
  width: 100%;
  height: auto;
  /* Maintain natural aspect ratio */
  display: block;
}

.screenshot-caption {
  padding: 0 8px;
  margin-top: 20px;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
  background: transparent;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    "Helvetica Neue",
    Arial,
    sans-serif;
  line-height: 1.4;
  display: block;
  width: 100%;
  position: relative;
  z-index: 10;
}

.screenshot-wrapper:hover .screenshot-item {
  transform: translateY(-10px) scale(1.02);
  box-shadow:
    0 40px 80px rgba(29, 78, 216, 0.2),
    0 10px 25px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .screenshots-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }

  .screenshot-item {
    border-radius: 28px;
    border-width: 6px;
  }
}

/* Section Divider */
.image-gallery::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}
