{"html":"<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin><link href=\"https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500&family=JetBrains+Mono:wght@400;500&family=Source+Sans+3:wght@400;600;700&display=swap\" rel=\"stylesheet\">\n<style>\n#eih-root{position:relative;height:var(--eih-len,650vh);background:#050403;color:#e9e2da;font-family:Sora,system-ui,sans-serif;-webkit-font-smoothing:antialiased}\n#eih-stage{position:sticky;top:0;height:100vh;height:100svh;width:100%;overflow:hidden;background:#050403;will-change:opacity}\n#eih-bg{position:absolute;inset:-20%;transform:translateX(calc(var(--p,0) * -12vw))}\n#eih-root .blob{position:absolute;border-radius:50%;filter:blur(110px);mix-blend-mode:screen}\n#eih-root .b1{width:60vmax;height:60vmax;left:5%;top:25%;background:radial-gradient(circle,rgba(150,64,14,.55),transparent 65%);animation:eihd1 28s ease-in-out infinite alternate}\n#eih-root .b2{width:48vmax;height:48vmax;left:55%;top:10%;background:radial-gradient(circle,rgba(110,46,12,.45),transparent 65%);animation:eihd2 34s ease-in-out infinite alternate}\n#eih-root .b3{width:42vmax;height:42vmax;left:35%;top:55%;background:radial-gradient(circle,rgba(70,40,26,.5),transparent 65%);animation:eihd3 24s ease-in-out infinite alternate}\n@keyframes eihd1{to{transform:translate(18vw,-10vh) scale(1.15)}}\n@keyframes eihd2{to{transform:translate(-20vw,14vh) scale(.9)}}\n@keyframes eihd3{to{transform:translate(12vw,-16vh) scale(1.2)}}\n#eih-vig{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 50%,transparent 35%,rgba(3,2,2,.85) 100%);pointer-events:none}\n#eih-gl{position:absolute;inset:0;width:100%;height:100%;display:block}\n#eih-ui{position:absolute;inset:0;pointer-events:none}\n#eih-root .card{position:absolute;left:0;top:0;transform-origin:0 50%;width:212px;box-sizing:border-box;padding:10px 13px 11px;border-radius:10px;background:linear-gradient(180deg,rgba(44,28,17,.66),rgba(18,12,8,.6));border:1px solid rgba(255,190,140,.26);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);box-shadow:0 0 34px rgba(255,130,40,.07),inset 0 1px 0 rgba(255,220,190,.07);opacity:0;visibility:hidden;will-change:transform,opacity}\n#eih-root .card::before{content:\"\";position:absolute;right:100%;top:50%;width:18px;height:1px;background:rgba(255,190,140,.45)}\n#eih-root .card .k{display:flex;justify-content:space-between;font:500 9px/1 \"JetBrains Mono\",monospace;letter-spacing:.14em;color:#8c7b6d;margin-bottom:7px}\n#eih-root .card .t{font:500 14px/1.2 Sora,sans-serif;color:#ffb46e;text-shadow:0 0 14px rgba(255,140,50,.55)}\n#eih-root .card .d{font:300 11.5px/1.45 Sora,sans-serif;color:#b9ab9e;margin-top:4px;text-wrap:pretty}\n#eih-root .card.compact .k,#eih-root .card.compact .d{display:none}\n#eih-root .lab{position:absolute;left:0;top:0;font:500 10px/1 \"JetBrains Mono\",monospace;letter-spacing:.16em;text-transform:uppercase;color:#cf9f74;white-space:nowrap;opacity:0;visibility:hidden}\n#eih-rail{position:absolute;left:32px;bottom:30px;display:flex;gap:26px;font:500 10.5px/1 \"JetBrains Mono\",monospace;letter-spacing:.16em;text-transform:uppercase}\n#eih-rail .st{color:#5f554e;display:flex;gap:8px;transition:color .4s}\n#eih-rail .st span{color:#3f3732;transition:color .4s}\n#eih-rail .st.on{color:#ffb46e}#eih-rail .st.on span{color:#a86a3c}\n#eih-bar{position:absolute;left:32px;bottom:20px;width:min(420px,calc(100% - 64px));height:1px;background:rgba(255,200,160,.1)}\n#eih-bar i{position:absolute;left:0;top:0;bottom:0;width:0;background:#ff9a46;box-shadow:0 0 8px #ff8a2b}\n#eih-hint{position:absolute;right:32px;bottom:24px;display:flex;align-items:center;gap:12px;font:500 10.5px/1 \"JetBrains Mono\",monospace;letter-spacing:.16em;text-transform:uppercase;color:#8c7b6d;transition:opacity .5s}\n#eih-hint b{display:block;width:1px;height:34px;background:linear-gradient(#ff9a46,transparent);animation:eihh 1.8s ease-in-out infinite;transform-origin:top}\n@keyframes eihh{0%{transform:scaleY(0)}50%{transform:scaleY(1)}100%{transform:scaleY(1);opacity:0}}\n@media (max-width:640px){#eih-rail{gap:14px;font-size:9px;left:18px}#eih-bar{left:18px}#eih-hint{display:none}}\n#eih-root .card,#eih-root .lab{box-sizing:border-box}\n@media (prefers-reduced-motion:reduce){#eih-root .blob{animation:none}}\n#eih-root{--eih-len:1100vh}\n#eih-rail,#eih-bar{display:none!important}\n#eih-bg{opacity:0}\n#eih-orb{position:absolute;left:0;top:0;width:260px;height:260px;margin:-130px 0 0 -130px;border-radius:50%;pointer-events:none;opacity:0;\nbackground:radial-gradient(circle,rgba(255,226,190,.95) 0,rgba(255,170,90,.75) 9%,rgba(255,138,43,.38) 24%,rgba(255,110,30,.12) 45%,transparent 68%);mix-blend-mode:screen;will-change:transform,opacity}\n#eih-head{position:absolute;left:clamp(20px,4.5vw,64px);top:0;margin:0;max-width:min(1000px,90vw);transform-origin:0 0;\nfont:500 clamp(44px,6.7vw,96px)/.98 \"At Magmae TRIAL\",\"At Magmae\",Inter,system-ui,sans-serif;letter-spacing:-.02em;text-transform:uppercase;color:#f5f5f2;pointer-events:none;will-change:transform,opacity}\n#eih-head .w{display:inline-block;opacity:0;transform:translateY(14px);will-change:transform,opacity}\n#eih-head .w.en{position:relative;z-index:1}\n.eih-copy{position:absolute;left:clamp(20px,4.5vw,64px);bottom:clamp(40px,11vh,110px);width:min(560px,calc(100% - 40px));opacity:0;visibility:hidden;font-family:\"Source Sans 3\",system-ui,sans-serif;color:#f5f5f2;will-change:opacity,transform}\n.eih-copy .eb{font:600 12px/1 \"Source Sans 3\",sans-serif;letter-spacing:.12em;text-transform:uppercase;color:#ff8a2b;margin:0 0 16px}\n.eih-copy h2{margin:0 0 16px;font:500 clamp(40px,6.7vw,96px)/.98 \"At Magmae TRIAL\",\"At Magmae\",Inter,system-ui,sans-serif;letter-spacing:-.02em;text-transform:uppercase;color:#f5f5f2;white-space:nowrap}\n.eih-copy p{margin:0 0 28px;font:400 19px/1.55 \"Source Sans 3\",sans-serif;color:#f5f5f2;text-shadow:0 1px 18px rgba(5,4,3,.9)}\n.eih-copy a{display:inline-block;padding:16px 32px;border-radius:999px;background:#ff8a2b;color:#0b0b0c;font:700 16px/1 \"Source Sans 3\",sans-serif;text-decoration:none;pointer-events:auto;transition:background .2s}\n.eih-copy a:hover{background:#ffa057}.eih-copy a:active{background:#d9701f}\n#eih-scrim{position:absolute;left:0;bottom:0;width:70%;height:65%;pointer-events:none;opacity:0;background:radial-gradient(ellipse at 0 100%,rgba(5,4,3,.88) 0,rgba(5,4,3,.55) 40%,transparent 72%)}\n#eih-fade{position:absolute;inset:0;background:#050403;opacity:0;pointer-events:none}\n@media (max-width:640px){.eih-copy{bottom:36px}.eih-copy p{font-size:17px}.eih-copy h2{font-size:clamp(30px,10vw,44px)}#eih-scrim{width:100%;height:75%}}\n</style>\n<div id=\"eih-root\" aria-label=\"Energy to intelligence: Olenox energy, power, infrastructure, intelligence and automation\">\n<div id=\"eih-stage\">\n<div id=\"eih-bg\"><div class=\"blob b1\"></div><div class=\"blob b2\"></div><div class=\"blob b3\"></div></div>\n<canvas id=\"eih-gl\"></canvas>\n<div id=\"eih-vig\"></div>\n<div id=\"eih-ui\"></div>\n<div id=\"eih-rail\">\n<div class=\"st on\"><span>01</span>Energy</div>\n<div class=\"st\"><span>02</span>Power</div>\n<div class=\"st\"><span>03</span>Infrastructure</div>\n<div class=\"st\"><span>04</span>Intelligence</div>\n<div class=\"st\"><span>05</span>Automation</div>\n</div>\n<div id=\"eih-bar\"><i></i></div>\n<div id=\"eih-hint\"><b></b>Scroll</div>\n<div id=\"eih-orb\"></div>\n<div id=\"eih-scrim\"></div>\n<h1 id=\"eih-head\" aria-label=\"Connecting energy to new possibilities\"><span class=\"w\">Connecting</span> <span class=\"w en\">energy</span> <span class=\"w\">to new</span> <span class=\"w\">possibilities</span></h1>\n<div class=\"eih-copy\" data-k=\"energy\"><div class=\"eb\">01 / 03 · Energy</div><h2>Energy</h2><p>Oil and natural gas production, field services and proprietary production-enhancement technology, now with gas processing and power generation assets.</p><a href=\"/energy\">Explore Energy</a></div>\n<div class=\"eih-copy\" data-k=\"infra\"><div class=\"eb\">02 / 03 · Infrastructure</div><h2>Infrastructure</h2><p>An operating Bitcoin mining fleet, modular container-based structures and industrial connectivity that link energy to real-world applications.</p><a href=\"/infrastructure\">Explore Infrastructure</a></div>\n<div class=\"eih-copy\" data-k=\"intel\"><div class=\"eb\">03 / 03 · Intelligence</div><h2>Intelligence</h2><p>Field monitoring operating today, with applied-intelligence systems in development to drive automation across the portfolio.</p><a href=\"/intelligence\">Explore Intelligence</a></div>\n<div id=\"eih-fade\"></div>\n</div>\n</div>\n<script type=\"module\">\nimport * as THREE from 'https://unpkg.com/three@0.184.0/build/three.module.js';\nconst ROOT=document.getElementById('eih-root'),STAGE=document.getElementById('eih-stage');\n// ---------- utils ----------\nfunction mulberry32(a){return function(){a|=0;a=a+0x6D2B79F5|0;let t=Math.imul(a^a>>>15,1|a);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296}}\nconst rnd=mulberry32(11);\nconst R=(a,b)=>a+(b-a)*rnd();\nconst clamp=(x,a=0,b=1)=>Math.min(b,Math.max(a,x));\nconst seg=(p,a,b)=>clamp((p-a)/(b-a));\nconst ease=t=>t*t*(3-2*t);\nconst lerp=(a,b,t)=>a+(b-a)*t;\nconst V=(x,y,z)=>new THREE.Vector3(x,y,z);\nconst COL={amber:new THREE.Color('#ff8a2b'),hot:new THREE.Color('#ffd9a8'),steel:new THREE.Color('#7e838c'),loop:new THREE.Color('#ffb36b')};\nfunction roundedPath(raw,r){\nconst pts=[];for(const p of raw){if(!pts.length||pts[pts.length-1].distanceTo(p)>1e-4)pts.push(p.clone());}\nconst path=new THREE.CurvePath();\nif(pts.length<2){path.add(new THREE.LineCurve3(pts[0],pts[0].clone().add(V(1e-3,0,0))));return path;}\nlet cur=pts[0].clone();\nfor(let i=1;i<pts.length-1;i++){\nconst a=pts[i-1],b=pts[i],c=pts[i+1];\nconst d1=b.clone().sub(a),d2=c.clone().sub(b);\nconst rr=Math.min(r,d1.length()/2,d2.length()/2);\nconst p1=b.clone().sub(d1.normalize().multiplyScalar(rr));\nconst p2=b.clone().add(d2.normalize().multiplyScalar(rr));\nif(cur.distanceTo(p1)>1e-4)path.add(new THREE.LineCurve3(cur,p1));\npath.add(new THREE.QuadraticBezierCurve3(p1,b.clone(),p2));cur=p2;\n}\npath.add(new THREE.LineCurve3(cur,pts[pts.length-1]));\nreturn path;\n}\n// ---------- shaders ----------\nconst timed=[];\nconst OVER={blending:THREE.CustomBlending,blendEquation:THREE.AddEquation,blendSrc:THREE.OneFactor,blendDst:THREE.OneMinusSrcAlphaFactor,blendSrcAlpha:THREE.OneFactor,blendDstAlpha:THREE.OneMinusSrcAlphaFactor};\nconst ADD={blending:THREE.CustomBlending,blendEquation:THREE.AddEquation,blendSrc:THREE.OneFactor,blendDst:THREE.OneFactor,blendSrcAlpha:THREE.OneFactor,blendDstAlpha:THREE.OneFactor};\nconst LINE_VS=`attribute float aU;attribute float aAlpha;attribute float aSeed;varying float vU;varying float vA;varying float vS;varying float vD;\nvoid main(){vU=aU;vA=aAlpha;vS=aSeed;vec4 mv=modelViewMatrix*vec4(position,1.);vD=-mv.z;gl_Position=projectionMatrix*mv;}`;\nconst LINE_FS=`uniform vec3 uColor;uniform vec3 uHot;uniform float uTime,uOpacity,uReveal,uPulse,uSpeed,uDensity,uSharp,uGate,uFar,uTip,uStart;\nvarying float vU;varying float vA;varying float vS;varying float vD;\nfloat h(float n){return fract(sin(n*127.1+vS*3.1)*43758.5453);}\nvoid main(){if(vU>uReveal+1e-4)discard;\nfloat x=vU*uDensity-uTime*uSpeed+vS;float ph=fract(x);float p=pow(ph,uSharp)*step(uGate,h(floor(x)));\nfloat tip=(1.-step(.999,uReveal))*(1.-smoothstep(0.,uTip,uReveal-vU));\nfloat k=clamp(p*uPulse+tip,0.,1.);\nfloat a=uOpacity*vA*(1.+p*uPulse*2.5+tip*3.)*smoothstep(0.,uStart,vU);\na*=1.-smoothstep(uFar*.55,uFar,vD);\nvec3 c=mix(uColor,uHot,k)*a;gl_FragColor=vec4(c,clamp(max(c.r,max(c.g,c.b)),0.,1.));}`;\nfunction lineMat(o={}){\nconst m=new THREE.ShaderMaterial({vertexShader:LINE_VS,fragmentShader:LINE_FS,transparent:true,depthWrite:false,...(o.over?OVER:ADD),\nuniforms:{uColor:{value:(o.color||COL.amber).clone()},uHot:{value:(o.hot||COL.hot).clone()},uTime:{value:0},uOpacity:{value:o.opacity??1},uReveal:{value:1},\nuPulse:{value:o.pulse??0},uSpeed:{value:o.speed??.4},uDensity:{value:o.density??1},uSharp:{value:o.sharp??14},uGate:{value:o.gate??0},uFar:{value:o.far??140},uTip:{value:o.tip??.02},uStart:{value:o.start??1e-4}}});\ntimed.push(m);return m;\n}\nconst TUBE_VS=`varying vec2 vUv;varying vec3 vN;varying vec3 vV;void main(){vUv=uv;vec4 mv=modelViewMatrix*vec4(position,1.);vN=normalize(normalMatrix*normal);vV=normalize(-mv.xyz);gl_Position=projectionMatrix*mv;}`;\nconst TUBE_FS=`uniform vec3 uColor,uHot;uniform float uTime,uOpacity,uReveal,uPulse,uSpeed,uDensity,uRim,uCore,uSeed,uTip,uStart,uSharp;\nvarying vec2 vUv;varying vec3 vN;varying vec3 vV;\nvoid main(){if(vUv.x>uReveal)discard;\nfloat r=1.-abs(dot(normalize(vN),normalize(vV)));r=r*r;\nfloat ph=fract(vUv.x*uDensity-uTime*uSpeed+uSeed);float p=pow(ph,uSharp);\nfloat tip=(1.-step(.999,uReveal))*(1.-smoothstep(0.,uTip,uReveal-vUv.x));\nfloat a=uOpacity*(r*uRim+uCore+p*uPulse+tip*1.6)*smoothstep(0.,uStart,vUv.x);\nvec3 c=mix(uColor,uHot,clamp(p*uPulse+tip,0.,1.))*a;gl_FragColor=vec4(c,clamp(max(c.r,max(c.g,c.b)),0.,1.));}`;\nfunction tubeMat(o={}){\nconst m=new THREE.ShaderMaterial({vertexShader:TUBE_VS,fragmentShader:TUBE_FS,transparent:true,depthWrite:false,side:THREE.DoubleSide,...(o.over?OVER:ADD),\nuniforms:{uColor:{value:(o.color||COL.amber).clone()},uHot:{value:COL.hot.clone()},uTime:{value:0},uOpacity:{value:o.opacity??1},uReveal:{value:1},uPulse:{value:o.pulse??0},\nuSpeed:{value:o.speed??.4},uDensity:{value:o.density??1},uRim:{value:o.rim??1},uCore:{value:o.core??0},uSeed:{value:o.seed??0},uTip:{value:o.tip??.03},uStart:{value:o.start??1e-4},uSharp:{value:o.sharp??10}}});\ntimed.push(m);return m;\n}\nconst PT_VS=`attribute float aSize;attribute float aAlpha;attribute float aSeed;attribute float aShape;uniform float uTime,uScale,uFire;varying float vA;varying float vF;varying float vSh;\nvoid main(){vec4 mv=modelViewMatrix*vec4(position,1.);float f=pow(max(0.,sin(uTime*(.9+aSeed*1.6)+aSeed*40.)),28.)*uFire;vF=f;vA=aAlpha;vSh=aShape;\ngl_PointSize=aSize*(1.+f*.45)*uScale/max(.1,-mv.z);gl_Position=projectionMatrix*mv;}`;\nconst ADD_={blending:THREE.CustomBlending,blendEquation:THREE.AddEquation,blendSrc:THREE.OneFactor,blendDst:THREE.OneFactor,blendSrcAlpha:THREE.OneFactor,blendDstAlpha:THREE.OneFactor};\nconst PT_FS=`uniform vec3 uColor,uHot;varying float vA;varying float vF;varying float vSh;\nvoid main(){vec2 p=gl_PointCoord*2.-1.;float dc=length(p);vec2 q=abs(p);float d=mix(dc,max(q.x,q.y),vSh);\nfloat core=1.-smoothstep(.15,.23,d);\nfloat ring=(1.-smoothstep(0.,.045,abs(d-.36)))*vSh;\nfloat glow=exp(-dc*dc*5.)*.5*(1.-vSh*.45);\nfloat a=(core*(1.-vSh*.55)+ring+glow)*vA*(1.+vF*2.6);\nif(a<.003)discard;\nvec3 c=mix(uColor,uHot,clamp(core*.7+vF,0.,1.))*a;gl_FragColor=vec4(c,clamp(max(c.r,max(c.g,c.b)),0.,1.));}`;\nfunction ptMat(){const m=new THREE.ShaderMaterial({vertexShader:PT_VS,fragmentShader:PT_FS,transparent:true,depthWrite:false,...ADD,\nuniforms:{uColor:{value:COL.amber.clone()},uHot:{value:COL.hot.clone()},uTime:{value:0},uScale:{value:1000},uFire:{value:1}}});timed.push(m);return m;}\nclass LB{constructor(){this.P=[];this.U=[];this.A=[];this.S=[];}\nseg(a,b,ua,ub=ua,al=1,s=0){this.P.push(a.x,a.y,a.z,b.x,b.y,b.z);this.U.push(ua,ub);this.A.push(al,al);this.S.push(s,s);}\nring(c,n,b,r,u,al,segs=28){let prev=null;for(let i=0;i<=segs;i++){const t=i/segs*Math.PI*2;const p=c.clone().addScaledVector(n,Math.cos(t)*r).addScaledVector(b,Math.sin(t)*r);if(prev)this.seg(prev,p,u,u,al);prev=p;}}\nbox(mn,mx,uf,al){const c=[];for(let i=0;i<8;i++)c.push(V(i&1?mx.x:mn.x,i&2?mx.y:mn.y,i&4?mx.z:mn.z));\nfor(const [i,j] of [[0,1],[2,3],[4,5],[6,7],[0,2],[1,3],[4,6],[5,7],[0,4],[1,5],[2,6],[3,7]])this.seg(c[i],c[j],uf(c[i]),uf(c[j]),al);}\nmesh(mat,name){const g=new THREE.BufferGeometry();g.setAttribute('position',new THREE.Float32BufferAttribute(this.P,3));\ng.setAttribute('aU',new THREE.Float32BufferAttribute(this.U,1));g.setAttribute('aAlpha',new THREE.Float32BufferAttribute(this.A,1));g.setAttribute('aSeed',new THREE.Float32BufferAttribute(this.S,1));\nconst m=new THREE.LineSegments(g,mat);m.name=name;m.frustumCulled=false;return m;}}\n// ---------- renderer ----------\nconst canvas=document.getElementById('eih-gl');\nconst renderer=new THREE.WebGLRenderer({canvas,antialias:true,alpha:true});\nrenderer.setPixelRatio(Math.min(devicePixelRatio,2));renderer.setClearColor(0x000000,0);\nconst scene=new THREE.Scene();scene.fog=new THREE.Fog(0x050403,16,72);\nconst camera=new THREE.PerspectiveCamera(38,1,.05,300);\nconst world=new THREE.Group();world.name='energy-intelligence';scene.add(world);\n// ---------- ground grid ----------\n{const P=[];const y=-.6;for(let x=-32;x<=32;x+=1)P.push(x,y,-12,x,y,12);for(let z=-12;z<=12;z+=1)P.push(-32,y,z,32,y,z);\nconst g=new THREE.BufferGeometry();g.setAttribute('position',new THREE.Float32BufferAttribute(P,3));\nvar gridMat=new THREE.LineBasicMaterial({color:0x4a3626,transparent:true,opacity:0,depthWrite:false});\nconst grid=new THREE.LineSegments(g,gridMat);grid.name='grid';world.add(grid);}\n// ---------- pipeline ----------\nconst WX=-16;\nconst pipeCurve=roundedPath([V(WX,-4.6,0),V(WX,1.6,0),V(-12,1.6,0),V(-12,.5,0),V(-9.3,.5,0)],1.1);\nconst PL=pipeCurve.getLength();\nconst pipeShellMat=tubeMat({opacity:.5,rim:1.1,core:.035,pulse:.22,density:PL/2.6,speed:.5,start:.04,tip:.02});\nconst pipeCoreMat=tubeMat({opacity:1,rim:.35,core:.22,pulse:2.2,density:PL/2.6,speed:.5,start:.04,tip:.02,sharp:14});\nconst shell=new THREE.Mesh(new THREE.TubeGeometry(pipeCurve,600,.32,32,false),pipeShellMat);shell.name='pipe_shell';\nconst core=new THREE.Mesh(new THREE.TubeGeometry(pipeCurve,600,.09,12,false),pipeCoreMat);core.name='pipe_core';\nworld.add(shell,core);\nconst NP=700,pp=[],fr=pipeCurve.computeFrenetFrames(NP,false);\nfor(let i=0;i<=NP;i++)pp.push(pipeCurve.getPointAt(i/NP));\nconst pipeLB=new LB(),steelLB=new LB();\nfor(let k=0;k<8;k++){const th=k/8*Math.PI*2+Math.PI/8,c=Math.cos(th),s=Math.sin(th);let prev=null;\nfor(let i=0;i<=NP;i++){const p=pp[i].clone().addScaledVector(fr.normals[i],c*.335).addScaledVector(fr.binormals[i],s*.335);if(prev)pipeLB.seg(prev,p,(i-1)/NP,i/NP,.4);prev=p;}}\nconst iAt=u=>Math.round(clamp(u)*NP);\nfor(let d=.25;d<PL;d+=.5){const u=d/PL,i=iAt(u);pipeLB.ring(pp[i],fr.normals[i],fr.binormals[i],.335,u,.5);}\nfor(let d=1.6;d<PL-.6;d+=3.2){const u=d/PL,i=iAt(u),t=fr.tangents[i];\nfor(const o of [-.07,.07])pipeLB.ring(pp[i].clone().addScaledVector(t,o),fr.normals[i],fr.binormals[i],.43,u,1.1,32);\nfor(let b=0;b<8;b++){const th=b/8*Math.PI*2,off=fr.normals[i].clone().multiplyScalar(Math.cos(th)*.4).addScaledVector(fr.binormals[i],Math.sin(th)*.4);\npipeLB.seg(pp[i].clone().add(off).addScaledVector(t,-.07),pp[i].clone().add(off).addScaledVector(t,.07),u,u,1);}}\nfor(let d=2.2;d<PL-1.2;d+=2.8){const u=d/PL,i=iAt(u);if(Math.abs(fr.tangents[i].y)>.02)continue;const p=pp[i],yb=p.y-.33;\nfor(const z of [-1,1]){steelLB.seg(V(p.x,yb,z*.22),V(p.x,-.6,z*.42),u,u,.9);steelLB.seg(V(p.x-.15,-.6,z*.42),V(p.x+.15,-.6,z*.42),u,u,.9);}\nsteelLB.seg(V(p.x,yb,-.3),V(p.x,yb,.3),u,u,.9);\nif(yb>.3)steelLB.seg(V(p.x,lerp(yb,-.6,.5),-.32),V(p.x,lerp(yb,-.6,.5),.32),u,u,.6);}\nfunction uNear(x,y){let bi=0,bd=1e9;pp.forEach((p,i)=>{const d=Math.hypot(p.x-x,p.y-y);if(d<bd){bd=d;bi=i;}});return bi;}\nfunction valve(x,y){const i=uNear(x,y),u=i/NP,c=pp[i],X=V(1,0,0),Z=V(0,0,1);\npipeLB.box(V(c.x-.3,c.y-.43,-.43),V(c.x+.3,c.y+.43,.43),()=>u,.8);\npipeLB.seg(V(c.x,c.y+.43,0),V(c.x,c.y+1.05,0),u,u,1);\npipeLB.ring(V(c.x,c.y+1.05,0),X,Z,.34,u,1.2,32);pipeLB.ring(V(c.x,c.y+1.05,0),X,Z,.3,u,.6,32);\nfor(let k=0;k<4;k++){const t=k/4*Math.PI*2;pipeLB.seg(V(c.x,c.y+1.05,0),V(c.x+Math.cos(t)*.32,c.y+1.05,Math.sin(t)*.32),u,u,.8);}}\nvalve(-14,1.6);valve(-10.6,.5);\npipeLB.ring(V(-9.38,.5,0),V(0,1,0),V(0,0,1),.46,1,1.4,36);\n{const wu=uNear(WX,-.6)/NP,X=V(1,0,0),Z=V(0,0,1),Y=V(0,1,0);\nsteelLB.box(V(WX-.7,-.6,-.7),V(WX+.7,-.42,.7),()=>wu*.6,1);\nfor(const y of [-.3,.05,.4])pipeLB.ring(V(WX,y,0),X,Z,.46,uNear(WX,y)/NP,1.2,32);\nconst vu=uNear(WX,.22)/NP;pipeLB.seg(V(WX-.34,.22,0),V(WX-1.05,.22,0),vu,vu,1);\npipeLB.ring(V(WX-1.05,.22,0),Y,Z,.32,vu,1.2,32);pipeLB.ring(V(WX-1.05,.22,0),Y,Z,.27,vu,.6,32);\nfor(let k=0;k<4;k++){const t=k/4*Math.PI*2;pipeLB.seg(V(WX-1.05,.22,0),V(WX-1.05,.22+Math.cos(t)*.3,Math.sin(t)*.3),vu,vu,.8);}}\nconst pipeLineMat=lineMat({opacity:.55,start:.04,tip:.02});\nconst resLB=new LB();\nfor(const [y,rs,al] of [[-.59,[.8,1.3,1.9,2.6],1],[-4.7,[1.4,2.4,3.4],.7],[-5.1,[2,3.2],.45]])rs.forEach((rr,i)=>resLB.ring(V(WX,y,0),V(1,0,0),V(0,0,1),rr,i/rs.length,al*(1-i*.18),64));\nfor(let k=0;k<10;k++){const t=k/10*Math.PI*2,rr=R(.6,2.6);resLB.seg(V(WX+Math.cos(t)*rr,-4.7,Math.sin(t)*rr),V(WX+Math.cos(t)*rr*.3,-4.4,Math.sin(t)*rr*.3),0,0,.5);}\nconst resMat=lineMat({opacity:0,pulse:1.2,speed:.35,density:1,sharp:6});\nworld.add(resLB.mesh(resMat,'reservoir'));\nconst pipeSteelMat=lineMat({color:COL.steel,hot:COL.steel,opacity:.5,start:1e-4});\nworld.add(pipeLB.mesh(pipeLineMat,'pipe_wire'),steelLB.mesh(pipeSteelMat,'pipe_supports'));\n// context tanks (x-ray refinery)\nconst tankLB=new LB();\nfunction tank(x,z,r,h){const y0=-.6,X=V(1,0,0),Z=V(0,0,1);\nfor(let y=0;y<=h;y+=.35)tankLB.ring(V(x,y0+y,z),X,Z,r,y/h,y%1.4<.35?.9:.45,40);\nfor(let k=0;k<20;k++){const t=k/20*Math.PI*2;tankLB.seg(V(x+Math.cos(t)*r,y0,z+Math.sin(t)*r),V(x+Math.cos(t)*r,y0+h,z+Math.sin(t)*r),0,1,.4);}\nfor(let k=1;k<=4;k++){const a=k/5*Math.PI/2;tankLB.ring(V(x,y0+h+Math.sin(a)*r*.45,z),X,Z,Math.cos(a)*r,1,.5,40);}}\ntank(-14.2,-3.4,1.3,4.2);tank(-10.8,-3.9,.9,5.6);tank(-17.4,-4.8,1.7,3.2);tank(-12.6,-5.6,1.1,3.6);\nconst tankMat=lineMat({color:COL.steel,hot:COL.steel,opacity:.32});\nworld.add(tankLB.mesh(tankMat,'tanks'));\n// ---------- power generation (turbine + generator) ----------\nconst PX0=-9.8,PX1=-4.2,pu=p=>clamp((p.x-PX0)/(PX1-PX0));\nconst plantLB=new LB(),plantSteelLB=new LB(),rotorLB=new LB();\n{const X=V(1,0,0),Y=V(0,1,0),Z=V(0,0,1),cy=.5,ux=x=>pu(V(x,0,0));\nplantSteelLB.box(V(-9.7,-.6,-1.3),V(-4.3,-.42,1.3),pu,.9);\nconst N=9,xs=[],rs=[];for(let i=0;i<=N;i++){xs.push(lerp(-9.25,-6.5,i/N));rs.push(lerp(.5,.85,i/N));}\nxs.forEach((x,i)=>plantLB.ring(V(x,cy,0),Y,Z,rs[i],ux(x),i%3===0?1.1:.5,36));\nfor(const [x,r] of [[-9.25,.58],[-6.5,.93]])plantLB.ring(V(x,cy,0),Y,Z,r,ux(x),1.2,36);\nfor(let k=0;k<12;k++){const t=k/12*Math.PI*2,c=Math.cos(t),s=Math.sin(t);for(let i=0;i<N;i++)plantLB.seg(V(xs[i],cy+c*rs[i],s*rs[i]),V(xs[i+1],cy+c*rs[i+1],s*rs[i+1]),ux(xs[i]),ux(xs[i+1]),.4);}\nfor(const x of [-8.7,-7.1]){const r=lerp(.5,.85,(x+9.25)/2.75);for(const z of [-1,1])plantSteelLB.seg(V(x,cy-r*.7,z*r*.7),V(x,-.42,z*(r*.7+.15)),ux(x),ux(x),.9);}\nplantLB.ring(V(-6.35,cy,0),Y,Z,.22,ux(-6.35),1,20);\nfor(let k=0;k<6;k++){const t=k/6*Math.PI*2;plantLB.seg(V(-6.5,cy+Math.cos(t)*.22,Math.sin(t)*.22),V(-6.2,cy+Math.cos(t)*.22,Math.sin(t)*.22),ux(-6.5),ux(-6.2),.6);}\nconst g0=V(-6.2,-.42,-.78),g1=V(-4.55,1.4,.78);plantLB.box(g0,g1,pu,1);plantLB.box(V(g0.x+.05,g0.y,g0.z+.05),V(g1.x-.05,g1.y,g1.z-.05),pu,.35);\nfor(let x=g0.x+.14;x<g1.x-.08;x+=.13)for(const z of [g0.z-.002,g1.z+.002])plantLB.seg(V(x,g0.y+.18,z),V(x,g1.y-.18,z),ux(x),ux(x),.4);\nplantLB.box(V(-5.7,1.4,-.38),V(-5.05,1.68,.38),pu,.8);\nfor(const z of [-.22,0,.22]){plantLB.seg(V(-5.37,1.68,z),V(-5.37,2.05,z),ux(-5.37),ux(-5.37),1);for(const y of [1.78,1.88,1.98])plantLB.ring(V(-5.37,y,z),X,Z,.06,ux(-5.37),.8,12);}\nconst sx=-8.1,sz=-1.05,sr=.38,sh=3.6;\nfor(let i=0;i<=12;i++){const y=i*.3;plantSteelLB.ring(V(sx,-.42+y,sz),X,Z,i===12?sr+.06:sr,ux(sx),i%4===0?.9:.45,28);}\nfor(let k=0;k<10;k++){const t=k/10*Math.PI*2;plantSteelLB.seg(V(sx+Math.cos(t)*sr,-.42,sz+Math.sin(t)*sr),V(sx+Math.cos(t)*sr,-.42+sh,sz+Math.sin(t)*sr),ux(sx),ux(sx),.4);}\nfor(let st=0;st<5;st++){const x=lerp(-9.05,-6.75,st/4),r=lerp(.36,.68,st/4),u=ux(x);\nfor(let b=0;b<14;b++){const t=b/14*Math.PI*2,t2=t+.2;rotorLB.seg(V(x-.06,Math.cos(t)*.12,Math.sin(t)*.12),V(x+.06,Math.cos(t2)*r,Math.sin(t2)*r),u,u,.7);}}\nrotorLB.seg(V(-9.2,0,0),V(-6.2,0,0),ux(-9.2),ux(-6.2),1);}\nconst plantMat=lineMat({opacity:.55,tip:.04}),plantSteelMat=lineMat({color:COL.steel,hot:COL.steel,opacity:.5}),rotorMat=lineMat({opacity:.6,pulse:.8,speed:.6,density:1,sharp:6});\nworld.add(plantLB.mesh(plantMat,'plant_turbine'),plantSteelLB.mesh(plantSteelMat,'plant_structure'));\nconst rotor=rotorLB.mesh(rotorMat,'turbine_rotor');rotor.position.y=.5;world.add(rotor);\n// power cable generator → racks\nconst cableCurve=roundedPath([V(-4.55,.5,0),V(-3.4,.5,0),V(-3.4,0,0),V(-1.65,0,0)],.3),CL=cableCurve.getLength();\nconst cableShellMat=tubeMat({opacity:.5,rim:1.1,core:.04,pulse:.3,density:CL/1.2,speed:.7,tip:.05});\nconst cableCoreMat=tubeMat({opacity:1,rim:.35,core:.22,pulse:2.2,density:CL/1.2,speed:.7,tip:.05,sharp:14});\n{const a=new THREE.Mesh(new THREE.TubeGeometry(cableCurve,120,.2,24,false),cableShellMat);a.name='power_cable_shell';\nconst b=new THREE.Mesh(new THREE.TubeGeometry(cableCurve,120,.06,10,false),cableCoreMat);b.name='power_cable_core';world.add(a,b);}\nconst cableLB=new LB();cableLB.ring(V(-4.5,.5,0),V(0,1,0),V(0,0,1),.3,0,1.3,32);cableLB.ring(V(-1.93,0,0),V(0,1,0),V(0,0,1),.46,1,1.4,36);\nconst cableLineMat=lineMat({opacity:.55,tip:.04});world.add(cableLB.mesh(cableLineMat,'cable_rings'));\n// ---------- data centre stack ----------\nconst RK={w:1.25,d:1.4,h:4.6,y0:-.6,units:14},rackX=[-1.3,0,1.3];\nconst stackLB=new LB(),uf=p=>clamp((p.y-RK.y0)/RK.h);\nconst ledData=[];const unitH=(RK.h-.3)/RK.units;\nfor(const x of rackX){const x0=x-RK.w/2,x1=x+RK.w/2,z0=-RK.d/2,z1=RK.d/2;\nstackLB.box(V(x0,RK.y0,z0),V(x1,RK.y0+RK.h,z1),uf,1);\nstackLB.box(V(x0+.04,RK.y0,z0+.04),V(x1-.04,RK.y0+RK.h,z1-.04),uf,.35);\nfor(let k=0;k<RK.units;k++){const y=RK.y0+.15+k*unitH,zf=z1+.002;\nstackLB.box(V(x0+.07,y+.03,zf),V(x1-.07,y+unitH-.03,zf),uf,.7);\nfor(let v=0;v<6;v++){const vx=x1-.16-v*.06;stackLB.seg(V(vx,y+.08,zf),V(vx,y+unitH-.08,zf),uf(V(0,y,0)),uf(V(0,y,0)),.45);}\nstackLB.seg(V(x0,y,z0),V(x0,y,z1),uf(V(0,y,0)),uf(V(0,y,0)),.25);stackLB.seg(V(x1,y,z0),V(x1,y,z1),uf(V(0,y,0)),uf(V(0,y,0)),.25);\nfor(let j=0;j<3;j++)ledData.push({p:V(x0+.15+j*.075,y+unitH/2,zf+.006),u:uf(V(0,y,0)),rate:R(.6,4),ph:R(0,50),hot:rnd()<.3});}}\nconst stackMat=lineMat({color:COL.amber,hot:COL.amber,opacity:.55,tip:.04,over:true});\nworld.add(stackLB.mesh(stackMat,'rack_frames'));\nconst ledMesh=new THREE.InstancedMesh(new THREE.BoxGeometry(.045,.032,.01),new THREE.MeshBasicMaterial({color:0xffffff,transparent:true,depthWrite:false}),ledData.length);\nledMesh.name='rack_leds';ledMesh.material.name='led';\n{const m=new THREE.Matrix4();ledData.forEach((l,i)=>{m.makeTranslation(l.p.x,l.p.y,l.p.z);ledMesh.setMatrixAt(i,m);ledMesh.setColorAt(i,new THREE.Color(0));});}\nworld.add(ledMesh);\nconst fillMat=new THREE.MeshBasicMaterial({color:COL.amber,transparent:true,opacity:0,...ADD,depthWrite:false,side:THREE.DoubleSide});fillMat.name='rack_glass';\nfor(const x of rackX){const b=new THREE.Mesh(new THREE.BoxGeometry(RK.w,RK.h,RK.d),fillMat);b.position.set(x,RK.y0+RK.h/2,0);b.name='rack_volume';b.visible=false;}\nconst busMats=[];\n{const bm=tubeMat({over:true,opacity:.6,rim:.9,core:.2,pulse:1.4,density:3,speed:.6});busMats.push(bm);\nconst bus=new THREE.Mesh(new THREE.TubeGeometry(roundedPath([V(-1.65,0,0),V(1.6,0,0)],.1),60,.07,12),bm);bus.name='power_bus';world.add(bus);\nfor(const x of rackX){const m=tubeMat({over:true,opacity:.5,rim:.9,core:.15,pulse:1.3,density:3,speed:.5,seed:R(0,1)});busMats.push(m);\nconst t=new THREE.Mesh(new THREE.TubeGeometry(roundedPath([V(x,0,0),V(x,0,-.45),V(x,3.9,-.45)],.15),80,.045,10),m);t.name='power_riser';world.add(t);}}\n// ---------- network (inputs, neurons -> decision tree) ----------\nconst nodes=[],edges=[];const add=o=>(nodes.push(o),nodes.length-1);\nconst starts=[];for(const y of [.55,1.5,2.45,3.4])for(const z of [-.4,0,.4])starts.push(V(1.935,y,z));\nconst IN=starts.length,inIdx=[];\nfor(let i=0;i<IN;i++){const p=V(R(5,5.7),lerp(-.15,4.7,i/(IN-1))+R(-.12,.12),R(-1.3,1.3));inIdx.push(add({nN:p,nT:p.clone(),kind:'in',birth:0}));}\nconst wireMats=[];\nstarts.forEach((s,i)=>{const e=nodes[inIdx[i]].nN;const c=new THREE.CubicBezierCurve3(s,s.clone().add(V(1.5,0,0)),e.clone().add(V(-1.5,0,0)),e);\nconst m=tubeMat({opacity:.85,rim:.9,core:.25,pulse:1.8,density:2,speed:.55,seed:R(0,1),tip:.06});wireMats.push(m);\nconst t=new THREE.Mesh(new THREE.TubeGeometry(c,80,.032,8),m);t.name='data_wire';world.add(t);});\nconst net=[];for(let t=0;net.length<26&&t<8000;t++){const p=V(R(6.8,13.6),R(-.2,5),R(-2.2,2.2));if(net.every(q=>q.distanceTo(p)>1.05))net.push(p);}\nnet.sort((a,b)=>a.x-b.x);\nconst birthOf=p=>clamp((p.x-6.5)/7.5)*.62+R(0,.1);\nconst used=new Set();const pick=i=>(used.add(i),net[i]);\nconst rootP=pick(1),L1P=[pick(8),pick(10),pick(12)].sort((a,b)=>b.y-a.y),L2P=[20,21,22,23,24,25].filter(i=>i<net.length).map(pick).sort((a,b)=>b.y-a.y);\nconst L1Y=[3.9,2.2,.5],L2Y=[4.32,3.48,2.62,1.78,.92,.08];\nconst rootI=add({nN:rootP,nT:V(7.8,2.2,0),kind:'T',birth:birthOf(rootP)});\nconst L1I=L1P.map((p,j)=>add({nN:p,nT:V(10.4,L1Y[j],0),kind:'T',birth:birthOf(p)}));\nconst L2I=L2P.map((p,j)=>add({nN:p,nT:V(13,L2Y[j],0),kind:'T',birth:birthOf(p)}));\nconst TI=[rootI,...L1I,...L2I];\nconst XI=[];net.forEach((p,i)=>{if(used.has(i))return;let best=TI[0],bd=1e9;for(const t of TI){const d=nodes[t].nN.distanceTo(p);if(d<bd){bd=d;best=t;}}\nXI.push(add({nN:p,nT:nodes[best].nT.clone(),kind:'X',birth:birthOf(p)}));});\nconst netI=[...TI,...XI];\nconst keys=new Set();const key=(a,b)=>a<b?a+'-'+b:b+'-'+a;\nfunction addE(a,b,aN,aT,o={}){keys.add(key(a,b));edges.push({a,b,aN,aT,tree:!!o.tree,birth:o.birth??Math.min(nodes[a].birth,nodes[b].birth),seed:R(0,1)});}\nL1I.forEach((l,j)=>{addE(rootI,l,.9,1,{tree:1});addE(l,L2I[j*2],.9,1,{tree:1});addE(l,L2I[j*2+1],.9,1,{tree:1});});\ninIdx.forEach(i=>addE(i,rootI,0,.7,{tree:1,birth:0}));\ninIdx.forEach(i=>{const s=[...netI].sort((a,b)=>nodes[a].nN.distanceTo(nodes[i].nN)-nodes[b].nN.distanceTo(nodes[i].nN));\naddE(i,s[0],.8,0,{birth:0});if(rnd()<.5)addE(i,s[1],.6,0,{birth:.05});});\nnetI.forEach(i=>{const s=netI.filter(j=>j!==i).sort((a,b)=>nodes[a].nN.distanceTo(nodes[i].nN)-nodes[b].nN.distanceTo(nodes[i].nN));\nfor(const j of s.slice(0,2)){if(keys.has(key(i,j)))continue;const [a,b]=nodes[i].birth<=nodes[j].birth?[i,j]:[j,i];addE(a,b,.75,0);}});\nnetI.forEach(i=>{for(let k=0;k<3;k++){const d=V(R(-1,1),R(-1,1),R(-1,1)).normalize();\nconst t=add({nN:nodes[i].nN.clone().addScaledVector(d,R(.35,.8)),nT:nodes[i].nT.clone(),kind:'tip',birth:nodes[i].birth});addE(i,t,.4,0,{birth:nodes[i].birth+.04});}});\nconst S=22;\nfunction fill(a,b){const f=new Float32Array(S*3);for(let k=0;k<S;k++){const s=k/(S-1);f[k*3]=lerp(a.x,b.x,s);f[k*3+1]=lerp(a.y,b.y,s);f[k*3+2]=lerp(a.z,b.z,s);}return f;}\nfunction organic(a,b){const f=new Float32Array(S*3),dir=b.clone().sub(a),len=dir.length();\nconst p1=dir.clone().cross(V(0,0,1)).normalize();if(p1.lengthSq()<.5)p1.set(0,1,0);const p2=dir.clone().cross(p1).normalize();\nconst b1=R(-.28,.28)*len,b2=R(-.15,.15)*len;\nfor(let k=0;k<S;k++){const s=k/(S-1),q=a.clone().lerp(b,s).addScaledVector(p1,Math.sin(Math.PI*s)*b1).addScaledVector(p2,Math.sin(Math.PI*2*s)*b2);f.set([q.x,q.y,q.z],k*3);}return f;}\nfunction elbow(a,b){if(a.distanceTo(b)<1e-3)return fill(a,b);const mx=(a.x+b.x)/2;const c=roundedPath([a,V(mx,a.y,a.z),V(mx,b.y,b.z),b],.3);\nconst f=new Float32Array(S*3);c.getSpacedPoints(S-1).forEach((q,k)=>f.set([q.x,q.y,q.z],k*3));return f;}\nedges.forEach(e=>{const A=nodes[e.a],B=nodes[e.b];e.N=organic(A.nN,B.nN);e.T=e.tree?elbow(A.nT,B.nT):fill(A.nT,B.nT);});\nconst segCount=edges.length*(S-1);\nconst ePos=new Float32Array(segCount*6),eU=new Float32Array(segCount*2),eA=new Float32Array(segCount*2),eS=new Float32Array(segCount*2);\nedges.forEach((e,ei)=>{for(let k=0;k<S-1;k++){const o=(ei*(S-1)+k)*2;eU[o]=k/(S-1);eU[o+1]=(k+1)/(S-1);eS[o]=eS[o+1]=e.seed*7;}});\nconst eGeo=new THREE.BufferGeometry();\neGeo.setAttribute('position',new THREE.BufferAttribute(ePos,3).setUsage(THREE.DynamicDrawUsage));\neGeo.setAttribute('aU',new THREE.BufferAttribute(eU,1));\neGeo.setAttribute('aAlpha',new THREE.BufferAttribute(eA,1).setUsage(THREE.DynamicDrawUsage));\neGeo.setAttribute('aSeed',new THREE.BufferAttribute(eS,1));\nconst netLineMat=lineMat({opacity:.55,pulse:1.6,speed:.55,density:1,sharp:16,gate:.55});\nconst netLines=new THREE.LineSegments(eGeo,netLineMat);netLines.name='neural_paths';netLines.frustumCulled=false;world.add(netLines);\nconst drawN=nodes.map((n,i)=>i).filter(i=>nodes[i].kind!=='tip');\nconst nPos=new Float32Array(drawN.length*3),nSize=new Float32Array(drawN.length),nAl=new Float32Array(drawN.length),nSeed=new Float32Array(drawN.length),nSh=new Float32Array(drawN.length);\ndrawN.forEach((i,k)=>nSeed[k]=R(0,1));\nconst nGeo=new THREE.BufferGeometry();\nfor(const [n,a,s] of [['position',nPos,3],['aSize',nSize,1],['aAlpha',nAl,1],['aSeed',nSeed,1],['aShape',nSh,1]])nGeo.setAttribute(n,new THREE.BufferAttribute(a,s).setUsage(THREE.DynamicDrawUsage));\nconst nodeMat=ptMat();\nconst nodePts=new THREE.Points(nGeo,nodeMat);nodePts.name='neurons';nodePts.frustumCulled=false;world.add(nodePts);\n// halo at pipe → stack junction\nconst hGeo=new THREE.BufferGeometry();hGeo.setAttribute('position',new THREE.Float32BufferAttribute([-1.93,0,0],3));\nhGeo.setAttribute('aSize',new THREE.Float32BufferAttribute([2.6],1));hGeo.setAttribute('aAlpha',new THREE.Float32BufferAttribute([0],1));\nhGeo.setAttribute('aSeed',new THREE.Float32BufferAttribute([.3],1));hGeo.setAttribute('aShape',new THREE.Float32BufferAttribute([0],1));\nconst haloMat=ptMat();haloMat.uniforms.uFire.value=0;const rGeo=hGeo.clone();rGeo.setAttribute('position',new THREE.Float32BufferAttribute([WX,-4.6,0],3));rGeo.setAttribute('aSize',new THREE.Float32BufferAttribute([7],1));\nconst resGlowMat=ptMat();resGlowMat.uniforms.uFire.value=0;const resGlow=new THREE.Points(rGeo,resGlowMat);resGlow.name='reservoir_glow';resGlow.frustumCulled=false;world.add(resGlow);\nconst halo=new THREE.Points(hGeo,haloMat);halo.name='junction_glow';halo.frustumCulled=false;world.add(halo);\nlet lastNet=[-1,-1,-1];\nconst tmp=new Float32Array(S*3);\nfunction updateNetwork(nGrow,m,wireT){\nif(Math.abs(nGrow-lastNet[0])<1e-4&&Math.abs(m-lastNet[1])<1e-4&&Math.abs(wireT-lastNet[2])<1e-4)return;lastNet=[nGrow,m,wireT];\ndrawN.forEach((i,k)=>{const n=nodes[i],b=n.birth;\nnPos[k*3]=lerp(n.nN.x,n.nT.x,m);nPos[k*3+1]=lerp(n.nN.y,n.nT.y,m);nPos[k*3+2]=lerp(n.nN.z,n.nT.z,m);\nif(n.kind==='in'){nAl[k]=ease(seg(wireT,.75,1));nSize[k]=.55;nSh[k]=m;}\nelse if(n.kind==='T'){nAl[k]=Math.max(ease(seg(nGrow,b,b+.12)),m);nSize[k]=lerp(.9,1.05,m);nSh[k]=m;}\nelse{nAl[k]=ease(seg(nGrow,b,b+.12))*(1-m);nSize[k]=.78;nSh[k]=0;}});\nfor(const a of ['position','aSize','aAlpha','aShape'])nGeo.attributes[a].needsUpdate=true;\nedges.forEach((e,ei)=>{const g=e.aN===0?1:e.a<IN?ease(seg(wireT,.8+e.birth,1))*ease(seg(nGrow,0,.15)):ease(seg(nGrow,e.birth,e.birth+.25));\nconst al=lerp(e.aN,e.aT,m)*(e.aN===0?1:g);const base=ei*(S-1)*2;\nif(al<.002){eA.fill(0,base,base+(S-1)*2);return;}\nfor(let k=0;k<S;k++){const f=k/(S-1)*g*(S-1),i0=Math.floor(f),i1=Math.min(i0+1,S-1),t=f-i0;\nfor(let c=0;c<3;c++){const nv=lerp(e.N[i0*3+c],e.N[i1*3+c],t),tv=lerp(e.T[i0*3+c],e.T[i1*3+c],t);tmp[k*3+c]=lerp(nv,tv,m);}}\nfor(let k=0;k<S-1;k++){const o=(base+k*2)*3;ePos.set(tmp.subarray(k*3,k*3+3),o);ePos.set(tmp.subarray(k*3+3,k*3+6),o+3);eA[base+k*2]=eA[base+k*2+1]=al;}});\neGeo.attributes.position.needsUpdate=true;eGeo.attributes.aAlpha.needsUpdate=true;\n}\n// ---------- feedback loop (decisions → operations) ----------\nconst loopLB=new LB();\nfunction loopPath(pts,u0,u1){const c=roundedPath(pts,.35),n=400;let prev=null;for(let i=0;i<=n;i++){const p=c.getPointAt(i/n);if(prev)loopLB.seg(prev,p,lerp(u0,u1,(i-1)/n),lerp(u0,u1,i/n),1);prev=p;}return c.getLength();}\nconst LA=loopPath([V(13,-.12,0),V(13,-.56,0),V(13,-.56,2.2),V(-10.6,-.56,2.2),V(-10.6,-.56,0),V(-10.6,.07,0)],0,.82);\nloopPath([V(1.3,-.56,2.2),V(1.3,-.56,1.05),V(1.3,.75,1.05),V(1.3,.75,.71)],.4,.82);\nloopPath([V(-5.4,-.56,2.2),V(-5.4,-.56,1.15),V(-5.4,.5,1.15),V(-5.4,.5,.8)],.594,.82);\nloopLB.ring(V(-5.4,.5,.8),V(1,0,0),V(0,1,0),.12,.82,1.4,24);loopLB.ring(V(-5.4,.5,.8),V(1,0,0),V(0,1,0),.06,.82,1.,16);\nloopLB.ring(V(1.3,.75,.712),V(1,0,0),V(0,1,0),.12,.82,1.4,24);loopLB.ring(V(1.3,.75,.712),V(1,0,0),V(0,1,0),.06,.82,1.,16);\nconst loopMat=lineMat({color:COL.loop,opacity:.55,pulse:1.4,speed:.45,density:LA/1.3,sharp:8,tip:.02});\nworld.add(loopLB.mesh(loopMat,'control_loop'));\n// ---------- overlay cards ----------\nconst ui=document.getElementById('eih-ui');\nconst CARDS=[['Reroute flow','Divert 18% to Line B ahead of a pressure spike.','EXECUTED'],\n['Dispatch crew','Valve V-12 vibration above threshold.','QUEUED'],\n['Shift compute','Move batch jobs into the off-peak window.','EXECUTED'],\n['Pre-cool racks','Raise chiller output before peak load.','EXECUTED'],\n['Escalate','Confidence 62%. Routed to an operator.','REVIEW'],\n['Auto-execute','Within policy. Applied in 0.4s.','EXECUTED']];\nconst cardEls=CARDS.map(([t,d,s],i)=>{const el=document.createElement('div');el.className='card';\nel.innerHTML=`<div class=\"k\"><span>ACTION 0${i+1}</span><span>${s}</span></div><div class=\"t\">${t}</div><div class=\"d\">${d}</div>`;ui.appendChild(el);return el;});\nconst labEls=['Flow pressure','Compute load','Confidence'].map(t=>{const el=document.createElement('div');el.className='lab';el.textContent=t;ui.appendChild(el);return el;});\nconst proj=new THREE.Vector3();\nfunction toScreen(v,W,H){proj.copy(v).project(camera);return [(proj.x*.5+.5)*W,(-proj.y*.5+.5)*H,proj.z];}\n// ---------- camera choreography ----------\nconst KEYS=[\n[0,  [-12.6,1.4,11],[-15,-1,0]],\n[.07,[-12.2,3,8.4],[-12.8,1.2,0]],\n[.15,[-9.8,2.4,6.8],[-9.4,.9,0]],\n[.25,[-5.6,2.6,7.8],[-6.8,1.1,0]],\n[.34,[-3.8,1.6,7.4],[-2.2,1,0]],\n[.45,[1,5,18],[-1.5,1.8,0]],\n[.57,[5.5,3.4,12.5],[6.5,2,0]],\n[.69,[10.2,2.8,8.6],[9.8,2.2,0]],\n[.82,[11,2.5,10.8],[10.8,2.2,0]],\n[.87,[11.2,2.5,10.6],[10.8,2.2,0]],\n[1,  [-1,7.5,40],[-1,1.4,0]]];\nconst cp=new THREE.Vector3(),ct=new THREE.Vector3();\nfunction camAt(p){let i=0;while(i<KEYS.length-2&&p>KEYS[i+1][0])i++;const [p0,c0,t0]=KEYS[i],[p1,c1,t1]=KEYS[i+1];\nlet t=seg(p,p0,p1);t=lerp(t,ease(t),.65);cp.set(lerp(c0[0],c1[0],t),lerp(c0[1],c1[1],t),lerp(c0[2],c1[2],t));ct.set(lerp(t0[0],t1[0],t),lerp(t0[1],t1[1],t),lerp(t0[2],t1[2],t));}\n// ---------- loop ----------\nlet W=1,H=1;\nfunction resize(){W=STAGE.clientWidth||innerWidth;H=STAGE.clientHeight||innerHeight;renderer.setSize(W,H,false);camera.aspect=W/H;camera.updateProjectionMatrix();\nconst sc=H*renderer.getPixelRatio()/(2*Math.tan(THREE.MathUtils.degToRad(camera.fov/2)));nodeMat.uniforms.uScale.value=sc;resGlowMat.uniforms.uScale.value=sc;haloMat.uniforms.uScale.value=sc;}\naddEventListener('resize',resize);if(window.ResizeObserver)new ResizeObserver(resize).observe(STAGE);resize();\nconst mouse={x:0,y:0,sx:0,sy:0};addEventListener('pointermove',e=>{const r=STAGE.getBoundingClientRect();mouse.x=(e.clientX-r.left)/W*2-1;mouse.y=(e.clientY-r.top)/H*2-1;},{passive:true});\nconst hero=ROOT,stageEl=STAGE;\nconst rawP=()=>{const r=hero.getBoundingClientRect(),m=r.height-2*H;return m>0?clamp(-r.top/m):0;};\nconst HOLD=[[0,0],[.16,.26],[.24,.26],[.40,.45],[.48,.45],[.68,.88],[.76,.88],[.88,.97],[.93,1],[1,1]];\nconst remap=u=>{for(let i=0;i<HOLD.length-1;i++){const [a,pa]=HOLD[i],[b,pb]=HOLD[i+1];if(u<=b)return lerp(pa,pb,seg(u,a,b));}return 1;};\nconst scrollP=()=>remap(rawP())*.94;\nconst RES_PT=V(WX,-4.6,0);const HEAD=document.getElementById(\"eih-head\"),WORDS=[...HEAD.querySelectorAll(\".w\")],ENW=HEAD.querySelector(\".en\"),ORB=document.getElementById(\"eih-orb\"),FADE=document.getElementById(\"eih-fade\"),SCRIM=document.getElementById(\"eih-scrim\");\nconst COPY={};document.querySelectorAll(\"#eih-root .eih-copy\").forEach(e=>COPY[e.dataset.k]=e);\nconst setO=(el,o,dy=0)=>{el.style.opacity=o.toFixed(3);el.style.visibility=o>.01?\"visible\":\"hidden\";el.style.pointerEvents=o>.5?\"auto\":\"none\";if(dy)el.style.transform=`translateY(${dy.toFixed(1)}px)`;};\nlet pS=scrollP(),prevT=pS,last=performance.now(),simT=0;const t0=performance.now();\nconst rail=[...ROOT.querySelectorAll('#eih-rail .st')],barI=ROOT.querySelector('#eih-bar i'),hint=document.getElementById('eih-hint'),bg=document.getElementById('eih-bg');\nconst ledCol=new THREE.Color();let rackDim=.4;let lastStage=-1;\nconst loopT0=p=>ease(seg(p,.87,.97));\nlet eihVisible=true,eihRunning=true;\nif(window.IntersectionObserver)new IntersectionObserver(es=>{eihVisible=es[0].isIntersecting;if(eihVisible&&!eihRunning){eihRunning=true;last=performance.now();requestAnimationFrame(frame);}},{rootMargin:'200px'}).observe(ROOT);\nfunction frame(now){\nif(!eihVisible){eihRunning=false;return;}\nconst dt=Math.min(.05,(now-last)/1000);last=now;\nconst target=scrollP();const vel=Math.abs(target-prevT)/Math.max(dt,1e-3);prevT=target;\npS+=(target-pS)*(1-Math.exp(-dt*5));const p=clamp(pS/.94);const hb=hero.getBoundingClientRect(),cover=clamp((-hb.top-(hb.height-2*H))/H);\nstageEl.style.opacity=(1-.55*cover).toFixed(3);if(cover>.999){requestAnimationFrame(frame);return;}\nsimT+=dt*(1+Math.min(vel*6,2.5));\nfor(const m of timed)m.uniforms.uTime.value=simT;\nconst tS=(now-t0)/1000;const intro=ease(seg(tS,2.6,4.4));\n// phases\nconst resIn=ease(seg(tS,1.05,2.3));\nconst pipeR=.22*ease(seg(tS,3.3,5.2))+.78*ease(seg(p,.02,.16));\nresMat.uniforms.uOpacity.value=.6*resIn;rGeo.attributes.aAlpha.array[0]=resIn*(.45+.12*Math.sin(simT*1.3));rGeo.attributes.aAlpha.needsUpdate=true;\nconst plantT=ease(seg(p,.13,.26)),spin=ease(seg(p,.2,.3)),cableT=ease(seg(p,.25,.31));\nplantMat.uniforms.uReveal.value=plantT;plantSteelMat.uniforms.uReveal.value=plantT;rotorMat.uniforms.uReveal.value=plantT;\nrotorMat.uniforms.uOpacity.value=.35+.4*spin;rotor.rotation.x+=dt*(.25+7*spin);\ncableShellMat.uniforms.uReveal.value=cableT;cableCoreMat.uniforms.uReveal.value=cableT;cableLineMat.uniforms.uReveal.value=cableT;\ncableShellMat.uniforms.uOpacity.value=.5*intro;cableCoreMat.uniforms.uOpacity.value=intro*(1+loopT0(p)*.4);\nconst stackT=ease(seg(p,.28,.38)),busT=ease(seg(p,.35,.44)),wireT=seg(p,.46,.6),nGrow=seg(p,.55,.7),m=ease(seg(p,.7,.81)),cardsT=seg(p,.79,.88),loopT=ease(seg(p,.87,.97));\npipeShellMat.uniforms.uReveal.value=pipeR;pipeCoreMat.uniforms.uReveal.value=pipeR;pipeLineMat.uniforms.uReveal.value=pipeR;pipeSteelMat.uniforms.uReveal.value=pipeR;\npipeShellMat.uniforms.uOpacity.value=.5*intro;pipeCoreMat.uniforms.uOpacity.value=intro*(1+loopT*.4);pipeLineMat.uniforms.uOpacity.value=.55*intro;\ntankMat.uniforms.uReveal.value=intro;gridMat.opacity=.32*intro;\nstackMat.uniforms.uReveal.value=stackT;\nbusMats.forEach(b=>b.uniforms.uReveal.value=busT);\nhGeo.attributes.aAlpha.array[0]=seg(p,.3,.35)*(.55+.15*Math.sin(simT*2));hGeo.attributes.aAlpha.needsUpdate=true;\nwireMats.forEach((w,i)=>w.uniforms.uReveal.value=ease(seg(wireT,i/IN*.3,i/IN*.3+.7)));\nupdateNetwork(nGrow,m,wireT);\nnodeMat.uniforms.uFire.value=1-m*.75;\nnetLineMat.uniforms.uGate.value=lerp(.55,.15,m);netLineMat.uniforms.uOpacity.value=lerp(.55,.75,m);\nloopMat.uniforms.uReveal.value=loopT;\n// LEDs\nledData.forEach((l,i)=>{const on=l.u<=stackT?1:0;const fl=Math.sin(simT*l.rate+l.ph)>.6?1:.28;\nledCol.copy(COL.amber).multiplyScalar(on*fl*(.35+busT*.2)*rackDim);ledMesh.setColorAt(i,ledCol);});\nledMesh.instanceColor.needsUpdate=true;\n// camera\ncamAt(p);const k=clamp(1.65/camera.aspect,1,2.3);cp.sub(ct).multiplyScalar(k).add(ct);\nmouse.sx+=(mouse.x-mouse.sx)*.04;mouse.sy+=(mouse.y-mouse.sy)*.04;const d=cp.distanceTo(ct);\ncp.x+=mouse.sx*d*.035;cp.y-=mouse.sy*d*.02;\ncamera.position.copy(cp);camera.lookAt(ct);camera.updateMatrixWorld();\nconst u=rawP();\n// heading: words fade in one at a time, then glide to the bottom-left and hand over to the stop copy\nWORDS.forEach((w,i)=>{const a=ease(seg(tS,.35+i*.5,.35+i*.5+.7));w.style.opacity=a.toFixed(3);w.style.transform=`translateY(${((1-a)*14).toFixed(1)}px)`;});\nconst mv=ease(seg(u,.005,.07));const hh=HEAD.offsetHeight,s1=W<641?.62:.5;const y0=(H-hh)/2-H*.02,y1=H-H*.11-hh*s1-200*(1-0);\nconst hy=lerp(y0,Math.max(H*.35,H-H*.11-hh*s1-160),mv);HEAD.style.transform=`translate(0,${hy.toFixed(1)}px) scale(${lerp(1,s1,mv).toFixed(4)})`;\nHEAD.style.opacity=(1-ease(seg(u,.055,.085))).toFixed(3);\ncamera.clearViewOffset();\nconst anchorK=1-ease(seg(u,0,.075));\nif(anchorK>.001){const [sx,sy]=toScreen(RES_PT,W,H);const r=ENW.getBoundingClientRect(),sr=STAGE.getBoundingClientRect();const wx=r.left+r.width/2-sr.left,wy=r.top+r.height*.52-sr.top;camera.setViewOffset(W,H,(sx-wx)*anchorK,(sy-wy)*anchorK,W,H);}\n{const [ox,oy]=toScreen(RES_PT,W,H);const orbA=resIn*(1-.55*intro)*(1-ease(seg(u,.02,.09)));ORB.style.opacity=orbA.toFixed(3);ORB.style.transform=`translate(${ox.toFixed(1)}px,${oy.toFixed(1)}px) scale(${(.75+.25*resIn+.04*Math.sin(simT*2.2)).toFixed(3)})`;}\nbg.style.opacity=intro.toFixed(3);\n// stop copy\nconst oE=ease(seg(u,.065,.1))*(1-ease(seg(p,.275,.3))),oI=ease(seg(p,.29,.32))*(1-ease(seg(p,.47,.5))),oN=ease(seg(p,.5,.53))*(1-ease(seg(u,.86,.9)));\nsetO(COPY.energy,oE,(1-oE)*16);setO(COPY.infra,oI,(1-oI)*16);setO(COPY.intel,oN,(1-oN)*16);SCRIM.style.opacity=Math.max(oE,oI,oN,mv*(1-ease(seg(u,.055,.085)))).toFixed(3);\nFADE.style.opacity=ease(seg(u,.9,.97)).toFixed(3);\nrackDim=lerp(.4,1,ease(seg(camera.position.distanceTo(V(0,1.7,0)),9,38)));\nstackMat.uniforms.uOpacity.value=.4*rackDim;fillMat.opacity=0;\nbusMats.forEach((b,i)=>{b.uniforms.uOpacity.value=(i?.5:.6)*rackDim;b.uniforms.uHot.value.copy(COL.amber);b.uniforms.uCore.value=0;});\n// overlay\nconst ppu=(()=>{const a=toScreen(V(13,2.2,0),W,H),b=toScreen(V(13,3.2,0),W,H);return Math.hypot(a[0]-b[0],a[1]-b[1]);})();\nconst sc=clamp(ppu/118,.42,1);\ncardEls.forEach((el,i)=>{const o=ease(seg(cardsT,i*.07,i*.07+.5));\nif(o<.01){el.style.visibility='hidden';return;}\nconst [x,y]=toScreen(V(13.3,L2Y[i],0),W,H);el.style.visibility='visible';el.style.opacity=o;\nel.classList.toggle('compact',sc<.72);\nel.style.transform=`translate(${(x+18*sc).toFixed(1)}px,${y.toFixed(1)}px) translateY(-50%) scale(${sc.toFixed(3)}) translateX(${((1-o)*-14).toFixed(1)}px)`;});\nlabEls.forEach((el,j)=>{const o=ease(seg(m,.75,1))*clamp((sc-.5)/.25);if(o<.01){el.style.visibility='hidden';return;}\nconst [x,y]=toScreen(V(10.4,L1Y[j]+.34,0),W,H);el.style.visibility='visible';el.style.opacity=o;el.style.transform=`translate(${x.toFixed(1)}px,${y.toFixed(1)}px) translate(-50%,-100%)`;});\nconst stage=p<.13?0:p<.28?1:p<.5?2:p<.72?3:4;\nif(stage!==lastStage){rail.forEach((r,i)=>r.classList.toggle('on',i===stage));lastStage=stage;}\nbarI.style.width=(p*100).toFixed(2)+'%';hint.style.opacity=u>.01?0:ease(seg(tS,4.4,5.2));bg.style.setProperty('--p',p.toFixed(4));\nrenderer.render(scene,camera);\nrequestAnimationFrame(frame);\n}\nrequestAnimationFrame(frame);\n</script>"}