/* ==========================================================================================================
   Kit Builder — the digital gear walkthrough (docs/KIT-BUILDER.md; component: public/js/kit-builder.js)
   One card: the build bay (every camera of the kit as a built rig, side by side) + the always-visible lens cards +
   camera count / prices / CTA. Phones stack them (bay, lens cards right under it, controls) and get a sticky
   "N cameras · $X · Pick your hours" bar; desktop puts the bay left (sticky) and the cards + controls right. The bay
   lays the rigs out in CSS (container units, so the server render is already composed); the controller moves a
   virtual camera with transforms on .kb-floor.
   ========================================================================================================== */

.kb {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 14px; padding: 10px;
  border-radius: var(--r-3); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(239, 234, 225, .025), transparent 220px), var(--graphite);
  box-shadow: var(--shadow);
}
/* the bay spans the first two rows; the lens cards and the controls stay in the last column (= the only one on phones,
   the right one when the card has two — here from 1024 px, on /book from pages/book.css) */
.kb-main { display: grid; gap: 12px; min-width: 0; grid-row: span 2; container: kbmain / inline-size; }
.kb-picker, .kb-controls { grid-column: -2; }
.kb-bar, .kb > noscript { grid-column: 1 / -1; }
.kb-label { font: 500 .6875rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--bone-2); }

@media (min-width: 1024px) {
  .kb { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 32px; padding: 14px 30px 14px 14px; align-items: start; }
  .kb-main { position: sticky; top: calc(var(--header-h) + 14px); align-self: start; }
}

/* ------------------------------------------------------------------------------------------------ build bay */
/* Rig grid (keep in step with public/js/kit-builder.js rigGrid/bestCols): each rig frames the manifest's frames.all
   (--fx/--fy/--fw/--fh of the --cw × --ch canvas); neighbours sit --pitch of a rig apart (legs interleave); --c1/--r1
   (narrow bay) and --c2/--r2 (≥ 560 px) are server-rendered per camera count. The bay is as tall as its rows need,
   between --hmin and --hmax; inside, a rig is as wide as both the width and the height allow (--rw). */
.kb-bay {
  --pt: 62px; --pb: 44px; --px: 16px; --lab: 34px; --pitch: .84;
  --cols: var(--c1, 1); --rows: var(--r1, 1);
  --hmin: 250px; --hmax: min(125cqw, 76svh);
  --fitw: calc((100cqw - 2 * var(--px)) / (1 + (var(--cols) - 1) * var(--pitch)));
  position: relative; container-type: size; overflow: hidden; isolation: isolate; width: 100%;
  height: clamp(var(--hmin), calc(var(--rows) * (var(--fitw) * var(--fh, 2343) / var(--fw, 1445) + var(--lab)) + var(--pt) + var(--pb)), var(--hmax));
  border-radius: 18px; background: var(--graphite); box-shadow: inset 0 0 0 1px var(--line);
  scroll-margin-top: calc(var(--header-h) + 10px);
  -webkit-tap-highlight-color: transparent;
}
@container kbmain (min-width: 560px) { .kb-bay { --cols: var(--c2, 1); --rows: var(--r2, 1); --pt: 64px; --pb: 50px; --px: 18px; --hmin: 380px; } }
@media (min-width: 1024px) { .kb-bay { --hmax: clamp(420px, calc(100vh - var(--header-h) - 210px), 700px); } }
/* /book (server/views/book.js passes cls 'book-kb'): the step's first screen also holds the pinned step chips */
@media (min-width: 1024px) { .book-kb .kb-bay { --hmax: clamp(380px, calc(100vh - var(--header-h) - var(--chips-h, 60px) - 250px), 620px); } }

