/* One Thick Coat — the "RACK" visual direction.
 *
 * THE RULE THAT KEEPS IT COHERENT:
 *   the paint is the only colour.
 * Chrome, type, rules, fills and states are neutral — greys, near-black,
 * near-white. Every chroma on screen is a real pigment: a swatch, a mix chip,
 * a photograph. That is what makes a wall of 300 pots readable instead of a
 * fruit salad, and it means a new module cannot quietly introduce a decorative
 * hue. If something needs to stand out, it uses weight, size or a rule — not a
 * colour. The two exceptions are semantic and deliberately desaturated:
 * --warn (running low) and --bad (out / destructive).
 *
 * Typography follows fuel's rule, borrowed because it works:
 *   if a human wrote it       -> IBM Plex Sans
 *   if the machine emitted it -> IBM Plex Mono, uppercase, tracked, muted
 * So a paint CODE, a hex value, a drop ratio and a ΔE are all mono; a paint
 * NAME and a recipe note are sans.
 *
 * THEMING: the full light palette is declared on bare :root. Dark redefines
 * ONLY the tokens, twice — once under prefers-color-scheme (so the OS is
 * followed by default) and once under [data-theme="dark"] (so an explicit
 * choice wins in both directions). No colour anywhere has its only definition
 * inside a media query.
 *
 * CSP NOTE: this site ships style-src 'self' with no 'unsafe-inline', so there
 * are no <style> blocks and no style="" attributes anywhere in the HTML.
 * Swatch colours are applied from JS via the CSSOM (el.style.setProperty),
 * which CSP does not restrict — that is the one channel by which real pigment
 * gets on screen.
 */

:root {
  /* surfaces, lightest to darkest */
  --paper:    #f7f7f5;
  --surface:  #ffffff;
  --sunken:   #efefec;
  --chrome:   #f2f2ef;

  /* ink */
  --ink:      #16171a;
  --ink-2:    #3a3c42;
  --muted:    #7c7d84;
  --faint:    #a3a4aa;

  /* lines */
  --rule:     #e3e3df;
  --rule-2:   #d2d2cd;

  /* the only two non-neutral tokens, both semantic, both muted on purpose */
  --warn:     #8a6a1f;
  --bad:      #a33a2b;
  --good:     #3d6b4c;

  /* controls */
  --btn-face:      #16171a;
  --btn-face-ink:  #ffffff;
  --btn-quiet:     #ffffff;
  --btn-quiet-ink: #16171a;

  --focus: #16171a;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* One declaration of the bar height: main's bottom padding, the scroll
     padding and the sheet offset all have to agree about it. */
  --nav-h: 56px;
  --top-h: 52px;
  --pad: 16px;
  --r: 10px;
  --r-sm: 7px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:    #131416;
    --surface:  #1b1c1f;
    --sunken:   #0e0f11;
    --chrome:   #191a1d;
    --ink:      #ecedee;
    --ink-2:    #c3c5c9;
    --muted:    #8b8d94;
    --faint:    #63656c;
    --rule:     #2b2d32;
    --rule-2:   #3a3d43;
    --warn:     #d9ad4a;
    --bad:      #e0705c;
    --good:     #74b98c;
    --btn-face:      #ecedee;
    --btn-face-ink:  #16171a;
    --btn-quiet:     #26282c;
    --btn-quiet-ink: #ecedee;
    --focus: #ecedee;
  }
}

:root[data-theme="dark"] {
  --paper:    #131416;
  --surface:  #1b1c1f;
  --sunken:   #0e0f11;
  --chrome:   #191a1d;
  --ink:      #ecedee;
  --ink-2:    #c3c5c9;
  --muted:    #8b8d94;
  --faint:    #63656c;
  --rule:     #2b2d32;
  --rule-2:   #3a3d43;
  --warn:     #d9ad4a;
  --bad:      #e0705c;
  --good:     #74b98c;
  --btn-face:      #ecedee;
  --btn-face-ink:  #16171a;
  --btn-quiet:     #26282c;
  --btn-quiet-ink: #ecedee;
  --focus: #ecedee;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  /* Explicit background: the viewport paints its own ground behind the page,
     and a transparent body borrows whatever is underneath. */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.75em; }
