* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 18px;
}

body {
    font-family: "Nunito", Arial, sans-serif;
    font-size: 18px;
    color: #2E261C;
    background-color: #F7F1E8;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.5rem;
    justify-content: center;
}

header {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.header-top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
}

.title {
    font-family: "Playwrite US Trad", Georgia, serif;
    font-size: 1.25em;
    color: #A8570C;
}

header > nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    border-top: 2px solid #A8570C;
    gap: 1rem;
}

.header-search {
    display: flex;
    flex-direction: row;
    padding-top: .25rem;
    gap: .25rem;
    margin-left: auto;
}

header form button {
    padding: .25rem;
}

main {
    display: flex;
    flex-direction: column;
    max-width: 700px;
    background-color:#FFF9F1;
    padding: 1em;
    margin: 1em auto;
    border: 2px solid #888;
    border-radius: 30px;
    gap: 1rem;
}

.account-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
}

h1 {
    font-family: "Playwrite US Trad", Georgia, serif;
    font-size: 1.8em;
    color:#A8570C;
}

header > a, h2, h3, h4, h5, h6 {
    font-family: "Playwrite US Trad", Georgia, serif;
    font-size: 1.25em;
    color: #A8570C;
}

a {
    color: #8B5E34;
    text-decoration: none;
}

a:hover {
    color:#A8570C;
    text-decoration: underline;
}

.description {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.ingredients {
    display: flex;
    flex-direction: column;
    padding-left: 1rem;
    text-indent: -1rem;
}

.steps {
    display: flex;
    flex-direction: column; 
    margin-left: 1rem;
}

.description, .ingredients, .steps {
    line-height: 1.25;
}

.tags, header > nav > ul {
    list-style: none;
    color:#2E261C
}

ul.tags a::before {
    content: "#";
    color: #888
}

.buttonlink {
    color: #F7F1E8;
    background-color: #8B5E34;
    padding: 0.5em 1em;
    border-radius: 9999px;
}

.card-grid {
    display: flex;
    flex-direction: row;
    gap: 1rem; 
    padding: 1rem 0;
    align-items: start;
    flex-wrap: wrap;
}

.card {
    display: flex;
    flex-direction: column;
    flex: 0 1 calc((100% - 2rem) / 3);
    background: #FFF;
    border: 1px solid #CCC;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.card .tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    line-height: 1rem;
    text-wrap: nowrap;
}

.recipe-photo {
    transform: rotate(2deg);
    border: 5px solid #FFF;
    border-radius: 3px;
    max-width: 100%;
    padding-bottom: 0.5rem;
}

.split-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-bottom: 2rem;
    margin-top: 1rem;
}

.split-row > section:first-child {
    flex: 1 1 33%;
    max-width: 33%;
}

.split-row > section:last-child {
    flex: 2 1 67%;
    max-width: 67%;
}

.time-info {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: start;
}

.label-value {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
}

.label-value dt {
    flex-basis: calc(25%);
}

.label-value dd {
    flex-basis: calc(75%);
}

.search-bar input {
    width: 100%;
    padding: 0.25rem;
    box-sizing: border-box;
}

.profile-bio {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content:space-between;
    gap: 1rem;
    padding-bottom: 2rem;
}

.left-bio {
    display: flex;
    flex-direction: column;
}

.prof-pic {
    width: 5rem;
    height: 5rem;
}

.visually-hidden {
    display: none;
}

.metadata {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    flex-wrap: wrap;
    row-gap: 0.1rem;
}

.metadata ul.tags {
    display: flex;
    gap: 0.5rem;
}

main form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: baseline;
    padding: 0.25rem;
    font-size: 1.25rem;
}

main form button {
    width: 50%;
    min-width: 200px;
    align-self: center;
    padding: 0.5rem;
    font-size: 1.25em;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    flex-shrink: 0;
    width: auto;
    min-width: auto;
}

section > h1 {
    display: flex;
    justify-content: space-between;
}

main form button:hover {
    background-color: #A8570C;
    color: #FFF9F1;
    cursor: pointer;
}

