/* =====================================================================
   BRAND TOKENS
   Every colour, font, radius and space on every page comes from here.
   To rebrand for another seller, edit this block.
   Nothing outside it should need to change.
   ===================================================================== */
:root {
  color-scheme: light;        /* always light, even when the phone is in dark mode */

  /* Colours: milky white drink, black cap, pink label, green "benefits" text */
  --c-page: #fbf8f3;          /* milk */
  --c-surface: #ffffff;
  --c-ice: #e8f3f6;           /* cold tint for panels */
  --c-ink: #1d1520;           /* text, bottle cap */
  --c-muted: #5e5662;         /* 6.6:1 on page */
  --c-line: #e7e0da;          /* dividers only (decorative) */
  --c-line-strong: #857b88;   /* input borders: 3:1 or more, as WCAG asks for controls */
  --c-accent: #c2185b;        /* hibiscus pink, button fill */
  --c-accent-press: #8e0f45;
  --c-on-accent: #ffffff;     /* 5.9:1 on accent */
  --c-accent-text: #c2185b;   /* accent used as text */
  --c-accent-soft: #fbe6ee;
  --c-leaf: #1b7a45;
  --c-on-leaf: #ffffff;       /* 5.4:1 on leaf */
  --c-leaf-text: #1b7a45;
  --c-leaf-soft: #e2f2e8;
  --c-chili: #b3261e;
  --c-on-chili: #ffffff;
  --c-chili-text: #b3261e;
  --c-chili-soft: #fbe8e6;
  --c-sun: #f6c445;           /* "needs you" highlight on the owner page */
  --c-on-sun: #1d1520;
  --c-speck: rgba(29, 21, 32, 0.15);  /* millet flecks in the background */
  --c-shadow: rgba(29, 21, 32, 0.12);
  --c-focus: #1d1520;
  --c-bottle: #c2185b;        /* stock meter bottles */
  --c-cap: #1d1520;
  --c-header: #1d1520;        /* owner page top bar */
  --c-on-header: #fbf8f3;

  /* Fonts: no downloads. iPhones get SF Pro Rounded for display text. */
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.8125rem;   /* 13px */
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-input: 1rem;     /* never below 16px, or iPhone Safari zooms in on focus */
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-price: clamp(3.25rem, 16vw, 4.75rem);
  --fw-body: 400;
  --fw-bold: 700;
  --fw-heavy: 850;
  --lh-body: 1.5;
  --lh-tight: 1.05;

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 24px;
  --r-pill: 999px;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Sizes */
  --tap: 48px;          /* smallest tap target */
  --tap-lg: 56px;
  --border: 2px;
  --hair: 1px;
  --focus-ring: 3px;
  --page-max: 480px;
  --shot-w: 112px;      /* bottle photo width in the header */
  --shot-tilt: 3deg;
  --meter-w: 13px;      /* one bottle in the stock meter */
  --meter-h: 26px;
  --radio: 20px;
  --qty-w: 76px;
  --icon: 18px;
  --speck-a: 23px 29px; /* spacing of the two layers of millet flecks */
  --speck-b: 37px 31px;

  /* Shadows and motion */
  --shadow-1: 0 1px 2px var(--c-shadow);
  --shadow-2: 0 8px 24px var(--c-shadow);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 0.18s;
}

/* =====================================================================
   BASE
   ===================================================================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  /* The home-bar and notch areas (viewport-fit=cover) */
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--c-page);
  color: var(--c-ink);
  font: var(--fw-body) var(--fs-md) / var(--lh-body) var(--font-body);
}

h1, h2, h3, .price-num, .hero-title, .ref, button, .wordmark { font-family: var(--font-display); }

