/* ============================================================================
   Catalog module - product card grid (index) + product detail page.
   Builds on the app.css design system; only catalog-specific rules live here.
   ========================================================================= */

/* --- Explanatory copy --------------------------------------------------------
   The master catalog pages decide money in both directions, and nearly every
   control on them is a two-word label over a number: MOQ, Priority, Lead d,
   Delivers to. Two levels, so the page stays a working screen rather than a
   manual: a lede that is always visible and says what the card is for, and a
   disclosure holding the detail - open it when a column is not obvious, ignore
   it once it is. */
.card-lede { color: var(--ink-soft); font-size: .92rem; line-height: 1.55; margin: -2px 0 12px; }
.card-lede:last-child { margin-bottom: 0; }

.guide { margin: 10px 0 0; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.guide + .guide { margin-top: 8px; }
.guide > summary {
  cursor: pointer; padding: 8px 12px;
  font-weight: 600; font-size: .86rem; color: var(--ink-soft);
}
.guide > summary:hover { color: var(--ink); }
.guide[open] > summary { border-bottom: 1px solid var(--line); }
.guide .guide-body { padding: 11px 12px 12px; font-size: .88rem; line-height: 1.55; }
.guide .guide-body > p { margin: 0 0 8px; color: var(--ink-soft); }
.guide .guide-body > p:last-child { margin-bottom: 0; }

/* Term beside its explanation, so a column can be looked up rather than read
   through. max-content on the first track keeps every term on one line -
   these are field labels, not sentences. */
.guide-dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; margin: 0; }
.guide-dl dt { font-weight: 600; color: var(--ink); }
.guide-dl dd { margin: 0; color: var(--ink-soft); }

.guide-steps { margin: 0; padding-left: 20px; }
.guide-steps li { margin-bottom: 6px; color: var(--ink-soft); }
.guide-steps li:last-child { margin-bottom: 0; }
.guide-steps strong, .guide-dl dd strong { color: var(--ink); }

@media (max-width: 640px) {
  /* Two columns of a term and a sentence is one word per line on a phone. */
  .guide-dl { grid-template-columns: 1fr; gap: 0; }
  .guide-dl dt { margin-top: 9px; }
  .guide-dl dt:first-child { margin-top: 0; }
}

/* The supplier scorecard's metric table. Auto layout sizes columns by their
   content, and a two-word metric name beat a full sentence of basis text for
   the space - so the column that says what the number MEANS was the narrowest
   on the row. Fixed shares instead; the .stack breakpoint turns the cells into
   blocks anyway, which cancels the table layout on a phone. */
.scorecard-table { table-layout: fixed; }
.scorecard-table th:first-child,  .scorecard-table td:first-child  { width: 32%; }
.scorecard-table th:nth-child(2), .scorecard-table td:nth-child(2) { width: 14%; }

/* --- Sample request queue: the actions cell ----------------------------------
   Two disclosures whose forms open inside the cell. A table column is as wide
   as its widest content, so an open form on ONE row was widening the column for
   every row - Product went from 184px to 86px and the whole table reflowed
   under the click.

   ONE declared width, used whether the forms are open or shut - a column that
   merely tends to stay the same still jumps the first time a form is longer
   than the buttons above it. Set on both halves of the column, and qualified
   past `th:last-child:empty` in app.css, which is also asking for a width here
   because the actions header is unlabelled. In auto table layout `width` alone
   is only a suggestion, hence all three. */
table.data th.queue-actions, table.data td.queue-actions {
  width: 190px; min-width: 190px; max-width: 190px; white-space: normal;
}
.queue-actions form {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px;
}
/* Each control on its own line inside a narrow column; the inline max-widths
   on the inputs are for the wide layout this cell no longer has. */
.queue-actions form input { flex: 1 1 100%; max-width: 100%; min-width: 0; }
.queue-actions form .hint { flex-basis: 100%; margin: 0; }

/* --- Product grid --------------------------------------------------------- */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}
/* The same grid, inside a card: a related-products rail on a product page and
   the shelf under a zero-result search. It is the last thing in its box, so the
   grid's trailing margin would double the card's own padding; the cap keeps a
   rail of four from stretching to six columns on a wide screen and looking
   like a second catalog. */
.prod-rail { margin-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* minmax(0, 1fr), not 1fr: a bare 1fr will not shrink below a card's content,
   so four cards with a long name or a wide price line pushed the fourth past
   the right edge of the box on the storefront's "New arrivals". */
@media (min-width: 1100px) { .prod-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* The whole card is the link, so it carries the hover and the focus ring -
   an inner focusable element would put the ring around the name alone. */
a.prod-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 20, .05);
  padding: 0; color: var(--ink); overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.prod-card:hover {
  text-decoration: none;
  border-color: var(--green-600);
  box-shadow: 0 8px 20px rgba(16, 24, 20, .10);
  transform: translateY(-2px);
}
a.prod-card:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }

/* Body is one padded column; the price block is pinned to the bottom with
   margin-top:auto so cards in a row line their prices up however long the
   names run. */
.prod-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1 1 auto; }
.prod-meta {
  font-size: .72rem; color: var(--muted); letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Two lines, then ellipsis: a 90-character product name must not make its
   card twice the height of its neighbours. */
.prod-name {
  font-weight: 700; line-height: 1.35; font-size: .96rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-flags { display: flex; flex-wrap: wrap; gap: 4px; }

.prod-price {
  margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--green-900);
}
.prod-figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; }
.prod-figure .prod-range { font-size: 1.22rem; font-weight: 800; letter-spacing: -.01em; }
.prod-from, .prod-unit { font-weight: 400; color: var(--muted); font-size: .78rem; }
.prod-none { color: var(--muted); font-weight: 600; font-size: .85rem; }

/* --- Category navigation (storefront) ---------------------------------------
   Real anchors, not a dropdown: a crawler cannot operate a <select>, so a
   category page reached only through one is a page nothing links to. They
   scroll rather than wrap past two rows on a phone. */
