/* Batchabar, on the Unified Design System: the family's paper, soot and ink, with the Peel
   layer for the accent. The start page, guest menu and bottle labels are set like a bottle
   label (a graduated measure under each title, a double-ruled menu card, an ink warning band);
   the plan reads like a prep sheet (each batch a tag, the shopping list a prep ticket).
   Two fonts: Instrument Sans to read, Space Grotesk for titles and labels.
   Screen first, then phones, then print. Colours are hex so they can be checked as they are. */

@font-face {
  font-family: "Instrument Sans Variable";
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk Variable";
  src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens: the family core, then the Peel layer (Batchabar) ---------- */

:root {
  color-scheme: light dark;

  /* Family core. line-strong and danger-soft are new to the core; danger is lifted in dark. */
  --bg: #f6f1e8;
  --surface: #fffcf7;
  --line: #e6dcce;
  --line-strong: #8a7d70;   /* edges of fields and controls, column-head rules, tear lines: 3:1 on bg and surface */
  --ink: #1f1a15;
  --muted: #6a5f55;
  --positive: #2b7046;
  --positive-soft: #e3eee2;
  --warn: #9a5b00;
  --warn-soft: #fbecd3;
  --danger: #871e18;
  --danger-soft: #f6e0dc;

  /* Peel layer: ember moved toward orange. Swapped in where the core uses accent. */
  --peel: #ab450b;
  --peel-hover: #8a3708;
  --peel-ink: #ffffff;
  --peel-soft: #f6e3d3;
  --peel-soft-ink: #7a3410;
  --tag-edge: #1f1a15;      /* edge of a batch tag: ink by day */
  --accent: var(--peel);
  --accent-ink: var(--peel-ink);
  --accent-soft: var(--peel-soft);
  --accent-soft-ink: var(--peel-soft-ink);

  --shadow-button: 2px 2px 0 var(--ink);

  --font-sans: "Instrument Sans Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-title: "Space Grotesk Variable", "Instrument Sans Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-label: "Space Grotesk Variable", "Instrument Sans Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --label-track: 0.07em;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-10: 40px;
  --tap-min: 44px;
  --tap-sm: 36px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --border-control: 1.5px;
  --focus-ring: 2px;
}

@media (prefers-color-scheme: light) {
  :root { color-scheme: light; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #16120f;
    --surface: #211b17;
    --line: #3a302a;
    --line-strong: #807265;
    --ink: #f2eae0;
    --muted: #a99c8e;
    --positive: #5dba55;
    --positive-soft: #1f3326;
    --warn: #e6b35a;
    --warn-soft: #33281a;
    --danger: #e0705c;      /* was #996146, which is 3.4:1 on surface and fails as text */
    --danger-soft: #2f1c17;

    --peel: #f5a25a;
    --peel-hover: #f8b97f;
    --peel-ink: #16120f;
    --peel-soft: #3b2616;
    --peel-soft-ink: #f7b77e;
    --tag-edge: #a99c8e;    /* by night the tag edge steps back to muted, so five tags do not glare */
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--font-sans);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--peel-soft); color: var(--peel-soft-ink); }

main { max-width: 46rem; margin: 0 auto; padding: var(--space-2) var(--space-4) 56px; counter-reset: batch; overflow-wrap: break-word; }

header.site, footer.site { max-width: 46rem; margin: 0 auto; padding: 0 var(--space-4); }
header.site {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); flex-wrap: wrap;
  padding-top: var(--space-3); padding-bottom: var(--space-2);
}
.brand {
  display: inline-flex; align-items: center; gap: 9px; min-height: var(--tap-min);
  font-family: var(--font-title); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
/* The mark: a round glass with a bent paper straw. It is the favicon too, so it is fetched once. */
.brand img { display: block; width: 28px; height: 28px; }
header.site nav { display: flex; gap: var(--space-1); margin-right: calc(-1 * var(--space-2)); }
header.site nav a {
  display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 var(--space-2);
  color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none;
}
header.site nav a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }

footer.site { color: var(--muted); font-size: 14px; padding-bottom: var(--space-6); }
footer.site::before { content: ""; display: block; border-top: 1px solid var(--line); margin-bottom: var(--space-4); }
footer.site p { margin: 0 0 var(--space-2); }
footer.site a { display: inline-block; padding-block: 10px; color: var(--muted); }
footer.site a:hover { color: var(--ink); }

