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

:root {
  --bg: #faf8f5;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #c8572a;
  --accent-light: #f5ede8;
  --border: #e8e2db;
  --radius: 12px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

header {
  background: linear-gradient(135deg, #2c1810 0%, #5a2d0c 100%);
  color: white; padding: 3rem 1rem 2rem;
  text-align: center;
}
.header-inner { max-width: 900px; margin: 0 auto; }
header h1 { font-family: 'Playfair Display', serif; font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 0.5rem; }
.subtitle { opacity: 0.8; font-size: 0.95rem; margin-bottom: 1.5rem; }

.search-bar input {
  width: 100%; max-width: 480px; padding: 0.8rem 1.2rem;
  border-radius: 999px; border: none; font-size: 1rem;
  outline: none; background: rgba(255,255,255,0.15);
  color: white; placeholder-color: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
}
.search-bar input::placeholder { color: rgba(255,255,255,0.6); }
.search-bar input:focus { background: rgba(255,255,255,0.25); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.filter-btn {
  padding: 0.4rem 1rem; border-radius: 999px; border: 1.5px solid rgba(255,255,255,0.4);
  background: transparent; color: white; font-size: 0.85rem; cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active { background: var(--accent); border-color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }

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

.card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

.card-img { width: 100%; height: 180px; object-fit: cover; background: var(--accent-light); }

.card-body { padding: 1rem; }
.card-cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; }
.card-name { font-family: 'Playfair Display', serif; font-size: 1.1rem; margin: 0.25rem 0 0.5rem; line-height: 1.3; }
.card-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); }
.card-cost { font-weight: 600; color: var(--text); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-content {
  position: relative; background: white; border-radius: 16px;
  max-width: 680px; width: 100%; max-height: 90vh; overflow-y: auto;
  z-index: 1;
}
.close-btn {
  position: absolute; top: 1rem; right: 1rem; width: 36px; height: 36px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.1);
  font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.close-btn:hover { background: rgba(0,0,0,0.2); }

.modal-img { width: 100%; height: 280px; object-fit: cover; border-radius: 16px 16px 0 0; }

.modal-body-inner { padding: 1.5rem; }
.modal-cat { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-weight: 600; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.8rem; margin: 0.4rem 0 0.5rem; }
.modal-desc { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.modal-time { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }
.modal-time span { font-weight: 600; color: var(--text); }

.section-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.8rem; color: var(--text); }

.ingredient-list { list-style: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.ingredient-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.ingredient-list li:last-child { border-bottom: none; }
.ingredient-list .qty { color: var(--muted); font-size: 0.85rem; }
.ingredient-list .price { font-weight: 600; color: var(--accent); }

.total-cost {
  background: var(--accent-light); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin-bottom: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
}
.total-cost .label { font-size: 0.9rem; color: var(--muted); }
.total-cost .amount { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700; color: var(--accent); }

.instructions { background: var(--bg); border-radius: var(--radius); padding: 1.2rem; font-size: 0.95rem; line-height: 1.7; }

.no-results { text-align: center; padding: 4rem 1rem; color: var(--muted); font-size: 1.1rem; }

@media (max-width: 600px) {
  .recipe-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .card-img { height: 130px; }
  .modal-img { height: 200px; }
}
@media (max-width: 380px) {
  .recipe-grid { grid-template-columns: 1fr; }
}
