@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playwrite+US+Trad:ital,wght@0,400;1,400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    padding: 0.5rem;
}

body {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #f7f1e8;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: #2e261c;
}

header,
.header,
.header-row,
.top-row,
.bottom-row,
.nav-links,
.search-form,
.header ul,
header nav {
    display: flex;
    gap: 0.25rem;
}

header {
    flex-direction: column;
    margin-bottom: 3rem;
    justify-content: space-between;
}

.header {
    flex-direction: column;
    padding: 0 0.5rem;
    gap: 0.1rem;
}

.header-row {
    justify-content: space-between;
    align-items: flex-end;
}

.top-row,
.bottom-row {
    align-items: baseline;
}

.bottom-row {
    margin-top: 0.25rem;
}

.top-row {
    margin-bottom: 0;
}

.nav-links {
    gap: 1rem;
}

.nav-links ul {
    display: flex;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-form,
nav form {
    display: flex;
    gap: 0.25rem;
}

nav form {
    justify-content: flex-end;
}

.search-form input,
.search-form button,
nav input,
nav button {
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    box-sizing: border-box;
    height: 100%;
}

.search-form input {
    flex: 1;
}

.search-form button {
    border: 1px solid #2e261c;
    background-color: #fff9f1;
    cursor: pointer;
}

.search-form button.search-button {
    font-weight: 300;
}

.search-form button.search-button:hover {
    background-color: #f0e7d5;
}

.search-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-main>h1,
.search-main>.search-tag-display {
    margin: 0;
}

.search-tag-display,
.search-tag-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    color: #2e261c;
}

.search-tag-display {
    display: block;
    text-align: left;
    background-color: #fff;
    border: 1px solid #2e261c;
    margin-bottom: 10px;
    width: 100%;
}

.search-tag-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid #2e261c;
    background-color: #fff;
    overflow: hidden;
    margin-bottom: 2rem;
}

.search-tag-label {
    padding: 0 0.5rem;
    color: #2e261c;
    font-weight: 500;
    white-space: nowrap;
    background-color: #fff;
}

.space {
    margin-bottom: 1rem;
}

.black {
    color: #2e261c !important;
}

.search-tag-input::placeholder {
    color: #aaa;
}

.search-main .recipe-grid,
.user-recipes,
.featured-recipes,
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    width: 100%;
}

.divider,
.line {
    border: none;
    height: 4px;
    background-color: #8B4513;
    margin: 0;
}

main {
    background-color: #fff9f1;
    border: 1px solid #2e261c;
    border-bottom: none;
    border-radius: 45px 45px 0 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100vh !important;
}

main.home-main,
.home-main,
.home-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.home-main>section:first-child {
    display: block;
}

