/* No Spam Recipes — "Native Grouped" (design direction 06).
   iOS-style grouped lists: soft gray canvas, white rounded groups,
   hairline separators, segmented controls, green toggles. No pictures. */

:root {
  --bg: #f2f2f7;            /* grouped-table canvas */
  --card: #ffffff;          /* group background */
  --ink: #1c1c1e;
  --ink-soft: #6d6d72;
  --ink-faint: #8e8e93;
  --line: #ececf0;          /* hairline separator */
  --accent: #007aff;        /* iOS blue */
  --accent-hover: #005ecb;
  --good: #34c759;          /* toggle green */
  --warn: #ff9500;
  --seg-bg: #e4e4ea;        /* segmented track */
  --radius: 14px;
  --radius-sm: 10px;
  --max: 680px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #f2f2f7;
    --ink-soft: #a1a1a6;
    --ink-faint: #8e8e93;
    --line: #2c2c2e;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --good: #30d158;
    --seg-bg: #2c2c2e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

main, .site-header, .site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---- header: large-title nav bar ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 10px;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.site-nav { display: flex; gap: 18px; font-size: 0.95rem; }
.site-nav a { color: var(--accent); font-weight: 600; }
.site-nav a:hover { text-decoration: none; }

/* ---- hero ---- */
.hero { padding: 2.5vh 0 0.8rem; text-align: left; }
.hero h1 {
  font-size: clamp(2rem, 7vw, 2.6rem);
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 0.35rem;
}
.hero .sub { color: var(--ink-soft); margin: 0 0 1.2rem; max-width: 50ch; font-size: 0.98rem; }

/* ---- inputs: inset search field ---- */
.search { display: flex; gap: 10px; }
.search input, .stack input[type="email"], .stack input[type="text"], .inline input[type="text"] {
  flex: 1;
  min-width: 0;
  width: 100%;
  font-size: 1.05rem;
  padding: 12px 15px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--seg-bg);
  color: var(--ink);
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus, .stack input:focus, .inline input:focus {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--card);
}
button, .search button, .stack button, .inline button, .actions button, .plus button {
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:active { opacity: 0.8; }
button.quiet {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line) inset;
}
button.quiet:hover { background: var(--bg); }

/* ---- segmented control ---- */
.seg {
  display: flex;
  background: var(--seg-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin: 0.9rem 0 0.2rem;
}
.seg a {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seg a:hover { text-decoration: none; }
.seg a.on {
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ---- section labels (grouped-table headers) ---- */
.categories h2, .results h2, .recipe h2, .admin h2, .about h2, .group-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 1.6rem 4px 0.45rem;
}

/* ---- grouped list container + rows ---- */
.group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 0.4rem;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
}
.row:last-child { border-bottom: 0; }
a.row:hover { text-decoration: none; background: color-mix(in srgb, var(--line) 40%, var(--card)); }
.row .value { color: var(--ink-faint); font-size: 0.98rem; white-space: nowrap; }
.row .value::after { content: " ›"; color: var(--ink-faint); }
.row .value.plain::after { content: ""; }
.row .value.wrap { white-space: normal; text-align: right; }

/* ---- dish summary + fork ratings (fully green fork = 5) ---- */
.dish-sub { color: var(--ink-soft); margin: 0.2rem 0 0.4rem; font-size: 1.02rem; max-width: 56ch; }
.rate-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 10px 16px; margin: 0.7rem 0 0.4rem; flex-wrap: wrap;
}
.rate-avg { font-weight: 600; color: var(--good); display: inline-flex; align-items: center; gap: 7px; }
.rate-avg .meta { font-weight: 400; }
/* small inline fork marker (result cards, meta lines) */
.fork-ico {
  display: inline-block; width: 9px; height: 19px; background: var(--good);
  vertical-align: -4px;
  -webkit-mask: url(fork.svg) no-repeat center / contain;
          mask: url(fork.svg) no-repeat center / contain;
}
/* the gauge: gray fork that fills green bottom-up with the average */
.fork-gauge {
  position: relative; display: inline-block; width: 15px; height: 32px;
  background: var(--seg-bg);
  -webkit-mask: url(fork.svg) no-repeat center / contain;
          mask: url(fork.svg) no-repeat center / contain;
}
.fork-gauge .fork-fill { position: absolute; inset: 0; background: var(--good); }
/* tap-to-rate: five forks, half-fork steps */
.rate-row { display: flex; gap: 0; align-items: center; }
.rate-h {
  width: 14px; height: 40px; padding: 0; border: 0; cursor: pointer;
  background: var(--seg-bg);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: auto 40px; mask-size: auto 40px;
}
.rate-h.L {
  -webkit-mask-image: url(fork-left.svg); mask-image: url(fork-left.svg);
  -webkit-mask-position: right center; mask-position: right center;
}
.rate-h.R {
  -webkit-mask-image: url(fork-right.svg); mask-image: url(fork-right.svg);
  -webkit-mask-position: left center; mask-position: left center;
  margin-right: 6px;
}
.rate-h.on { background: var(--good); }
.rate-h:hover { background: var(--accent); }

