<!-- SOLID CITY · part 2797 -->
roup();
  group.add(solid.build(new T.MeshLambertMaterial({ vertexColors: true })));
  group.add(glassB.build(new T.MeshLambertMaterial({ vertexColors: true, transparent: true, opacity: 0.55 })));
  group.add(glowB.build(new T.MeshBasicMaterial({ vertexColors: true })));
  extras.forEach(function (m) { group.add(m); });

  var houseCount = 0, unitCount = 0;
  homes.forEach(function (h) { if (h.style === 'apartment') unitCount += (h.units || 6); else houseCount++; });
  function standYAt(x, z) {
    var best = -Infinity;
    for (var i = 0; i < standRects.length; i++) {
      var r = standRects[i], dx = x - r.cx, dz = z - r.cz;
      var lx = dx * r.cos - dz * r.sin, lz = dx * r.sin + dz * r.cos;
      if (Math.abs(lx - r.lx) <= r.hw && Math.abs(lz - r.lz) <= r.hd && r.y > best) best = r.y;
    }
    return best;
  }
  group.userData = {
    footprint: foot,
    standRects: standRects,
    standTris: standTris,
    homes: homes,
    counts: { houses: houseCount, apartmentUnits: unitCount, dwellings: houseCount + unitCount, trees: treeCount, styles: STYLE_COUNT },
    center: { x: 300, z: -1500 },
    standYAt: standYAt,
    update: null
  };
  return group;
}


===== FILE: public/city/mountain-homes.js.bak-verge-20261013 =====
/* SOLID CITY — NĀ HALE O NĀ KŪPUNA: THE ANCESTORS' HOMES (2026-10-12, by order of the King)
 * "We need to build homes for hawaiians." — homes woven into the green coastal
 * benches around THE ANCESTRAL ROADS (0,-1600), on the ancestors' own land:
 * 'ohana compounds (a main hale, a kupuna hale, a keiki hale around a shared yard),
 * plantation homes, Dickey-roof residences, traditional hale, small apartment
 * blocks at the base — following the verified historic style guide (hale →
 * plantation → Dickey → mission).
 *
 * Design sources (the King's method): three AI reference images (compound / plantation
 * home / mountainside pattern) + his real Hilo ground photos (steep roofs, A-frame gables,
 * earth-tone stucco, lawn-and-path layout, yellow path stones).
 *
 * PLACEMENT LAW (the King's word): homes sit on gentle slopes and valley floors ONLY —
 * never on ledges, ridge crests, or cliff edges. Ledges keep their natural form.
 * Every home has a driveway and a parking pad. Every home is WALK-IN: a real door
 * opening, a real little interior, walls solid, door gap passable.
 *
 * Performance: ALL static geometry is merged into a few vertex-colored batches
 * (opaque / glow / glass) — the whole mountainside is a handful of draw calls.
 * Self-contained ES module:
 *   import { createMountainHomes } from '/city/mountain-homes.js';
 *   const g = createMountainHomes({ THREE, groundAt });
 *   // g.userData: footprint [x,z,w,d,y0,y1,rot] (world), standRects, homes, update(t)
 */
import { createRoadSmith } from './roads.js?v=20261013a';

function mulberry(a) { return function () { a |= 0; a = a + 0x6D2B79F5 | 0; var t = Math.imul(a ^ a >>> 15, 1 | a); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }

export function createMountainHomes(o) {
  var T = o.THREE, groundAt = o.groundAt;
  var R = mulberry(20261012);
  var root = new T.Group(); root.name = 'mountain-homes';
  var foot = [];        // collision footprints, world coords: [x, z, w, d, y0, y1, rotY]
  var standRects = [];  // walkable floors: {cx, cz, cos, sin, hw, hd, y} (rotated rect, world)
  var standTris = [];   // pitched surfaces that STAND (world tris, 9 numbers each): road slabs, driveway stones, paths, parking pads — what you see is what you stand on (2026-10-13)
  var homes = [];       // {x, z, y, kind, name} for narration / POI

  /* ---------------- palette (from the King's photos) ---------------- */
  var C = {
    stucco: 0xb3a184,      // earth-tone walls, Hilo photos
    stucco2: 0xc0b096,
    woodWall: 0x6e5136,     // weathered dark wood, compound image
    woodDark: 0x4a3520,
    white: 0xe8e2d4,        // plantation board-and-batten
    shingle: 0x4c4238,      // dark shingle roofs, Hilo photos
    shingle2: 0x5a4c3c,
    corrugated: 0xaeb6ba,   // silvered tin roof, compound main hale
    stone: 0x55504c,        // lava-rock foundation / walls
    stoneDark: 0x3c3835,
    lanaiWood: 0x7a5c38,
    doorFrame: 0x3d2b1a,    // dark wood door frames
    glass: 0xbfe0ea,
    warm: 0xffc06a,         // window glow
    leaf: 0x2a5c2e, leafDeep: 0x1d4523, leafLight: 0x3f7a38,
    banana: 0x4c9440, taro: 0x3e8a4c,
    trunk: 0x5a4630, palmTrunk: 0x8a7a68,
    lawn: 0x4d7d33, soil: 0x4a3826, water: 0x7fc4d8,
    road: 0x6b6259, drive: 0x8a8078, conc: 0xa89e90,   // warm paved tones, Hilo photos
    yellowStone: 0xd8b93a,  // the King's yellow path stones
    flower1: 0xe86a9a, flower2: 0xf2f0e6, flower3: 0xd84a3a,
    carA: 0xb8bcc2, carB: 0x7a3a30, carC: 0x3a5a7a, carD: 0xd8d4c8
  };

  /* ---------------- geometry batcher (indexed merge, vertex colors) ---------------- */
  function Batch() { this.pos = []; this.nor = []; this.col = []; 