/* General Reset and Body Styling */
body {
    margin: 0;
    font-family: sans-serif;
    background-color: #3d4852; /* Dark Slate Grey/Blue background */
    color: #f0f0f0;
}

/* Header and Navigation */
.page-header {
    background-color: #2c3e50;
    padding: 15px 0;
}

.main-nav {
    display: flex;
    justify-content: space-around;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    flex-wrap: wrap;
}

.nav-link {
    background-color: #3498db;
    color: white;
    padding: 12px 25px;
    border-radius: 3px;
    text-align: center;
    box-sizing: border-box;
    flex-basis: auto;
    margin: 5px;
}

/* Grid Container Styling - DESKTOP */
.grid-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 40px;
    gap: 30px;
    max-width: 900px;
    margin: 40px auto;
}

.grid-item {
    border-radius: 6px;
}

/* Pink Block */
.item-a {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 300px;
    min-height: 300px;
    background-color: orangered;
}

/* Wrapper for the 2x2 Yellow Grid */
.subgrid-wrapper {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-content: flex-start;
}

/* Individual Yellow Blocks within the subgrid */
.subgrid-wrapper .grid-item {
    flex-basis: calc(50% - 10px);
    min-height: 140px;
    background-color: mediumvioletred;
}

/* Footer */
.page-footer {
    background-color: #2c3e50;
    padding: 25px;
    margin-top: 30px;
}



                    /* --- Responsive Adjustments --- */

                    /* Phone View */
@media (max-width: 500px) {
    /* Navigation: 2 links per row */
    .main-nav {
        flex-direction: row;
        flex-wrap: row wrap;
        justify-content: space-between;
        padding: 0 10px; /* Add some horizontal padding to nav container */
    }

    .nav-link {
        flex-basis: calc(50% - 5px); /* Two items per row, accounting for small gap. */
        margin: 5px 0; /* Vertical margin between rows of nav links */
        padding: 15px; /* Keep padding for easier tapping */
        min-height: 40px; /* Give nav items some explicit min-height like in image */
        display: flex; /* To center text if it were there */
        align-items: center; /* To center text if it were there */
        justify-content: center; /* To center text if it were there */
    }

    .nav-link:last-child:nth-child(odd) { /* If last nav item is odd, make it full width */
        flex-basis: 100%;
    }

    /* Content Blocks: */
    .grid-container {
        flex-direction: column; /* Stack item-a and subgrid-wrapper */
        align-items: stretch;   /* Make children take full width */
        padding: 15px 3px;
        gap: 35px;              /* Gap between pink block and yellow block group */
        margin: 15px auto;
    }

    .item-a { /* Pink block */
        flex-basis: 100%;   /* Full width */
        min-height: 380px;  /* Adjust height as needed */
        max-width: none;
    }

    .subgrid-wrapper { /* Wrapper for yellow blocks at the bottom */
        flex-basis: 100%;   /* Full width */
        gap: 10px;          /* Gap between rows/items of yellow blocks */
        max-width: none;
        display: flex;      /* Ensure it's a flex container */
        flex-wrap: wrap;    /* Allow yellow blocks to wrap */
        justify-content: space-between; /* Distribute space for 2-column items */
    }

    .subgrid-wrapper .grid-item { /* Yellow blocks at the bottom */
        flex-basis: calc(50% - 5px); /* Two yellow blocks per row. (10px total gap / 2 = 5px) */
        min-height: 180px;  /* Adjust height as needed to look like image */
    }

    /* If there's an odd number of yellow blocks in the subgrid,
       the last one should take full width like the nav items. */
    .subgrid-wrapper .grid-item:last-child:nth-child(odd) {
        flex-basis: 100%;
    }
}