main form input {
    width: 100%;
    font-size: 1.25rem;
}

.title-edit {
    display: flex;
    flex-direction: row;
    justify-content: start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.title-input {
    font-family: "Playwrite US Trad", Georgia, serif;
    font-size: 1.8em;
    color: #A8570C;
    background: white;
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 4rem);
    height: 4rem;
}

.edit-form .split-row > section:first-child {
    font-size: 1rem;
}

.edit-form .split-row > section:last-child {
    flex: 2 1 67%;
    max-width: none;
}

/* Time/servings inputs */
.edit-form .label-value input[type="number"] {
    width: 3rem;
    text-align: center;
    font-size: 1rem;
    padding: 0.2rem;
    border: 1px solid #CCC;
    border-radius: 4px;
}

.unit-label {
    font-size: 1rem;
    color: #2E261C;
}

/* Description textarea */
.edit-form .description textarea {
    font-size: .9rem;
    line-height: 1;
    border: 1px solid #CCC;
    border-radius: 4px;
    background: #FFF;
    padding: 0.5rem;
    resize: vertical;
    height: 10rem;
}

/* Ingredients section */
.edit-form .ingredients ul {
    list-style: none;
    padding-left: 0;
}

.edit-form .ingredients li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: baseline;
    margin-bottom: 0.5rem;
    padding-left: 0;
    text-indent: 0;
}

.edit-form .ingredients input[type="number"] {
    width: 3.5rem !important;
    font-size: 1rem;
    padding: 0.2rem;
    border: 1px solid #CCC;
    border-radius: 4px;
    text-align: right;
}

.edit-form .ingredients input[type="text"] {
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid #CCC;
    border-radius: 4px;
    width: auto !important;
}

/* First text input per ingredient (unit) */
.edit-form .ingredients li input[type="text"]:nth-of-type(1) {
    width: 5rem !important;
}

/* Last text input per ingredient (name) */
.edit-form .ingredients li input[type="text"]:last-of-type {
    flex: 1;
    min-width: 120px;
}

/* Steps section */
.edit-form .steps ol {
    padding-left: 1.5rem;
}

.edit-form .steps li {
    margin-bottom: .25rem;
}

.edit-form .steps textarea {
    width: 100%;
    font-size: .9rem;
    padding: 0.5rem;
    border: .5px solid #CCC;
    border-radius: 4px;
    background: #FFF;
    line-height: 1;
    resize: vertical;
}

.step-ings {
    margin-top: 0.15rem;
    margin-bottom: .5rem;
}

.step-ings li {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
}

.step-ings li::before {
    content: "o";
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
    width: 1.2rem;
    text-align: center;
}

.step-ings li::before {
    color: #2e261c6b;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.step-ings input[type="number"] {
    width: 3rem;
    font-size: 0.9rem;
    padding: 0.15rem;
    border: 1px solid #CCC;
    border-radius: 3px;
    text-align: right;
}

.step-ings input[type="text"] {
    font-size: 0.9rem;
    padding: 0.15rem 0.3rem;
    border: 1px solid #CCC;
    border-radius: 3px;
}

.step-ings input[type="text"]:nth-of-type(1) {
    width: 3rem;
}

.step-ings input[type="text"]:nth-of-type(2) {
    flex: 1;
    min-width: 75px;
}

.error-list {
  color: red;
  font-weight: bold;
  margin: 1em 0;
}
.error-list ul {
  list-style-type: disc;
  margin-left: 1.5em;
}

.show_pwd {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: .9rem;
}

@media (max-width: 600px) {
    .card {
        flex: 0 1 calc((100% - 1rem)/2)
    }
}

@media (max-width: 500px) {

    body {
        padding: 0;
        max-width: 100%;
    }

    main {
        border-left: none;
        border-right: none;
        border-radius: 0;
        margin: 0;
    }

    header {
        padding: 0.5;
    }

    .split-row {
        flex-direction: column;
        gap: 2rem;
    }

    .split-row > section {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 400px) {
    .card {
        flex: 0 1 100%;
    }
}
