/* Product 03 · physical-AI model. The inline SVG opens a Canvas room
   through the single camera lens; product-ai-entry.js owns its lifecycle. */
#product-ai {
  --pai-s2: 8px;
  --pai-s3: 12px;
  --pai-s4: 16px;
  --pai-s5: 24px;
  --pai-s6: 32px;
  --pai-hairline: 1px;
  --pai-caption: 11px;
  --pai-title: clamp(23px, 2.3vw, 36px);
  --pai-body: clamp(13px, 1.12vw, 16px);
  gap: var(--pai-s4);
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg-0);
  isolation: isolate;
}
#product-ai .pai-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--pai-s4);
  color: var(--fg-2);
  font: 400 var(--pai-caption)/1 var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
#product-ai .pai-no { color: var(--fg-1); }
#product-ai .pai-rule {
  width: var(--pai-s6);
  height: var(--pai-hairline);
  background: var(--line-3);
}
#product-ai .pai-eyebrow::after {
  content: '';
  flex: 1;
  height: var(--pai-hairline);
  background: var(--line-1);
}
#product-ai .pai-stage {
  position: relative;
  flex: 1;
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  background: var(--bg-0);
}
#product-ai .pai-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
  cursor: grab;
}
#product-ai .pai-copy {
  padding-top: var(--pai-s3);
  border-top: var(--pai-hairline) solid var(--line-1);
}
#product-ai .pai-title {
  margin: 0;
  color: var(--fg-0);
  font: 300 var(--pai-title)/1.45 var(--font-jp);
  letter-spacing: .015em;
  overflow-wrap: anywhere;
}
#product-ai .pai-canvas.is-dragging { cursor: grabbing; }
/* recording bar: same wording as the field recording, in the site's type */
#product-ai .pai-hud {
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px var(--pai-s4);
  padding: var(--pai-s3) var(--pai-s4);
  background: var(--bg-0);
  border-bottom: var(--pai-hairline) solid var(--line-2);
  font-family: var(--font-mono);
  letter-spacing: .04em;
  pointer-events: none;
}
#product-ai .pai-hud p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#product-ai .pai-hud__brand { color: var(--accent); font-size: clamp(13px, 1.2vw, 16px); font-weight: 500; }
#product-ai .pai-hud__rec { color: var(--fg-0); font-size: 12px; display: flex; align-items: center; gap: 8px; }
#product-ai .pai-hud__rec i { width: 7px; height: 7px; background: var(--accent); animation: pai-rec 1.2s steps(1, end) infinite; }
@keyframes pai-rec { 50% { opacity: 0; } }
#product-ai .pai-hud__perf { grid-column: 1 / -1; color: var(--fg-1); font-size: 11px; }
#product-ai .pai-hud__note { grid-column: 1 / -1; color: var(--fg-2); font-size: 11px; }
@media (prefers-reduced-motion: reduce) { #product-ai .pai-hud__rec i { animation: none; } }
#product-ai.pai--still .pai-stage { display: none; }

@media (max-width: 640px) {
  #product-ai { --pai-title: clamp(21px, 5.6vw, 28px); }
  #product-ai .pai-stage { min-height: 300px; }
  #product-ai .pai-hud { padding: var(--pai-s2) var(--pai-s3); gap: 4px var(--pai-s3); }
  #product-ai .pai-hud__perf, #product-ai .pai-hud__note { font-size: 10px; letter-spacing: 0; }
  #product-ai .pai-hud p.pai-hud__note { white-space: normal; }
}

/* Collapsed entrance: lightweight inline vector, room engine loaded on entry. */
#product-ai { min-height: 0; --pai-title: clamp(26px, 3.1vw, 46px); }
#product-ai .pai-copy { padding: 0; border: 0; max-width: 1100px; }
#product-ai .pai-title { font-weight: 400; line-height: 1.5; }
#product-ai .pai-lede { margin: var(--pai-s3) 0 0; max-width: 52em; text-wrap: pretty; color: var(--fg-1); font: 400 var(--pai-body)/1.8 var(--font-jp); }
#product-ai .pai-entry { position: relative; margin-top: var(--pai-s4); }
#product-ai .pai-diagram { display: block; width: 100%; max-height: 440px; color: var(--fg-2); }
#product-ai .pai-diagram-label { fill: var(--accent); font: 400 15px var(--font-jp); }
#product-ai .pai-enter:focus-visible, #product-ai .pai-close:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
#product-ai .pai-demo { position: absolute; inset: 0 0 auto; margin: 0; opacity: 0; }
#product-ai .pai-demo-toolbar { display: flex; justify-content: flex-end; padding-bottom: var(--pai-s3); }
#product-ai .pai-close { padding: var(--pai-s2) var(--pai-s4); border: 1px solid var(--line-3); background: transparent; color: var(--fg-1); font: 400 var(--pai-body) var(--font-jp); cursor: pointer; }
#product-ai .pai-close:hover { border-color: var(--accent); color: var(--accent); }
#product-ai .pai-stage { height: clamp(380px, 64svh, 680px); min-height: 0; }
#product-ai .pai-loading { position: absolute; inset: 50% 0 auto; margin: 0; text-align: center; color: var(--fg-2); font: 400 var(--pai-body) var(--font-jp); pointer-events: none; }
#product-ai .pai-entry-status { margin: 0; color: var(--fg-2); font: 400 var(--pai-body)/1.5 var(--font-jp); }
#product-ai .pai-entry[hidden], #product-ai .pai-demo[hidden], #product-ai .pai-loading[hidden] { display: none; }
@media (max-width: 640px) {
  #product-ai { --pai-title: clamp(23px, 5.5vw, 30px); }
  #product-ai .pai-diagram { width: 125%; max-width: none; margin-left: -12.5%; min-height: 230px; }
  #product-ai .pai-stage { height: clamp(380px, 63svh, 580px); }
}

/* Lens portal — the hand is the entry control, not a decorative second CTA.
   Chromatic effects are scoped here, explicitly requested for this interaction. */
#product-ai {
  --pai-cyan: #73eaff;
  --pai-magenta: #f09bff;
}
#product-ai .pai-portal { position: relative; min-width: 0; isolation: isolate; }
#product-ai .pai-entry { margin-top: 0; }
#product-ai .pai-lens-trigger {
  position: absolute;
  z-index: 3;
  left: var(--lens-x); top: var(--lens-y);
  width: 80px; height: 80px;
  padding: 0; border: 0; background: transparent; color: var(--accent);
  transform: translate(-50%, -50%); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#product-ai .pai-trigger-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