a { color: inherit; }

/* Machine-emitted values. */
.mono, code, .code {
  font-family: var(--mono);
  font-size: 0.82em;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.mono-up {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── boot gate ───────────────────────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  z-index: 100;
}
.boot-mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--rule-2);
  border-top-color: var(--ink);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* NOTE: `hidden` needs !important against any display rule that would
   otherwise win. boop shipped a full-viewport #login that stayed visible
   because it was display:grid and swallowed every click on the page behind it.
   This single line is what prevents that class of bug here. */
[hidden] { display: none !important; }

/* ── sign-in / join ──────────────────────────────────────────────────────── */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: var(--paper);
}
.gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 26px 22px 22px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand h1 { font-size: 1.25rem; }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  /* A pot seen from above, half filled. Neutral: the mark is chrome, not paint. */
  background: linear-gradient(to bottom, transparent 46%, var(--ink) 46%);
  flex: none;
}
.gate-sub { color: var(--muted); font-size: 0.9rem; margin: 14px 0 18px; }
.gate-foot {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 5px;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  padding: 10px 11px;
  /* 16px minimum or iOS Safari zooms the whole page on focus. */
  font-size: 16px;
}
textarea { resize: vertical; min-height: 78px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: transparent;
}

.hint { color: var(--muted); font-size: 0.8rem; margin: 6px 0 0; }
.err {
  color: var(--bad);
  font-size: 0.86rem;
  margin: 12px 0 0;
  border-left: 2px solid var(--bad);
  padding-left: 9px;
}

/* ── buttons ─────────────────────────────────────────────────────────────────
 * EVERY interactive control wears this. There is no bare-link button anywhere
 * in this app: a dialog's Cancel is a .btn-secondary with the same box, height
 * and padding as the .btn-primary it sits beside, just a quieter fill. An
 * underlined word next to a filled button reads as a footnote rather than as
 * the other half of the decision. Colours come from tokens so both themes are
 * covered by construction rather than by whichever one got screenshotted.
 */
.btn {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  padding: 11px 16px;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--btn-quiet);
  color: var(--btn-quiet-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--rule-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--btn-face); color: var(--btn-face-ink); border-color: var(--btn-face); }
.btn-primary:hover { opacity: 0.88; border-color: var(--btn-face); }

.btn-secondary { background: var(--btn-quiet); color: var(--btn-quiet-ink); border-color: var(--rule-2); }
.btn-secondary:hover { background: var(--sunken); border-color: var(--rule-2); }

.btn-danger { background: var(--btn-quiet); color: var(--bad); border-color: var(--rule-2); }
.btn-danger:hover { border-color: var(--bad); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--ink); padding: 8px 10px; }
.btn-quiet:hover { background: var(--sunken); border-color: transparent; }

.btn-icon { padding: 8px; min-height: 38px; width: 38px; background: transparent; border-color: transparent; }
.btn-icon:hover { background: var(--sunken); border-color: transparent; }

.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { font-size: 0.84rem; padding: 7px 11px; min-height: 34px; }

.row-btns { display: flex; gap: 9px; margin-top: 20px; }
.row-btns .btn { flex: 1; }

.i-theme {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(to right, currentColor 50%, transparent 50%);
  display: block;
}

/* ── shell ───────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 var(--pad);
  background: var(--chrome);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top);
}
.brand-sm .brand-mark { width: 18px; height: 18px; border-width: 1.5px; }
.brand-sm .brand-name { font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 4px; }

.menu {
  position: fixed;
  top: calc(var(--top-h) + 6px);
  right: var(--pad);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  padding: 5px;
  min-width: 190px;
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  cursor: pointer;
  text-decoration: none;
}
.menu-item:hover { background: var(--sunken); }

main {
  display: block;
  padding: var(--pad);
  /* Room for the fixed tab bar, plus the home-indicator inset on iOS. */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 1100px;
  margin: 0 auto;
}
main:focus { outline: none; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--chrome);
  border-top: 1px solid var(--rule);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 2px solid transparent;
  margin-top: -1px;
}
.tabbar a[aria-current="page"] { color: var(--ink); border-top-color: var(--ink); }
.tabbar .i { width: 17px; height: 17px; display: block; position: relative; }
.tabbar .i::before, .tabbar .i::after { content: ''; position: absolute; }

