/* =========================================================================
   CookThis — single stylesheet
   Mobile-first. Light + dark via prefers-color-scheme. CSS custom properties
   for theming. No framework, no preprocessor.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --c-bg:        #fbfaf7;
  --c-bg-elev:   #ffffff;
  --c-bg-mute:   #f3efe8;
  --c-text:      #1c1c1c;
  --c-muted:     #666258;
  --c-line:      #e5e1d6;

  --c-accent:    #c5562a;          /* warm terracotta — food site */
  --c-accent-fg: #ffffff;
  --c-accent-mute: #f5e3d7;

  --c-lunch:     #2f7d62;          /* green for lunch */
  --c-lunch-mute:#dcefe5;
  --c-dinner:    #6a4cb1;          /* purple for dinner */
  --c-dinner-mute:#e7dffb;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);

  --content-max: 1100px;
  --content-pad: clamp(16px, 4vw, 32px);

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg:        #14130f;
    --c-bg-elev:   #1c1b17;
    --c-bg-mute:   #23211c;
    --c-text:      #ece7dc;
    --c-muted:     #a39d8e;
    --c-line:      #2f2c25;

    --c-accent:    #ec7a4a;
    --c-accent-fg: #14130f;
    --c-accent-mute: #3a261b;

    --c-lunch:     #6dc7a3;
    --c-lunch-mute:#1d342a;
    --c-dinner:    #b8a3f0;
    --c-dinner-mute:#2b2348;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 18px rgba(0,0,0,.5);
  }
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 4.2vw + 1rem, 3.2rem); }
h2 { font-size: clamp(1.4rem, 1.6vw + 1rem, 1.9rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

/* ---------- Layout ---------- */
.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 56px) var(--content-pad) 64px;
}

/* ---------- Header / footer ---------- */
.site-header {
  border-bottom: 1px solid var(--c-line);
  background: var(--c-bg-elev);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}
.site-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 12px var(--content-pad);
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--c-text);
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.4rem; }

.site-nav {
  display: flex;
  gap: clamp(8px, 2vw, 20px);
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--c-muted);
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--c-text); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--c-text);
  border-bottom-color: var(--c-accent);
}

.site-footer {
  border-top: 1px solid var(--c-line);
  background: var(--c-bg-elev);
  margin-top: 48px;
}
.site-footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px var(--content-pad);
  color: var(--c-muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0 0 4px; }
.site-footer-meta { font-size: 0.85rem; opacity: .8; }

/* ---------- Hero / page heads ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-accent);
  margin: 0 0 12px;
}
.lede {
  font-size: clamp(1.05rem, 0.6vw + 0.95rem, 1.25rem);
  color: var(--c-muted);
  max-width: 56ch;
}
.hero { margin-bottom: 48px; }
.hero h1 { max-width: 22ch; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.page-head { margin-bottom: 32px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform .05s ease, background .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-line);
}
.btn-ghost:hover { background: var(--c-bg-mute); }

/* ---------- Weekly menu grid ---------- */
.week { margin-bottom: 56px; }
.week-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 720px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .week-grid { grid-template-columns: repeat(5, 1fr); }
}
.day {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.day-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  margin: 0 0 4px;
}

.meal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--c-bg-mute);
  color: var(--c-text);
  border: 1px solid transparent;
  transition: transform .06s ease, border-color .15s ease, box-shadow .15s ease;
}
.meal-card:hover {
  text-decoration: none;
  border-color: var(--c-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.meal-card--lunch  { background: var(--c-lunch-mute); }
.meal-card--dinner { background: var(--c-dinner-mute); }

.meal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-muted);
}
.meal-card-emoji { font-size: 1.4rem; }
.meal-card-meal { font-weight: 700; }

.meal-card--lunch  .meal-card-meal { color: var(--c-lunch); }
.meal-card--dinner .meal-card-meal { color: var(--c-dinner); }

.meal-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0;
}
.meal-card-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.8rem;
  color: var(--c-muted);
}
.meal-card-meta li::after { content: " ·"; }
.meal-card-meta li:last-child::after { content: ""; }

