:root {
    --primary-background: #fefefe;
    --primary-accent: grey;
    --default-text: black;
    --primary-highlight: blue;
}

* {
    margin:0;
    padding:0;
    box-sizing: border-box;
    font-family: arial;
}

html {
    background: hsla(302, 82%, 76%, 1);
    background: linear-gradient(90deg, hsla(302, 82%, 76%, 1) 0%, hsla(258, 40%, 68%, 1) 100%);
}

/* List of products */
#product_list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    align-content: flex-start;
    justify-content: space-evenly;
    max-width: 1500px;
    margin: auto;
}

.prod_container {
    padding: 5px;
    text-align: center;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    margin: 10px 0;
    background-color: var(--primary-background);
    transition: 0.5s ease;
}

.prod_container:hover {
    border: 2px solid var(--primary-highlight);
    cursor: pointer; 
    color: var(--primary-accent);
    transform: scaleX(105%) scaleY(105%);
}

.prodImageContainer {
    margin: 0;
    width: 100%;
    height: 70%;
    position: relative;
}

.prodImageContainer img,
#modal_image_container img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
}

.titleContainer {
    height: 20%;
    width: 100%;
    overflow: hidden;
    padding-top: 10px;
    margin: auto;
}
.priceContainer {
    height: 10%;
    width: 100%;
    padding-top: 10px;
    color: var(--primary-accent);
}

/******************** MODAL ********************/
.modal {
    visibility: hidden; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--default-text); /* Fallback color */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
}

/* Modal Content */
.modal_content {
    width: 90%;
    height: 90%;
    max-width: 600px;
    max-height: 500px;
    background-color: var(--primary-background);
    margin: auto auto;
    padding: 5px;
    border: 1px solid var(--primary-accent);
    display: grid;
}

/* The Close Button */
#modal_close {
    color: var(--primary-accent);
    font-size: 28px;
    font-weight: bold;
}

#modal_close:hover,
#modal_close:focus {
    color: var(--default-text);
    text-decoration: none;
    cursor: pointer;
}

#modal_close {
    position: absolute;
    top: -40px;
    right: 0px;
    padding: 0 6px;
    background-color: var(--primary-background);
    margin-bottom: 5px;
}

/* Modal heading (prod title, price and ratings) */
#modal_heading {
    grid-area: heading;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#product_title {
    overflow: hidden;
    margin-bottom: 5px;
    margin: 0 auto;
}

#product_price_rating {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 5px 10px;
    margin: auto 0;
}

/* Modal footer (add to basket button and prod desc) */
#modal_footer {
    grid-area: footer;
    margin-top: 5px;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
}

#product_desc {
    overflow: auto;
}

#modal_button {
    height: 30px;
    width: 100px;
    margin-bottom: 10px;
}

#modal_button:hover {
    background-color: var(--default-text);
    color: var(--primary-background);
    text-decoration: none;
    cursor: pointer;
}

#modal_image_container img {
    grid-area: image;
    padding-right: 10px;
}

.prodImageContainer img,
.modal_content,
#modal_image_container img {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
}

/* make the modal grid responsive */
@media only screen and (min-width: 415px) {
    .modal_content {
        grid-template-rows: 25% 75%;
        grid-template-columns: 50% 50%;
        grid-template-areas:
        "image heading"
        "image footer";
    }

    .prod_container {
        width: 250px;
        height: 400px;
    }
}

@media only screen and (max-width: 414px) {
    .modal_content {
        grid-template-rows: 25% 40% 35%;
        grid-template-columns: auto;
        grid-template-areas:
        "heading"
        "image"
        "footer";
    }

    .prod_container {
        width: 140px;
        height: 350px;
        font-size: 0.75rem;;
    }
}