/* ---- categories as grouped rows ---- */
.chips { list-style: none; padding: 0; margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.chips li { border-bottom: 1px solid var(--line); }
.chips li:last-child { border-bottom: 0; }
.chips a {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}
.chips a:hover { background: color-mix(in srgb, var(--line) 40%, var(--card)); text-decoration: none; }
.chips .count { color: var(--ink-faint); font-weight: 400; }
.chips .count::after { content: " ›"; }

/* ---- result cards: grouped list ---- */
.cards { list-style: none; padding: 0; margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; display: block; }
.cards li { border-bottom: 1px solid var(--line); }
.cards li:last-child { border-bottom: 0; }
.cards a { display: block; padding: 12px 16px; color: var(--ink); }
.cards a:hover { text-decoration: none; background: color-mix(in srgb, var(--line) 40%, var(--card)); }
.cards h3 { margin: 0; font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.meta { color: var(--ink-faint); font-size: 0.88rem; margin: 0.15rem 0; }
.empty { color: var(--ink-soft); padding: 2.5rem 0; text-align: center; }
.results { padding-top: 0.8rem; }
.results h1, .grocery h1, .plan h1, .admin h1 { letter-spacing: -0.02em; }

/* ---- recipe page ---- */
.recipe h1 {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  letter-spacing: -0.03em;
  font-weight: 800;
  margin-bottom: 0.2rem;
}
.ingredients ul, .steps ol {
  margin: 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 6px 16px 6px 2.2rem;
}
.ingredients li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.steps li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.nutrition, .swap, .variations {
  margin-top: 1.2rem;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--card);
}
.nutrition summary, .swap summary, .variations summary { cursor: pointer; font-weight: 600; font-size: 1rem; }
.nutrition table { margin-top: 8px; border-collapse: collapse; }
.nutrition th { text-align: left; font-weight: 400; color: var(--ink-soft); padding: 3px 18px 3px 0; }
.attribution { margin-top: 1.6rem; color: var(--ink-faint); font-size: 0.88rem; }

/* ---- forms & account ---- */
.narrow { max-width: 480px; margin: 0 auto; padding-top: 1.6rem; }
.stack { display: grid; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; color: var(--ink-soft); }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--good); }
.inline { display: flex; gap: 8px; margin-top: 0.6rem; }
.plain { list-style: none; padding: 0; }
.plain li { padding: 4px 0; }
.qa-note {
  margin-top: 1.2rem;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 14%, var(--card));
}
.plan { padding: 12px 16px; border-radius: var(--radius); background: var(--card); }
.plan-plus { box-shadow: 0 0 0 1.5px var(--good) inset; }
.logout { margin-top: 2.5rem; }
.actions { display: flex; gap: 8px; align-items: center; margin: 0.9rem 0 0.4rem; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions button, .actions .btn-link { padding: 9px 14px; font-size: 0.92rem; border-radius: 999px; }
.add-to summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.btn-link { font-weight: 600; background: var(--card); border-radius: 999px; padding: 9px 14px; box-shadow: 0 0 0 1px var(--line) inset; }
.plus .features { padding-left: 1.2rem; }
.plus .features li { padding: 3px 0; }
.price { font-size: 1.25rem; }

/* ---- diet: badges, filters, swaps ---- */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.4rem 0 0; }
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--warn);
  border-radius: 6px;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--warn) 14%, var(--card));
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 0.8rem 0 0.3rem; }
.filter-chip {
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.filter-chip:hover { text-decoration: none; }
.filter-chip.on {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}
.swap summary { color: var(--accent); }
.swap ul { padding-left: 1.2rem; margin: 0.5rem 0 0.2rem; }
.swap li { padding: 3px 0; }
.prefs { display: grid; gap: 10px; margin: 0.4rem 0; background: var(--card); border-radius: var(--radius); padding: 12px 16px; }
.prefs .check { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.prefs .check:last-of-type { border-bottom: 0; }
.prefs button { justify-self: start; }

/* ---- planner & grocery ---- */
.plan-day {
  margin: 1.5rem 4px 0.3rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.plan-slot { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.slot-name { color: var(--ink-soft); font-size: 0.85rem; min-width: 76px; text-transform: capitalize; }
.plan-slot ul { margin: 0; }
.plan-slot li { display: flex; gap: 6px; align-items: center; }
.inline-rm { display: inline; margin: 0; }
button.xs { padding: 2px 10px; font-size: 0.85rem; border-radius: 8px; }
.checklist { list-style: none; padding: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.checklist li { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
.checklist input { width: 20px; height: 20px; accent-color: var(--good); }
.checklist input:checked + span { text-decoration: line-through; color: var(--ink-faint); }
.scale-row { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 0 4px 0.4rem; }
.scale-opt { font-weight: 600; }
.cook-link { font-size: 0.85rem; margin-left: 10px; font-weight: 600; }
.plan-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.plan-form select {
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--seg-bg);
  color: var(--ink);
  font-size: 0.95rem;
}

/* ---- footer ---- */
.site-footer {
  margin-top: 3.5rem;
  color: var(--ink-faint);
  font-size: 0.86rem;
  padding-top: 1.4rem;
  padding-bottom: 2.6rem;
  border-top: 1px solid var(--line);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin: 0.7rem 0; }
.site-footer a { color: var(--accent); font-weight: 500; }
.site-footer .promise { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.fine { font-size: 0.8rem; }

/* pager */
.pager { display: flex; justify-content: space-between; margin: 1.2rem 0; }
.pager-link {
  padding: .7rem 1.3rem;
  background: var(--card);
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line) inset;
}
.pager-link:hover { text-decoration: none; }
.pager-link.next { margin-left: auto; }

/* filter chips: one swipeable row on phones */
@media (max-width: 720px) {
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter-chip { white-space: nowrap; flex: 0 0 auto; }
  .search button { padding-left: 1rem; padding-right: 1rem; }
  .pager-link { padding: .8rem 1.4rem; }
}

/* streaks */
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: .5rem 1rem; border-radius: 999px;
  background: var(--warn); color: #fff; font-weight: 600;
}
.streak-card {
  background: var(--card); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1.2rem 0;
}
.streak-big { font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
.streak-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: .5rem; }

/* variations */
.variation-note {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  padding: .7rem 1rem; border-radius: var(--radius);
}

/* range preset links inside grouped rows */
.rangelink {
  display: inline-block;
  padding: 5px 10px;
  margin-left: 4px;
  border-radius: 8px;
  background: var(--seg-bg);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
}
.rangelink:hover { text-decoration: none; }
.rangelink.on { background: var(--accent); color: #fff; }

/* platform share grid */
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: .6rem; }
.share-btn {
  padding: 10px 4px; font-size: 0.82rem; font-weight: 600;
  background: var(--seg-bg); color: var(--ink); border: 0; border-radius: var(--radius-sm);
}
.share-btn:hover { background: var(--line); }
@media (max-width: 420px) { .share-grid { grid-template-columns: repeat(2, 1fr); } }

/* All-filters grouped panel */
.allfilters {
  background: var(--card); border-radius: var(--radius);
  padding: 12px 16px; margin-top: 0.6rem;
}
.allfilters summary { cursor: pointer; font-weight: 600; font-size: 1rem; }
.fgroup {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.fgroup:last-of-type { border-bottom: 0; }
.fgroup-label { flex: 0 0 92px; font-size: 0.86rem; color: var(--ink-soft); font-weight: 600; }
.fgroup-opts { display: flex; flex-wrap: wrap; gap: 6px; }

/* ingredient include/exclude form */
.ingform { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; display: grid; gap: 8px; }
.ingrow { display: flex; align-items: center; gap: 10px; }
.ingrow label { flex: 0 0 82px; font-size: 0.86rem; color: var(--ink-soft); font-weight: 600; }
.ingrow input { flex: 1; min-width: 0; font-size: 0.95rem; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); background: var(--seg-bg); color: var(--ink); }
.ingform button { justify-self: start; padding: 9px 14px; font-size: 0.9rem; }

/* pantry wizard */
.pantry { padding-top: 1rem; }
.pantry h1 { font-size: 1.7rem; letter-spacing: -0.02em; margin: 0.3rem 0 0.8rem; }
.steps-bar { display: flex; gap: 6px; }
.stepseg { flex: 1; height: 5px; border-radius: 3px; background: var(--seg-bg); }
.stepseg.done { background: var(--accent); }
.pantry-opts { display: flex; flex-wrap: wrap; gap: 9px; margin: 0.4rem 0 1rem; }
.pick {
  padding: 10px 14px; border-radius: 12px; font-size: 0.95rem; font-weight: 600;
  background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line) inset;
}
.pick:hover { text-decoration: none; }
.pick.on { background: var(--accent); color: #fff; box-shadow: none; }
.pantry-foot {
  margin-top: 1.4rem; background: var(--ink); color: var(--bg);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.foot-label { font-size: 0.72rem; letter-spacing: 0.1em; opacity: 0.7; font-weight: 700; }
.foot-count { font-size: 1.4rem; font-weight: 800; }
.foot-actions { display: flex; gap: 8px; align-items: center; }
.pantry-foot .pager-link { background: transparent; color: inherit; box-shadow: 0 0 0 1px rgba(255,255,255,0.35) inset; }
.foot-next {
  background: var(--good); color: #fff; font-weight: 700;
  padding: 12px 16px; border-radius: 12px; white-space: nowrap;
}
.foot-next:hover { text-decoration: none; color: #fff; }
.pantry-cta {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--card); border-radius: var(--radius);
  padding: 13px 16px; margin-top: 0.9rem; font-weight: 700; color: var(--ink);
}
.pantry-cta:hover { text-decoration: none; }

/* contribute + QA queue */
.stack textarea {
  font: inherit; font-size: 1rem; padding: 12px 15px; border: 0;
  border-radius: var(--radius-sm); background: var(--seg-bg); color: var(--ink); resize: vertical;
}
.stack textarea:focus { outline: none; background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.sub-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin: 0.6rem 0; }
.sub-card h3 { margin: 0 0 2px; }
.sub-qa { font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; color: var(--ink-soft); word-break: break-all; }
.sub-cols { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.sub-cols > div { flex: 1 1 220px; min-width: 0; }
.sub-cols ul, .sub-cols ol { margin: 4px 0 0; padding-left: 1.2rem; font-size: 0.9rem; }
.review-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.review-row input[type="text"] { flex: 1; min-width: 140px; font-size: 0.9rem; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--seg-bg); color: var(--ink); }
button.approve { background: var(--good); }
button.reject { background: #ff3b30; }
.gen-tag { font-size: 0.68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); background: var(--seg-bg); border-radius: 4px; padding: 1px 6px; vertical-align: 1px; }
