:host {
  all: initial;
  display: block;
  container-type: inline-size;
  color-scheme: light;
  --cream: #FAF7F2;
  --linen: #F0EBE1;
  --stone: #D9CFC0;
  --sage: #8A9E8C;
  --espresso: #3D2B1F;
  --terracotta: #C17A5A;
  --green: #415B47;
  --muted: #695D53;
  --surface: #FFFDF9;
  --serif: 'Foodnook Playfair Display', Georgia, serif;
  background: var(--cream);
  color: var(--espresso);
  font: 1rem/1.5 'Foodnook Lato', Arial, sans-serif;
}
* { box-sizing: border-box; }
button, input, select { color: inherit; font: inherit; }
button, select, summary { cursor: pointer; }
a { color: inherit; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
[hidden] { display: none !important; }
svg { display: block; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: min(100% - 2.5rem, 76rem); margin-inline: auto; }

.saved-nav { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.saved-nav { min-height: 44px; padding: .35rem .6rem; border: 1px solid var(--stone); border-radius: .4rem; background: var(--surface); }
.saved-nav:hover, .saved-nav[aria-pressed="true"] { border-color: var(--sage); background: var(--linen); }
#savedCount { display: inline-grid; place-items: center; min-width: 1.45rem; padding-inline: .25rem; border-radius: 99px; background: var(--linen); font-size: .8rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; gap: 2.2rem; padding: 1.7rem 0; }
.hero-copy { padding-block: .5rem; }
.hero-title, h3 { margin: 0; font-family: var(--serif); font-weight: 500; line-height: 1.14; }
.hero-title { font-size: clamp(1.8rem, 5cqw, 3.35rem); letter-spacing: -.04em; }
.hero-title em { color: var(--green); font-weight: 400; }
.hero-copy > p:last-child { max-width: 32rem; margin: .85rem 0 0; color: var(--muted); }
.hero picture { display: block; background: var(--linen); border-radius: 4.25rem .35rem .35rem .35rem; border-bottom: 4px solid var(--terracotta); overflow: hidden; }
.hero img { display: block; width: 100%; height: clamp(9rem, 17vw, 14rem); object-fit: cover; object-position: center 56%; }

.finder { scroll-margin-top: 1rem; }
.finder-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .85rem; }
.search-box { flex: 1 1 15rem; display: flex; align-items: center; gap: .75rem; padding-inline: .9rem .35rem; border: 1px solid var(--sage); border-radius: .4rem; background: var(--surface); }
.search-box:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.search-box > svg { color: var(--green); }
.search-box input { flex: 1; min-width: 0; min-height: 50px; padding-block: .5rem; border: 0; outline: 0; background: transparent; }
.search-box input::placeholder { color: var(--muted); opacity: 1; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; }

.finder-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1.8rem; margin-top: 1.4rem; }
.categories h3 { margin: .5rem 0 .65rem; font: 700 .9rem/1.5 'Foodnook Lato', Arial, sans-serif; color: var(--green); }
.category-button { display: flex; gap: .4rem; justify-content: space-between; width: 100%; min-height: 44px; margin-bottom: .2rem; padding: .55rem .65rem; border: 1px solid transparent; border-radius: .35rem; background: transparent; text-align: left; font-size: .93rem; }
.category-button:hover { background: var(--linen); }
.category-button[aria-pressed="true"] { background: #E4EAE2; border-color: var(--sage); color: var(--green); font-weight: 700; }
.count { color: var(--muted); font-size: .85rem; align-self: center; }
.mobile-category { display: none; }
.quick-filters, .results-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .65rem; }
.filter-chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .75rem; border: 1px solid var(--stone); border-radius: 99px; background: var(--surface); font-size: .9rem; }
.filter-chip:hover { border-color: var(--green); }
.filter-chip[aria-pressed="true"] { color: var(--cream); background: var(--green); border-color: var(--green); }
.chip-check { display: grid; place-items: center; width: .95rem; height: .95rem; border: 1px solid currentColor; border-radius: .2rem; }
.chip-check svg { width: .8rem; height: .8rem; visibility: hidden; }
.filter-chip[aria-pressed="true"] svg { visibility: visible; }
.results-toolbar { margin-block: .65rem; }
#resultCount { flex: 1 0 auto; margin: 0; font-weight: 700; }
select { appearance: none; min-height: 44px; max-width: 100%; padding: .4rem 1.9rem .4rem .6rem; border-radius: .35rem; border: 1px solid var(--stone); background: var(--surface) url('chevron.svg') right .6rem center / .75rem no-repeat; font-size: .9rem; }
.text-button { min-height: 44px; padding: .25rem .1rem; border: 0; background: transparent; color: var(--green); font-size: .875rem; text-decoration: underline; text-underline-offset: .2em; }