/* rack — a pot seen from above, paint in the bottom. Same mark as the logo. */
.i-rack {
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(to bottom, transparent 56%, currentColor 56%);
}
/* recipes — stacked steps */
.i-recipes {
  background:
    linear-gradient(currentColor, currentColor) left 0    / 100% 2.5px no-repeat,
    linear-gradient(currentColor, currentColor) left 50%  / 70%  2.5px no-repeat,
    linear-gradient(currentColor, currentColor) left 100% / 88%  2.5px no-repeat;
}
/* units — a model standing on a base */
.i-units::before {
  left: 4.5px; top: 0; width: 8px; height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 4px 4px 1px 1px;
}
.i-units::after {
  left: 0; bottom: 0; width: 17px; height: 3px;
  background: currentColor; border-radius: 1px;
}
/* mix — two pots overlapping */
.i-mix::before, .i-mix::after {
  top: 2px; width: 11px; height: 11px;
  border: 1.5px solid currentColor; border-radius: 50%;
}
.i-mix::before { left: 0; }
.i-mix::after  { right: 0; background: currentColor; }
/* feed — other people's work, tiled */
.i-feed {
  background:
    linear-gradient(currentColor, currentColor) 0    0    / 7px 7px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0    / 7px 7px no-repeat,
    linear-gradient(currentColor, currentColor) 0    100% / 7px 7px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 7px 7px no-repeat;
}

/* ── generic layout pieces ───────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-head p { color: var(--muted); font-size: 0.88rem; margin: 5px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}
.card > h2 { margin-bottom: 4px; }
.card > .sub { color: var(--muted); font-size: 0.86rem; margin: 0 0 14px; }

.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }

.list { border-top: 1px solid var(--rule); }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.list-row .grow { flex: 1; min-width: 0; }
/* display:block matters: these are two lines of a row, and as inline spans the
   name and the brand ran together as "White ScarCitadel". */
.list-row .name { display: block; font-weight: 500; }
.list-row .meta { display: block; color: var(--muted); font-size: 0.82rem; }
/* A row is a link in several views. Same rule as .chip: a control never wears
   the browser's default underline. */
a.list-row { text-decoration: none; color: inherit; }
a.list-row:hover { background: var(--sunken); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  color: var(--muted);
}
.tag-on   { color: var(--good); border-color: currentColor; }
.tag-off  { color: var(--faint); }
.tag-warn { color: var(--warn); border-color: currentColor; }
.tag-bad  { color: var(--bad);  border-color: currentColor; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 18px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r);
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 0.88rem; margin: 0; }

.soon {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 3px 8px;
}

/* A switch, not a checkbox: it is a control and it gets control styling. */
.chan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}
.chan:last-child { border-bottom: 0; }
/* These are TITLES, not field labels. Without this reset they inherit the
   global `label` rule — mono, uppercase, muted, tiny — and a switch row ends up
   looking identical to a text input's caption. */
