@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --bg:     #faf8f3;
  --text:   #2a1a0e;
  --muted:  #7a6552;
  --rule:   #c4a882;
  --accent: #8b4513;
  --max:    660px;
}

/* system dark — only when user hasn't made an explicit choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:     #1c1712;
    --text:   #e8e0d0;
    --muted:  #9e8e78;
    --rule:   #5a4a36;
    --accent: #c8895a;
  }
}

/* explicit dark override */
:root[data-theme="dark"] {
  --bg:     #1c1712;
  --text:   #e8e0d0;
  --muted:  #9e8e78;
  --rule:   #5a4a36;
  --accent: #c8895a;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

/* ── Base ────────────────────────────────────────────────────────────────── */

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', Georgia, serif;
  line-height: 1.75;
  padding: 3.5rem 1.5rem 6rem;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.container {
  max-width: var(--max);
  margin: 0 auto;
}

/* ── Recipe hero image ───────────────────────────────────────────────────── */

.recipe-hero-wrap {
  margin-bottom: 1.75rem;
  text-align: center;
}

.recipman-recipe {
  display: block;
  margin: 0 auto 0.5rem;
  width: clamp(50px, 12vw, 80px);
  height: auto;
}

.recipman-recipe--solo {
  margin-bottom: 1.75rem;
}

.recipe-hero {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border: 1px solid var(--rule);
}

@media (max-width: 480px) {
  .recipe-hero {
    max-height: 260px;
  }
}

/* ── Back link ───────────────────────────────────────────────────────────── */

.back-link {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
}

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

/* ── Recipe header ───────────────────────────────────────────────────────── */

.recipe-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 0.75rem;
}

.recipe-meta {
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  border: none;
  height: auto;
  background: none;
  margin: 2.25rem 0;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

hr.divider:nth-of-type(5n+1)::before {
  content: '🥄 🍳 🧄 🫒 🍋 🥗 🧂 🍅 🫙 🌿 🫐 🍄 🥕 🫑 🍯 🥑 🍇 🧅 🥦 🍞 🥄 🍳 🧄 🫒 🍋 🥗 🧂 🍅 🫙 🌿 🫐 🍄 🥕 🫑 🍯 🥑 🍇 🧅 🥦 🍞';
}
hr.divider:nth-of-type(5n+2)::before {
  content: '🍳 🫐 🥕 🧄 🍇 🫙 🥗 🍅 🌿 🍄 🥄 🫑 🍯 🧂 🥑 🍋 🧅 🥦 🍞 🫒 🍳 🫐 🥕 🧄 🍇 🫙 🥗 🍅 🌿 🍄 🥄 🫑 🍯 🧂 🥑 🍋 🧅 🥦 🍞 🫒';
}
hr.divider:nth-of-type(5n+3)::before {
  content: '🌿 🍋 🫑 🍄 🥄 🧅 🍞 🥗 🫒 🧂 🍳 🥑 🫐 🍅 🥕 🍇 🫙 🧄 🍯 🥦 🌿 🍋 🫑 🍄 🥄 🧅 🍞 🥗 🫒 🧂 🍳 🥑 🫐 🍅 🥕 🍇 🫙 🧄 🍯 🥦';
}
hr.divider:nth-of-type(5n+4)::before {
  content: '🥦 🍯 🫐 🧄 🍳 🫒 🥕 🌿 🍋 🧂 🫑 🍄 🥗 🥑 🫙 🍇 🍞 🧅 🥄 🍅 🥦 🍯 🫐 🧄 🍳 🫒 🥕 🌿 🍋 🧂 🫑 🍄 🥗 🥑 🫙 🍇 🍞 🧅 🥄 🍅';
}
hr.divider:nth-of-type(5n+5)::before {
  content: '🍇 🥕 🍞 🍅 🧅 🫒 🌿 🍄 🥄 🍋 🥗 🧄 🫐 🫙 🥦 🍯 🥑 🧂 🍳 🫑 🍇 🥕 🍞 🍅 🧅 🫒 🌿 🍄 🥄 🍋 🥗 🧄 🫐 🫙 🥦 🍯 🥑 🧂 🍳 🫑';
}

/* ── Section label ───────────────────────────────────────────────────────── */

.section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

/* ── Ingredients ─────────────────────────────────────────────────────────── */

.ingredients-list {
  list-style: none;
  padding: 0;
}

.ingredients-list li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.1rem;
  font-size: 1rem;
}

