<!-- SOLID CITY · part 52 -->
 2; c.lineTo(x + w * mid, y + h * val[i]); c.lineTo(x + w * b, y + h * (i === 1 ? 0.0 : 0.3) * (i === 1 ? 1 : 1)); }
  c.lineTo(x + w, y + h * 0.82); c.lineTo(x + w, y + h); c.closePath();
}
function crown(g, cx, cy, w, s) {
  var h = w * 0.62, x = cx - w / 2, y = cy - h / 2;
  g.fillStyle = '#2a1c08'; crownPath(g, x + 3 * s, y + 3 * s, w, h); g.fill();
  engraveShape(g, x - 2, y - 2, w + 4, h + 4, s, function (c, ox, oy) { crownPath(c, x + ox, y + oy, w, h); c.fill(); }, 2.2);
  g.strokeStyle = GOLD; g.lineWidth = 1.6 * s; crownPath(g, x, y, w, h); g.stroke();
  g.fillStyle = GOLD; [0.02, 0.5, 0.98].forEach(function (a) { g.beginPath(); g.arc(x + w * a, y + h * (a === 0.5 ? 0.0 : 0.3) - 5 * s, 5 * s, 0, Math.PI * 2); g.fill(); });
  g.beginPath(); g.arc(x + w * 0.26 + w * 0.0, y + h * 0.3 - 5 * s, 4 * s, 0, Math.PI * 2); g.fill(); g.beginPath(); g.arc(x + w * 0.74, y + h * 0.3 - 5 * s, 4 * s, 0, Math.PI * 2); g.fill();
  g.strokeStyle = GOLD; g.lineWidth = 1.2 * s; g.beginPath(); g.moveTo(x, y + h * 0.82); g.lineTo(x + w, y + h * 0.82); g.stroke();
  for (var i = 0; i < 5; i++) { g.beginPath(); g.arc(x + w * (0.14 + i * 0.18), y + h * 0.91, 3 * s, 0, Math.PI * 2); g.stroke(); }
}
function border(g, x, y, w, h, s) {
  g.save(); g.strokeStyle = GOLD; g.lineWidth = 3 * s; g.strokeRect(x, y, w, h);
  var b = 26 * s; g.lineWidth = 1.4 * s; g.strokeRect(x + b, y + b, w - 2 * b, h - 2 * b);
  g.beginPath(); g.rect(x, y, w, h); g.rect(x + b, y + b, w - 2 * b, h - 2 * b); g.clip('evenodd');   // the band between the rules
  g.lineWidth = Math.max(0.5, 0.7 * s); g.beginPath();
  for (var t = -h; t < w + h; t += 3.2 * s) { g.moveTo(x + t, y); g.lineTo(x + t - h, y + h); } g.stroke();
  g.strokeStyle = GOLD_D; g.lineWidth = 1.1 * s;   // a running guilloche wave around the band
  [[x, y + b / 2, w, 0], [x, y + h - b / 2, w, 0], [x + b / 2, y, h, 1], [x + w - b / 2, y, h, 1]].forEach(function (e) {
    for (var k = 0; k < 2; k++) { g.beginPath(); for (var i = 0; i <= e[2]; i += 3 * s) { var o = Math.sin(i / (9 * s) + k * Math.PI) * b * 0.32; if (e[3]) { if (i) g.lineTo(e[0] + o, e[1] + i); else g.moveTo(e[0] + o, e[1] + i); } else { if (i) g.lineTo(e[0] + i, e[1] + o); else g.moveTo(e[0] + i, e[1] + o); } } g.stroke(); }
  });
  g.restore();
  [[x + b / 2, y + b / 2], [x + w - b / 2, y + b / 2], [x + b / 2, y + h - b / 2], [x + w - b / 2, y + h - b / 2]].forEach(function (p) { g.fillStyle = INK; g.beginPath(); g.arc(p[0], p[1], b * 0.9, 0, Math.PI * 2); g.fill(); rosette(g, p[0], p[1], b * 0.85, s, 14, 7); });
}
function wrapVar(g, text, wfn) { var words = text.split(" "), lines = [], cur = ""; words.forEach(function (w) { var t = cur ? cur + " " + w : w; if (g.measureText(t).width > wfn(lines.length) && cur) { lines.push(cur); cur = w; } else cur = t; }); if (cur) lines.push(cur); return lines; }
function wrap(g, text, maxW) { var words = text.split(' '), lines = [], cur = ''; words.forEach(function (w) { var t = cur ? cur + ' ' + w : w; if (g.measureText(t).width > maxW && cur) { lines.push(cur); cur = w; } else cur = t; }); if (cur) lines.push(cur); return lines; }
function engrave(W, H, book) {
  var c = document.createElement('canvas'); c.width = W; c.height = H; var g = c.getContext('2d'), s = W / 2048, P = W / 2;
  g.fillStyle = INK; g.fillRect(0, 0, W, H);
  g.strokeStyle = 'rgba(201,154,58,0.20)'; g.lineWidth = Math.max(0.5, 0.65 * s);   // ultra-dense sine-modulated line field (banknote ground)
  for (var y = 0; y < H; y += 2.6 * s) { g.beginPath(); for (var x = 0; x <= W; x += 12 * s) { var yy = y + Math.sin(x / (70 * s) + y / (37 * s)) * 1.4 * s + Math.sin(x / (23 * s) - y / (90 * s)) * 0.6 * s; if (x) g.lineTo(x, yy); else g.moveTo(x, yy); } g.stroke(); }
  var gut = g.createLinearGradient(P - 90 * s, 0, P + 90 * s, 0); gut.addColorStop(0, 'rgba(0,0,0,0)'); gut.addColorStop(0.5, 'rgba(0,0,0,0.85)'); gut.addColorStop(1, 'rgba(0,0,0,0)'); g.fillStyle = gut; g.fillRect(P - 90 * s, 0, 180 * s, H);
  var m = 46 * s, pw = P - 2 * m, ph = H - 2 * m;
  [0, P].forEach(function (ox) { g.fillStyle = 'rgba(6,4,5,0.72)'; g.fillRect(ox + m + 26 * s, m + 26 * s, pw - 52 * s, ph - 52 * s); border(g, ox + m, m, pw, ph, s); });
  // LEFT: crown, rosette, title
  var L = m + pw / 2;
  crown(g, L, m + 120 * s, 190 * s, s);
  engravedText(g, "THE KING'S", L, m + 255 * s, 92 * s, s);
  engravedText(g, 'BOOK OF LAW', L, m + 370 * s, 112 * s, s);
  g.strokeStyle = GOLD; g.lineWidth = 1.4 * s; g.beginPath(); g.moveTo(L - 300 * s, m + 440 * s); g.lineTo(L + 300 * s, m + 440 * s); g.stroke();
  rosette(g, L, m + 640 * s, 175 * s, s, 56, 11); rosette(g, L, m + 640 * s, 92 * s, s, 30, 8);
  g.fillStyle = GOLD; g.font = 'italic 600 ' + (30 * s) + 'px Georgia, "Times New Roman", serif'; g.textAlign = 'center'; g.textBaseline = 'middle';
  g.fillText('Thirteen pages. Thirteen truths.', L, m + 838 * s);
  // RIGHT: page one, typeset in engraved serif with an engraved drop cap
  var R = P + m + pw / 2, p1 =