/* ============================================================
   Overdraft Kitchen — Stylesheet
   ============================================================ */

/* Custom Properties
   ------------------------------------------------------------ */
:root {
  --bg:             #f4f1eb;
  --surface:        #ffffff;
  --border:         #dedad0;
  --border-subtle:  #eceae3;

  --text:           #1a1918;
  --text-muted:     #5c5856;
  --text-light:     #928e89;

  --accent:         #2a6130;
  --accent-dark:    #1e4a24;
  --accent-mid:     #3d7d45;
  --accent-light:   #edf4ee;
  --accent-border:  #b5d4bc;

  --cost:           #7a5410;
  --cost-bg:        #fdf7e8;
  --cost-border:    #e8d394;

  --header-bg:      #1c1a17;
  --header-text:    #f0ece4;
  --header-muted:   #9c9488;

  --gf:             #1a5c3a;
  --gf-bg:          #e8f4ed;
  --gf-border:      #a8d4b8;

  --radius-sm:      4px;
  --radius:         8px;
  --radius-lg:      14px;

  --shadow-sm:      0 1px 4px rgba(0, 0, 0, 0.07);
  --shadow:         0 3px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg:      0 6px 24px rgba(0, 0, 0, 0.12);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
               Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-dark); }

ul, ol { list-style: none; }

/* Layout
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

main {
  flex: 1;
  padding-block: 2.5rem 5rem;
}

/* Accessibility
   ------------------------------------------------------------ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--text);
  color: var(--surface);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 100;
}
.skip-link:focus { top: 0.75rem; }

/* Site Header
   ------------------------------------------------------------ */
.site-header {
  background: var(--header-bg);
  padding-block: 1.25rem;
  border-bottom: 3px solid var(--accent);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--header-text);
  text-decoration: none;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  line-height: 1;
}
.site-logo:hover { color: #fff; }

.site-tagline {
  font-size: 0.875rem;
  color: var(--header-muted);
  letter-spacing: 0.01em;
}

/* Site Footer
   ------------------------------------------------------------ */
.site-footer {
  background: var(--header-bg);
  border-top: 1px solid #2e2c28;
  padding-block: 1.5rem;
  margin-top: auto;
}

.site-footer p {
  font-size: 0.8125rem;
  color: var(--header-muted);
  text-align: center;
}

/* Index — Hero/About
   ------------------------------------------------------------ */
.site-about {
  margin-bottom: 0;
  padding: 2rem 1.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  text-align: center;
}

.site-about p {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-muted);
}

/* Index — Stats Strip
   ------------------------------------------------------------ */
.site-stats {
  display: flex;
  background: var(--accent);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--accent-mid);
  text-align: center;
}
.stat:last-child { border-right: none; }

.stat-value {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  margin-top: 0.2rem;
  letter-spacing: 0.01em;
}

/* Index — Recipes Section
   ------------------------------------------------------------ */
.recipes-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recipe-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0;
}

/* Tag Filter Bar
   ------------------------------------------------------------ */
.tag-filter-bar {
  padding: 1.25rem 1.375rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.tag-filter-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
  margin-bottom: 0.875rem;
}

.tag-filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.tag-filter-btn {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0.875rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.4;
}

.tag-filter-btn:hover {
  background: var(--border-subtle);
  color: var(--text);
  border-color: #c8c4bc;
}

.tag-filter-btn.active {
  background: var(--header-bg);
  color: #fff;
  border-color: var(--header-bg);
}

.tag-filter-clear {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.12s;
}

.tag-filter-clear:hover { color: var(--text-muted); }

.filter-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 2.5rem 0;
}

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

/* Recipe Cards
   ------------------------------------------------------------ */
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-top-color 0.15s ease;
}

.recipe-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-top-color: var(--accent-mid);
}

.recipe-card-cost {
  background: var(--cost-bg);
  border-bottom: 1px solid var(--cost-border);
  padding: 0.625rem 1.125rem;
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
}

.card-cost-per {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cost);
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-cost-label {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--cost);
  opacity: 0.75;
}

.card-total {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-left: auto;
}

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

.recipe-card-name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
}

.recipe-card-name a {
  color: var(--text);
  text-decoration: none;
}
.recipe-card-name a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.recipe-card-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.recipe-card-meta {
  display: flex;
  gap: 0.875rem;
  font-size: 0.8rem;
  color: var(--text-light);
  padding-top: 0.375rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

/* Tags
   ------------------------------------------------------------ */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  text-transform: lowercase;
  letter-spacing: 0.01em;
}

/* Recipe Page
   ------------------------------------------------------------ */
.recipe-page { max-width: 740px; }

