/* ========================================
   Image Gallery Template Styles
   ======================================== */

.gallery-template {
  padding: 40px 24px;
}

.gallery-template .section-title {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 24px 0;
  text-align: center;
}

/* Gallery Grid Layouts */
.gallery-grid {
  display: grid;
  gap: 16px;
}

.gallery-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.gallery-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.gallery-grid.tall {
  min-height: 400px;
}

.gallery-grid.vertical .image-vertical-item {
  display: flex;
  flex-direction: column;
}

/* Image Box Base */
.gallery-image-box {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f4f6;
  min-height: 200px;
}

.gallery-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.gallery-image-box .image-placeholder {
  position: absolute;
  inset: 0;
}

.gallery-image-box .placeholder-svg {
  width: 100%;
  height: 100%;
}

/* Tall Images */
.gallery-image-box.tall {
  min-height: 350px;
}

/* Wide Images */
.gallery-image-box.wide {
  min-height: 300px;
  aspect-ratio: 21/9;
}

/* Large Images */
.gallery-image-box.large {
  min-height: 350px;
}

/* Vertical Images */
.gallery-image-box.vertical {
  aspect-ratio: 3/4;
  min-height: auto;
}

/* Image Overlay */
.gallery-image-box .gallery-image-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s ease;
}

/* ========================================
   Image Wrapper for Under Labels
   ======================================== */
.gallery-image-wrapper {
  display: flex;
  flex-direction: column;
}

.gallery-image-wrapper.with-under-labels .gallery-image-box {
  flex: 1;
}

/* ========================================
   Labels Frame Container
   ======================================== */
.labels-frame {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  z-index: 4;
}

/* Position: Center */
.labels-frame.position-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  justify-content: center;
}

/* Position: Top */
.labels-frame.position-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  border-radius: 8px;
  justify-content: center;
}

/* Position: Bottom */
.labels-frame.position-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  border-radius: 8px;
  justify-content: center;
}

/* Position: Left */
.labels-frame.position-left {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  flex-direction: column;
  border-radius: 8px;
}

/* Position: Right */
.labels-frame.position-right {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  flex-direction: column;
  border-radius: 8px;
}

/* Position: Under Image */
.labels-frame.position-under {
  position: relative;
  border-radius: 0 0 8px 8px;
  justify-content: center;
  margin-top: -4px;
}

/* Label Button Style */
.image-label-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.image-label-btn:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

/* Image Overlay Content */
.gallery-image-box .image-overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 24px 32px;
  border-radius: 8px;
  min-width: 200px;
}

.image-overlay-content .overlay-subtitle {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.image-overlay-content .overlay-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
}

.image-overlay-content .overlay-btn {
  font-size: 11px;
  font-weight: 600;
  background: #1f2937;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}

/* Image with Text Below */
.image-with-text-below {
  display: flex;
  flex-direction: column;
}

.image-with-text-below .gallery-image-box {
  aspect-ratio: 1;
  min-height: auto;
}

.image-with-text-below .text-below,
.image-vertical-item .text-below {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-align: center;
}

/* Vertical Images */
.image-vertical-item .gallery-image-box {
  flex: 1;
}

/* Box Image with Text */
.box-image-item {
  display: flex;
  flex-direction: column;
}

.box-image-item .gallery-image-box {
  aspect-ratio: 1;
  min-height: auto;
  border-radius: 12px 12px 0 0;
}

.box-image-item .box-content {
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 12px 12px;
}

.box-content .box-title {
  font-size: 16px;
  font-weight: 600;
  color: #ea580c;
  margin: 0 0 8px 0;
}

.box-content .box-description {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
}

/* Image + Text Layout */
.gallery-template.image-plus-text {
  padding: 60px 24px;
}

.image-text-container {
  display: flex;
  gap: 40px;
  align-items: center;
}

.image-text-container .gallery-image-box {
  flex: 1;
  min-height: 350px;
}

.image-text-container .text-content {
  flex: 1;
  padding: 20px 0;
}

.text-content .content-title {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px 0;
}

.text-content .content-description {
  font-size: 15px;
  color: #6b7280;
  line-height: 1.7;
  margin: 0 0 24px 0;
}

.text-content .content-btn {
  padding: 12px 24px;
  background: #0891b2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.text-content .content-btn:hover {
  background: #0e7490;
}

/* Single Wide Image */
.gallery-template.image-single {
  padding: 0;
}

.gallery-template.image-single .gallery-image-box {
  border-radius: 0;
  min-height: 350px;
}

/* Default zoom effect on all images */
.gallery-image-box {
  overflow: hidden;
}

.gallery-image-box img {
  transition: transform 0.4s ease;
}

.gallery-image-box:hover img {
  transform: scale(1.05);
}

/* ========================================
   Responsive - Media Queries (Storefront)
   ======================================== */

@media (max-width: 768px) {
  .gallery-template {
    padding: 24px 16px;
  }

  .gallery-template .section-title {
    font-size: 18px;
  }

  /* Default: stack to 2 columns */
  .gallery-grid.cols-3,
  .gallery-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Horizontal scroll mode for multiple images on mobile only */
  .gallery-template.horizontal-scroll-mobile .gallery-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 12px;
    gap: 16px;
  }

  .gallery-template.horizontal-scroll-mobile .gallery-grid::-webkit-scrollbar {
    height: 6px;
  }

  .gallery-template.horizontal-scroll-mobile .gallery-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }

  .gallery-template.horizontal-scroll-mobile .gallery-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }

  .gallery-template.horizontal-scroll-mobile .gallery-grid > * {
    flex-shrink: 0;
    scroll-snap-align: start;
    min-width: 200px;
    width: 60vw;
    max-width: 280px;
  }
  
  .image-text-container {
    flex-direction: column;
  }
  
  .image-text-container .gallery-image-box {
    width: 100%;
    min-height: 250px;
  }
  
  .image-text-container .text-content {
    text-align: center;
  }
  
  .gallery-image-box .image-overlay-content {
    padding: 16px 20px;
    min-width: 150px;
  }
  
  .image-overlay-content .overlay-title {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .gallery-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .gallery-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-image-box {
    min-height: 150px;
  }

  .labels-frame {
    padding: 8px 10px;
    gap: 4px;
  }

  .image-label-btn {
    font-size: 10px;
    padding: 6px 10px;
  }

  .gallery-image-box .image-overlay-content {
    padding: 12px 16px;
    min-width: 120px;
  }

  .image-overlay-content .overlay-subtitle {
    font-size: 9px;
  }

  .image-overlay-content .overlay-title {
    font-size: 12px;
  }

  .image-overlay-content .overlay-btn {
    font-size: 9px;
    padding: 6px 12px;
  }

  .text-content .content-title {
    font-size: 20px;
  }

  .text-content .content-btn {
    width: 100%;
  }
}

/* ========================================
   Shape Mask Styles
   ======================================== */
.gallery-image-wrapper.has-shape-mask {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery-image-wrapper.has-shape-mask .gallery-image-box {
  background: transparent;
  min-height: auto;
  aspect-ratio: 1;
}

.gallery-image-wrapper.has-shape-mask .gallery-image-box:hover img {
  transform: scale(1.02);
}

