/* Sticky header for block theme */
.wp-block-template-part {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 9999;
  background-color: #ffffff; /* change to your color or keep your gradient */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* ======================================================= */
/* 1. DESKTOP GRID LAYOUT (Use your existing rules) */
/* ======================================================= */

#service-blocks {
    /* Forces 7 equal-width columns using GRID on desktop */
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 10px; 
    margin-bottom: 0 !important; 
}

/* Fixed-height columns on DESKTOP */
#service-blocks .wp-block-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 500px; /* FIXED HEIGHT on desktop */
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50); 
    box-sizing: border-box; 
    /* Remove min-width rule conflict we were testing */
    min-width: unset !important; 
}

/* (Include your existing inner-block, group, and spacer rules here) */
#service-blocks .wp-block-column .wp-block-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-bottom: 0; 
}
#service-blocks .wp-block-spacer {
    display: none;
}


/* ======================================================= */
/* 2. MOBILE FIXES (Applied below 768px) */
/* ======================================================= */
/* Sticky header for block theme */
.wp-block-template-part {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 9999;
  background-color: #ffffff; /* change to your color or keep your gradient */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* ======================================================= */
/* 1. DESKTOP GRID LAYOUT (Use your existing rules) */
/* ======================================================= */

#service-blocks {
    /* Forces 7 equal-width columns using GRID on desktop */
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 10px; 
    margin-bottom: 0 !important; 
}

/* Fixed-height columns on DESKTOP */
#service-blocks .wp-block-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 500px; /* FIXED HEIGHT on desktop */
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--50); 
    box-sizing: border-box; 
    /* Remove min-width rule conflict we were testing */
    min-width: unset !important; 
}

/* (Include your existing inner-block, group, and spacer rules here) */
#service-blocks .wp-block-column .wp-block-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-bottom: 0; 
}
#service-blocks .wp-block-spacer {
    display: none;
}


/* ======================================================= */
/* --- 2. Corrected Mobile Stacking and Padding Fix (Applied below 1024px) --- */
@media (max-width: 800px) {
    
    /* A. FORCE COLUMN STACKING (The Grid Override) */
    #service-blocks {
        /* CRUCIAL: Switch from Grid to a simple column layout on mobile */
        display: block !important; 
        
        /* Reset grid properties that force a row */
        grid-template-columns: none !important;
        gap: 0 !important;
        
        /* REMOVE ANY HORIZONTAL PADDING/MARGIN from the main container */
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* B. FORCE 100% WIDTH and RESET HEIGHT */
    #service-blocks .wp-block-column {
        width: 100% !important; 
        flex: 0 0 100% !important; 
        height: auto !important; 
        min-height: 200px; 
        margin-bottom: 15px; 
        
        /* CRUCIAL FIX: Reduce the massive side padding on mobile. 
           Change these values (e.g., to 20px) if they are still too wide. */
        padding-left: 20px !important; 
        padding-right: 20px !important;
    }

    /* C. FLUID TEXT SIZE (Shrinking) */
    #service-blocks h2 {
        font-size: clamp(20px, 3.5vw, 30px) !important;
    }

    #service-blocks p {
        font-size: 14px !important; 
    }

    /* D. Vertical Text Stacking Fix (Failsafe) */
    #service-blocks * {
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }
}