/**
 * JBL CNC Global Link - Responsive Base Styles
 *
 * Breakpoints:
 *   Desktop: ≥1024px (multi-column layouts)
 *   Tablet:  768px–1023px (reduced columns, adjusted spacing)
 *   Mobile:  <768px (single-column, stacked nav)
 *
 * Validates: Requirements 1.5, 1.7, 1.8
 */

/* ==========================================================================
   Global Layout Rules
   ========================================================================== */

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-weight: var(--jbl-font-regular, 400);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
video,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Desktop Styles (≥1024px)
   ========================================================================== */

@media screen and (min-width: 1024px) {
    .site-content {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 40px;
        padding-right: 40px;
    }

    .content-section {
        padding: 80px 0;
    }

    .grid-layout {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }

    .grid-layout--two-col {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .site-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }

    .nav-toggle {
        display: none;
    }
}

/* ==========================================================================
   Tablet Styles (768px–1023px)
   ========================================================================== */

@media screen and (min-width: 768px) and (max-width: 1023px) {
    .site-content {
        max-width: 100%;
        padding-left: 30px;
        padding-right: 30px;
    }

    .content-section {
        padding: 60px 0;
    }

    .grid-layout {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .grid-layout--two-col {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .site-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .nav-toggle {
        display: none;
    }
}

/* ==========================================================================
   Mobile Styles (<768px) — Single-column stacking
   ========================================================================== */

@media screen and (max-width: 767px) {
    .site-content {
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }

    .content-section {
        padding: 40px 0;
    }

    /* Single-column stacking rule for all grid and multi-column layouts */
    .grid-layout,
    .grid-layout--two-col {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Navigation stacks vertically within toggleable menu */
    .site-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0;
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        padding: 12px 16px;
        border-bottom: 1px solid rgba(18, 38, 32, 0.1);
    }

    .nav-toggle {
        display: block;
        cursor: pointer;
    }

    /* Footer stacks to single column on mobile */
    .site-footer .footer-columns {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Ensure all flex containers stack on mobile */
    .flex-row-desktop {
        flex-direction: column;
    }
}

/* ==========================================================================
   Envira Gallery — Responsive Columns
   Validates: Requirements 5.1, 5.4
   ========================================================================== */

/* Desktop: 3+ columns */
@media screen and (min-width: 1024px) {
    .envira-gallery-wrap .envira-gallery-public {
        column-count: 3;
    }
    .envira-gallery-wrap .enviratope {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

/* Tablet: 2 columns */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .envira-gallery-wrap .envira-gallery-public {
        column-count: 2;
    }
    .envira-gallery-wrap .enviratope {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Mobile: 1 column */
@media screen and (max-width: 767px) {
    .envira-gallery-wrap .envira-gallery-public {
        column-count: 1;
    }
    .envira-gallery-wrap .enviratope {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Gallery image hover effect */
.envira-gallery-item img {
    border-radius: 4px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.envira-gallery-item img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(18, 38, 32, 0.15);
}

/* ==========================================================================
   Gallery Empty-State Visibility
   Validates: Requirement 5.5
   ========================================================================== */

/* When gallery has images: hide empty-state section */
.jbl-gallery-has-images .jbl-gallery-empty-state {
    display: none;
}

/* When gallery is empty: show empty-state */
.jbl-gallery-empty .jbl-envira-gallery-wrapper {
    display: none;
}
