/* =====================================================================
   AFIAS cartridge: rotatable 3D model with labelled parts
   Replaces the cartridge photos in the Test Menu viewer.
   Add this file AFTER poct.css (or paste at the end of poct.css).
   ===================================================================== */

/* hide the old photo slides, keep their slider/info logic running */
#test-menu .poct-tm-img .poct-tm-slide { display: none !important; }
#test-menu .poct-tm-img { padding: 0 !important; }

.poct-cart {
  --cart-accent: #0e7c74;          /* mint theme of the test menu */
  --cart-accent-dark: #0a5f59;
  --cart-ink: #10302d;
  --cart-muted: #4b6763;
  --cart-line: #d3e7e2;
  position: absolute; inset: 0;
  display: flex;
  font-family: 'Open Sans', sans-serif;
  user-select: none; -webkit-user-select: none;
}

/* ---------- 3D view ---------- */
.poct-cart-view {
  position: relative; flex: 1 1 auto; min-width: 0;
  perspective: 1100px; perspective-origin: 50% 40%;
  cursor: grab; touch-action: pan-y; outline: none; overflow: hidden;
}
.poct-cart-view.is-dragging { cursor: grabbing; }
.poct-cart-view:focus-visible { box-shadow: inset 0 0 0 3px rgba(14,124,116,.35); }

