:root {
  --green-dark: #1e3a2b;
  --green: #2e7d4f;
  --green-light: #e8f3ec;
  --cream: #faf7f0;
  --ink: #25302a;
  --muted: #5f6f66;
  --card-radius: 16px;
  --shadow: 0 4px 14px rgba(30, 58, 43, 0.10);
  --shadow-hover: 0 10px 28px rgba(30, 58, 43, 0.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e6e0d4;
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--green-dark);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.nav-links a:hover { color: var(--green); border-color: var(--green); }

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(rgba(20, 40, 28, 0.55), rgba(20, 40, 28, 0.65)),
    url("https://images.unsplash.com/photo-1540420773420-3366772f4999?auto=format&fit=crop&w=1600&q=70")
    center / cover no-repeat,
    var(--green-dark);
  color: #fff;
  text-align: center;
  padding: 7rem 1.25rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero p {
  max-width: 540px;
  margin: 0 auto 2rem;
  font-size: 1.1rem;
  opacity: 0.95;
}

.hero-buttons { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}

.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.btn-primary { background: #fff; color: var(--green-dark); }
.btn-secondary { background: var(--green); color: #fff; }

/* ---------- Search ---------- */
.search-wrap {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#recipe-search {
  width: min(480px, 90%);
  padding: 0.85rem 1.4rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  box-shadow: var(--shadow);
}

#recipe-search:focus { outline: 3px solid var(--green); }

#search-count {
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.4em;
  color: #fff;
  opacity: 0.95;
}

/* While searching: hide non-matches, reveal collapsed extras, hide show-more buttons */
.recipe-card.search-miss { display: none; }
body.searching .recipe-card.collapsed { display: flex; }
body.searching .recipe-card.search-miss { display: none; }
body.searching .show-more { display: none; }

/* ---------- Show more ---------- */
.recipe-card.collapsed { display: none; }

.show-more {
  display: block;
  margin: 0 auto 2.5rem;
  cursor: pointer;
  border: none;
  font: inherit;
  font-weight: 600;
}

/* ---------- Sections ---------- */
.recipe-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.25rem 2rem;
}

.recipe-section.alt {
  max-width: none;
  background: var(--green-light);
}

.recipe-section.alt > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.section-head { text-align: center; margin-bottom: 2.25rem; }

.section-head h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  color: var(--green-dark);
  margin-bottom: 0.4rem;
}

.section-head p { color: var(--muted); }

/* ---------- Recipe cards ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.recipe-card {
  background: #fff;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: none;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.recipe-card:hover, .recipe-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-img-wrap { position: relative; aspect-ratio: 4 / 3; background: var(--green-light); }

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #d7eadf, #b9d9c6);
}

.time-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }

.card-body h3 { font-size: 1.15rem; color: var(--green-dark); }

.card-body p { font-size: 0.92rem; color: var(--muted); flex: 1; }

.card-meta { font-size: 0.85rem; color: var(--green); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 24, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: #fff;
  border-radius: var(--card-radius);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.modal-img { width: 100%; height: 280px; object-fit: cover; display: block; }

.modal-body { padding: 1.75rem; }

.modal-body h3 { font-size: 1.7rem; color: var(--green-dark); margin-bottom: 0.4rem; }

.modal-meta { color: var(--green); font-weight: 600; font-size: 0.95rem; margin-bottom: 0.9rem; }

.modal-desc { color: var(--muted); margin-bottom: 1.5rem; }

.modal-columns {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2rem;
}

.modal-columns h4 {
  font-family: "Fraunces", Georgia, serif;
  color: var(--green-dark);
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
}

.modal-columns ul, .modal-columns ol { padding-left: 1.2rem; }

.modal-columns li { margin-bottom: 0.45rem; font-size: 0.95rem; }

@media (max-width: 600px) {
  .modal-columns { grid-template-columns: 1fr; }
  .hero { padding: 5rem 1.25rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--green-dark);
  color: #d6e6dc;
  text-align: center;
  padding: 2rem 1.25rem;
  margin-top: 2rem;
}