.chan .chan-t {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin: 0;
}
.chan .chan-d { color: var(--muted); font-size: 0.82rem; }
.switch { position: relative; flex: none; width: 46px; height: 27px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  background: var(--sunken);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.14s ease, background 0.14s ease;
}
.switch input:checked + span { background: var(--btn-face); border-color: var(--btn-face); }
.switch input:checked + span::after { transform: translateX(19px); background: var(--btn-face-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.invite-link {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  margin-top: 10px;
}
.invite-link code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.87rem;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  max-width: calc(100vw - 32px);
}

/* ── desktop: the tab bar becomes a left rail ────────────────────────────── */
@media (min-width: 900px) {
  body { padding-left: 188px; }
  .topbar { padding-left: calc(var(--pad) + 0px); }
  .tabbar {
    top: 0; bottom: 0; right: auto;
    width: 188px;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    padding: calc(var(--top-h) + 14px) 12px 12px;
    border-top: 0;
    border-right: 1px solid var(--rule);
    z-index: 25;
  }
  .tabbar a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 11px;
    padding: 10px 12px;
    border-top: 0;
    border-radius: var(--r-sm);
    font-size: 0.72rem;
  }
  .tabbar a[aria-current="page"] { background: var(--sunken); border-top-color: transparent; }
  main { padding-bottom: 40px; }
  .toast { bottom: 24px; left: calc(50% + 94px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ── phase 2: the rack ────────────────────────────────────────────────────────
 * Reminder of the RACK rule: the paint is the only colour. Every swatch below
 * gets its colour from a --c custom property set in JS via the CSSOM, because
 * this site's CSP is style-src 'self' with no 'unsafe-inline' and a style=""
 * attribute would be silently dropped — leaving a grid of grey squares on a
 * site about paint. Nothing in the chrome may introduce a hue of its own.
 */

.segbar {
  display: flex;
  gap: 4px;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 4px;
  margin-bottom: 14px;
}
.seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.seg:hover { color: var(--ink); }
.seg-on { background: var(--surface); color: var(--ink); border-color: var(--rule-2); font-weight: 500; }
.seg-n { font-size: 0.7rem; color: var(--faint); }
.seg-on .seg-n { color: var(--muted); }

.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat {
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 58px;
}
.stat:hover { border-color: var(--rule-2); }
.stat-on { border-color: var(--ink); background: var(--sunken); }
.stat-n { font-size: 1.15rem; font-weight: 600; color: var(--ink); line-height: 1.1; }
.stat-l {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.filters { display: grid; gap: 9px; margin-bottom: 16px; }
.filter-row { display: flex; gap: 9px; }
.filter-row select { flex: 1; min-width: 0; }
.filter-row .btn { flex: none; }

.count-line { margin: 0 0 10px; }
.loading { padding: 34px; text-align: center; }

/* The grid itself. auto-fill with a min track so a phone gets 3 across and a
   wide desktop gets a genuine wall of pots, which is the point. */
.grid-swatch {
  display: grid;
  /* Wider tracks than the two-line version: three lines of text need the room
     or every brand name truncates to an ellipsis and stops being useful. */
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}
@media (min-width: 700px) {
  .grid-swatch { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
}

.tile {
  font: inherit;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 7px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  position: relative;
  overflow: hidden;
}
.tile:hover { border-color: var(--rule-2); }
/* Three lines under the swatch: name, brand, range. They are visually ranked
   so the eye lands on the name first and can still find the range without
   reading — name in the body face, brand quieter, range in the machine face
   (it is a catalogue classification, not a human's words). */
.tile-name  { font-size: 0.8rem; font-weight: 500; line-height: 1.25; }
.tile-brand { font-size: 0.68rem; color: var(--ink-2); line-height: 1.25; }
.tile-range {
  font-size: 0.62rem;
  line-height: 1.3;
  /* The line is a range name ("Speedpaint 2.0") most of the time and a paint
     type ("layer") when the range would just repeat the brand. Capitalising
     makes the two sources look like one field instead of two. */
  text-transform: capitalize;
}

.swatch {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  background: var(--c, var(--sunken));
  /* An inset hairline instead of a border: a pale paint on a pale card would
     otherwise have no edge at all, and the swatch has to read as an object. */
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14);
  margin-bottom: 5px;
}
.swatch-none {
  background: repeating-linear-gradient(45deg,
    var(--sunken) 0 6px, var(--chrome) 6px 12px);
  display: grid;
  place-items: center;
}
.swatch-q { font-family: var(--mono); color: var(--faint); font-size: 0.9rem; }
.swatch-xs { width: 26px; height: 26px; aspect-ratio: auto; flex: none; margin: 0; }
.swatch-sm { width: 44px; height: 44px; aspect-ratio: auto; flex: none; margin: 0; }

.hero-swatch {
  width: 100%;
  height: 116px;
  border-radius: var(--r-sm);
  background: var(--c, var(--sunken));
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14);
  margin-bottom: 14px;
}
.hero-swatch.swatch-none {
  background: repeating-linear-gradient(45deg, var(--sunken) 0 8px, var(--chrome) 8px 16px);
}

.tile-marks { position: absolute; top: 11px; right: 11px; display: flex; gap: 3px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--surface);
}
/* These four are the only place a status gets a colour, and they are the muted
   semantic tokens — not new hues invented for decoration. */
.dot-owned    { background: var(--good); }
.dot-low      { background: var(--warn); }
.dot-out      { background: var(--bad); }
.dot-wishlist { background: var(--faint); }
.dot-photo    { background: var(--ink); }

/* ── sheet ──────────────────────────────────────────────────────────────── */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(0 0 0 / 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
body.sheet-open { overflow: hidden; }
.sheet-panel {
  background: var(--paper);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r) var(--r) 0 0;
  border: 1px solid var(--rule-2);
  border-bottom: 0;
}
@media (min-width: 700px) {
  .sheet-scrim { align-items: center; }
  .sheet-panel { border-radius: var(--r); border-bottom: 1px solid var(--rule-2); max-height: 84dvh; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--rule);
  background: var(--chrome);
  border-radius: var(--r) var(--r) 0 0;
  flex: none;
}
.sheet-title { font-size: 1.05rem; }
.sheet-body {
  padding: var(--pad);
  overflow-y: auto;
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom));
}
.sheet-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.card-inline {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 14px;
  margin-bottom: 12px;
}
.card-inline h3 { margin-bottom: 4px; }
.card-inline .hint { margin-bottom: 10px; }

