/* ===== Recipe Box styles =====
   Warm food-magazine look: cream background, one bold accent,
   serif display headings (Fraunces) + clean sans body (Inter). */

:root {
  --cream: #faf6ef;
  --ink: #2b2118;
  --accent: #d9480f;      /* burnt orange */
  --accent-soft: #ffe8d9;
  --card: #ffffff;
  --muted: #8a7d70;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(43, 33, 24, 0.08);
  --shadow-lift: 0 10px 24px rgba(43, 33, 24, 0.14);
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 16px 28px;
  background: linear-gradient(180deg, var(--accent-soft), var(--cream));
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  color: var(--accent);
  letter-spacing: -0.02em;
}

.tagline { color: var(--muted); margin-top: 6px; font-size: 1.05rem; }

/* ===== Layout ===== */
main {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 0 16px 48px;
  flex: 1;
}

/* ===== Search controls ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.search-row { display: flex; gap: 8px; flex: 1 1 340px; max-width: 520px; }

#search-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #e6ddd2;
  border-radius: 999px;
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
}

#search-input:focus { border-color: var(--accent); }

.btn {
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { box-shadow: var(--shadow-lift); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent-soft); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.tab {
  padding: 8px 18px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.fav-count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
}

/* ===== Spinner ===== */
.spinner {
  width: 42px;
  height: 42px;
  margin: 40px auto;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Messages / empty states ===== */
.message {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  padding: 36px 12px;
}

/* ===== Card grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: fadeIn 0.4s ease both;
  position: relative;
}

.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

.card-body { padding: 12px 14px 14px; }

.card-body h3 { font-size: 1.05rem; line-height: 1.3; }

.card-category {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
}

/* Heart button on cards and detail view */
.heart {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s;
}

.heart:hover { transform: scale(1.12); }

/* ===== Detail view ===== */
.detail { animation: fadeIn 0.3s ease both; }

.detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 20px 0 24px;
  align-items: flex-start;
}

.detail-header img {
  width: min(380px, 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.detail-info { flex: 1 1 300px; }

.detail-info h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin-bottom: 8px; }

.detail-meta { color: var(--muted); margin-bottom: 14px; }

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.ingredients {
  list-style: none;
  margin: 10px 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.ingredients li {
  background: var(--card);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}

.ingredients li span { color: var(--muted); }

.instructions { line-height: 1.75; white-space: pre-line; max-width: 72ch; }

.section-label {
  font-size: 1.3rem;
  margin: 22px 0 8px;
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: 4px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer a { color: var(--accent); }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Mobile ===== */
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hero { padding: 34px 16px 20px; }
}