.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.05rem; }
.recipe-card { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--stone); border-radius: .45rem; overflow: hidden; background: var(--surface); }
.recipe-card:focus-within { outline: 2px solid var(--green); outline-offset: 3px; }
.recipe-card:hover { border-color: var(--sage); }
.card-image { display: block; width: 100%; height: auto; aspect-ratio: 1.65; object-fit: cover; background: var(--linen); }
.card-body { display: flex; flex: 1; flex-direction: column; padding: .85rem 1rem .7rem; }
.card-category { margin: 0 0 .35rem; color: var(--green); font-size: .85rem; font-weight: 700; }
.card-body h3 { font-size: clamp(1.17rem, 1.65vw, 1.42rem); }
.card-description { margin: .55rem 0 .65rem; color: var(--muted); }
.card-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: auto 0 .4rem; }
.tag { padding: .15rem .45rem; border-radius: .25rem; background: #E4EAE2; color: var(--green); font-size: .82rem; }
.tag.lowcarb { background: #F4E7DE; color: #74452E; }
.recipe-link { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; margin-top: auto; font-size: .94rem; font-weight: 700; }
.card-tags + .recipe-link { margin-top: 0; }
.recipe-link::after { content: ''; position: absolute; inset: 0; }
.favorite { position: absolute; z-index: 1; top: .5rem; right: .5rem; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--stone); border-radius: 50%; background: var(--cream); color: var(--green); }
.favorite:hover { border-color: var(--green); }
.favorite[aria-pressed="true"] svg, .saved-nav[aria-pressed="true"] svg { fill: var(--sage); }

.empty-state { padding: 2rem 1rem; text-align: center; background: var(--linen); border-radius: .4rem; }
.empty-state h3 { font-size: 1.5rem; }
.empty-state p { color: var(--muted); }
.primary-button { min-height: 44px; border: 0; border-radius: .35rem; padding: .55rem .95rem; background: var(--green); color: var(--cream); }
.site-footer { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .8rem 1.6rem; margin-top: 2rem; padding: 1.3rem 0 2rem; border-top: 1px solid var(--stone); color: var(--muted); font-size: .9rem; }
.site-footer details { flex: 1 1 18rem; }
.site-footer summary { width: fit-content; }
.site-footer p { max-width: 44rem; }
.toast { position: fixed; z-index: 2; bottom: 1rem; inset-inline: 1rem; width: fit-content; margin-inline: auto; padding: .65rem 1rem; border-radius: .35rem; color: var(--cream); background: var(--espresso); box-shadow: 0 3px 12px #3D2B1F33; }
.toast:empty { display: none; }

@container (max-width: 1040px) {
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 760px) {
  .wrap { width: calc(100% - 2rem); }
  .hero { gap: 1rem; }
  .finder-layout { display: block; margin-top: .85rem; }
  .categories { display: none; }
  .mobile-category { display: flex; align-items: center; gap: .7rem; margin-bottom: .75rem; color: var(--green); }
  .mobile-category label { font-weight: 700; }
  .mobile-category select { flex: 1; min-width: 0; font-size: 1rem; }
}
@container (max-width: 580px) {
  .saved-nav { font-size: .88rem; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(68px, 25%); padding-block: .8rem; }
  .hero-title { font-size: clamp(1.42rem, 6.4cqw, 2.15rem); overflow-wrap: anywhere; }
  .hero-copy > p:last-child { margin-top: .5rem; font-size: .94rem; }
  .hero picture { border-radius: 2rem .25rem .25rem .25rem; }
  .hero img { height: 7.5rem; object-position: 58% 50%; }
  .recipe-grid { grid-template-columns: minmax(0, 1fr); }
  .card-body h3 { font-size: 1.5rem; }
  #resultCount { flex: 1 0 20%; }
}
