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

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f4f0;
    color: #222;
    font-size: 16px;
    line-height: 1.6;
}

a {
    color: #b5460f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---- header ---- */

.site-header {
    background: #fff;
    border-bottom: 1px solid #e0ddd8;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 740px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: #222;
    margin-right: auto;
}

.brand:hover {
    color: #b5460f;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 18px;
}

.main-nav a {
    color: #444;
    font-size: 0.95rem;
}

.main-nav a:hover {
    color: #b5460f;
    text-decoration: none;
}

.account-links {
    display: flex;
    gap: 12px;
    font-size: 0.88rem;
}

.account-links a {
    color: #555;
}

/* ---- main content wrapper ---- */

.page-wrap {
    max-width: 740px;
    margin: 0 auto;
    padding: 30px 20px 56px;
}

h1 {
    font-size: 1.65rem;
    margin: 0 0 6px;
}

h2 {
    font-size: 1.2rem;
    margin: 0 0 10px;
}

.lead {
    color: #555;
    margin: 0 0 22px;
}

/* ---- card grid ---- */

.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
}

.card {
    background: #fff;
    border: 1px solid #e0ddd8;
    border-radius: 6px;
    padding: 16px;
    flex: 1 1 260px;
    max-width: 100%;
}

.card img {
    width: 100%;
    height: 155px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 12px;
    display: block;
}

.card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.card h3 a {
    color: #222;
}

.card h3 a:hover {
    color: #b5460f;
    text-decoration: none;
}

.card-desc {
    margin: 0 0 10px;
    color: #444;
    font-size: 0.9rem;
}

/* ---- tags ---- */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tag {
    background: #ede9e1;
    color: #555;
    font-size: 0.77rem;
    padding: 2px 8px;
    border-radius: 3px;
}

/* ---- search form ---- */

.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.search-form input[type=search] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.search-form button {
    padding: 8px 20px;
    background: #b5460f;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.search-form button:hover {
    background: #933a0c;
}

/* ---- recipe detail ---- */

.recipe-detail h1 {
    margin-bottom: 4px;
}

.recipe-byline {
    color: #555;
    margin: 0 0 12px;
    font-size: 0.95rem;
}

.recipe-photo {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: 5px;
    display: block;
    margin: 16px 0;
}

.recipe-description {
    margin: 14px 0 20px;
    color: #333;
}

.recipe-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    background: #ede9e1;
    padding: 12px 18px;
    border-radius: 5px;
    margin-bottom: 28px;
}

.recipe-meta div {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    min-width: 60px;
}

.recipe-meta strong {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 2px;
}

.recipe-body {
    display: flex;
    gap: 36px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.recipe-body section {
    flex: 1 1 200px;
}

.ingredient-list,
.step-list {
    padding-left: 20px;
    margin: 0;
}

.ingredient-list li,
.step-list li {
    margin-bottom: 7px;
    font-size: 0.95rem;
}

.recipe-comments {
    max-width: 560px;
    width: 100%;
    margin: 40px auto 0;
}

.recipe-comments-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #e8decc;
    border: 1px solid #d6c8b0;
    border-radius: 12px;
    padding: 24px;
}

.comment-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.comment-heading h2 {
    margin-bottom: 0;
    text-align: center;
}

.comment-form,
.comment-card {
    background: #fcfbf8;
    border: 1px solid #ddd6ca;
    border-radius: 8px;
}

.comment-form {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.comment-input-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.comment-form label {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: #3b342d;
    margin-bottom: 0;
    flex: 0 0 130px;
    min-height: 44px;
}

.comment-form textarea {
    width: 100%;
    flex: 1 1 auto;
    resize: vertical;
    min-height: 110px;
    padding: 12px 14px;
    border: 1px solid #cbc2b4;
    border-radius: 6px;
    background: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    color: #2f2923;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #b5460f;
    box-shadow: 0 0 0 3px rgba(181, 70, 15, 0.12);
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
}

.comment-login-note,
.comment-empty {
    color: #6c665d;
    font-size: 0.9rem;
    margin: 0;
}

.comment-login-note,
.comment-empty {
    background: #fcfbf8;
    border: 1px dashed #d4ccbe;
    border-radius: 8px;
    padding: 14px 16px;
}

.comment-form button {
    padding: 9px 18px;
    background: #b5460f;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
}

.comment-form button:hover:not(:disabled) {
    background: #933a0c;
}

.comment-form button:disabled {
    background: #d2b4a6;
    cursor: not-allowed;
}

.comment-display {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    background: #ccb898;
    border: 1px solid #b59d78;
    border-radius: 10px;
    padding: 20px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: #fbf7f0;
    border: 1px solid #d7c8ae;
}

.comment-time {
    display: flex;
    justify-content: center;
    margin: 0;
    font-size: 0.88rem;
    text-align: center;
    color: #6f685f;
}

.comment-line {
    margin: 0;
    color: #312b25;
    line-height: 1.7;
}

.comment-writer a {
    font-weight: bold;
    color: #5c2d10;
}

.comment-body {
    color: #312b25;
}

/* ---- profile ---- */

.profile-header {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    margin-bottom: 28px;
}

.profile-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-header h1 {
    margin-bottom: 2px;
}

.username {
    color: #777;
    font-size: 0.88rem;
    margin: 0 0 8px;
}

/* ---- login ---- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 290px;
    margin-top: 22px;
}

.login-form label {
    font-weight: bold;
    font-size: 0.88rem;
    margin-top: 6px;
}

.login-form input {
    padding: 8px 11px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.login-form button {
    margin-top: 10px;
    padding: 9px;
    background: #b5460f;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}

.login-form button:hover {
    background: #933a0c;
}

.error-msg {
    color: #8b2500;
    background: #fdeee9;
    border: 1px solid #f0c0ac;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ---- responsive ---- */

@media (max-width: 540px) {
    .header-inner {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .brand {
        flex-basis: 100%;
        margin-right: 0;
    }

    .card-grid {
        flex-direction: column;
    }

    .card {
        flex: none;
    }

    .recipe-body {
        flex-direction: column;
        gap: 20px;
    }

    .recipe-meta {
        gap: 14px;
    }

    .recipe-comments-inner {
        padding: 18px;
    }

    .comment-form,
    .comment-card {
        padding: 14px;
    }

    .comment-input-row {
        flex-direction: column;
        gap: 10px;
    }

    .comment-form label {
        flex-basis: auto;
        min-height: 0;
    }

    .comment-display {
        padding: 14px;
    }

    .profile-header {
        flex-direction: column;
        gap: 12px;
    }
}
