@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/dm-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/fonts/dm-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Caslon Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/libre-caslon-text-400.woff2") format("woff2");
}
@font-face {
  font-family: "Libre Caslon Text";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/fonts/libre-caslon-text-700.woff2") format("woff2");
}

:root {
  --canvas: #fbfaf6;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #667169;
  --line: #d9ddd8;
  --green: #2f513e;
  --green-dark: #213c2d;
  --terracotta: #a9573f;
  --error: #9f352c;
  --shadow: 0 18px 50px rgba(29, 45, 35, .08);
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 80% 0, #fff 0, transparent 38%), var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--green); }
h1, h2, .brand { font-family: "Libre Caslon Text", Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(2.7rem, 6vw, 4.4rem); line-height: .98; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 1.65rem; line-height: 1.12; }
p { line-height: 1.6; }
.site-header { border-bottom: 1px solid rgba(23, 32, 27, .1); background: rgba(251,250,246,.93); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.header-inner { width: min(1210px, calc(100% - 48px)); height: 76px; margin: auto; display: flex; align-items: center; gap: 34px; }
.brand { color: var(--ink); font-size: 2rem; text-decoration: none; letter-spacing: -.04em; }
.nav-link { align-self: stretch; display: flex; align-items: center; color: var(--green); text-decoration: none; border-bottom: 3px solid var(--green); }
.site-nav { display: flex; align-self: stretch; gap: 18px; }
.nav-link { white-space: nowrap; font-size: .9rem; }
.header-spacer { flex: 1; }
.user-name { color: var(--ink); }
.text-button, .icon-button { border: 0; background: none; color: var(--green); padding: 9px 10px; }
.text-button:hover, .back-link:hover, .auth-switch a:hover { text-decoration: underline; }
.page { width: min(1210px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: start; gap: 30px; margin-bottom: 32px; }
.count { color: var(--muted); margin: 13px 0 0; }
.button { appearance: none; border: 1px solid transparent; border-radius: 6px; min-height: 48px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; font-weight: 600; text-decoration: none; transition: background .16s, border .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--green); background: transparent; border-color: #aeb8b1; }
.button.secondary:hover { background: #f0f3ef; border-color: var(--green); }
.button.danger-button { color: white; background: var(--error); }
.wide { width: 100%; }
.filters { display: grid; grid-template-columns: minmax(280px, 2.2fr) repeat(3, minmax(160px, 1fr)); gap: 14px; margin-bottom: 34px; }
.search, .filter-select { position: relative; }
.search input, .filter-select select { width: 100%; height: 52px; border: 1px solid #c8cec9; border-radius: 5px; background: rgba(255,255,255,.76); color: var(--ink); outline: none; }
.search input { padding: 0 18px 0 50px; }
.search-icon { position: absolute; left: 18px; top: 11px; font: 1.65rem/1 Georgia, serif; transform: rotate(-20deg); }
.filter-select select { padding: 0 42px 0 15px; }
.search input:focus, select:focus, input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,81,62,.14); }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 28px; transition: opacity .2s; }
.recipe-grid[aria-busy="true"] { opacity: .55; }
.recipe-card { color: var(--ink); text-decoration: none; min-width: 0; }
.card-photo { position: relative; aspect-ratio: 1.82; overflow: hidden; background: #e7ebe5; margin-bottom: 13px; }
.card-photo img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.recipe-card:hover .card-photo img { transform: scale(1.025); }
.photo-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, #e6e4d7, #c8d4c8); }
.photo-placeholder span { font: 3rem Georgia, serif; color: rgba(47,81,62,.62); }
.recipe-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
.recipe-card:hover h2 { color: var(--green); }
.card-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.card-owner, .recipe-owner, .muted { color: var(--muted); }
.card-owner { margin: -3px 0 8px; font-size: .9rem; }
.dot { color: #9aa19c; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 44px; color: var(--muted); }
.empty-state { padding: 100px 24px; text-align: center; border-top: 1px solid var(--line); }
.empty-state h2 { font-size: 2.2rem; margin-bottom: 12px; }
.empty-state p { max-width: 540px; margin: 0 auto 24px; color: var(--muted); }
.empty-mark { width: 84px; height: 84px; margin: 0 auto 28px; border: 1px solid #b6c0b9; border-radius: 50%; display: grid; place-items: center; font: 2.6rem Georgia, serif; color: var(--green); }
.loading-state, .boot { min-height: 45vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.boot { min-height: 100vh; }
.spinner { width: 22px; height: 22px; border: 2px solid #cbd1cc; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-banner { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 18px; margin: 0 0 24px; border: 1px solid #d9aaa4; background: #fff5f3; color: #71261f; border-radius: 6px; }
.error-banner p { margin: 3px 0 0; }
.notice { position: fixed; z-index: 40; top: 88px; left: 50%; transform: translateX(-50%); background: var(--green-dark); color: white; border-radius: 5px; padding: 10px 12px 10px 18px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.notice .icon-button { color: white; font-size: 1.35rem; }
.auth-page { min-height: calc(100vh - 77px); display: grid; place-items: center; padding: 50px 20px; background: radial-gradient(circle at 25% 20%, #eef1e8 0, transparent 35%); }
.auth-panel { width: min(460px, 100%); background: rgba(255,255,255,.86); border: 1px solid var(--line); padding: 46px; box-shadow: var(--shadow); }
.auth-panel h1 { font-size: 3.1rem; margin-bottom: 16px; }
.auth-intro { text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; color: var(--terracotta); font-weight: 700; }
.auth-copy { color: var(--muted); margin: 0 0 28px; }
.auth-switch { text-align: center; margin: 22px 0 0; color: var(--muted); }
.auth-switch a { font-weight: 700; }
.field { display: grid; gap: 8px; margin-bottom: 20px; font-weight: 600; }
.field small, .field > span small, .field-label small { font-weight: 400; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid #c6cdc7; border-radius: 5px; color: var(--ink); background: white; outline: none; font-weight: 400; resize: vertical; }
.field-error { color: var(--error); font-size: .82rem; margin: -2px 0 0; }
.back-link { display: inline-block; color: var(--green); text-decoration: none; margin-bottom: 34px; }
.detail-actions { display: flex; justify-content: space-between; align-items: center; }
.detail-actions > div { display: flex; gap: 10px; }
.danger { color: var(--error); }
.recipe-detail { width: min(100%, 1040px); margin: 0 auto; }
.detail-photo { width: 100%; max-height: 560px; object-fit: cover; display: block; margin-bottom: 42px; }
.detail-title { max-width: 810px; margin: 0 auto 54px; text-align: center; }
.detail-title h1 { font-size: clamp(3rem, 7vw, 5.4rem); }
.lede { color: var(--muted); font: 1.25rem/1.65 Georgia, serif; margin: 22px auto; max-width: 680px; }
.detail-meta { display: flex; justify-content: center; gap: 28px; margin-top: 24px; color: var(--muted); }
.detail-meta strong { color: var(--ink); }
.tags { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.tag { background: #eef1ec; color: var(--green); padding: 6px 10px; border-radius: 999px; font-size: .78rem; text-transform: capitalize; }
.recipe-columns { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(0, 1.45fr); gap: 90px; border-top: 1px solid var(--line); padding-top: 45px; }
.recipe-columns h2 { font-size: 2rem; margin-bottom: 24px; }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 11px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.instructions { margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.instructions li { display: grid; grid-template-columns: 38px 1fr; gap: 16px; counter-increment: steps; margin-bottom: 25px; }
.instructions li::before { content: counter(steps); width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #adb8b0; border-radius: 50%; color: var(--green); }
.instructions p { margin: 4px 0 0; white-space: pre-line; }
.source { margin-top: 42px; overflow-wrap: anywhere; color: var(--muted); }
.comments-section { width: min(100%, 760px); margin: 68px auto 0; border-top: 1px solid var(--line); padding-top: 36px; }
.comments-section h2 { margin-bottom: 24px; }
.comment-list { display: grid; gap: 18px; }
.comment-item { border-bottom: 1px solid var(--line); padding: 0 0 18px; }
.comment-heading { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .9rem; }
.comment-heading strong { color: var(--ink); }
.comment-heading time { font-size: .8rem; }
.comment-text { margin: 8px 0; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 8px; align-items: center; }
.comment-edit textarea, .comment-form textarea { width: 100%; min-height: 110px; padding: 12px; resize: vertical; border: 1px solid #c6cdc7; border-radius: 5px; }
.comment-form { margin-top: 28px; }
.comment-form .field { margin-bottom: 12px; }
.form-page { width: min(900px, calc(100% - 48px)); }
.form-heading { margin-bottom: 38px; }
.form-heading p { color: var(--muted); }
.recipe-form { display: grid; gap: 24px; }
.form-section { background: rgba(255,255,255,.72); border: 1px solid var(--line); padding: 32px; }
.form-section h2 { font-size: 1.8rem; margin-bottom: 26px; }
.three-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.photo-field { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-field p { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.field-label { font-weight: 600; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name { color: var(--muted); font-size: .9rem; }
.photo-thumb { width: 84px; height: 60px; object-fit: cover; }
.form-footer { display: flex; justify-content: flex-end; position: sticky; bottom: 0; padding: 18px 0; background: linear-gradient(transparent, var(--canvas) 28%); }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(14,20,16,.55); display: grid; place-items: center; padding: 20px; }
.modal { width: min(440px, 100%); padding: 34px; background: var(--surface); box-shadow: var(--shadow); }
.modal h2 { font-size: 2rem; }
.modal p { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .search { grid-column: 1 / -1; }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .recipe-columns { gap: 45px; }
}
@media (max-width: 620px) {
  .header-inner, .page, .form-page { width: min(100% - 28px, 1210px); }
  .header-inner { height: auto; min-height: 66px; display: grid; grid-template-columns: auto 1fr auto auto; gap: 7px; padding: 8px 0; }
  .brand { grid-column: 1; }
  .site-nav { grid-column: 2; justify-content: center; gap: 4px; }
  .nav-link { display: flex; padding: 0 4px; font-size: .72rem; }
  .header-spacer { display: none; }
  .brand { font-size: 1.7rem; }
  .user-name { grid-column: 3; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
  header .text-button { grid-column: 4; padding: 6px 0; white-space: nowrap; font-size: .75rem; }
  .page { padding-top: 34px; }
  h1 { font-size: 3rem; }
  .page-heading { align-items: center; }
  .page-heading .button { padding: 0 16px; }
  .filters { grid-template-columns: 1fr; }
  .search { grid-column: auto; }
  .recipe-grid { grid-template-columns: 1fr; gap: 32px; }
  .card-photo { aspect-ratio: 1.6; }
  .recipe-card h2 { font-size: 1.8rem; }
  .auth-panel { padding: 30px 24px; }
  .auth-panel h1 { font-size: 2.65rem; }
  .detail-actions { align-items: flex-start; }
  .detail-actions > div { flex-direction: column; align-items: stretch; }
  .detail-photo { width: calc(100% + 28px); margin-left: -14px; margin-bottom: 30px; }
  .detail-meta { gap: 12px; flex-wrap: wrap; }
  .recipe-columns { grid-template-columns: 1fr; gap: 45px; }
  .three-fields { grid-template-columns: 1fr; gap: 0; }
  .form-section { padding: 24px 18px; margin-left: -4px; margin-right: -4px; }
  .photo-field { align-items: flex-start; flex-direction: column; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.admin-nav,.admin-actions { display:flex; flex-wrap:wrap; align-items:center; gap:1rem; }
.admin-nav { border-bottom:1px solid #dedbd3; padding:1rem 0; margin-bottom:2rem; }
.admin-filters { display:flex; flex-wrap:wrap; align-items:end; gap:1rem; }
.admin-filters .field { flex:1; min-width:160px; }
.admin-totals { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; margin:2rem 0; }
.metric { border-top:2px solid #596c50; padding:1rem 0; display:flex; flex-direction:column; gap:.5rem; }
.metric strong { font-size:2rem; }
.admin-trends { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:2rem; }
.trend-bars { display:flex; align-items:end; height:110px; gap:3px; border-bottom:1px solid #dedbd3; margin:1rem 0; }
.trend-column { height:100%; flex:1; display:flex; align-items:end; }
.trend-bar { width:100%; background:#596c50; border-radius:3px 3px 0 0; }
.admin-editor { padding:1.5rem; border:1px solid #dedbd3; border-radius:8px; margin:1rem 0; max-width:700px; }
.admin-table-wrap { overflow-x:auto; }
.admin-table { width:100%; border-collapse:collapse; text-align:left; }
.admin-table th,.admin-table td { padding:1rem .5rem; border-bottom:1px solid #dedbd3; vertical-align:top; overflow-wrap:anywhere; }
.admin-table td:first-child { max-width:350px; white-space:pre-wrap; }
.admin-page select { padding:.65rem; border:1px solid #dedbd3; border-radius:5px; background:white; }
@media(max-width:650px) { .admin-totals { grid-template-columns:repeat(2,minmax(0,1fr)); } .admin-trends { grid-template-columns:1fr; } .admin-table { font-size:.85rem; } }

/* Recipe ratings */
.rating-summary { display: flex; align-items: center; gap: .6rem; font-size: .875rem; margin: .6rem 0; }
.rating-stars { position: relative; display: inline-block; color: #b8b1a7; letter-spacing: .08em; white-space: nowrap; }
.rating-stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; color: #986313; }
.rating-section { margin: 1.5rem 0; }
.rating-picker { border: 0; padding: 0; margin: 1rem 0 0; }
.rating-picker legend { font-weight: 600; }
.rating-options { display: flex; gap: .2rem; margin: .25rem 0; }
.rating-star { background: transparent; border: 0; color: #b8b1a7; cursor: pointer; font-size: 2rem; min-width: 44px; min-height: 44px; padding: .1rem; }
.rating-star.selected, .rating-star:hover { color: #986313; }
.rating-star:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }
.rating-picker:disabled .rating-star { cursor: wait; opacity: .6; }
.rating-status { min-height: 1.25rem; margin: .25rem 0; font-size: .875rem; }