.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit;
  /* Chips are used on both <button> and <a>. Without this an anchor chip keeps
     the browser's underline and reads as a link wearing a pill, which is the
     half-finished look this codebase bans. */
  text-decoration: none;
  font-size: 0.84rem;
  padding: 8px 12px;
  min-height: 38px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { background: var(--sunken); }
.chip-on { background: var(--btn-face); color: var(--btn-face-ink); border-color: var(--btn-face); }

.photo-strip { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.photo { margin: 0; flex: none; width: 116px; display: grid; gap: 5px; }
.photo img {
  width: 116px; height: 116px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--rule);
  display: block;
}
.photo span { font-size: 0.64rem; }

/* A file input is unstyleable, so it is hidden and its <label> is a real
   button. The label MUST carry .btn — a bare "Add a photo" link next to
   styled controls is exactly the unfinished look this codebase bans. */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-label { cursor: pointer; }

.shot-preview {
  width: 100%; max-height: 220px; object-fit: contain;
  border-radius: var(--r-sm); border: 1px solid var(--rule);
  background: var(--sunken); display: block; margin-bottom: 12px;
}
.measured { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }

.near-list { display: grid; }
.near-row {
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.near-row:last-child { border-bottom: 0; }
.near-row:hover { background: var(--sunken); }
.near-row .name { display: block; font-size: 0.88rem; font-weight: 500; }
.near-row .meta { display: block; font-size: 0.76rem; color: var(--muted); }

.color-input {
  width: 100%; height: 44px; padding: 3px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer;
}
.colour-pick { margin-top: 10px; }

/* ── phase 3: recipes and units ──────────────────────────────────────────── */

.backlink {
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 4px 0;
}
.backlink:hover { color: var(--ink); }

.body-text { color: var(--ink-2); font-size: 0.94rem; max-width: 62ch; }
.section-h { margin: 20px 0 10px; }
.filter-chips { margin-bottom: 16px; align-items: center; }

.card-list { display: grid; gap: 9px; }
.rec-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 13px 14px;
}
.rec-card:hover { border-color: var(--rule-2); }
.rec-card .name { font-weight: 500; }
.rec-card .meta { color: var(--muted); font-size: 0.82rem; }

