/* us.recipes: warm, readable, made for a phone propped up in the kitchen.
   Spacing comes from four tokens so every screen size lines up:
   --gutter  page edge to content (grows with the screen, respects the notch)
   --pad     inside every box (cards, lists, tips, notes)
   --gap     between blocks
   --gap-lg  between sections                                              */

:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-2: #efe7da;
  --ink: #2a2420;
  --ink-2: #6a6058;
  --line: #e3d9ca;
  --accent: #b14f27;
  --accent-ink: #ffffff;
  --accent-soft: #f5e1d5;
  --ok: #2f7a45;
  --ok-soft: #e1efe3;
  --warn: #8a5d00;
  --warn-soft: #fbefd0;
  --err: #a53030;
  --err-soft: #f7dddd;
  --used: #8b8178;
  --tip: #6b5a00;
  --tip-soft: #f8f0d2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --gutter: 16px;
  --pad: 16px;
  --gap: 16px;
  --gap-lg: 28px;
  --topbar: 58px;
  color-scheme: light;
}
@media (min-width: 700px) { :root { --gutter: 24px; --pad: 20px; --gap: 20px; --gap-lg: 36px; } }
@media (min-width: 1100px) { :root { --gutter: 32px; } }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1815;
    --surface: #24201c;
    --surface-2: #2f2a25;
    --ink: #f1e9df;
    --ink-2: #b2a699;
    --line: #3b352f;
    --accent: #e2804f;
    --accent-ink: #1b1815;
    --accent-soft: #3e2b21;
    --ok: #6cc085;
    --ok-soft: #233528;
    --warn: #e6b955;
    --warn-soft: #3a3020;
    --err: #ef8a8a;
    --err-soft: #3d2525;
    --used: #8e847a;
    --tip: #e8cf7a;
    --tip-soft: #332c18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.count { font-family: var(--sans); font-size: .8rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-radius: 999px; padding: .1em .55em; vertical-align: middle; }
.icon { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.narrow { max-width: 720px; margin: 0 auto; }
.print-only { display: none; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: var(--topbar); gap: 12px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav-link:hover, .nav-link.on { color: var(--ink); background: var(--surface-2); }
@media (max-width: 420px) { .nav-link span { display: none; } }
main { padding-top: var(--gap-lg); padding-bottom: var(--gap-lg); }
.foot { padding-top: var(--gap); padding-bottom: calc(var(--gap-lg) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; }
.rate-label { align-self: center; color: var(--ink-2); font-size: .85rem; font-weight: 600; margin-right: 2px; }
.foot a { color: var(--ink-2); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-quiet.is-on { color: var(--accent); background: var(--accent-soft); }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .875rem; border-radius: 9px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; font-size: .875rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: none; border: 0; padding: 6px; color: var(--ink-2); cursor: pointer; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* ----------------------------------------------------------------- alerts */
.alert { display: flex; gap: var(--gap); align-items: flex-start; justify-content: space-between; padding: var(--pad); border-radius: 12px; margin: 0 0 var(--gap); }
.alert p { margin: 0 0 .3em; }
.alert p:last-child { margin: 0; }
.alert-ok { background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.alert-warn { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); }
.alert-error { background: var(--err-soft); color: var(--err); font-weight: 500; }

/* ------------------------------------------------------------------ forms */
.stack { display: grid; gap: var(--gap); }
.field { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: .95rem; }
textarea, input[type=search], input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  line-height: 1.5; resize: vertical;
}
textarea:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.mono { font: 14px/1.55 var(--mono); }
input[type=file] { font-size: .9rem; max-width: 100%; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 60ch; }

.card-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin: 0 0 var(--gap); }
.card-section h2 { font-size: 1.2rem; }
.card-section.danger { border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }
.edit-img { max-height: 220px; border-radius: 10px; margin-bottom: 12px; }
.original { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 var(--mono); background: var(--surface-2); padding: 12px; border-radius: 10px; max-height: 420px; overflow: auto; }
details summary { cursor: pointer; font-weight: 500; margin-bottom: 12px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; margin-bottom: var(--gap); }
.back:hover { color: var(--ink); }

/* ------------------------------------------------------------------- list */
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.pill-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; font-size: .9rem; }
/* The search box and category chips stay pinned under the top bar while the list scrolls
   (Scott, 2026-10-25). The chips are one swipeable row so the pinned bar stays short. */
.filters { display: grid; gap: 10px; margin: 0 0 var(--gap-lg); position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 15; background: var(--bg); padding: 10px 0; box-shadow: 0 6px 6px -6px color-mix(in srgb, var(--ink) 18%, transparent); }
.chips { flex-wrap: nowrap; }
.search { position: relative; display: block; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.search input { padding-left: 42px; min-height: 48px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .icon { width: 1em; height: 1em; }
.chip-sm { padding: 2px 9px; font-size: .78rem; cursor: default; }
.chip-x { background: none; border: 0; color: var(--ink-2); font-size: 1.25rem; line-height: 1; min-width: 32px; min-height: 32px; padding: 0 0 0 6px; cursor: pointer; }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); }
.card-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.card-img-blank { display: grid; place-items: center; aspect-ratio: 16 / 5; font: 600 2.2rem var(--serif); color: var(--accent); background: var(--accent-soft); }
.card-body { padding: var(--pad); }
.card-body h2 { font-size: 1.2rem; margin-bottom: .3em; }
.card-body p { color: var(--ink-2); font-size: .93rem; margin-bottom: .6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: .85rem; color: var(--ink-2); }
.none { text-align: center; color: var(--ink-2); padding: 40px 0; }
.empty, .message { max-width: 560px; margin: 8vh auto; text-align: center; }
.empty p, .message p { color: var(--ink-2); font-size: 1.05rem; }

/* ----------------------------------------------------------------- rating */
.rating-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: 12px; }
.rating-badge .icon { width: 1em; height: 1em; }
.rating-up { background: var(--ok-soft); color: var(--ok); }
.rating-down { background: var(--surface-2); color: var(--ink-2); }
.rating-sm { margin: 0; padding: 2px 8px; font-size: .78rem; }
.rate { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rate-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .85rem; font-weight: 600; cursor: pointer; }
.rate-btn .icon { width: 1.05em; height: 1.05em; }
.rate-btn span { display: none; }
.rate-btn.is-on span { display: inline; }
.rate-btn.rate-up.is-on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.rate-btn.rate-down.is-on { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.rate-btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }

/* ----------------------------------------------------------------- recipe */
.r-head { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
@media (min-width: 900px) { .r-head.has-img { grid-template-columns: 1fr 380px; align-items: start; } }
.r-head-text { min-width: 0; }
.r-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
/* AI illustrations carry a small label until someone adds a real photo. */
.pic { position: relative; display: block; margin: 0; }
.pic img { display: block; }
.pic-tag { position: absolute; left: 10px; bottom: 10px; background: rgba(20, 16, 12, .62); color: #fff; font: 600 .72rem var(--sans); letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 4px 0 12px; }
.meta-item { font-weight: 500; }
.scaler { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scaler:empty { display: none; }
.step-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.25rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.step-btn:hover { border-color: var(--accent); color: var(--accent); }
.scale-val { min-width: 2.5ch; text-align: center; font-weight: 600; font-size: 1.1rem; }
.source { color: var(--ink-2); margin-bottom: 10px; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
/* The buttons' 12px inner padding hangs outside the content edge, so every
   row of icons lines up with the text above, however the row wraps. */
.toolbar { margin: 0 0 var(--gap); padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toolbar-in { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 -12px; }
.toolbar .btn-quiet { padding: 0 12px; }

.tabs { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 0 var(--gap); background: var(--surface-2); border-radius: 12px; }
.tabs.tabs-2 { grid-template-columns: repeat(2, 1fr); }
.tabs { box-shadow: 0 0 0 6px var(--bg); }
.tabs button { border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: .95rem; color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.panel { display: none; min-width: 0; }
.panel.is-active { display: block; }
@media (min-width: 900px) {
  .tabs { display: none; }
  .r-body { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; grid-template-areas: "ing steps" "ing notes"; gap: 0 var(--gap-lg); align-items: start; }
  .panel { display: block; }
  .panel-ingredients { grid-area: ing; position: sticky; top: calc(var(--topbar) + var(--gap)); max-height: calc(100vh - var(--topbar) - 2 * var(--gap)); overflow-y: auto; }
  .panel-steps { grid-area: steps; }
  .panel-notes { grid-area: notes; margin-top: var(--gap-lg); }
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-title { font-size: 1.5rem; margin: 0; }

/* Ingredients: three lists. */
.ing-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: var(--gap); }
.ing-group h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.05rem; margin-bottom: 6px; }
.ing-group h3 .link-btn { margin-left: auto; }
.ing-group > p:last-child { margin: 0; }
.ing-group-need { border-top: 4px solid var(--accent); }
.ing-group-have { border-top: 4px solid var(--ok); }
.ing-group-used { border-top: 4px solid var(--used); }
.aisle { font: 600 .72rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 12px 0 2px; }
.ings { list-style: none; margin: 0; padding: 0; }
.ing { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ings .ing:first-child { border-top: 0; }
.ing-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ing-note { color: var(--ink-2); }
.ing-used .ing-text > :not(.tip-line), .ing-used .ing-text { color: var(--used); }
.ing-used .amt, .ing-used .ing-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--used) 60%, transparent); }
.amt { font-weight: 650; color: var(--ink); }
.ing-used .amt { color: inherit; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--bg); }
.seg button { border: 0; background: transparent; padding: 6px 9px; min-height: 36px; font-size: .78rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[data-s="need"][aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button[data-s="have"][aria-pressed="true"] { background: var(--ok); color: var(--bg); }
.seg button[data-s="used"][aria-pressed="true"] { background: var(--used); color: var(--bg); }
.units { display: inline-flex; align-items: center; }
.units:empty { display: none; }
.seg-units button { padding: 6px 12px; font-size: .85rem; }
.seg-units button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Tips, placed in cooking order. */
.tip-line { display: block; margin-top: 4px; font-size: .9rem; line-height: 1.45; color: var(--tip); overflow-wrap: anywhere; }
.tip-tag { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: var(--tip-soft); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.tip-line .amt { color: inherit; }
.tipbox { background: var(--tip-soft); border-radius: var(--radius); padding: var(--pad); margin: 0 0 var(--gap-lg); }
.tipbox h3 { font-size: 1.05rem; margin-bottom: 8px; }
.tipbox ul { margin: 0; padding-left: 1.2em; }
.tipbox li { margin-bottom: .35em; overflow-wrap: anywhere; }
.tipbox li:last-child { margin-bottom: 0; }
.tipbox-special { background: var(--surface-2); border: 1px solid var(--line); }
.tipbox-special ul { list-style: none; padding-left: 0; }
.tipbox-special li { margin-bottom: .8em; }
.tipbox-special strong { display: block; }
.tipbox-special .workaround { display: block; margin-top: 2px; color: var(--ink-2); font-size: .92rem; }
.tipbox-special .scaled { display: block; margin-top: 4px; font-weight: 600; color: var(--accent); font-size: .92rem; }
.photo-form { display: inline-flex; margin: 0; }
.photo-form label { cursor: pointer; }
.photo-ask { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--tip-soft); border-radius: var(--radius); padding: 12px var(--pad); margin: 0 0 var(--gap); }
.photo-ask[hidden] { display: none; }
.photo-ask p { margin: 0; flex: 1 1 200px; }
.photo-ask .icon { flex: none; width: 22px; height: 22px; }
.cooks { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cooks .chip { min-height: 36px; padding: 4px 12px; font-size: .85rem; cursor: pointer; }

/* Steps. Phase numbers and checkboxes share one 40px column so text lines up. */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: var(--gap-lg); }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }
.phase { margin-bottom: var(--gap-lg); }
.phase h3 { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; margin-bottom: 6px; }
.phase-n { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 600 .9rem var(--sans); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.step:first-child { border-top: 0; }
.step label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 1.08rem; line-height: 1.5; }
.step input { position: absolute; opacity: 0; pointer-events: none; }
.step-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.step-tip { margin: 6px 0 0 40px; }
.box { flex: none; width: 28px; height: 28px; border: 2px solid color-mix(in srgb, var(--ink) 30%, var(--line)); border-radius: 8px; background: var(--surface); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.box::after { content: ''; width: 7px; height: 13px; border: solid var(--accent-ink); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
input:checked + .box { background: var(--accent); border-color: var(--accent); }
input:checked + .box::after { opacity: 1; }
input:focus-visible + .box { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.step.done .step-text { color: var(--used); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--used) 50%, transparent); }
.step.done .amt { color: inherit; }
.steps-foot { margin: 0 0 var(--gap); }

/* Notes. */
.note-form { display: grid; gap: 10px; justify-items: start; margin-bottom: var(--gap); }
.notes { list-style: none; margin: 0 0 var(--gap); padding: 0; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px var(--pad); margin-bottom: 10px; }
.note p { margin: 0; overflow-wrap: anywhere; }
.note-head { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--ink-2); margin-bottom: 4px; }

/* -------------------------------------------------------------- shopping */
.shop-recipes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.shop-recipes .chip { cursor: default; padding-right: 4px; }
.shop-list { list-style: none; margin: 0 0 var(--gap); padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.shop-item label { display: flex; gap: 12px; align-items: flex-start; padding: 12px var(--pad); cursor: pointer; border-top: 1px solid var(--line); }
.shop-item:first-child label { border-top: 0; }
.shop-item input { position: absolute; opacity: 0; pointer-events: none; }
.shop-text { flex: 1; min-width: 0; }
.shop-for { display: block; }
.shop-item.got .ing-text { color: var(--used); text-decoration: line-through; }
.shop-item.got .amt { color: inherit; }

/* ------------------------------------------------------- busy and toast */
.busy { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--gutter); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.busy-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px 28px 18px; max-width: 360px; text-align: center; box-shadow: var(--shadow); }
.busy-card p { margin: 14px 0 0; }
.spinner { width: 38px; height: 38px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .card { transition: none; } }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: min(92vw, 460px); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: .93rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ print */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #444; --line: #ccc; --accent: #000; --accent-ink: #fff; --tip: #333; --tip-soft: #f3f3f3; --gap-lg: 16px; }
  body { font-size: 12pt; }
  .filters { position: static; box-shadow: none; }
  .topbar, .toolbar, .tabs, .back, .alert, .seg, .units, .photo-ask, .ing-group, .note-form, .steps-foot, .scaler .step-btn, .scaler .link-btn, .icon-btn, .rate, .foot, .progress, .panel-head .muted.small, .panel-notes > .muted.small, #toast { display: none !important; }
  .print-only { display: block; }
  .print-ings { padding-left: 1.2em; }
  .panel { display: block !important; }
  .r-body { display: block !important; }
  .panel-ingredients { position: static !important; max-height: none !important; overflow: visible !important; }
  .r-img { max-height: 2.5in; width: auto; box-shadow: none; }
  .step { padding: 3px 0; border: 0; }
  .step label { font-size: 11.5pt; }
  .step.done .step-text { text-decoration: none; color: #000; }
  .box { width: 14px; height: 14px; border-width: 1px; border-radius: 3px; }
  .step-tip { margin-left: 26px; }
  input:checked + .box { background: none; }
  .phase { break-inside: avoid-page; }
  main { padding: 0; }
}

/* ------------------------------------------------------------ cooking now */
.cooking-now { background: var(--accent-soft); border-radius: var(--radius); padding: var(--pad); margin: 0 0 var(--gap-lg); }
.cooking-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.cooking-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 1.2rem; margin: 0; }
.cooking-head .pill-link { background: var(--surface); }
.cooking-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cooking-item { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; border: 1px solid var(--line); }
.cooking-item:hover { border-color: var(--accent); }
.cooking-who, .chip-who { margin-left: 8px; font-weight: 500; font-size: .85rem; color: var(--ink-2); }
.cooking-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.cooking-tag .icon { width: 1em; height: 1em; }
.steps-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.shop-recipes { align-items: center; }
.shop-recipes .chip a { color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- versions */
.versions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; }
.version-link { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 500; text-decoration: none; }
.version-link:hover { border-color: var(--accent); }
.rating-mini { display: inline-flex; }
.rating-mini .icon { width: .95em; height: .95em; }
.rating-mini.rating-up { color: var(--ok); background: none; }
.rating-mini.rating-down { color: var(--ink-2); background: none; }
.versions-tag { font-weight: 600; color: var(--ink); }
.row-form input[type=text] { flex: 1; min-width: 200px; }

.no-steps { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: var(--pad); color: var(--ink-2); margin: 0 0 var(--gap-lg); }

/* Group headings stay pinned at the top while you scroll through their group:
   step groups, aisles on the Need to buy list, and aisles on the shopping list
   (Scott, 2026-10-25). On phones they sit under the top bar and the tabs. */
:root { --tabs-h: 50px; }
.phase h3 { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top) + var(--tabs-h)); z-index: 5; background: var(--bg); padding: 8px 0 6px; margin-top: -8px; }
.ing-group .aisle { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top) + var(--tabs-h)); z-index: 5; background: var(--surface); padding: 8px 0 4px; margin-top: 4px; }
#shopping .aisle { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding: 10px 0 6px; margin: 4px 0 0; }
@media (min-width: 900px) {
  .phase h3 { top: calc(var(--topbar) + env(safe-area-inset-top)); }
  .ing-group .aisle { top: 0; }
}
@media print {
  .phase h3, .ing-group .aisle, #shopping .aisle { position: static; }
}

