* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: sans-serif; background: #f9f5ee; color: #222; }

.hidden { display: none !important; }

/* NAV */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 52px;
  background: #1e1209;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav span { color: #fff; font-size: 1.1rem; }
nav button {
  background: none;
  border: 1px solid transparent;
  color: #aaa;
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  margin-left: 0.4rem;
}
nav button:hover  { color: #fff; border-color: #666; }
nav button.active { color: #c8943a; border-color: #c8943a; }

/* HERO */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: #1e1209;
  color: #fff;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.8rem; }
.hero h1 em { font-style: italic; color: #c8943a; }
.hero p  { color: #aaa; margin-bottom: 1.5rem; }
.hero button {
  background: #b5391e;
  color: #fff;
  border: none;
  padding: 0.7rem 1.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.hero button:hover { background: #962f16; }

/* FEATURE CARDS */
.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem 1.5rem;
}
.feat {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  width: 200px;
}
.feat h3 { margin-bottom: 0.4rem; font-size: 1rem; }
.feat p  { font-size: 0.85rem; color: #888; }

/* CONTROLS */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  padding: 0.9rem 1rem;
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 52px;
}
.controls input,
.controls select {
  padding: 0.5rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.875rem;
  outline: none;
}
.controls input { width: 200px; }
.controls input:focus,
.controls select:focus { border-color: #b5391e; }
.controls button {
  background: #b5391e;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}
.controls button:hover { background: #962f16; }

/* STATUS */
#statusMsg {
  text-align: center;
  padding: 1rem;
  color: #888;
  font-size: 0.9rem;
}

/* GRID */
#recipeGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* CARD */
.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.card img   { width: 100%; height: 150px; object-fit: cover; display: block; }
.card-body  { padding: 0.75rem; }
.card-body p     { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; }
.card-body small { font-size: 0.78rem; color: #888; }

/* MODAL OVERLAY */
#modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
#modalBox {
  background: #fff;
  border-radius: 8px;
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}
#modalClose {
  position: sticky;
  top: 0.6rem;
  float: right;
  margin: 0.6rem 0.6rem 0 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}
#modalClose:hover { background: #b5391e; color: #fff; border-color: #b5391e; }
#modalImg { width: 100%; height: 200px; object-fit: cover; display: block; border-radius: 8px 8px 0 0; }
#modalBody { padding: 1.2rem 1.5rem 1.5rem; }
#modalTitle { font-size: 1.5rem; margin-bottom: 0.3rem; }
#modalCategory {
  display: inline-block;
  background: #b5391e;
  color: #fff;
  font-size: 0.72rem;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
#modalBody h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.3rem;
}
#modalIngredients { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
#modalIngredients li {
  background: #f5f0e8;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
}
#modalInstructions { font-size: 0.88rem; line-height: 1.7; color: #444; white-space: pre-line; }

/* MOBILE */
@media (max-width: 520px) {
  #recipeGrid { padding: 1rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .controls input { width: 140px; }
}