/* the lit cyc: warm key from the upper right, a soft pool where the tripod stands */
.kb-bay__cyc { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(55% 40% at 78% 8%, rgba(231, 180, 95, .16), transparent 70%),
    radial-gradient(60% 34% at 50% calc(100% - var(--pb)), rgba(255, 236, 205, .085), transparent 72%),
    radial-gradient(75% 62% at 50% 38%, var(--cyc-hi) 0%, #3b3833 36%, #2a2824 66%, var(--graphite) 100%);
}
.kb-bay__cyc::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 min(14cqw, 120px) rgba(10, 9, 8, .55); }
/* viewfinder corners */
.kb-bay::after {
  content: ""; position: absolute; inset: 10px; z-index: 2; pointer-events: none; --c: rgba(239, 234, 225, .34); --l: 16px;
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--l) 1.5px, linear-gradient(var(--c), var(--c)) 0 0 / 1.5px var(--l),
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--l) 1.5px, linear-gradient(var(--c), var(--c)) 100% 0 / 1.5px var(--l),
    linear-gradient(var(--c), var(--c)) 0 100% / var(--l) 1.5px, linear-gradient(var(--c), var(--c)) 0 100% / 1.5px var(--l),
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--l) 1.5px, linear-gradient(var(--c), var(--c)) 100% 100% / 1.5px var(--l);
  background-repeat: no-repeat;
}

.kb-view { position: absolute; inset: 0; z-index: 1; }
/* the floor carries every rig; the virtual camera (zoom onto one camera block) is a transform on it */
.kb-floor {
  position: absolute; inset: 0; transform-origin: 0 0;
  --rw: min(calc((100cqw - 2 * var(--px)) / (1 + (var(--cols) - 1) * var(--pitch))), calc(((100cqh - var(--pt) - var(--pb)) / var(--rows) - var(--lab)) * var(--fw) / var(--fh)));
  --rh: calc(var(--rw) * var(--fh) / var(--fw));
  --cell: calc(var(--rw) * var(--pitch));
}
.kb-rigs {
  position: absolute; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start;
  width: calc(var(--cols) * var(--cell) + 1px); left: calc((100cqw - var(--cols) * var(--cell)) / 2 - .5px);
  top: calc(var(--pt) + (100cqh - var(--pt) - var(--pb) - var(--rows) * (var(--rh) + var(--lab))) / 2);
}
.kb-rig { position: relative; flex: none; width: var(--cell); height: calc(var(--rh) + var(--lab)); }
/* a rig's scene is the layer canvas (--cw × --ch) laid out so frames.all fills its cell (overhanging by the pitch) */
.kb-scene {
  --fs: calc(var(--rw) / var(--fw));
  position: absolute; width: calc(var(--fs) * var(--cw)); height: calc(var(--fs) * var(--ch));
  left: calc((var(--cell) - var(--rw)) / 2 - var(--fs) * var(--fx)); top: calc(-1 * var(--fs) * var(--fy));
  pointer-events: none; user-select: none; transition: filter .3s var(--ease);
}
/* the active camera: focus brackets (like a camera's AF box), a warm pool of light at its feet, the others a step back */
.kb-rig::before, .kb-rig::after { content: ""; position: absolute; pointer-events: none; opacity: 0; transition: opacity .25s var(--ease); }
.kb-rig::before {
  --c: var(--amber); --l: clamp(9px, calc(var(--rw) * .08), 18px);
  left: calc((var(--cell) - var(--rw)) / 2 + var(--rw) * .04); width: calc(var(--rw) * .92); top: -4px; height: calc(var(--rh) + 6px);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--l) 2px, linear-gradient(var(--c), var(--c)) 0 0 / 2px var(--l),
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--l) 2px, linear-gradient(var(--c), var(--c)) 100% 0 / 2px var(--l),
    linear-gradient(var(--c), var(--c)) 0 100% / var(--l) 2px, linear-gradient(var(--c), var(--c)) 0 100% / 2px var(--l),
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--l) 2px, linear-gradient(var(--c), var(--c)) 100% 100% / 2px var(--l);
  background-repeat: no-repeat;
}
.kb-rig::after {
  left: calc((var(--cell) - var(--rw)) / 2); width: var(--rw); top: calc(var(--rh) * .78); height: calc(var(--rh) * .24);
  background: radial-gradient(closest-side, rgba(231, 180, 95, .2), rgba(231, 180, 95, .06) 60%, transparent); z-index: -1;
}
.kb-bay.is-multi .kb-rig.is-active::before, .kb-bay.is-multi .kb-rig.is-active::after { opacity: 1; }
/* (not while something plays: the camera being built or given a lens stays lit) */
.kb-bay.is-multi:not(.is-running) .kb-rig:not(.is-active) .kb-scene { filter: brightness(.74) saturate(.85); }
/* zoomed in on one camera (a lens swap, a part's tooltip) or building: no brackets, no tags (they would loom large).
   Same selectors as the rule above plus the state, so these win; they come back (fading in) as the frame backs out —
   which is how the next camera visibly becomes the active one after a lens clicks on. */