.recipe-header {
  margin-bottom: 3rem;
  padding: 2rem 2rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.breadcrumb {
  font-size: 0.8125rem;
  margin-bottom: 1.125rem;
  color: var(--text-light);
}
.breadcrumb a { color: var(--accent); }

.recipe-header h1 {
  font-size: clamp(1.625rem, 4.5vw, 2.375rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.625rem;
}

.recipe-summary {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 1.625rem;
  line-height: 1.65;
  max-width: 58ch;
}

.recipe-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 82px;
  text-align: center;
}

.meta-item.meta-cost {
  background: var(--cost-bg);
  border-color: var(--cost-border);
}

.meta-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.meta-value {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.meta-cost .meta-value {
  color: var(--cost);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

/* Recipe Sections
   ------------------------------------------------------------ */
.recipe-section { margin-bottom: 2.75rem; }

.recipe-section h2 {
  font-size: 1rem;
  font-weight: 700;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.recipe-section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* Ingredients
   ------------------------------------------------------------ */
.ingredients-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ingredient-header,
.ingredient-row,
.ingredient-total {
  display: grid;
  grid-template-columns: 115px 1fr 76px;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  align-items: center;
}

.ingredient-header {
  background: var(--header-bg);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--header-muted);
  border-bottom: 1px solid #2a2824;
}

.ingredient-row {
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9375rem;
  transition: background 0.1s;
}
.ingredient-row:last-of-type { border-bottom: none; }
.ingredient-row:nth-child(even) { background: #faf9f6; }
.ingredient-row:hover { background: var(--accent-light); }

.ing-qty  { color: var(--text-muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.ing-name { color: var(--text); }
.ing-cost {
  text-align: right;
  color: var(--text-light);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.ingredient-total {
  background: var(--cost-bg);
  border-top: 2px solid var(--cost-border);
  font-weight: 700;
  font-size: 0.9375rem;
}
.ingredient-total span:last-child {
  text-align: right;
  color: var(--cost);
  font-variant-numeric: tabular-nums;
}

/* Instructions
   ------------------------------------------------------------ */
.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  counter-reset: steps;
}

.instruction-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.1s, box-shadow 0.1s;
}
.instruction-step:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-text {
  font-size: 0.9375rem;
  line-height: 1.65;
  padding-top: 3px;
}

/* Nutrition Grid
   ------------------------------------------------------------ */
.nutrition-note {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  font-style: italic;
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  margin-bottom: 1rem;
}

@media (min-width: 500px) {
  .nutrition-grid { grid-template-columns: repeat(6, 1fr); }
}

.nutrition-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.375rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--accent-border);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.nutrition-item:first-child {
  border-bottom-color: var(--accent);
}

.nutrition-value {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nutrition-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-top: 0.3rem;
  font-weight: 600;
}

.nutrition-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
}

/* Gluten-Free Section
   ------------------------------------------------------------ */
.gf-status {
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gf-status::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gf-natural {
  background: var(--gf-bg);
  border-color: var(--gf-border);
  color: var(--gf);
}
.gf-natural::before { background: var(--gf); }

.gf-modified {
  background: var(--cost-bg);
  border-color: var(--cost-border);
  color: var(--cost);
}
.gf-modified::before { background: var(--cost); }

.gf-subs {
  margin-block: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gf-subs li {
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.gf-cost-note {
  font-size: 0.8125rem;
  color: var(--text-light);
  display: block;
  margin-top: 0.2rem;
}

.gf-notes {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-left: 3px solid var(--border);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Budget Notes
   ------------------------------------------------------------ */
.budget-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.budget-notes-list li {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 0.625rem 0.875rem 0.625rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cost-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.55;
}

/* Pricing Metadata
   ------------------------------------------------------------ */
.pricing-meta {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.pricing-meta p {
  font-size: 0.8125rem;
  color: var(--text-light);
  font-style: italic;
}

/* Mobile
   ------------------------------------------------------------ */
@media (max-width: 600px) {
  .container { padding-inline: 1rem; }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .site-stats { flex-direction: column; }
  .stat { border-right: none; border-bottom: 1px solid var(--accent-mid); }
  .stat:last-child { border-bottom: none; }

  .site-about { padding: 1.25rem; }

  .recipe-header { padding: 1.25rem; }

  .recipe-meta-strip { gap: 0.4rem; }

  .meta-item {
    min-width: 72px;
    padding: 0.4rem 0.625rem;
  }

  .meta-value { font-size: 0.9375rem; }
  .meta-cost .meta-value { font-size: 1.0625rem; }

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

  .nutrition-grid { grid-template-columns: repeat(3, 1fr); }

  .ingredient-header,
  .ingredient-row,
  .ingredient-total {
    grid-template-columns: 85px 1fr 60px;
    font-size: 0.875rem;
  }

  .instruction-step { padding: 0.75rem; }
}

@media (max-width: 380px) {
  .ingredient-header,
  .ingredient-row,
  .ingredient-total {
    grid-template-columns: 72px 1fr 52px;
    font-size: 0.8125rem;
  }
}
