:root {
  --paper: #f4f0e8;
  --paper-deep: #e9e2d6;
  --ink: #272820;
  --muted: #707064;
  --olive: #657052;
  --olive-dark: #4e5840;
  --tomato: #b84d35;
  --line: rgba(39, 40, 32, .16);
  --white: #fffdf8;
  --shadow: 0 18px 60px rgba(50, 46, 35, .09);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
.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; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; }
button, input[type="checkbox"] { accent-color: var(--olive); }
.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.narrow { max-width: 860px; }

.site-header { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1180px) / 2)); background: rgba(244, 240, 232, .92); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.brand-cluster { display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50% 50% 44% 44%; color: var(--paper); background: var(--tomato); font-style: italic; font-size: 17px; }
.header-count { color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 28px; font-size: 13px; font-weight: 650; }
.main-nav > a:not(.button), .nav-button { color: var(--muted); }
.main-nav a[aria-current="page"] { color: var(--ink); }
.nav-button { border: 0; background: none; cursor: pointer; padding: 8px 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border: 1px solid var(--olive); border-radius: 4px; background: var(--olive); color: white; font-weight: 700; cursor: pointer; transition: .18s ease; }
.button:hover { transform: translateY(-1px); background: var(--olive-dark); }
.button-small { min-height: 38px; padding: 0 17px; }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button-secondary:hover { background: var(--white); }
.text-link, .card-link { display: inline-flex; align-items: center; gap: 8px; color: var(--olive-dark); font-size: 13px; font-weight: 750; }
.text-link span, .card-link span { transition: transform .18s ease; }
.text-link:hover span, .card-link:hover span { transform: translateX(3px); }
.eyebrow { margin: 0 0 10px; color: var(--tomato); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

.messages { position: fixed; right: 24px; top: 96px; z-index: 40; display: grid; gap: 8px; }
.message { max-width: 420px; padding: 13px 16px; background: var(--ink); color: white; border-radius: 5px; box-shadow: var(--shadow); font-size: 14px; }
.message-warning { background: #8b6229; }

.hero { min-height: 390px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 80px; align-items: end; padding-block: 78px 68px; border-bottom: 1px solid var(--line); }
.hero h1, .recipe-header h1, .form-header h1, .auth-card h1 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.055em; line-height: .96; }
.hero h1 { font-size: clamp(58px, 8vw, 104px); }
.hero h1 em { color: var(--tomato); font-weight: 400; }
.hero-intro { max-width: 570px; margin: 28px 0 0; color: var(--muted); font-family: var(--serif); font-size: 19px; line-height: 1.55; }
.import-card { align-self: end; display: grid; grid-template-columns: auto 1fr auto; gap: 17px; align-items: center; padding: 22px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,253,248,.58); box-shadow: 0 10px 30px rgba(50,46,35,.04); }
.import-card:hover { border-color: var(--olive); background: var(--white); }
.import-card .spark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; background: #e0e4d5; color: var(--olive-dark); }
.import-card strong, .import-card small { display: block; }
.import-card strong { font-family: var(--serif); font-size: 16px; }
.import-card small { margin-top: 3px; color: var(--muted); line-height: 1.35; }
.import-card .arrow { color: var(--tomato); font-size: 22px; }

