:root {
  color-scheme: light;
  --ink: #26211d;
  --muted: #70665e;
  --paper: #fffdf8;
  --cream: #f5ecdc;
  --tomato: #b6412b;
  --tomato-dark: #87301f;
  --sage: #5f7152;
  --line: #dfd1bf;
  --shadow: 0 18px 45px rgb(78 52 27 / 10%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgb(226 153 87 / 18%), transparent 28rem),
    linear-gradient(135deg, var(--paper), #f8f1e6);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

header { padding: clamp(4rem, 9vw, 8rem) 0 3rem; }

h1 {
  max-width: 12ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 9vw, 7.5rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .86;
}

.toolbar {
  display: grid;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(255 253 248 / 82%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.count {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: 1rem 0 0;
}

.filter {
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: .84rem;
}

.filter:hover, .filter[aria-pressed="true"] {
  color: white;
  border-color: var(--sage);
  background: var(--sage);
}

main { padding: 1.25rem 0 6rem; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.recipe-card {
  position: relative;
  min-height: 18rem;
  padding: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 55px rgb(78 52 27 / 16%);
}

.recipe-card a {
  color: inherit;
  text-decoration: none;
}

.recipe-card a::after {
  position: absolute;
  inset: 0;
  content: "";
}

.recipe-card h2 {
  padding-right: 2.5rem;
  margin: 0 0 .75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.05;
}

.favorite-toggle {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
}

.favorite-toggle:hover {
  color: #a56a08;
  background: #fff5d8;
}

.favorite-toggle[aria-pressed="true"] {
  color: #a56a08;
}

.favorite-toggle:focus-visible {
  outline: 3px solid var(--tomato);
  outline-offset: 2px;
}

.recipe-card p {
  color: var(--muted);
  line-height: 1.55;
}

.empty {
  grid-column: 1 / -1;
  padding: clamp(2rem, 7vw, 5rem);
  border: 1px dashed var(--line);
  border-radius: 1rem;
  text-align: center;
  background: rgb(255 253 248 / 55%);
}

.empty h2 {
  margin: 0 0 .65rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.empty p {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.6;
}

footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .count { padding-inline: .15rem; }
}

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