*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px 16px 40px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: #f5efe6;
    color: #2f241b;
}

/* centered page width */
header,
body > h1,
body > h2,
body > p,
body > img,
.recipes,
.recipes-list,
.cards-area,
.search-block,
.login-form,
.profile-intro,
.recipe-info,
.recipe-columns {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

a {
    color: #8b5e34;
}

a:hover {
    color: #6f4724;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* header */
header {
    background: #fcf8f3;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 8px;

    display: flex;
    flex-direction: column;
    gap: 12px;
}

.header-brand a {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: #3c2d20;
}

header nav {
    display: flex;
    gap: 16px;
}

header nav a {
    text-decoration: none;
    font-weight: 600;
}

.header-account {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* headings and text */
h1,
h2,
h3 {
    margin-top: 0;
    color: #3c2d20;
}

h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 12px;
}

h2 {
    font-size: 1.4rem;
}

h3 {
    font-size: 1.1rem;
}

p {
    margin-top: 0;
}

/* card containers */
.recipes,
.recipes-list,
.cards-area {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 16px;
}

/* recipe cards */
.recipe-card {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;

    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recipe-card h2,
.recipe-card h3,
.recipe-card p {
    margin: 0;
}

.recipe-card a {
    text-decoration: none;
}

.recipe-card ul {
    list-style: none;
    margin: 0;
    padding: 0;

    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.recipe-card li {
    flex: 0 0 auto;
}

.recipe-card li a {
    display: block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e7d9c8;
    color: #4a3828;
    font-size: 0.92rem;
    white-space: nowrap;
}

/* login/search forms */
.login-form,
.search-block form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-form {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;
}

.login-form p {
    margin: 0;
}

.search-block {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c9b49b;
    border-radius: 10px;
    font: inherit;
    background: #fffdf9;
    color: #2f241b;
}

button {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font: inherit;
    background: #8b5e34;
    color: white;
    cursor: pointer;
}

button:hover {
    background: #6f4724;
}

button:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* profile page */
.profile-intro {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;

    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
}

.profile-intro img {
    width: min(220px, 100%);
}

/* recipe detail page */
body > img {
    border: 1px solid #d5c3ae;
}

.recipe-info {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;

    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recipe-info p {
    margin: 0;
}

.recipe-columns {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 16px;
}

.recipe-columns > div {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;
}

.recipe-columns ul,
.recipe-columns ol {
    margin: 0;
    padding-left: 20px;
}

.recipe-columns li {
    margin-bottom: 8px;
}

.shopping-action {
    width: 100%;
    max-width: 700px;
    margin: 16px auto 0;
    padding: 18px 20px;
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
}

.shopping-action form {
    display: flex;
    justify-content: flex-start;
}

.shopping-feedback {
    margin: 12px 0 0;
    color: #5b4634;
}

.shopping-page {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.shopping-summary,
.shopping-section {
    background: #fffaf5;
    border: 1px solid #d5c3ae;
    border-radius: 14px;
    padding: 18px 20px;
}

.shopping-summary {
    margin-bottom: 16px;
}

.shopping-summary p:last-child {
    margin-bottom: 0;
}

.shopping-section {
    margin-top: 16px;
}

.shopping-section h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.count-badge {
    display: inline-block;
    min-width: 2rem;
    padding: 2px 10px;
    border-radius: 999px;
    background: #e7d9c8;
    color: #4a3828;
    font-size: 0.95rem;
    text-align: center;
}

.shopping-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shopping-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid #d5c3ae;
    border-radius: 12px;
    background: #fffdf9;
}

.shopping-item-copy {
    flex: 1;
}

.shopping-item-name,
.shopping-item-meta {
    margin: 0;
}

.shopping-item-name {
    font-weight: 600;
}

.shopping-item-meta {
    margin-top: 4px;
    color: #6c5847;
}

.shopping-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.shopping-item-checked {
    background: #f4f0ea;
}

.shopping-item-checked .shopping-item-name {
    text-decoration: line-through;
    color: #756353;
}

.shopping-button-secondary {
    background: #6c7a55;
}

.shopping-button-secondary:hover {
    background: #556143;
}

.shopping-button-danger {
    background: #a14b3b;
}

.shopping-button-danger:hover {
    background: #843c2e;
}

.shopping-empty,
.shopping-section-empty {
    color: #6c5847;
}

.shopping-empty {
    margin: 16px 0 0;
}

/* tag styling on recipe detail page */
body > p span {
    display: inline-block;
    margin: 4px 8px 4px 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e7d9c8;
    color: #4a3828;
    font-size: 0.92rem;
}

/* responsive layout */
@media (min-width: 640px) {
    header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    header nav {
        flex: 1;
        justify-content: center;
    }

    .header-account {
        justify-content: flex-end;
    }

    .search-block form {
        flex-direction: row;
        align-items: end;
    }

    .search-block input[type="search"] {
        flex: 1;
    }

    .profile-intro {
        flex-direction: row;
        align-items: center;
    }

    .recipe-columns {
        flex-direction: row;
        align-items: flex-start;
    }

    .recipe-columns > div {
        flex: 1;
    }

    .shopping-item {
        align-items: center;
    }
}
