:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --panel: #fffdf8;
  --ink: #17201c;
  --muted: #657069;
  --line: #ded7c9;
  --green: #00a897;
  --green-dark: #08786e;
  --amber: #ff7206;
  --amber-soft: #ffe1c6;
  --shadow: 0 18px 55px rgb(52 42 28 / 14%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 16% 8%, rgb(255 114 6 / 16%), transparent 26rem),
    linear-gradient(135deg, #f7f4ed 0%, #edf4f0 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 19.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgb(255 253 248 / 86%);
  backdrop-filter: blur(18px);
}

.archive-link {
  display: inline-flex;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.08em;
}

.archive-link:hover {
  color: var(--green-dark);
}

.brand {
  margin-bottom: 2rem;
}

.brand__logo {
  display: block;
  width: min(13.5rem, 100%);
  height: auto;
}

.brand p {
  margin: 0.55rem 0 0;
  color: var(--green-dark);
  font-size: 0.98rem;
}

.panel {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.panel h2 {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel__row h2 {
  margin: 0;
}

.panel__row strong {
  color: var(--amber);
}

.source-list {
  display: grid;
  gap: 0.4rem;
}

.source-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.2rem;
  color: var(--ink);
  font-size: 0.9rem;
}

.source-option input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green);
}

.source-option span:last-child {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.range {
  width: 100%;
  margin-top: 0.9rem;
  accent-color: var(--amber);
}

.panel--stats dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 0;
}

.panel--stats div {
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 52%);
}

.panel--stats dt {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.panel--stats dd {
  margin: 0.15rem 0 0;
  color: var(--green-dark);
  font-weight: 800;
}

.mascot {
  display: block;
  width: min(10rem, 70%);
  margin: 1.5rem auto 0;
}

.workspace {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 5.8rem);
  font-weight: 400;
  line-height: 0.9;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  width: 15rem;
  min-height: 2.75rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mode-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.mode-button.is-active {
  background: var(--green);
  color: white;
}

.search-strip {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 253 248 / 92%);
  box-shadow: 0 10px 30px rgb(42 38 31 / 7%);
  backdrop-filter: blur(18px);
}

.search-main {
  position: relative;
  min-width: 0;
}

.search-main label,
.sort-control span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 3.2rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.1rem;
  padding: 0 0.55rem;
  border: 1px solid rgb(0 168 151 / 24%);
  border-radius: 999px;
  background: rgb(0 168 151 / 10%);
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 750;
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 900;
  line-height: 1;
}

.search-box input {
  flex: 1;
  min-width: 9rem;
  height: 2.25rem;
  border: 0;
  outline: 0;
}

.sort-control select {
  width: 100%;
  min-height: 3.2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.suggestions {
  position: absolute;
  inset: calc(100% + 0.35rem) 0 auto;
  z-index: 10;
  display: none;
  max-height: 18rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.suggestions.is-open {
  display: grid;
}

.suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  text-align: left;
}

.suggestion:hover {
  background: #f0fbf9;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.4rem;
  margin-bottom: 0.8rem;
}

.status-row p {
  margin: 0;
  color: var(--muted);
}

.quiet-button {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-weight: 800;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.85rem;
}

.recipe-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgb(52 42 28 / 9%);
}

.recipe-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 0;
  background: #e7e2d5;
}

.recipe-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.recipe-card:hover img {
  transform: scale(1.035);
}

.recipe-card__image.is-empty {
  display: grid;
  place-items: center;
}

.recipe-card__image.is-empty img {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  opacity: 0.45;
}

.match-pill {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: var(--amber);
  color: white;
  font-size: 0.78rem;
  font-weight: 850;
}

.recipe-card__body {
  padding: 0.85rem;
}

.recipe-card h3 {
  display: -webkit-box;
  min-height: 2.7rem;
  margin: 0 0 0.65rem;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.recipe-meta span {
  padding: 0.32rem 0.48rem;
  border-radius: 999px;
  background: #f0ebe0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.recipe-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.recipe-actions button,
.recipe-actions a,
.load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  border-radius: 7px;
  font-weight: 800;
  text-decoration: none;
}

.recipe-actions button {
  border: 1px solid var(--green);
  background: var(--green);
  color: white;
}

.recipe-actions a {
  border: 1px solid var(--line);
  background: white;
  color: var(--green-dark);
}

.load-more {
  width: min(18rem, 100%);
  margin: 1.25rem auto 0;
  border: 1px solid var(--green);
  background: var(--green);
  color: white;
}

.load-more[hidden] {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 22rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgb(255 253 248 / 68%);
  text-align: center;
}

.empty-state img {
  width: 5rem;
  margin-bottom: 1rem;
  opacity: 0.55;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgb(14 20 17 / 62%);
}

.modal__card {
  position: relative;
  width: min(62rem, 100%);
  max-height: min(44rem, 92vh);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal__close {
  position: sticky;
  top: 0.75rem;
  z-index: 2;
  float: right;
  margin: 0.75rem 0.75rem 0 0;
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.recipe-detail {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  padding: 1rem;
}

.recipe-detail__image {
  overflow: hidden;
  border-radius: 8px;
  background: #e7e2d5;
  aspect-ratio: 4 / 3;
}

.recipe-detail__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-detail__image.is-empty {
  display: grid;
  place-items: center;
}

.recipe-detail__image.is-empty img {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
  opacity: 0.55;
}

.recipe-detail h2 {
  margin: 0 0 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 400;
  line-height: 1.05;
}

.ingredient-list {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.ingredient-list li {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0 1rem;
  border-radius: 7px;
  background: var(--amber);
  color: white;
  font-weight: 850;
  text-decoration: none;
}

@media (max-width: 58rem) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mascot {
    display: none;
  }

  .source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .search-strip,
  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    display: grid;
  }

  .mode-switch {
    width: 100%;
  }

  .search-strip {
    position: static;
    grid-template-columns: 1fr;
  }

  .recipe-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 36rem) {
  .workspace,
  .sidebar {
    padding: 0.85rem;
  }

  .source-list,
  .panel--stats dl {
    grid-template-columns: 1fr;
  }

  .recipe-grid {
    grid-template-columns: 1fr;
  }
}
