:root {
  --ink: #22211e;
  --muted: #6f6b62;
  --paper: #f6f2ea;
  --card: #fffdf9;
  --line: #ded8cc;
  --accent: #b73d23;
  --accent-dark: #8f2e1a;
  --sage: #47624c;
  --shadow: 0 16px 40px rgba(46, 38, 27, 0.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; background: var(--paper); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
img { display: block; max-width: 100%; }

.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;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 68px max(16px, env(safe-area-inset-left));
  color: #fffaf2;
  background:
    radial-gradient(circle at 92% 5%, rgba(255,255,255,.13) 0 90px, transparent 91px),
    linear-gradient(135deg, #303b31 0%, #47624c 58%, #5d705e 100%);
}
.hero::after {
  content: ""; position: absolute; width: 240px; height: 240px; right: -95px; bottom: -155px;
  border: 46px solid rgba(238, 196, 111, .18); border-radius: 50%;
}
.hero__inner { width: min(1120px, 100%); margin: 0 auto; position: relative; z-index: 1; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand__mark { display: grid; place-items: center; width: 34px; height: 34px; color: #303b31; background: #f1c879; border-radius: 11px; font-family: Georgia, serif; font-size: 20px; }
.hero__copy { padding-top: 42px; max-width: 690px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; line-height: 1.2; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero .eyebrow { color: #f1c879; }
h1, h2, h3 { text-wrap: balance; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 12vw, 74px); line-height: .98; letter-spacing: -.045em; }
.hero__lead { max-width: 560px; margin: 18px 0 0; color: rgba(255,250,242,.82); font-size: clamp(15px, 4vw, 18px); line-height: 1.55; }

.page-shell { width: min(1120px, calc(100% - 24px)); margin: -34px auto 0; position: relative; z-index: 2; }
.filter-panel { padding: 16px; border: 1px solid rgba(222,216,204,.85); border-radius: var(--radius); background: rgba(255,253,249,.97); box-shadow: var(--shadow); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; width: 21px; height: 21px; left: 15px; top: 50%; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
input, select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); outline: none; }
input { padding: 0 42px 0 46px; }
select { appearance: none; padding: 0 42px 0 13px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(71,98,76,.13); }
.select-grid { display: grid; gap: 12px; margin-top: 12px; }
.field label { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 12px; font-weight: 750; }

.results { padding: 46px 0 24px; }
.results__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.results h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 34px; letter-spacing: -.035em; }
.result-count { flex: none; margin: 0; padding: 7px 10px; border-radius: 999px; background: #e6dfd2; color: var(--muted); font-size: 12px; font-weight: 750; }
.recipe-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.recipe-card { display: grid; grid-template-columns: 112px minmax(0,1fr); min-height: 126px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 5px 16px rgba(50,43,31,.05); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.recipe-card:hover { transform: translateY(-2px); border-color: #c8bdad; box-shadow: 0 12px 28px rgba(50,43,31,.11); }
.recipe-card:focus-visible { outline: 3px solid rgba(71,98,76,.4); outline-offset: 2px; }
.recipe-card__image { width: 100%; height: 100%; object-fit: cover; background: #e7e0d4; }
.recipe-card__body { display: flex; flex-direction: column; min-width: 0; padding: 14px 13px; }
.recipe-card__category { margin: 0 0 6px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.recipe-card h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.08; letter-spacing: -.025em; }
.recipe-card__meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: auto; padding-top: 10px; color: var(--muted); font-size: 11px; font-weight: 650; }
.recipe-card__meta span { white-space: nowrap; }
.empty-state { padding: 54px 18px; text-align: center; border: 1px dashed #c8bdad; border-radius: var(--radius); background: rgba(255,255,255,.45); }
.empty-state > span { font-size: 38px; }
.empty-state h3 { margin: 12px 0 6px; font-size: 22px; }
.empty-state p { margin: 0 auto 18px; max-width: 390px; color: var(--muted); line-height: 1.5; }
.button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; color: white; background: var(--sage); font-weight: 750; }
.button:hover { background: #334b39; }

footer { padding: 34px 20px max(34px, env(safe-area-inset-bottom)); text-align: center; color: var(--muted); }
footer p { margin: 0; }
.footer-note { margin-top: 7px; font-size: 12px; }

dialog { width: min(820px, 100%); max-width: none; max-height: min(92dvh, 900px); margin: auto 0 0; padding: 0; overflow: hidden; border: 0; border-radius: 24px 24px 0 0; background: var(--card); color: var(--ink); box-shadow: 0 -20px 60px rgba(25,21,16,.25); }
dialog::backdrop { background: rgba(22,24,20,.62); backdrop-filter: blur(4px); }
.dialog-card { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
.dialog-close { position: absolute; z-index: 5; right: max(13px, env(safe-area-inset-right)); top: 13px; display: grid; place-items: center; width: 42px; height: 42px; padding: 0 0 4px; border: 0; border-radius: 50%; color: white; background: rgba(20,20,18,.62); font-size: 29px; line-height: 1; backdrop-filter: blur(8px); }
.dialog-hero { position: relative; min-height: 285px; display: flex; align-items: flex-end; color: white; background: #313a32; }
.dialog-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dialog-hero__overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(19,18,15,.92) 0%, rgba(19,18,15,.32) 64%, rgba(19,18,15,.05) 100%); }
.dialog-hero__copy { position: relative; z-index: 2; width: 100%; padding: 70px 20px 22px; }
.category-pill { display: inline-flex; margin: 0 0 8px; padding: 5px 9px; border-radius: 999px; background: #f1c879; color: #352d20; font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.dialog-hero h2 { margin: 0; max-width: 650px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 9vw, 48px); line-height: 1; letter-spacing: -.04em; }
.meta-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.meta-row span { padding: 6px 9px; border: 1px solid rgba(255,255,255,.26); border-radius: 999px; background: rgba(0,0,0,.2); color: rgba(255,255,255,.9); font-size: 11px; font-weight: 700; }
.dialog-body { display: grid; gap: 28px; padding: 26px 20px max(34px, env(safe-area-inset-bottom)); }
.dialog-body h3 { margin: 0 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.ingredient-list, .instruction-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.ingredient-list li { padding: 10px 2px; border-bottom: 1px solid var(--line); color: #4c4943; font-size: 14px; line-height: 1.35; }
.instruction-list { counter-reset: steps; display: grid; gap: 17px; }
.instruction-list li { counter-increment: steps; position: relative; min-height: 28px; padding-left: 40px; color: #45423c; font-size: 14px; line-height: 1.55; }
.instruction-list li::before { content: counter(steps); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: white; background: var(--accent); font-size: 12px; font-weight: 800; }
.recipe-note { margin: 20px 0 0; padding: 14px; border-left: 3px solid #d4aa56; border-radius: 0 12px 12px 0; color: #655734; background: #fbf1da; font-size: 13px; line-height: 1.5; }

@media (min-width: 540px) {
  .page-shell { width: min(1120px, calc(100% - 40px)); }
  .filter-panel { padding: 20px; }
  .select-grid { grid-template-columns: 1fr 1.4fr; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
  .recipe-card { display: flex; flex-direction: column; min-height: 320px; }
  .recipe-card__image { height: 190px; }
  .recipe-card__body { flex: 1; padding: 17px; }
  .recipe-card h3 { font-size: 23px; }
}

@media (min-width: 760px) {
  .hero { padding-bottom: 92px; }
  .hero__copy { padding-top: 64px; }
  .page-shell { margin-top: -44px; }
  .filter-panel { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; align-items: end; }
  .select-grid { margin-top: 0; }
  dialog { margin: auto; border-radius: 26px; }
  .dialog-body { grid-template-columns: minmax(220px,.75fr) minmax(0,1.4fr); padding: 34px; gap: 42px; }
  .dialog-hero__copy { padding: 90px 34px 30px; }
}

@media (min-width: 980px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 360px) {
  .hero__copy { padding-top: 32px; }
  .hero__lead { font-size: 14px; }
  .page-shell { width: calc(100% - 16px); }
  .filter-panel { padding: 12px; border-radius: 18px; }
  .recipe-card { grid-template-columns: 96px minmax(0,1fr); min-height: 116px; }
  .recipe-card__body { padding: 12px 10px; }
  .recipe-card h3 { font-size: 18px; }
  .dialog-hero { min-height: 245px; }
  .dialog-body { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  body * { visibility: hidden; }
  dialog, dialog * { visibility: visible; }
  dialog { position: static; max-height: none; box-shadow: none; }
  .dialog-close { display: none; }
  .dialog-card { overflow: visible; }
}
