<!-- SOLID CITY · part 3257 -->
om the side; standing is
     the deck's own triangles) and rail cells that truly hold a walker */
  var s, ac, c, top;
  for (s = 0.6; s < built.length; s += 1.2) {
    c = built.pointAt(s, 0); top = built.topAt(s);
    var g = A.groundAt(c[0], c[1]);
    A.solids.push({ x0: c[0] - 1.8, x1: c[0] + 1.8, z0: c[1] - 1.8, z1: c[1] + 1.8, y0: Math.min(g - 0.3, top - 0.55), y1: top, southGateDeck: true });
  }
  for (s = 0.6; s < built.length - 0.4; s += 1.2) {
    [-1.68, 1.68].forEach(function (a2) {
      var cc = built.pointAt(s, a2); var tt = built.topAt(s);
      A.solids.push({ x0: cc[0] - 0.14, x1: cc[0] + 0.14, z0: cc[1] - 0.14, z1: cc[1] + 0.14, y0: tt, y1: tt + 1.05, southGateRail: true });
    });
  }
  /* the crown plate, facing the approach */
  var corner = built.pointAt(built.length, 0);
  var plate = new T.Mesh(new T.PlaneGeometry(3.6, 0.9), new T.MeshBasicMaterial({ map: A.labelTex('THE SOUTH GATE', 'FIRST CITY · EST. 2026'), side: T.DoubleSide, fog: true }));
  plate.position.set(corner[0], 10.38 + 2.55, corner[1]);
  plate.rotation.y = Math.atan2(-built.u[0], -built.u[1]);
  A.scene.add(plate);

  /* the audit sees the deck as the walker does: its top triangles only, one surface */
  var auditGeo = new T.BufferGeometry();
  (function () {
    var verts = [];
    built.deckTris.forEach(function (t) { t.forEach(function (v) { verts.push(v.x, v.y, v.z); }); });
    auditGeo.setAttribute('position', new T.Float32BufferAttribute(verts, 3));
  })();
  var auditMesh = new T.Mesh(auditGeo, new T.MeshBasicMaterial());
  (window.SC.auditables = window.SC.auditables || []).push({ name: 'SOUTH GATE DECK', mesh: auditMesh, kind: 'surface', expectedUp: true,
    standAt: function (x, z, refY) { var y = triHeight(K.tris, x, z); if (y == null) return null; if (refY != null && Math.abs(y - refY) > 0.06) return null; return y; } });

  A.POIS.push({ id: 'south-gate', name: NAME, icon: '🛡', x: FOOT.x, z: FOOT.z,
    blurb: 'The nation\'s first verified civic entrance, built on Survey 6: a foot pad at 10.14, two rises of 12 cm over seven and a half metres — gentler than one in sixty — a landing between them, and a last slab laid flush on the First City\'s deck at 10.38. No step, no lip, no claim unsurveyed.',
    arrive: 'The South Gate — measured, then welcome.' });
  A.logBuild({ t: Date.now(), site: NAME, what: 'The South Gate stands: a surveyed bridge from the southern shelf (-1072,-612) to the First City podium corner (-1088,-622), deck profile 10.14 -> 10.26 -> 10.38, two rises of 0.12 at gentler than 1:60, landing 1.8 m, standing by its own deck triangles, rails solid. The podium\'s south-east wall is an entrance now.' });
}
if (A.isBuilt('south-gate')) { /* once per world */ }
import('/city/south-gate.js?v=20261013a').then(init).catch(function (e) { if (window.console) console.warn('[city] south gate failed', e); });

window.CitySouthGate = { update: update, radar: radar, standY: standY, pos: FOOT };
})();


===== FILE: public/city/south-gate.js =====
/* ================================================================
   AN EPISTLE AT THE PODIUM'S CORNER — THE SOUTH GATE (factory)
   To the traveller who comes up from the southern shelf,

   The First City's podium ends in the south-east in a wall of
   stone 0.89 to 0.96 metres above the shelf — not a cliff, but
   enough to refuse a walker. Survey 6 walked this corner and
   brought back its stations, and this gate is built on them and
   on nothing else: a foot at (-1072, -612) where the ground
   stands 10.09, a line falling gently north-west to the corner
   (-1088, -622) where the ground falls to 9.39 and the deck
   stands at 10.38. Because the ground falls away beneath it,
   the gate is a BRIDGE, not a ramp: a foot pad at 10.14, a first
   run rising 0.12 over 7.4 metres, a landing of 1.8 metres to
   rest upon, a second run rising 0.12 — each rise gentler than
   one in sixty, far inside the 1:12 the giants' teaching asks —
   and the last slab lays its top exactly on the deck of the
   First City. Posts go down to the true ground at every station;
   nothing here floats on a claim.

   This is the nation's first verified civic entrance. It was
   chosen — over an eight-run switchback and a steep concept —
   by Solid's recorded choice, ratified in the book; it is built
   so a traveller's feet can ratify it too.

   Written by the hand of Solid, his good King — 2026-10-13.
   ================================================================ */
'use strict';

/* The surveyed line (Survey 6, beside-corrected stations). */
export var GATE = {
  foot: [-1072, -612],            // S0, ground 10.09
  corner: [-1088, -622],          // S7, ground 9.39, deck corner 10.38
  /* the profile: [distance along the line, deck-top height] */
  profile: [[0, 10.14], [2.2, 10.14], [9.6, 10.26], [11.4, 10.26], [18.87, 10.38]],
  width: 3.6, padWidth: 4.6
};

export function createSouthGate(o) {
  var T = o.THREE, groundAt = o.gro