/* Settings > People: one row per person, wraps on a phone. */
.people { list-style: none; margin: var(--gap) 0; padding: 0; }
.people li { border-top: 1px solid var(--line); padding: 10px 0; }
.person-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.person-form input[type="text"], .person-form input[type="email"] { flex: 1 1 140px; min-width: 0; }
.person-form select { flex: 0 0 auto; }
.person-email { flex: 1 1 100%; order: 3; }
.person-add { margin-top: var(--gap); }

/* ------------------------------------------------- group votes and versions
   Everyone votes on their own; the votes rank the versions of each dish
   (Scott, 2026-10-25). */
.rate { align-items: center; }
.rate + .votes { margin-top: -4px; }
.votes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 12px; font-size: .88rem; color: var(--ink-2); }
.votes .rating-badge { margin: 0; }
.vote { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.version-rank { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .9rem; font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.version-rank:hover { border-color: var(--accent); }
.version-rank .icon, .best-tag .icon { width: 1em; height: 1em; color: var(--warn); fill: currentColor; }
.best-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--ink); font-size: .78rem; font-weight: 600; white-space: nowrap; }

.dish-versions { margin: var(--gap-lg) 0 0; padding-top: var(--gap); border-top: 1px solid var(--line); }
.dish-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.dish-head h2 { font-size: 1.25rem; margin: 0; }
.ranked { list-style: none; margin: 0 0 8px; padding: 0; }
.rank-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rank-row:first-child { border-top: 0; }
.rank-row.is-here { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); border-radius: 12px; padding-left: 10px; padding-right: 10px; }
.rank { flex: 0 0 auto; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: .9rem; color: var(--ink); }
.rank-body { flex: 1; min-width: 0; }
.rank-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rank-title a { font-weight: 600; color: var(--ink); }
.rank-title h2 { font-size: 1.15rem; margin: 0; }
.rank-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .85rem; color: var(--ink-2); margin-top: 2px; }
.rank-body .votes { margin: 6px 0 0; }