#product-ai .pai-hand {
  position: absolute; left: calc(50% - 5px); top: calc(50% + 3px);
  width: 18px; height: 23px; overflow: visible; pointer-events: none;
  animation: pai-hand-invite 2.8s steps(2,end) infinite;
  transform-origin: 5px 1px;
}
#product-ai .pai-hand-fill { fill: var(--fg-0); stroke: url(#pai-hand-color); stroke-width: 1; }
#product-ai .pai-pixel-prompt {
  position: absolute; left: calc(50% + 30px); top: calc(50% - 12px);
  width: 66px; height: 15px; overflow: visible;
  fill: var(--accent); pointer-events: none;
}
#product-ai .pai-lens-frame {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 26px;
  transform: translate(-50%,-50%); pointer-events: none; overflow: visible;
}
#product-ai .pai-frame-corners { fill: none; stroke: url(#pai-frame-color); stroke-width: 1.8; }
#product-ai .pai-frame-beam {
  fill: none; stroke: url(#pai-frame-color); stroke-width: 1;
  stroke-dasharray: 12 88; animation: pai-frame-orbit 3s linear infinite;
}
#product-ai .pai-enter:hover .pai-frame-corners,
#product-ai .pai-enter:focus-visible .pai-frame-corners { stroke-width: 2; }
#product-ai .pai-enter:active .pai-hand { transform: translate(-1px,-2px); }
#product-ai .pai-enter:focus-visible { outline-offset: -5px; }
#product-ai .pai-portal[data-portal-state="loading"] .pai-hand { animation: pai-hand-press .5s steps(2,end) infinite; }
#product-ai .pai-portal[data-portal-state="loading"] .pai-frame-beam { animation-duration: .6s; }
#product-ai .pai-portal[data-portal-state="open"] .pai-demo { position: relative; opacity: 1; }
#product-ai .pai-portal:not([data-portal-state="closed"]) .pai-entry { pointer-events: none; }
#product-ai .pai-iris {
  position: absolute; z-index: 5; left: var(--lens-x); top: var(--lens-y);
  width: 100px; height: 100px; opacity: 0;
  pointer-events: none; transform: translate(-50%,-50%);
}
#product-ai .pai-iris i { position: absolute; inset: 0; border: 1px solid var(--pai-cyan); border-radius: 50%; }
#product-ai .pai-iris i:nth-child(2) { inset: 8px -4px; border-color: var(--pai-magenta); transform: rotate(32deg); }
#product-ai .pai-iris i:nth-child(3) { inset: -6px 10px; border-color: var(--accent); transform: rotate(-24deg); }
#product-ai .pai-scan-sweep { animation: pai-radar-sweep 4.6s linear infinite; }
#product-ai .pai-localize { animation: pai-localize 4.6s ease-in-out infinite; }
#product-ai .pai-localize--chair { animation-delay: -1.7s; }
#product-ai .pai-entry.is-inspecting .pai-scan-sweep { animation-duration: 2.8s; }
#product-ai .pai-entry.is-inspecting .pai-localize { stroke-width: 1.6; filter: drop-shadow(0 0 2px var(--accent)); }
#product-ai .pai-probe {
  position: absolute; z-index: 2; left: 0; top: 0; width: 24px; height: 24px;
  margin: -12px 0 0 -12px; opacity: 0; pointer-events: none;
  border: 1px solid var(--accent); clip-path: polygon(0 0,30% 0,30% 10%,10% 10%,10% 30%,0 30%,0 0,100% 0,100% 30%,90% 30%,90% 10%,70% 10%,70% 0,100% 0,100% 100%,70% 100%,70% 90%,90% 90%,90% 70%,100% 70%,100% 100%,0 100%,0 70%,10% 70%,10% 90%,30% 90%,30% 100%,0 100%);
  transition: opacity .18s;
}
#product-ai .pai-entry.is-inspecting:not(.is-on-lens) .pai-probe { opacity: .9; }
#product-ai:not(.is-portal-visible) :is(.pai-hand,.pai-frame-beam,.pai-scan-sweep,.pai-localize),
#product-ai .pai-portal:not([data-portal-state="closed"]) :is(.pai-scan-sweep,.pai-localize) { animation-play-state: paused; }
@keyframes pai-hand-invite { 0%,65%,100% { transform: translate(1px,2px); } 78%,90% { transform: translate(-1px,-1px); } 84% { transform: translate(1px,1px); } }
@keyframes pai-hand-press { 50% { transform: translate(-1px,-2px); } }
@keyframes pai-frame-orbit { to { stroke-dashoffset: -100; } }
@keyframes pai-radar-sweep { 0% { rotate: -18deg; opacity: 0; } 8%,88% { opacity: 1; } 100% { rotate: 86deg; opacity: 0; } }
@keyframes pai-localize { 0%,50%,100% { opacity: .48; } 62%,80% { opacity: 1; } }
@media (max-width: 640px) {
  #product-ai .pai-lens-trigger { width: 72px; height: 72px; }
  #product-ai .pai-hand { width: 16px; height: 20px; }
  #product-ai .pai-lens-frame { width: 26px; height: 20px; }
  #product-ai .pai-pixel-prompt { width: 55px; height: 12px; left: calc(50% + 25px); }
}
@media (prefers-reduced-motion: reduce) {
  #product-ai :is(.pai-hand,.pai-frame-beam,.pai-scan-sweep,.pai-localize) { animation: none; }
  #product-ai .pai-scan-sweep, #product-ai .pai-iris, #product-ai .pai-probe { display: none; }
}

