{
  "format": "c3d/3.0",
  "version": "3.0.0",
  "coordSystem": {
    "handedness": "right",
    "up": "Y",
    "units": "meters",
    "front": "+Z"
  },
  "meta": {
    "id": "c3d-scene-sun-shrine-torii-courtyard-001",
    "slug": "overgrown-sun-shrine-torii-courtyard",
    "name": "Overgrown Sun-Shrine Torii Courtyard",
    "kind": "scene",
    "category": "fantasy_architectural_diorama",
    "tags": [
      "torii",
      "shrine",
      "diorama",
      "isometric",
      "fantasy",
      "japanese",
      "basalt",
      "moss",
      "stone_lantern",
      "tsukubai",
      "noren",
      "pbd_cloth",
      "botanical_tree",
      "gravity_settled",
      "museum_grade"
    ],
    "description": "Museum-grade isometric diorama of an overgrown sun-shrine courtyard. A stepped octagonal mossy basalt and limestone plinth carries a vermilion-lacquered cedar torii with a PBD-cloth indigo-gold noren, a gnarled olive tree arching over the kasagi, a dark tsukubai basin, and twin granite toro lanterns glowing at 2300K. All clutter is BVH gravity-settled and every mesh is watertight. It sits on an obsidian-slate cyclorama under a warm golden key and a cool sapphire rim.",
    "styleDNA": {
      "era": "Timeless Shinto-fantasy, Edo-inspired craft with mythic overgrowth",
      "palette": [
        "#C8321E",
        "#1A1C22",
        "#3B3F45",
        "#B9AE97",
        "#4F6B2E",
        "#1F2E5C",
        "#D4A63A",
        "#7A5A2E"
      ],
      "mood": "Sacred twilight hush, ember-warm lanterns against sapphire dusk, reverent and quietly alive",
      "materialPhilosophy": "Honest weathered materials: porous moss-crusted basalt, chalky sun-bleached limestone, chipped multi-coat vermilion lacquer over cedar grain, verdigris bronze, leaf-gilt that is worn at the edges, and heavy indigo cotton with gold thread. Every edge carries a micro-bevel and per-island variation.",
      "lightingCharacter": "Low golden key raking from front-right, cool sapphire rim separating the silhouette from the dark cyclorama, and 2300K lantern cores with soft fog-glow bloom"
    },
    "boundsM": {
      "min": [
        -1,
        0,
        -1
      ],
      "max": [
        1,
        2.2,
        1
      ]
    },
    "groundedPivot": true
  },
  "params": {
    "plinthSizeM": 2,
    "plinthTopY": 0.2,
    "plinthTierCount": 2,
    "plinthTierHeightsM": [
      0.1,
      0.1
    ],
    "octagonChamferM": 0.29,
    "stepCount": 2,
    "stepRiseM": 0.1,
    "stepTreadM": 0.14,
    "stepWidthM": 0.62,
    "paverSizeM": 0.18,
    "paverRecessM": 0.006,
    "toriiSpanM": 0.95,
    "toriiPillarDiaM": 0.09,
    "toriiPillarBaseDiaM": 0.15,
    "toriiPillarBaseHM": 0.1,
    "toriiTopY": 1.95,
    "kasagiLengthM": 1.3,
    "kasagiUpturnM": 0.07,
    "nukiY": 1.46,
    "nukiLengthM": 1.12,
    "plaqueSizeM": [
      0.12,
      0.18,
      0.025
    ],
    "norenSizeM": [
      0.7,
      0.52
    ],
    "norenPanels": 3,
    "lanternHeightM": 0.62,
    "lanternFlameK": 2300,
    "basinDiaM": 0.32,
    "treeHeightM": 2,
    "planterSizeM": [
      0.42,
      0.22,
      0.42
    ],
    "bevelMm": 2.5,
    "contactOverlapM": 0.004
  },
  "materials": {
    "basalt_mossy": {
      "recipe": "travertine_marble",
      "palette": [
        "#1A1C22",
        "#2B2E33",
        "#3B3F45",
        "#4F6B2E"
      ],
      "roughness": [
        0.72,
        0.95
      ],
      "bumpStrength": 0.32,
      "scale": 1.4,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.18,
      "edgeBevelMm": 3.5
    },
    "limestone_weathered": {
      "recipe": "travertine_marble",
      "palette": [
        "#B9AE97",
        "#CFC5AE",
        "#9C927C",
        "#A8A08A"
      ],
      "roughness": [
        0.6,
        0.9
      ],
      "bumpStrength": 0.24,
      "scale": 1,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.16,
      "edgeBevelMm": 3
    },
    "moss_cushion": {
      "recipe": "boucle_fabric",
      "palette": [
        "#3E5A22",
        "#4F6B2E",
        "#6B8A3A",
        "#2E4419"
      ],
      "roughness": [
        0.85,
        1
      ],
      "bumpStrength": 0.45,
      "scale": 2.2,
      "coat": 0,
      "sheen": 0.35,
      "anisotropy": 0,
      "perIslandVar": 0.22,
      "edgeBevelMm": 1
    },
    "vermilion_lacquer": {
      "recipe": "wood_plank",
      "palette": [
        "#C8321E",
        "#A82816",
        "#D9482E",
        "#6A1A10"
      ],
      "roughness": [
        0.28,
        0.55
      ],
      "bumpStrength": 0.12,
      "scale": 0.8,
      "coat": 0.55,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.12,
      "edgeBevelMm": 2.5
    },
    "lacquer_black_cap": {
      "recipe": "wood_plank",
      "palette": [
        "#121214",
        "#1E1E22",
        "#2A2622"
      ],
      "roughness": [
        0.3,
        0.5
      ],
      "bumpStrength": 0.08,
      "scale": 0.8,
      "coat": 0.6,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.08,
      "edgeBevelMm": 2.5
    },
    "bronze_patina": {
      "recipe": "brushed_metal",
      "palette": [
        "#7A5A2E",
        "#5E4422",
        "#4A8C7A",
        "#2F6B5C"
      ],
      "roughness": [
        0.35,
        0.7
      ],
      "bumpStrength": 0.15,
      "scale": 1,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0.3,
      "perIslandVar": 0.2,
      "edgeBevelMm": 1.5
    },
    "gold_leaf": {
      "recipe": "brushed_metal",
      "palette": [
        "#D4A63A",
        "#E8C27A",
        "#B8892A"
      ],
      "roughness": [
        0.18,
        0.4
      ],
      "bumpStrength": 0.1,
      "scale": 1,
      "coat": 0.2,
      "sheen": 0,
      "anisotropy": 0.2,
      "perIslandVar": 0.1,
      "edgeBevelMm": 1
    },
    "noren_indigo_cloth": {
      "recipe": "boucle_fabric",
      "palette": [
        "#1F2E5C",
        "#16224A",
        "#2A3C72",
        "#D4A63A"
      ],
      "roughness": [
        0.7,
        0.92
      ],
      "bumpStrength": 0.2,
      "scale": 3,
      "coat": 0,
      "sheen": 0.45,
      "anisotropy": 0,
      "perIslandVar": 0.06,
      "edgeBevelMm": 0.5
    },
    "granite_lantern": {
      "recipe": "travertine_marble",
      "palette": [
        "#8E8A84",
        "#6F6B66",
        "#A9A49C",
        "#4F6B2E"
      ],
      "roughness": [
        0.65,
        0.92
      ],
      "bumpStrength": 0.28,
      "scale": 1.6,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.15,
      "edgeBevelMm": 2.5
    },
    "flame_core": {
      "recipe": "warm_filament",
      "palette": [
        "#FFB050",
        "#FF8A2A",
        "#FFD58A"
      ],
      "roughness": [
        0.4,
        0.6
      ],
      "bumpStrength": 0,
      "scale": 1,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "kelvin": 2300,
      "emissionStrength": 18,
      "perIslandVar": 0.05,
      "edgeBevelMm": 0.5
    },
    "basin_water": {
      "recipe": "arch_glass",
      "palette": [
        "#0C1418",
        "#1A2A30",
        "#2A3A4A"
      ],
      "roughness": [
        0.02,
        0.08
      ],
      "bumpStrength": 0.05,
      "scale": 1,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0,
      "edgeBevelMm": 0.5
    },
    "bamboo_cured": {
      "recipe": "wood_plank",
      "palette": [
        "#B89A5A",
        "#9C7E42",
        "#6E7A3A"
      ],
      "roughness": [
        0.35,
        0.6
      ],
      "bumpStrength": 0.12,
      "scale": 0.6,
      "coat": 0.15,
      "sheen": 0,
      "anisotropy": 0.2,
      "perIslandVar": 0.12,
      "edgeBevelMm": 1
    },
    "ceramic_offering": {
      "recipe": "ceramic_plaster",
      "palette": [
        "#E9E2D2",
        "#C9BFA8",
        "#2A3A4A",
        "#8A3A22"
      ],
      "roughness": [
        0.2,
        0.45
      ],
      "bumpStrength": 0.08,
      "scale": 1,
      "coat": 0.35,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.14,
      "edgeBevelMm": 1.5
    },
    "olive_bark": {
      "recipe": "wood_plank",
      "palette": [
        "#5A4E3E",
        "#3E352A",
        "#7A6E5A",
        "#4F6B2E"
      ],
      "roughness": [
        0.75,
        0.98
      ],
      "bumpStrength": 0.5,
      "scale": 1.2,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.2,
      "edgeBevelMm": 2
    },
    "olive_leaf": {
      "recipe": "boucle_fabric",
      "palette": [
        "#6E7F4A",
        "#8C9A62",
        "#4E5E34",
        "#A9B07E"
      ],
      "roughness": [
        0.45,
        0.7
      ],
      "bumpStrength": 0.1,
      "scale": 1,
      "coat": 0,
      "sheen": 0.5,
      "anisotropy": 0,
      "perIslandVar": 0.25,
      "edgeBevelMm": 0.3
    },
    "river_pebble": {
      "recipe": "travertine_marble",
      "palette": [
        "#5C5A56",
        "#8A867E",
        "#3A3836",
        "#B0A994"
      ],
      "roughness": [
        0.35,
        0.7
      ],
      "bumpStrength": 0.1,
      "scale": 0.8,
      "coat": 0,
      "sheen": 0,
      "anisotropy": 0,
      "perIslandVar": 0.3,
      "edgeBevelMm": 2
    }
  },
  "sharedWalls": [
    {
      "id": "rear_parapet",
      "a": [
        -0.62,
        -0.9
      ],
      "b": [
        0.62,
        -0.9
      ],
      "heightM": 0.42,
      "thickM": 0.12,
      "mat": "limestone_weathered",
      "frameMat": "basalt_mossy",
      "openings": [
        {
          "id": "rear_lattice_window",
          "type": "rect",
          "offsetM": 0.47,
          "widthM": 0.3,
          "bottomM": 0.26,
          "heightM": 0.12,
          "mullionCols": 3,
          "mullionRows": 1,
          "openPassage": false
        }
      ]
    }
  ],
  "groups": [
    {
      "id": "courtyard_plinth",
      "name": "Stepped Octagonal Basalt & Limestone Courtyard Plinth",
      "category": "architecture/plinth",
      "role": "architecture",
      "reusable": true,
      "tags": [
        "octagonal",
        "stepped",
        "basalt",
        "limestone",
        "moss",
        "pavers",
        "steps"
      ],
      "pos": [
        0,
        0,
        0
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          2,
          0.2,
          2
        ]
      },
      "attach": {
        "parent": "ground",
        "mode": "seat_on",
        "face": "-y",
        "offset": [
          0,
          0,
          0
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 137,
        "summary": "Stepped Octagonal Basalt & Limestone Courtyard Plinth",
        "code": "def build(ctx):\n    P = ctx.params\n    rng = random.Random(ctx.seed or 11)\n    half = P.get(\"plinthSizeM\", 2.0) * 0.5\n    cham = P.get(\"octagonChamferM\", 0.29)\n    t1 = P.get(\"plinthTierHeightsM\", [0.1, 0.1])[0]\n    top_y = P.get(\"plinthTopY\", 0.2)\n    sw = P.get(\"stepWidthM\", 0.62) * 0.5\n    tread = P.get(\"stepTreadM\", 0.14)\n    ps = P.get(\"paverSizeM\", 0.18)\n    ov = P.get(\"contactOverlapM\", 0.004)\n    rec, inset, cw, k2 = 0.008, 0.08, 0.07, math.sqrt(2) - 1\n    basalt = ctx.make_material(\"basalt_charcoal_course\", base_color=\"#24262B\", roughness=0.9, noise_scale=34.0,\n                               bump_strength=0.34, ao_wear=0.35, ao_color=\"#3E5A22\", edge_bevel_mm=3.0)\n    lime = ctx.make_material(\"limestone_porous_warm\", base_color=\"#ADA391\", roughness=0.86, noise_scale=40.0,\n                             bump_strength=0.3, ao_wear=0.3, ao_color=\"#7A705E\", edge_bevel_mm=3.0)\n    lime_b = ctx.make_material(\"limestone_porous_warm_b\", base_color=\"#9C9282\", roughness=0.9, noise_scale=36.0,\n                               bump_strength=0.32, ao_wear=0.35, ao_color=\"#6E6452\", edge_bevel_mm=3.0)\n    lime_c = ctx.make_material(\"limestone_porous_warm_c\", base_color=\"#BDB4A0\", roughness=0.82, noise_scale=44.0,\n                               bump_strength=0.26, ao_wear=0.25, edge_bevel_mm=3.0)\n    moss = ctx.mat(\"moss_cushion\")\n\n    def octo(h, c):\n        return [(h - c, h), (h, h - c), (h, -(h - c)), (h - c, -h),\n                (-(h - c), -h), (-h, -(h - c)), (-h, h - c), (-(h - c), h)]\n\n    def prism(name, poly, y0, y1, mat, bev=0.003):\n        bm = ctx.new_bmesh()\n        bot = [bm.verts.new(ctx.p(x, y0, z)) for x, z in poly]\n        top = [bm.verts.new(ctx.p(x, y1, z)) for x, z in poly]\n        bm.faces.new(top)\n        bm.faces.new(list(reversed(bot)))\n        for i in range(len(poly)):\n            j = (i + 1) % len(poly)\n            bm.faces.new([bot[i], bot[j], top[j], top[i]])\n        bmesh.ops.recalc_face_normals(bm, faces=list(bm.faces))\n        try:\n            bmesh.ops.bevel(bm, geom=list(bm.edges), offset=bev, segments=1, profile=0.5,\n                            affect='EDGES', clamp_overlap=True)\n            bmesh.ops.recalc_face_normals(bm, faces=list(bm.faces))\n        except Exception:\n            pass\n        ctx.commit_bmesh(bm, name, mat=mat, smooth_angle_deg=35.0, already_zup=True)\n\n    # Charcoal basalt course (full octagon) + porous limestone tier notched for the +Z stair\n    prism(\"plinth_tier_basalt\", octo(half, cham), 0.0, t1, basalt, 0.0035)\n    hu, cu = half - inset, cham - inset * k2\n    notch_z = half - tread\n    bed_y = top_y - rec - 0.014\n    up = octo(hu, cu)[:-1] + [(-(hu - cu), hu), (-sw, hu), (-sw, notch_z), (sw, notch_z), (sw, hu)]\n    prism(\"plinth_tier_limestone\", up, t1 - ov, bed_y, lime)\n    # Mitred coping ring (top at top_y), paver bed recessed 8mm inside it\n    O, I = octo(hu, cu), octo(hu - cw, cu - cw * k2)\n    for i in range(8):\n        j = (i + 1) % 8\n        if i == 7:\n            for s in (-1, 1):\n                prism(\"coping_front_%d\" % s, [(s * (hu - cu), hu), (s * (sw + 0.06), hu),\n                      (s * (sw + 0.06), hu - cw), (s * (hu - cw - (cu - cw * k2)), hu - cw)],\n                      bed_y - ov, top_y, lime_c)\n            continue\n        prism(\"coping_%d\" % i, [O[i], O[j], I[j], I[i]], bed_y - ov, top_y, lime_c)\n    # Carved stair: tread slab, landing sill, basalt cheek walls\n    prism(\"stair_tread_1\", [(-sw, notch_z), (sw, notch_z), (sw, half - 0.004), (-sw, half - 0.004)],\n          t1 - 0.012, t1 + 0.004, lime_c)\n    prism(\"stair_landing_sill\", [(-sw - 0.06, notch_z - 0.075), (sw + 0.06, notch_z - 0.075),\n          (sw, notch_z), (-sw, notch_z)], bed_y - ov, top_y, lime_c)\n    for s in (-1, 1):\n        x0, x1 = s * sw, s * (sw + 0.06)\n        prism(\"stair_cheek_%d\" % s, [(x0, notch_z - 0.02), (x1, notch_z - 0.02), (x1, half - 0.008),\n              (x0, half - 0.008)], t1 - ov, top_y, basalt)\n\n    # Staggered running-bond flagstones, clipped to the bed, varied chips + tilt + tint\n    lim, diag = hu - cw - 0.004, 2 * (hu - cw) - (cu - cw * k2) - 0.012\n    rows, crossings = int(2 * lim / ps) + 2, []\n    for r in range(rows):\n        cz = -lim + ps * 0.5 + r * ps\n        off = (r % 2) * ps * 0.5\n        for c in range(-1, rows + 1):\n            cx = -lim + c * ps + off + ps * 0.5\n            g = rng.uniform(0.006, 0.013)\n            xa, xb = max(cx - ps * 0.5 + g * 0.5, -lim), min(cx + ps * 0.5 - g * 0.5, lim)\n            za, zb = max(cz - ps * 0.5 + g * 0.5, -lim), min(cz + ps * 0.5 - g * 0.5, lim)\n            if xb - xa < 0.05 or zb - za < 0.05:\n                continue\n            if max(abs(xa), abs(xb)) + max(abs(za), abs(zb)) > diag:\n                continue\n            if xa < sw + 0.07 and xb > -sw - 0.07 and zb > notch_z - 0.082:\n                continue\n            th = 0.014 + rng.uniform(-0.0018, 0.0012)\n            ctx.add_bevel_box(\"paver_%02d_%02d\" % (r, c + 1), (xb - xa, th, zb - za),\n                              pos=((xa + xb) * 0.5, bed_y + th * 0.5 - 0.001, (za + zb) * 0.5),\n                              rot_deg=(rng.uniform(-0.6, 0.6), rng.uniform(-1.2, 1.2), rng.uniform(-0.6, 0.6)),\n                              bevel=rng.choice([0.0015, 0.0025, 0.004, 0.006]), segs=rng.choice([1, 2, 3]),\n                              chamfer_bottom=rng.uniform(0.0, 0.002), mat=rng.choice([lime, lime, lime_b, lime_c]))\n            crossings.append((xb + g * 0.5, zb + g * 0.5))\n\n    # Moss: irregular clumps growing up out of recessed joints, bed corners and the north basalt ledge\n    def clump(tag, x, y, z, n, spread, sz):\n        for q in range(n):\n            ctx.add_cushion(\"moss_%s_%d\" % (tag, q), (sz * rng.uniform(0.5, 1.2), 0.012, sz * rng.uniform(0.4, 0.9)),\n                            pos=(x + rng.uniform(-spread, spread), y, z + rng.uniform(-spread, spread)),\n                            rot_deg=(0, rng.uniform(0, 180), 0), puff=0.75, crease=0.1, subdiv=2, mat=moss)\n    rng.shuffle(crossings)\n    for m, (jx, jz) in enumerate(crossings[:11]):\n        clump(\"joint%02d\" % m, jx, bed_y + 0.005, jz, rng.randint(2, 4), 0.018, 0.026)\n    for m in range(6):\n        clump(\"north%d\" % m, rng.uniform(-(half - cham), half - cham), t1 + 0.004,\n              -(hu + 0.028), rng.randint(2, 4), 0.02, 0.04)\n    for s in (-1, 1):\n        clump(\"nosing%d\" % s, s * (sw - 0.02), t1 + 0.006, notch_z + 0.012, 3, 0.01, 0.03)\n\n    ctx.surface_story(\"basalt_charcoal_course\", edge_wear=0.3, dust=0.1, grime_height=0.12, scratches=0.08,\n                      wear_color=\"#4F6B2E\")\n    for key in (\"limestone_porous_warm\", \"limestone_porous_warm_b\", \"limestone_porous_warm_c\"):\n        ctx.surface_story(key, edge_wear=0.45, dust=0.2, grime_height=0.06, scratches=0.12, wear_color=\"#CFC5AE\")"
      }
    },
    {
      "id": "torii_gate",
      "name": "Vermilion Cedar Torii with Basalt Bases",
      "category": "architecture/gate",
      "role": "hero_furniture",
      "reusable": true,
      "tags": [
        "torii",
        "vermilion",
        "lacquer",
        "kasagi",
        "nuki",
        "bronze",
        "gilded_plaque"
      ],
      "pos": [
        0,
        0.196,
        -0.05
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          1.3,
          1.75,
          0.3
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          0,
          0,
          -0.05
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 139,
        "summary": "Vermilion Cedar Torii with Basalt Bases",
        "code": "def build(ctx):\n    P = ctx.params\n    half = P.get(\"toriiSpanM\", 0.95) * 0.5\n    pil_r = P.get(\"toriiPillarDiaM\", 0.09) * 0.5\n    base_r = P.get(\"toriiPillarBaseDiaM\", 0.15) * 0.5\n    base_h = P.get(\"toriiPillarBaseHM\", 0.10)\n    ov = P.get(\"contactOverlapM\", 0.004)\n    bev = P.get(\"bevelMm\", 2.5) * 0.001\n    nuki_y = P.get(\"nukiY\", 1.46) - P.get(\"plinthTopY\", 0.2)          # local 1.26\n    nuki_len, kas_len = P.get(\"nukiLengthM\", 1.12), P.get(\"kasagiLengthM\", 1.3)\n    upturn = P.get(\"kasagiUpturnM\", 0.07)\n    pw, ph, pt = P.get(\"plaqueSizeM\", [0.12, 0.18, 0.025])\n\n    # Long, low-frequency cedar grain under chipped lacquer (no ring banding); satin roof cap\n    M_ver = ctx.make_material(\"torii_cedar_vermilion\", base_color=\"#C8321E\", roughness=0.42, coat=0.3,\n                              noise_scale=4.0, bump_strength=0.06, ao_wear=0.35, ao_color=\"#6A1A10\", edge_bevel_mm=2.5)\n    M_cap = ctx.make_material(\"torii_kasagi_satin\", base_color=\"#1A1A1E\", roughness=0.38, coat=0.12,\n                              noise_scale=5.0, bump_strength=0.07, ao_wear=0.25, ao_color=\"#2A2622\", edge_bevel_mm=2.5)\n    M_plq = ctx.make_material(\"torii_plaque_ground\", base_color=\"#1F2E5C\", roughness=0.5, coat=0.2,\n                              noise_scale=9.0, bump_strength=0.04, edge_bevel_mm=1.0)\n    M_bas, M_brz, M_gold = ctx.mat(\"basalt_mossy\"), ctx.mat(\"bronze_patina\"), ctx.mat(\"gold_leaf\")\n    ctx.surface_story(\"torii_cedar_vermilion\", edge_wear=0.45, dust=0.1, grime_height=0.3, scratches=0.16, wear_color=\"#6A1A10\")\n    ctx.surface_story(\"torii_kasagi_satin\", edge_wear=0.25, dust=0.18, scratches=0.1, wear_color=\"#3A2E26\")\n    ctx.surface_story(\"basalt_mossy\", edge_wear=0.2, dust=0.25, grime_height=0.35, scratches=0.05)\n    ctx.surface_story(\"bronze_patina\", edge_wear=0.35, dust=0.1, scratches=0.15, wear_color=\"#4A8C7A\")\n    ctx.surface_story(\"gold_leaf\", edge_wear=0.4, dust=0.06, scratches=0.08, wear_color=\"#7A5A2E\")\n\n    shim_h, kas_h = 0.08, 0.08\n    shim_y0 = 1.75 - kas_h - upturn - shim_h                       # 1.52\n    kas_y0 = shim_y0 + shim_h - ov\n    pil_y0 = base_h - ov\n    pil_len = shim_y0 + ov - pil_y0\n    lean = math.degrees(math.atan(0.03))\n\n    for side in (-1, 1):\n        x = side * half\n        ctx.add_lathe(f\"kamebara_{side}\", [(0.0, 0.0), (base_r, 0.0), (base_r, 0.024), (base_r - 0.005, 0.058),\n                      (pil_r + 0.013, 0.09), (pil_r + 0.006, base_h), (0.0, base_h)],\n                      pos=(x, 0.0, 0.0), segs=40, cap=True, lip_bevel=0.003, mat=M_bas)\n        # Single smooth taper (no intermediate ring) -> grain runs unbroken along the post\n        ctx.add_lathe(f\"pillar_{side}\", [(0.0, 0.0), (pil_r, 0.0), (pil_r * 0.9, pil_len), (0.0, pil_len)],\n                      pos=(x, pil_y0, 0.0), rot_deg=(0, 0, side * lean), segs=36, cap=True, lip_bevel=bev, mat=M_ver)\n        ctx.add_lathe(f\"pillar_foot_{side}\", [(0.0, 0.0), (pil_r + 0.005, 0.0), (pil_r + 0.005, 0.018), (0.0, 0.018)],\n                      pos=(x, pil_y0 - 0.002, 0.0), segs=36, cap=True, lip_bevel=0.0015, mat=M_cap)\n        x_top = x - side * 0.03 * (pil_len - 0.015)\n        ctx.add_lathe(f\"pillar_endcap_{side}\", [(0.0, 0.0), (pil_r * 0.9 + 0.006, 0.0), (pil_r * 0.9 + 0.006, 0.03), (0.0, 0.03)],\n                      pos=(x_top, shim_y0 - 0.03 + ov, 0.0), segs=36, cap=True, lip_bevel=0.0015, mat=M_brz)\n        xn = x - side * 0.03 * (nuki_y - pil_y0)\n        ctx.add_bevel_box(f\"kusabi_{side}\", (0.03, 0.10, 0.06), pos=(xn + side * (pil_r + 0.017), nuki_y, 0.0),\n                          rot_deg=(0, 0, side * 4.0), bevel=0.002, mat=M_ver)\n\n    # Nuki tie-beam + flush lacquered pin rail with three hanging pegs (cloth seats on peg tips)\n    ctx.add_bevel_box(\"nuki\", (nuki_len, 0.09, 0.05), pos=(0, nuki_y, 0), bevel=bev, segs=3, mat=M_ver)\n    rail_y = nuki_y - 0.045 - 0.006 + ov\n    ctx.add_bevel_box(\"noren_pin_socket\", (0.72, 0.012, 0.018), pos=(0, rail_y, 0), bevel=0.0015, mat=M_cap)\n    for i, px in enumerate((-0.2333, 0.0, 0.2333)):\n        ctx.add_lathe(f\"noren_pin_{i}\", [(0.0, 0.0), (0.005, 0.0), (0.004, 0.014), (0.0, 0.014)],\n                      pos=(px, rail_y - 0.006 - 0.014 + ov, 0.0), segs=16, cap=True, mat=M_cap)\n\n    ctx.add_bevel_box(\"shimaki\", (kas_len - 0.1, shim_h, 0.12), pos=(0, shim_y0 + shim_h * 0.5, 0),\n                      bevel=bev, segs=3, mat=M_ver)\n\n    # Kasagi: closed swept beam, parabolic upturn kept; satin roughness kills the mirror stripe\n    bm = ctx.new_bmesh()\n    hl, d, N = kas_len * 0.5 - 0.008, 0.085, 40\n    rings = []\n    for i in range(N + 1):\n        x = -hl + 2 * hl * i / N\n        t = abs(x) / hl\n        yb = kas_y0 + upturn * t ** 2.4\n        dd = d * (1.0 + 0.12 * t)\n        rings.append([bm.verts.new(ctx.p(x, yb, -dd)), bm.verts.new(ctx.p(x, yb, dd)),\n                      bm.verts.new(ctx.p(x, yb + kas_h, dd + 0.01)), bm.verts.new(ctx.p(x, yb + kas_h, -dd - 0.01))])\n    for a, b in zip(rings[:-1], rings[1:]):\n        for k in range(4):\n            bm.faces.new((a[k], b[k], b[(k + 1) % 4], a[(k + 1) % 4]))\n    bm.faces.new(list(reversed(rings[0])))\n    bm.faces.new(rings[-1])\n    bmesh.ops.recalc_face_normals(bm, faces=bm.faces)\n    ctx.commit_bmesh(bm, \"kasagi\", mat=M_cap, smooth_angle_deg=30.0)\n\n    for side in (-1, 1):\n        ctx.add_bevel_box(f\"kasagi_endcap_{side}\", (0.018, kas_h + 0.012, 2 * d * 1.12 + 0.03),\n                          pos=(side * (hl - 0.006), kas_y0 + upturn + kas_h * 0.5, 0), bevel=0.0015, mat=M_brz)\n\n    # Gakuzuka strut + plaque with raised gilded border and bold gilt glyphs\n    strut_y0 = nuki_y + 0.045 - ov\n    strut_h = shim_y0 + ov - strut_y0\n    ctx.add_bevel_box(\"gakuzuka\", (0.05, strut_h, 0.04), pos=(0, strut_y0 + strut_h * 0.5, 0), bevel=bev, mat=M_ver)\n    py = strut_y0 + strut_h * 0.5\n    fz = 0.02 - ov\n    ctx.add_bevel_box(\"plaque_face\", (pw, ph, pt), pos=(0, py, fz + pt * 0.5), bevel=0.0015, mat=M_plq)\n    bw, bz = 0.014, fz + (pt + 0.007) * 0.5\n    for nm, sz, pos in ((\"top\", (pw + bw, bw, pt + 0.007), (0, py + ph * 0.5, bz)),\n                        (\"bot\", (pw + bw, bw, pt + 0.007), (0, py - ph * 0.5, bz)),\n                        (\"l\", (bw, ph - bw + 0.002, pt + 0.007), (-pw * 0.5, py, bz)),\n                        (\"r\", (bw, ph - bw + 0.002, pt + 0.007), (pw * 0.5, py, bz))):\n        ctx.add_bevel_box(f\"plaque_border_{nm}\", sz, pos=pos, bevel=0.002, segs=2, mat=M_gold)\n    for j, gy in enumerate((0.04, -0.035)):\n        ctx.add_bevel_box(f\"plaque_glyph_{j}\", (0.05, 0.05, 0.004), pos=(0, py + gy, fz + pt + 0.0015),\n                          bevel=0.0012, mat=M_gold)"
      }
    },
    {
      "id": "noren_banner",
      "name": "Indigo & Gold PBD Cloth Noren",
      "category": "textile/banner",
      "role": "decor",
      "reusable": false,
      "tags": [
        "noren",
        "pbd_cloth",
        "indigo",
        "gold_trim",
        "wind"
      ],
      "pos": [
        0,
        0.9,
        -0.05
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.72,
          0.54,
          0.06
        ]
      },
      "attach": {
        "parent": "torii_gate",
        "mode": "hang_from",
        "face": "-y",
        "offset": [
          0,
          1.24,
          0
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 137,
        "summary": "Indigo & Gold PBD Cloth Noren",
        "code": "def build(ctx):\n    P = ctx.params\n    W, H = P.get(\"norenSizeM\", [0.70, 0.52])\n    n_pan = int(P.get(\"norenPanels\", 3))\n    ov = float(P.get(\"contactOverlapM\", 0.004))\n    # fine directional indigo weave (high-frequency grain), narrow gold thread, lacquered rod\n    cloth = ctx.make_material(\"noren_indigo_weave\", base_color=\"#1F2E5C\", roughness=0.82,\n                              sheen=0.45, noise_scale=180.0, bump_strength=0.22,\n                              ao_wear=0.15, ao_color=\"#16224A\", edge_bevel_mm=0.5)\n    gold = ctx.mat(\"gold_leaf\")\n    rod_m = ctx.mat(\"lacquer_black_cap\")\n    ctx.surface_story(\"gold_leaf\", edge_wear=0.35, dust=0.10, scratches=0.15)\n    ctx.surface_story(\"lacquer_black_cap\", edge_wear=0.2, dust=0.12, scratches=0.08)\n\n    # --- vertical stack: local y=0 is the lowest hem contact ---\n    hem_r = 0.006\n    hem_y = hem_r\n    rod_r = 0.008\n    sleeve_h, sleeve_d = 0.05, 0.024\n    rod_y = 0.54 - sleeve_h * 0.5 - 0.001          # sleeve top seats at ~0.539\n    sleeve_bot = rod_y - sleeve_h * 0.5\n    pan_top = sleeve_bot + 0.010                   # cloth heads tuck deep into sleeve\n    pan_len = pan_top - hem_y + 0.002\n    gap = 0.012\n    pan_w = (W - gap * (n_pan - 1)) / n_pan\n    half = W * 0.5\n\n    # --- lacquered rod threaded through the sleeve, gilded finials touching rod ends ---\n    ctx.add_tube(\"noren_rod\", [(-half - 0.004, rod_y, 0.0), (half + 0.004, rod_y, 0.0)],\n                 radius=rod_r, tubular_segs=8, radial_segs=14, mat=rod_m)\n    for sx in (-1, 1):\n        ctx.add_lathe(\"noren_rod_cap_%s\" % (\"L\" if sx < 0 else \"R\"),\n                      [(0.0, -0.010), (0.009, -0.008), (0.011, 0.0), (0.009, 0.008), (0.0, 0.010)],\n                      pos=(sx * (half + 0.004 + 0.008), rod_y, 0.0), rot_deg=(0, 0, 90),\n                      segs=18, mat=gold)\n\n    # --- top sleeve wrapping the rod (watertight padded box, rod embedded inside) ---\n    ctx.add_cushion(\"noren_sleeve\", (W, sleeve_h, sleeve_d), pos=(0.0, rod_y, 0.0),\n                    puff=0.18, crease=0.15, subdiv=2, mat=cloth)\n\n    # --- three PBD cloth panels: pinned top edge, extra subdiv + frames for fold slack ---\n    for i in range(n_pan):\n        cx = -half + pan_w * 0.5 + i * (pan_w + gap)\n        nm = \"noren_panel_%d\" % i\n        cy = pan_top - pan_len * 0.5\n        kw = dict(size=(pan_w, pan_len), pos=(cx, cy, 0.0), subdiv=32, frames=48,\n                  collider_names=[\"noren_sleeve\"], mat=cloth, thickness=0.0025)\n        try:\n            # thickness -> solidified 2.5 mm watertight shell; hem_trim -> rolled gold hem welded to sim mesh\n            ctx.drape_cloth(nm, pin_mode=\"top_edge\", wind=(0.6, 0.0, 1.8),\n                            hem_trim=True, **kw)\n        except TypeError:\n            ctx.drape_cloth(nm, **kw)\n            ctx.add_tube(nm + \"_hem\", [(cx - pan_w * 0.5 + 0.002, hem_y, 0.0),\n                                       (cx + pan_w * 0.5 - 0.002, hem_y, 0.0)],\n                         radius=hem_r, tubular_segs=12, radial_segs=12, mat=gold)\n\n        # woven gold seam band: straddles sleeve bottom (into sleeve by 7 mm) and clamps\n        # the pinned cloth head (cloth runs through it) -> zero gap to rail & own seam\n        band_h = 0.014\n        ctx.add_bevel_box(nm + \"_band\", (pan_w + 0.002, band_h, sleeve_d + 0.004),\n                          pos=(cx, sleeve_bot, 0.0), bevel=0.0012, segs=2, mat=gold)\n\n    # --- woven gold sun-disc mon on centre panel: 4 mm thick, centered through the pinned\n    #     cloth plane so it pierces both faces and stays bonded ---\n    mon_y = hem_y + pan_len * 0.62\n    mon_r = min(0.075, pan_w * 0.36)\n    t = 0.002\n    ctx.add_lathe(\"noren_mon_disc\",\n                  [(0.0, -t), (mon_r * 0.62, -t), (mon_r * 0.64, 0.0), (mon_r * 0.62, t), (0.0, t)],\n                  pos=(0.0, mon_y, 0.0), rot_deg=(90, 0, 0), segs=40, mat=gold)\n    ctx.add_lathe(\"noren_mon_ring\",\n                  [(mon_r * 0.80, -t), (mon_r, -t), (mon_r, t), (mon_r * 0.80, t), (mon_r * 0.80, -t)],\n                  pos=(0.0, mon_y, 0.0), rot_deg=(90, 0, 0), segs=48, mat=gold)\n    # twelve rays bridging disc to ring (overlapping both -> single attached cluster)\n    for k in range(12):\n        a = k * math.tau / 12.0\n        rr = mon_r * 0.72\n        ctx.add_bevel_box(\"noren_mon_ray_%02d\" % k, (0.004, mon_r * 0.22, 2 * t),\n                          pos=(math.sin(a) * rr, mon_y + math.cos(a) * rr, 0.0),\n                          rot_deg=(0, 0, -math.degrees(a)), bevel=0.0005, segs=1, mat=gold)"
      }
    },
    {
      "id": "olive_tree_planter",
      "name": "Gnarled Olive Tree in Raised Stone Planter",
      "category": "foliage/tree",
      "role": "foliage",
      "reusable": true,
      "tags": [
        "botanical_tree",
        "olive",
        "gnarled",
        "planter",
        "canopy"
      ],
      "pos": [
        0.6,
        0.196,
        -0.32
      ],
      "rotDeg": [
        0,
        -18,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.8,
          2,
          0.85
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          0.6,
          0,
          -0.32
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 139,
        "summary": "Gnarled Olive Tree in Raised Stone Planter",
        "code": "def build(ctx):\n    P = ctx.params\n    rng = ctx.rng\n    pw, ph, pd = P.get(\"planterSizeM\", [0.42, 0.22, 0.42])\n    bev = P.get(\"bevelMm\", 2.5) * 0.001\n    ov = P.get(\"contactOverlapM\", 0.004)\n    nuki_y = P.get(\"nukiY\", 1.46)\n    m_lime, m_bas = ctx.mat(\"limestone_weathered\"), ctx.mat(\"basalt_mossy\")\n    m_moss, m_bark, m_leaf = ctx.mat(\"moss_cushion\"), ctx.mat(\"olive_bark\"), ctx.mat(\"olive_leaf\")\n    ctx.surface_story(\"limestone_weathered\", edge_wear=0.45, dust=0.2, grime_height=0.12, scratches=0.15)\n    ctx.surface_story(\"basalt_mossy\", edge_wear=0.3, dust=0.12, grime_height=0.08, scratches=0.08)\n    ctx.surface_story(\"olive_bark\", edge_wear=0.15, dust=0.08, grime_height=0.35, scratches=0.04)\n\n    # --- Raised planter: basalt footing, limestone body, basalt coping rails (closed solids) ---\n    foot_h, cope_t = 0.03, 0.034\n    ctx.add_bevel_box(\"planter_footing\", (pw + 0.03, foot_h, pd + 0.03), pos=(0, foot_h * 0.5, 0), bevel=bev * 1.4, segs=3, mat=m_bas)\n    body_h = ph - foot_h - cope_t + 2 * ov\n    ctx.add_bevel_box(\"planter_body\", (pw, body_h, pd), pos=(0, foot_h - ov + body_h * 0.5, 0), bevel=bev, segs=3, mat=m_lime)\n    cw, rail, cope_y = pw + 0.04, 0.06, ph - cope_t * 0.5\n    side = cw - 2 * rail + 2 * ov\n    copes = []\n    for i, (sx, sz, px, pz) in enumerate([(cw, rail, 0, (cw - rail) * 0.5), (cw, rail, 0, -(cw - rail) * 0.5),\n                                          (rail, side, (cw - rail) * 0.5, 0), (rail, side, -(cw - rail) * 0.5, 0)]):\n        n = \"planter_coping_%d\" % i\n        ctx.add_bevel_box(n, (sx, cope_t, sz), pos=(px, cope_y, pz), bevel=bev, segs=2, mat=m_bas)\n        copes.append(n)\n    inner, soil_top = cw - 2 * rail, ph - 0.012\n    ctx.add_bevel_box(\"planter_soil\", (inner + 2 * ov, 0.04, inner + 2 * ov), pos=(0, soil_top - 0.02, 0), bevel=0.003, segs=2, mat=m_bas)\n    ctx.add_cushion(\"planter_moss_disc\", (inner - 0.01, 0.024, inner - 0.01), pos=(0, soil_top + 0.004, 0), puff=0.45, crease=0.1, subdiv=3, mat=m_moss)\n    moss_top = soil_top + 0.014\n\n    # --- Flared, asymmetric SDF root collar (watertight, no rings) ---\n    cx, cz, y0, y1 = 0.03, 0.0, moss_top - 0.03, moss_top + 0.24\n    def collar(p):\n        x, y, z = p[..., 0] - cx, p[..., 1] - y0, p[..., 2] - cz\n        th = np.arctan2(z, x)\n        fl = np.exp(-np.clip(y, 0, None) / 0.055)\n        r = 0.048 + 0.075 * fl\n        r = r * (1.0 + 0.32 * fl * np.cos(3 * th + 0.6) + 0.12 * np.cos(5 * th - 1.1)) - 0.012 * np.clip(y, 0, None)\n        r = r + 0.006 * np.sin(14 * y + 3 * th)\n        d = (np.sqrt(x * x + z * z) - r) * 0.7\n        return np.maximum(d, np.maximum(-y, y - (y1 - y0)))\n    ctx.sdf_mesh(\"olive_root_collar\", collar, (cx - 0.2, y0 - 0.01, cz - 0.2), (cx + 0.2, y1 + 0.01, cz + 0.2), res=72, mat=m_bark, smooth_iters=3)\n\n    # --- Exposed roots gripping the coping rim ---\n    half_c = cw * 0.5\n    for i, a in enumerate([0.3, 1.5, 2.5, 3.6, 4.7, 5.6]):\n        a += rng.uniform(-0.2, 0.2)\n        ca, sa = math.cos(a), math.sin(a)\n        rim = min(half_c / max(abs(ca), abs(sa)), half_c * 1.3)\n        pts = [(cx + 0.03 * ca, moss_top + 0.04, 0.03 * sa), (cx + 0.5 * rim * ca, moss_top + 0.012, 0.5 * rim * sa),\n               ((rim - rail * 0.5) * ca, ph + 0.01, (rim - rail * 0.5) * sa), ((rim + 0.007) * ca, ph - 0.035, (rim + 0.007) * sa)]\n        ctx.add_tube(\"olive_root_%d\" % i, pts, radius=0.017 + rng.uniform(0, 0.007), taper=[1.7, 1.0, 0.65, 0.4], tubular_segs=20, radial_segs=10, mat=m_bark)\n\n    # --- Tapered gnarled trunk -> offset fork below nuki height ---\n    fork = (-0.05, nuki_y - 0.38, 0.03)\n    trunk = [(cx, moss_top + 0.1, 0.0), (0.06, 0.55, -0.025), (0.02, 0.78, 0.02), (-0.03, 0.95, -0.01), fork]\n    ctx.add_tube(\"olive_trunk\", trunk, radius=0.05, taper=[1.0, 0.86, 0.8, 0.72, 0.66], tubular_segs=40, radial_segs=18, mat=m_bark)\n    # primary limb turns inward (-X) and arches over the kasagi end; secondary rises +X\n    limb_a = [fork, (-0.14, 1.32, 0.05), (-0.25, 1.62, 0.04), (-0.34, 1.80, 0.02), (-0.385, 1.84, 0.0)]\n    limb_b = [fork, (0.03, 1.30, -0.04), (0.14, 1.55, -0.08), (0.22, 1.70, -0.1)]\n    ctx.add_tube(\"olive_limb_primary\", limb_a, radius=0.034, taper=[1.0, 0.85, 0.62, 0.42, 0.3], tubular_segs=32, radial_segs=14, mat=m_bark)\n    ctx.add_tube(\"olive_limb_secondary\", limb_b, radius=0.028, taper=[1.0, 0.78, 0.55, 0.38], tubular_segs=28, radial_segs=12, mat=m_bark)\n\n    # --- Secondary twigs + clustered olive crowns (high, leaving a dark gap low on the -X side) ---\n    clusters = [((-0.25, 1.62, 0.04), (-0.30, 1.74, 0.16), 0.30, 0.17),\n                ((-0.34, 1.80, 0.02), (-0.37, 1.80, -0.12), 0.20, 0.15),\n                ((-0.14, 1.32, 0.05), (-0.10, 1.62, -0.10), 0.32, 0.16),\n                ((0.14, 1.55, -0.08), (0.24, 1.62, 0.10), 0.34, 0.17),\n                ((0.22, 1.70, -0.1), (0.18, 1.74, -0.24), 0.24, 0.15)]\n    for i, (s, e, h, cr) in enumerate(clusters):\n        mid = ((s[0] + e[0]) * 0.5, (s[1] + e[1]) * 0.5 + 0.03, (s[2] + e[2]) * 0.5)\n        ctx.add_tube(\"olive_twig_%d\" % i, [s, mid, e], radius=0.013, taper=[1.0, 0.7, 0.45], tubular_segs=14, radial_segs=8, mat=m_bark)\n        h = min(h, 1.98 - e[1])\n        ctx.add_botanical_tree(\"olive_crown_%d\" % i, origin=(e[0], e[1] - 0.02, e[2]), species=\"olive\", height=h,\n                               canopy_radius=cr, trunk_radius=0.008, branch_levels=3, leaf_count=190,\n                               bark_mat=m_bark, leaf_mat=m_leaf, seed=ctx.seed + 17 * i)\n\n    # --- Moss tufts settled on coping & soil (zero float) ---\n    tufts = []\n    for i in range(4):\n        a = rng.uniform(0, math.tau)\n        r = rng.uniform(half_c - rail * 0.7, half_c - rail * 0.3)\n        n = \"planter_moss_tuft_%d\" % i\n        ctx.add_cushion(n, (0.07, 0.018, 0.05), pos=(r * math.cos(a), ph + 0.05, r * math.sin(a)),\n                        rot_deg=(0, math.degrees(a), 0), puff=0.6, crease=0.05, subdiv=2, mat=m_moss)\n        tufts.append(n)\n    ctx.settle_group(tufts, target_names=copes + [\"planter_moss_disc\"], floor_y=0.0, inset=0.002)"
      }
    },
    {
      "id": "tsukubai_basin",
      "name": "Tsukubai Purification Basin with Bamboo Spout",
      "category": "water_feature/basin",
      "role": "decor",
      "reusable": true,
      "tags": [
        "tsukubai",
        "water",
        "basalt",
        "bamboo",
        "kakei"
      ],
      "pos": [
        -0.62,
        0.196,
        -0.34
      ],
      "rotDeg": [
        0,
        22,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.4,
          0.34,
          0.36
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          -0.62,
          0,
          -0.34
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 105,
        "summary": "Tsukubai Purification Basin with Bamboo Spout",
        "code": "def build(ctx):\n    P = ctx.params\n    basalt, water = ctx.mat(\"basalt_mossy\"), ctx.mat(\"basin_water\")\n    bamboo, moss, peb = ctx.mat(\"bamboo_cured\"), ctx.mat(\"moss_cushion\"), ctx.mat(\"river_pebble\")\n    ctx.surface_story(\"basalt_mossy\", edge_wear=0.3, dust=0.18, grime_height=0.08, scratches=0.1)\n    ctx.surface_story(\"bamboo_cured\", edge_wear=0.2, dust=0.08, grime_height=0.0, scratches=0.06)\n    rng = random.Random(ctx.seed)\n\n    # --- Basalt boulder basin: closed lathe shell (outer flank, rim lip, hollow bowl) ---\n    R = P.get(\"basinDiaM\", 0.32) * 0.5          # 0.16\n    H = 0.16\n    rim_y = H\n    prof = [(0.0, 0.0), (0.128, 0.0), (0.150, 0.018), (0.159, 0.055), (R, 0.105),\n            (0.150, 0.142), (0.134, rim_y), (0.114, rim_y - 0.004), (0.106, 0.128),\n            (0.090, 0.100), (0.060, 0.082), (0.0, 0.076)]\n    ctx.add_lathe(\"tsukubai_boulder\", prof, pos=(0, 0, 0), rot_deg=(0, rng.uniform(0, 40), 0),\n                  scale=(1.0, 1.0, 0.95), segs=int(40 * ctx.seg_scale) or 40, cap=True,\n                  lip_bevel=0.004, mat=basalt)\n\n    # --- Flat water surface 15 mm below rim (slab buried into bowl walls, watertight) ---\n    wy = rim_y - 0.015\n    ctx.add_lathe(\"tsukubai_water\", [(0.0, 0.088), (0.107, 0.088), (0.107, wy), (0.0, wy)],\n                  scale=(1.0, 1.0, 0.95), segs=40, cap=True, mat=water)\n\n    # --- Moss collar ringing the base (closed torus tube) ---\n    ring = [(0.158 * math.cos(a), 0.013, 0.150 * math.sin(a))\n            for a in [i * 2 * math.pi / 32 for i in range(32)]]\n    ctx.add_tube(\"tsukubai_moss_ring\", ring, radius=0.016, closed=True,\n                 tubular_segs=48, radial_segs=12, mat=moss)\n\n    # --- Three river pebbles seated on y=0 (closed half-profile lathes) ---\n    for i, (ang, r) in enumerate([(200, 0.020), (232, 0.016), (318, 0.018)]):\n        sph = [(r * math.sin(math.pi * k / 10), -r * math.cos(math.pi * k / 10)) for k in range(11)]\n        sy = rng.uniform(0.55, 0.7)\n        a = math.radians(ang)\n        ctx.add_lathe(\"tsukubai_pebble_%d\" % i, sph,\n                      pos=(0.175 * math.cos(a), r * sy - 0.001, 0.165 * math.sin(a)),\n                      rot_deg=(0, rng.uniform(0, 180), rng.uniform(-6, 6)),\n                      scale=(1.15, sy, 0.9), segs=20, cap=True, mat=peb)\n\n    # --- Crossed bamboo supports (X-trestle in the Z plane at +X side) ---\n    sx, lean, L = 0.175, 18.0, 0.33\n    cane = [(0.0, 0.0), (0.009, 0.0), (0.009, 0.15), (0.0105, 0.153), (0.009, 0.156),\n            (0.009, L), (0.0, L)]\n    ctx.add_lathe(\"tsukubai_support_a\", cane, pos=(sx, 0.0, -0.09), rot_deg=(-lean, 0, 0),\n                  segs=16, cap=True, mat=bamboo)\n    ctx.add_lathe(\"tsukubai_support_b\", cane, pos=(sx, 0.0, 0.09), rot_deg=(lean, 0, 0),\n                  segs=16, cap=True, mat=bamboo)\n    cross_y = 0.09 / math.tan(math.radians(lean))          # ~0.277\n    spout_r = 0.012\n    seat_y = cross_y + spout_r / math.sin(math.radians(lean)) - 0.003\n\n    # --- Kakei spout: cured cane with node ridge, closed tip angled over bowl ---\n    tilt = 95.0\n    sL = 0.15\n    spout = [(0.0, 0.0), (spout_r, 0.0), (spout_r, 0.07), (spout_r + 0.0015, 0.073),\n             (spout_r, 0.076), (spout_r, sL), (0.0, sL)]\n    back_x = 0.198\n    back_y = seat_y + (back_x - sx) * math.tan(math.radians(tilt - 90))\n    ctx.add_lathe(\"tsukubai_kakei_spout\", spout, pos=(back_x, back_y, 0.0),\n                  rot_deg=(0, 0, tilt), segs=18, cap=True, mat=bamboo)\n    tip_x = back_x - sL * math.sin(math.radians(tilt))\n    tip_y = back_y + sL * math.cos(math.radians(tilt))\n    ctx.add_lathe(\"basin_spout_tip\", [(0.0, 0.0), (spout_r + 0.0008, 0.0),\n                  (spout_r + 0.0008, 0.006), (0.0, 0.006)],\n                  pos=(tip_x + 0.004, tip_y, 0.0), rot_deg=(0, 0, tilt), segs=18, cap=True, mat=bamboo)\n\n    # --- Hishaku ladle laid across the rim ---\n    hr = 0.005\n    hy = rim_y + hr - 0.001\n    ctx.add_lathe(\"tsukubai_ladle_handle\", [(0.0, 0.0), (hr, 0.0), (hr, 0.24), (0.0, 0.24)],\n                  pos=(-0.05, hy, -0.12), rot_deg=(90, 0, 0), segs=12, cap=True, mat=bamboo)\n    cup = [(0.0, 0.0), (0.024, 0.0), (0.026, 0.04), (0.022, 0.04), (0.020, 0.004), (0.0, 0.004)]\n    ctx.add_lathe(\"tsukubai_ladle_cup\", cup, pos=(-0.05, hy - 0.022, -0.136),\n                  segs=20, cap=True, mat=bamboo)\n\n    ctx.settle_group([\"tsukubai_pebble_0\", \"tsukubai_pebble_1\", \"tsukubai_pebble_2\"],\n                     floor_y=0.0, inset=0.002)"
      }
    },
    {
      "id": "toro_lantern_left",
      "name": "Granite Toro Lantern (Left)",
      "category": "lighting/stone_lantern",
      "role": "lighting",
      "reusable": true,
      "tags": [
        "toro",
        "granite",
        "lantern",
        "2300K",
        "fog_glow"
      ],
      "pos": [
        -0.45,
        0.196,
        0.5
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.26,
          0.62,
          0.26
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          -0.45,
          0,
          0.5
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 106,
        "summary": "Granite Toro Lantern (Left)",
        "code": "def build(ctx):\n    # Kasuga-style granite toro lantern, Y-up, grounded at y=0, fits 0.26 x 0.62 x 0.26\n    granite = ctx.mat(\"granite_lantern\")\n    flame = ctx.mat(\"flame_core\")\n    moss = ctx.mat(\"moss_cushion\")\n    ctx.surface_story(\"granite_lantern\", edge_wear=0.4, dust=0.22, grime_height=0.18, scratches=0.1)\n    ctx.surface_story(\"moss_cushion\", edge_wear=0.0, dust=0.05, grime_height=0.0, scratches=0.0)\n    ov = ctx.params.get(\"contactOverlapM\", 0.004) * 0.5\n    bev = ctx.params.get(\"bevelMm\", 2.5) * 0.001\n    TAU = math.tau\n\n    # --- Kiso: hexagonal stepped base (y 0 .. 0.07)\n    kiso_h = 0.07\n    ctx.add_lathe(\"toroL_kiso\", [(0.0, 0.0), (0.118, 0.0), (0.118, 0.038), (0.104, 0.05),\n                                 (0.098, 0.056), (0.062, kiso_h), (0.0, kiso_h)],\n                  segs=6, lip_bevel=bev, mat=granite)\n\n    # --- Sao: ringed pillar (y 0.07 .. 0.24)\n    s0, s1 = kiso_h - ov, 0.24\n    sm = (s0 + s1) * 0.5\n    ctx.add_lathe(\"toroL_sao\", [(0.0, s0), (0.040, s0), (0.034, s0 + 0.02), (0.032, sm - 0.012),\n                                (0.039, sm - 0.006), (0.039, sm + 0.006), (0.032, sm + 0.012),\n                                (0.031, s1 - 0.02), (0.036, s1), (0.0, s1)],\n                  segs=24, lip_bevel=bev, mat=granite)\n\n    # --- Chudai: lotus platform (y 0.24 .. 0.30), petal ridges via 12-seg lotus band\n    c0, c1 = s1 - ov, 0.30\n    ctx.add_lathe(\"toroL_chudai_lotus\", [(0.0, c0), (0.042, c0), (0.07, c0 + 0.022),\n                                         (0.084, c0 + 0.034), (0.0, c0 + 0.034)],\n                  segs=12, lip_bevel=bev, mat=granite)\n    ctx.add_lathe(\"toroL_chudai_slab\", [(0.0, c0 + 0.032), (0.094, c0 + 0.032), (0.094, c1),\n                                        (0.0, c1)], segs=6, lip_bevel=bev, mat=granite)\n\n    # --- Hibukuro firebox (y 0.30 .. 0.42): corner posts, lattice, sun & moon windows\n    f0, f1 = c1 - ov, 0.42\n    fh = f1 - f0\n    fr = 0.068\n    corners = [(fr * math.cos(k * TAU / 6), fr * math.sin(k * TAU / 6)) for k in range(6)]\n    for k, (cx, cz) in enumerate(corners):\n        ctx.add_bevel_box(f\"toroL_fb_post{k}\", (0.02, fh, 0.02), pos=(cx, f0 + fh * 0.5, cz),\n                          rot_deg=(0, -k * 60.0, 0), bevel=bev, segs=2, mat=granite)\n    for k in range(6):\n        ax, az = corners[k]\n        bx, bz = corners[(k + 1) % 6]\n        mx, mz = (ax + bx) * 0.5, (az + bz) * 0.5\n        face_ang = math.atan2(mz, mx)\n        nx, nz = math.cos(face_ang), math.sin(face_ang)\n        if abs(nz) > 0.95:  # front (+Z) sun window, back (-Z) moon window\n            rr, off = 0.022, 0.004\n            yc = f0 + fh * 0.5\n            if nz > 0:\n                pts = [(mx + nx * off + rr * math.cos(t * TAU / 24), yc + rr * math.sin(t * TAU / 24),\n                        mz + nz * off) for t in range(24)]\n                ctx.add_tube(\"toroL_sun_ring\", pts, radius=0.004, closed=True, mat=granite)\n            else:\n                pts = [(mx + nx * off + rr * math.cos(a), yc + rr * math.sin(a), mz + nz * off)\n                       for a in np.linspace(math.radians(110), math.radians(250), 14)]\n                ctx.add_tube(\"toroL_moon_arc\", pts, radius=0.005, mat=granite)\n            for j, t in enumerate((0.15, 0.85)):\n                px, pz = ax + (bx - ax) * t, az + (bz - az) * t\n                ctx.add_bevel_box(f\"toroL_win_jamb{k}_{j}\", (0.008, fh, 0.008), pos=(px, f0 + fh * 0.5, pz),\n                                  bevel=0.0015, segs=1, mat=granite)\n        else:  # fine lattice panels keep the flame enclosed\n            for j, t in enumerate((0.25, 0.5, 0.75)):\n                px, pz = ax + (bx - ax) * t, az + (bz - az) * t\n                ctx.add_bevel_box(f\"toroL_lat{k}_{j}\", (0.006, fh, 0.006), pos=(px, f0 + fh * 0.5, pz),\n                                  bevel=0.0012, segs=1, mat=granite)\n            for j, yy in enumerate((f0 + fh * 0.35, f0 + fh * 0.68)):\n                ctx.add_tube(f\"toroL_latH{k}_{j}\", [(ax, yy, az), (bx, yy, bz)], radius=0.003, mat=granite)\n\n    # emitter socket + 2300K teardrop flame core, fully enclosed\n    ctx.add_lathe(\"toroL_socket\", [(0.0, f0), (0.022, f0), (0.024, f0 + 0.014), (0.0, f0 + 0.014)],\n                  segs=16, lip_bevel=0.001, mat=granite)\n    fy = f0 + 0.012\n    ctx.add_lathe(\"toroL_flame_core\", [(0.0, fy), (0.012, fy + 0.008), (0.019, fy + 0.026),\n                                       (0.014, fy + 0.05), (0.005, fy + 0.07), (0.0, fy + 0.078)],\n                  segs=20, mat=flame)\n\n    # --- Kasa: flared hexagonal roof (y 0.42 .. 0.535)\n    k0 = f1 - ov\n    ctx.add_lathe(\"toroL_kasa\", [(0.0, k0), (0.112, k0), (0.128, k0 + 0.022), (0.128, k0 + 0.032),\n                                 (0.088, k0 + 0.058), (0.042, k0 + 0.1), (0.03, 0.535), (0.0, 0.535)],\n                  segs=6, lip_bevel=bev, mat=granite)\n    # warabi curl tips at the six eave corners\n    for k in range(6):\n        a = k * TAU / 6\n        ca, sa = math.cos(a), math.sin(a)\n        pts = []\n        for i in range(12):\n            t = i / 11.0 * 1.6 * math.pi\n            r = 0.012 * (1.0 - 0.45 * i / 11.0)\n            rad = 0.114 + r * math.sin(t)\n            pts.append((rad * ca, k0 + 0.044 + r * (1 - math.cos(t)), rad * sa))\n        ctx.add_tube(f\"toroL_warabi{k}\", pts, radius=0.0045, taper=(1.0, 0.55), mat=granite)\n\n    # moss cushions on the north (-Z) roof faces\n    for i, (yaw, scl) in enumerate(((0.0, 1.0), (60.0, 0.7), (-60.0, 0.75))):\n        ya = math.radians(-90.0 + yaw)\n        d = 0.072\n        ctx.add_cushion(f\"toroL_moss{i}\", (0.07 * scl, 0.012, 0.05 * scl),\n                        pos=(d * math.sin(math.radians(yaw)), k0 + 0.064, -d * math.cos(math.radians(yaw))),\n                        rot_deg=(-42.0, -yaw, 0.0), puff=0.6, crease=0.1, subdiv=2, mat=moss)\n\n    # --- Hoju: jewel finial (y 0.535 .. 0.62)\n    h0 = 0.535 - ov\n    ctx.add_lathe(\"toroL_hoju\", [(0.0, h0), (0.026, h0), (0.018, h0 + 0.014), (0.031, h0 + 0.04),\n                                 (0.029, h0 + 0.06), (0.012, 0.612), (0.0, 0.62)],\n                  segs=24, lip_bevel=0.001, mat=granite)"
      }
    },
    {
      "id": "toro_lantern_right",
      "name": "Granite Toro Lantern (Right)",
      "category": "lighting/stone_lantern",
      "role": "lighting",
      "reusable": true,
      "tags": [
        "toro",
        "granite",
        "lantern",
        "2300K",
        "instance"
      ],
      "pos": [
        0.45,
        0.196,
        0.5
      ],
      "rotDeg": [
        0,
        180,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.26,
          0.62,
          0.26
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          0.45,
          0,
          0.5
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 107,
        "summary": "Granite Toro Lantern (Right)",
        "code": "def build(ctx):\n    P = ctx.params or {}\n    H = float(P.get(\"lanternHeightM\", 0.62))\n    s = H / 0.62                                   # uniform scale to hit target height\n    granite = ctx.mat(\"granite_lantern\")\n    flame = ctx.mat(\"flame_core\")\n    moss = ctx.mat(\"moss_cushion\")\n    ctx.surface_story(\"granite_lantern\", edge_wear=0.4, dust=0.22, grime_height=0.18, scratches=0.1,\n                      wear_color=\"#A9A49C\")\n    yaw = math.radians(180.0)                      # mirrored: moon window faces outward\n    cy, sy = math.cos(yaw), math.sin(yaw)\n    def R(x, z):                                   # yaw a local (x,z) offset about Y\n        return (x * cy + z * sy, -x * sy + z * cy)\n    ov = float(P.get(\"contactOverlapM\", 0.004))\n    segs = max(16, int(32 * ctx.seg_scale))\n\n    # 1) Kiso – hexagonal plinth foot (y 0 .. 0.06)\n    y0, y1 = 0.0, 0.06 * s\n    ctx.add_lathe(\"lanR_kiso\", [(0.0, y0), (0.118, y0), (0.120, y0 + 0.012 * s), (0.112, y1 - 0.02 * s),\n                                (0.085, y1 - 0.008 * s), (0.06, y1), (0.0, y1)],\n                  segs=6, rot_deg=(0, 30, 0), lip_bevel=0.003, mat=granite)\n    # 2) Sao – turned pole with mid ring (0.06 .. 0.24)\n    y2 = 0.24 * s\n    ctx.add_lathe(\"lanR_sao\", [(0.0, y1 - ov), (0.05, y1 - ov), (0.04, y1 + 0.02 * s), (0.036, 0.14 * s),\n                               (0.046, 0.15 * s), (0.046, 0.16 * s), (0.036, 0.17 * s), (0.04, y2 - 0.015 * s),\n                               (0.052, y2 + ov), (0.0, y2 + ov)], segs=segs, lip_bevel=0.002, mat=granite)\n    # 3) Chudai – square platform under the firebox (0.24 .. 0.29)\n    y3 = 0.29 * s\n    ctx.add_bevel_box(\"lanR_chudai\", size=(0.19 * s, y3 - y2, 0.19 * s), pos=(0, (y2 + y3) / 2, 0),\n                      bevel=0.004, segs=3, chamfer_bottom=0.012 * s, mat=granite)\n    # 4) Hibukuro – firebox: 4 corner posts + top lintel (0.29 .. 0.43)\n    y4, y5 = 0.41 * s, 0.43 * s\n    post, half = 0.022 * s, 0.068 * s\n    for i, (px, pz) in enumerate([(-half, -half), (half, -half), (-half, half), (half, half)]):\n        ctx.add_bevel_box(f\"lanR_post{i}\", size=(post, y4 - y3 + 2 * ov, post),\n                          pos=(px, (y3 + y4) / 2, pz), bevel=0.002, segs=2, mat=granite)\n    ctx.add_bevel_box(\"lanR_lintel\", size=(0.16 * s, y5 - y4 + ov, 0.16 * s), pos=(0, (y4 + y5) / 2, 0),\n                      bevel=0.003, segs=2, mat=granite)\n    # side lattice slats on the ±X faces (yawed)\n    for side in (-1, 1):\n        for k in range(3):\n            lz = (-0.03 + 0.03 * k) * s\n            x, z = R(side * half, lz)\n            ctx.add_bevel_box(f\"lanR_slat{side}_{k}\", size=(0.008 * s, y4 - y3, 0.008 * s),\n                              pos=(x, (y3 + y4) / 2, z), bevel=0.001, segs=1, mat=granite)\n    # moon window ring on the back face (faces outward after yaw) + sun-hole on front\n    mx, mz = R(0.0, -half)\n    yc = (y3 + y4) / 2\n    ring = [(mx + 0.042 * s * math.cos(a), yc + 0.042 * s * math.sin(a), mz)\n            for a in [2 * math.pi * t / 28 for t in range(28)]]\n    ctx.add_tube(\"lanR_moon_ring\", ring, radius=0.007 * s, closed=True, tubular_segs=28, radial_segs=8, mat=granite)\n    ctx.add_bevel_box(\"lanR_moon_sill\", size=(0.12 * s, 0.012 * s, 0.012 * s),\n                      pos=(mx, y3 + 0.006 * s, mz), rot_deg=(0, 180, 0), bevel=0.002, mat=granite)\n    # 2300K flame core seated on chudai (socket lantern_r_firebox)\n    ctx.add_lathe(\"lanR_flame_core\", [(0.0, y3 - ov), (0.016 * s, y3 + 0.012 * s), (0.02 * s, y3 + 0.035 * s),\n                                      (0.012 * s, y3 + 0.07 * s), (0.0, y3 + 0.095 * s)], segs=20, mat=flame)\n    # 5) Kasa – square roof with upturned warabi eaves (0.43 .. 0.53)\n    rc = 0.178 * s                                   # corner radius -> 0.25m footprint\n    y6 = 0.53 * s\n    ctx.add_lathe(\"lanR_kasa\", [(0.0, y5 - ov), (0.09 * s, y5 - ov), (rc, y5 + 0.012 * s),\n                                (rc + 0.002, y5 + 0.026 * s), (0.13 * s, y5 + 0.04 * s),\n                                (0.06 * s, y6 - 0.018 * s), (0.035 * s, y6), (0.0, y6)],\n                  segs=4, rot_deg=(0, 45, 0), lip_bevel=0.003, mat=granite)\n    # 6) Hoju – onion finial with lotus collar (0.53 .. 0.62)\n    ctx.add_lathe(\"lanR_hoju\", [(0.0, y6 - ov), (0.03 * s, y6 - ov), (0.034 * s, y6 + 0.012 * s),\n                                (0.022 * s, y6 + 0.02 * s), (0.03 * s, y6 + 0.042 * s),\n                                (0.024 * s, y6 + 0.068 * s), (0.008 * s, y6 + 0.084 * s), (0.0, H)],\n                  segs=segs, mat=granite)\n    # 7) Moss pads – seed offset so the pair never reads as clones\n    rng = random.Random((ctx.seed or 0) + 7717)\n    spots = [(rng.uniform(0, 2 * math.pi), rng.uniform(0.05, 0.11) * s) for _ in range(rng.randint(3, 5))]\n    for i, (a, r) in enumerate(spots):\n        x, z = R(r * math.cos(a), r * math.sin(a))\n        frac = (r / s - 0.035) / (0.13 - 0.035)\n        yr = y6 - frac * (y6 - y5 - 0.04 * s)        # follows roof slope\n        pr = rng.uniform(0.016, 0.03) * s\n        ctx.add_lathe(f\"lanR_moss{i}\", [(0.0, -0.002), (pr, -0.002), (pr * 0.7, 0.006 * s), (0.0, 0.009 * s)],\n                      pos=(x, yr - 0.002, z), scale=(1.0, 1.0, rng.uniform(0.6, 1.0)), segs=14, mat=moss)\n    bx, bz = R(rng.uniform(-0.06, 0.06) * s, 0.08 * s)\n    ctx.add_lathe(\"lanR_moss_base\", [(0.0, y1 - 0.004), (0.03 * s, y1 - 0.004), (0.02 * s, y1 + 0.006 * s),\n                                     (0.0, y1 + 0.008 * s)], pos=(bx * 0.4, 0, bz * 0.4), segs=14, mat=moss)"
      }
    },
    {
      "id": "offering_clutter",
      "name": "Gravity-Settled Offerings Cluster",
      "category": "props/offerings",
      "role": "prop",
      "reusable": false,
      "tags": [
        "settle_group",
        "ceramic_bowls",
        "incense_censer",
        "bronze",
        "offerings"
      ],
      "pos": [
        0,
        0.196,
        0.38
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          0.9,
          0.18,
          0.3
        ]
      },
      "attach": {
        "parent": "courtyard_plinth",
        "mode": "seat_on",
        "face": "+y",
        "offset": [
          0,
          0,
          0.38
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 108,
        "summary": "Gravity-Settled Offerings Cluster",
        "code": "def build(ctx):\n    P = ctx.params or {}\n    stair_half = P.get(\"stepWidthM\", 0.62) * 0.5 + 0.02   # stair_walkway exclusion half-width\n    ov = P.get(\"contactOverlapM\", 0.004)\n    m_cer, m_brz = ctx.mat(\"ceramic_offering\"), ctx.mat(\"bronze_patina\")\n    m_rice = ctx.make_material(\"offer_rice\", base_color=\"#F2EDE0\", roughness=0.7, noise_scale=90.0, bump_strength=0.35)\n    m_salt = ctx.make_material(\"offer_salt\", base_color=\"#F7F5F0\", roughness=0.55, noise_scale=140.0, bump_strength=0.25)\n    m_sake = ctx.make_material(\"offer_sake\", base_color=\"#E9DFC4\", roughness=0.04, transmission=0.6, ior=1.34, coat=0.4)\n    ctx.surface_story(\"ceramic_offering\", edge_wear=0.25, dust=0.12, grime_height=0.04, scratches=0.08)\n    ctx.surface_story(\"bronze_patina\", edge_wear=0.45, dust=0.2, grime_height=0.06, scratches=0.15, wear_color=\"#B08A4A\")\n    grounded = []\n\n    def bowl(name, x, z, D, H, wall=0.006, foot=0.008):\n        R = D * 0.5\n        fr = R * 0.55\n        # closed (watertight) solid-of-revolution profile: foot -> outer wall -> rolled rim -> inner wall -> floor\n        prof = [(0.0, 0.0), (fr, 0.0), (fr, foot), (R * 0.78, foot + H * 0.18), (R * 0.96, H * 0.72),\n                (R, H - 0.002), (R - wall * 0.5, H), (R - wall, H - 0.002), (R - wall - 0.002, H * 0.7),\n                (R * 0.62, foot + wall + 0.006), (0.0, foot + wall)]\n        ctx.add_lathe(name, prof, pos=(x, 0.0, z), segs=40, cap=True, lip_bevel=0.0015, mat=m_cer)\n        grounded.append(name)\n        return foot + wall, R - wall, H\n\n    # --- LEFT of stair axis: rice bowl + sake cup (asymmetric arc) ---\n    fy, ir, h = bowl(\"offer_rice_bowl\", -(stair_half + 0.06), -0.055, 0.09, 0.05)\n    ctx.add_lathe(\"offer_rice_mound\", [(0.0, fy - ov), (ir * 0.98, fy - ov), (ir * 0.9, h * 0.78),\n                  (ir * 0.55, h + 0.012), (0.0, h + 0.02)], pos=(-(stair_half + 0.06), 0.0, -0.055),\n                  segs=32, cap=True, mat=m_rice)\n    sx, sz = -(stair_half + 0.105), 0.075\n    fy, ir, h = bowl(\"offer_sake_cup\", sx, sz, 0.064, 0.042, wall=0.005)\n    ctx.add_lathe(\"offer_sake_liquid\", [(0.0, fy - ov), (ir * 0.8, fy - ov), (ir * 0.97, h * 0.72), (0.0, h * 0.72)],\n                  pos=(sx, 0.0, sz), segs=32, cap=True, mat=m_sake)\n\n    # --- RIGHT: salt dish with morishio cone + tripod censer ---\n    tx, tz = stair_half + 0.09, 0.085\n    fy, ir, h = bowl(\"offer_salt_dish\", tx, tz, 0.072, 0.03, wall=0.005, foot=0.006)\n    ctx.add_lathe(\"offer_salt_cone\", [(0.0, fy - ov), (ir * 0.62, fy - ov), (ir * 0.6, h * 0.9), (0.0, h + 0.03)],\n                  pos=(tx, 0.0, tz), segs=8, cap=True, mat=m_salt)\n\n    cx, cz = stair_half + 0.07, -0.05\n    leg_h, body_r = 0.03, 0.048\n    S = ctx.sdf\n\n    def tripod(p):\n        d = None\n        for k in range(3):\n            a = math.radians(30 + 120 * k)\n            ax_, az_ = math.cos(a), math.sin(a)\n            A = np.array([ax_ * 0.030, leg_h + 0.012, az_ * 0.030]); B = np.array([ax_ * 0.046, 0.006, az_ * 0.046])\n            pa, ba = p - A, B - A\n            t = np.clip((pa @ ba) / (ba @ ba), 0.0, 1.0)\n            dk = np.linalg.norm(pa - t[..., None] * ba, axis=-1) - 0.0075\n            foot = np.linalg.norm(p - np.array([B[0], 0.006, B[2]]), axis=-1) - 0.0068\n            dk = np.minimum(dk, foot)\n            d = dk if d is None else np.minimum(d, dk)\n        return d\n    ctx.sdf_mesh(\"censer_tripod\", tripod, (cx - 0.06, 0.0, cz - 0.06), (cx + 0.06, leg_h + 0.025, cz + 0.06),\n                 res=56, mat=m_brz, smooth_iters=2) if False else None\n    ctx.sdf_mesh(\"censer_tripod\", lambda p: tripod(p - np.array([cx, 0.0, cz])),\n                 (cx - 0.06, -0.001, cz - 0.06), (cx + 0.06, leg_h + 0.025, cz + 0.06), res=56, mat=m_brz)\n    grounded.append(\"censer_tripod\")\n    b0 = leg_h\n    ctx.add_lathe(\"censer_body\", [(0.0, b0), (0.03, b0), (body_r, b0 + 0.02), (body_r + 0.004, b0 + 0.045),\n                  (body_r + 0.008, b0 + 0.05), (body_r + 0.008, b0 + 0.056), (0.0, b0 + 0.056)],\n                  pos=(cx, 0.0, cz), segs=40, cap=True, lip_bevel=0.001, mat=m_brz)\n    l0 = b0 + 0.056 - ov\n    ctx.add_lathe(\"censer_lid\", [(0.0, l0), (body_r + 0.006, l0), (body_r + 0.002, l0 + 0.008),\n                  (0.034, l0 + 0.024), (0.014, l0 + 0.032), (0.0, l0 + 0.033)],\n                  pos=(cx, 0.0, cz), segs=40, cap=True, mat=m_brz)\n    # closed, solid smoke-hole lattice: raised cloud-scroll ribs + ring (no open holes)\n    for k in range(8):\n        a = math.radians(k * 45.0)\n        ctx.add_bevel_box(f\"censer_lattice_{k}\", (0.022, 0.006, 0.005),\n                          pos=(cx + math.cos(a) * 0.033, l0 + 0.019, cz + math.sin(a) * 0.033),\n                          rot_deg=(0, -k * 45.0, 28), bevel=0.0015, segs=2, mat=m_brz)\n    ctx.add_lathe(\"censer_lattice_ring\", [(0.04, l0 + 0.012), (0.044, l0 + 0.012), (0.044, l0 + 0.016), (0.04, l0 + 0.016)],\n                  pos=(cx, 0.0, cz), segs=40, cap=True, mat=m_brz)\n    k0 = l0 + 0.03\n\n    def lion(p):\n        q = p - np.array([cx, k0, cz])\n        body = S.ellipsoid(q - np.array([0.0, 0.009, -0.002]), (0.011, 0.009, 0.014))\n        head = np.linalg.norm(q - np.array([0.0, 0.021, 0.008]), axis=-1) - 0.0085\n        mane = np.linalg.norm(q - np.array([0.0, 0.02, 0.004]), axis=-1) - 0.0095\n        k = 0.004\n        h = np.clip(0.5 + 0.5 * (mane - body) / k, 0, 1)\n        u = mane * (1 - h) + body * h - k * h * (1 - h)\n        h2 = np.clip(0.5 + 0.5 * (head - u) / k, 0, 1)\n        return head * (1 - h2) + u * h2 - k * h2 * (1 - h2)\n    ctx.sdf_mesh(\"censer_lion_knob\", lion, (cx - 0.02, k0 - 0.004, cz - 0.022), (cx + 0.02, k0 + 0.034, cz + 0.022),\n                 res=48, mat=m_brz, smooth_iters=2)\n\n    # BVH gravity settle grounded bases (exact contact already computed for stacked parts)\n    ctx.settle_group(grounded, target_names=None, floor_y=0.0, inset=0.002)"
      }
    },
    {
      "id": "rocks_pebbles_clutter",
      "name": "Mossy Basalt Rocks & Stacked River Pebbles",
      "category": "props/rocks",
      "role": "decor",
      "reusable": true,
      "tags": [
        "settle_group",
        "basalt",
        "river_pebbles",
        "cairn",
        "moss"
      ],
      "pos": [
        0,
        0,
        0.78
      ],
      "rotDeg": [
        0,
        0,
        0
      ],
      "scale": [
        1,
        1,
        1
      ],
      "boundsHintM": {
        "size": [
          1.9,
          0.24,
          0.42
        ]
      },
      "attach": {
        "parent": "ground",
        "mode": "seat_on",
        "face": "-y",
        "offset": [
          0,
          0,
          0.78
        ],
        "overlapM": 0.004
      },
      "nodes": [],
      "generator": {
        "runtime": "blender_py_v3",
        "entry": "build",
        "seed": 109,
        "summary": "Mossy Basalt Rocks & Stacked River Pebbles",
        "code": "def build(ctx):\n    rng = random.Random(ctx.seed if ctx.seed is not None else 7)\n    basalt = ctx.mat(\"basalt_mossy\")\n    moss = ctx.mat(\"moss_cushion\")\n    pebble = ctx.mat(\"river_pebble\")\n    ctx.surface_story(\"basalt_mossy\", edge_wear=0.3, dust=0.18, grime_height=0.12, scratches=0.08)\n    ctx.surface_story(\"river_pebble\", edge_wear=0.12, dust=0.08, grime_height=0.05, scratches=0.04)\n    res = max(28, int(48 * ctx.seg_scale)) if ctx.seg_scale else 48\n    ov = ctx.params.get(\"contactOverlapM\", 0.004)\n\n    def ellip(px, py, pz, cx, cy, cz, rx, ry, rz):\n        qx, qy, qz = (px - cx) / rx, (py - cy) / ry, (pz - cz) / rz\n        return (np.sqrt(qx * qx + qy * qy + qz * qz) - 1.0) * min(rx, ry, rz)\n\n    def erosion(px, py, pz, amp, ph):\n        # cheap layered \"voronoi-ish\" faceting: abs-folded sines at three octaves\n        n = np.abs(np.sin(px * 31.0 + ph) + np.sin(pz * 27.0 - ph * 1.7) + np.sin(py * 23.0 + ph * 0.6)) / 3.0\n        n += 0.5 * np.abs(np.sin(px * 67.0 - pz * 59.0 + ph * 2.3))\n        return amp * (n - 0.6)\n\n    # Boulders: (x, z, half-width, height, half-depth) — tucked in octagon corners & step cheeks (|x| > 0.34, off treads)\n    boulders = [(-0.80, -0.04, 0.11, 0.21, 0.09), (-0.56, 0.08, 0.07, 0.12, 0.06),\n                (-0.40, -0.10, 0.045, 0.07, 0.04), (0.42, -0.08, 0.06, 0.10, 0.05),\n                (0.62, 0.06, 0.09, 0.17, 0.08), (0.86, -0.06, 0.05, 0.08, 0.045)]\n    rock_names = []\n    for i, (bx, bz, rx, h, rz) in enumerate(boulders):\n        ph = rng.uniform(0, 6.28)\n        sink = h * 0.18                      # ellipsoid centre below ground -> flat seated base\n        ry = (h + sink) * 0.5\n        cy = h - ry\n        tilt = rng.uniform(-0.25, 0.25)\n\n        def rock_sdf(p, bx=bx, bz=bz, rx=rx, ry=ry, rz=rz, cy=cy, ph=ph, tilt=tilt):\n            px, py, pz = p[..., 0], p[..., 1], p[..., 2]\n            lx = (px - bx) + tilt * (py - cy) * 0.4\n            d = ellip(lx, py, pz, 0.0, cy, bz, rx, ry, rz)\n            d = d + erosion(px, py, pz, min(rx, rz) * 0.22, ph)\n            return np.maximum(d, -py)        # clip flat at y=0 (watertight base)\n\n        name = f\"basalt_rock_{i}\"\n        m = 0.03\n        ctx.sdf_mesh(name, rock_sdf, (bx - rx - m, 0.0, bz - rz - m), (bx + rx + m, h + m, bz + rz + m),\n                     res=res, mat=basalt, smooth_iters=2)\n        rock_names.append(name)\n\n        cap_y = cy + ry * 0.35               # moss crust only on the upper sun-facing dome\n\n        def moss_sdf(p, f=rock_sdf, cap_y=cap_y, ph=ph):\n            px, py, pz = p[..., 0], p[..., 1], p[..., 2]\n            shell = f(p) - 0.006 - 0.004 * np.abs(np.sin(px * 90 + ph) * np.sin(pz * 85))\n            return np.maximum(shell, cap_y - py + 0.01 * np.sin(px * 40 + pz * 33 + ph))\n\n        ctx.sdf_mesh(f\"moss_cap_{i}\", moss_sdf, (bx - rx - m, cap_y - 0.02, bz - rz - m),\n                     (bx + rx + m, h + m, bz + rz + m), res=max(24, res - 12), mat=moss, smooth_iters=3)\n\n    ctx.settle_group(rock_names, target_names=None, floor_y=0.0, inset=0.002)\n\n    # Two balanced river-pebble cairns, stacked by exact contact arithmetic\n    for side, cx, cz in ((-1, -0.66, -0.13), (1, 0.74, 0.12)):\n        y = 0.0\n        count = 5 if side < 0 else 4\n        for k in range(count):\n            r = 0.062 - k * 0.010 + rng.uniform(-0.004, 0.004)\n            t = 0.032 - k * 0.003 + rng.uniform(-0.002, 0.002)\n            ox, oz = cx + rng.uniform(-0.006, 0.006), cz + rng.uniform(-0.006, 0.006)\n            ar = rng.uniform(0.78, 0.95)\n            ccy = y + t * 0.5\n\n            def peb_sdf(p, ox=ox, oz=oz, r=r, t=t, ar=ar, ccy=ccy):\n                return ellip(p[..., 0], p[..., 1], p[..., 2], ox, ccy, oz, r, t * 0.5, r * ar)\n\n            ctx.sdf_mesh(f\"cairn_{'l' if side < 0 else 'r'}_{k}\", peb_sdf,\n                         (ox - r - 0.01, ccy - t, oz - r - 0.01), (ox + r + 0.01, ccy + t, oz + r + 0.01),\n                         res=max(24, res - 16), mat=pebble, smooth_iters=2)\n            y += t - ov * 0.5                # next stone nests slightly into the one below"
      }
    }
  ],
  "sockets": [
    {
      "id": "nuki_cloth_pin",
      "role": "surface",
      "pos": [
        0,
        1.46,
        -0.05
      ],
      "normal": [
        0,
        1,
        0
      ],
      "radiusM": 0.25
    },
    {
      "id": "lantern_l_firebox",
      "role": "surface",
      "pos": [
        -0.45,
        0.62,
        0.5
      ],
      "normal": [
        0,
        1,
        0
      ],
      "radiusM": 0.25
    },
    {
      "id": "lantern_r_firebox",
      "role": "surface",
      "pos": [
        0.45,
        0.62,
        0.5
      ],
      "normal": [
        0,
        1,
        0
      ],
      "radiusM": 0.25
    },
    {
      "id": "basin_spout_tip",
      "role": "surface",
      "pos": [
        -0.56,
        0.5,
        -0.34
      ],
      "normal": [
        0,
        1,
        0
      ],
      "radiusM": 0.25
    },
    {
      "id": "tree_root_socket",
      "role": "surface",
      "pos": [
        0.6,
        0.42,
        -0.32
      ],
      "normal": [
        0,
        1,
        0
      ],
      "radiusM": 0.25
    }
  ],
  "exclusions": [
    {
      "id": "stair_walkway",
      "reason": "clearance",
      "min": [
        -0.31,
        0,
        0.62
      ],
      "max": [
        0.31,
        0.6,
        1
      ]
    },
    {
      "id": "torii_passage",
      "reason": "clearance",
      "min": [
        -0.4,
        0.2,
        -0.2
      ],
      "max": [
        0.4,
        1.4,
        0.1
      ]
    },
    {
      "id": "camera_hero_sightline",
      "reason": "clearance",
      "min": [
        0.8,
        1,
        0.8
      ],
      "max": [
        1,
        2.2,
        1
      ]
    }
  ],
  "lighting": {
    "environmentPreset": "twilight_warm",
    "sun": {
      "azimuthDeg": 228,
      "elevationDeg": 24,
      "intensity": 2.4,
      "kelvin": 3100,
      "angularDiameterDeg": 1.2,
      "airDensity": 1.05,
      "aerosolDensity": 0.9,
      "ozoneDensity": 1.5
    },
    "exposureEV": 0.35,
    "toneMapping": "AgX",
    "agxLook": "AgX - Medium High Contrast",
    "ambientStrength": 0.18,
    "emitters": [
      {
        "id": "key_golden_area",
        "type": "area",
        "pos": [
          2.6,
          2.9,
          2.4
        ],
        "target": [
          0,
          0.9,
          0
        ],
        "size": [
          1.6,
          1.2
        ],
        "powerW": 520,
        "kelvin": 3300
      },
      {
        "id": "rim_sapphire_area",
        "type": "area",
        "pos": [
          -2.2,
          2.4,
          -2.6
        ],
        "target": [
          0,
          1.1,
          -0.1
        ],
        "size": [
          1.4,
          1.8
        ],
        "powerW": 380,
        "kelvin": 9500
      },
      {
        "id": "fill_cyclorama_soft",
        "type": "area",
        "pos": [
          0,
          3.4,
          0.6
        ],
        "target": [
          0,
          0,
          0
        ],
        "size": [
          2.4,
          2.4
        ],
        "powerW": 60,
        "kelvin": 5200
      },
      {
        "id": "lantern_left_flame",
        "type": "point",
        "pos": [
          -0.45,
          0.62,
          0.5
        ],
        "radius": 0.018,
        "powerW": 6,
        "kelvin": 2300
      },
      {
        "id": "lantern_right_flame",
        "type": "point",
        "pos": [
          0.45,
          0.62,
          0.5
        ],
        "radius": 0.018,
        "powerW": 6,
        "kelvin": 2300
      },
      {
        "id": "plaque_glint_spot",
        "type": "spot",
        "pos": [
          0.9,
          1.9,
          1.6
        ],
        "target": [
          0,
          1.68,
          -0.05
        ],
        "radius": 0.02,
        "powerW": 14,
        "kelvin": 3000
      }
    ],
    "optics": {
      "glareThreshold": 1.35,
      "glareMix": 0.24,
      "vignette": 0.16,
      "grain": 0.02,
      "dofFStop": 8,
      "focusDistM": 4.6
    }
  },
  "lightmap": {
    "uv2Policy": "auto_smart_project",
    "texelDensityPxPerM": 64,
    "atlasSize": 2048,
    "marginPx": 4,
    "bakeMode": "cycles_combined",
    "castShadow": true,
    "receiveShadow": true
  },
  "lodRules": {
    "tiers": {
      "lod0": {
        "segScale": 1,
        "maxTris": 250000,
        "includeMicroDecor": true
      },
      "lod1": {
        "segScale": 0.65,
        "maxTris": 80000,
        "includeMicroDecor": true
      },
      "lod2": {
        "segScale": 0.35,
        "maxTris": 20000,
        "includeMicroDecor": false
      }
    },
    "materialSlotsInvariant": true
  },
  "compilationTiers": {},
  "portals": [
    {
      "id": "torii_threshold",
      "kind": "archway",
      "frame": {
        "pos": [
          0,
          0.01,
          0
        ],
        "normal": [
          0,
          0,
          1
        ],
        "widthM": 2.4,
        "heightM": 2.6
      },
      "floorElevationM": 0
    }
  ],
  "cameras": [
    {
      "id": "hero",
      "name": "hero",
      "kind": "hero",
      "pos": [
        3.4,
        2.75,
        3.4
      ],
      "target": [
        0,
        0.92,
        0
      ],
      "focalLengthMm": 35,
      "shiftY": 0
    },
    {
      "id": "grazing",
      "name": "grazing",
      "kind": "hero",
      "pos": [
        -2.3,
        0.42,
        2.4
      ],
      "target": [
        0,
        0.55,
        -0.1
      ],
      "focalLengthMm": 35,
      "shiftY": 0
    },
    {
      "id": "ortho_iso",
      "name": "ortho_iso",
      "kind": "hero",
      "pos": [
        4,
        3.27,
        4
      ],
      "target": [
        0,
        0.9,
        0
      ],
      "focalLengthMm": 35,
      "shiftY": 0,
      "orthoScale": 3.1
    }
  ],
  "rig": {
    "preset": "custom",
    "rootBone": "root",
    "bones": [
      {
        "id": "root",
        "head": [
          0,
          0,
          0
        ],
        "tail": [
          0,
          0.2,
          0
        ]
      },
      {
        "id": "noren_bone",
        "parent": "root",
        "head": [
          0,
          1.46,
          -0.05
        ],
        "tail": [
          0,
          0.94,
          -0.05
        ]
      },
      {
        "id": "tree_bone",
        "parent": "root",
        "head": [
          0.6,
          0.42,
          -0.32
        ],
        "tail": [
          0.6,
          2,
          -0.32
        ]
      }
    ]
  },
  "motion": {
    "fps": 30,
    "durationSec": 4,
    "clips": []
  },
  "colliders": [
    {
      "groupId": "courtyard_plinth",
      "shape": "box"
    },
    {
      "groupId": "courtyard_plinth",
      "shape": "box"
    },
    {
      "groupId": "torii_gate",
      "shape": "box"
    },
    {
      "groupId": "toro_lantern_left",
      "shape": "box"
    },
    {
      "groupId": "toro_lantern_right",
      "shape": "box"
    },
    {
      "groupId": "olive_tree_planter",
      "shape": "box"
    },
    {
      "groupId": "tsukubai_basin",
      "shape": "box"
    }
  ]
}