:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1c1a17;
  --text-muted: #5b5650;
  --border: #e4dfd7;
  --accent: #8a5a3b;
  --accent-soft: #f1e6da;
  --table-stripe: #f6f3ee;
  --warn-bg: #fdf2e3;
  --warn-border: #e8c48a;
  --link: #8a5a3b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --surface: #201c16;
    --text: #ece7de;
    --text-muted: #b3ab9e;
    --border: #3a332a;
    --accent: #d29a6e;
    --accent-soft: #2c2318;
    --table-stripe: #241f18;
    --warn-bg: #2c2416;
    --warn-border: #6b4f23;
    --link: #d29a6e;
  }
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.55;
  font-size: 16px;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

nav.site-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: 0.92rem;
}

nav.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
}

nav.site-nav a.active,
nav.site-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

nav.site-nav .spacer { flex: 1; }

h1, h2, h3, h4 {
  font-weight: 650;
  line-height: 1.25;
  color: var(--text);
}

h1[id], h2[id], h3[id], h4[id], table[id], tr[id] {
  scroll-margin-top: 4.5rem;
}

h1 { font-size: 1.7rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.25rem; margin: 2.2rem 0 0.8rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.75rem;
}

.intro { color: var(--text-muted); font-size: 0.95rem; }

.personal-note {
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.75rem;
  border-radius: 0 8px 8px 0;
}

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0 0 1.75rem;
}

.notice strong { display: block; margin-bottom: 0.25rem; }

p { margin: 0 0 1rem; }

a { color: var(--link); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

ul, ol {
  padding-left: 1.4rem;
  margin: 0 0 1rem;
}

li { margin-bottom: 0.3rem; }

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  min-width: 520px;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: var(--table-stripe); }

code {
  background: var(--accent-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
}

/* shopping list */

ul.checklist {
  list-style: none;
  padding-left: 0;
}

ul.checklist li {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.1rem;
}

ul.checklist label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  cursor: pointer;
}

ul.checklist input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  flex: none;
}

ul.checklist .item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

ul.checklist .qty {
  font-size: 0.82rem;
  color: var(--text-muted);
}

ul.checklist input:checked + .item-body {
  color: var(--text-muted);
}

ul.checklist input:checked + .item-body .item-name {
  text-decoration: line-through;
}

ul.checklist sup a {
  text-decoration: none;
  color: var(--accent);
  font-size: 0.75rem;
}

ol.references {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 1.4rem;
}

ol.references li { margin-bottom: 0.5rem; }

ol.references:target,
li:target,
tr:target,
h1:target, h2:target, h3:target, h4:target {
  background: var(--accent-soft);
}

ol.sources {
  padding-left: 1.4rem;
}

ol.sources li {
  margin-bottom: 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

ol.sources li:last-child {
  border-bottom: none;
}

.source-links {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.source-links a {
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.source-links a:hover {
  text-decoration: underline;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
}

button.reset-btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

button.reset-btn:hover { color: var(--text); border-color: var(--accent); }

.progress {
  font-size: 0.85rem;
  color: var(--text-muted);
  align-self: center;
}

.load-error {
  color: #b23b3b;
  font-size: 0.9rem;
}

@media print {
  nav.site-nav, .toolbar { display: none; }
  .page { max-width: none; padding: 0; }
}