/* The lens supplies its own compact frame instead of the global large hitbox reticle. */
.rt.is-lens { opacity: 0 !important; }

/* entry: a real-looking cart, a cardboard box and a stool on a dark floor.
   The camera's view is a faint lime wedge; what falls in it gets a box and a
   distance as the scan passes. The lens is the way into the demo. */
#product-ai .pai-diagram--real { max-height: none; height: auto; aspect-ratio: 20 / 9; }
#product-ai .pai-fov-edge { fill: none; stroke-width: 2; stroke-dasharray: 2 10; stroke-linecap: round; }
#product-ai .pai-wave { transform-box: view-box; animation: pai-wave 4.4s cubic-bezier(.35,.05,.3,1) infinite; }
#product-ai .pai-det-box { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-opacity: .45; }
#product-ai .pai-det-corner { fill: none; stroke: var(--accent); stroke-width: 4; }
#product-ai .pai-det-chip { fill: var(--accent); }
#product-ai .pai-det-text { fill: #000; font: 500 22px "IBM Plex Mono", ui-monospace, monospace; dominant-baseline: central; }
#product-ai .pai-det { opacity: .2; animation: pai-lock 4.4s linear infinite; animation-delay: var(--at); animation-fill-mode: backwards; }
#product-ai .pai-callout { fill: none; stroke: var(--fg-2); stroke-width: 2; }
#product-ai .pai-cam-label { fill: var(--fg-1); font: 400 30px var(--font-jp); letter-spacing: .08em; }
@keyframes pai-wave { from { transform: translateX(0); } to { transform: translateX(var(--reach)); } }
@keyframes pai-lock { 0% { opacity: .2; } 3% { opacity: 1; } 78% { opacity: 1; } 96%, 100% { opacity: .2; } }
#product-ai:not(.is-portal-visible) :is(.pai-wave,.pai-det),
#product-ai .pai-portal:not([data-portal-state="closed"]) :is(.pai-wave,.pai-det) { animation-play-state: paused; }
/* The prompt stands straight above the hand in the lens colours, lifted just clear
   of the pale cargo box; the lift follows the picture's width. */
#product-ai .pai-entry { container-type: inline-size; }
#product-ai .pai-diagram--real ~ .pai-enter .pai-pixel-prompt {
  width: 149px; height: 14.4px; left: calc(50% - 71px); top: calc(50% - 6.5cqw - 22px);
  fill: url(#pai-prompt-color);
}
@media (max-width: 768px) {
  #product-ai .pai-diagram--real ~ .pai-enter .pai-pixel-prompt { width: 124px; height: 12px; left: calc(50% - 59px); top: calc(50% - 10.7cqw - 19px); }
}
@media (max-width: 768px) {
  #product-ai .pai-diagram.pai-diagram--real { width: 165%; margin-left: -4%; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #product-ai .pai-wave { display: none; }
  #product-ai .pai-det { animation: none; opacity: 1; }
}