.dish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
.dish-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dish-item > .votes { margin: 0; padding: 0 var(--pad) var(--pad); }
.dish-link { display: grid; grid-template-columns: 1fr; color: inherit; text-decoration: none; }
@media (min-width: 620px) { .dish-link { grid-template-columns: 200px 1fr; } }
.dish-img { width: 100%; height: 100%; min-height: 120px; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.dish-img.card-img-blank { aspect-ratio: 16 / 5; min-height: 0; }
@media (min-width: 620px) { .dish-img.card-img-blank { aspect-ratio: auto; } }
.dish-body { padding: var(--pad); display: grid; gap: 8px; align-content: start; }
.dish-body p { color: var(--ink-2); font-size: .93rem; margin: 0; }
.dish-body .best-tag { justify-self: start; }

/* ----------------------------------------------------------- invite links
   Friends bring friends with a link, the way a social network does (2026-10-25). */
input[type=email] { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); line-height: 1.5; }
.seg-levels { margin: 0 0 var(--gap); }
.seg-levels a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; font-size: .9rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.seg-levels a + a { border-left: 1px solid var(--line); }
.seg-levels a.on { background: var(--ink); color: var(--bg); }
.invite-link { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font: 600 .95rem/1.4 var(--mono); word-break: break-all; margin: 0 0 var(--gap); }
.invite-send .form-actions { margin-bottom: 12px; }
.invite-send form { margin-top: 4px; }
.links-head { font-size: 1rem; margin: var(--gap-lg) 0 0; }
.link-who { flex: 1 1 auto; }
.join { text-align: left; }
.join-from { font-weight: 600; color: var(--accent); margin: 0 0 .3em; }
.foot a { margin-left: 2px; }

@media print {
  .dish-versions, .version-rank { display: none !important; }
}
