:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f1b16;
  --muted: #6b6259;
  --accent: #b4462b;
  --accent-text: #ffffff;
  --border: #e4ddd2;
  --note-bg: #fff4d6;
  --error: #b3261e;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --surface: #221e1b;
    --text: #f2ece4;
    --muted: #b3a99d;
    --accent: #ef8a6a;
    --accent-text: #1a0f0b;
    --border: #3a332d;
    --note-bg: #3a2f17;
    --error: #ffb4ab;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* Not sticky or fixed: HomeView's screen is short. */
header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 16px;
  border-bottom: 1px solid var(--border);
}
header.site nav { display: flex; gap: 1rem; align-items: center; }
header.site form { margin: 0; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }

main { max-width: 720px; margin: 0 auto; padding: 1rem 16px 3rem; }

a { color: var(--accent); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0.5rem 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 1.75rem 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 0.25rem; color: var(--muted); }

.lede { font-size: 1.1rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; color: var(--muted); }

.next-time {
  background: var(--note-bg);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.next-time h2 { margin-top: 0; font-size: 1.1rem; }
.next-time ul { margin: 0; padding-left: 1.2rem; }

.ingredients li, .steps li { margin: 0.35rem 0; }
.steps li { font-size: 1.15rem; padding-left: 0.25rem; margin: 0.75rem 0; }

.scale, .units { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.scale input { width: 5.5rem; }

.stack { display: flex; flex-direction: column; gap: 0.35rem; }
.stack > button { margin-top: 0.5rem; align-self: flex-start; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.row > .stack { flex: 1 1 8rem; }

label { font-weight: 600; }
input, textarea, button { font: inherit; }
input, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

button {
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}
button.link {
  min-height: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font-weight: 400;
  text-decoration: underline;
}

.rating { border: 0; padding: 0; margin: 0.5rem 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.rating legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
.rating label { font-weight: 400; display: flex; align-items: center; gap: 0.3rem; min-height: 44px; }
.rating input { width: auto; }

.cooked { border-top: 1px solid var(--border); margin-top: 2rem; }
.history { padding-left: 1.2rem; }
.history li { margin: 0.5rem 0; }

.recipe-list { padding-left: 1.2rem; }
.recipe-list li { margin: 0.4rem 0; font-size: 1.15rem; }

.error { color: var(--error); font-weight: 600; }

/* HomeView: short, square-ish screen. Tighten vertical space. */
@media (max-height: 480px) {
  main { padding-top: 0.5rem; }
  h1 { font-size: 1.6rem; margin-top: 0.25rem; }
  header.site { padding-block: 0.4rem; }
}