.cat-nav {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px;
}
a.cat-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: .86rem; font-weight: 600; white-space: nowrap;
}
a.cat-chip:hover { text-decoration: none; border-color: var(--green-600); }
a.cat-chip.is-on { background: var(--green-900); border-color: var(--green-900); color: #fff; }
a.cat-chip .cat-n { font-weight: 400; font-size: .76rem; opacity: .65; }

@media (max-width: 700px) {
  .cat-nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
}

/* The promoted filter in the storefront hero. Shaped like a category chip on
   purpose - it is a link, and it should read as a way through the catalog
   rather than as one more control that belongs in the form below. Bigger than
   a chip because it is the one facet a buyer in this trade settles first. */
.hero-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hero-filters .hint { margin: 0; }
a.usa-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: .92rem; font-weight: 700; white-space: nowrap;
}
a.usa-toggle:hover { text-decoration: none; border-color: var(--green-600); }
a.usa-toggle.is-on { background: var(--green-900); border-color: var(--green-900); color: #fff; }
/* The count is the whole argument for clicking, so it is legible rather than
   a footnote - and it inverts with the chip so it stays readable when on. */
/* The count that rides next to an origin control. ONE definition: it appears
   on the storefront's toggle, on the catalog's tick row, on the collapsed
   filter summary and on the phone's slim bar, and four near-identical copies
   of the same pill had already started to drift on size. Only the inverted
   variant below is a real difference - it sits on a filled green button. */
.usa-n {
  font-weight: 700; font-size: .74rem; padding: 1px 7px; border-radius: 999px;
  background: var(--green-100); color: var(--green-900);
}
.usa-toggle .usa-n { font-size: .78rem; padding: 1px 8px; }
.usa-toggle.is-on .usa-n { background: rgba(255,255,255,.26); color: #fff; }

/* Origin as a tick row: the flag and the count sit on the label's baseline
   with the words, not above them, so the row reads as one phrase. */
.check-usa { gap: 7px; }
.check-usa .usa-flag { margin-right: 0; }

/* A block INSIDE a card, for a second thing the card is about.
   The pricing card carries two: what a variant costs, and the smallest quantity
   it can be bought at. They are different statements about the same product and
   the minimum has to be read first - price a tier at a quantity the variant
   cannot be ordered at and the tier is fiction - so it needs to read as its own
   thing without becoming its own card and pushing the prices below the fold. */
.sub-card {
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfb; padding: 13px 14px; margin: 0 0 16px;
}
.sub-title { font-weight: 700; font-size: .92rem; margin: 0 0 8px; }
.sub-card > .table-wrap { margin-bottom: 12px; }
.sub-card .form-grid { margin-bottom: 0; }

/* The floating save on the master product page. Hidden until app.js says the
   real Save button has scrolled out of view, so the page never shows two.
   Fixed rather than sticky for the same reason the catalog's slim bar is: out
   of the flow, it costs the layout nothing and its arrival shifts nothing. */
/* button.float-save, not .float-save: app.css sets `.btn, button.btn` and that
   second selector is (0,1,1), so a bare class here LOST the specificity tie and
   the button never hid. It looked like the observer was broken; the observer
   was fine and the rule was simply not applying. */
button.float-save { display: none; }
button.float-save.is-stuck {
  display: inline-flex;
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  box-shadow: 0 6px 20px rgba(16, 24, 20, .28);
}
@media (max-width: 560px) {
  /* Clear of a thumb resting at the bottom edge, and of the phone's own home
     indicator, which sits exactly where a bottom-right button wants to be. */
  button.float-save.is-stuck { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* --- Detail page banners ---------------------------------------------------- */
.order-banner { border-color: var(--green-600); background: #f0faf2; font-weight: 600; }
.disc-banner  { border-color: var(--amber); background: var(--amber-bg); }

/* --- Offers table ------------------------------------------------------------ */
tr.best-offer td { background: #f2faf4; }

/* Two or more bits of meta at the right end of a card title, kept together as
   one flex item so .card-title's space-between still reads title-left /
   meta-right rather than stranding the middle one mid-card. */
.card-title .title-meta { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* The product-detail spec table: label column shrinks to its longest label, the
   values take everything else. A width:100% table in auto layout splits the
   surplus between its columns instead, which put three hundred pixels between
   "Unit" and "ea" once the card went full width. width:1% is the shrink-to-fit
   idiom - the column still cannot render narrower than its min-content, so it
   lands exactly on the longest label. */
.spec-table td:first-child { width: 1%; white-space: nowrap; }

/* --- Buyer quotes -------------------------------------------------------------
   A <blockquote>, because that is what it is - but the browser default puts
   40px of margin on either side, which on a phone leaves the quote narrower
   than the hint under it and reading as an aside rather than the thing the
   section is for. Reset it and mark the left edge instead: the rule carries
   the "somebody else said this" signal the indent was there for, at a width
   that still fits a sentence. */
.buyer-quote {
  margin: 0; padding: 10px 0 10px 12px;
  border-left: 3px solid var(--line);
}
.buyer-quote + .buyer-quote { border-top: 1px solid var(--line); }
.buyer-quote p { margin: 4px 0 6px; }
.buyer-quote footer { margin: 0; }
/* Amber rather than the theme green: these are stars, and a green star reads
   as a status chip. Slightly tighter than body text so five of them are one
   glyph run and not a line of their own on a narrow card. */
.buyer-stars { color: #d97706; letter-spacing: 1px; line-height: 1.2; }

/* --- Compliance panel ---------------------------------------------------------- */
.comp-state { padding: 8px 0 4px; border-top: 1px solid var(--line); }
.comp-state:first-of-type { border-top: none; }
.comp-state h3 { margin: 6px 0 8px; }
.comp-req { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; }
.comp-req .comp-name { font-weight: 600; text-transform: capitalize; }
.comp-req .hint { flex-basis: 100%; margin: 0; }

/* A rule's validity window: two dates stacked in one cell rather than two
   columns of 140px date pickers pushing the row's buttons off the grid. */
.rule-window { white-space: nowrap; }
.rule-window input { display: block; }
.rule-window input + input { margin-top: 4px; }

/* --- "Request this document" ------------------------------------------------
   Sits at the right end of a document row: a short note box and the ask. On a
   phone the row has already wrapped, so it takes the full width rather than
   squeezing the note field to nothing. */
.doc-ask { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-ask input { min-width: 210px; flex: 1 1 210px; }
@media (max-width: 700px) {
  .linked-list li .doc-ask { flex-basis: 100%; }
  .doc-ask input { flex-basis: 100%; }
}

/* --- Linked items / link forms ---------------------------------------------------- */
.linked-list { list-style: none; margin: 0 0 14px; padding: 0; }
.linked-list li {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.linked-list li:last-child { border-bottom: none; }
.link-forms { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* --- Mobile ---------------------------------------------------------------------- */
@media (max-width: 900px) {
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
  .prod-body { padding: 10px 12px 12px; }
  .prod-figure .prod-range { font-size: 1.1rem; }
  .linked-list li .row-actions { margin-left: 0 !important; flex-basis: 100%; }
}


/* --- Card imagery ----------------------------------------------------------
   A fixed 4:3 well rather than an intrinsic height, so a grid of products
   whose photos were shot at different aspect ratios still lines up. Products
   with no photo keep the well (an empty placeholder) - a grid where only some
   cards have a picture reads as broken rather than as sparse. */
.prod-shot {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  /* White, not grey. Packaging is photographed on white, so a grey plate
     behind it fought the product's own background and made every shot look
     like it had a border it did not have. The hairline below still separates
     the picture from the card body. */
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
/* CONTAIN, not cover: a packaging SKU shot square or tall was being blown up
   and cropped to fill a 4:3 well, so a card showed the middle of a bag rather
   than the bag. Whole product, letterboxed on the well's own tint - the well
   still keeps the grid aligned, it just stops zooming to fill it.
   font-size/colour apply to the ALT TEXT when an image fails to load - an
   unstyled broken image dumps full-size black text across the card. */
.prod-shot img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  padding: 6px; box-sizing: border-box;
  font-size: .7rem; color: var(--muted); overflow: hidden;
}
/* The card's photo area with nothing in it rests on the drawn carton
   (assets/img/product.svg, rendered by shared/_prod_card.php) - the largest
   empty shape on the page deserves a drawing sized to it, not a thumbnail
   glyph scaled up or a tinted void. The drawing is transparent and sits on
   the well's own white, like every real photo. The compare tables keep the
   shared glyph in their own, smaller wells, where a drawing would be mush -
   same family, two sizes, each drawn for its space. */
.cmp-shot .prod-shot-empty { color: var(--green-700, #15803d); opacity: .42; }
.cmp-shot .prod-shot-empty svg { width: 40px; height: 40px; }

/* Status over the photo: availability, a compliance warning, "linked".
   pointer-events:none so the badges never eat the card's click. */
.prod-tags {
  position: absolute; inset: 8px 8px auto 8px;
  display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none;
}
.prod-tags .badge { box-shadow: 0 1px 3px rgba(16, 24, 20, .18); }
/* A slow zoom on hover - enough to feel live, not enough to crop anything the
   buyer was looking at. Off entirely for anyone who asked for less motion. */
.prod-shot img { transition: transform .35s ease; }
a.prod-card:hover .prod-shot img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) {
  a.prod-card, .prod-shot img { transition: none; }
  a.prod-card:hover { transform: none; }
  a.prod-card:hover .prod-shot img { transform: none; }
}

/* Price + MOQ ranges. The range sits on one line and wraps as a unit so
   "$0.42 – $1.10" never breaks across lines mid-dash. */
.prod-range { white-space: nowrap; }
/* A card quoting a negotiated price says so: the same figure without the
   badge reads as list price, and the buyer has no way to tell the difference. */
.prod-yours { vertical-align: 1px; }
.prod-moq { font-weight: 400; color: var(--muted); font-size: .78rem; }

/* Option chips: what a buyer can choose before they open the product. */
.prod-opts { display: flex; flex-wrap: wrap; gap: 4px; }
.opt-chip {
  font-size: .7rem; line-height: 1; padding: 4px 7px; border-radius: 999px;
  background: var(--green-50, #f0faf2); color: var(--green-900);
  border: 1px solid var(--green-600); font-weight: 600;
}

/* --- Product gallery (detail page) -----------------------------------------
   Hero + thumbnail strip. The strip scrolls horizontally rather than wrapping,
   so a product with ten photos does not push the buy panel below the fold on a
   phone. */
/* Bounded, not full-bleed: a 4:3 well across a 1100px card is a metre of
   product photo and pushes the offers table off the screen. */
/* Centred in its card: bounded at 560px inside a ~1150px card, a left-hugging
   gallery leaves half the card empty beside it - most obvious on a product
   with a single photo, where there is no thumbnail strip to balance it. */
.gallery { display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin-inline: auto; }
/* Product video: the gallery's width, the browser's player. aspect-ratio
   holds the well open before metadata arrives, so the page does not reflow
   when the clip's real height lands. */
.prod-video { margin: 0 auto 14px; max-width: 560px; }
.prod-video:last-child { margin-bottom: 0; }
.prod-video video { width: 100%; aspect-ratio: 16 / 9; background: #0f172a; border-radius: 10px; display: block; }
.prod-video figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: center; }
.gallery-hero {
  width: 100%; aspect-ratio: 4 / 3; max-height: 420px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.gallery-hero img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Centred under the hero rather than left-aligned against it: three thumbs on
   a 560px column read as an accident otherwise.
   Centred with AUTO MARGINS, not justify-content. `justify-content: center` on
   a scrolling row pushes the overflow out both sides, and the first thumbnails
   end up before scrollLeft 0 where nothing can reach them; `safe center` fixes
   that but is not understood everywhere, and declaring plain `center` as its
   fallback hands exactly the broken behaviour to the browsers that need the
   fallback. Auto margins have neither problem: they centre the group when it
   fits, and resolve to 0 when it does not, so the first thumbnail is always
   reachable - on anything with flexbox, no feature detection. */
.gallery-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.gallery-strip > :first-child { margin-inline-start: auto; }
.gallery-strip > :last-child  { margin-inline-end: auto; }
.gallery-strip button {
  flex: 0 0 auto; width: 68px; height: 68px; padding: 0; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; scroll-snap-align: start;
}
.gallery-strip button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-strip button.is-active { border-color: var(--green-600); box-shadow: 0 0 0 2px rgba(24,128,56,.18); }
.gallery-strip button:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }

/* --- Option pickers --------------------------------------------------------- */
.opt-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.opt-row label { font-weight: 600; font-size: .85rem; }
.opt-row .hint { margin: 0; }
.opt-price-line {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin: 8px 0; border-radius: 8px;
  background: #f6f8f6; border: 1px solid var(--line); font-weight: 700;
}
.opt-price-line .hint { font-weight: 400; margin: 0; }

/* --- Master editor: image manager ------------------------------------------- */
.img-manager { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.img-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #fff; }
.img-tile .shot {
  width: 100%; aspect-ratio: 4 / 3; background: #fff; border-radius: 6px;
  border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px;
}
.img-tile .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile.is-hero { border-color: var(--green-600); box-shadow: 0 0 0 2px rgba(24,128,56,.14); }

/* The position controls, in one cluster at the top of the tile: the drag handle
   and the two one-step buttons are all answers to "where does this image sit",
   and splitting them across the tile would read as three unrelated things.
   It wraps, because at 150px a handle and two labelled buttons do not fit on
   one line and a squeezed "Later" is worse than a second row. */
/* One step at a time, directly under the photo. The two buttons split the
   width evenly rather than sitting at their natural size: a tile is 140px of
   usable width on a phone, and two halves of that are thumb-sized targets
   where two label-width buttons would leave dead space beside them.

   The labels stay words rather than arrows. An arrow gives a voice-control
   user nothing to say, and in a grid that wraps it would be pointing the wrong
   way half the time - "Earlier" and "Later" are true whatever the grid does. */
.img-step { display: flex; gap: 6px; margin-bottom: 8px; }
.img-step .btn { flex: 1; padding-left: 9px; padding-right: 9px; }
/* At the ends of the list. aria-disabled, not disabled - the button keeps its
   place in the tab order and is still announced, so a keyboard user stepping an
   image to the back does not watch their control vanish under them. Both
   app.js and image_move refuse the press; this is only how it looks. */
.img-step [aria-disabled="true"] { opacity: .45; cursor: default; }
/* image_move sends the browser to #img-<id>. Without this the tile lands under
   the sticky top bar, which is the same as not scrolling to it. */
.img-tile { scroll-margin-top: calc(var(--topbar-h, 56px) + 12px); }

/* The reorder handle. touch-action:none is the whole reason this is a separate
   40px control and not the picture: it tells the browser not to scroll with
   this gesture, and on the photo that would mean a finger landing anywhere on
   a card several screens tall could no longer scroll past it. 40px is also the
   smallest target a thumb reliably hits (WCAG 2.5.8 asks for 24). */
.img-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 8px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--muted); font-size: 17px; line-height: 1;
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
.img-grip:hover { border-color: var(--green-600); color: var(--green-600); }
.img-grip:active { cursor: grabbing; }
/* Picked up: the button is holding something, and says so in aria-pressed as
   well as in colour - the state is not carried by colour alone. */
.img-grip[aria-pressed="true"] {
  background: var(--green-600); border-color: var(--green-600); color: #fff; cursor: grabbing;
}
/* ...and while one is held, every other handle is a place to put it. */
.img-manager.is-picking .img-grip[aria-pressed="false"] {
  border-style: dashed; border-color: var(--green-600); color: var(--green-600);
}
/* pointer-events:none is load-bearing, not decoration: the drag hit-tests with
   elementFromPoint, and it has to see THROUGH the tile in hand to the tile
   underneath it. Without this a drag can never find a target. */
.img-tile.is-dragging { opacity: .45; pointer-events: none; }
[data-img-sort] .img-tile { transition: opacity .12s ease; }
@media (prefers-reduced-motion: reduce) { [data-img-sort] .img-tile { transition: none; } }

@media (max-width: 900px) {
  .gallery-strip button { width: 56px; height: 56px; }
  .img-manager { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  /* Thumb-sized on a phone: min-height holds them at 40px whatever the button
     styles do elsewhere, which is what a thumb needs and comfortably past what
     WCAG 2.5.8 asks for. */
  .img-step .btn { min-height: 40px; }
}

/* --- Bulk "add offers" grid --------------------------------------------------
   The defaults row is a compact strip above the factory table, not a full
   form-grid: it is a set of values to copy down, not a record being saved, and
   giving it the same visual weight as the grid below reads as two forms. */
.bulk-defaults {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 12px; margin-bottom: 12px;
  background: #f6f7f6; border: 1px solid var(--line); border-radius: var(--radius);
}
/* Its own full-width line above the boxes. Without it the strip is a row of
   inputs that looks exactly like the grid's first row and gets filled in as
   one - the whole point is that these are copied down, not saved. */
.bulk-defaults-head { flex: 1 0 100%; margin: 0; line-height: 1.35; }
.bulk-defaults-head strong { display: block; }
.bulk-defaults-head .hint { display: block; margin: 1px 0 0; }
.bulk-defaults .field { margin: 0; flex: 0 1 130px; }
.bulk-defaults .field .hint { margin: 2px 0 0; }
.bulk-defaults .bulk-fill-action { flex: 0 0 auto; align-self: flex-end; }

@media (max-width: 700px) {
  .bulk-defaults .field { flex-basis: calc(50% - 7px); }
  .bulk-defaults .bulk-fill-action { flex-basis: 100%; }
}

/* --- Customer pricing: the "add several" disclosure ---------------------------
   <summary class="btn"> so the control reads as the button it is; the default
   marker would sit outside the button box and give it two affordances. */
.bulk-rules { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.bulk-rules > summary { display: inline-block; cursor: pointer; list-style: none; }
.bulk-rules > summary::-webkit-details-marker { display: none; }
.bulk-rules > summary::marker { content: ''; }
.bulk-rules[open] > summary { margin-bottom: 12px; }

/* The tier ladder. Two narrow number fields and a note that takes the rest;
   on a phone each field goes full width rather than squeezing to nothing. */
.tier-rows { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.tier-row > label { flex: 0 1 150px; margin-bottom: 0; }
.tier-row > label.tier-note { flex: 1 1 220px; }
/* The caption only earns its line on the first row - after that the columns
   are established and repeating it five times is noise. */
.tier-row:not(:first-child) > label { font-size: 0; }
.tier-row:not(:first-child) > label input { font-size: 1rem; }
/* Unless the first row is not the first row any more. The add-offer ladder
   hides every rung the MOQ already covers, and those are always the leading
   ones - so the captions went out with them and the form was three unlabelled
   boxes. Whatever row is left at the top carries them. */
.tier-row[hidden] + .tier-row > label { font-size: .84rem; }

/* A quantity that came from the customer price breaks is shown, not typed -
   entering it a second time is exactly what this is here to avoid. It keeps
   the column width of the input it replaces so the rows still line up. */
.tier-fixed { flex: 0 1 150px; display: flex; flex-direction: column; gap: 3px; }
.tier-fixed .tier-cap { font-weight: 600; font-size: .84rem; }
.tier-fixed .tier-val { padding: 7px 0; }
.tier-row:not(:first-child) > .tier-fixed .tier-cap { font-size: 0; }
.tier-row[hidden] + .tier-row > .tier-fixed .tier-cap { font-size: .84rem; }
/* What that quantity sells for: a column, not a note under the cost box -
   under it, the hint lifts the input out of line with the rest of the row. */
/* Two-digit day counts do not need a 150px box, and once the row also carries
   an origin tick and a shelf it stops fitting: the whole thing is a wrapping
   flex, so the FIRST thing to fall off the end was "We sell at", the one cell
   there to be read rather than typed into. Narrowing the numeric fields buys
   the width back rather than pushing the ladder into a horizontal scroll. */
.tier-row > label.tier-days  { flex: 0 0 84px; }
.tier-row > label.tier-stock { flex: 0 1 132px; }
/* Its own size, because .tier-row:not(:first-child) > label sets font-size: 0
   to print the captions once - and this is not a caption, it is the answer. */
.tier-stock-state { display: block; font-size: .76rem; margin-top: 3px; }
.tier-sell { flex: 0 0 76px; }
.tier-sell .tier-val { color: var(--muted); }
/* Origin is a tick where its neighbours are boxes: narrow enough not to hold a
   column open for nothing, and dropped onto the same baseline as the fields it
   sits between - a bare checkbox otherwise rides up against the caption. */
.tier-row > label.tier-usa { flex: 0 0 44px; }
.tier-usa input[type="checkbox"] { width: 20px; height: 20px; margin: 9px 0 0; }

@media (max-width: 700px) {
  .tier-row > label, .tier-row > label.tier-note, .tier-row > .tier-fixed { flex-basis: 100%; }
  /* Stacked, a 44px column would leave the tick stranded beside the wide
     fields above and below it. */
  .tier-row > label.tier-usa { flex-basis: 100%; }
  .tier-usa input[type="checkbox"] { margin-top: 2px; }
  /* Full width means no column to infer the field from, so bring the captions
     back on every row. */
  .tier-row:not(:first-child) > label,
  .tier-row:not(:first-child) > .tier-fixed .tier-cap { font-size: .84rem; }
  /* One lonely line each for a caption and a number reads as a gap; keep the
     sell price on a single line. */
  .tier-sell { flex-direction: row; gap: 6px; align-items: baseline; }
  .tier-sell .tier-val { padding: 0 0 4px; }
  /* Stacked, the column is a caption per row - one saying nothing is noise.
     It stays on the desktop grid, where it is holding a column open. */
  .tier-sell.is-empty { display: none; }
}

/* --- Factory price breaks ------------------------------------------------------
   The ladder sub-row sits under its offer, so it must not read as another
   offer: no row hover, a quiet inset, and the editor tucked behind its own
   summary until someone wants it. */
.offer-breaks-row > td { background: #fbfcfb; border-bottom: 2px solid var(--line); padding: 10px 12px; }
table.data tr.offer-breaks-row:hover td { background: #fbfcfb; }
.offer-breaks > summary { display: inline-block; cursor: pointer; list-style: none; }
.offer-breaks > summary::-webkit-details-marker { display: none; }
.offer-breaks > summary::marker { content: ''; }
.offer-breaks[open] > summary { margin-bottom: 10px; }

/* The read-only ladder: one chip per rung, base rung muted so the breaks
   above it are what the eye lands on. */
.ladder-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.ladder-rung {
  font-size: .76rem; line-height: 1.3; padding: 3px 8px; border-radius: 999px;
  background: var(--green-100); color: var(--green-900); border: 1px solid var(--green-600);
  white-space: nowrap;
}
.ladder-rung.is-base { background: #f1f3f2; color: var(--ink-soft); border-color: var(--line); }
/* The rung the quantity in the box is actually on. Muted siblings, so the
   buyer can see at a glance which one they are buying at and how far the next
   one is. */
.ladder-strip .ladder-rung { opacity: .55; }
.ladder-strip .ladder-rung.is-active {
  opacity: 1; font-weight: 700;
  box-shadow: 0 0 0 2px rgba(24, 128, 56, .18);
}

/* The storefront's Volume pricing row the typed quantity falls in - the same
   look as the members ladder rung above, on a table row. The size table a
   size picker draws uses it too. */
.shop-tiers tbody tr.is-active td,
.size-table tbody tr.is-active td { background: var(--green-100); font-weight: 700; }
.shop-tiers tbody tr.is-active td:first-child,
.size-table tbody tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--green-600); }
/* The storefront size picker (shop/_size_pick.php) and each size's price
   and minimum below it (shop/_size_table.php). */
.size-pick { margin: 0 0 12px; }
.size-pick select { max-width: 100%; }
.size-table { margin-top: 10px; }
.size-table caption { text-align: left; }
.ladder-rung .hint { margin: 0; font-size: .68rem; }
/* Inside the buyer's right-aligned price column the chips would otherwise
   stack against the wrong edge. */
td.num .ladder-strip { justify-content: flex-end; }

/* --- Compare picker ----------------------------------------------------------
   The tick sits above the card rather than inside it: a control nested in an
   <a> is unclickable in some browsers and unreachable by keyboard in others. */
.prod-slot { display: flex; flex-direction: column; gap: 6px; }
.prod-slot > .prod-card { flex: 1 1 auto; }
.prod-slot.is-picked > .prod-card {
  border-color: var(--green-600);
  box-shadow: 0 0 0 2px rgba(24, 128, 56, .18);
}
.cmp-pick {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--muted); cursor: pointer; align-self: flex-start;
}
.cmp-pick input:disabled + span { opacity: .45; }

/* A sticky bar rather than a button per card: the action only exists once two
   are ticked, and it must stay reachable however far the grid has scrolled. */
.cmp-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--green-600);
  border-radius: 999px; box-shadow: 0 6px 18px rgba(16, 24, 20, .14);
  width: fit-content;
}
.cmp-bar[hidden] { display: none; }

/* --- Compare table ------------------------------------------------------------ */
.compare-table th[scope="row"] { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; }
.compare-table thead th { vertical-align: top; min-width: 170px; }
.cmp-shot {
  width: 100%; aspect-ratio: 4 / 3; max-height: 120px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
}
.cmp-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Spec chips on a card ----------------------------------------------------
   A definition list, because that is what it is: a label and the values a
   buyer can have. Two columns so the labels align down the card and the eye
   can scan one axis across a row of cards; on a narrow card they stack. */
.prod-specs {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 8px;
  margin: 0; font-size: .76rem; line-height: 1.35;
}
.prod-specs dt { color: var(--muted); white-space: nowrap; }
.prod-specs dd { margin: 0; font-weight: 600; color: var(--ink); }
@media (max-width: 480px) {
  .prod-specs { grid-template-columns: 1fr; gap: 0 0; }
  .prod-specs dt { font-size: .7rem; }
}
.prod-specs .spec-more { margin-left: 5px; font-weight: 400; color: var(--muted); }

/* Two lines of the product's own words, clamped. The storefront card had a
   description and the members card did not, and of the two the storefront was
   right: a SKU and a name are not enough to skip opening a product, which is
   the entire job of a card. Clamped rather than truncated in PHP so the whole
   sentence stays in the DOM for a crawler and a screen reader, and so a card
   with a long description cannot grow taller than the one beside it. */
.prod-desc {
  font-size: .82rem; line-height: 1.4; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* "Sign in for pricing" is a state, not a price, so it does not get the
   figure's weight - but it is the card's call to action for a signed-out
   visitor and it cannot read as disabled either. */
.prod-none.prod-locked { color: var(--green-900); font-size: .88rem; }
/* Not a padlock. A product nothing can supply is an invitation, not a wall:
   the same weight as the locked state so the grid stays even, but no lock
   glyph and no "sign in", because signing in would not produce a price. */
.prod-ask { color: var(--green-900); font-weight: 700; }

/* --- Offer delivery coverage ----------------------------------------------------
   Fifty tick boxes in a cell of a ten-column table, so the closed state has to
   BE the answer: the summary is the badge, and the list only exists once
   someone opens it. A popover would need JavaScript and would still have to
   live inside the row's form; <details> is the same interaction for free. */
.deliver-pick > summary { cursor: pointer; list-style: none; white-space: nowrap; }
/* The per-row picker lives in a table cell, where nowrap is the point. The bulk
   one above the grid is a full-width block carrying a sentence of explanation,
   and on a 320px phone "Delivers to · All states · applies to every offer added
   below" is 376px - wider than the screen, so it scrolled the page sideways. */
.deliver-pick.deliver-bulk > summary { white-space: normal; }
.deliver-pick > summary::-webkit-details-marker { display: none; }
.deliver-pick > summary::marker { content: ''; }
.deliver-pick > summary .hint { margin-left: 6px; }
.deliver-body {
  margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fbfcfb;
}
.deliver-body > .hint { margin: 2px 0 6px; }
.deliver-all { font-weight: 400; }
/* Two-letter codes, so a fixed narrow track fits the lot in a few rows without
   the cell dictating the width of the whole table. */
.deliver-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 2px 8px; min-width: 240px;
}
.deliver-grid .check-row { font-size: .8rem; gap: 5px; font-weight: 400; }
/* On the bulk-add form it is a block of its own rather than a table cell, so
   it can have the room to lay the states out wider. */
.deliver-bulk { margin: 10px 0 4px; }
.deliver-bulk .deliver-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }

/* The seeded ladder on the add-offer form: a block of its own inside the field
   grid, so it does not read as one more field beside "Priority". */
.offer-seed-ladder {
  margin: 6px 0 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb;
}
.offer-seed-ladder .card-title { font-size: .9rem; }
/* The bulk grid's rung columns. Narrower than a text column - every cell is a
   price - and the header carries what the quantity sells for, so a quote can
   be judged against it without leaving the row. */
.bulk-offer-grid .brk-col { min-width: 76px; }
.bulk-offer-grid .brk-col input { min-width: 64px; }
.bulk-offer-grid th.brk-col { white-space: nowrap; }
/* Every heading in this grid may carry a second line saying which side of the
   money it is ("we sell $1.15", "at the MOQ"), so the small type is the
   header's, not the rung column's. */
.bulk-offer-grid th .hint { font-weight: 400; font-size: .68rem; margin: 1px 0 0; }
/* With a rung column per customer price break the grid is wider than the card,
   so .table-wrap scrolls it - and scrolled right, every row looked the same.
   The tick and the factory name stay put, so you can always see whose price
   you are typing. border-collapse eats a sticky cell's own border, hence the
   inset shadow standing in for the divider. */
/* The offset the second column is pinned at has to BE the width the first one
   really gets, or the rows scroll through the gap between them - or, the other
   way, the name column parks on top of the tick. ONE number, so the two cannot
   drift apart in a later edit, and in auto table layout `width` alone is only
   a suggestion so the cell is pinned by min/max/width together.
   44px, not the ~29px a mouse needs: (pointer: coarse) grows every tick box to
   20px (app.css), and the tap targets around it are sized for a finger. The
   frozen column has to fit the biggest of those, not the smallest. */
.bulk-offer-grid { --tick-col: 44px; }
.bulk-offer-grid th:first-child, .bulk-offer-grid td:first-child {
  width: var(--tick-col); min-width: var(--tick-col); max-width: var(--tick-col);
  padding-left: 8px; padding-right: 8px;
}
.bulk-offer-grid th:nth-child(-n+2), .bulk-offer-grid td:nth-child(-n+2) {
  position: sticky; background: var(--card); z-index: 1;
}
.bulk-offer-grid th:first-child, .bulk-offer-grid td:first-child { left: 0; }
.bulk-offer-grid th:nth-child(2), .bulk-offer-grid td:nth-child(2) {
  left: var(--tick-col); box-shadow: inset -1px 0 0 var(--line);
}
.bulk-offer-grid tr:hover td:nth-child(-n+2) { background: #fafcfa; }
@media (max-width: 560px) {
  /* A phone has too little width left over for two frozen columns to be a
     help rather than the whole viewport. */
  .bulk-offer-grid th:nth-child(-n+2), .bulk-offer-grid td:nth-child(-n+2) { position: static; }
}


/* ============================================================================
   Catalog index: getting the products above the fold on a phone
   ----------------------------------------------------------------------------
   Measured before any of this: on a 390x844 handset the FIRST product card
   started at y=1057 - a screen and a quarter of scrolling to reach the thing
   the page is named after. Nothing above it was wrong; there was just a lot of
   it, all of it full height, and all of it ahead of the grid. The rules below
   are the four moves that closed that gap, and each one is a trade written
   down so a later edit knows what it would be giving back.
   ========================================================================= */

/* 1. THE LEDE, CLAMPED.
   Three sentences explaining what the catalog is. Worth reading once, worth
   114px of a phone screen never again. Four lines on the first visit and a
   fade at the cut; tapping it opens the rest. No JS: a checkbox would need
   markup, and :focus-within on a tabbable paragraph does the same job. On a
   desktop the whole thing fits anyway, so the clamp only exists on narrow -
   at the SAME 900px the rest of this file folds at, because two breakpoints
   telling different stories about what "a phone" is were how the filter bar
   and the grid ended up disagreeing in the first place. */
@media (max-width: 900px) {
  .card-lede.is-clamped {
    position: relative; cursor: pointer;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-lede.is-clamped::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 1.5em;
    background: linear-gradient(to bottom, rgba(243,244,246,0), var(--bg));
    pointer-events: none;
  }
  .card-lede.is-clamped:focus-within, .card-lede.is-clamped:active {
    -webkit-line-clamp: unset; display: block;
  }
  .card-lede.is-clamped:focus-within::after, .card-lede.is-clamped:active::after { content: none; }
}

/* 2. SEARCH OUT, THE REST FOLDED.
   The filter card was 280px on a phone - eight controls, one per line, all of
   them open. Search is the one most visits actually use, so it stays out at
   every width; the other seven go behind a disclosure that app.js closes on
   narrow screens. The <details> renders OPEN, so with JS off the page is
   exactly what it was: the collapsing is the enhancement, not the form. */
.cat-filter { flex-direction: column; align-items: stretch; gap: 10px; }
/* The bar below anchors to this card. Without a scroll margin the browser puts
   its top edge at the top of the VIEWPORT, which is under the sticky topbar -
   you arrive at a form whose first row you cannot see. */
.cat-filter { scroll-margin-top: calc(var(--topbar-h) + 10px); }
.cat-search { display: flex; gap: 8px; align-items: center; }
.cat-search input[type="search"] { flex: 1 1 auto; min-width: 0; width: auto; }
.cat-search .btn { flex: 0 0 auto; }

.cat-more > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: .86rem; color: var(--ink-soft);
}
.cat-more > summary::-webkit-details-marker { display: none; }
/* A drawn caret rather than the browser's triangle, so it can sit AFTER the
   badge instead of before the word, and rotate when the panel opens. */
.cat-more > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: -2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .15s ease;
}
.cat-more[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
.cat-more > summary:hover { color: var(--ink); }
.cat-more-body {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding-top: 10px;
}
/* On a desktop there is room for one row and no reason to hide anything, so
   the disclosure stops being a box at all: display:contents drops the summary
   and the wrapper out of the layout and the controls land straight back in the
   filter card's own flex row - the bar as it was before this change. */
@media (min-width: 901px) {
  .cat-filter { flex-direction: row; align-items: center; flex-wrap: wrap; }
  /* A BASIS, not a grow. flex:1 1 320px let the search pair swallow the whole
     row, which pushed the selects and tick boxes into a narrow column stacked
     down the right-hand side and made a 50px bar 400px tall. It takes the
     width a search box wants and the rest of the controls flow after it, which
     is what this bar looked like before it was ever split. */
  .cat-search { flex: 0 1 340px; }
  .cat-more { display: contents; }
  .cat-more > summary { display: none; }
  .cat-more-body { display: contents; }
  /* Chrome wraps a <details>'s non-summary children in ::details-content, a
     real block box. display:contents on the <details> flattens the summary and
     that box, but NOT the box's own contents - so without this line the whole
     filter set collapsed into a 230px column stacked down the right of the
     card. content-visibility because the UA hides that box while the details
     is shut, and on a desktop the summary is hidden: a reader who loaded the
     page narrow (app.js shut it) and then widened the window would have no
     control left to open it with, and no filters. */
  .cat-more::details-content { display: contents; content-visibility: visible; }
}

/* 3. A SLIM BAR ONCE THE FILTER CARD HAS SCROLLED AWAY.
   Once you are three rows down, both "how many of these are there" and "how do
   I change that" are off-screen above. Under the topbar rather than at the
   foot: the compare bar already owns the bottom of the viewport, and two
   strips pinching a phone screen from both ends is worse than the problem
   either solves. Phone only - on a desktop the filter row is still in view
   when the grid is.

   FIXED, not sticky, and hidden until app.js says the real filter card has
   left the screen. Two reasons, both learned by trying the other way first:
   sticky costs its own height in the flow whether or not it is doing anything,
   which is 52px of the fold spent to duplicate a control still visible two
   inches above it; and showing it only when stuck means it cannot be flipped
   in and out of the flow later without shoving the whole grid down 52px under
   the reader's thumb. Out of flow, it costs the fold nothing.

   With JS off it never appears. That is the right degradation for this one -
   it is a shortcut to a form that is still right there on the page, not the
   only way to reach anything. */
.cat-sticky { display: none; }
@media (max-width: 900px) {
  .cat-sticky.is-stuck {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 4;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 0; padding: 7px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 10px -8px rgba(16, 24, 20, .45);
  }
  .cat-sticky-n { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
  .cat-sticky .usa-n { font-size: .7rem; padding: 0 6px; }
}
@media (max-width: 560px) {
  /* Match .content's own padding at this width, or the bar's contents sit on a
     different left edge from every card under it. */
  .cat-sticky.is-stuck { padding-left: 12px; padding-right: 12px; }
}

/* 4. COMPARE IN THE CARD'S CORNER.
   It used to be its own row above every card: one line of height per product,
   for a control most visits never touch, paid a dozen times over before the
   fold. Absolutely positioned over the photo instead - still a SIBLING of the
   card's <a> in the markup, because a control nested inside a link is
   unclickable in some browsers and unreachable by keyboard in the rest.
   A backdrop pill, because the corner it lands in may be white packaging. */
.prod-slot { position: relative; }
.cmp-pick {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  align-self: auto; gap: 5px;
  padding: 3px 8px 3px 6px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1.3;
  color: var(--ink-soft); background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 3px rgba(16, 24, 20, .18), inset 0 0 0 1px var(--line);
  transition: transform .15s ease;
}
.cmp-pick:hover { color: var(--ink); background: #fff; }
.cmp-pick input { margin: 0; }
/* The card lifts 2px on hover. The pill is not inside it, so without this it
   stays put and the corner visibly comes apart. */
.prod-slot:has(> a.prod-card:hover) .cmp-pick { transform: translateY(-2px); }
/* Room reserved on the badge strip so "In stock" never runs under the pill.
   ONE number for both, or they drift apart and the overlap comes back. */
.prod-slot { --cmp-w: 92px; }
.prod-tags { padding-right: var(--cmp-w); }

/* 5. MOQ WITH THE WEIGHT PRICE HAS.
   In this trade a per-unit price is not an offer until you know the minimum
   that comes with it: $0.42 reads as cheap right up to the moment it turns out
   to be $0.42 x 50,000. It was grey 0.78rem under the figure. The KEY stays
   small and quiet - it is the same three letters on every card - and the
   QUANTITY gets the ink. */
/* WHAT IS ON THE SHELF, when a supplier reports it. Sits above the MOQ line
   because the two are read together - a quantity ready to ship only means
   something once you know the minimum that comes with it - and it gets the
   green the price uses, because "you can have this today" is the same kind of
   good news. The dot is a full stop's worth of colour: enough to catch the eye
   scanning a grid, not enough to compete with the figure. */
.prod-stock { font-size: .78rem; color: var(--green-900); display: flex; align-items: baseline; gap: 5px; }
.prod-stock strong { font-weight: 700; font-size: .84rem; }
.prod-stock .stock-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green-600);
  flex: 0 0 auto; align-self: center;
}

.prod-moq .moq-k {
  font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
}
.prod-moq strong { font-weight: 700; color: var(--green-900); font-size: .84rem; }

@media (max-width: 900px) {
  /* 6. WIDTH BACK TO THE PICTURE.
     Two cards across a phone is ~177px each, and the overlay badges were sized
     for a 240px desktop card - "In stock" plus a compliance warning covered
     most of the top of the photo. Smaller badges, a tighter pill, and 3px of
     letterbox padding instead of 6px, which is the picture getting the width
     rather than the card losing any. */
  .prod-tags .badge { font-size: .66rem; padding: 1px 6px; }
  .prod-shot img { padding: 3px; }
  /* The pill keeps a finger-sized tick box - (pointer: coarse) in app.css grows
     it to 20px and this is not the place to take that back - so the width it
     gives up comes out of the type and the padding around it. */
  .prod-slot { --cmp-w: 74px; }
  .cmp-pick { top: 5px; right: 5px; gap: 3px; padding: 2px 6px 2px 4px; font-size: .64rem; }
}
@media (max-width: 480px) {
  .prod-grid { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .cat-more > summary::after, .cmp-pick { transition: none; }
  .prod-slot:has(> a.prod-card:hover) .cmp-pick { transform: none; }
}

/* --- 3D model well ------------------------------------------------------------
   model3d.js replaces the well's fallback text with a canvas. A fixed height,
   because the canvas sizes itself to the box - an auto box would collapse to
   the fallback's height and hand the viewer a 20px window. */
.model3d-well {
  height: 380px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; display: flex; align-items: center; justify-content: center;
}
@media (max-width: 900px) { .model3d-well { height: 280px; } }

/* --- Print-area drawer (master) ----------------------------------------------- */
.area-draw { position: relative; max-width: 560px; user-select: none; }
.area-draw img { width: 100%; display: block; border-radius: 6px; border: 1px solid var(--line); }
.area-rect {
  position: absolute; border: 2px dashed var(--green-600);
  background: rgba(24,128,56,.12); pointer-events: none;
}

/* --- Print areas as they actually sit on the photo (master) ---------------------
   A read-only twin of the drawer above: same rectangle, same fractions, drawn
   from what is stored. Several photos side by side, each carrying its own
   areas, wrapping to one column on a phone. */
.parea-previews { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.parea-fig { margin: 0; flex: 0 1 320px; min-width: 0; max-width: 100%; }
/* overflow:hidden so a long tag on an area at the edge is clipped by the photo
   rather than widening the figure and pushing the next one to a new row. */
.parea-shot {
  position: relative; overflow: hidden; border-radius: 6px; border: 1px solid var(--line);
}
.parea-shot img { width: 100%; display: block; }
/* NO fill, unlike the drawer's .area-rect and the buyer's .brand-area. Both of
   those draw one rectangle at a time; this draws all of them at once, and a
   translucent fill COMPOUNDS - thirteen areas at 12% each stack to 75% and the
   photo disappears under a solid green block with no individual rectangle left
   to see. An outline does not compound, so the tenth area is as legible as the
   first. The white halo keeps the green border readable on a dark product. */
.parea-box {
  position: absolute; border: 2px dashed var(--green-600);
  box-shadow: 0 0 0 1px rgba(255,255,255,.7), inset 0 0 0 1px rgba(255,255,255,.7);
}
/* Hover fills ONE of them, which is how you tell overlapping areas apart
   without a script - and why the fill lives here rather than on every box. */
.parea-box:hover { background: rgba(24,128,56,.22); z-index: 2; }
/* Inside the box, not above it. A tag hung above an area at y=0 renders off
   the top of the photo, and "top of the panel" is where print areas live.
   Longhands, not the `font` shorthand: `font: 700 .68rem/1.5 inherit` is
   invalid - the shorthand takes no `inherit` in the family slot - so the whole
   declaration is dropped, taking the line-height with it and collapsing every
   tag to nothing. It did, and the tags were invisible until a measuring pass
   asked how tall they were. */
.parea-tag {
  position: absolute; top: 0; left: 0;
  font-size: .68rem; font-weight: 700; line-height: 1.6;
  color: #fff; background: var(--green-600);
  padding: 0 4px; border-radius: 0 0 4px 0; white-space: nowrap;
}
/* An area in the right half anchors its tag to the right edge, so a long name
   grows towards the middle of the photo instead of off the side of it. */
.parea-box-r .parea-tag { left: auto; right: 0; border-radius: 0 0 0 4px; }
.parea-fig figcaption { margin-top: 4px; line-height: 1.4; }

/* The panel's real size, edited in the row it belongs to. Two short numeric
   boxes on one line: wrapping "90 × 45 mm [Set]" onto two lines in a table
   cell makes the row twice as tall for four characters of input. */
.parea-size-form { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.parea-size-form .mm-in { width: 58px; text-align: right; padding: 3px 5px; }

/* A resolution complaint. Amber rather than red: the artwork WILL print, and
   colouring a soft logo the same as a refusal teaches people to ignore both. */
.dpi-warn {
  margin: 6px 0 0; padding: 6px 8px; border-radius: 6px; line-height: 1.45;
  font-size: .82rem; color: var(--amber-900, #78350f);
  background: var(--amber-50, #fffbeb); border: 1px solid var(--amber-300, #fcd34d);
}
.dpi-warn.is-bad {
  color: var(--red-900, #7f1d1d); background: var(--red-50, #fef2f2);
  border-color: var(--red-300, #fca5a5);
}
.dpi-warn strong { font-weight: 700; }
.dpi-ok { color: var(--muted); font-size: .82rem; }

/* What we asked for last round, and what moved since. Set apart with a rule
   down the left rather than a box: it is a quotation from an earlier
   conversation, not a status of its own, and a second card here would compete
   with the proof the reviewer is meant to be looking at. */
.rev-since {
  margin-top: 12px; padding: 8px 0 8px 10px;
  border-left: 3px solid var(--border, #e5e7eb);
}
.rev-asked { margin: 4px 0 6px; font-size: .86rem; line-height: 1.45; }
.rev-list { margin: 4px 0 0; padding-left: 18px; font-size: .86rem; line-height: 1.5; }
.rev-list li { margin: 2px 0; }
/* The one outcome a reviewer must not skim past: they asked for a change and
   the artwork came back identical. */
.rev-none { margin: 4px 0 0; font-size: .86rem; font-weight: 700; color: var(--amber-900, #78350f); }

/* --- Branding editor ------------------------------------------------------------
   Stage left, controls right; stacked on a phone. The stage is the photo -
   areas and elements are absolutely positioned children in % so the whole
   thing scales as one picture. */
.brand-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .brand-editor { grid-template-columns: 1fr; } }
/* isolation, so the handle below cannot escape into the PAGE's stacking order:
   position:relative with z-index:auto is not a stacking context, and the
   handle's z-index competed page-wide - above the sticky topbar (50),
   dropdowns (100) and the command palette (120), which it painted over and
   took clicks from whenever the stage scrolled under them. */
.brand-stage { position: relative; user-select: none; isolation: isolate; }
.brand-stage > img { width: 100%; display: block; border-radius: var(--radius); border: 1px solid var(--line); }
.brand-area {
  position: absolute; border: 2px dashed var(--green-600);
  background: rgba(24,128,56,.06);
}
.brand-area-tag {
  position: absolute; top: -1.4em; left: 0; font-size: .72rem; font-weight: 700;
  color: var(--green-600); background: #fff; padding: 0 4px; border-radius: 4px;
  white-space: nowrap;
}
/* Bleed and safe. OUTLINES with no fill, and pointer-events: none - they sit
   over the drag surface and a guide that swallows a click is a guide that
   makes the editor feel broken. Two dash rhythms rather than two colours
   alone, so they stay distinguishable to a colour-blind reader and in a
   greyscale print of a screenshot. */
.brand-guide {
  position: absolute; pointer-events: none; border-radius: 1px;
}
.brand-guide.is-bleed { border: 1px dashed rgba(180, 60, 60, .75); }
.brand-guide.is-safe  { border: 1px dotted rgba(40, 70, 160, .75); }

/* What this panel can do, beside the element being placed on it. A fact about
   the surface, so it is quiet - the amber DPI box above it is the thing that
   wants attention. */
.press-note {
  margin: 6px 0 0; padding: 6px 8px; border-radius: 6px; line-height: 1.45;
  font-size: .82rem; color: var(--text); background: var(--gray-50, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
}
.press-note strong { display: block; }
.press-note .press-own { margin-top: 4px; font-style: italic; }
/* Elements live inside this clip: what pokes past the area (a rotated corner)
   is cut on screen exactly as the compositor cuts it on the proof. The name
   tag stays outside the clip so it never disappears. */
.brand-area-clip { position: absolute; inset: 0; overflow: hidden; }
/* Snap guides: shown only while a drag is snapped to the area's middle. */
.brand-guide-v, .brand-guide-h { position: absolute; display: none; pointer-events: none; z-index: 200; }
.brand-guide-v { left: 50%; top: 0; bottom: 0; border-left: 1px dashed #d97706; }
.brand-guide-h { top: 50%; left: 0; right: 0; border-top: 1px dashed #d97706; }
.brand-el { position: absolute; cursor: grab; outline: 1px dashed transparent; }
.brand-el:hover { outline-color: #999; }
.brand-el.is-selected { outline: 2px solid var(--green-600); }
.brand-el:focus-visible { outline: 2px solid var(--green-600); }
.brand-el img { width: 100%; height: 100%; display: block; }
.brand-el.is-missing { background: repeating-linear-gradient(45deg, #eee, #eee 6px, #fff 6px, #fff 12px); }
/* An emptied text element: a dashed box with a ghost placeholder, so it stays
   visible and grabbable until the buyer types into it or removes it. */
.brand-el.is-empty { outline: 1px dashed #d97706; }
.brand-el.is-empty .brand-el-text { opacity: .45; font-style: italic; }
/* A COLUMN of line boxes, centered as a stack - the same shape the compositor
   lays out: every line owns a box of line-height ems and the stack sits in the
   middle of the element. One span per line because italic is a skewX transform
   (see branding.js), and `white-space: pre` so a run of spaces survives to the
   proof, which draws the string literally. */
.brand-el-text {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  justify-content: center; overflow: hidden; line-height: 1.2;
  /* The compositor draws one unbroken imagefilledrectangle; Chromium's default
     text-decoration-skip-ink cuts a gap wherever a descender crosses the rule,
     so an underlined "Hamburg" showed a 0.43 em hole on the stage that the
     proof never had. Same rule on both sides. */
  text-decoration-skip-ink: none;
}
.brand-line { display: block; width: 100%; white-space: pre; }
/* The one place a gesture is expected: a thumbable corner handle, shown only
   while an element is selected so the stage does not read as a grid of dots.
   It is parented to the STAGE rather than to the element, because elements sit
   inside .brand-area-clip and that clip would cut the handle off whenever an
   element was pushed against the edge of its area. left/top put its CENTRE on
   the element's visual corner, which is why the margins are negative halves. */
.brand-el-resize {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--green-600); border: 2px solid #fff;
  cursor: nwse-resize; z-index: 201;   /* just above the snap guides (200) */
}
.brand-el-resize[hidden] { display: none; }
/* Style toggles: one row of square on/off buttons, pressed state carried by
   aria-pressed so the control and the screen reader agree. */
.brand-style-row { display: flex; gap: 6px; }
.brand-style {
  width: 34px; height: 34px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: .95rem; line-height: 1;
  color: var(--ink);
}
.brand-style:hover { border-color: var(--green-600); }
.brand-style[aria-pressed="true"] {
  background: var(--green-600); border-color: var(--green-600); color: #fff;
}
.brand-style:focus-visible { outline: 2px solid var(--green-600); outline-offset: 1px; }

/* Inspector: two knobs on one row, preset swatches, a checkbox that reads as
   a label. */
.brand-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.check-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 400; }
.swatch-row { display: flex; gap: 6px; margin-top: 6px; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line);
  cursor: pointer; padding: 0;
}
.swatch:hover { transform: scale(1.15); }

/* The design library's proof thumbnails. */
.design-thumb {
  display: block; height: 54px; max-width: 96px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line); background: #fff;
}

/* --- Art library tray ----------------------------------------------------------- */
.asset-tray { display: flex; flex-wrap: wrap; gap: 10px; }
.asset-chip {
  width: 110px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; background: #fff; text-align: center; font: inherit;
}
button.asset-chip { cursor: pointer; }
button.asset-chip:hover { border-color: var(--green-600); }
/* A print master has no thumbnail and is not pretending to: nothing here can
   rasterise a PDF or an EPS, so the chip shows what the file IS rather than a
   grey box standing in for a preview that was never coming. */
.asset-chip.is-file { display: flex; flex-direction: column; gap: 6px; }
.file-ext {
  display: block; margin: 6px auto 0; padding: 10px 0; width: 70px;
  border: 1px dashed var(--line); border-radius: 6px; background: #fafafa;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--muted);
}
.asset-chip img { max-width: 100%; max-height: 70px; object-fit: contain; display: block; margin: 0 auto 4px; }

/* --- Category pictures, on the master category editor ---------------------
   The preview is the picture the storefront will actually use, which is not
   always one somebody uploaded here: a category with none of its own borrows
   the best photo from its shelf. Showing the resolved answer is the point -
   an empty box beside an upload button says "this category has no picture"
   when it may well have one. */
.cat-pic { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.cat-pic-frame {
  flex: 0 0 auto; width: 132px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  /* White for the same reason the corridor's door frame is: this contains
     rather than covers, so the colour behind shows as bars beside the
     picture - and a preview whose ground is a different colour from the
     door's is answering the question slightly wrong. */
  border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center;
}
/* Contain, because the showroom's door contains. This preview exists to answer
   "what will the corridor put on this door", and a preview that crops what the
   door shows whole answers a different question. */
.cat-pic-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cat-pic form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-right: 8px; }
.cat-pic input[type=file] { font-size: 13px; max-width: 100%; }

/* The department's picture, on the chip that opens it. Small on purpose: the
   chip row is navigation and its job is to stay one or two lines tall, which
   is why this is a 26px tile rather than the card row a picture tempts you to
   build. A category with no picture - none of its own and nothing
   photographed on its shelf - renders no <img> at all rather than an empty
   box, so the row never advertises a gap. */
.cat-chip-pic {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  display: block; flex: 0 0 auto; background: var(--mint, #ecfdf5);
  /* Aligns and insets ITSELF rather than restyling .cat-chip. The chip is
     shared with the signed-in catalog, which renders no picture: changing the
     chip's own alignment or padding would move type on a page that gained
     nothing. -6px eats half the chip's left padding so the tile sits near the
     edge without the chip needing to know it is there. */
  align-self: center; margin-left: -6px;
}

/* Card facts: where the headline price starts, how many price levels the
   ladder has, and the smallest order at a published price. */
.prod-start { font-weight: 400; color: var(--muted); font-size: .78rem; }
.prod-levels {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  background: var(--green-100); color: var(--green-900);
  font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.prod-spend strong { font-weight: 700; color: var(--green-900); }

/* The storefront card's Add: a row under the card, full width, a finger's
   height. A sibling of the card's link, like the compare pill. */
.prod-act { display: flex; }
.prod-add { flex: 1 1 auto; justify-content: center; min-height: 36px; }
/* A storefront card picked to compare: a lighter mark than the cart's. */
.prod-slot.is-compared > .prod-card { border-color: var(--green-600); border-style: dashed; }
/* The price at the grid's quantity, and a card whose minimum is above it:
   marked, never hidden. */
.prod-atqty { font-size: .78rem; color: var(--green-900); line-height: 1.35; margin-top: 4px; }
.prod-atqty .badge { margin-right: 4px; }
.prod-slot.is-under-min > .prod-card { opacity: .8; }

/* The storefront's ask-forms (shop/_ask_aside.php): who to reach and what
   happens next on the left, the form on the right, stacked on a phone. The
   same shape as the homepage's one contact form, in this shell's stylesheet
   because the storefront does not load landing.css. */
.ask-card { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 22px 40px; align-items: start; }
.ask-aside .card-title { font-size: 1.2rem; margin-bottom: 6px; }
.ask-lede { color: var(--muted, #6b7280); line-height: 1.6; margin: 0 0 16px; }
.ask-ways { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; font-size: .92rem; }
.ask-ways a { font-weight: 700; }
.ask-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: ask; }
.ask-next li { position: relative; padding-left: 36px; font-size: .9rem; line-height: 1.5; color: var(--muted, #6b7280); counter-increment: ask; }
.ask-next li::before { content: counter(ask); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
                       display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem;
                       color: #fff; background: var(--green-700, #15803d); }
.ask-next li b { display: block; color: var(--ink, #111827); }
.ask-form .form-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* Name and email share the first row; company, phone and state the second -
   five fields on two full rows, not a third row holding State alone. */
.ask-form > .form-grid:first-of-type { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ask-form > .form-grid:first-of-type > .field { grid-column: span 2; }
.ask-form > .form-grid:first-of-type > .field:nth-child(-n+2) { grid-column: span 3; }
@media (max-width: 560px) {
  .ask-form > .form-grid:first-of-type { grid-template-columns: 1fr; }
  .ask-form > .form-grid:first-of-type > .field,
  .ask-form > .form-grid:first-of-type > .field:nth-child(-n+2) { grid-column: auto; }
}
.ask-form textarea { min-height: 120px; resize: vertical; }
.ask-form .form-actions { margin-top: 4px; }
.ask-send { width: 100%; justify-content: center; text-align: center; padding: 12px 20px; font-size: 1rem; }
@media (max-width: 860px) { .ask-card { grid-template-columns: 1fr; } .ask-next { display: none; } }

/* --- Product page clean-up -------------------------------------------------
   No photo yet: the catalog's drawn carton, compact, so it marks the spot
   without pushing the price down the page. */
.card.pdp-nophoto { padding-block: 12px; }
.pdp-nophoto { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: left; }
.pdp-nophoto img { width: 96px; height: 96px; flex: none; }
.pdp-nophoto p { margin: 0; max-width: 28ch; }
/* The minimum order, right under the price and readable at a glance. */
.pdp-moq { margin: 4px 0 10px; font-size: 14px; color: var(--ink, #1f2937); }
.pdp-moq [data-moq-start] { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.pdp-textlink { align-self: center; text-decoration: underline; }
/* On a phone the pricing card leads, so price, minimum and Add to cart are on
   the first screen; the spec list follows. Same breakpoint as .two-col. */
@media (max-width: 900px) {
  .pdp-cols .pdp-buy { order: -1; }
  .pdp-nophoto img { width: 72px; height: 72px; }
}
