/* Jayone buyer catalog — PDF catalog of the products in the buyer's quote (user request 2026-09-22).
   Layout follows the company's external catalog PDF spec (docs/CATALOG_EXPORT_SPEC.md — user decisions 2026-06-17 / 2026-09-04):
   Letter · cover · 6 per page (3×2, large photos) or 16 per page (4×4) · SKU badge top-left · storage badge top-right ·
   barcode + UPC digits pinned to the bottom of each card · company info on every page.
   Brand: #008A5E structure, #005C3F under white text (8.1:1 — #008A5E is only 4.38:1), ink #111814, Source Sans 3.
   Storage colours = the site's restrained icon colours (user feedback 2026-09-20), not the internal PDF's cold-chain fills. */
:root {
  --green: #008A5E; --green-d: #005C3F; --lime: #7AC143;
  --ink: #111814; --ink-2: #4A5550; --line: #E1E6E3; --tile: #F3F5F4; --page: #FFFFFF; --desk: #E9EDEB;
  --warn: #7A5000; --warn-s: #FFF4DB;
  --st-dry: #4A5550; --st-chilled: #2A7D6F; --st-frozen: #1C6EA4;
  --font: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --z: 1;   /* preview scale on narrow screens — set by pdf.js, never used in print */
}
* { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--desk); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* ── Options bar (screen only). Not sticky: pinned, it covered 28% of a 1280×720 screen while paging the preview (r23 P2-15). ── */
.bar { background: var(--page); border-bottom: 1px solid var(--line); }
.bar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: grid; gap: 10px 20px;
  grid-template-columns: auto 1fr auto; grid-template-areas: 'back title count' 'fields fields fields' 'density go go'; align-items: center; }
.back { grid-area: back; color: var(--green-d); font-weight: 600; text-decoration: none; font-size: 15px; }
.back:hover { text-decoration: underline; }
.bar-title { grid-area: title; margin: 0; font-size: 20px; font-weight: 600; }
.bar-count { grid-area: count; margin: 0; color: var(--ink-2); font-size: 15px; }
.bar-fields { grid-area: fields; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px 16px; }
.bar-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.bar-fields input, .bar-fields textarea { font: inherit; font-size: 17px; color: var(--ink); border: 1px solid #8A948F; border-radius: 12px;
  padding: 8px 12px; min-height: 44px; resize: vertical; background: #fff; }
.bar-density { grid-area: density; border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; font-size: 15px; }
.bar-density legend { float: left; margin-right: 10px; font-weight: 600; }
.bar-density label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; }
.bar-density input { width: 18px; height: 18px; margin: 0; accent-color: var(--green-d); }
/* The button comes first, so status text of any length sits to its right and never moves it (r23 P1-2: it slid 48–72px). */
.bar-go { grid-area: go; display: flex; align-items: flex-start; gap: 8px 16px; }
.bar-notes { flex: 1; min-width: 0; }
.bar-notes p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.bar-notes .status { min-height: 1.45em; font-size: 15px; color: var(--ink); }
.bar-notes .status.warn { color: var(--warn); font-weight: 600; }
.bar-notes .link { font: inherit; font-weight: 600; background: none; border: 0; padding: 0 2px; color: var(--green-d); text-decoration: underline; cursor: pointer; min-height: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 15px; font-weight: 600; min-height: 44px;
  padding: 0 24px; border-radius: 999px; cursor: pointer; flex: none; text-decoration: none; }
