:root {
  --green-900: #1b5e20;
  --green-700: #2e7d32;
  --green-500: #4caf50;
  --green-100: #e3f2e3;
  --fruit-700: #b03a3a;
  --fruit-100: #fde8e8;
  --bg: #f7f5f0;
  --card: #ffffff;
  --text: #222;
  --muted: #6b6b6b;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 55%, #43a047 100%);
  color: #fff;
  padding: 2.5rem 1rem 1.75rem;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 55ch;
  font-size: 1.05rem;
}

/* ---------- Month filter ---------- */

.month-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.month-pill {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.month-pill:hover {
  background: rgba(255, 255, 255, 0.28);
}

.month-pill.active {
  background: #fff;
  color: var(--green-900);
  border-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.month-pill.today::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 6px;
  background: var(--green-500);
  vertical-align: middle;
}

.month-pill.active.today::after {
  background: var(--green-700);
}

.season-line {
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  font-weight: 600;
}

/* ---------- Toolbar ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.count {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.legend {
  display: flex;
  gap: 0.5rem;
}

.legend-item {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.legend-item.veg {
  background: var(--green-100);
  color: var(--green-700);
}

.legend-item.fruit {
  background: var(--fruit-100);
  color: var(--fruit-700);
}

/* ---------- Grid & cards ---------- */

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: fadeUp 0.45s ease both;
}

.simple-badges {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  display: flex;
  gap: 0.25rem;
}
.simple-badges span {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.simple-badges .s { background: #f97316; }
.simple-badges .i { background: #eab308; }
.simple-badges .l { background: #06b6d4; }

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

.card .img-wrap {
  position: relative;
  height: 190px;
  overflow: hidden;
  background: #eceff1;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card:hover img {
  transform: scale(1.06);
}

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

.card .body {
  padding: 0.85rem 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.card .name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.produce-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}

.badge.vegetable {
  background: var(--green-100);
  color: var(--green-700);
}

.badge.fruit {
  background: var(--fruit-100);
  color: var(--fruit-700);
}

/* season strip: 12 month cells */
.season-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin-top: 0.35rem;
}

.season-strip .cell {
  height: 8px;
  border-radius: 3px;
  background: #e8e6e0;
}

.season-strip .cell.on {
  background: var(--green-500);
}

.season-strip .cell.on.fruit {
  background: #e57373;
}

.season-strip .cell.now {
  outline: 2px solid #222;
  outline-offset: 1px;
}

.season-strip-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ---------- Card interaction ---------- */

.card {
  cursor: pointer;
}

.card:focus-visible {
  outline: 3px solid var(--green-500);
  outline-offset: 2px;
}

/* ---------- Recipe cards page ---------- */

.back-link {
  margin: 0;
  font-weight: 600;
  color: var(--green-700);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.recipe-header {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.5rem;
  background: linear-gradient(135deg, var(--green-900), var(--green-500));
  color: #fff;
  border-radius: var(--radius);
}

.recipe-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.recipe-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.grid.recipes {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12), 0 14px 30px rgba(0, 0, 0, 0.10);
}

.recipe-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.recipe-hint {
  align-self: flex-start;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-100);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}

.recipe-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}


/* ---------- Recipe detail page ---------- */

.grid.detail {
  display: block;
}

.card.recipe-detail {
  cursor: default;
}

.card.recipe-detail:hover {
  transform: none;
}

.card.recipe-detail .img-wrap {
  height: 340px;
}

.card.recipe-detail .body {
  gap: 1.1rem;
}

.recipe-desc.full {
  display: block;
  -webkit-line-clamp: unset;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
}

.recipe-cols {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.5rem;
}

.recipe-cols h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.recipe-cols ul,
.recipe-cols ol {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.6;
  font-size: 0.92rem;
}

.source-link {
  align-self: flex-start;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green-700);
}


/* ---------- Footer ---------- */

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--green-700);
}

/* ---------- Responsive tweaks ---------- */

@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .card .img-wrap {
    height: 150px;
  }

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

  .card.recipe-detail .img-wrap {
    height: 240px;
  }

  .month-pills {
    gap: 0.4rem;
  }

  .month-pill {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
  }
}

/* ---------- Shopping list ---------- */

.list-link {
  font-weight: 600;
  color: var(--green-700);
  text-decoration: none;
  white-space: nowrap;
}

.list-link:hover {
  text-decoration: underline;
}

.add-list-btn {
  align-self: flex-start;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--green-500);
  background: var(--green-100);
  color: var(--green-700);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.add-list-btn:hover {
  background: #d5ecd5;
}

.add-list-btn.added {
  background: var(--green-700);
  color: #fff;
  border-color: var(--green-700);
}

.add-list-btn.remove {
  border-color: var(--fruit-700);
  background: var(--fruit-100);
  color: var(--fruit-700);
}

.add-list-btn.remove:hover {
  background: #f8d5d5;
}

.clear-list-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--fruit-700);
  background: var(--fruit-100);
  color: var(--fruit-700);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.clear-list-btn:hover {
  background: #f8d5d5;
}

.ing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.92rem;
  cursor: pointer;
}

.ing-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green-700);
  cursor: pointer;
}

.ing-row span {
  flex: 1;
}

.ing-row input:checked + span {
  text-decoration: line-through;
  color: #9a9a9a;
}
