:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --panel-alt: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #d7dde5;
    --accent: #2457c5;
    --accent-soft: #e7efff;
    --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f7f8fb 0%, #eef2f7 100%);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

.page-shell {
    width: min(100% - 1.5rem, 700px);
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.page-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.site-header,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.site-header {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.account-links,
.site-nav,
.tag-list {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.account-links {
    color: var(--muted);
}

.account-name {
    font-weight: 700;
    color: var(--text);
}

.site-nav a {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: var(--panel-alt);
    border: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    border-color: var(--line);
    text-decoration: none;
}

.content-section,
.page-intro,
.auth-panel,
.recipe-hero,
.profile-hero {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel,
.page-intro {
    padding: 1.25rem;
}

.eyebrow,
.section-note,
.recipe-meta,
.profile-meta {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
}

h1,
h2,
h3,
p,
dl,
ol,
ul {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 0;
}

h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.recipe-card__media {
    display: block;
    flex: 0 0 168px;
    min-height: 120px;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(135deg, #edf2ff, #f8fafc);
}

.recipe-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recipe-card__title {
    margin-bottom: 0;
    font-size: 1.15rem;
}

.recipe-card__summary,
.recipe-description {
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0;
}

.tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.tag--muted {
    background: #edf1f5;
    color: var(--muted);
}

.search-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-form input,
.login-form input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    background: #fff;
    color: var(--text);
}

.search-form input {
    flex: 1 1 220px;
}

.search-form button,
.login-form button {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 0.8rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.login-form {
    display: grid;
    gap: 0.9rem;
}

.login-form label {
    display: grid;
    gap: 0.35rem;
    font-weight: 700;
}

.error-message,
.empty-state {
    margin-bottom: 0;
}

.error-message {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: #fff1f1;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.recipe-hero,
.profile-hero {
    padding: 1.25rem;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
}

.recipe-hero__body,
.profile-hero__body {
    flex: 1;
    min-width: 0;
}

.recipe-hero__media,
.profile-hero__media {
    flex: 0 0 220px;
    min-height: 220px;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #edf2ff, #f8fafc);
}

.recipe-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0;
}

.recipe-stats div {
    padding: 0.85rem;
    border-radius: 14px;
    background: var(--panel-alt);
    border: 1px solid var(--line);
}

.recipe-stats dt {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.recipe-stats dd {
    margin: 0;
    font-weight: 700;
}

.recipe-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ingredients-by-step,
.step-list,
.ingredient-list {
    display: grid;
    gap: 0.75rem;
}

.ingredient-group {
    padding: 0.85rem;
    border-radius: 14px;
    background: var(--panel-alt);
    border: 1px solid var(--line);
}

.ingredient-list,
.step-list {
    padding-left: 1.25rem;
    margin-bottom: 0;
}

.step-list li + li {
    margin-top: 0.9rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 1rem, 700px);
        padding-top: 0.75rem;
    }

    .site-header,
    .panel,
    .page-intro,
    .recipe-card,
    .recipe-hero,
    .profile-hero {
        padding: 1rem;
    }

    .recipe-card,
    .recipe-hero,
    .profile-hero,
    .recipe-detail-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .recipe-card__media,
    .recipe-hero__media,
    .profile-hero__media {
        width: 100%;
        flex-basis: auto;
        min-height: 180px;
    }

    .recipe-detail-grid {
        display: flex;
        flex-direction: column;
    }
}

/* ── Reviews ── */

.recipe-rating-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0 0.5rem;
}

.rating-text {
    color: var(--muted);
    font-size: 0.9rem;
}

.star {
    font-size: 1.1rem;
    line-height: 1;
}

.star--full {
    color: #f59e0b;
}

.star--half {
    color: #f59e0b;
    opacity: 0.55;
}

.star--empty {
    color: #d1d5db;
}

.reviews-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.star-picker {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.star-pick {
    font-size: 1.75rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}

.star-pick.active {
    color: #f59e0b;
}

#review-comment {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    font: inherit;
    background: #fff;
    color: var(--text);
    resize: vertical;
}

.review-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-primary {
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-danger {
    border: 0;
    border-radius: 12px;
    background: #ef4444;
    color: #fff;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.review-feedback {
    padding: 0.7rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    margin-top: 0.5rem;
}

.review-feedback--success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.review-feedback--error {
    background: #fff1f1;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.review-login-prompt {
    color: var(--muted);
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.review-item {
    padding: 0.85rem;
    border-radius: 14px;
    background: var(--panel-alt);
    border: 1px solid var(--line);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.review-date {
    color: var(--muted);
    font-size: 0.85rem;
}

.review-comment {
    margin: 0.5rem 0 0;
    line-height: 1.5;
}

.recipe-card__rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}