:root {
    --bg: #f7f1e3;
    --surface: #ffffff;
    --surface-alt: #fbf7ef;
    --border: rgb(184 134 11 / 35%);
    --text: #222222;
    --muted: #5f5f5f;
    --accent: maroon;
    --accent-hover: #7a0f0f;
    --radius: 14px;
    --shadow: 0 1px 2px rgb(0 0 0 / 6%);
}

html {
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 16px 12px 24px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
}

a:hover,
a:focus {
    color: var(--accent-hover);
}

a.brand {
    font-size: 1.9rem;
    font-weight: 700;
    text-decoration: none;
    color: #111;
    letter-spacing: -0.02em;
}

header,
main {
    width: min(700px, 100%);
    margin-left: auto;
    margin-right: auto;
}

header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.top nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 2px;
}

.top nav a,
.nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-alt);
    text-decoration: none;
}

main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.intro,
.search-block,
.login-form,
.profile-intro,
.recipe-info,
.recipe-columns,
.recipe-box,
.comments-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.intro {
    width: 100%;
    padding: 16px;
    overflow-wrap: break-word;
}

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.2;
    color: #111;
}

h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
}

h2 {
    font-size: 1.2rem;
}

h3 {
    font-size: 1.05rem;
}

p {
    margin: 0 0 1rem;
}

.recipes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.recipe-box {
    display: flex;
    flex-direction: column;
    width: calc(50% - 10px);
    padding: 12px;
    gap: 10px;
    overflow-wrap: break-word;
}

.recipe-box h3,
.recipe-box p {
    margin: 0;
}

.recipe-box img {
    width: 100%;
    border-radius: 10px;
}

.recipe-box p:last-child {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.recipe-box span,
main > p span {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgb(128 0 0 / 8%);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.search-block,
.login-form,
.profile-intro,
.recipe-info,
.recipe-columns,
.comments-block {
    padding: 16px;
}

.search-block form,
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-weight: 700;
    color: #333;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid #cbb58a;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(128 0 0 / 12%);
}

button {
    align-self: flex-start;
    padding: 0.7rem 1rem;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover,
button:focus {
    background: var(--accent-hover);
}

.profile-intro {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.profile-intro > div:first-child {
    flex: 0 0 120px;
}

.profile-intro img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
}

.recipe-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 16px;
}

.recipe-info p {
    margin: 0;
}

.recipe-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.recipe-columns ul,
.recipe-columns ol {
    margin: 0;
    padding-left: 1.25rem;
}

.recipe-columns li + li {
    margin-top: 0.45rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.comment-body {
    margin-bottom: 0;
    white-space: pre-wrap;
}

.comments-empty {
    margin-bottom: 0;
    color: var(--muted);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.comment-count,
.comment-feedback {
    margin: 0;
}

.comment-count {
    color: var(--muted);
    font-size: 0.95rem;
}

.comment-feedback {
    min-height: 1.5rem;
    color: #2c6b2f;
}

.comment-feedback.is-error {
    color: #a12020;
}

@media (max-width: 600px) {
    body {
        padding-left: 8px;
        padding-right: 8px;
    }

    header {
        padding: 12px;
    }

    .top {
        flex-direction: column;
        align-items: flex-start;
    }

    .top nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .recipes-list {
        flex-direction: column;
    }

    .recipe-box {
        width: 100%;
    }

    .profile-intro,
    .recipe-columns {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .profile-intro > div:first-child {
        flex-basis: auto;
    }

    button {
        width: 100%;
    }
}
