:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --green: #7fff00;
  --green-dim: #4a9900;
  --text: #f0f0f0;
  --text-muted: #888;
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Hero ── */
.hero {
  padding: 80px 24px 60px;
  text-align: center;
  background: linear-gradient(180deg, #0f1a0a 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 20px;
}

.hero h1 span { color: var(--green); }

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat strong {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}

.hero-stat span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Grid ── */
.section-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.section-count {
  background: var(--green);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .grid { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 60px; } }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--green-dim);
}

.card-img {
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
}

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

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

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #111 0%, #1a2a10 100%);
}

.card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(127,255,0,0.2);
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.macros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.macro-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.68rem;
  white-space: nowrap;
}

.macro-badge .macro-label {
  color: var(--text-muted);
  margin-right: 3px;
}

.macro-badge .macro-val {
  color: var(--text);
  font-weight: 600;
}

.card-footer {
  padding: 0 20px 20px;
}

.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--green-dim);
  color: var(--green);
  background: transparent;
  letter-spacing: 0.02em;
}

.btn:hover {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

/* ── Detail page ── */
.detail-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 28px 0 24px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--green); }

.back-link svg { width: 16px; height: 16px; }

.detail-hero-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 32px;
  background: var(--surface2);
  display: block;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-tag {
  background: rgba(127,255,0,0.1);
  color: var(--green);
  border: 1px solid rgba(127,255,0,0.25);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 100px;
}

.detail-serves {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.detail-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.detail-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-style: italic;
}

/* macros table */
.macros-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 40px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
}

@media (max-width: 600px) { .macros-table { grid-template-columns: repeat(3, 1fr); } }

.macro-cell {}

.macro-cell .mc-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}

.macro-cell .mc-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ingredients & instructions */
.section-block { margin-bottom: 36px; }

.section-block h2 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.ingredients-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredients-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.ingredients-list li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 2px;
}

.instructions-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.detail-source {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.detail-source a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* not-found */
.not-found {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.not-found h2 { font-size: 2rem; margin-bottom: 12px; color: var(--text); }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 24px 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  letter-spacing: 0.01em;
}

.filter-btn:hover {
  border-color: var(--green-dim);
  color: var(--text);
}

.filter-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  font-weight: 700;
}

.filter-btn.active .filter-count {
  background: rgba(0,0,0,0.2);
  color: #000;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.hero-nav {
  margin-top: 24px;
}

.hero-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.18s;
}

.hero-nav-link:hover {
  border-color: var(--green-dim);
  color: var(--green);
}

/* ── Ingredients Page ── */
.ing-hero {
  padding: 48px 24px 40px;
  background: linear-gradient(180deg, #0f1a0a 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  max-width: 900px;
  margin: 0 auto;
}

.ing-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--green);
  margin: 16px 0 8px;
  letter-spacing: -0.02em;
}

.ing-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 28px;
}

.ing-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
}

.ing-search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.ing-search {
  width: 100%;
  padding: 12px 48px 12px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s;
}

.ing-search:focus {
  border-color: var(--green-dim);
}

.ing-search::placeholder { color: var(--text-muted); }

.ing-count-badge {
  position: absolute;
  right: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 100px;
}

.ing-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.ing-category {
  margin-bottom: 48px;
}

.cat-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.cat-count {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: auto;
}

.ing-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ing-row:last-child { border-bottom: none; }

.ing-name {
  min-width: 200px;
  max-width: 220px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  padding-top: 2px;
  flex-shrink: 0;
}

.ing-recipes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipe-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}

.recipe-chip:hover {
  border-color: var(--green-dim);
  color: var(--text);
  background: var(--surface2);
}

.chip-meal { font-size: 0.8em; }
.chip-title { white-space: nowrap; }

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

@media (max-width: 580px) {
  .ing-row {
    flex-direction: column;
    gap: 8px;
  }
  .ing-name {
    min-width: unset;
    max-width: unset;
  }
}

/* footer */
footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

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