<!-- SAGA · part 44 -->
tion'){ window._buildQueue.push(buildLavaTubes); }

/* ALLUVIAL FANS — sediment at canyon mouths. 2026-10-04. */
function buildFans(){
  try{
    var sedimentMat = new THREE.MeshStandardMaterial({color: 0xb09468, roughness: 1});
    function fan(x, z, r){
      /* Fan shape: half-cone spreading from canyon mouth */
      var fanMesh = new THREE.Mesh(new THREE.CylinderGeometry(r, r*0.3, 8, 16, 1, false, 0, Math.PI), sedimentMat);
      fanMesh.position.set(x, 2, z);
      fanMesh.scale.y = 0.5;
      scene.add(fanMesh);
      /* Braided channels */
      for(var c = 0; c < 5; c++){
        var ch = new THREE.Mesh(new THREE.PlaneGeometry(3, r*0.8),
          new THREE.MeshStandardMaterial({color: 0x8a7050, roughness: 1}));
        ch.rotation.x = -Math.PI/2;
        var ca = (c / 5) * Math.PI;
        ch.position.set(x + Math.cos(ca)*r*0.4, 4.2, z + Math.sin(ca)*r*0.4);
        ch.rotation.z = ca;
        scene.add(ch);
      }
    }
    fan(-1800, -3450, 80);  /* Canyon 1 mouth */
    fan(2200, 3450, 90);    /* Canyon 2 mouth */
    fan(-2800, -2700, 70);  /* Valley mouth */
  }catch(e){}
}
if(typeof buildFans === 'function'){ window._buildQueue.push(buildFans); }

/* TRANSIT STATIONS — integrated into districts (Singapore model). 2026-10-04. */
function buildStations(){
  try{
    var steelMat = new THREE.MeshStandardMaterial({color: 0x888888, metalness: 0.7, roughness: 0.4});
    var glassMat = new THREE.MeshStandardMaterial({color: 0xaaddff, transparent: true, opacity: 0.4});

    function station(x, z, name){
      var st = new THREE.Group();
      /* Platform */
      var plat = new THREE.Mesh(new THREE.BoxGeometry(30, 2, 12), steelMat);
      plat.position.y = 1;
      st.add(plat);
      /* Canopy */
      var canopy = new THREE.Mesh(new THREE.BoxGeometry(32, 0.5, 14), glassMat);
      canopy.position.y = 8;
      st.add(canopy);
      /* Pillars */
      for(var p = -1; p <= 1; p++){
        for(var q = -1; q <= 1; q += 2){
          var pillar = new THREE.Mesh(new THREE.CylinderGeometry(0.5, 0.5, 7, 8), steelMat);
          pillar.position.set(p*12, 4.5, q*6);
          st.add(pillar);
        }
      }
      /* Sign */
      var sign = new THREE.Mesh(new THREE.BoxGeometry(10, 2, 0.5),
        new THREE.MeshBasicMaterial({color: 0x00ffff}));
      sign.position.set(0, 10, 0);
      st.add(sign);
      st.position.set(x, 0.13, z);
      scene.add(st);
    }

    station(100, -80);    /* City Central */
    station(-80, 160);    /* Village */
    station(2000, 1980);  /* Ahupua'a */
    station(3000, 480);   /* Shoreline */

  }catch(e){}
}
if(typeof buildStations === 'function'){ window._buildQueue.push(buildStations); }

/* SCHOOLS — places of learning, for the children. 2026-10-04. */
function buildSchools(){
  try{
    var wallMat = new THREE.MeshStandardMaterial({color: 0xf0e0c0, roughness: 0.9});
    var roofMat = new THREE.MeshStandardMaterial({color: 0x2a5aaa, roughness: 0.8});

    function school(x, z){
      var sc = new THREE.Group();
      /* Main building */
      var main = new THREE.Mesh(new THREE.BoxGeometry(20, 8, 12), wallMat);
      main.position.y = 4;
      sc.add(main);
      /* Roof */
      var roof = new THREE.Mesh(new THREE.BoxGeometry(22, 1, 14), roofMat);
      roof.position.y = 8.5;
      sc.add(roof);
      /* Door */
      var door = new THREE.Mesh(new THREE.PlaneGeometry(3, 5),
        new THREE.MeshBasicMaterial({color: 0x8a5a2a}));
      door.position.set(0, 2.5, 6.01);
      sc.add(door);
      /* Windows — bright, welcoming */
      for(var w = -2; w <= 2; w++){
        if(w === 0) continue;
        var win = new THREE.Mesh(new THREE.PlaneGeometry(2, 2),
          new THREE.MeshBasicMaterial({color: 0xaaddff}));
        win.position.set(w*4, 5, 6.01);
        sc.add(win);
      }
      /* Playground */
      var yard = new THREE.Mesh(new THREE.CircleGeometry(15, 20),
        new THREE.MeshStandardMaterial({color: 0x4aaa4a, roughness: 1}));
      yard.rotation.x = -Math.PI/2;
      yard.position.set(18, 0.1, 0);
      sc.add(yard);
      /* Swing set */
      var frame = new THREE.Mesh(new THREE.BoxGeometry(6, 0.3, 0.3), wallMat);
      frame.position.set(18, 4, 0);
      sc.add(frame);
      for(var s = -1; s <= 1; s += 2){
        var leg = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.15, 4, 6), wallMat);
        leg.position.set(18 + s*3, 2, 0);
        sc.add(leg);
        var swing = new THREE.Mesh(new THREE.BoxGeometry(1, 0.2, 1), roofMat);
        swing.position.set(18 + s*3, 2, 0);
        sc.add(swing);
      }
      sc.position.set(x, 0.13, z);
      scene.add(sc);
    }

    school(-80, 220);   /* Village school */
    school(140, -100);  /* City school */

  }catch(e){}
}
if(typeof buildSchools === 'function'){ window._buildQueue.push(buildSchools); }

/* MARKETS — gathering places with stalls. 2026-10-04. */
function buildMarkets(){
  try{
    var woodMat = new THREE.MeshStandardMaterial({color: 0x8a6a3a, roughness: 0.8})