/* Example CSS file */ 

:root{
    --primary: #663399;
}

* {
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    max-width: 800px;
    margin: 0px auto;
}

#topnav {
    position: sticky;
    top: 0px;
    overflow: hidden;
    background-color: var(--primary);
}

#topnav a, #topnav h2 {
    float: right;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    transition: .25s;
    font-size: 1.25rem;
}

#topnav #title {
    float: left;
}

#topnav .nav-item:hover {
    background-color: #ddd;
    color: var(--primary);
}

.empty {
    text-decoration: inherit;
    color: inherit;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin: 15px;
}

.recipe {
    cursor: pointer;
    position: relative;
    width: 100%;
    border: 1px solid #cdcdcd;
    border-radius: 2px;
}

.recipe img {
    display: block;
    width: 100%;    
    height: 200px;
    object-fit: cover;

    border-top-left-radius: 2px;
    border-top-right-radius: 2px;
}

.recipe .title {
    position: absolute;
    top: 10px;
    color: #f2f2f2;
    font-size: 1.5rem;
    width: 100%;
    text-align: center;
    margin: 0px;
    padding: 10px;
    background-image: linear-gradient(#fff0, #66339988, #66339988, #fff0);
}

.recipe .description {
    padding: 15px 10px;
}

.recipe .categories {
    padding: 2px 5px;
    font-size: .65rem;
    color: #898989;
}

form {
    margin: 25px 15px;
    display: flex;
    justify-content: space-between;
}

.search-bar {
    display: flex;
    padding: 5px;
    border: 1px solid #cdcdcd;
    border-radius: 2px;
}

.search-bar .text {
    flex: 1;
    background: #fff;
    outline: none;
    border: none;
    font-size: 1rem;
    padding: 5px 10px;
    margin-inline: 5px;
    border-radius: 2px;
}

.search-bar .text:focus, .search-bar .text:hover {
    background-color: #efefef;
}

.search-bar .button {
    cursor: pointer;
    border-radius: 2px;
    background: var(--primary);
    outline: none;
    border: none;
    font-size: 1rem;
    padding: 5px 10px;
    color: #f2f2f2;
}

.search-bar .button:hover {
    background-color: #9c6acd;
}

select {
    cursor: pointer;
    outline: none;
    color: #333;
    border: none;
    background-color: #dedede;
    border-radius: 2px;
}

.detail {
    width: 100%;
}

.detail h2 {
    text-align: center;
    margin-block: 35px;
}

.detail-container {
    display: flex;
    gap: 20px;
}

.detail-container .main {
    flex: 1;
}

.detail-container .main h3 {
    text-align: center;
}

.detail-container .main .ingredient {
    color: #333;
    line-height: 1.8rem;
    margin-left: 20px;
}

.detail-container .main .ingredient .amount {
    margin-left: 5px;
    font-weight: bold;
}

.detail-container .sidebar {
    max-width: 40%;
}

.detail-container .sidebar img {
    display: block;
    width: 100%;    
    object-fit: cover;
    border-radius: 2px;
}

.detail-container .sidebar p {
    margin-top: 20px;
    line-height: 1.5rem;
}

.stepHeader {
    width: 100%;
    border-bottom: 1px solid #ddd;
    line-height: .1rem;
    margin: 35px 0px 20px;
    color: #333;
}

.stepHeader span {
    margin-left: 20px;
    background: #fff;
    padding: 0px 10px;
}

.stepIngredients {
    color: #333;
    font-size: .8rem;
    line-height: 1rem;
    padding-bottom: 15px;
    padding-inline: 10px;
    border-bottom: 1px solid #ddd;
}

.stepDescription {
    padding: 20px 30px;
    line-height: 1.5rem;
}

#servingsForm {
    line-height: 2rem;
    max-width: 120px;
}

#servingsForm div label {
    padding-left: 5px;
}

#servings {
    width: 3rem;
    height: 2rem;
    padding-left: 5px;
    margin-inline: 5px;
    border: none;
    outline: none;
}

#servings:focus, #servings:hover {
    background-color: #efefef;
    border-radius: 2px;
}

.times {
    color: #333;
    font-size: .9rem;
    padding-bottom: 20px;
    padding-inline: 10px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

@media only screen and (max-width: 600px) { 
    .grid{ 
        grid-template-columns: 1fr;
    } 

    .detail-container {
        display: block;
    }

    .detail-container .sidebar {
        margin: auto;
        text-align: center;
    }
}

@media only screen and (min-width: 600px) { 
    .grid{ 
        grid-template-columns: 1fr 1fr; 
    } 

    .detail-container {
        display: block;
    }

    .detail-container .sidebar {
        margin: auto;
        text-align: center;
    }
}

@media only screen and (min-width: 768px) { 
    .grid{ 
        grid-template-columns: 1fr 1fr 1fr; 
    } 

    .detail-container {
        display: flex;
    }

    .detail-container .sidebar {
        margin: 0px;
        text-align: left;
    }
}