.kb-bay.is-multi:is(.is-zoomed, .is-assembling, .has-tip) .kb-rig.is-active::before,
.kb-bay.is-multi:is(.is-zoomed, .is-assembling) .kb-rig.is-active::after,
.kb-bay:is(.is-zoomed, .is-assembling) .kb-tag { opacity: 0; transition-duration: 0s; }
/* each rig is a button: tap it to choose its lens (the camera in focus passes taps on its parts to the hit polygons) */
.kb-rig__hit {
  position: absolute; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kb-rig__hit:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.kb-rig.is-active .kb-rig__hit { cursor: default; }
@media (hover: hover) { .kb-bay.is-multi .kb-rig:not(.is-active) .kb-rig__hit:hover ~ .kb-tag .kb-tag__cam { color: var(--bone); border-color: var(--line-2); } }
.kb-rig.is-prebuild .kb-scene, .kb-bay.is-prebuild .kb-scene, .kb-bay.is-prebuild .kb-overlay { opacity: 0; }
.kb-bay.is-prebuild .kb-tag { opacity: 0; }
.kb-rig.is-leaving { pointer-events: none; }
/* the tag under each rig: "CAM 2" over its focal range (the active one in amber). It must fit its cell (--cell, the
   distance between two rigs): with 11 cameras a phone's cells are 38–52 px, so below ≈ 58 px the padding and letter
   spacing shrink, and below ≈ 48 px the type too (never under 8 px) — "CAM 10" and "CAM 11" never touch, down to 320 px. */
.kb-tag {
  position: absolute; left: 50%; bottom: 4px; translate: -50% 0; display: grid; justify-items: center; gap: 3px;
  font: 600 max(8px, min(clamp(9px, calc(var(--rw) * .06), 11px), calc((var(--cell, 60px) - 8px) / 4.4)))/1 var(--font-mono);
  white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums;
  transition: opacity .3s var(--ease);
}
.kb-tag__cam {
  padding: 3px clamp(2px, calc((var(--cell, 60px) - 40px) / 3), 6px) 2px; border-radius: 4px; border: 1px solid var(--line);
  background: rgba(31, 30, 27, .62); color: var(--bone-2); text-transform: uppercase;
  letter-spacing: clamp(0px, calc((var(--cell, 60px) - 50px) / 10), .08em); transition: background-color .2s, color .2s, border-color .2s;
}
.kb-tag__lens { color: var(--bone); letter-spacing: .01em; }
.kb-rig.is-active .kb-tag__cam { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.kb-rig.is-active .kb-tag__lens { color: var(--amber); }
.kb-bay:not(.is-multi) .kb-tag { display: none; }

.kb-block { position: absolute; inset: 0; }

.kb-l { position: absolute; max-width: none; display: block; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.kb-l[hidden] { display: none; }
.kb-shadows { position: absolute; inset: 0; transform-origin: 50% 96%; }
.kb-shadow { position: absolute; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .5), rgba(0, 0, 0, .22) 55%, transparent); }
.kb-shadow--floor { background: radial-gradient(closest-side, rgba(0, 0, 0, .34), rgba(0, 0, 0, .12) 60%, transparent); }
.kb-shadow--foot { background: radial-gradient(closest-side, rgba(0, 0, 0, .66), rgba(0, 0, 0, .25) 55%, transparent); }
.kb-cables { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.kb-byo { position: absolute; border-radius: 50%; border: 2px dashed rgba(231, 180, 95, .8); background: radial-gradient(closest-side, rgba(231, 180, 95, .06), transparent); box-shadow: 0 0 22px rgba(231, 180, 95, .18); }
/* the lock flash: a thin seam of light at the flange, BEHIND the lens layer (only the rim shows); sized in screen px
   whatever the zoom (--k = the frame's scale, set by the controller) */
.kb-pulse { position: absolute; border-radius: 50%; opacity: 0; pointer-events: none;
  border: calc(1.5px / var(--k, 1)) solid rgba(255, 221, 166, .95);
  box-shadow: 0 0 calc(5px / var(--k, 1)) calc(1px / var(--k, 1)) rgba(231, 180, 95, .6); }
.kb-snap { position: absolute; border-radius: 50%; opacity: 0; pointer-events: none; background: radial-gradient(closest-side, rgba(255, 232, 186, .95), rgba(231, 180, 95, .45) 45%, transparent); }

/* hit areas: the parts themselves (pointer); the dots are the keyboard / screen-reader buttons */
.kb-hits { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.kb-hits polygon { fill: transparent; stroke: transparent; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill .2s, stroke .2s; }
.kb-bay.is-built:not(.is-assembling) .kb-hits polygon { pointer-events: all; cursor: pointer; }
@media (hover: hover) { .kb-hits polygon:hover { fill: rgba(231, 180, 95, .06); stroke: rgba(231, 180, 95, .5); } }
.kb-hits polygon.is-on { fill: rgba(231, 180, 95, .08); stroke: rgba(231, 180, 95, .7); }

/* overlay: hotspot dots, focal callout, tooltip card (screen px, positioned by the controller) */
.kb-overlay { position: absolute; inset: 0; pointer-events: none; }
.kb-dots { position: absolute; inset: 0; }
.kb-overlay.is-moving .kb-dots, .kb-overlay.is-moving .kb-callout { opacity: 0; transition: opacity .12s; }
.kb-dot {
  position: absolute; z-index: 2; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent;
  transform: translate(-50%, -50%); display: grid; place-items: center; cursor: pointer; pointer-events: auto; color: var(--amber);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kb-dot[hidden], .kb-dot.is-off { display: none; }
.kb-dot.is-culled { opacity: 0; pointer-events: none; }
.kb-dot.is-culled:focus-visible { opacity: 1; }
.kb-dot__ring {
  position: relative; width: 11px; height: 11px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 2px rgba(24, 23, 21, .7), 0 0 0 3.5px rgba(231, 180, 95, .35), 0 3px 10px rgba(0, 0, 0, .55);
  transition: transform .2s var(--ease), background-color .2s;
}
.kb-dot__ring::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(231, 180, 95, .7); animation: kb-ping 2.8s cubic-bezier(.2, .7, .3, 1) infinite; animation-delay: var(--d, 0s); }
.kb-dots.is-compact .kb-dot__ring { width: 9px; height: 9px; }
.kb-dots.is-compact .kb-dot__ring::after { inset: -5px; }
.kb-dot:nth-child(2) { --d: .3s; } .kb-dot:nth-child(3) { --d: .6s; } .kb-dot:nth-child(4) { --d: .9s; } .kb-dot:nth-child(5) { --d: 1.2s; }
.kb-dot:nth-child(6) { --d: 1.5s; } .kb-dot:nth-child(7) { --d: 1.8s; } .kb-dot:nth-child(8) { --d: 2.1s; }
@keyframes kb-ping { 0% { transform: scale(.55); opacity: .95; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
.kb-dot:hover .kb-dot__ring, .kb-dot.is-hover .kb-dot__ring, .kb-dot:focus-visible .kb-dot__ring { transform: scale(1.25); }
.kb-dot.is-open .kb-dot__ring { background: var(--bone); transform: scale(1.2); }
.kb-dot.is-open .kb-dot__ring::after { animation: none; opacity: 0; }
.kb-dot:focus-visible { outline: 2px solid var(--amber); outline-offset: -4px; }
.kb-dot__label {
  position: absolute; left: 36px; top: 50%; translate: 0 -50%; padding: 4px 7px 3px; border-radius: 4px; white-space: nowrap;
  background: var(--tape); color: var(--tape-ink); font: 600 .625rem/1.1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .16s; pointer-events: none;
}
.kb-dot[data-side="left"] .kb-dot__label { left: auto; right: 36px; }
.kb-dot:hover .kb-dot__label, .kb-dot.is-hover .kb-dot__label, .kb-dot:focus-visible .kb-dot__label, .kb-dot.is-open .kb-dot__label { opacity: 1; }

/* focal-length callout: a strip of tape beside the front of the lens (.is-left), or hanging under it */
.kb-callout { position: absolute; z-index: 1; display: grid; justify-items: end; gap: 5px; padding-top: 20px; translate: calc(-100% + 14px + var(--shift, 0px)) 0; pointer-events: none; }
.kb-callout[hidden] { display: none; }
.kb-callout::before { content: ""; position: absolute; top: 0; right: calc(14px - var(--shift, 0px)); width: 1px; height: 21px; background: linear-gradient(var(--amber), rgba(231, 180, 95, .6)); }
.kb-callout::after { content: ""; position: absolute; top: -3px; right: calc(11.5px - var(--shift, 0px)); width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px rgba(231, 180, 95, .8); }
.kb-callout.is-left { padding: 0 26px 0 0; translate: -100% -50%; }
.kb-callout.is-left::before { top: 50%; right: 3px; width: 22px; height: 1px; background: linear-gradient(90deg, rgba(231, 180, 95, .6), var(--amber)); }
.kb-callout.is-left::after { top: calc(50% - 3px); right: 0; }
.kb-callout.is-left .kb-callout__ff { position: absolute; top: 100%; right: 26px; margin-top: 6px; }
.kb-callout__tape {
  --tilt: -1.4deg; display: inline-block; padding: 5px 9px 4px; background-color: var(--tape); color: var(--tape-ink); rotate: var(--tilt);
  background-image: repeating-linear-gradient(90deg, rgba(42, 39, 36, .035) 0 1px, transparent 1px 4px), linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(0, 0, 0, .04));
  font: 700 .75rem/1.1 var(--font-mono); letter-spacing: .02em; white-space: nowrap; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 16px -10px rgba(0, 0, 0, .8);
  clip-path: polygon(1.5% 4%, 99% 0, 100% 30%, 98.5% 55%, 100% 80%, 98% 100%, 1% 96%, 2.5% 70%, 0 45%, 1.8% 22%);
}
.kb-callout__ff { padding-left: 2px; font: 500 .6875rem/1.2 var(--font-mono); color: rgba(239, 234, 225, .78); white-space: nowrap; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
@container (max-width: 380px) { .kb-callout__ff { display: none; } }
@container (max-width: 559px) { .kb-bay.has-tip .kb-callout { display: none; } }

/* tooltip card */
.kb-tip {
  position: absolute; z-index: 6; width: min(300px, calc(100% - 24px)); padding: 14px 8px 8px 16px; display: grid; gap: 6px;
  border-radius: 14px; border: 1px solid var(--line-2); background: rgba(40, 38, 34, .95); color: var(--bone);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 26px 50px -22px rgba(0, 0, 0, .85);
  pointer-events: auto; animation: kb-tip-in .22s var(--ease);
}
.kb-tip[hidden] { display: none; }
.kb-tip.is-docked { left: 10px; right: 10px; bottom: 10px; top: auto; width: auto; }
@keyframes kb-tip-in { from { opacity: 0; translate: 0 6px; } }
.kb-tip__kicker { font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--amber); padding-right: 8px; }
.kb-tip__title { font-weight: 600; font-size: 1.0625rem; line-height: 1.25; padding-right: 8px; }
.kb-tip__lines { display: grid; gap: 4px; padding-right: 8px; }
.kb-tip__line { font-size: .9375rem; line-height: 1.4; color: var(--bone); }
.kb-tip__sub { font-size: .8125rem; line-height: 1.4; color: var(--bone-2); }
.kb-tip__actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.kb-tip__next { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px 0 0; border: 0; background: none; color: var(--amber); font: 600 .875rem/1 var(--font-body); }
.kb-tip__next:hover .icon { transform: translateX(2px); }
.kb-tip__next .icon { transition: transform .2s var(--ease); }
.kb-tip__close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--bone-2); }
.kb-tip__close:hover { color: var(--bone); background: rgba(239, 234, 225, .06); }

/* HUD (camera viewfinder) + sound toggle */
.kb-hud { position: absolute; z-index: 3; top: 16px; left: 18px; right: 66px; display: grid; gap: 5px; pointer-events: none; }
.kb-hud__rec { display: inline-flex; align-items: center; gap: .6em; font: 500 .6875rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: rgba(239, 234, 225, .72); font-variant-numeric: tabular-nums; }
.kb-hud__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); box-shadow: 0 0 10px rgba(240, 82, 79, .8); animation: rec 1.6s steps(1, end) infinite; }
.kb-hud__cam { margin-left: .4em; }
.kb-hud__cam b { color: var(--bone); font-weight: 600; }
.kb-hud__lens { font: 600 .9375rem/1.2 var(--font-body); color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
.kb-bay.is-empty .kb-hud__dot { animation: none; background: var(--bone-3); box-shadow: none; }
.kb-sound {
  position: absolute; z-index: 4; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(31, 30, 27, .45); color: var(--bone-2);
  transition: color .18s, border-color .18s, background-color .18s;
}
.kb-sound:hover { color: var(--bone); border-color: var(--line-2); }
.kb-sound[aria-pressed="true"] { color: var(--amber); }
.kb-sound[aria-pressed="true"] .kb-ic-mute, .kb-sound[aria-pressed="false"] .kb-ic-waves { display: none; }

/* assembly checklist → hint */
.kb-steps {
  position: absolute; z-index: 3; left: 14px; right: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 5px;
  margin: 0; padding: 0; list-style: none; pointer-events: none; opacity: 0; transition: opacity .18s;
}
/* fades in a beat after the hint has gone (the hint fades out fast, below), so the two never overprint */
.kb-bay.is-assembling .kb-steps { opacity: 1; transition: opacity .28s .1s; }
.kb-steps li {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px 5px 7px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(31, 30, 27, .62); font: 500 .625rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bone-2);
  transition: color .2s, border-color .2s, background-color .2s;
}
.kb-steps .icon { width: 10px; height: 10px; opacity: .25; transition: opacity .2s; }
.kb-steps__s { display: none; }
/* phones: one row (short "SSD", tighter pills, type that scales with the bay down to 360 px screens) */
@container (max-width: 420px) {
  .kb-steps { gap: 4px; left: 18px; right: 18px; flex-wrap: nowrap; } /* clear of the viewfinder corner brackets */
  .kb-steps li { padding: 4px 5px; gap: 3px; letter-spacing: 0; font-size: clamp(8px, 2.75cqw, 10px); white-space: nowrap; }
  .kb-steps .icon { width: 9px; height: 9px; }
  .kb-steps__l { display: none; } .kb-steps__s { display: inline; }
}
.kb-steps li.is-done { color: var(--amber); border-color: rgba(231, 180, 95, .45); background: rgba(46, 38, 24, .78); }
.kb-steps li.is-done .icon { opacity: 1; }
.kb-hint {
  position: absolute; z-index: 3; left: 18px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; pointer-events: none;
  font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: rgba(239, 234, 225, .7);
  opacity: 0; transition: opacity .1s;
}
.kb-hint[hidden] { display: none; }
.kb-hint__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(231, 180, 95, .2); }
/* out fast (above), in slowly once the checklist has gone */
.kb-bay.is-built:not(.is-assembling):not(.has-tip) .kb-hint { opacity: 1; transition: opacity .4s .2s; }