/* ── the steps, as a printed procedure ─────────────────────────────────────
 * Numbered by CSS counter rather than <ol> markers so the number can sit in
 * its own gutter and the step body can be a full-width block. */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 40px;
  border-left: 1px solid var(--rule-2);
  margin-left: 13px;
}
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step::before {
  content: counter(step);
  position: absolute;
  left: -13px;
  top: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.step-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; min-height: 26px; }
.step-kind {
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.62rem;
}
.step-title { font-weight: 500; }
.step-notes { color: var(--ink-2); font-size: 0.9rem; margin: 7px 0 0; max-width: 62ch; }
.step-meta { margin: 6px 0 0; font-size: 0.66rem; }
.step-img {
  display: block;
  margin: 9px 0 0;
  max-width: 260px;
  width: 100%;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
}

.step-paints { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 0; align-items: center; }
.paint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  font-size: 0.82rem;
  padding: 4px 9px 4px 4px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--surface);
}
/* "You have this one." The tick and border are the whole reason for showing
   somebody else's recipe — without it a shared recipe is just a photograph. */
.paint-pill.owned { border-color: var(--good); }
.paint-pill .ok { color: var(--good); }
.paint-pill .swatch { margin: 0; }
.pill-x {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font-size: 1rem; line-height: 1; padding: 2px 4px; border-radius: 3px;
}
.pill-x:hover { background: var(--sunken); color: var(--bad); }
.parts-input {
  width: 58px; font-size: 0.78rem; padding: 3px 6px; min-height: 0;
  border-radius: 4px;
}

/* ── the step editor ─────────────────────────────────────────────────────── */
.step-editor { display: grid; gap: 11px; }
.step-edit {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.step-edit-head { display: flex; align-items: center; gap: 7px; }
.step-edit-head select { flex: 1; min-width: 0; }
.step-n {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--sunken);
  border: 1px solid var(--rule);
  font-size: 0.7rem;
}
.step-edit textarea { min-height: 62px; }

.area-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.area-edit input { flex: 0 0 34%; }
.area-edit select { flex: 1; min-width: 0; }
.area-row { text-decoration: none; color: inherit; }
.area-row:hover { background: var(--sunken); }
.area-label {
  flex: 0 0 30%;
  max-width: 140px;
  color: var(--ink);
  font-size: 0.66rem;
}

