/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #faf9f7;
  --color-surface: #ffffff;
  --color-text: #2d2d2d;
  --color-text-muted: #666;
  --color-accent: #c0392b;
  --color-accent-light: #f9ebe9;
  --color-border: #e8e4df;
  --color-ingredient: #1a6b3c;
  --color-timer: #7a5c00;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, sans-serif;
  --max-width: 900px;
  --radius: 10px;
}

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

/* ===== Layout ===== */
header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
}

header nav {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

main {
  max-width: var(--max-width);
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

footer a { color: var(--color-text-muted); }

/* ===== Homepage ===== */
.home-header {
  margin-bottom: 2.5rem;
}

.home-header h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.home-subtitle {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.home-subtitle a { color: var(--color-accent); text-decoration: none; }
.home-subtitle a:hover { text-decoration: underline; }

/* ===== Recipe Grid ===== */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.recipe-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.recipe-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 16px rgba(192, 57, 43, 0.12);
  transform: translateY(-2px);
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-border);
}

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

.recipe-card:hover .card-image img {
  transform: scale(1.04);
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card-body h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.3;
}

.card-body p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.no-recipes {
  color: var(--color-text-muted);
  padding: 3rem 0;
  text-align: center;
}

/* ===== Tags ===== */
.recipe-tags, .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-weight: 500;
  text-transform: lowercase;
}

/* ===== Recipe Page ===== */
.recipe {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Hero image */
.recipe-hero {
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--color-border);
}

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

.recipe-header-body {
  padding: 2rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.recipe-header-body h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.recipe-description {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.meta-item svg { flex-shrink: 0; opacity: 0.6; }
.meta-item a { color: var(--color-accent); text-decoration: none; }
.meta-item a:hover { text-decoration: underline; }

/* ===== Two-column recipe body ===== */
.recipe-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
}

/* ===== Ingredients sidebar ===== */
.ingredients {
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
}

.ingredients h2,
.cookware-heading {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.cookware-heading {
  margin-top: 1.5rem;
}

.ingredient-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ingredient {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.ingredient:last-child {
  border-bottom: none;
}

.ingredient-amount {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-ingredient);
}

.cookware-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ===== Instructions ===== */
.instructions {
  padding: 2rem 2.5rem;
}

.instructions h2 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Section headers within steps */
.step-section {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}

.step-section:first-child {
  margin-top: 0;
}

/* Steps with CSS counter */
.step-list {
  counter-reset: step-counter;
}

.step {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}

.step:last-child {
  border-bottom: none;
}

.step-number {
  counter-increment: step-counter;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

.step-number::before {
  content: counter(step-counter);
}

.step p {
  line-height: 1.7;
  font-size: 0.975rem;
}

/* ===== Inline recipe tokens ===== */
.recipe--ingredient {
  color: var(--color-ingredient);
  font-weight: 600;
}

.recipe--cookware {
  font-style: italic;
  color: #555;
}

.recipe--timer {
  display: inline-block;
  background: #fff8e6;
  color: var(--color-timer);
  font-weight: 600;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid #f0e0a0;
}

.recipe--text { /* plain text — no extra styling */ }

/* ===== Back link ===== */
.back-link {
  display: inline-block;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

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

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .recipe-body {
    grid-template-columns: 1fr;
  }

  .ingredients {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem;
  }

  .ingredient-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .ingredient {
    border-bottom: none;
    background: var(--color-surface);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
  }

  .instructions { padding: 1.5rem; }

  .recipe-header-body {
    padding: 1.5rem;
  }

  .recipe-header-body h1 { font-size: 1.75rem; }
  .recipe-hero { aspect-ratio: 16 / 9; }
  .recipe-grid { grid-template-columns: 1fr; }
}
