/* recipes SPA styles — readable, responsive, print-friendly. */

:root {
  --bg: #faf9f7;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --accent: #b3541e;
  --accent-dark: #8f4014;
  --accent-soft: #f3e8dd;
  --border: #e2ddd6;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
/* Any author `display` rule overrides the UA stylesheet's [hidden] rule, so
 * the `display: flex` above silently re-shows a hidden header. Opt the
 * hidden attribute back in (other toggled elements — #toast, .form-error,
 * #more-btn — set no `display`, so the UA rule still applies to them). */
header[hidden] { display: none; }
header h1 { margin: 0; font-size: 1.25rem; }
header h1 a { color: var(--text); text-decoration: none; }
header nav { display: flex; gap: 1rem; align-items: center; }

main {
  max-width: 46rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
h2 { margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.card h3 { margin: 0 0 0.25rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }

.meta { color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0; }
.description { white-space: pre-line; }
.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.search-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  margin-bottom: 1rem;
}

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

input, select, textarea, button { font: inherit; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: #fff;
  color: var(--text);
}
input[type="search"], input[type="text"] { flex: 1; min-width: 10rem; }

button, .btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  color: var(--text);
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); color: #fff; }
button.danger, .btn.danger { color: var(--danger); border-color: #e5b6b3; }
a.btn { text-decoration: none; display: inline-block; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0; }
.chip {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.chip button {
  border: none;
  background: none;
  color: inherit;
  padding: 0 0.2rem;
  cursor: pointer;
  font-size: 1rem;
}

label { display: block; margin: 0.5rem 0 0.25rem; font-weight: 600; }
label input, label textarea { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.ing-row input { flex: 1; min-width: 4rem; }
.ing-row input[name="ing_text"] { flex: 2; }
.instr-row { margin-bottom: 0.4rem; }
.instr-row textarea { flex: 1; }

.login-box {
  max-width: 22rem;
  margin: 4rem auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}
.login-box input { width: 100%; }
.form-error, .error { color: var(--danger); }
.empty { color: var(--muted); }

.ingredients li, .instructions li { margin-bottom: 0.3rem; }
.notes { white-space: pre-line; }
.recipe-img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
#import-file { flex: 1; min-width: 12rem; }

#toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 100;
}

@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  header nav { gap: 0.6rem; }
}

@media print {
  header, .no-print, #toast { display: none !important; }
  body { background: #fff; }
  main { max-width: 100%; margin: 0; }
  .search-bar { display: none; }
  a { color: var(--text); text-decoration: none; }
}