/* ==========================================================================
   1. Responsive Breakpoints & Container Adapters (Mobile-First)
   ========================================================================== */

/* Core Mobile Default (0px - 576px) inherits from style.css base rules, 
   overridden here via structural components to adapt gracefully */

.grid {
    grid-template-columns: 1fr !important;
    /* Stack all grids by default on mobile */
    gap: 20px;
}

/* ==========================================================================
   2. Small Devices (Landscape Phones, 576px and up)
   ========================================================================== */
@media (min-width: 576px) {
    .container {
        padding: 0 25px;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .hero-title {
        font-size: 32px;
    }

    .services-row-bottom {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

/* ==========================================================================
   3. Medium Devices (Tablets, 768px and up)
   ========================================================================== */
@media (min-width: 768px) {
    :root {
        --section-padding-desktop: 60px 0;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 Columns on tablet for readability */
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        /* 2 Columns on tablet */
    }

    .hero-section {
        height: 70vh;
    }

    .hero-title {
        font-size: 40px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .services-row-bottom {
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
}

/* ==========================================================================
   4. Large Devices (Desktops, 992px and up)
   ========================================================================== */
@media (min-width: 992px) {
    :root {
        --section-padding-desktop: 80px 0;
    }

    /* Restore Desktop Grid Integrity */
    .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .hero-section {
        height: 80vh;
    }

    .hero-title {
        font-size: 48px;
    }

    /* Navigation Layout Transitions */
    .menu-toggle {
        display: none;
        /* Hide hamburger menu on desktop */
    }

    .nav-menu {
        display: block !important;
        position: static;
        background-color: transparent;
        width: auto;
        height: auto;
        padding: 0;
        box-shadow: none;
    }

    .nav-menu ul {
        flex-direction: row;
        align-items: center;
    }

    .nav-menu li {
        margin: 0;
    }

    .nav-link {
        padding: 10px 15px;
        display: block;
    }

    .nav-cta {
        display: block !important;
    }

    /* Footer Restructuring */
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 2fr;
    }

    .services-row-bottom {
        grid-template-columns: repeat(2, 1fr);
        width: calc((100% - 60px) * 2 / 3 + 30px);
        margin: 30px auto 0;
    }
}

/* ==========================================================================
   5. Mobile Navigation & Interactive Overrides (Max-width: 991px)
   ========================================================================== */
@media (max-width: 991px) {
    .top-bar {
        display: none;
        /* Hide top bar on mobile to optimize view vertical space */
    }

    .main-header {
        padding: 12px 0;
    }

    .header-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .logo {
        flex-shrink: 1;
        min-width: 0;
    }

    .logo img {
        width: 160px !important;
        height: auto !important;
        max-width: 160px !important;
        object-fit: contain;
        display: block;
    }

    .menu-toggle {
        flex: 0 0 28px;
        width: 28px;
        height: 21px;
    }

    .nav-cta {
        display: none;
        /* Hide secondary CTA on mobile headers */
    }

    .menu-toggle {
        display: flex;
        /* Show navigation hamburger */
    }

    /* Mobile Drawer Overlay */
    .nav-menu {
        position: fixed;
        top: 64px;
        /* Matches the compact mobile header */
        left: -100%;
        width: 100%;
        height: calc(100vh - 64px);
        background-color: var(--color-white);
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
        transition: var(--transition-smooth);
        overflow-y: auto;
        padding: 30px 20px;
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu ul {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu li {
        width: 100%;
        margin-bottom: 15px;
    }

    .nav-link {
        font-size: 18px;
        padding: 10px 0;
        width: 100%;
        border-bottom: 1px solid var(--color-bg-light);
    }

    .nav-link::after {
        display: none;
        /* Suppress bottom hover bars on touch devices */
    }

    /* Hamburger Active Transform State */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Interface adjustments */
    .section-title {
        font-size: 28px;
    }

    .hero-content {
        text-align: center;
        padding: 0 10px;
    }

    .hero-actions {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .hero-actions .btn {
        margin-right: 0;
        width: 100%;
    }

    .footer-bottom-container {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}