/* --- DIVISIONS SECTION --- */
.divisions-section {
    padding: 80px 40px;
    background: white;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-tag {
    display: inline-block;
    color: var(--primary-red);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    color: var(--navy-blue);
    margin-bottom: 20px;
    line-height: 1.2;
}

.section-description {
    font-size: 18px;
    color: #64748b;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;
}

/* --- DIVISIONS SECTION --- */
.divisions-section {
    padding: 80px 40px;
    background: white;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-tag {
    display: inline-block;
    color: var(--primary-red);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    color: var(--navy-blue);
    margin-bottom: 20px;
    line-height: 1.2;
}

.section-description {
    font-size: 18px;
    color: #64748b;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Grid: responsive 1 → 2 → 4 columns (index/home uses same) */
.divisions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: stretch;
}

@media (min-width: 600px) {
    .divisions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }
}

@media (min-width: 992px) {
    .divisions-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* Home page (index.html) specific tweaks to keep the whole
   "Our Divisions" section visible in one view */
.page-home #divisions.divisions-section {
    padding-top: 60px;
    padding-bottom: 60px;
}

.page-home #divisions .divisions-grid {
    gap: 24px;
}

.page-home #divisions .division-content {
    padding: 22px 24px 24px;
}

.page-home #divisions .division-title {
    font-size: 22px;
    margin-bottom: 10px;
}

.page-home #divisions .division-subtitle {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Show full promo image (including "Plumbing" etc label) on all devices */
.page-home #divisions .division-image {
    height: 200px;
    min-height: 180px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-home #divisions .division-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.division-card {
    position: relative;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); 
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none; /* Important for 'a' tag cards */
    /* FIX 2: Makes the card a flex container to manage its own internal height */
    display: flex;
    flex-direction: column;
    /* Ensure the card fills the full height provided by the grid (from FIX 1) */
    height: 100%;
    /* Start hidden for animation */
    opacity: 0;
    transform: translateY(30px);
}

.division-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(196, 30, 58, 0.9), rgba(22, 31, 75, 0.9));
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.division-card:hover::before {
    opacity: 1;
}

.division-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 25px 60px rgba(196, 30, 58, 0.2);
}

.division-image {
    position: relative;
    /* Kept height: 300px to ensure the image space is consistent for all cards */
    height: 300px; 
    overflow: hidden;
}

.division-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.division-card:hover .division-image img {
    transform: scale(1.1);
}

/* Removed .division-badge as it's not present in the original image */

.division-content {
    position: relative;
    padding: 35px;
    z-index: 2;
    transition: all 0.5s ease;
    /* FIX 3: Allows the content area to push down and occupy all remaining space */
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes location text to the bottom */
}

.division-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    transition: all 0.5s ease;
}

.division-icon i {
    font-size: 32px;
    color: var(--primary-red);
    transition: all 0.5s ease;
}

.division-card:hover .division-icon {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transform: scale(1.1) rotate(-5deg);
}

.division-card:hover .division-icon i {
    color: white;
}

.division-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--navy-blue);
    margin-bottom: 15px;
    transition: color 0.5s ease;
}

.division-card:hover .division-title {
    color: white;
}

.division-subtitle {
    font-size: 16px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 20px;
    transition: color 0.5s ease;
}

.division-card:hover .division-subtitle {
    color: rgba(255, 255, 255, 0.9);
}

.division-location {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #94a3b8;
    font-weight: 600;
    /* Added margin-top: auto to push the location to the very bottom */
    margin-top: auto; 
    transition: color 0.5s ease;
}

.division-card:hover .division-location {
    color: white;
}

/* --- RESPONSIVENESS --- */

/* Tablet/Smaller Desktop */
@media (max-width: 1024px) {
    .divisions-section {
        padding: 60px 24px;
    }
    .divisions-grid {
        gap: 24px;
    }
}

/* Mobile: single column, full-width cards, ensure image visible */
@media (max-width: 768px) {
    .divisions-section {
        padding: 48px 16px;
    }
    .section-header {
        margin-bottom: 40px;
    }
    .section-description {
        font-size: 16px;
    }
    .divisions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .division-image {
        height: 240px;
        min-height: 200px;
    }
    .division-image img {
        object-fit: contain;
        object-position: center;
    }
    .division-content {
        padding: 20px 20px 22px;
    }
}

@media (max-width: 480px) {
    .divisions-section {
        padding: 40px 12px;
    }
    .division-image {
        height: 220px;
        min-height: 180px;
    }
}