.poct-cart-model, .poct-cart-rig, .poct-cart-box { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.poct-cart-face { position: absolute; backface-visibility: visible; }
.poct-cart-face.is-top { background: #fbfcfd; border-radius: 6px; box-shadow: inset 0 0 0 1px #d7dee6; transform-style: preserve-3d; }
.poct-cart-face.is-top svg { display: block; width: 100%; height: 100%; border-radius: 6px; }
.poct-cart-face.is-side { background: linear-gradient(#eef2f6, #d9e0e8); }
.poct-cart-face.is-end  { background: linear-gradient(#e4e9ef, #ccd5df); }
.poct-cart-face.is-under{ background: #dfe5ec; border-radius: 8px; }
.poct-cart-tip .poct-cart-face.is-top { border-radius: 6px; }

/* soft floor shadow */
.poct-cart-shadow {
  position: absolute; left: 50%; top: 50%; width: 560px; height: 150px; margin: -75px 0 0 -280px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(16,48,45,.22), rgba(16,48,45,0));
  transform: translateZ(-26px); pointer-events: none;
}

/* ---------- pins ---------- */
.poct-cart-anchor { position: absolute; width: 1px; height: 1px; pointer-events: none; }
.poct-cart-pins { position: absolute; inset: 0; pointer-events: none; }
.poct-cart-leads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.poct-cart-lead { stroke: var(--cart-accent); stroke-width: 1.5; opacity: .55; }
.poct-cart-dot  { fill: #fff; stroke: var(--cart-accent); stroke-width: 1.5; }
.poct-cart-lead.is-active { opacity: 1; stroke-width: 2; }
.poct-cart-dot.is-active  { fill: var(--cart-accent); }
.poct-cart-pin {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0;
  border: 2px solid #fff; border-radius: 50%;
  background: var(--cart-accent); color: #fff;
  font: 700 11px/18px 'Open Sans', sans-serif !important; text-align: center;
  box-shadow: 0 3px 8px rgba(16,48,45,.35);
  cursor: pointer; pointer-events: auto;
  transition: transform .2s, background .2s;
}
.poct-cart-pin::before {             /* pulse ring on the active pin */
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--cart-accent); opacity: 0;
}
.poct-cart-pin.is-active { transform: scale(1.18); background: var(--cart-accent-dark); z-index: 2; }
.poct-cart-pin.is-active::before { animation: poctCartPulse 1.6s ease-out infinite; }
@keyframes poctCartPulse { 0% { opacity: .7; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.5); } }

/* label bubble for the active part */
.poct-cart-bubble {
  position: absolute; left: 0; top: 0; z-index: 3;
  max-width: 230px; padding: 8px 12px 9px;
  background: #fff; border: 1px solid var(--cart-line); border-radius: 10px;
  box-shadow: 0 10px 24px rgba(16,48,45,.18);
  pointer-events: none; transition: opacity .2s;
}
.poct-cart-bubble[hidden] { display: block; opacity: 0; }
.poct-cart-bubble b { display: block; font-size: 13px !important; color: var(--cart-ink); line-height: 1.3; }
.poct-cart-bubble span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--cart-muted); }

/* ---------- controls ---------- */
.poct-cart-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.poct-cart-hint span {
  background: rgba(16,48,45,.82); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; white-space: nowrap; transition: opacity .4s;
}
.poct-cart.is-used .poct-cart-hint span { opacity: 0; }
.poct-cart-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--cart-accent); color: #fff; font: 700 12px/1 'Open Sans', sans-serif;
  letter-spacing: .04em; padding: 6px 10px; border-radius: 20px;
}
.poct-cart-reset {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--cart-line); border-radius: 50%; background: #fff; color: var(--cart-accent);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s, color .2s;
}
.poct-cart-reset:hover { background: var(--cart-accent); color: #fff; }
.poct-cart-reset svg { width: 16px; height: 16px; }

/* ---------- parts list ---------- */
.poct-cart-legend {
  flex: 0 0 190px; margin: 0; padding: 12px 12px 12px 0; list-style: none;
  display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow-y: auto;
}
.poct-cart-legend button {
  display: flex; align-items: center; gap: 9px; width: 80%;
  padding: 4px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer; transition: background .2s, border-color .2s;
}
.poct-cart-legend button:hover { background: rgba(255,255,255,.55); }
.poct-cart-legend button.is-active { background: #fff; border-color: var(--cart-line); box-shadow: 0 4px 10px rgba(16,48,45,.08); }
.poct-cart-legend i {
  flex: 0 0 20px; height: 20px; border-radius: 50%;
  background: var(--cart-accent); color: #fff; font: 700 11px/20px 'Open Sans', sans-serif; font-style: normal !important; text-align: center;
}
.poct-cart-legend span { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--cart-ink); }

/* narrow viewer (phones / tablets): no side list, the bubble does the labelling */
.poct-cart.is-compact .poct-cart-legend { display: none; }
.poct-cart.is-compact .poct-cart-bubble { max-width: 190px; }
.poct-cart.is-compact .poct-cart-pin { width: 20px; height: 20px; margin: -10px 0 0 -10px; font-size: 10.5px !important; line-height: 16px !important; }


@media (prefers-reduced-motion: reduce) {
  .poct-cart-pin.is-active::before { animation: none; }
}

/* frosted clear plastic (underside, wells and grip) */
.poct-cart-body .poct-cart-face.is-side, .poct-cart-body .poct-cart-face.is-end { background: linear-gradient(rgba(236,242,246,.95), rgba(205,216,225,.9)); }
.poct-cart-clear .poct-cart-face { background: rgba(222,233,240,.55); box-shadow: inset 0 0 0 1px rgba(150,172,188,.55); border-radius: 2px; }
.poct-cart-clear .poct-cart-face.is-top { background: rgba(238,244,248,.7); }
.poct-cart-grip .poct-cart-face.is-top { background: repeating-linear-gradient(90deg, rgba(240,245,248,.85) 0 4px, rgba(190,205,216,.75) 4px 6px); }

/* ---------- updated proportions (longer clear grip) ---------- */
.poct-cart-shadow { width: 680px; margin-left: -340px; }
/* the real finger tab is smooth clear plastic with a small moulded window */
.poct-cart-grip .poct-cart-face.is-top { background: rgba(236,243,247,.72); }
.poct-cart-grip-window {
  position: absolute; left: 10px; top: 28px; width: 24px; height: 38px;
  border: 1px solid rgba(140,162,178,.75); border-radius: 3px;
  background: rgba(255,255,255,.35); pointer-events: none;
}
 
/* ---------- updated proportions (longer clear grip) ---------- */
.poct-cart-shadow { width: 680px; margin-left: -340px; }
/* the real finger tab is smooth clear plastic with a small moulded window */
.poct-cart-grip .poct-cart-face.is-top { background: rgba(236,243,247,.72); }
.poct-cart-grip-window {
  position: absolute; left: 10px; top: 28px; width: 24px; height: 38px;
  border: 1px solid rgba(140,162,178,.75); border-radius: 3px;
  background: rgba(255,255,255,.35); pointer-events: none;
}

/* ---------- key parts (2, 3, 6) highlighted, the rest dimmed ---------- */
/* dimmed pins, leads and list numbers */
.poct-cart-pin:not(.is-key) {
  background: #fff; color: #6f8a86; border-color: #cfe0dc;
  box-shadow: 0 1px 3px rgba(16,48,45,.12); opacity: .85;
}
.poct-cart-lead:not(.is-key) { opacity: .22; }
.poct-cart-dot:not(.is-key)  { stroke: #a9c2bd; }
/* key pins: teal with a soft halo */
.poct-cart-pin.is-key { box-shadow: 0 0 0 5px rgba(14,124,116,.18), 0 3px 8px rgba(16,48,45,.35); }
/* any pin turns solid teal while hovered */
.poct-cart-pin.is-active { background: var(--cart-accent-dark); color: #fff; border-color: #fff; opacity: 1; }

.poct-cart-legend button:not(.is-key) i { background: #fff; color: #6f8a86; box-shadow: inset 0 0 0 1.5px #cfe0dc; }
.poct-cart-legend button:not(.is-key) span { font-weight: 500; color: #6f8a86; }
.poct-cart-legend button.is-key span { font-weight: 700; }
.poct-cart-legend button.is-active i { background: var(--cart-accent); color: #fff; box-shadow: none; }
.poct-cart-legend button.is-active span { color: var(--cart-ink); }

/* "Pre-filled buffer inside" chip in the description, and a small one in the list */
.poct-cart-bubble-tag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  padding: 3px 9px 3px 7px; border-radius: 20px;
  background: #e2f3ef; color: var(--cart-accent-dark);
  font: 700 11.5px/1.4 'Open Sans', sans-serif; font-style: normal !important;
}
.poct-cart-bubble-tag::before {           /* small drop */
  content: ""; width: 7px; height: 9px; background: var(--cart-accent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.poct-cart-bubble-tag[hidden] { display: none; }
.poct-cart-legend-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 10px;
  background: #e2f3ef; color: var(--cart-accent-dark);
  font: 700 10px/16px 'Open Sans', sans-serif; font-style: normal !important; vertical-align: 1px;
}