/* 1. Centre the main single image at the top */
.custom-project-gallery .sppb-addon-single-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.custom-project-gallery .sppb-addon-single-image-container img {
    margin: 0 auto;
    display: block;
}

/* 2. Modernise the gallery layout with Flexbox */
.custom-project-gallery ul.sppb-gallery {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Stop SP Page Builder's clearfix class from creating invisible flex items */
.custom-project-gallery ul.sppb-gallery::before,
.custom-project-gallery ul.sppb-gallery::after {
    display: none !important;
}

/* 3. Thumbnails - Default sizing (3 per row) and Square Shape */
.custom-project-gallery ul.sppb-gallery li {
    flex: 0 0 calc(33.333% - 14px) !important;
    max-width: calc(33.333% - 14px) !important;
    margin: 0 !important; 
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1 / 1 !important;
}

/* Quantity Query: If there are exactly 8 total images, automatically switch to 4 images per row */
.custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8),
.custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8) ~ li {
    flex: 0 0 calc(25% - 15px) !important;
    max-width: calc(25% - 15px) !important;
}

.custom-project-gallery ul.sppb-gallery li a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Force the image to fill the square */
.custom-project-gallery ul.sppb-gallery li img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
    display: block !important;
}

/* 4. Add a zoom effect on hover */
.custom-project-gallery ul.sppb-gallery li:hover img {
    transform: scale(1.08);
}

/* 5. Mobile responsiveness */
@media (max-width: 991px) {
    /* Switch to 2 images per row on tablets */
    .custom-project-gallery ul.sppb-gallery li,
    .custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8),
    .custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8) ~ li {
        flex: 0 0 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
}

