/**
 * Mobile Button Layout Optimization
 * Fixes the 2-2-1 button arrangement issue on mobile devices
 * Implements single-column layout for better UX
 */

/* Target the homepage button container */
.home .wp-block-buttons,
.home .wp-block-button-group,
body.home [class*="button-container"],
body.home [class*="cta-buttons"] {
    /* Mobile-first: Single column layout */
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure buttons take full width on mobile */
.home .wp-block-buttons .wp-block-button,
.home .wp-block-button-group .wp-block-button,
body.home [class*="button-container"] a,
body.home [class*="button-container"] button,
body.home [class*="cta-buttons"] a,
body.home [class*="cta-buttons"] button {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.home .wp-block-buttons .wp-block-button__link,
.home .wp-block-button-group .wp-block-button__link,
body.home [class*="button-container"] a,
body.home [class*="cta-buttons"] a {
    width: 100% !important;
    display: block !important;
    text-align: center !important;
    padding: 14px 20px !important;
    box-sizing: border-box !important;
}

/* Tablet breakpoint: 2-column grid */
@media (min-width: 768px) and (max-width: 1024px) {
    .home .wp-block-buttons,
    .home .wp-block-button-group,
    body.home [class*="button-container"],
    body.home [class*="cta-buttons"] {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 16px !important;
    }
    
    .home .wp-block-buttons .wp-block-button,
    .home .wp-block-button-group .wp-block-button,
    body.home [class*="button-container"] a,
    body.home [class*="button-container"] button,
    body.home [class*="cta-buttons"] a,
    body.home [class*="cta-buttons"] button {
        width: calc(50% - 8px) !important;
        flex: 0 0 calc(50% - 8px) !important;
    }
    
    /* Make the 5th button span full width for better balance */
    .home .wp-block-buttons .wp-block-button:nth-child(5),
    .home .wp-block-button-group .wp-block-button:nth-child(5),
    body.home [class*="button-container"] a:nth-child(5),
    body.home [class*="button-container"] button:nth-child(5),
    body.home [class*="cta-buttons"] a:nth-child(5),
    body.home [class*="cta-buttons"] button:nth-child(5) {
        width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Desktop: Horizontal layout */
@media (min-width: 1025px) {
    .home .wp-block-buttons,
    .home .wp-block-button-group,
    body.home [class*="button-container"],
    body.home [class*="cta-buttons"] {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 16px !important;
    }
    
    .home .wp-block-buttons .wp-block-button,
    .home .wp-block-button-group .wp-block-button,
    body.home [class*="button-container"] a,
    body.home [class*="button-container"] button,
    body.home [class*="cta-buttons"] a,
    body.home [class*="cta-buttons"] button {
        width: auto !important;
        flex: 0 0 auto !important;
    }
}

/* Ensure proper spacing and touch targets on mobile */
@media (max-width: 767px) {
    .home .wp-block-button__link,
    body.home [class*="button-container"] a,
    body.home [class*="cta-buttons"] a {
        min-height: 48px !important; /* Minimum touch target size */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Made with Bob */