.recipe-title {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.recipe-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.recipe-data {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.recipe-tags ul,
.featured-recipes .hash-list,
.recipe-card .hash-list,
.tag-list,
ul.hash-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.recipe-tags li,
ul.hash-list li,
.featured-recipes .hash-list li,
.recipe-card .hash-list li.hashtag,
.tag-list li,
.hashtags,
.tag {
    white-space: nowrap;
    color: #a8570c;
}

.do-recipe,
.picture-description {
    display: flex;
    gap: 1rem;
}

.do-recipe .ingredients,
.picture-column,
.ingredients-column {
    flex: 1;
}

.do-recipe .instructions,
.description-column,
.steps-column {
    flex: 2;
}

.do-recipe section {
    flex: 1;
}

.steps-list {
    list-style: list-item;
    padding: 0;
}

.step-ingredients li {
    margin-bottom: 0.25rem;
}

ol.ingredients-list {
    list-style-type: decimal;
    list-style-position: outside;
    padding-left: 3rem;
    margin: 0.5rem 0;
}

ol.ingredients-list li {
    padding-left: 0;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.instructions ol {
    margin-top: 0.5rem;
    padding-left: 1em;
}

.recipe-photo,
.recipe-picture,
.featured-recipes img,
.recipe-card img,
.card img {
    max-width: 100%;
    height: auto;
    display: block;
}

.recipe-picture {
    transform: rotate(2deg);
}

dl {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

dt,
.prep-list dt {
    display: flex;
    gap: 1rem;
}

.prep-label {
    font-weight: bold;
}

.prep-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
}

.picture-description {
    gap: 2rem;
}

.picture-column {
    max-width: 33.33%;
}

.description-column {
    flex: 2;
}

header h2,
h1,
h2,
h3,
.login-form h1,
.title-input {
    flex: 1;
    min-width: 0;
    font-family: 'Playwrite US Trad', cursive;
    font-size: 2rem;
    padding: 0.5rem;
    box-sizing: border-box;
    color: #8B4513;
}

.edit-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

header h2,
h1,
.login-form h1,
.title-input {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p,
dd,
.step-header textarea,
textarea,
.form-row input {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    line-height: 1.25;
    width: 100%;
    box-sizing: border-box;
}

.profile-name {
    color: #2e261c;
    margin-right: 0.5rem;
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-header {
    display: flex;
    width: 100%;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.profile-info {
    flex: 3;
}

.profile-picture {
    flex: 1;
    display: flex;
    justify-content: end;
    margin-right: 1rem;
}

.profile-picture img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
}

.profile-description {
    width: 100%;
}

.buttons-row,
.button-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100% !important;
}

.button-row a,
.secondary-button,
.secondary-button.login-button {
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
}

.button-row a,
.secondary-button.login-button {
    width: 100%;
    max-width: 300px;
    height: 2rem;
}

.button-row a,
.secondary-button {
    background-color: #8b5e34;
    color: #f7f1e8;
}

.secondary-button:hover {
    color: #fff9f1;
}

.nav-button:hover,
a:hover {
    text-decoration: underline;
}

a {
    text-decoration: none;
    color: #8b5e34;
}

.search-button {
    color: #2e261c;
    background-color: #fff9f1;
    font-weight: 300;
}

.featured-recipes,
.recipe-grid,
.card-grid {
    padding: 0 1rem;
    list-style: none;
    margin: 0;
}

.featured-recipes li,
.recipe-card,
.card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 10px;
    padding: 0.5rem;
}

.card {
    background-color: #fff;
    border: 1px solid #ddd;
}

.recipe-card {
    border: 1px solid #2e261c;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.125);
    width: 100%;
    box-sizing: border-box;
}

ul.hash-list li {
    white-space: normal !important;
    word-break: break-word;
    display: inline-block;
    line-height: 1;
    background: transparent;
    border: none;
    box-shadow: none;
}

.tag-list li::before,
.show-tag::before {
    content: "#";
    margin-right: 0.25rem;
    color: #8b5e34;
}

.step-block,
.edit-page,
.photo-description,
.columns {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.edit-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #a67b5b;
    background-color: #f8f4ef;
    border-radius: 5px;
    cursor: pointer;
}

.step-ingredients .ingredient-row::before {
    content: "•";
    position: absolute;
    left: -1rem;
    color: #2e261c;
    font-size: 1rem;
    line-height: 1.5;
}

.visually-hidden {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-errors {
    color: red;
    margin: 1.5rem 1.5rem;
    font-weight: bold;
}

.form-errors li {
    color: red;
}

.full-width {
    width: 100%;
    box-sizing: border-box;
}

.photo-box {
    width: 100%;
    margin-bottom: 1rem;
}

.recipe-picture {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0.5rem;
}

.photo-description {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.photo-box {
    flex: 1;
    min-width: 200px;
}

.description-box {
    flex: 2;
    min-width: 300px;
}

header.header h2 {
    color: #8B4513 !important;
    -webkit-text-fill-color: #8B4513 !important;
}

input.title-input,
.title-input {
    color: #8B4513 !important;
    -webkit-text-fill-color: #8B4513 !important;
}

.title-input::placeholder {
    color: #8B4513 !important;
    opacity: 0.6;
}

.edit-page img {
    max-width: 250px;
    height: auto;
    display: block;
    margin: 1rem auto;
    object-fit: cover;
    z-index: 1;
    position: relative;
}

main.edit-page {
    margin-top: 2rem;
}

.edit-page .recipe-image,
.edit-page img {
    width: 90%;
    max-width: 600px;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

main.edit-page {
    margin-top: 2.5rem;
}

.edit-header .title-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 2rem;
    line-height: 1.2;
    padding: 0.5rem 1rem;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.byline-top {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.recipe-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "photo description"
        "timing steps"
        "ingredients steps";
    gap: 1.25rem;
    align-items: start;
    width: 100%;
}

.grid-photo {
    grid-area: photo;
}

.grid-description {
    grid-area: description;
}

.grid-timing {
    grid-area: timing;
}

.grid-ingredients {
    grid-area: ingredients;
}

.grid-steps {
    grid-area: steps;
    width: 100%;
    min-height: 140px;
    box-sizing: border-box;
    resize: vertical;
}

.grid-photo .recipe-picture,
.photo-box img,
.recipe-picture {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.grid-timing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    background: #fff9f1;
    padding: 0.75rem;
}

.grid-ingredients,
.grid-steps,
.grid-description {
    background: #fff9f1;
    padding: 1rem;
    width: 100%;
    min-width: 300px;
    box-sizing: border-box;
    resize: horizontal;
}

.grid-description textarea {
    width: 100%;
    min-height: 140px;
    box-sizing: border-box;
    resize: vertical;
}

.steps-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.checkbox {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0px !important;
    column-gap: 0px !important;
}

.checkbox input[type="checkbox"] {
    margin: 0;
    padding: 0;
}

.checkbox label {
    margin-left: 4px;
    white-space: nowrap;
}

.results-anchor {
    height: 1px;
    visibility: hidden;
}

.results-anchor {
    height: 1px;
    visibility: hidden;
}

.search-results-wrapper {
    margin-top: 20px;
    min-height: 150px;
    display: block;
}

@media (max-width: 900px) {
    .recipe-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "photo"
            "description"
            "timing"
            "ingredients"
            "steps";
    }

    .grid-steps {
        max-height: none;
    }
}

@media (min-width: 1600px) {
    .recipe-grid {
        gap: 1.75rem;
        grid-template-columns: minmax(320px, 1fr) minmax(640px, 2fr);
    }
}

@media (max-width: 700px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row+.form-row {
        gap: 1rem;
    }

    .form-row input {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .picture-description,
    .do-recipe {
        flex-direction: column;
        gap: 2rem;
    }

    main {
        padding-left: 0;
        padding-right: 0;
        border-left: none;
        border-right: none;
    }

    header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .divider,
    .line {
        width: 100%;
    }
}

@media (max-width: 500px) {

    .picture-description,
    .do-recipe {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 400px) {
    .recipe-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .edit-header .title-input {
        font-size: 1.5rem;
    }
}