/* The slab scanner (scan.js): full-screen camera, no shutter. It reads the cert number on its own; "Type it" is the
   way out for a label that won't read. Used by the seller app on the web and the panel. Drawn like the iPhone app's
   scanner (BindScannerPlugin.swift): a label box with the surround dimmed, a cert chip under it that says what just
   happened, and a see-through panel at the bottom that counts the slabs and shows each one as it goes in. */
.cam { position: fixed; inset: 0; z-index: 80; background: #000; color: #f5f5f4; overflow: hidden; -webkit-tap-highlight-color: transparent;
  font-family: var(--sans, "Archivo", system-ui, -apple-system, sans-serif); }
.cam .hidden { display: none !important; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .mono { font-family: var(--mono, "JetBrains Mono", ui-monospace, Menlo, monospace); font-weight: 500; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

/* in: grows out of Home's camera card, or fades up; out: fades */
.cam.grow { clip-path: var(--clip); }
.cam.grow.in { clip-path: inset(0 round 0); transition: clip-path .44s cubic-bezier(.2, .85, .25, 1); }
.cam.grow .cam-ui { opacity: 0; }
.cam.grow.in .cam-ui { opacity: 1; transition: opacity .28s ease-out .14s; }
.cam.fade { opacity: 0; }
.cam.fade.in { opacity: 1; transition: opacity .22s ease-out; }
.cam.out { opacity: 0; transition: opacity .2s ease-in; }

/* the label box: everything around it dimmed, a white line; a read pulses it with a heavier line, no color */
.cam-guide { position: absolute; left: max(24px, calc(50% - 280px)); right: max(24px, calc(50% - 280px)); top: calc(env(safe-area-inset-top) + 112px);
  aspect-ratio: 3.2 / 1; border: 2px solid #fff; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); pointer-events: none; }
.cam-guide.pulse { animation: cam-pulse .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes cam-pulse { 0% { transform: scale(1.03); border-width: 4px; } 70% { border-width: 4px; } 100% { transform: none; border-width: 2px; } }

/* the cert chip under the box: near-black, a hairline, a bar down the left (faint while it looks, white when a slab
   is added, amber when it isn't), cert numbers in the mono */
.cam-chip { position: absolute; z-index: 4; left: 50%; top: calc(env(safe-area-inset-top) + 112px + (min(100vw, 608px) - 48px) / 3.2 + 16px); transform: translateX(-50%);
  max-width: calc(100% - 48px); display: flex; align-items: stretch; border-radius: 8px; overflow: hidden; background: rgba(11, 11, 12, .92);
  border: 1px solid rgba(255, 255, 255, .12); font-size: 15px; font-weight: 500; line-height: 20px; text-align: center; }
.cam-chip i { flex: none; width: 3px; background: rgba(255, 255, 255, .18); transition: background-color .2s; }
.cam-chip.good i { background: #f5f5f4; }
.cam-chip.bad i { background: #e0a050; }
.cam-msg { min-width: 0; padding: 8px 16px 8px 12px; }
.cam-msg b { font-weight: 600; }
/* the card's name and grade, once the lookup has them: a second line that eases in */
.cam-name { display: block; max-height: 0; opacity: 0; overflow: hidden; font-size: 13px; font-weight: 400; line-height: 18px; color: #a3a3a3;
  white-space: nowrap; text-overflow: ellipsis; transition: opacity .2s var(--ease, cubic-bezier(.22, 1, .36, 1)), max-height .2s var(--ease, cubic-bezier(.22, 1, .36, 1)); }
.cam-name.on { max-height: 18px; opacity: 1; margin-top: 2px; }

/* a slab went in: a check pops in the middle of the box */
.cam-check { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 112px + (min(100vw, 608px) - 48px) / 6.4); transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #fff; color: #000; opacity: 0; pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
/* ...and its photo flies from the box into the tray */
.cam-fly { position: fixed; z-index: 3; width: 40px; height: 64px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .18); background: #0d0d0e center / cover no-repeat;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); pointer-events: none; will-change: transform, opacity; }

.cam-x, .cam-torch { position: absolute; top: calc(env(safe-area-inset-top) + 8px); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .09); background: rgba(0, 0, 0, .55); color: #f5f5f4; cursor: pointer;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.cam-x { left: 16px; }
.cam-torch { right: 16px; }
.cam-torch.on { background: #f5f5f4; color: #000; }

/* the panel: the camera blurred behind it, tinted toward near-black, a hairline, rounded on top */
.cam-panel { position: absolute; left: -1px; right: -1px; bottom: -1px; display: grid; gap: 20px; padding: 24px 21px calc(12px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0; border: 1px solid rgba(255, 255, 255, .09); background: rgba(13, 13, 14, .62);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
.cam-panel > * { width: 100%; max-width: 520px; justify-self: center; }
.cam-text { display: grid; gap: 4px; }
.cam-title { font-family: var(--display, "Archivo", system-ui, sans-serif); font-stretch: 112.5%; font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.cam-sub { font-size: 15px; line-height: 1.4; color: #a3a3a3; }
.cam-tray { display: flex; gap: 8px; height: 64px; overflow-x: auto; scrollbar-width: none; }
.cam-tray::-webkit-scrollbar { display: none; }
.cam-tray[hidden] { display: none; }
.cam-thumb { flex: none; width: 40px; height: 64px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .09); background: #0d0d0e center / cover no-repeat;
  animation: cam-in .3s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes cam-in { from { transform: scale(.6); opacity: .5; } to { transform: none; opacity: 1; } }
.cam-btns { display: flex; gap: 12px; }
.cam-btns button { flex: 1; height: 52px; border-radius: 26px; font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; }
.cam-type { border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #f5f5f4; }
.cam-done { border: 0; background: #fff; color: #000; }
.cam-btns button:active, .cam-x:active { transform: scale(.97); }
.cam-x:focus-visible, .cam-torch:focus-visible, .cam-btns button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .cam-guide.pulse, .cam-thumb { animation: none; }
  .cam.grow.in, .cam.fade.in, .cam.out, .cam-chip i { transition: none; }
}

/* checking slabs in (the panel's Check in, opts.tally): the read's result in color, right at the box, and the panel
   counts what's in and what's left. Green: in the deal and checked in. Red: not in this deal. Amber: already in. */
.cam-guide { transition: border-color .18s ease-out; }
.cam-guide.ok { border-color: #4cc38a; }
.cam-guide.no { border-color: #e5484d; }
.cam-guide.warn { border-color: #e0a050; }
.cam-chip.ok i { background: #4cc38a; }
.cam-chip.ok b { color: #7fe0ae; }
.cam-chip.no i { background: #e5484d; }
.cam-chip.no b { color: #f3a6a8; }
.cam-chip.warn i { background: #e0a050; }
.cam-chip.warn b { color: #f0c68a; }
.cam.tally .cam-chip .cam-name { white-space: normal; max-width: 280px; }
.cam.tally .cam-chip .cam-name.on { max-height: 36px; }
.cam-check.ok { background: #4cc38a; color: #04140b; }
.cam-prog { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.cam-prog i { display: block; height: 100%; border-radius: 3px; background: #4cc38a; transform: scaleX(0); transform-origin: left;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1); }
.cam.tally .cam-panel { gap: 16px; }
.cam.tally .cam-title { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .cam-guide, .cam-prog i { transition: none; } }
/* check-in's result chip: bigger and tinted, readable at arm's length */
.cam.tally .cam-chip { font-size: 17px; line-height: 22px; border-radius: 12px; }
.cam.tally .cam-chip .cam-msg { padding: 10px 18px 10px 14px; }
.cam.tally .cam-chip i { width: 4px; }
.cam.tally .cam-chip.ok { background: rgba(10, 36, 23, .94); border-color: rgba(76, 195, 138, .45); }
.cam.tally .cam-chip.no { background: rgba(42, 12, 13, .94); border-color: rgba(229, 72, 77, .45); }
.cam.tally .cam-chip.warn { background: rgba(40, 28, 10, .94); border-color: rgba(224, 160, 80, .45); }
.cam.tally .cam-chip .cam-name { font-size: 14px; line-height: 19px; color: #d4d4d4; }
.cam.tally .cam-chip .cam-name.on { max-height: 40px; }
/* the counts: checked in (green), left, not in this deal (red, once there is one) */
.cam.tally .cam-title { display: flex; gap: 24px; font-size: 13px; font-weight: 500; font-stretch: 100%; letter-spacing: 0; color: #a3a3a3; }
.cam-stat { display: grid; gap: 2px; }
.cam-stat b { font-family: var(--display, "Archivo", system-ui, sans-serif); font-stretch: 112.5%; font-size: 30px; font-weight: 600; line-height: 1; color: #f5f5f4;
  font-variant-numeric: tabular-nums; }
.cam-stat.ok b { color: #7fe0ae; }
.cam-stat.no b { color: #f3a6a8; }
.cam.tally .cam-text { gap: 10px; }