.ingredients-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 1.1em;
  line-height: 1.5;
}


/* ── Steps ───────────────────────────────────────────────────────────────── */

.steps-list {
  list-style: none;
  padding: 0;
  counter-reset: steps;
}

.steps-list li {
  counter-increment: steps;
  position: relative;
  padding: 0 0 1.75rem 3rem;
}

.steps-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 2.2rem;
  text-align: right;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--rule);
  line-height: 1.2;
}

.steps-list li:last-child {
  padding-bottom: 0;
}

/* ── Quantities ──────────────────────────────────────────────────────────── */

.qty {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05em;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* ── Notes ───────────────────────────────────────────────────────────────── */

.notes-text {
  font-style: italic;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Source ──────────────────────────────────────────────────────────────── */

.source-line {
  font-size: 0.72rem;
  color: var(--rule);
  text-align: center;
  font-style: italic;
}

.source-line a {
  color: var(--rule);
  word-break: break-all;
}

/* ── Index: site title ───────────────────────────────────────────────────── */

.site-title {
  font-size: clamp(2.2rem, 9vw, 3.75rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.recipman {
  display: block;
  margin: 0.75rem auto 0.5rem;
  width: clamp(120px, 30vw, 220px);
  height: auto;
}

.site-title-me {
  text-decoration: underline;
}

.site-subtitle {
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}

/* ── Index: grouped sections ─────────────────────────────────────────────── */

.meal-section {
  margin-bottom: 2rem;
}

.meal-section.hidden {
  display: none;
}

.meal-heading {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.category-group {
  margin-bottom: 1.25rem;
}

.category-group.hidden {
  display: none;
}

.category-heading {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.1rem;
}

/* ── Index: search ───────────────────────────────────────────────────────── */

.search-input {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 1.5rem auto 0;
  padding: 0.55rem 0.85rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus {
  border-color: var(--accent);
}

/* ── Index: recipe list ──────────────────────────────────────────────────── */

.recipe-list {
  list-style: none;
  padding: 0;
}

.recipe-list a {
  display: block;
  padding: 0.8rem 0.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  transition: padding-left 0.12s ease, color 0.12s ease;
}

.recipe-list a:hover {
  color: var(--accent);
  padding-left: 0.75rem;
}

.recipe-list li.hidden {
  display: none;
}

/* ── Responsive: iPad ────────────────────────────────────────────────────── */

@media (min-width: 768px) {
  body {
    padding: 4.5rem 2.5rem 7rem;
  }
}

/* ── Responsive: iPhone ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 2rem 1.1rem 4rem;
  }

  .recipe-title {
    font-size: 1.75rem;
  }

  .steps-list li {
    padding-left: 2.5rem;
  }

  .steps-list li::before {
    font-size: 1.25rem;
    width: 1.9rem;
  }
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--rule);
  white-space: nowrap;
  line-height: 1;
  transition: border-color 0.12s, box-shadow 0.08s, transform 0.08s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
}

.theme-toggle:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

@media (max-width: 480px) {
  .theme-toggle {
    top: 0.6rem;
    right: 0.6rem;
    font-size: 0.58rem;
    padding: 0.35rem 0.65rem;
    box-shadow: 1px 1px 0 var(--rule);
  }
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    padding: 0;
  }

  .back-link,
  .search-input,
  .theme-toggle {
    display: none;
  }

  .divider {
    background: #999;
  }

  .divider::before {
    background: #fff;
    color: #999;
  }

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

  .source-line a::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
  }
}