/* ---------- Type ---------- */

h1, h2, h3 { color: var(--ink); font-family: var(--font-title); text-wrap: balance; }
h1 {
  font-weight: 600; font-size: 28px; line-height: 1.12; letter-spacing: -0.025em;
  margin: var(--space-4) 0 var(--space-3);
}
h2 { font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; margin: 40px 0 var(--space-3); }
h3 { font-size: 18px; line-height: 1.3; font-weight: 600; margin: var(--space-6) 0 var(--space-2); }

/* Two beats: the lead steps back, the land is bold. Same face, same ink. */
.two-beat { text-wrap: wrap; }
.two-beat .beat-lead { font-weight: 400; }
.two-beat .beat-land { font-weight: 700; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }

/* The measure: a graduated rule under the page title, like the marks on a measuring cylinder.
   Baseline, a long tick every 40px, a short muted tick every 8px, a closing tick at the right. Never behind text. */
main > h1::after {
  content: "";
  display: block;
  height: 10px;
  margin-top: var(--space-3);
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(var(--ink), var(--ink)) right 0 / 1.5px 10px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 40px) 0 0 / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--muted) 0 1px, transparent 1px 8px) 0 0 / 100% 5px no-repeat;
}

p { margin: 0 0 var(--space-3); }
.lead { font-size: 18px; line-height: 1.5; color: var(--muted); margin-bottom: var(--space-4); }
.hint, .small { color: var(--muted); font-size: 14px; line-height: 1.5; }
strong { font-weight: 700; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--peel-hover); text-decoration-thickness: 2px; }
/* A link inside small print stays ink and keeps peel for its underline only. */
.hint a { color: var(--ink); text-decoration-color: var(--accent); }

ul, ol { padding-left: 22px; margin: 0 0 var(--space-4); }
li { margin: 0 0 6px; }
li::marker { color: var(--muted); }

/* Section heads of a prose page sit on a hairline. */
main > h2 { border-top: 1px solid var(--line); padding-top: var(--space-4); margin-top: 40px; }
/* The plan reads as a prep sheet: each section opens on an ink rule and a larger head.
   The shopping list carries its own double rule, so its head does not draw a second one. */
.sheet > h2 { font-size: 25px; line-height: 1.2; margin-top: 48px; padding-top: 14px; border-top-color: var(--ink); }
.sheet > h2:has(+ table.shopping) { padding-top: 0; border-top: 0; }

/* The label voice: table heads, field labels, the record fields of a bottle label. */
thead th,
tfoot th,
.cell-label,
.row > label:not(.check),
label.servings > span,
.label .fields label {
  font-family: var(--font-label); font-size: 11px; font-weight: 500; line-height: 1.3;
  letter-spacing: var(--label-track); text-transform: uppercase; color: var(--muted);
}

/* ---------- Cards and forms ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; margin: var(--space-4) 0;
}
.card > h2:first-of-type, .card > h3:first-child { margin-top: 0; }
.card h2 { font-size: 20px; margin-top: 32px; }
.card h3 { font-size: 17px; margin-top: 28px; }

label { display: block; margin: var(--space-3) 0; font-weight: 500; }
label.check { display: flex; gap: var(--space-3); align-items: flex-start; font-weight: 400; margin: 0; padding: var(--space-2) 0; min-height: var(--tap-min); }
label.check input { flex: none; margin: 2px 0 0; }

/* Field labels in the label voice, above their field. */
.row { display: flex; gap: var(--space-3) var(--space-6); flex-wrap: wrap; align-items: flex-end; }
.row > label:not(.check) { display: flex; flex-direction: column; gap: 6px; margin: var(--space-2) 0; font-size: 12px; line-height: 1.2; }
.row > label.check { align-self: flex-end; }

fieldset { border: 0; border-top: 1px solid var(--line); margin: 20px 0 0; padding: var(--space-4) 0 var(--space-1); min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 var(--space-1); font-family: var(--font-title); font-weight: 600; font-size: 17px; }
legend + * { clear: both; }
/* The wine, beer and spirits sliders: name, slider, share, on one aligned grid. */
fieldset > label:not(.check) { display: grid; grid-template-columns: 4.25rem minmax(0, 18rem) 4ch; align-items: center; gap: var(--space-3); margin: var(--space-2) 0; }
fieldset > label output { text-align: right; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0 var(--space-4); }

