/**
 * HW Builder Grid - Contact Page Styles
 *
 * LAYOUT ONLY — all font families, sizes, weights, and colors are handled
 * via inline styles in the PHP (community theme system) to prevent theme
 * CSS from overriding them with !important.
 *
 * This file handles: containers, grid layout, responsive, hover states,
 * divider pseudo-elements, and image overrides.
 *
 * @package HW_Builder_Grid
 */

/* ==========================================================================
   Contact Section Container
   ========================================================================== */

.dbg-contacts-section {
    width: 1500px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Break out of WordPress theme content container */
.entry-content .dbg-contacts-section,
.wp-block-post-content .dbg-contacts-section,
.site-content .dbg-contacts-section,
.content-area .dbg-contacts-section,
article .dbg-contacts-section {
    width: 1500px;
    max-width: 100%;
}

/* ==========================================================================
   Contact Cards Grid (Grouped layout)
   ========================================================================== */

.dbg-contacts-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 30px;
    max-width: calc((var(--dbg-contact-card-width, 350px) + 30px) * var(--dbg-contact-columns, 4));
    margin-left: auto;
    margin-right: auto;
}

.dbg-contact-card {
    flex: 0 0 var(--dbg-contact-card-width, 350px);
    text-align: center;
    padding: 10px 5px;
}

/* ==========================================================================
   Hover States
   ========================================================================== */

.dbg-contact-phone:hover,
.dbg-contact-email:hover {
    opacity: 0.7;
    text-decoration: none;
}

/* ==========================================================================
   Individual Grid Layout — Clean Editorial
   Structural rules only. Fonts/colors come from inline styles.
   ========================================================================== */

/* Prevent WordPress block editor layout rules from overriding our grid */
.is-layout-constrained .dbg-contacts-individual-grid,
.is-layout-flow .dbg-contacts-individual-grid,
.wp-block-post-content .dbg-contacts-individual-grid,
.entry-content .dbg-contacts-individual-grid {
    display: grid !important;
    max-width: 1000px !important;
    gap: 0 !important;
}

.is-layout-constrained .dbg-contact-individual-card,
.is-layout-flow .dbg-contact-individual-card,
.wp-block-post-content .dbg-contact-individual-card,
.entry-content .dbg-contact-individual-card {
    max-width: none !important;
}

/* Vertical dividers between columns — 3-col */
.dbg-contacts-individual-grid[style*="repeat(3"] .dbg-contact-individual-card:not(:nth-child(3n))::after,
.dbg-contacts-individual-grid:not([style*="repeat("]) .dbg-contact-individual-card:not(:nth-child(3n))::after {
    content: '';
    position: absolute;
    right: 0;
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: var(--dbg-border, #D4C9B8);
}

/* Vertical dividers — 2-col */
.dbg-contacts-individual-grid[style*="repeat(2"] .dbg-contact-individual-card::after {
    display: none !important;
}
.dbg-contacts-individual-grid[style*="repeat(2"] .dbg-contact-individual-card:not(:nth-child(2n))::after {
    content: '' !important;
    display: block !important;
    position: absolute;
    right: 0;
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: var(--dbg-border, #D4C9B8);
}

/* Vertical dividers — 4-col */
.dbg-contacts-individual-grid[style*="repeat(4"] .dbg-contact-individual-card::after {
    display: none !important;
}
.dbg-contacts-individual-grid[style*="repeat(4"] .dbg-contact-individual-card:not(:nth-child(4n))::after {
    content: '' !important;
    display: block !important;
    position: absolute;
    right: 0;
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: var(--dbg-border, #D4C9B8);
}

/* Override theme img rules for logos */
.dbg-contacts-section img.dbg-contacts-builder-logo {
    max-width: 200px !important;
    width: 200px !important;
    height: 100px !important;
    object-fit: contain !important;
}

.dbg-contacts-section .dbg-contact-individual-logo-wrap img.dbg-contact-individual-logo {
    max-width: 180px !important;
    max-height: 60px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* ==========================================================================
   No Contacts Message
   ========================================================================== */

.dbg-no-contacts {
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 40px 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 768px) {
    .dbg-contacts-section {
        padding: 0 15px;
    }
    
    .dbg-contacts-cards {
        gap: 8px 15px;
        max-width: 100%;
    }
    
    .dbg-contact-card {
        flex: 0 0 150px;
    }
    
    .dbg-contacts-individual-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 100%;
    }
    
    .dbg-contact-individual-card::after {
        display: none !important;
    }
    .dbg-contact-individual-card:not(:nth-child(2n))::after {
        content: '' !important;
        display: block !important;
        position: absolute;
        right: 0;
        top: 24px;
        bottom: 24px;
        width: 1px;
        background: var(--dbg-border, #D4C9B8);
    }
    
    .dbg-contacts-section .dbg-contact-individual-logo-wrap img.dbg-contact-individual-logo {
        max-width: 160px !important;
        max-height: 50px !important;
    }
}

@media screen and (max-width: 480px) {
    .dbg-contacts-cards {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .dbg-contact-card {
        flex: 0 0 auto;
        width: 100%;
        max-width: 280px;
    }
    
    .dbg-contacts-individual-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dbg-contact-individual-card::after {
        display: none !important;
    }
}
