#top {
    margin-top: 124.7px;
}


.product-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 equal columns */
    /*grid-auto-rows: 8vw; !* height unit for each row, tweak as you like *!*/
    gap: 1rem;
    width: 48.3vw;
}

/* main image spans 3 columns x 3 rows */
#product-gallery-main {
    grid-column: 1 / -1;    /* from first to last column (all 3) */
    grid-row: 1 / span 3;   /* rows 1, 2, 3 */
}

/* make images fill their grid cell nicely */
.product-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

/* thumbs are 1x1 cells, automatically fill row 4, 5, 6, ... */
.product-gallery-thumb {
    /* no special grid rules needed, auto-placement handles it */
    cursor: pointer;
    opacity: 0.8;
    transition: opacity .2s, outline .2s;
}

.product-gallery-thumb:hover {
    opacity: 1;
}

.product-gallery-thumb.active {
    outline: 2px solid black;
    opacity: 1;
}

.product-top {
    display: flex;
    /*gap: 45px;*/
    justify-content: space-evenly;
    margin-bottom: 80px;
}




.product-purchase {
    width: 44.4vw;
}

.black-line {
    border: none;
    border-top: 2px solid #000; /* black line */
    margin: 1rem 0;             /* spacing above/below */
}

.gray-line {
    border: none;
    border-top: 2px solid lightgray; /* black line */
    margin: 1rem 0;             /* spacing above/below */
}

.product-purchase > h1{
    font-size: 30px;
    line-height: 1.4;
    margin-bottom: 12px;
}

.product-purchase > p:first-of-type{
    font-size: 17px;
    color: #d49743;
    margin-bottom: 12px;
}

.product-purchase > p:last-of-type {
    color: #575a61;
    font-size: 25px;
    font-weight: 500;
    margin-bottom: 14px;
}

.product-purchase span {
    text-decoration: line-through;
}

.product-purchase form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.product-purchase form,
.product-purchase form button{
    font-size: 17px;
    color: #575a61;
}

.product-purchase form input,
.product-purchase form select{
    font-size: 30px;
    color: #575a61;
}

.product-purchase form select{
    border: 1px solid lightgray;
    border-radius: 2px;
    padding: 9px;
}

.product-purchase form button{
    padding: 3px 0;
}

#price-display {
    font-size: 25px;
    font-weight: 500;
}

#add-to-cart-btn, .back-to-shop {
    padding: 10px 20px;
    border: none;
    color: white;
    background-color: black;
    cursor: pointer;
    letter-spacing: 2px;
    transition: background-color 0.25s ease;
}

.back-to-shop {
    background-color: #d49743;
}

#add-to-cart-btn:hover {
    background-color: #d49743;
}

#quantity-input {
    border: none;
    border-left: 1px solid #ccc;
    text-align: center;
    width: 100%;
    font-size: 1rem;
    background: #fff;
}

#quantity-input:focus {
    outline: none;
}

.quantity-control {
    display: grid;
    grid-template-columns: 40px 50px 40px; /* adjust sizes */
    border: 1px solid #ccc;
    overflow: hidden;
    width: max-content;
}

.quantity-control button {
    background: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#qty-plus{
    border-left: 1px solid #ccc;
}

.quantity-and-add {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* PRODUCT DESCRIPTION */

.product-description {
    border-top: darkgray solid 1px;
    font-size: 17px;
    padding: 40px 20px 60px 20px;
}

.product-description p {
    color: #585858;
    margin-bottom: 10px;
    line-height: 2;
}

.nutrition-table {
  width: 100%;
  border-collapse: collapse;   /* merges borders cleanly */
  table-layout: fixed;
    color: #585858;
}

.nutrition-table td, caption {
  padding: 16px 16px;
  border: 1px solid #000;      /* borders for all cells */
  vertical-align: middle;
}

.nutrition-table td:first-child {
  width: 66.666%;
}

.nutrition-table td:last-child {
  width: 33.333%;
  text-align: right;
}

@media (max-width: 500px) {
    .product-top{
        flex-direction: column;
    }

    .product-gallery{
        width: 100%;
        margin-bottom: 16px;
    }

    .product-purchase{
        width: 100%;
    }

    .product-top {
        padding: 20px;
        margin-bottom: 0;
    }

    .product-purchase > h1{
        font-size: 27px;
    }

    .product-purchase > p:first-of-type {
        font-size: 14px;
    }

    .product-purchase > p:last-of-type{
        font-size: 23px;
    }

    .product-purchase form input, .product-purchase form select {
        font-size: 17px;
    }

}