/* Step 1. The way to count comes first, straight under the title, so it needs no rule of its own above it. */
.card > h2 + fieldset { border-top: 0; margin-top: 0; padding-top: var(--space-1); }
/* The guests, hours, pace, spare and split: one group, which scripts hide for "I know how many drinks I want". */
.rule-inputs { border-top: 1px solid var(--line); margin-top: 20px; padding-top: var(--space-2); }
.rule-inputs[hidden] { display: none; }
/* The running total, set apart on the paper ground so the count reads at a glance. */
p.total { margin: var(--space-2) 0 0; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-sm); font-weight: 500; line-height: 1.45; font-variant-numeric: tabular-nums lining-nums; }

input[type="number"], input[type="text"], input[type="date"], select, textarea {
  font-family: var(--font-sans); font-size: 16px; font-weight: 400; line-height: 1.25; letter-spacing: 0; text-transform: none;
  font-variant-numeric: tabular-nums lining-nums;
  min-height: var(--tap-min); padding: 0 var(--space-3);
  border: var(--border-control) solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink);
}
input[type="number"] { width: 7rem; }
select { padding-right: var(--space-2); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:is(input[type="number"], input[type="text"], input[type="date"], select, textarea):focus { border-color: var(--ink); }
/* Native boxes, filled in ink when on, so peel stays on the one action. */
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--ink); margin: 0; }
output, [data-cocktails] { font-variant-numeric: tabular-nums lining-nums; font-weight: 600; min-width: 3.5ch; }
textarea {
  display: block; width: 100%; padding: var(--space-3); font-size: 14px; line-height: 1.5;
  background: var(--bg); resize: vertical;
}

/* ---------- Buttons: one filled (peel) per screen, the rest secondary (ink edge, hard offset) ---------- */

button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap-min); padding: 0 20px; margin: var(--space-2) var(--space-2) var(--space-2) 0;
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  border: var(--border-control) solid var(--ink); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-button);
}
:is(button:not(:disabled), a.button):hover { color: var(--ink); transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
:is(button:not(:disabled), a.button):active { transform: translate(2px, 2px); box-shadow: none; }

/* The filled one: the step forward on each form, and Print on the guest menu and the labels. */
button[type="submit"], nav.tabs:is([data-view="menu"], [data-view="labels"]) button {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: none;
}
:is(button[type="submit"], nav.tabs:is([data-view="menu"], [data-view="labels"]) button):not(:disabled):hover {
  background: var(--peel-hover); border-color: var(--peel-hover); color: var(--accent-ink); transform: none; box-shadow: none;
}
:is(button[type="submit"], nav.tabs:is([data-view="menu"], [data-view="labels"]) button):not(:disabled):active {
  background: var(--peel-hover); border-color: var(--peel-hover); transform: translateY(1px); box-shadow: none;
}
form > button[type="submit"] { min-height: 48px; margin-top: var(--space-6); }
button[data-copy] { min-width: 9rem; }

button:disabled, a.button[aria-disabled="true"] { opacity: 0.45; box-shadow: none; cursor: not-allowed; }
a.button[aria-disabled="true"] { pointer-events: none; }

:focus-visible { outline: var(--focus-ring) solid var(--accent); outline-offset: 3px; }

.js-only { display: none; }
.js .js-only { display: inline-flex; }
/* The plan updates by itself while scripts run, so its Update button is for pages without them, or after an update failed. */
.js .no-js-only { display: none; }
.js.live-off .no-js-only { display: block; }

/* What the page's script says it did ("Plan updated"), at the foot of the screen. Empty, it takes no room and shows nothing. */
.status {
  position: fixed; left: 50%; bottom: var(--space-4); z-index: 10; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 2 * var(--space-4)); margin: 0; padding: 10px 16px;
  background: var(--ink); color: var(--bg); border-radius: var(--radius-md);
  font-size: 15px; font-weight: 500; line-height: 1.4; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
}
.status:empty { padding: 0; box-shadow: none; background: none; }

/* ---------- Messages ---------- */

.error, .notice { border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: var(--space-4) 0; color: var(--ink); }
.error { border: 2px solid var(--danger); background: var(--danger-soft); }
.notice { border: var(--border-control) solid var(--warn); background: var(--warn-soft); }
.error p:last-child, .notice > :last-child { margin-bottom: 0; }

