/**
 * Canada Appliance Repair - Layouts CSS
 * Defining Page Grid, Container width, Section spacing, Flexboxes
 */

.container {
    width: 100%;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--space-6);
    padding-left: var(--space-6);
}

@media (max-width: 640px) {
    .container {
        padding-right: var(--space-4);
        padding-left: var(--space-4);
    }
}

/* Flexbox utilities compatible with Elementor */
.flex-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin-right: calc(-1 * var(--space-4));
    margin-left: calc(-1 * var(--space-4));
}

.flex-col {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
    flex: 1 1 0%;
}

.col-12 { width: 100%; flex: 0 0 100%; max-width: 100%; }
.col-10 { width: 83.333333%; flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-9  { width: 75%; flex: 0 0 75%; max-width: 75%; }
.col-8  { width: 66.666667%; flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-6  { width: 50%; flex: 0 0 50%; max-width: 50%; }
.col-4  { width: 33.333333%; flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-3  { width: 25%; flex: 0 0 25%; max-width: 25%; }

@media (max-width: 1024px) {
    .col-lg-12 { width: 100%; flex: 0 0 100%; max-width: 100%; }
    .col-lg-8  { width: 66.666667%; flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-6  { width: 50%; flex: 0 0 50%; max-width: 50%; }
    .col-lg-4  { width: 33.333333%; flex: 0 0 33.333333%; max-width: 33.333333%; }
}

@media (max-width: 768px) {
    .flex-row {
        flex-direction: column;
    }
    
    .flex-col {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: var(--space-6);
    }
    
    .flex-col:last-child {
        margin-bottom: 0;
    }
}

/* CSS Grid Auto-fit for Cards (Services, Brands, Locations) */
.grid-auto-fit-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

.grid-auto-fit-brands {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-4);
}

@media (max-width: 640px) {
    .grid-auto-fit-cards {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .grid-auto-fit-brands {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: var(--space-3);
    }
}

/* Sections padding */
.section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
}

.section-light {
    background-color: var(--color-neutral-100);
}

.section-dark {
    background-color: var(--color-neutral-950);
    color: var(--color-white);
}

.section-hero {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
    position: relative;
    overflow: hidden;
}

.hero-slider-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.hero-slide.active {
    opacity: 1;
}

.hero-slider-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.65) 45%, rgba(255, 255, 255, 0.15) 100%);
    z-index: 2;
}

/* Ensure container sits above background slides */
.section-hero .container {
    position: relative;
    z-index: 3;
}

@media (max-width: 768px) {
    .section {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }
    
    .section-hero {
        padding-top: var(--space-16);
        padding-bottom: var(--space-16);
    }
    
    .hero-slide {
        background-position: 75% center !important; /* Shift to focus on appliances/technicians on the right side of landscape slides */
    }
    
    .hero-slider-overlay {
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.25) 100%) !important; /* Lighter overlay so carousel images are visible */
    }
}