.collection { padding-block: 30px 100px; }
.ingredients-panel h2, .method-panel h2 { margin: 0; font-family: var(--serif); font-size: 35px; font-weight: 400; letter-spacing: -.035em; }
.filters { display: grid; grid-template-columns: minmax(250px, 360px) 1fr minmax(170px, 195px); gap: 18px; align-items: center; margin-bottom: 38px; }
.search-field { height: 48px; display: flex; align-items: center; gap: 11px; margin: 0; padding: 0 15px; border: 1px solid rgba(39,40,32,.18); border-radius: 7px; background: var(--white); box-shadow: 0 3px 12px rgba(50,46,35,.035); color: var(--muted); cursor: text; font-weight: 400; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.search-field:hover { border-color: rgba(101,112,82,.5); }
.search-field:focus-within { border-color: var(--olive); background: #fffefa; box-shadow: 0 0 0 3px rgba(101,112,82,.12), 0 5px 18px rgba(50,46,35,.055); }
.search-icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.search-field input[type="search"] { width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1; appearance: none; }
.search-field input[type="search"]::placeholder { color: #858579; opacity: 1; font-weight: 450; }
.search-field input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill { padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tag-pill:hover, .tag-pill.active { border-color: var(--olive); background: var(--olive); color: white; }
.sort-field { position: relative; height: 48px; margin: 0; }
.sort-field > span { position: absolute; top: 5px; left: 12px; z-index: 1; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .09em; line-height: 1; pointer-events: none; text-transform: uppercase; }
.sort-field select { width: 100%; height: 48px; min-height: 48px; padding: 14px 32px 1px 11px; border: 1px solid rgba(39,40,32,.18); border-radius: 7px; background-color: var(--white); color: var(--ink); font-size: 12px; font-weight: 700; outline: 0; cursor: pointer; }
.sort-field select:hover { border-color: rgba(101,112,82,.5); }
.sort-field select:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(101,112,82,.12); }
.recipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.recipe-card { background: var(--white); box-shadow: 0 8px 26px rgba(50,46,35,.05); transition: transform .2s ease, box-shadow .2s ease; }
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-image { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--paper-deep); }
.card-image img, .recipe-hero-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.recipe-card:hover .card-image img { transform: scale(1.025); }
.time-badge { position: absolute; right: 12px; bottom: 12px; padding: 6px 10px; background: rgba(255,253,248,.9); backdrop-filter: blur(8px); border-radius: 2px; font-size: 11px; font-weight: 800; }
.image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, #d7d3bf, #b9b89f); }
.image-placeholder span { font-family: var(--serif); font-size: 72px; color: rgba(255,255,255,.68); font-style: italic; }
.card-body { padding: 22px 22px 24px; }
.card-tags { min-height: 22px; display: flex; flex-wrap: wrap; gap: 7px; }
.card-tags span { color: var(--tomato); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.card-body h3 { margin: 10px 0 8px; font-family: var(--serif); font-size: 25px; line-height: 1.1; }
.card-body p { min-height: 44px; margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.empty-state { display: grid; justify-items: center; padding: 75px 24px; border: 1px dashed var(--line); text-align: center; }
.empty-state h3 { margin: 8px 0; font: 28px var(--serif); }
.empty-state p { max-width: 460px; margin: 0 0 24px; color: var(--muted); }
.empty-glyph { color: var(--tomato); font-size: 36px; }

.recipe-page { padding-block: 34px 100px; }
.back-link { display: inline-block; margin-bottom: 28px; color: var(--muted); font-size: 13px; font-weight: 700; }
.recipe-header { min-height: 525px; display: grid; grid-template-columns: .9fr 1.1fr; background: var(--white); }
.recipe-header-copy { padding: clamp(38px, 6vw, 76px); align-self: center; }
.recipe-header h1 { margin: 14px 0 21px; font-size: clamp(48px, 6vw, 78px); }
.recipe-header-copy > p { max-width: 510px; color: var(--muted); font-family: var(--serif); font-size: 18px; }
.recipe-meta { display: flex; gap: 32px; margin: 32px 0 27px; padding-block: 20px; border-block: 1px solid var(--line); }
.recipe-meta small, .recipe-meta strong { display: block; }
.recipe-meta small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.recipe-meta strong { font-family: var(--serif); font-size: 17px; }
.recipe-hero-image { min-height: 420px; }
.recipe-content { display: grid; grid-template-columns: .9fr 1.1fr; gap: 76px; padding: 80px 52px; }
.ingredients-panel { align-self: start; padding: 32px; background: var(--paper-deep); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.servings-control { display: grid; grid-template-columns: auto 36px 52px 36px; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.servings-control button, .servings-control input { height: 36px; border: 1px solid var(--line); background: var(--white); text-align: center; }
.servings-control button { padding: 0; cursor: pointer; font-size: 18px; font-weight: 800; }
.servings-control input[type="number"] { width: 52px; min-height: 36px; padding: 0 4px; appearance: textfield; color: var(--ink); font-size: 15px; font-weight: 800; line-height: 36px; }
.servings-control input[type="number"]::-webkit-inner-spin-button,
.servings-control input[type="number"]::-webkit-outer-spin-button { margin: 0; appearance: none; }
.ingredient-list { margin: 0; padding: 12px 0 0; list-style: none; }
.ingredient-list li { display: grid; grid-template-columns: 48px 46px 1fr; gap: 6px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ingredient-amount { font: 17px var(--serif); }
.ingredient-unit { color: var(--muted); font-size: 12px; padding-top: 3px; }
.ingredient-name strong, .ingredient-name small { display: block; }
.ingredient-name small { margin-top: 2px; color: var(--muted); }
.method-panel { padding-top: 6px; }
.step-list { margin: 27px 0 0; padding: 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 45px 1fr; gap: 18px; padding: 24px 0; border-top: 1px solid var(--line); }
.step-list li > span { color: var(--tomato); font: italic 19px var(--serif); }
.step-list p { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.65; }
.recipe-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.recipe-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.form-shell { padding-block: 35px 120px; }
.form-header { max-width: 700px; margin-bottom: 38px; }
.form-header h1 { font-size: clamp(48px, 6vw, 76px); }
.form-header > p:last-child { max-width: 620px; color: var(--muted); font-family: var(--serif); font-size: 18px; }
.recipe-editor { display: grid; gap: 20px; }
.editor-card { padding: 34px; border: 1px solid var(--line); background: var(--white); box-shadow: 0 7px 25px rgba(50,46,35,.035); }
.editor-section-title { display: flex; gap: 17px; margin-bottom: 29px; }
.editor-section-title > span { color: var(--tomato); font: italic 18px var(--serif); }
.editor-section-title h2 { margin: 0; font: 29px var(--serif); }
.editor-section-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 21px; }
.field-span-2 { grid-column: 1 / -1; }
label { display: block; margin-bottom: 7px; color: #4a4b42; font-size: 12px; font-weight: 750; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 3px; background: #fdfbf6; color: var(--ink); outline: none; }
input[type="text"], input[type="password"], input[type="number"], select { min-height: 44px; padding: 8px 11px; }
textarea { padding: 11px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(101,112,82,.1); }
.field-grid small, .upload-zone small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.errorlist, .field-error { margin: 5px 0 0; padding: 0; color: #9f3427; font-size: 12px; list-style: none; }
.formset-list { display: grid; gap: 10px; }
.formset-row { position: relative; padding: 17px; border: 1px solid var(--line); background: #fbf8f2; }
.ingredient-row { display: grid; grid-template-columns: 90px 90px 1.2fr 1fr 60px 30px; gap: 10px; align-items: end; }
.ingredient-row label { font-size: 10px; }
.check-field { align-self: center; display: flex; align-items: center; gap: 5px; margin: 18px 0 0; }
.delete-field > input { display: none; }
.remove-row { width: 29px; height: 29px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 21px; cursor: pointer; }
.remove-row:hover { background: #f0ded8; color: var(--tomato); }
.add-row { margin-top: 14px; padding: 8px 0; border: 0; background: transparent; color: var(--olive-dark); font-weight: 800; cursor: pointer; }
.step-row { display: grid; grid-template-columns: 42px 1fr 30px; gap: 13px; align-items: center; }
.drag-number { color: var(--tomato); font: italic 17px var(--serif); }
.upload-zone { position: relative; min-height: 150px; display: grid; justify-items: center; align-content: center; padding: 24px; border: 1px dashed var(--olive); border-radius: 4px; background: #f7f6ec; cursor: pointer; text-align: center; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.upload-zone:hover, .upload-zone:focus-within, .upload-zone.is-dragging { border-color: var(--olive-dark); background: #eef0e3; box-shadow: inset 0 0 0 2px rgba(101,112,82,.12); }
.upload-zone.is-dragging { border-style: solid; }
.upload-zone input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.upload-icon { font-size: 29px; color: var(--olive); }
.existing-images { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.existing-images label { position: relative; margin: 0; }
.existing-images img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.existing-images span { display: block; margin-top: 5px; }
.sticky-actions { position: sticky; bottom: 14px; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 17px; border: 1px solid var(--line); background: rgba(255,253,248,.94); backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.sticky-actions > span { color: var(--muted); font-size: 12px; }
.sticky-actions > div { display: flex; gap: 9px; }
.notice { margin-bottom: 20px; padding: 15px 17px; border-left: 3px solid #a96d2f; background: #f3e6d2; font-size: 13px; }
.notice.success { border-color: var(--olive); background: #e5eadc; }
.notice code { font-size: 12px; }
.import-form label { margin-bottom: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 19px; }
.auth-shell { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 60px 24px; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 48px; }
.auth-card > p { color: var(--muted); }
.auth-card label { margin-top: 17px; }
.auth-card .button { width: 100%; margin-top: 22px; }
.login-page { min-height: 100vh; background: radial-gradient(circle at 50% 10%, #fffdf8 0, var(--paper) 48%, var(--paper-deep) 100%); }
.login-page .auth-shell { min-height: 100vh; }
.login-page .auth-card { padding: 46px; border-radius: 8px; box-shadow: 0 22px 70px rgba(50, 46, 35, .13); }
.login-brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 45px; font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.login-page .auth-card h1 { margin-bottom: 14px; }
.login-page .auth-card > p { margin: 0 0 25px; }
.login-page .auth-card .field-error { color: #9f3427; }
.login-page input[type="password"] { min-height: 52px; padding-inline: 15px; font-size: 16px; }

.site-footer { min-height: 90px; display: flex; justify-content: space-between; align-items: center; padding: 0 max(24px, calc((100vw - 1180px) / 2)); border-top: 1px solid var(--line); color: var(--muted); font: italic 14px var(--serif); }

@media (max-width: 900px) {
  .hero, .recipe-header, .recipe-content { grid-template-columns: 1fr; }
  .hero { gap: 38px; }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .recipe-header-copy { order: 2; }
  .recipe-hero-image { order: 1; }
  .recipe-content { padding-inline: 0; gap: 45px; }
  .ingredient-row { grid-template-columns: 80px 80px 1fr 30px; }
  .ingredient-note { grid-column: 1 / 4; }
  .check-field { grid-column: 3; grid-row: 2; justify-self: end; }
  .filters { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 28px, 1180px); }
  .site-header { height: 68px; padding-inline: 15px; }
  .main-nav { gap: 14px; }
  .main-nav > a:not(.button):first-child { display: none; }
  .nav-button { display: none; }
  .hero { min-height: 0; padding-block: 50px; }
  .hero h1 { font-size: 56px; }
  .collection { padding-top: 24px; }
  .sticky-actions { align-items: flex-start; flex-direction: column; }
  .recipe-grid { grid-template-columns: 1fr; }
  .recipe-header h1 { font-size: 49px; }
  .recipe-header-copy { padding: 32px 24px; }
  .recipe-meta { gap: 18px; }
  .recipe-content { padding-block: 45px; }
  .ingredients-panel { padding: 23px; }
  .panel-heading { flex-direction: column; }
  .editor-card { padding: 23px 16px; }
  .login-page .auth-card { padding: 34px 24px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .ingredient-row { grid-template-columns: 1fr 1fr 30px; }
  .ingredient-main, .ingredient-note { grid-column: 1 / 3; }
  .check-field { grid-column: 1 / 3; grid-row: auto; justify-self: start; margin: 0; }
  .existing-images { grid-template-columns: repeat(2, 1fr); }
  .sticky-actions > div { width: 100%; }
  .sticky-actions .button { flex: 1; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }
}