/* ---------- Stamps ---------- */

.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; vertical-align: 1px; }
.badge {
  display: inline-block; padding: 4px 7px 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  font-family: var(--font-label); font-weight: 500; font-size: 11px; line-height: 1.1; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--bg); white-space: nowrap;
}
/* Zero-proof is a fact, so it is an ink stamp, not a status colour. */
.badge.zero { border-color: var(--ink); color: var(--ink); background: none; }
/* Allergens: an amber frame on the amber ground, ink words (in dark mode amber text sits close to peel links). */
.badge.warn { border: var(--border-control) solid var(--warn); padding: 3.5px 6.5px 2.5px; background: var(--warn-soft); color: var(--ink); }

/* ---------- Step 2: the drink list ---------- */

ul.options { list-style: none; padding: 0; margin: 0 0 var(--space-4); }
ul.options li { border-top: 1px solid var(--line); margin: 0; }
ul.options li:last-child { border-bottom: 1px solid var(--line); }
/* Each drink, then its own number at the end of the row. On a phone the number drops under the name, in line with it. */
ul.options li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-4); }
label.check.drink { padding: var(--space-3) 0; }
label.check.drink strong { font-weight: 600; margin-right: 6px; }
label.check.drink .hint { display: inline-block; margin-top: 2px; }
label.servings { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: 400; }
label.servings input[type="number"] { width: 6rem; }
/* "Your numbers: 150 drinks." Empty, it takes no room. */
.servings-sum { margin: 0 0 var(--space-2); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; margin: var(--space-2) 0 var(--space-3); font-variant-numeric: tabular-nums lining-nums; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); }
th:last-child, td:last-child { padding-right: 0; }
td { overflow-wrap: anywhere; }
thead th { padding-top: 0; padding-bottom: 7px; border-bottom: 1px solid var(--line-strong); vertical-align: bottom; }
/* The sum rule: the one heavy line in a batch tag. */
tfoot th, tfoot td { border-bottom: 0; border-top: 1.5px solid var(--ink); }
tfoot td { font-weight: 700; }
tfoot th { vertical-align: middle; color: var(--ink); }
.metric { color: var(--muted); }
.cell-label { display: none; }

/* ---------- The view switch (the family's segmented control) ---------- */

nav.tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 20px; }
nav.tabs .segmented { display: inline-flex; }
nav.tabs a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px;
  border: var(--border-control) solid var(--ink); background: var(--surface); color: var(--ink);
  font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
nav.tabs a + a { margin-left: calc(-1 * var(--border-control)); }
nav.tabs a:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
nav.tabs a:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
nav.tabs a:not([aria-current]):hover { background: var(--peel-soft); color: var(--ink); }
nav.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); font-weight: 600; }
nav.tabs a:focus-visible { position: relative; z-index: 1; }
nav.tabs button { margin: 0; min-height: 40px; padding: 0 14px; font-size: 14px; }

/* ---------- The plan: each drink is a batch tag ---------- */

.drink-card {
  position: relative; counter-increment: batch;
  border: var(--border-control) solid var(--tag-edge); border-radius: var(--radius-sm);
  padding: 0 24px 20px; margin: 20px 0;
}
/* The tag line: a punched eyelet, the batch number, a tear line under it.
   The number is decoration, so it is hidden from screen readers (the "/ ''" alt text). */
.drink-card::before {
  content: "Batch " counter(batch, decimal-leading-zero);
  content: "Batch " counter(batch, decimal-leading-zero) / "";
  display: block; margin: 0 -24px 16px; padding: 8px 24px 7px 46px;
  font-family: var(--font-label); font-size: 11px; font-weight: 500; line-height: 1.3;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  background: var(--bg); border-bottom: 1px dashed var(--line-strong);
  border-radius: calc(var(--radius-sm) - var(--border-control)) calc(var(--radius-sm) - var(--border-control)) 0 0;
}
.drink-card::after {
  content: ""; position: absolute; left: 22px; top: 8px; width: 13px; height: 13px; border-radius: 50%;
  border: var(--border-control) solid var(--tag-edge); background: var(--surface);
}
.drink-card h3 { font-size: 21px; line-height: 1.2; margin: 0 0 8px; }
.drink-card h3 + p { margin: 0 0 14px; }
/* A drink the host renamed keeps its recipe's name in a small line under the heading. */
.drink-card .recipe-name { margin: -4px 0 10px; color: var(--muted); font-size: 15px; }
.drink-card .recipe-name + p { margin: 0 0 14px; }
.drink-card table { margin: 4px 0; }
.drink-card th:last-child, .drink-card td:last-child { text-align: right; white-space: nowrap; }
.drink-card td:first-child .hint { font-size: 13px; }
.drink-card p { margin: 10px 0; }
.drink-card p > strong:first-child { font-weight: 600; }

