:root {
  color-scheme: light dark;
  --bg: #fff3e6;
  --surface: #fffaf3;
  --ink: #191410;
  --muted: #6b5f55;
  --line: #e8d9c6;
  --accent: #c2371a;
  --accent-ink: #fff;
  --accent-soft: #ffe1d2;
  --olive: #5d6b34;
  --danger: #a32222;
  --shadow: 0 1px 2px rgb(60 40 20 / .08);
  --type: Cambria, "Noto Serif", "Iowan Old Style", Georgia, serif; /* Cambria first: Georgia's old-style 1 looks like an I */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100d;
    --surface: #1f1914;
    --ink: #fff3e6;
    --muted: #b8a99b;
    --line: #3c3128;
    --accent: #ff7a55;
    --accent-ink: #1d0d07;
    --accent-soft: #43231a;
    --olive: #aebb7c;
    --danger: #f08a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; } /* the gutter keeps every page the same width */
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2 { font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
h1 { font-size: 2.6rem; }
h2 { font-size: 1.3rem; }
a { color: var(--accent); }
img { max-width: 100%; }
code { background: var(--accent-soft); padding: .1em .3em; border-radius: 4px; }
[hidden] { display: none !important; }

button, .button, input, textarea { font: inherit; color: inherit; }
button, .button {
  display: inline-block; min-height: 40px; padding: .4rem .9rem; cursor: pointer; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
button:hover, .button:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.danger { color: var(--danger); }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, textarea {
  width: 100%; padding: .55rem .7rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > textarea { margin-top: .25rem; font-weight: 400; font-size: 1rem; }
.hint { color: var(--muted); font-weight: 400; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.inline { display: flex; gap: .5rem; }
.inline input { flex: 1; min-width: 0; }
.notice { background: var(--accent-soft); border-radius: 8px; padding: .6rem .8rem; margin: 0 0 1rem; }
.form-error { color: var(--danger); margin: 0; font-size: .92rem; }

/* sign in */
.auth { max-width: 400px; margin: 0 auto; padding: 12vh 16px 2rem; }
.auth-brand { font-size: 3rem; color: var(--accent); text-align: center; }
.auth-tag { text-align: center; color: var(--muted); margin: .25rem 0 1.5rem; }
.auth-card { padding: 1.25rem; display: grid; gap: .9rem; }
.auth-card .notice, .auth-card p { margin: 0; }
.auth-links { display: flex; justify-content: space-between; font-size: .92rem; }

/* app frame: one width on every page. It fills phones and tablets, is at least 1240px when
   there's room (the meal plan's seven columns need it), and grows on very wide monitors. */
.topbar, .page { max-width: clamp(1240px, 90vw, 2400px); margin-inline: auto; }
.topbar { display: flex; justify-content: flex-end; gap: .25rem; padding: .4rem 16px 0; }
.page { padding: 1.25rem 16px 3rem; }
.hello, .top-link {
  max-width: 11rem; padding: .3rem .6rem; border-radius: 8px; font-size: .92rem; color: var(--ink);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hello:hover, .hello[aria-current], .top-link:hover, .top-link[aria-current] { background: var(--accent-soft); }
.page-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .25rem 1rem;
  flex-wrap: wrap; margin-bottom: .75rem; padding-block: .4rem; background: var(--bg);
}
/* the page links name the page, so the heading stays for screen readers only */
.page-head h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabs { display: flex; gap: .5rem; flex: 1; }
/* jukebox selector buttons: the current page is pressed in and lit */
.tab {
  display: inline-flex; align-items: center; padding: .25rem .7rem; color: var(--ink); font-weight: 700;
  text-decoration: none; background: var(--surface); border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 6px;
}
.tab:hover { background: var(--accent-soft); }
.tab[aria-current] { margin-top: 3px; color: var(--accent-ink); font-weight: 800; background: var(--accent); border-bottom-width: 2px; }
.actions { display: flex; gap: .5rem; }
.back { display: inline-block; margin-bottom: .75rem; font-size: .92rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty h2 { color: var(--ink); margin-bottom: .4rem; }

/* the banner at the top of every signed-in page */
.kinetic { margin-bottom: .5rem; }
.kinetic-title { margin: 0; font: 800 clamp(2rem, 9.5vw, 4rem)/1 var(--sans); letter-spacing: -.045em; }
.kinetic-title span { display: inline-block; }
.kinetic-title span:nth-child(3) { color: var(--accent); }
.kinetic.enter .kinetic-title span { animation: rise .8s cubic-bezier(.2, .9, .2, 1) both; }
.kinetic.enter .kinetic-title span:nth-child(2) { animation-delay: .12s; }
.kinetic.enter .kinetic-title span:nth-child(3) { animation-delay: .24s; }
.kinetic-brand {
  display: inline-block; margin-left: .15em; padding: 0 .3em; font-size: max(.4em, 1.1rem); line-height: 1.25; letter-spacing: -.02em;
  color: var(--olive); text-decoration: none; vertical-align: .2em;
  border: 2px solid currentColor; border-radius: 3px; transform: rotate(-5deg);
}
.kinetic-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: .4rem 0 .5rem; }
.tonight { margin: 0; min-width: 0; font-size: clamp(1.05rem, 3vw, 1.3rem); font-weight: 600; letter-spacing: -.02em; }
.tonight span { display: inline-block; max-width: 100%; overflow-wrap: anywhere; color: var(--accent); font-weight: 800; }
.motion-toggle { flex: none; padding-block: .25rem; font-size: .82rem; }
.ticker { overflow: hidden; white-space: nowrap; border-block: 2px solid var(--ink); padding: .3rem 0; font-size: 1.2rem; font-weight: 700; }
.ticker div { display: inline-block; animation: slide linear infinite; }
.ticker span { color: var(--accent); margin: 0 .7rem; }
.kinetic.still .ticker div { animation-play-state: paused; }
@keyframes rise { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide { to { transform: translateX(-50%); } }

/* profile */
.profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(340px, calc(25% - .6rem))), 1fr)); gap: .75rem; align-items: start; }
.profile .card { padding: 1rem; display: grid; gap: .75rem; }
.profile .card p { margin: 0; }
.profile button { justify-self: start; }
.danger-zone { border-color: var(--danger); }

/* recipes */
.import { padding: .9rem; margin-bottom: 1rem; display: grid; gap: .4rem; }
.or-type { margin: 0 0 .5rem; }
.search { margin-bottom: 1rem; }
.recipe-views { display: flex; gap: 1rem; margin-bottom: .75rem; font-weight: 600; }
.recipe-views a { padding-bottom: .1rem; color: var(--muted); text-decoration: none; }
.recipe-views a[aria-current] { color: var(--ink); border-bottom: 2px solid var(--accent); }
.recipe-views { flex-wrap: wrap; align-items: baseline; }
.merge-check { display: flex; gap: .4rem; align-items: center; margin-left: auto; font-weight: 400; font-size: .9rem; color: var(--muted); cursor: pointer; }
.friends { display: grid; gap: .6rem; padding: .9rem; margin-bottom: 1rem; }
.friends h2, .friends p { margin: 0; }
.friend-list { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.friend-list li { display: flex; justify-content: space-between; align-items: center; gap: .4rem 1rem; flex-wrap: wrap; overflow-wrap: anywhere; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.friend-list li:last-child { border-bottom: 0; }
.friend-name small { margin-left: .3rem; }
.friend-actions { display: flex; gap: .9rem; }
.nickname-form { flex: 1; }
.friends-page { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.friends-page .friends { margin-bottom: 0; }
.manage-friends { margin-left: auto; font-weight: 400; font-size: .9rem; }
#invite-box { display: grid; gap: .4rem; }
#invite-box > button { justify-self: start; }
.share-check { display: flex; gap: .55rem; align-items: flex-start; }
.share-check input { margin-top: .15rem; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(320px, calc(25% - .75rem))), 1fr)); gap: 1rem; }
.recipe-form { padding: 1.25rem; margin-top: 1rem; display: grid; gap: 1rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.delete-recipe { margin-top: 2.5rem; }

/* old lined index card: fixed colours in both themes, because it's paper.
   Everything inside sits on the --rule grid so text stays on the printed lines.
   --lift raises each printed line to just under the text. */
.index-card {
  --rule: 1.5rem; --lift: .22rem; --top: .6rem; --pad: .9rem;
  --paper: #fdf8ec; --blue: #dfe9f1; --head: #e8a79e; --red: #d0584a; --pen-red: #c2371a; --pen: #1a130d; --label: #a8392c;
  --lines: repeating-linear-gradient(to bottom, transparent 0 calc(var(--rule) - 1px), var(--blue) calc(var(--rule) - 1px) var(--rule));
  color-scheme: light; display: block; min-width: 0; padding: var(--top) var(--pad) .75rem;
  color: var(--pen); text-decoration: none; font: 1rem/var(--rule) var(--type); font-variant-numeric: lining-nums;
  background: var(--paper) var(--lines) 0 calc(var(--top) - var(--lift));
  border-radius: 3px; box-shadow: 0 1px 2px rgb(40 25 10 / .25), 0 6px 14px rgb(40 25 10 / .12);
}
@media (prefers-color-scheme: dark) { .index-card { --paper: #f3ead6; --blue: #d3dfe8; } }
.ic-head { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 .75rem; }
.ic-head::after { content: ""; position: absolute; inset-inline: calc(var(--pad) * -1); bottom: var(--lift); height: 2px; background: var(--head); }
.ic-head strong, .ic-head h1 { font: 800 1.05rem/var(--rule) var(--sans); letter-spacing: -.02em; min-width: 0; overflow-wrap: anywhere; }
.ic-head small { font-size: .85rem; white-space: nowrap; }
.ic-body { display: grid; grid-template-columns: minmax(0, 2fr) 1.4rem minmax(0, 3fr); gap: .5rem; }
.ic-left, .ic-right { display: block; min-width: 0; overflow-wrap: anywhere; }
.ic-note { color: #54483e; }

/* in the list: a picture and a menu blurb, in a fixed window of four lines */
.recipe-card { font-size: .95rem; transition: transform .15s ease; }
.recipe-card:hover, .recipe-card:focus-visible { transform: rotate(-.6deg) translateY(-2px); }
.recipe-card .ic-body { height: calc(var(--rule) * 4); grid-template-columns: calc(var(--rule) * 4) minmax(0, 1fr); gap: .75rem; }
.ic-picture { display: block; width: 100%; height: calc(var(--rule) * 4); object-fit: cover; }
.ic-drawing { fill: none; stroke: #5d6b34; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recipe-card { display: flex; flex-direction: column; }
.ic-size { margin-top: auto; font-size: .82rem; text-align: right; color: #54483e; }
.ic-blurb { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; overflow-wrap: anywhere; }

/* the full recipe: the same card, as long as it needs to be */
.recipe-sheet { --rule: 1.85rem; --pad: 1.4rem; --stuck-top: 3.3rem; font-size: 1.1rem; padding-bottom: 1.25rem; }
.recipe-sheet .ic-head h1 { font-size: 1.5rem; }
.recipe-sheet .ic-head small { font-size: .9rem; white-space: normal; }
/* the photo is clipped to the corner of the card, so the recipe comes first; tap for the full size */
.recipe-sheet .ic-head { min-height: calc(var(--rule) * 3); padding-right: 8rem; align-content: flex-start; }
.sheet-photo, .sheet-drawing { position: absolute; top: 0; right: 0; width: 7rem; height: calc(var(--rule) * 3 - .35rem); }
.sheet-drawing svg { display: block; width: 100%; height: 100%; }
.sheet-photo {
  z-index: 1; min-height: 0; padding: 0; overflow: hidden; cursor: zoom-in; background: #fff; border: 3px solid #fff; border-radius: 2px;
  box-shadow: 0 1px 4px rgb(40 25 10 / .35); transform: rotate(1.5deg);
}
.sheet-photo:hover { border-color: #fff; }
.sheet-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
#photo-view { width: fit-content; max-width: min(900px, calc(100vw - 32px)); max-height: none; padding: 0; overflow: hidden; cursor: zoom-out; background: none; border: 0; }
#photo-view img { display: block; max-height: 85vh; border-radius: 4px; }
.photo-close {
  position: absolute; top: .5rem; right: .5rem; width: 2.5rem; height: 2.5rem; min-height: 0; padding: 0;
  font-size: 1.4rem; line-height: 1; color: #fff; background: rgb(0 0 0 / .6); border: 0; border-radius: 50%;
}
.recipe-sheet h2 { font: 800 .85rem/var(--rule) var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--label); }
.recipe-sheet ul, .recipe-sheet ol { margin: 0; padding: 0; list-style: none; }
/* each column carries its own printed lines, so its text stays on them when the ingredients stick */
.recipe-sheet .ic-left, .recipe-sheet .ic-right { background: var(--paper) var(--lines) 0 calc(var(--lift) * -1) local; }
/* the ingredients stay in view below the page links while a long method scrolls */
.recipe-sheet .ic-left {
  position: sticky; top: var(--stuck-top); align-self: start; z-index: 2; max-height: calc(100vh - var(--stuck-top)); max-height: calc(100dvh - var(--stuck-top)); overflow-y: auto;
  margin-left: calc(var(--pad) * -1); padding-left: var(--pad);
}
.method-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.clear-steps { font-size: .85rem; line-height: var(--rule); color: var(--label); }
/* crossing off, like a red pen on the card. Touchscreens tap the whole row and show no boxes;
   a mouse also gets a circle around each step number and a box beside each ingredient. */
.tap-note { font-size: .85rem; font-style: italic; color: #54483e; }
.step, .ingredient { position: relative; display: flex; font: inherit; cursor: pointer; }
.step { gap: .5rem; margin-inline: -.3rem; padding-inline: .3rem; }
.ingredient { gap: .45rem; }
.step input, .ingredient input { position: absolute; left: 0; top: .2rem; width: 1px; height: 1px; opacity: 0; }
.step-num { position: relative; flex: none; width: 1.5rem; font-weight: 700; text-align: center; }
.step-text { flex: 1; min-width: 0; }
li[aria-current] .step { background: rgb(250 222 100 / .5); }
.step input:focus-visible ~ .step-num, .ingredient input:focus-visible + span { outline: 2px solid var(--pen-red); outline-offset: 1px; }
.step input:checked ~ .step-num { color: #7a6d60; }
.step input:checked ~ .step-num::after {
  content: "\2713\fe0e"; position: absolute; left: .15rem; top: -.5rem; color: var(--pen-red); font: 800 1.7rem/1 var(--type); transform: rotate(6deg);
}
.step input:checked ~ .step-text, .ingredient input:checked + span {
  text-decoration-line: line-through; text-decoration-color: var(--pen-red); text-decoration-thickness: 2px;
}
/* a finished step folds down to one line; tap it to bring it back */
.step input:checked ~ .step-text { overflow: hidden; font-size: .85em; white-space: nowrap; text-overflow: ellipsis; }
@media (hover: hover) and (pointer: fine) {
  .tap-note { display: none; }
  .step-num { align-self: flex-start; height: 1.5rem; margin-top: calc((var(--rule) - 1.5rem) / 2 - var(--lift)); font: 800 .85rem/calc(1.5rem - 3px) var(--sans); background: #fff; border: 1.5px solid #8d7f71; border-radius: 50%; }
  .ingredient input { position: static; flex: none; width: 1rem; height: 1rem; margin-top: calc((var(--rule) - 1rem) / 2 - var(--lift)); opacity: 1; accent-color: var(--pen-red); }
}
.recipe-sheet p { margin: 0; }
.recipe-sheet a { color: var(--label); }

/* the curly bracket, pointing at the method. Drawn from four pieces so the
   curves keep their shape however tall the ingredient list gets. */
.brace { --r: .7rem; --w: 2px; display: grid; grid-template-rows: 1fr 1fr; color: var(--red); margin-block: .2rem .35rem; }
.brace span { position: relative; }
.brace span::before, .brace span::after { content: ""; position: absolute; border: 0 solid currentColor; }
.brace span::before { left: 0; width: 50%; }
.brace span::after { left: calc(50% - var(--w)); right: 0; height: var(--r); }
.brace span:first-child::before { top: 0; bottom: var(--r); border-top-width: var(--w); border-right-width: var(--w); border-top-right-radius: var(--r); }
.brace span:first-child::after { bottom: 0; border-bottom-width: var(--w); border-left-width: var(--w); border-bottom-left-radius: var(--r); }
.brace span:last-child::before { top: var(--r); bottom: 0; border-bottom-width: var(--w); border-right-width: var(--w); border-bottom-right-radius: var(--r); }
.brace span:last-child::after { top: 0; border-top-width: var(--w); border-left-width: var(--w); border-top-left-radius: var(--r); }

/* plan */
.week-nav { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.week-nav strong { min-width: 9.5rem; text-align: center; }
.planner { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.plan-recipes { display: none; }
.days { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.day { position: relative; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: .6rem; padding: .6rem .7rem; }
.day.today { border-color: var(--accent); }
.day h2 { font-size: 1.05rem; padding-top: .3rem; }
.day h2 small { display: block; font: .8rem var(--sans); color: var(--muted); }
.day-meals { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; min-width: 0; }
.meal {
  display: inline-flex; align-items: center; max-width: 100%; min-width: 0; padding-left: .55rem;
  background: var(--accent-soft); border-radius: 8px;
}
.meal-text { display: grid; min-width: 0; padding: .2rem 0; line-height: 1.25; }
.meal small { color: var(--olive); font-size: .72rem; font-weight: 600; text-transform: capitalize; }
.meal a { color: inherit; text-decoration: none; font-size: .92rem; overflow-wrap: anywhere; }
.x { background: none; border: 0; min-height: 32px; width: 32px; flex: none; padding: 0; color: var(--muted); font-size: 1.15rem; line-height: 1; }
.add { min-height: 36px; padding: 0 .6rem; color: var(--accent); border-style: dashed; font-size: .88rem; }
.drop-zones { display: none; position: absolute; inset: 0; z-index: 2; grid-auto-rows: 1fr; gap: 2px; padding: 2px; background: var(--surface); border-radius: 12px; }
.planner.dragging .drop-zones { display: grid; }
.drop-zone {
  display: grid; place-items: center; font-size: .82rem; color: var(--muted); text-transform: capitalize;
  border: 1px dashed var(--line); border-radius: 8px;
}
.drop-zone.over { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); font-weight: 600; }

.plan-recipes h2 { font-size: 1.05rem; }
.plan-recipes .hint { margin: 0; font-size: .82rem; }
.plan-recipe-list { display: grid; gap: .3rem; align-content: start; overflow-y: auto; min-height: 0; padding: 2px; }
.plan-recipe {
  padding: .35rem .5rem; font-size: .88rem; overflow-wrap: anywhere; cursor: grab;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.plan-recipe:hover { border-color: var(--accent); }
.plan-recipe-list p { margin: 0; font-size: .88rem; }

@media (min-width: 900px) {
  .planner { grid-template-columns: 190px minmax(0, 1fr); align-items: start; }
  .plan-recipes {
    display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: .45rem; padding: .7rem;
    position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem);
  }
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .day { grid-template-columns: minmax(0, 1fr); align-content: start; gap: .4rem; min-height: 300px; padding: .55rem; }
  .day h2 { padding-top: 0; }
  .day h2 small { display: inline; }
  .day-meals { align-items: stretch; flex-direction: column; }
  .meal { width: 100%; justify-content: space-between; }
  .meal .x { width: 24px; }
  .add { width: 100%; padding: 0; }
  .meal[draggable] { cursor: grab; }
}
@media (hover: none) {
  .planner { grid-template-columns: minmax(0, 1fr); }
  .plan-recipes { display: none; }
}

/* recipe picker */
dialog { width: min(440px, calc(100vw - 32px)); max-height: 80vh; padding: 1rem; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.picker-head h2 { text-transform: capitalize; }
.picker-list { display: grid; gap: .35rem; margin-top: .6rem; max-height: 50vh; overflow-y: auto; padding: 2px; }
.picker-list button { text-align: left; overflow-wrap: anywhere; }
.picker-list p { margin: .5rem 0; }
.slot-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; margin-bottom: .6rem; }
.slot-choice label { font-weight: 400; text-transform: capitalize; }
.slot-choice input { position: absolute; opacity: 0; width: 1px; }
.slot-choice span { display: block; padding: .35rem 0; text-align: center; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.slot-choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.slot-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* grocery */
.add-item { margin-bottom: 1rem; }
.grocery { list-style: none; margin: 0; padding: 0; column-gap: 0; column-rule: 1px solid var(--line); }
.grocery:empty { display: none; }
@media (min-width: 900px) { .grocery { column-count: 2; } }
@media (min-width: 1800px) { .grocery { column-count: 3; } }
@media (min-width: 2500px) { .grocery { column-count: 4; } }
.grocery li { display: flex; align-items: center; break-inside: avoid; border-top: 1px solid var(--line); padding-right: .35rem; }
.grocery li:first-child { border-top-color: transparent; } /* keeps rows level across columns */
.grocery label { flex: 1; min-width: 0; display: flex; align-items: center; gap: .7rem; padding: .7rem; font-weight: 400; font-size: 1rem; cursor: pointer; }
.item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-amount { color: var(--muted); font-size: .92rem; text-align: right; }
.done .item-name { text-decoration: line-through; color: var(--muted); }
.done-head { margin: 1.25rem 0 .5rem; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 1rem); z-index: 20;
  max-width: calc(100vw - 32px); padding: .6rem 1rem; border-radius: 8px;
  background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .tabs { order: -1; flex-basis: 100%; }
  .tab { flex: 1; justify-content: center; padding-inline: .3rem; }
  .page-head > :not(.tabs) { margin-left: auto; }
  .page-head > .actions { flex-basis: 100%; justify-content: space-between; margin-left: 0; }
  /* the week controls would make the sticky row too tall on a phone */
  .page-head:has(.week-nav) { position: static; }
  .week-nav [data-action="clear-checked"] { order: 1; }

  /* on a phone the recipe columns stack, so the bracket lies down and points at the method */
  .recipe-sheet { --pad: 1rem; }
  .recipe-sheet .ic-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* a compact strip that stays at the top of the screen, so the page links let go of it */
  .page-head:has(.actions) { position: static; }
  .recipe-sheet { --stuck-top: 0px; }
  .recipe-sheet .ic-left {
    max-height: 38vh; margin-inline: calc(var(--pad) * -1); padding: 0 var(--pad) .4rem; font-size: .88rem; line-height: 1.3;
    background: var(--paper); border-bottom: 2px solid var(--head);
  }
  .recipe-sheet .ic-left h2 { line-height: 1.6rem; }
  .recipe-sheet .ic-left ul { columns: 2; column-gap: 1.25rem; }
  .recipe-sheet .ic-left li { padding-bottom: .2rem; break-inside: avoid; }
  .recipe-sheet .ic-right { margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); }
  .recipe-sheet .brace { grid-template-rows: none; grid-template-columns: 1fr 1fr; height: var(--rule); margin-block: 0; }
  .recipe-sheet .brace span::before, .recipe-sheet .brace span::after { left: auto; right: auto; width: auto; height: auto; border-width: 0; border-radius: 0; }
  .recipe-sheet .brace span::before { top: 0; bottom: calc(50% - var(--w)); }
  .recipe-sheet .brace span::after { top: 50%; bottom: 0; width: var(--r); }
  .recipe-sheet .brace span:first-child::before { left: 0; right: var(--r); border-left-width: var(--w); border-bottom-width: var(--w); border-bottom-left-radius: var(--r); }
  .recipe-sheet .brace span:first-child::after { right: 0; border-top-width: var(--w); border-right-width: var(--w); border-top-right-radius: var(--r); }
  .recipe-sheet .brace span:last-child::before { left: var(--r); right: 0; border-right-width: var(--w); border-bottom-width: var(--w); border-bottom-right-radius: var(--r); }
  .recipe-sheet .brace span:last-child::after { left: 0; border-top-width: var(--w); border-left-width: var(--w); border-top-left-radius: var(--r); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker div { animation: none; }
  .motion-toggle { display: none; }
  .recipe-card { transition: none; }
  .recipe-card:hover, .recipe-card:focus-visible { transform: none; }
  #toast { transition: none; }
}
