/* =============================================
   JO PROPERTY GALLERY STYLES - MASONRY LAYOUT
   ============================================= */

.jo-property-gallery {
    margin: 2rem 0;
    width: 100%;
}

.property-gallery-title {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-weight: 600;
    font-size: 1.5rem;
}

.jo-gallery-error {
    background: #ffeaa7;
    border: 1px solid #fdcb6e;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    color: #2d3436;
}

/* =============================================
   MASONRY LAYOUT SYSTEM
   ============================================= */

/* Base Masonry Layout - 12 column grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(200px, auto);
    align-items: start;
    gap: var(--image-gap, 15px);
}

/* Gallery Items */
.gallery-item {
  display: block;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  object-fit: cover;
  position: absolute;
}

/* Thumbnails */
.gallery-thumb {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  text-decoration: none;
  cursor: zoom-in;
  overflow: hidden;
  padding-bottom: 100%;
}

.property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumb:hover .property-image {
    transform: scale(1.05);
}

.image-caption {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    padding: 0 0.5rem;
}

/* =============================================
   DYNAMIC MASONRY LAYOUTS BASED ON THUMBNAIL COUNT
   ============================================= */

/* 1 Thumbnail: 12 column */
.gallery-grid[data-thumb-count="1"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 12;
    grid-row: 1;
}

/* 2 Thumbnails: image1=1st and 2nd row+6column, image2=1st and 2nd row+6column */
.gallery-grid[data-thumb-count="2"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 6;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="2"] .gallery-item:nth-child(2) {
    grid-column: 7 / span 6;
    grid-row: 1 / span 2;
}

/* 3 Thumbnails: image1=1st and 2nd row+6column, image2=1st row+6column, image3=2nd row+6column */
.gallery-grid[data-thumb-count="3"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 8;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="3"] .gallery-item:nth-child(2) {
    grid-column: 9 / span 4;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="3"] .gallery-item:nth-child(3) {
    grid-column: 9 / span 4;
    grid-row: 2;
}

/* 4 Thumbnails: image1=1st and 2nd row+6column, image2=1st row+6column, image3=2nd row+3column, image4=2nd row+3column */
.gallery-grid[data-thumb-count="4"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 8;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="4"] .gallery-item:nth-child(2) {
    grid-column: 9 / span 4;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="4"] .gallery-item:nth-child(3) {
    grid-column: 9 / span 4;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="4"] .gallery-item:nth-child(4) {
    grid-column: 1 / span 12;
    grid-row: 3;
}

/* 5 Thumbnails: image1=1st and 2nd row+6column, image2=1st row+3column, image3=1st row+3column, image4=2nd row+3column, image5=2nd row+3column */
.gallery-grid[data-thumb-count="5"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 6;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="5"] .gallery-item:nth-child(2) {
    grid-column: 7 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="5"] .gallery-item:nth-child(3) {
    grid-column: 10 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="5"] .gallery-item:nth-child(4) {
    grid-column: 7 / span 3;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="5"] .gallery-item:nth-child(5) {
    grid-column: 10 / span 3;
    grid-row: 2;
}

/* 6 Thumbnails: 5thumbs rule and 1 thumb rule */
.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 6;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(2) {
    grid-column: 7 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(3) {
    grid-column: 10 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(4) {
    grid-column: 7 / span 3;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(5) {
    grid-column: 10 / span 3;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(6) {
    grid-column: 1 / span 12;
    grid-row: 3;
}

/* 7 Thumbnails: 5 thumbs rules and 2 thumbs rule */
.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(1) {
    grid-column: 1 / span 6;
    grid-row: 1 / span 2;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(2) {
    grid-column: 7 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(3) {
    grid-column: 10 / span 3;
    grid-row: 1;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(4) {
    grid-column: 7 / span 3;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(5) {
    grid-column: 10 / span 3;
    grid-row: 2;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(6) {
    grid-column: 1 / span 6;
    grid-row: 3 / span 2;
}

.gallery-grid[data-thumb-count="7"] .gallery-item:nth-child(7) {
    grid-column: 7 / span 6;
    grid-row: 3 / span 2;
}

/* 8+ Thumbnails: Continue pattern */
.gallery-grid[data-thumb-count="8"] .gallery-item:nth-child(8) {
    grid-column: 1 / span 12;
    grid-row: 5;
}

.gallery-grid[data-thumb-count="9"] .gallery-item:nth-child(9) {
    grid-column: 1 / span 6;
    grid-row: 5 / span 2;
}

.gallery-grid[data-thumb-count="10"] .gallery-item:nth-child(10) {
    grid-column: 7 / span 6;
    grid-row: 5 / span 2;
}

/* =============================================
   VIEW ALL LINK COMPONENT
   ============================================= */
.view-all-container {
    padding: 1rem 0;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1rem;
    color: #007cba !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #007cba;
	width: fit-content;
}

.view-all-link:hover {
    border-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.view-all-text {
    font-size: 1rem;
}

.image-count {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: normal;
}

/* =============================================
   PHOTOSWIPE CUSTOMIZATIONS
   ============================================= */
.pswp__counter {
    font-weight: 600;
    font-size: 14px;
}

.pswp__caption__center {
    text-align: center;
    font-size: 14px;
    padding: 10px;
    line-height: 1.4;
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* Tablet Breakpoint (768px and below) */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-auto-rows: minmax(150px, auto);
    }
	
    .gallery-grid[data-thumb-count="1"] {
        grid-template-columns: 1fr !important;
    }
    
    .gallery-grid[data-thumb-count="2"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .property-gallery-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .gallery-grid .gallery-item {
        grid-column: auto !important;
        grid-row: auto !important;
    }
    
    .view-all-link {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .view-all-text {
        font-size: 0.9rem;
    }
    
    .image-count {
        font-size: 0.8rem;
    }
}
@media (min-width: 769px) and (max-width: 1399px) {
	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(1) {
		grid-column: 1 / span 8;
		grid-row: 1 / span 2;
	}

	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(2) {
		grid-column: 9 / span 4;
		grid-row: 1;
	}

	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(3) {
		grid-column: 9 / span 4;
		grid-row: 2;
	}

	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(4) {
		grid-column: 1 / span 8;
		grid-row: 3 / span 2;
	}

	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(5) {
		grid-column: 9 / span 4;
		grid-row: 3;
	}

	.gallery-grid[data-thumb-count="6"] .gallery-item:nth-child(6) {
		grid-column: 9 / span 4;
		grid-row: 4;
	}
}