/* ---------- The plan: the shopping list reads like a prep ticket ---------- */

table.shopping { background: var(--surface); border: 1px solid var(--line); border-top: 3px double var(--ink); margin-top: 16px; }
table.shopping td:first-child { font-weight: 500; }
table.shopping td.hint { font-size: 14px; }
/* Only the amount stays on one line. The other bottle size and the verdict wrap under it, so a long verdict never
   squeezes the item and the working into slivers. */
table.shopping td.buy > strong { white-space: nowrap; }
table.shopping td.buy .alt { color: var(--muted); }
table.shopping td.buy .verdict { font-size: 15px; line-height: 1.45; }
/* What the host has: the count and its unit together, the bottle size under them. */
table.shopping td.have { vertical-align: top; }
table.shopping .have-field { white-space: nowrap; }
table.shopping td.have input[type="number"] { width: 5rem; margin-right: 4px; }
table.shopping td.have select { display: block; width: 6.5rem; margin-top: 6px; }

/* Columns with dashed rules from tablet width up (and on paper, where What you have is not printed); phones get their own layout below. */
@media (min-width: 641px), print {
  table.shopping :is(th, td) { padding: 10px 14px 10px 0; border-bottom: 1px dashed var(--line-strong); }
  table.shopping :is(th, td):first-child { padding-left: 16px; }
  table.shopping :is(th, td):last-child { padding-right: 16px; }
  table.shopping thead th { padding-top: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
  table.shopping tbody tr:last-child td { border-bottom: 0; }
  table.shopping td:first-child { width: 23%; }
  table.shopping td.buy { width: 27%; }
  /* As narrow as its fields, so the working keeps a readable width beside it. */
  table.shopping td.have { width: 1%; }
}

/* Prep timeline: on screen a quiet dash per task (a box would look like a checkbox that does
   nothing); on paper an empty box to tick. */
ul.prep { list-style: none; padding-left: 0; }
ul.prep > li { position: relative; padding-left: 24px; margin: 8px 0; }
ul.prep > li::before {
  content: ""; position: absolute; left: 2px; top: 0.78em; width: 10px;
  border-top: var(--border-control) solid var(--muted);
}

/* ---------- The plan: the controls that sit where they apply ---------- */

/* The water for a batch, on its card: a quiet panel, so the controls read apart from the facts above them. */
.drink-card .batch-controls { margin: 12px 0; padding: 2px 14px; background: var(--bg); border-radius: var(--radius-sm); }
label.water { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 8px 0; overflow-wrap: normal; }
label.water > input[type="number"] { width: 5.5rem; }
.batch-controls label.check { padding: 4px 0 8px; }

/* Prices and the host's own count, folded under the shopping list. */
details.extras { margin: var(--space-4) 0; padding: 0 var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
details.extras > summary { padding: 10px 0; cursor: pointer; font-family: var(--font-title); font-weight: 600; }
details.extras[open] { padding-bottom: var(--space-3); }
details.extras[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: var(--space-3); }
ul.prices { list-style: none; padding: 0; margin: 0 0 var(--space-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); column-gap: var(--space-6); }
ul.prices li { margin: 0; border-bottom: 1px solid var(--line); }
ul.prices label { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 0; padding: 6px 0; font-weight: 400; }
.price-field { white-space: nowrap; }
ul.prices input[type="number"] { width: 6rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin-top: var(--space-3); }
.actions button, .actions a.button { margin: var(--space-1) 0; }
#handoff-prompt { margin: 12px 0 4px; }

/* ---------- Guest menu: set like a bottle label ---------- */

.menu {
  position: relative; margin: var(--space-4) 0 0;
  background: var(--surface); padding: 64px 48px 56px; text-align: center;
}
.menu::before, .menu::after { content: ""; position: absolute; pointer-events: none; border: 0 solid var(--ink); }
.menu::before { inset: 10px; border-width: 2px; }
.menu::after { inset: 15px; border-width: 1px; }
.menu h1 {
  font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -0.015em;
  margin: 0 0 20px;
}
/* The title and the drink names can be edited: say so on hover, and keep the focus ring clear of the rule under the title. */
.menu [contenteditable]:hover { cursor: text; outline: 1px dashed var(--muted); outline-offset: 8px; border-radius: var(--radius-xs); }
.menu [contenteditable]:focus-visible { outline: var(--focus-ring) solid var(--accent); outline-offset: 8px; border-radius: var(--radius-xs); }
.menu h2[contenteditable]:is(:hover, :focus-visible) { outline-offset: 4px; }
/* The short ink rule under the title sits outside the h1, so an outline never meets it. */
.menu h1 + section::before { content: ""; display: block; width: 48px; margin: 0 auto 40px; border-top: 2px solid var(--ink); }
.menu section { margin: 0 0 32px; }
.menu h2 { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.menu p { margin: 0 auto; max-width: 26rem; }
.menu .flags {
  display: inline-block; margin-top: 10px; padding: 4px 8px 3px; border: 1px solid var(--ink); border-radius: var(--radius-xs);
  font-family: var(--font-label); font-weight: 500; font-size: 12px; line-height: 1.2; letter-spacing: var(--label-track); text-transform: uppercase; color: var(--ink);
}
.menu .flags.allergen { border: var(--border-control) solid var(--warn); background: var(--warn-soft); }
.menu .small { margin-top: 40px; }

/* ---------- Bottle labels ---------- */

.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--space-4); }
.label {
  display: flex; flex-direction: column;
  background: var(--surface); border: 3px solid var(--ink); border-radius: var(--radius-sm);
  padding: var(--space-4) 18px; font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums lining-nums;
}
.label h2 { margin: 0 0 var(--space-3); font-size: 22px; font-weight: 700; line-height: 1.15; }
.label .recipe-name { margin: -8px 0 var(--space-3); color: var(--muted); font-size: 14px; }
.label p { margin: 0 0 var(--space-2); }
.label p > strong { font-weight: 600; }
/* The warning band: solid ink with paper-coloured type. A zero-proof label gets the same band, open. */
.label .alcohol, .label .flags.zero {
  margin: 0 -18px var(--space-3); padding: 7px 18px 6px; text-align: center;
  font-weight: 700; font-size: 14px; line-height: 1.2; letter-spacing: 0.16em; text-transform: uppercase;
}
.label .alcohol { background: var(--ink); color: var(--bg); }
.label .flags.zero { border-block: 2px solid var(--ink); color: var(--ink); }
.label .flags.allergen {
  align-self: flex-start; padding: 3.5px 5.5px 2.5px; border: var(--border-control) solid var(--warn); border-radius: var(--radius-xs); background: var(--warn-soft); color: var(--ink);
  font-family: var(--font-label); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
}
/* Write-on lines for the dates and the name, at the foot of the label, all starting on one line. */
.label .fields { margin: auto 0 0; padding-top: var(--space-3); display: grid; gap: 0; }
.label .fields label { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); align-items: baseline; gap: var(--space-2); margin: 0; }
.label .fields input {
  min-width: 0; width: 100%; min-height: var(--tap-min); padding: 0 var(--space-1);
  border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0; background: transparent;
}