.btn.primary { background: var(--green-d); color: #fff; border: 1px solid var(--green-d); }
.btn.primary:hover { background: #00442F; }
.btn.secondary { background: #fff; color: var(--green-d); border: 1px solid var(--green-d); }
.btn:disabled { opacity: .55; cursor: default; }
/* Empty quote / catalog could not load: the tools say nothing useful — only the message and the way back (r23 P2-6·7) */
body.is-empty .bar-fields, body.is-empty .bar-density, body.is-empty .bar-go,
body.is-failed .bar-fields, body.is-failed .bar-density, body.is-failed .bar-go { display: none; }
body.is-empty .bar-inner, body.is-failed .bar-inner { grid-template-areas: 'back title count'; }   /* no empty rows left behind */
.empty { max-width: 640px; margin: 24px auto; padding: 24px; background: #fff; border-radius: 16px; font-size: 17px; line-height: 1.5; }
.empty p { margin: 0 0 12px; }
.empty p:last-child { margin-bottom: 0; }
.empty a { color: var(--green-d); font-weight: 600; }
@media (max-width: 760px) {
  .bar-inner { grid-template-columns: 1fr auto; grid-template-areas: 'back count' 'title title' 'fields fields' 'density density' 'go go'; }
  .bar-fields { grid-template-columns: 1fr; }
  .bar-fields textarea { min-height: 92px; }   /* three lines show whole (r23 P2-14: the third line was cut 24px at 320) */
  .bar-density { display: block; }
  .bar-density legend { float: none; margin: 0 0 2px; padding: 0; }
  .bar-density label { display: flex; }   /* both choices start on the same line (r23 P2-14) */
  .bar-go { flex-direction: column; align-items: stretch; }
  .bar-go .btn { width: 100%; }
  .empty { margin: 16px; padding: 20px; }
  body.is-empty .bar-inner, body.is-failed .bar-inner { grid-template-areas: 'back count' 'title title'; }
}

/* ── Sheets (Letter). On screen they sit on a grey desk; narrow screens shrink them to fit (pdf.js sets --z).
   Shrunk with a transform inside a box of the shrunk size — not CSS zoom: WebKit keeps text at least 9px under zoom, so at
   36% the words outgrew their cards (gate, WebKit 320/375 — 9.3px text laid out as 24.8px). A transform lays the page out
   at full size first, then scales the picture, the same as the printed page. ── */
#doc { padding: 24px 0 48px; }
.sheet-box { width: calc(8.5in * var(--z)); height: calc(11in * var(--z)); margin: 0 auto 24px; background: #fff;
  box-shadow: 0 2px 12px rgba(17, 24, 20, .12); overflow: hidden; }
.sheet { width: 8.5in; height: 11in; background: #fff; padding: 12mm 12mm 10mm; display: flex; flex-direction: column;
  overflow: hidden; position: relative; transform: scale(var(--z)); transform-origin: 0 0; }

/* Page header (product pages) */
.phead { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid var(--green); padding-bottom: 5px; margin-bottom: 4mm; flex: none; }
.phead img { height: 24px; width: auto; display: block; flex: none; }
.phead .r { text-align: right; line-height: 1.25; }
.phead .lbl { font-size: 9pt; font-weight: 600; color: var(--green-d); }
.phead .for { font-size: 8pt; color: var(--ink-2); }

/* Page footer — company info on every page (spec §5). Links stay clickable in the saved PDF (r23 P2-10). */
.pfoot { flex: none; margin-top: 4mm; padding-top: 4px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px;
  font-size: 7pt; color: var(--ink-2); line-height: 1.35; }
.pfoot a { color: inherit; text-decoration: none; }
.pfoot .n { white-space: nowrap; }

/* Cover — one left edge with the header and footer (r23 P2-11) */
.cover .cv { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cover .logo { height: 64px; width: auto; display: block; align-self: flex-start; margin-bottom: 14mm; }
.cover h2 { margin: 0; font-size: 34pt; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
.cover .rule { height: 4px; width: 64px; background: var(--green); margin: 8mm 0; }
.cover .who { display: grid; grid-template-columns: auto 1fr; gap: 3mm 8mm; font-size: 13pt; line-height: 1.35; margin: 0; }
.cover .who dt { color: var(--ink-2); font-size: 10pt; padding-top: 3px; }
.cover .who dd { margin: 0; white-space: pre-line; }
.cover .facts { margin-top: 10mm; font-size: 11pt; color: var(--ink-2); line-height: 1.5; }
.cover .note { margin-top: 3mm; font-size: 9pt; color: var(--ink-2); }

/* Product grid — fixed rows so a short last page keeps the same card size */
.grid { flex: 1; min-height: 0; display: grid; gap: 5mm; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.d16 .grid { gap: 3.5mm; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, minmax(0, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.sku { position: absolute; top: 0; left: 0; z-index: 2; background: var(--green-d); color: #fff; font-weight: 600; font-size: 8pt;
  padding: 2px 7px; border-bottom-right-radius: 6px; white-space: nowrap; }
.st { position: absolute; top: 0; right: 0; z-index: 2; display: inline-flex; align-items: center; gap: 3px; background: #fff;
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); border-bottom-left-radius: 6px;
  font-size: 7.5pt; font-weight: 600; padding: 2px 6px; white-space: nowrap; }
.st svg { width: 10px; height: 10px; flex: none; }
.st-dry { color: var(--st-dry); } .st-chilled { color: var(--st-chilled); } .st-frozen { color: var(--st-frozen); }
.card .img { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 22px 10px 8px;
  border-bottom: 1px solid var(--line); }
.card .img img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.card .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--tile);
  color: var(--ink-2); font-weight: 600; font-size: 11pt; border-radius: 4px; }
/* A photo that exists but did not load is not "No photo" (company photo rule — that would be wrong information, r23 P1-1).
   On screen it says so; printed it is a blank tile, and the bar warns before saving. */
.card .ph-fail { display: none; }
.card .img.failed img { display: none; }
.card .img.failed .ph-fail { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--warn-s); color: var(--warn); font-weight: 600; font-size: 10pt; border-radius: 4px; }
.card .body { flex: none; padding: 6px 9px 7px; display: flex; flex-direction: column; }
.brand { font-size: 7.5pt; color: var(--ink-2); }
.nm { font-weight: 600; font-size: 10pt; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.box { font-size: 8.5pt; font-weight: 600; color: var(--green-d); margin-top: 2px; }
.logi { font-size: 7pt; color: var(--ink-2); line-height: 1.3; margin-top: 3px; }
.cat { font-size: 7pt; color: var(--ink-2); margin-top: 2px; }
.bcwrap { margin-top: 6px; text-align: center; min-height: 12px; }
.bc { display: inline-block; height: 30px; width: auto; max-width: 100%; }
.bcnum { margin-top: 1px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 8pt; letter-spacing: 1px; line-height: 1; }
.d16 .sku { font-size: 6.5pt; padding: 1px 5px; }
.d16 .st { font-size: 6pt; padding: 1px 4px; }
.d16 .st svg { width: 8px; height: 8px; }
.d16 .card .img { padding: 17px 6px 5px; }
.d16 .card .ph, .d16 .card .img.failed .ph-fail { font-size: 7.5pt; }
.d16 .card .body { padding: 4px 6px 5px; }
.d16 .brand { font-size: 6pt; }
.d16 .nm { font-size: 7.5pt; -webkit-line-clamp: 2; }
.d16 .box { font-size: 6.5pt; margin-top: 1px; }
.d16 .bcwrap { margin-top: 3px; }
.d16 .bc { height: 20px; }
.d16 .bcnum { font-size: 6pt; letter-spacing: .5px; }

/* ── Print: exactly one sheet per page, no bar ── */
@page { size: letter; margin: 0; }
@media print {
  body { background: #fff; }
  .bar, .empty { display: none !important; }
  #doc { padding: 0; }
  .sheet-box { width: auto; height: auto; margin: 0; box-shadow: none; overflow: visible; break-after: page; page-break-after: always; }
  .sheet-box:last-child { break-after: auto; page-break-after: auto; }
  .sheet { transform: none; }
  .card .img.failed .ph-fail { visibility: hidden; }
}