/* ── units ───────────────────────────────────────────────────────────────── */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}
.unit-card {
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.unit-card:hover { border-color: var(--rule-2); }
.unit-cover { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.unit-cover-none {
  background: repeating-linear-gradient(45deg, var(--sunken) 0 8px, var(--chrome) 8px 16px);
  display: grid;
  place-items: center;
}
.unit-cover-none span { font-size: 0.66rem; color: var(--faint); }
.unit-body { padding: 10px 11px 12px; display: grid; gap: 3px; }
.unit-body .name { font-weight: 500; font-size: 0.9rem; }
.unit-body .meta { color: var(--muted); font-size: 0.76rem; }
.unit-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.photo-lg { width: 168px; }
.photo-lg img { width: 168px; height: 168px; }

.pick-list { margin-top: 12px; min-height: 180px; }

/* The escape hatch in the paint picker. A real button, full width, sitting
   directly under the search box — the point is that it is visible BEFORE you
   have given up searching, not buried after an empty result. */
.not-listed { width: 100%; margin-top: 9px; }

/* A sheet's primary action must never be below the fold.
 *
 * The recipe editor grows with every step you add, so Cancel/Save were ending
 * up off the bottom of the scroll area — on a phone that reads as "there is no
 * save button". Pinning the last button row to the bottom of the panel keeps
 * the decision visible however long the form gets. The negative margins undo
 * the body's padding so the bar spans the full panel width and its background
 * covers the content scrolling beneath it. */
.sheet-body > .row-btns:last-child {
  position: sticky;
  /* MUST be 0. A negative bottom offset pins the bar that far BELOW the
     scrollport edge, i.e. out of sight — which looks identical to "no save
     button" and is what shipped for about ten minutes. */
  bottom: 0;
  margin: 20px calc(-1 * var(--pad)) calc(-1 * var(--pad));
  padding: 12px var(--pad) calc(var(--pad) + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--rule);
  z-index: 1;
}

/* A paint pill is a link wherever it names a real catalog paint, so it needs
   the same no-underline treatment as a chip. */
a.paint-pill { text-decoration: none; color: inherit; }
a.paint-pill:hover { border-color: var(--rule-2); background: var(--sunken); }
a.paint-pill.owned:hover { border-color: var(--good); }

/* ── phase 4: the mixing lab ─────────────────────────────────────────────────
 * The one place where two colours are shown deliberately side by side, because
 * the gap between them IS the information: predicted on the left, measured off
 * a photograph on the right. */

.mix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 11px;
}
.mix-card {
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.mix-card:hover { border-color: var(--rule-2); }
/* Predicted and measured as two halves of one chip — a mix with no photo shows
   the hatched "not measured yet" half, which is a standing invitation. */
.mix-pair { display: flex; height: 76px; }
.swatch-half { flex: 1; height: 100%; border-radius: 0; margin: 0; aspect-ratio: auto; }
.mix-body { padding: 9px 11px 11px; display: grid; gap: 2px; }
.mix-body .name { font-weight: 500; font-size: 0.88rem; }
.mix-body .meta { color: var(--muted); font-size: 0.74rem; }

.compare { display: flex; gap: 12px; margin-bottom: 10px; }
.compare-half { flex: 1; display: grid; gap: 3px; justify-items: start; }
.swatch-big {
  width: 100%; height: 88px; aspect-ratio: auto; margin: 0 0 4px;
  border-radius: var(--r-sm);
}

.mix-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.mix-preview .swatch-big { width: 88px; flex: none; }

.mix-parts { display: grid; gap: 7px; margin-bottom: 6px; }
.mix-part {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 7px 9px;
}
.drops-input { width: 72px; flex: none; padding: 6px 8px; font-size: 0.86rem; }

.scale-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.scale-row label { margin: 0; }
.scale-row input { width: 84px; }
.drops { flex: none; }

.swatch-photo {
  width: 100%; max-width: 320px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); display: block;
}

.match-row { display: flex; gap: 9px; align-items: center; }
.match-row .color-input { flex: 0 0 84px; }
.hex-input { flex: 1; font-family: var(--mono); }

.match-result {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.match-result:last-child { border-bottom: 0; }
.mix-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.formula-part {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 190px;
  font-size: 0.82rem;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 3px 8px 3px 3px;
}
.plus { color: var(--faint); }
.ok { color: var(--good); }

.drop-target { cursor: crosshair; }

/* ── phase 5: the community ──────────────────────────────────────────────── */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.feed-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.feed-media { display: block; text-decoration: none; color: inherit; }
.feed-cover { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
/* A mix with no photograph is not a missing image — the colour IS the content,
   so it fills the frame instead of showing a placeholder. */
.feed-colour { background: var(--c, var(--sunken)); }
.feed-none {
  background: repeating-linear-gradient(45deg, var(--sunken) 0 8px, var(--chrome) 8px 16px);
  display: grid;
  place-items: center;
  color: var(--faint);
}
.feed-body { padding: 11px 12px 12px; display: grid; gap: 6px; }
.feed-title { font-weight: 500; text-decoration: none; color: inherit; }
.feed-title:hover { text-decoration: none; }
.feed-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.78rem; }
.feed-owner { text-decoration: none; color: var(--ink-2); }
.feed-owner:hover { color: var(--ink); }
.feed-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 2px; }
.feed-actions .btn { text-decoration: none; }

/* A lone like button must not stretch to the full width the way a Cancel/Save
   pair does — .row-btns makes its children flex:1, which is right for a
   decision and wrong for a single action. */
.social-row { margin-bottom: 14px; }
.social-row .btn { flex: 0 0 auto; }
.like { gap: 6px; }
.like svg { opacity: 0.4; }
.like-on svg { opacity: 1; }
.like-on { border-color: var(--bad); color: var(--bad); }

.comments { display: grid; gap: 12px; margin-bottom: 16px; }
.comment { border-left: 2px solid var(--rule-2); padding-left: 11px; }
.comment-reply { margin-left: 22px; border-left-color: var(--rule); }
.comment-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 3px; }
.comment-author { font-weight: 500; font-size: 0.88rem; text-decoration: none; color: inherit; }
.comment-author:hover { text-decoration: none; color: var(--ink); }
.comment-body { margin: 0; font-size: 0.92rem; color: var(--ink-2); white-space: pre-wrap; }
.comment-actions { display: flex; gap: 3px; margin-top: 3px; }
.comment-form textarea, .reply-form textarea { min-height: 64px; }
.reply-form { margin-top: 9px; }