@media (max-width: 575px) {
    /* Switch to 1 image per row on mobile phones */
    .custom-project-gallery ul.sppb-gallery li,
    .custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8),
    .custom-project-gallery ul.sppb-gallery li:first-child:nth-last-child(8) ~ li {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Added for tenant portal buttons styling */
/* ----------------------------------
   Strategic Portal Tiles (Image Overlay Override)
------------------------------------- */

/* 1. Turn the Overlay into a Solid Modern Block */
.portal-tile .sppb-addon-overlay-image-content {
    background-color: #153436 !important; /* Your brand color */
    border-radius: 8px; /* Modern rounded corners */
    padding: 35px 20px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(21, 52, 54, 0.15); /* Soft drop shadow */
    position: relative;
    z-index: 1;
    cursor: pointer;
}

/* 2. Hide all the default Image Overlay clutter */
.portal-tile .overlay-background-image-wrapper,
.portal-tile .overlay-background-style,
.portal-tile .overlay-image-button-wrap {
    display: none !important;
}

/* 3. Format the Text */
.portal-tile .sppb-addon-title {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff !important;
    text-align: center;
    word-break: break-word; /* Prevents long text from bleeding out */
}

.portal-tile .sppb-addon-title a {
    color: #ffffff !important;
    text-decoration: none;
}

/* 4. Style the FontAwesome Icon (Stacks it above text) */
.portal-tile .sppb-addon-title i,
.portal-tile .sppb-addon-title .fas,
.portal-tile .sppb-addon-title .fa {
    display: block !important; /* Forces the icon to its own line above the text */
    font-size: 38px; /* Large, modern icon size */
    margin-bottom: 15px;
    color: #ffffff;
    opacity: 0.9;
    transition: transform 0.3s ease;
}

/* 5. Hover Effects (Lifts up and slightly lightens) */
.portal-tile:hover .sppb-addon-overlay-image-content {
    background-color: #1e4a4d !important; /* A slightly lighter teal on hover */
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(21, 52, 54, 0.3);
}

.portal-tile:hover .sppb-addon-title i {
    transform: scale(1.15); /* Gentle icon pop on hover */
}

/* 6. Force a Perfect 2x2 Grid on Mobile Phones */
@media (max-width: 767px) {
    /* Targets the specific columns holding your tiles */
    div[id^="column-wrap-id"]:has(.portal-tile) {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 6px !important; /* Tighter gaps for mobile */
        margin-bottom: 12px;
    }
    
    .portal-tile .sppb-addon-overlay-image-content {
        padding: 25px 10px;
        min-height: 130px;
        border-radius: 6px;
    }
    
    .portal-tile .sppb-addon-title {
        font-size: 14px;
    }
    
    .portal-tile .sppb-addon-title i {
        font-size: 28px; /* Shrinks the icon slightly so it fits */
        margin-bottom: 10px;
    }
}


/* ----------------------------------
   Strategic Portal Tiles (Perfect Squares)
------------------------------------- */

/* 1. Force the Box Size & Color */
.portal-tile .sppb-addon-overlay-image-content {
    background-color: #153436 !important; /* Brand color */
    aspect-ratio: 1 / 1 !important; /* FORCES A PERFECT SQUARE */
    height: auto !important; /* Overrides any previous hard heights */
    border-radius: 8px !important;
    position: relative !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(21, 52, 54, 0.15) !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 2. Hide SP Page Builder Clutter */
.portal-tile .overlay-background-image-wrapper,
.portal-tile .overlay-background-style,
.portal-tile .overlay-image-button-wrap,
.portal-tile .sppb-addon-subtitle {
    display: none !important;
}

/* 3. The Ultimate Centering Wrapper */
.portal-tile .overlay-image-title {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important; /* Stretches to fill the square */
    
    /* Flexbox inside the absolute container forces perfect centering */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    
    transform: none !important; /* Kills the slide-left animation */
    opacity: 1 !important;
    margin: 0 !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    z-index: 5 !important;
}

/* 4. Text & Link Formatting */
.portal-tile .sppb-addon-title,
.portal-tile .sppb-addon-title a {
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Nunito', sans-serif !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    text-align: center !important;
    display: block !important;
}

/* 5. Icon Stacking */
.portal-tile .sppb-addon-title i,
.portal-tile .sppb-addon-title .fas,
.portal-tile .sppb-addon-title .fa {
    display: block !important;
    font-size: 38px !important;
    margin: 0 auto 12px auto !important; /* Centers icon, pushes text down */
    color: #ffffff !important;
    transition: transform 0.3s ease !important;
}

/* 6. Hover Effects */
.portal-tile:hover .sppb-addon-overlay-image-content {
    background-color: #1e4a4d !important; 
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 25px rgba(21, 52, 54, 0.3) !important;
}

.portal-tile:hover .sppb-addon-title i {
    transform: scale(1.15) !important;
}

/* 7. Mobile Grid Setup */
@media (max-width: 767px) {
    div[id^="column-wrap-id"]:has(.portal-tile) {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 5px !important;
        margin-bottom: 10px !important;
    }
    
    .portal-tile .sppb-addon-title,
    .portal-tile .sppb-addon-title a {
        font-size: 13px !important; /* Slightly smaller to fit the square */
    }
    
    .portal-tile .sppb-addon-title i,
    .portal-tile .sppb-addon-title .fas,
    .portal-tile .sppb-addon-title .fa {
        font-size: 26px !important;
        margin-bottom: 8px !important;
    }
}

/* 1. Reset the massive margins pushing the image out of line with the menu */
#sppb-addon-42188b1c-8b06-455e-b8fb-c033b3f94ba5 {
    margin-top: 0px !important;
    margin-left: 0px !important;
}

/* 2. Set the footer image max-height to 200px and maintain aspect ratio */
#sppb-addon-EKWkPwD_jgwh46jZKrnQH .sppb-addon-single-image-container img {
    max-height: 200px !important;
    width: auto !important;
}

/* 1. Align the image and phone number side-by-side and vertically centred */
#column-id-8e0bbaeb-7918-450d-a1c6-34aad7dc92f1 .sppb-column-addons {
    display: flex;
    align-items: center; 
    flex-wrap: wrap;
    gap: 20px; 
}