/* A plan link is one long word, so let it wrap. */
main a { overflow-wrap: anywhere; }

/* ---------- Wider screens ---------- */

@media (min-width: 720px) {
  main, header.site, footer.site { padding-left: var(--space-6); padding-right: var(--space-6); }
  h1 { font-size: 36px; margin-top: var(--space-6); }
  .card { padding: var(--space-6); }
  .drink-card { padding: 0 24px 20px; }
  .menu h1 { font-size: 40px; }
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .sheet > h2 { font-size: 23px; margin-top: 40px; }
  .lead { font-size: 17px; }
  .card { padding: var(--space-4); }
  .drink-card { padding: 0 16px 16px; }
  .drink-card::before { margin: 0 -16px 14px; padding-left: 38px; padding-right: 16px; }
  .drink-card::after { left: 15px; }
  .drink-card h3 { font-size: 20px; }
  th, td { padding: 8px 10px 8px 0; }
  form > button[type="submit"] { width: 100%; }
  ul.options li { grid-template-columns: minmax(0, 1fr); }
  label.servings { margin: calc(-1 * var(--space-1)) 0 var(--space-3) calc(20px + var(--space-3)); }

  nav.tabs .segmented { display: flex; flex: 1 1 100%; }
  nav.tabs a { flex: 1 1 auto; padding: 0 8px; min-height: var(--tap-min); }
  nav.tabs button { min-height: var(--tap-min); margin-left: auto; }
  .batch-controls label.water { column-gap: 8px; }
  details.extras { padding: 0 var(--space-3); }

  /* The shopping list: item and amount on one line, then what the host has, then the working.
     The item keeps at least 7rem, so a long amount can never squeeze it to nothing. */
  table.shopping, table.shopping thead, table.shopping tbody { display: block; }
  table.shopping tr { display: grid; grid-template-columns: minmax(7rem, 1fr) auto; column-gap: 12px; padding: 10px 14px; border-bottom: 1px dashed var(--line-strong); }
  table.shopping tbody tr:last-child { border-bottom: 0; }
  table.shopping thead tr { padding-top: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
  table.shopping :is(th, td) { display: block; padding: 0; border: 0; }
  table.shopping :is(th, td):nth-child(2) { text-align: right; }
  /* What the host has and the working sit under each item here, so their column heads are not shown. */
  table.shopping thead th:nth-child(n + 3) { display: none; }
  table.shopping td:nth-child(n + 3) { grid-column: 1 / -1; }
  table.shopping td:last-child { margin-top: 4px; }
  /* A verdict is a sentence: with one, the whole Buy cell takes the line under the item. */
  table.shopping td.buy:has(.verdict) { grid-column: 1 / -1; text-align: left; margin-top: 2px; }
  /* The label, the count and the size on one line on most phones; a narrow one wraps the size under them. */
  table.shopping td.have { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
  table.shopping td.have:empty { display: none; }
  table.shopping td.have input[type="number"] { width: 4.25rem; }
  table.shopping td.have select { display: inline-block; width: 6rem; margin-top: 0; }
  table.shopping td.have .cell-label { display: inline; }

  .menu { padding: 52px 28px 44px; }
  .menu h1 + section::before { margin-bottom: 32px; }
}

/* Narrow phones: the mark, the wordmark and both links stay on one line. */
@media (max-width: 420px) {
  header.site { column-gap: var(--space-3); }
  .brand { gap: 8px; }
  .brand img { width: 26px; height: 26px; }
  header.site nav { margin-right: -6px; }
  header.site nav a { padding: 0 6px; font-size: 14px; }
}

/* ---------- Print: dark ink on white, whatever the device ---------- */

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --line: #bdb3a6;
    --line-strong: #6a5f55;
    --ink: #1f1a15;
    --muted: #5c5249;
    --positive: #2b7046;
    --positive-soft: #ffffff;
    --warn: #1f1a15;
    --warn-soft: #ffffff;
    --danger: #871e18;
    --danger-soft: #ffffff;
    --peel: #1f1a15;
    --peel-hover: #1f1a15;
    --peel-ink: #ffffff;
    --peel-soft: #ffffff;
    --peel-soft-ink: #1f1a15;
    --tag-edge: #1f1a15;
  }
  body { background: var(--bg); color: var(--ink); font-size: 12pt; line-height: 1.55; }
  main { max-width: none; padding: 0; }
  .no-print, .js .js-only { display: none !important; }
  a { color: inherit; text-decoration: none; }

  h1 { font-size: 1.9rem; margin: 0.5rem 0; }
  main > h1::after { margin-top: 0.4rem; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  /* .sheet > h2 is named too: its larger screen size would otherwise win on paper and add a page. */
  h2, main > h2, .sheet > h2 { font-size: 1.3rem; margin: 2rem 0 0.5rem; break-after: avoid; }
  main > h2, .sheet > h2 { margin-top: 2.2rem; padding-top: 0.4rem; border-top-color: var(--ink); }
  .sheet > h2:has(+ table.shopping) { padding-top: 0; }
  h3 { font-size: 1.1rem; margin: 0.9rem 0 0.3rem; break-after: avoid; }
  p { margin: 0.45rem 0; }
  .lead { font-size: 1.05rem; margin-bottom: 0.4rem; }
  .hint, .small { font-size: 0.9rem; }
  li { margin: 0.25rem 0; }
  th, td { padding: 0.4rem 0.5rem 0.4rem 0; }
  thead th { padding-bottom: 0.25rem; }

  .card, .menu, .label { break-inside: avoid; }
  .card { border: 0; border-top: 1px solid var(--ink); border-radius: 0; padding: 0.4rem 0; margin: 1rem 0; background: none; }
  /* Printed, each batch is still a tag you could cut out and tie to the jug. */
  .drink-card { border: var(--border-control) solid var(--ink); border-radius: var(--radius-sm); padding: 0 0.9rem 0.5rem; margin: 1rem 0; }
  .drink-card::before { margin: 0 -0.9rem 0.5rem; padding: 0.25rem 0.9rem 0.25rem 2.1rem; background: none; border-bottom-color: var(--ink); }
  .drink-card::after { left: 0.85rem; top: 0.37rem; width: 11px; height: 11px; border-color: var(--ink); }
  .drink-card h3 { font-size: 1.15rem; margin: 0 0 0.2rem; }
  .drink-card h3 + p { margin: 0 0 0.3rem; }
  .drink-card .recipe-name { margin: 0 0 0.2rem; font-size: 0.9rem; }
  .drink-card .recipe-name + p { margin: 0 0 0.3rem; }
  .drink-card p { margin: 0.25rem 0; }
  .drink-card table { margin: 0.2rem 0; }
  .drink-card :is(th, td) { padding-top: 0.3rem; padding-bottom: 0.3rem; }

  table.shopping { border-left: 0; border-right: 0; margin-top: 0.4rem; }
  table.shopping :is(th, td) { padding: 0.48rem 0.6rem 0.48rem 0; }
  table.shopping :is(th, td):first-child { padding-left: 0; }
  table.shopping :is(th, td):last-child { padding-right: 0; }
  table.shopping td.hint { font-size: 0.85rem; }
  table.shopping td.buy .verdict { font-size: 0.9rem; }
  /* Without What you have, the paper keeps the three columns it always had. */
  table.shopping td:first-child { width: 27%; }
  table.shopping td.buy { width: 30%; }

  /* On paper the prep timeline is a list to tick off. */
  ul.prep > li { margin: 0.3rem 0; padding-left: 22px; }
  ul.prep > li::before {
    top: 0.25em; width: 11px; height: 11px;
    border: var(--border-control) solid var(--line-strong); border-radius: calc(var(--radius-xs) / 2);
  }

  .labels { grid-template-columns: 1fr 1fr; gap: 10px; }
  .label { border-width: 2.5px; padding: 12px 14px; font-size: 10.5pt; line-height: 1.4; }
  .label h2 { font-size: 17pt; margin: 0 0 8px; }
  .label .recipe-name { margin: -4px 0 8px; font-size: 9.5pt; }
  .label p { margin: 0 0 6px; }
  .label .alcohol, .label .flags.zero { margin: 0 -14px 10px; padding: 5px 14px 4px; font-size: 10pt; }
  /* On paper the warning stays a filled band in ink letters: a mid-tone ground ruled in ink. */
  .label .alcohol {
    background: var(--line); color: var(--ink); border-block: 2px solid var(--ink);
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .label .flags.zero { border-block-width: 1px; font-weight: 600; }
  .label .fields { padding-top: 10px; gap: 4px; }
  .label .fields input { min-height: 28px; border-bottom-width: 1px; }
  /* An empty date prints its mm/dd/yyyy mask in muted, as a guide for handwriting. */
  .label .fields input::-webkit-calendar-picker-indicator { display: none; }
  .label .fields input[type="date"] { color: var(--muted); font-size: 0.8rem; }

  /* On paper the menu keeps its frame but tightens, so eight drinks and the wine, beer and spirits line fit one page. */
  .menu { max-width: none; padding: 2.25rem 2rem 1.75rem; }
  .menu h1 { font-size: 1.9rem; margin-bottom: 0.75rem; }
  .menu h1 + section::before { margin-bottom: 1.25rem; }
  .menu section { margin: 0 0 1rem; }
  .menu h2 { font-size: 1.2rem; margin: 0 0 0.1rem; }
  .menu .flags { margin-top: 0.3rem; }
  .menu .small { margin-top: 1.25rem; }
  .menu [contenteditable] { outline: none !important; }
  .badge { border-color: currentColor; }
}
