/* ---------- Tokens (dark only) ---------- */
:root {
  --bg: #08070a;
  --bg-elev: #0d0c10;
  --surface: #121116;
  --surface-2: #17161c;
  --ink: #ece6d8;
  --ink-soft: #c9c1b0;
  --muted: #7a7263;
  --line: #201e26;
  --line-strong: #2e2b36;
  --accent: #e07a5f;
  --accent-ink: #0a0910;
  --accent-soft: #3a2119;
  --accent-tint: #17110f;
  --check: #9fb872;
  --check-soft: #22301c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --radius-sm: 10px;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  color: var(--ink);
  letter-spacing: -0.005em;
}

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0 1.1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(10px);
}

.header-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  justify-content: space-between;
}

.header-titles { min-width: 0; flex: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.15rem;
}

.site-header h1 {
  margin: 0.15rem 0;
  font-size: 1.9rem;
  line-height: 1.15;
}

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

.meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.back-link:hover { text-decoration: underline; }

/* ---------- Wake lock badge ---------- */
.wake-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}

.wake-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--check);
  box-shadow: 0 0 0 0 rgba(159, 184, 114, 0.5);
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(159, 184, 114, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(159, 184, 114, 0); }
  100% { box-shadow: 0 0 0 0 rgba(159, 184, 114, 0); }
}

/* ---------- Recipe list ---------- */
#recipe-list { padding: 1.25rem 0 2.5rem; }

.category-group + .category-group { margin-top: 1.75rem; }

.category-heading {
  margin: 0 0 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding-left: 0.15rem;
}

.recipe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.15s ease;
  overflow: hidden;
}

.recipe-card a {
  display: block;
  padding: 1rem 1.15rem;
  color: inherit;
  text-decoration: none;
}

.recipe-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.recipe-card:active { transform: scale(0.995); }

.recipe-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}

.recipe-card p {
  margin: 0 0 0.4rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.recipe-card .card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Recipe body ---------- */
.recipe-body {
  padding: 1.5rem 1.25rem 3.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.reset-btn {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.check-list, .step-list {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.step-list { counter-reset: step; }

.check-item, .step-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: start;
  will-change: transform;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.check-item.has-meta {
  grid-template-columns: auto 1fr auto;
}

.ing-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 2px;
  white-space: nowrap;
}

.aisle-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.opt-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0.8;
  cursor: help;
}

.opt-mark svg {
  width: 14px;
  height: 14px;
}

.check-item.done .aisle-badge,
.check-item.done .opt-mark {
  opacity: 0.4;
}

.aisle-source {
  margin: 0.5rem 0 -0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 480px) {
  .aisle-badge { font-size: 0.66rem; padding: 0.15rem 0.45rem; }
}

.check-item.done,
.step-item.done {
  background: var(--surface-2);
  opacity: 0.7;
}

.item-label {
  white-space: pre-line;
  cursor: pointer;
  color: var(--ink);
  transition: color 0.2s ease;
}

.check-item.done .item-label,
.step-item.done .item-label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
}

.check-item input[type="checkbox"],
.step-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--check);
  cursor: pointer;
}

.step-item .item-label::before {
  counter-increment: step;
  content: "Step " counter(step);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-sans);
}

/* ---------- Timer ---------- */
.timer {
  grid-column: 2;
  margin-top: 0.7rem;
  padding: 0.7rem 0.85rem;
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.timer .time {
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 4.5ch;
  color: var(--ink);
  font-family: var(--font-serif);
}

.timer.running .time { color: var(--accent); }
.timer.done .time { color: var(--check); }

.timer button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.timer button:hover { filter: brightness(1.1); }
.timer button:active { transform: scale(0.97); }

.timer button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.timer button.secondary:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.timer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.multi-fallback {
  flex-basis: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.15rem;
}

.multi-fallback a { color: var(--accent); }

/* ---------- Note ---------- */
.note {
  margin-top: 2.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.note code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 0.3rem;
  border-radius: 4px;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.55rem; }
  .section-head h2 { font-size: 1.2rem; }
  .wake-badge { display: none; }
}