/* Remove the default bottom margin from the image wrapper so it aligns perfectly */
#sppb-addon-wrapper-EKWkPwD_jgwh46jZKrnQH {
    margin-bottom: 0px !important;
}

/* 2. Add the phone icon before the phone number */
#sppb-addon-Mqj1Vw7_bewYInigsKqn7 .sppb-addon-content::before {
    content: "\f095"; 
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    margin-right: 10px;
}

/* 3. Keep them under the menu but centrally aligned on mobile devices */
@media (max-width: 767.98px) {
    #column-id-8e0bbaeb-7918-450d-a1c6-34aad7dc92f1 .sppb-column-addons {
        justify-content: center; 
        margin-top: 30px; 
    }
}
/* Push the image and phone number to the right side on desktop */
@media (min-width: 768px) {
    #column-id-8e0bbaeb-7918-450d-a1c6-34aad7dc92f1 .sppb-column-addons {
        justify-content: flex-end;
    }
}

/* Homepage location cards */
/* ----------------------------------
   Location Cards (Perfect Squares using Feature Box)
------------------------------------- */

/* 1. Force the Box Size, Color & Flex Centering */
.location-tile.sppb-addon-feature {
    background-color: #153436 !important; /* Brand color */
    aspect-ratio: 1 / 1 !important; /* FORCES A PERFECT SQUARE */
    border-radius: 8px !important;
    position: relative !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(21, 52, 54, 0.15) !important;
    padding: 20px !important; /* Back to 20px to give content more room */
    margin: 0 !important;
    
    /* Flexbox forces absolute perfect centering */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* 2. Content Wrapper Centering */
.location-tile .sppb-addon-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 !important;
}

/* 3. Title Formatting (City Name) - BALANCED DESKTOP SIZE */
.location-tile .sppb-feature-box-title {
    margin: 0 0 8px 0 !important; /* Tighter margin so suburbs fit */
    padding: 0 !important;
    font-family: 'Nunito', sans-serif !important;
    font-size: 26px !important; /* Large, but safe */
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #ffffff !important;
}

/* 4. Icon Formatting (For the Trophy/etc) - BALANCED DESKTOP SIZE */
.location-tile .sppb-icon i {
    display: block !important;
    font-size: 45px !important; 
    margin: 0 0 12px 0 !important; /* Tighter margin */
    color: #ffffff !important;
    transition: transform 0.3s ease !important;
}

/* 5. Text & List Formatting (Suburbs) - BALANCED DESKTOP SIZE */
.location-tile .sppb-media-content,
.location-tile .sppb-addon-text {
    width: 100% !important;
}

/* Strips browser defaults from the bullet list to center it */
.location-tile .sppb-addon-text ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.location-tile .sppb-addon-text li {
    margin: 0 !important;
    padding: 2px 0 !important; /* Tighter vertical spacing */
    font-family: 'Nunito', sans-serif !important;
    font-size: 16px !important; 
    line-height: 1.3 !important;
    color: rgba(255, 255, 255, 0.85) !important; 
}

/* 6. Hover Effects */
.location-tile.sppb-addon-feature:hover {
    background-color: #1e4a4d !important; 
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 25px rgba(21, 52, 54, 0.3) !important;
}

.location-tile.sppb-addon-feature:hover .sppb-icon i {
    transform: scale(1.15) !important;
}

/* 7. Mobile Grid Setup (Preserved perfectly) */
@media (max-width: 767px) {
    div[id^="column-wrap-id"]:has(.location-tile) {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 5px !important;
        margin-bottom: 10px !important;
    }
    
    .location-tile.sppb-addon-feature {
        padding: 15px !important; 
    }
    
    .location-tile .sppb-feature-box-title {
        font-size: 20px !important; 
        margin-bottom: 5px !important;
    }
    
    .location-tile .sppb-icon i {
        font-size: 32px !important; 
        margin-bottom: 8px !important;
    }

    .location-tile .sppb-addon-text li {
        font-size: 13px !important;
        padding: 1px 0 !important; 
    }
}