/* ---------- Rules section on home ---------- */
.rules { margin-top: 56px; }
.rule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (min-width: 720px) {
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .rule-grid { grid-template-columns: repeat(4, 1fr); }
}
.rule {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.rule h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  margin: 0 0 6px;
}
.rule p {
  color: var(--c-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Recipes index ---------- */
.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  margin-right: 4px;
}
.chip {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--c-accent); }
.chip[aria-pressed="true"] {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  border-color: var(--c-accent);
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
}
.recipe-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  transition: transform .06s ease, box-shadow .15s ease, border-color .15s ease;
}
.recipe-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--c-accent);
}
.recipe-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.recipe-card-emoji { font-size: 2rem; }
.recipe-card-pill {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--c-bg-mute);
  color: var(--c-muted);
}
.recipe-card--lunch  .recipe-card-pill { background: var(--c-lunch-mute);  color: var(--c-lunch); }
.recipe-card--dinner .recipe-card-pill { background: var(--c-dinner-mute); color: var(--c-dinner); }

.recipe-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
}
.recipe-card-blurb {
  color: var(--c-muted);
  font-size: 0.95rem;
  margin: 0;
}
.recipe-card-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.85rem;
  color: var(--c-muted);
}
.recipe-card-meta li::after { content: " ·"; }
.recipe-card-meta li:last-child::after { content: ""; }
.recipe-card-tags {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.recipe-card-tags li {
  font-size: 0.72rem;
  color: var(--c-muted);
  background: var(--c-bg-mute);
  border-radius: 999px;
  padding: 2px 8px;
}

.empty {
  color: var(--c-muted);
  background: var(--c-bg-mute);
  padding: 24px;
  border-radius: var(--r-md);
  text-align: center;
}

/* ---------- Recipe detail ---------- */
.recipe-page { max-width: 820px; }
.recipe-head { margin-bottom: 24px; }
.recipe-head-flex {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.recipe-head-emoji {
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}
.recipe-head h1 { margin-top: 0; }

.recipe-stats {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.recipe-stats li {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-muted);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.callout {
  border-left: 3px solid var(--c-accent);
  background: var(--c-accent-mute);
  padding: 14px 16px;
  border-radius: var(--r-sm);
  margin: 0 0 24px;
}
.callout h2 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 4px;
  color: var(--c-accent);
}
.callout p { margin: 0; }

.recipe-section { margin-bottom: 28px; }
.recipe-section h2 { margin-bottom: 12px; }
.recipe-section-meta {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin: -6px 0 10px;
}

.ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 16px;
}
@media (min-width: 600px) {
  .ingredients { grid-template-columns: 1fr 1fr; }
}
.ingredients li {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
}
.ingredient-qty {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
  min-width: 78px;
}
.ingredient-item {
  flex: 1;
}

.method {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}
.method li {
  position: relative;
  padding: 8px 0 16px 44px;
  border-bottom: 1px solid var(--c-line);
  counter-increment: step;
}
.method li:last-child { border-bottom: 0; }
.method li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.back-link {
  margin-top: 32px;
  font-size: 0.95rem;
}

/* ---------- Shopping list ---------- */
.shopping {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 720px) {
  .shopping { grid-template-columns: repeat(2, 1fr); }
}
.aisle {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.aisle-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  margin: 0 0 12px;
}
.shopping-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shopping-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-line);
}
.shopping-item:last-child { border-bottom: 0; }
.shopping-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.shopping-check {
  accent-color: var(--c-accent);
  width: 16px;
  height: 16px;
}
.shopping-check:checked ~ .shopping-name,
.shopping-check:checked ~ .shopping-qty {
  text-decoration: line-through;
  color: var(--c-muted);
}
.shopping-qty {
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
  font-size: 0.9rem;
  min-width: 70px;
}
.shopping-name {
  flex: 1;
  font-size: 0.95rem;
}
.shopping-source {
  font-size: 0.75rem;
  color: var(--c-muted);
  padding-left: 26px;
}

/* ---------- Prose (about page) ---------- */
.prose section { margin-bottom: 24px; }
.prose section h2 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.prose section p { color: var(--c-muted); }
.prose section ul {
  color: var(--c-muted);
  padding-left: 18px;
}
.prose code {
  background: var(--c-bg-mute);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