/* ------------------------------------------------------------------------------------------------ controls */
.kb-controls { container-type: inline-size; display: grid; gap: 20px; align-content: start; min-width: 0; padding: 6px 4px 4px; }
.kb-count { display: grid; gap: 10px; }
.kb-count__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kb-count .kb-label { font-size: .75rem; color: var(--bone); }
.kb-stepper output { min-width: 40px; }
/* One chip per camera in the fleet (--n, server-rendered by kit-builder.js chipGrid; --half = ⌈n / 2⌉, --third = ⌈n / 3⌉).
   The fewest rows in which every chip still gets 44 px: one row (--one ≥ 44px), else two balanced rows (11 → 6 + 5,
   9 → 5 + 4), else three (11 → 4 + 4 + 3, e.g. a 320 px phone or a narrow /book column). The column width is --one,
   --two or --three, picked without a fixed breakpoint ((44px − --one) × 1000 is ≤ 0 exactly when one row fits; the same
   test on --two picks between two and three rows). auto-fill then makes exactly n, ⌈n / 2⌉ or ⌈n / 3⌉ columns (the
   −.5px keeps rounding from dropping one). */
.kb-chips {
  --gap: 4px;
  --one: calc((100% - (var(--n, 5) - 1) * var(--gap)) / var(--n, 5));
  --two: calc((100% - (var(--half, 3) - 1) * var(--gap)) / var(--half, 3));
  --three: calc((100% - (var(--third, 2) - 1) * var(--gap)) / var(--third, 2));
  --two-or-three: max(var(--two), min(var(--three), (44px - var(--two)) * 1000));
  display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(max(var(--one), min(var(--two-or-three), (44px - var(--one)) * 1000)) - .5px), 1fr));
  gap: var(--gap); padding: 4px; border-radius: 14px; background: var(--graphite-0); border: 1px solid var(--line);
}
.kb-chip {
  position: relative; min-height: 46px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent;
  font: 600 1.0625rem/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--bone-2); text-decoration: none; cursor: pointer;
  transition: background-color .18s, color .18s, box-shadow .18s;
}
.kb-chip:hover { background: rgba(239, 234, 225, .06); color: var(--bone); }
.kb-chip.is-in { color: var(--bone); background: rgba(231, 180, 95, .1); }
.kb-chip.is-on { background: var(--amber); color: var(--amber-ink); box-shadow: 0 6px 18px -8px rgba(231, 180, 95, .8); }
.kb-chip:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.kb-price { display: grid; gap: 12px; }
.kb-price__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--line); font: 500 .8125rem/1.3 var(--font-mono); color: var(--bone-2); font-variant-numeric: tabular-nums; }
.kb-price__row b { color: var(--bone); font-weight: 600; }
.kb-fine { font-size: .8125rem; line-height: 1.5; color: var(--bone-2); }
.kb-actions { display: grid; gap: 6px; justify-items: start; }
.kb-actions .kb-cta { width: 100%; }
@media (max-width: 1023px) {
  .kb-actions .kb-cta { display: none; }
  /* keyboard focus scrolls controls clear of the sticky bar below them (WCAG 2.4.11) */
  .kb-main :is(a, button), .kb-picker :is(a, button), .kb-controls :is(a, button) { scroll-margin-bottom: calc(92px + env(safe-area-inset-bottom)); }
}