button { font: inherit; font-family: var(--font-display); cursor: pointer; color: inherit; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { padding: 0; }
img { display: block; max-width: 100%; }

:focus-visible { outline: var(--focus-ring) solid var(--c-focus); outline-offset: var(--border); }

.small { font-size: var(--fs-xs); color: var(--c-muted); }
.error { color: var(--c-chili-text); font-weight: var(--fw-bold); }
.ok { color: var(--c-leaf-text); font-weight: var(--fw-bold); }

/* =====================================================================
   HEADER (customer pages): speckled milk, like the drink itself
   ===================================================================== */

.top {
  padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-4) var(--s-10);
  background-color: var(--c-page);
  background-image:
    radial-gradient(circle, var(--c-speck) 1.3px, transparent 1.9px),
    radial-gradient(circle, var(--c-speck) 1px, transparent 1.6px);
  background-size: var(--speck-a), var(--speck-b);
  background-position: 0 0, 11px 17px;
}
.top > * { max-width: var(--page-max); margin-left: auto; margin-right: auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: var(--tap);
  margin-bottom: var(--s-4);
}
.wordmark {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-heavy);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.wordmark span { color: var(--c-accent-text); }
.wordmark a { color: inherit; text-decoration: none; }

/* WhatsApp: in the header, so it never covers the form */
.wa {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--c-leaf);
  color: var(--c-on-leaf);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;
}
.wa svg { width: var(--icon); height: var(--icon); fill: currentColor; }

.hero-row { display: flex; align-items: flex-start; gap: var(--s-4); }
.hero { flex: 1; min-width: 0; }
.hero p { margin: 0; }

/* The real bottle, in a slightly tilted frame */
.shot {
  flex: none;
  width: var(--shot-w);
  margin-top: var(--s-1);
  padding: var(--s-1);
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  transform: rotate(var(--shot-tilt));
}
.shot img { width: 100%; height: auto; aspect-ratio: 320 / 574; border-radius: var(--r-sm); object-fit: cover; }

.kicker {
  margin: 0 0 var(--s-1) !important;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--c-accent-text);
}

.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s-2); }
.price-num {
  font-size: var(--fs-price);
  font-weight: var(--fw-heavy);
  line-height: var(--lh-tight);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
/* Closed / Sold out reuse .price-num with words, so keep those smaller */
.state > .price-num { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.price-unit { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--c-muted); }
.hero-title { font-size: var(--fs-2xl); font-weight: var(--fw-heavy); letter-spacing: -0.02em; line-height: var(--lh-tight); }
.hero-line { margin-top: var(--s-2) !important; font-size: var(--fs-md); font-weight: var(--fw-bold); }

/* The memorable bit: stock as a row of little bottles (one per bottle left, up to 12) */
.meter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-1); margin: var(--s-4) 0 0; }
.meter i {
  position: relative;
  width: var(--meter-w);
  height: var(--meter-h);
  margin-top: 6px;              /* room for the cap */
  border-radius: 4px 4px 3px 3px;
  background: var(--c-bottle);
  transform-origin: bottom;
}
.meter i::before {             /* cap */
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -6px;
  height: 5px;
  border-radius: 2px;
  background: var(--c-cap);
}
.meter i::after {              /* milky glass above the label */
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 2px;
  height: 5px;
  border-radius: 2px;
  background: var(--c-surface);
  opacity: 0.85;
}
.meter.play i { animation: pop 0.4s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes pop { from { transform: translateY(8px) scale(0.6); opacity: 0; } }

.tag {
  display: inline-flex;
  align-items: center;
  margin: var(--s-3) 0 0 !important;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--c-leaf);
  color: var(--c-on-leaf);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.tag.quiet { background: var(--c-surface); color: var(--c-ink); box-shadow: inset 0 0 0 var(--border) var(--c-line); }

/* Three promises, always visible under the price */
.promise {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding: 0;
  list-style: none;
}
.promise li {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--c-ice);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
/* Promises only make sense next to the form: hide them when sold out,
   closed, unreachable or after the order is placed (not while loading). */
body:has(#order-form[hidden]):not(:has(.state .loading)) .promise { display: none; }
/* After ordering, the reference matters more than the photo: keep it above the fold */
body:has(#done:not([hidden])) .shot { width: calc(var(--shot-w) / 2); }
body:has(#done:not([hidden])) .top { padding-bottom: var(--s-8); }
.promise li:first-child { background: var(--c-accent-soft); color: var(--c-accent-text); }

/* =====================================================================
   SHEET (the form and the "order placed" card)
   ===================================================================== */

main {
  max-width: var(--page-max);
  margin: calc(-1 * var(--s-5)) auto 0;
  padding: 0 var(--s-3) calc(var(--s-10) + env(safe-area-inset-bottom));
}

.sheet, .card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-5) var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-1);
}
.sheet p, .card p { margin: 0 0 var(--s-3); }
.sheet h2, .card h2 { margin: 0 0 var(--s-2); font-size: var(--fs-xl); font-weight: var(--fw-heavy); letter-spacing: -0.02em; }
.sheet h3 { margin: 0 0 var(--s-2); font-size: var(--fs-lg); font-weight: var(--fw-heavy); }

.ref {
  margin: 0 0 var(--s-3) !important;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-heavy);
  letter-spacing: 0.02em;
  color: var(--c-accent-text);
  font-variant-numeric: tabular-nums;
  -webkit-user-select: all;
  user-select: all;
}
.link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--c-accent-text);
  font-weight: var(--fw-bold);
}