/* ── the colour wheel ────────────────────────────────────────────────────────
 * The one place on this site where chrome carries chroma, and it is not
 * decoration: the wheel IS the data. Everything around it stays neutral so the
 * ring is the only colour competing with the paints below it. */

.wheel-panel {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
}
@media (min-width: 700px) {
  .wheel-panel { grid-template-columns: 260px 1fr; align-items: center; }
}
.wheel-wrap { display: grid; place-items: center; }
.wheel { width: 100%; max-width: 240px; touch-action: none; cursor: grab; display: block; }
.wheel:active { cursor: grabbing; }
.wheel:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 50%; }
.wheel-seg { stroke: var(--surface); stroke-width: 0.5; }
.wheel-sel { stroke: var(--ink); }
.wheel-dot { stroke: var(--ink); stroke-width: 2.5; }
.wheel-label {
  font-family: var(--mono);
  font-size: 15px;
  fill: var(--ink);
  letter-spacing: 0.04em;
}
.wheel-controls { display: grid; gap: 4px; align-content: center; }
.wheel-controls .chan { border-bottom: 0; padding-top: 0; }

/* Its own scrollport, so the wheel stays visible while you travel around it.
   position:relative makes the marker's offsetTop relative to THIS box, which is
   what the centring maths assumes. */
.wheel-strip {
  display: grid;
  gap: 10px;
  position: relative;
  max-height: 62vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--sunken);
}
/* Sticky panel on a tall screen: the wheel is the control for everything below
   it, so it should not be something you scroll away from. */
@media (min-width: 900px) {
  .wheel-panel { position: sticky; top: calc(var(--top-h) + 8px); z-index: 5; }
}
/* The marker for the chosen hue. It is a full-width rule rather than a chip so
   it is unmistakable while scrolling past at speed — the whole interaction is
   "travel away from here and back". */
.wheel-here {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  color: var(--ink);
}
.wheel-here::before, .wheel-here::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--ink);
}
.wheel-here span { font-size: 0.7rem; }

.neutral-band {
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-top: 8px;
}
.neutral-band summary { cursor: pointer; font-size: 0.88rem; }
.neutral-band summary::marker { color: var(--muted); }
.neutral-slot { margin-top: 10px; }

/* ── phase 6: notifications ──────────────────────────────────────────────── */

.bell { position: relative; }
.i-bell {
  width: 15px; height: 15px; display: block;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  position: relative;
}
.i-bell::after {
  content: '';
  position: absolute;
  left: -3px; right: -3px; bottom: -1.5px;
  height: 1.5px;
  background: currentColor;
}
.bell-count {
  position: absolute;
  top: 2px; right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--bad);
  color: var(--surface);
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 15px;
  text-align: center;
}

.notif-panel {
  width: min(340px, calc(100vw - 24px));
  padding: 0;
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.notif-list { overflow-y: auto; }
.notif {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--sunken); }
/* Unread carries a rule, not a colour: the RACK rule says chrome stays neutral,
   and a coloured row here would be the only non-pigment hue on the page. */
.notif-unread { border-left: 3px solid var(--ink); padding-left: 9px; }
.notif-title { font-size: 0.88rem; }
.notif-when { flex: none; font-size: 0.68rem; }
.notif-empty { padding: 20px 14px; color: var(--muted); font-size: 0.86rem; }