/* phones + tablets: sticky summary bar inside the card */
.kb-bar {
  position: sticky; bottom: 0; z-index: 8; margin: 2px -10px -10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r-3) var(--r-3);
  background: rgba(40, 38, 34, .95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 -16px 36px -26px rgba(0, 0, 0, .9);
}
.kb-bar__sum { display: grid; gap: 2px; min-width: 0; font: 500 .75rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--bone-2); }
.kb-bar__sum b { font-weight: 600; color: var(--bone); }
.kb-bar__sum span { font: 760 1.35rem/1 var(--font-display); font-stretch: 112%; letter-spacing: -.02em; text-transform: none; color: var(--amber); font-variant-numeric: tabular-nums; }
.kb-bar__cta { flex: none; min-height: 48px; padding: 0 18px; }
@media (min-width: 1024px) { .kb-bar { display: none; } }

/* no-JS list of what each part is (full width, under everything) */
.kb > noscript { display: block; grid-column: 1 / -1; }
.kb-parts { margin: 0; padding: 4px 6px; list-style: none; display: grid; gap: 6px; font-size: .875rem; color: var(--bone-2); }
.kb-parts b { color: var(--bone); font-weight: 600; }

/* ------------------------------------------------------------------------------------------------ lens cards */
.kb-picker { container: kbpick / inline-size; display: grid; gap: 10px; min-width: 0; align-content: start; padding: 2px 2px 0; }
.kb-picker__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.kb-picker__title { font: 600 1.0625rem/1.25 var(--font-body); color: var(--bone); letter-spacing: -.005em; }
.kb-picker__title b { color: var(--amber); font-weight: 700; font-variant-numeric: tabular-nums; }
.kb-picker__nav { display: flex; gap: 6px; flex: none; }
.kb-nav {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(239, 234, 225, .02); color: var(--bone); cursor: pointer; transition: border-color .18s, color .18s, background-color .18s;
}
.kb-nav:hover { border-color: rgba(231, 180, 95, .6); color: var(--amber); }
.kb-nav:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.kb-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kb-opt {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 68px; min-width: 0;
  padding: 8px 7px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--graphite-3); color: var(--bone);
  font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: border-color .18s, background-color .18s, box-shadow .18s, transform .18s var(--ease);
}
span.kb-opt { cursor: default; }
button.kb-opt:hover:not(:disabled) { border-color: rgba(231, 180, 95, .6); background: #3a3631; }
button.kb-opt:active:not(:disabled) { transform: scale(.98); }
.kb-opt.is-on { border-color: var(--amber); background: #3b342a; box-shadow: inset 0 0 0 1px var(--amber), 0 12px 26px -18px rgba(231, 180, 95, .8); }
.kb-opt:disabled { opacity: .5; cursor: not-allowed; }
.kb-opt:disabled .kb-opt__img img { filter: grayscale(1) brightness(.7); }
.kb-opt:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.kb-opt__img { display: grid; place-items: center; height: 44px; border-radius: 10px; overflow: hidden; background: radial-gradient(60% 62% at 50% 46%, rgba(255, 236, 205, .13), transparent 72%), #2a2824; }
.kb-opt__img img { max-width: 94%; max-height: 82%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
.kb-opt__mount { width: 26px; height: 26px; border-radius: 50%; border: 2px dashed rgba(231, 180, 95, .75); box-shadow: inset 0 0 0 5px rgba(31, 30, 27, .6); }
.kb-opt__body { display: grid; gap: 3px; min-width: 0; }
.kb-opt__name {
  font: 600 .875rem/1.2 var(--font-body); overflow-wrap: anywhere; text-wrap: balance;
  /* two lines rather than an ellipsis: "Tamron 24–70mm" must stay readable on 1280–1366 px laptops and 360 px phones */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.kb-opt__focal { font: 600 .6875rem/1.25 var(--font-mono); color: var(--amber); font-variant-numeric: tabular-nums; }
/* "All 4 in your kit" (a 10- or 11-camera kit uses every Tamron 24–70) is wider than a 390 px phone's card: it wraps
   (balanced) instead of running out of the card; the dot stays on the first line. */
.kb-opt__stock { display: inline-flex; align-items: flex-start; gap: 5px; font: 500 .6875rem/1.2 var(--font-mono); color: var(--go); font-variant-numeric: tabular-nums; text-wrap: balance; }
.kb-opt__stock::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: calc((1.2em - 6px) / 2); border-radius: 50%; background: currentColor; }
.kb-opt__stock.is-low { color: var(--low); }
.kb-opt__stock.is-out { color: var(--bone-2); }
.kb-opt__stock.is-out::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.kb-opt__stock.is-own { color: var(--bone-2); }
.kb-opt__stock.is-own::before { display: none; }
/* the lens on the camera in focus: an amber check badge */
.kb-opt.is-on::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--amber) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.2 4.2L19 7' fill='none' stroke='%231F1E1B' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
/* A narrow picker (≈300 px: 1280–1366 px laptops, 360 px phones) can't fit photo + text side by side without clipping
   "6 of 8 free": stack the photo above the text instead. */
@container kbpick (max-width: 320px) {
  .kb-opt { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; padding: 8px; }
  .kb-opt__img { height: 40px; }
  .kb-opt.is-on::after { left: auto; right: 6px; top: 6px; }
}
@container kbpick (min-width: 400px) {
  .kb-opt { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 8px 10px 8px 8px; }
  .kb-opt__img { height: 48px; }
  .kb-opt.is-on::after { left: auto; right: 6px; top: 6px; }
  .kb-opt.is-on .kb-opt__body { padding-right: 16px; }
}
.kb-picker__foot { display: flex; align-items: center; min-height: 44px; }
.kb-picker__fine { font-size: .8125rem; line-height: 1.4; color: var(--bone-2); }
.kb-all {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: rgba(239, 234, 225, .02); color: var(--bone); font: 600 .875rem/1.2 var(--font-body); text-align: left;
  cursor: pointer; transition: border-color .18s, color .18s, background-color .18s;
}
.kb-all .icon { color: var(--amber); flex: none; }
.kb-all:hover { border-color: rgba(231, 180, 95, .6); color: var(--amber); }
.kb-all:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.kb-picker__note { padding: 8px 12px; border-left: 2px solid var(--amber); border-radius: 0 8px 8px 0; background: var(--amber-soft); color: var(--bone); font-size: .875rem; line-height: 1.4; }

/* ------------------------------------------------------------------------------------------------ home section */
.kb-section .section-head { margin-bottom: clamp(24px, 4vw, 40px); }
.kb-section .claims { margin-top: 18px; }
.claims--quiet .claim { background: transparent; gap: 10px; padding: clamp(18px, 2.4vw, 24px); }
.claims--quiet .claim__big { font-size: clamp(1.35rem, 2.4vw, 1.8rem); }
.claims--quiet .claim__text { font-size: .9375rem; }
.kb-section .compare { margin-top: 14px; }

/* ------------------------------------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  .kb-dot__ring::after, .kb-hud__dot { animation: none; }
  .kb-tip { animation: none; }
}
@media print { .kb-sound, .kb-bar, .kb-dots, .kb-tip { display: none !important; } }