/* ---------- Form ---------- */

.field { margin: 0 0 var(--s-6); }
label, legend { display: block; margin: 0 0 var(--s-2); font-weight: var(--fw-bold); }

input[type="text"], input[type="tel"], input[type="number"], input[type="password"],
input[type="date"], input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: var(--tap-lg);     /* iOS: empty date/time inputs otherwise collapse */
  padding: var(--s-3) var(--s-4);
  font: inherit;
  font-size: var(--fs-input);
  color: var(--c-ink);
  background: var(--c-surface);
  border: var(--border) solid var(--c-line-strong);
  border-radius: var(--r-md);
}
input::placeholder { color: var(--c-muted); opacity: 1; }
input::-webkit-date-and-time-value { text-align: left; }   /* iOS centres it by default */
input:focus { border-color: var(--c-accent); }
input:focus-visible { outline: var(--focus-ring) solid var(--c-focus); outline-offset: var(--border); }

.stepper {
  display: flex;
  width: max-content;
  border: var(--border) solid var(--c-line-strong);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stepper button {
  width: var(--tap-lg);
  min-height: var(--tap-lg);
  border: 0;
  background: var(--c-ice);
  color: var(--c-ink);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  touch-action: manipulation;    /* no double-tap zoom when tapping + fast */
}
.stepper button:active { background: var(--c-accent-soft); }
.stepper input {
  width: var(--qty-w);
  min-height: var(--tap-lg);
  padding: 0;
  text-align: center;
  border: 0;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-heavy);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper :focus-visible { outline-offset: calc(-1 * var(--focus-ring)); }

/* Selectable tiles (radio buttons) */
.choice { position: relative; margin: 0 0 var(--s-2); font-weight: var(--fw-body); }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice span {
  position: relative;
  display: block;
  min-height: var(--tap-lg);
  padding: var(--s-3) var(--s-4) var(--s-3) calc(var(--s-4) * 3);
  background: var(--c-surface);
  border: var(--border) solid var(--c-line-strong);
  border-radius: var(--r-md);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.choice span::before {
  content: "";
  position: absolute;
  left: var(--s-4);
  top: 50%;
  width: var(--radio);
  height: var(--radio);
  margin-top: calc(var(--radio) / -2);
  border: var(--border) solid var(--c-muted);
  border-radius: 50%;
  background: var(--c-surface);
}
.choice b { display: block; font-weight: var(--fw-bold); }
.choice small { display: block; font-size: var(--fs-sm); color: var(--c-muted); }
.choice input:checked + span { background: var(--c-accent-soft); border-color: var(--c-accent); }
.choice input:checked + span::before {
  border-color: var(--c-accent);
  background: radial-gradient(circle, var(--c-accent) 0 45%, var(--c-surface) 50%);
}
.choice input:focus-visible + span { outline: var(--focus-ring) solid var(--c-focus); outline-offset: var(--border); }
.choice input:disabled { cursor: not-allowed; }
.choice input:disabled + span { opacity: 0.55; }

.reorder { margin: 0 0 var(--s-6); padding: var(--s-3); background: var(--c-ice); border-radius: var(--r-md); }
.linkbtn {
  display: block;
  min-height: var(--tap);
  margin: var(--s-1) auto 0;
  padding: 0 var(--s-3);
  border: 0;
  background: none;
  color: var(--c-muted);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  text-decoration: underline;
}

button.secondary {
  min-height: var(--tap);
  padding: 0 var(--s-5);
  background: var(--c-surface);
  color: var(--c-accent-text);
  border: var(--border) solid var(--c-accent);
  border-radius: var(--r-md);
  font-weight: var(--fw-bold);
}
.reorder button.secondary { width: 100%; }
#done > button.secondary { width: 100%; margin-top: var(--s-2); }

/* Total and order button stay on screen while the form scrolls, above the home bar */
.bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-5) calc(-1 * var(--s-5)) calc(-1 * var(--s-5));
  padding: var(--s-3) var(--s-5) calc(var(--s-3) + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-top: var(--hair) solid var(--c-line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.bar-total { flex: none; margin: 0 !important; }
.bar-total small { display: block; font-size: var(--fs-xs); color: var(--c-muted); }
.bar-total strong {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-heavy);
  font-variant-numeric: tabular-nums;
}

button.primary {
  flex: 1;
  min-height: var(--tap-lg);
  border: 0;
  border-radius: var(--r-md);
  background: var(--c-accent);
  color: var(--c-on-accent);
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
  touch-action: manipulation;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
button.primary:active { background: var(--c-accent-press); transform: scale(0.98); }

/* ---------- After ordering ---------- */

.pay { margin: var(--s-5) 0; padding: var(--s-4); background: var(--c-ice); border-radius: var(--r-md); }
.pay p { margin: 0 0 var(--s-3); }
.pay input { margin-bottom: var(--s-3); }
.pay button.secondary { width: 100%; }
.copyrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin: 0 0 var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
  background: var(--c-surface);
  border-radius: var(--r-sm);
}
.copyrow .small { display: block; }
.copyrow strong {
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  -webkit-user-select: all;     /* one tap selects it if "Copy" fails */
  user-select: all;
}
.copy {
  flex: none;
  min-width: 72px;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: var(--c-surface);
  color: var(--c-accent-text);
  border: var(--border) solid var(--c-accent);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

/* ---------- Status page ---------- */

.steps { list-style: none; padding: 0; margin: var(--s-4) 0; }
.steps li {
  position: relative;
  margin-bottom: var(--s-2);
  padding: var(--s-3) var(--s-4);
  min-height: var(--tap);
  border: var(--border) solid var(--c-line);
  border-radius: var(--r-md);
  color: var(--c-muted);
}
.steps li.past { color: var(--c-leaf-text); border-color: var(--c-leaf-soft); background: var(--c-leaf-soft); }
.steps li.past::before { content: "✓ "; font-weight: var(--fw-bold); }
.steps li.current { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-ink); font-weight: var(--fw-bold); }
.steps li small { display: block; font-weight: var(--fw-body); color: var(--c-muted); }
.top-short { padding-bottom: var(--s-8); }
.top-short .hero-title { margin: 0 auto; }
.endnote { padding: var(--s-4); border-radius: var(--r-md); background: var(--c-chili-soft); }
.loading { color: var(--c-muted); }

/* ---------- Misc ---------- */

/* Hidden field for bots. Off-screen, not display:none, because bots skip those. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.foot { margin: var(--s-6) 0 0; text-align: center; font-size: var(--fs-xs); color: var(--c-muted); }

@media (min-width: 400px) {
  :root { --shot-w: 124px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .shot { transform: none; }
}
