{"version":3,"sources":["daylight.mjs"],"sourcesContent":["// Kubicor — WORLD SEASONS, ROUND 3: THE DAYLIGHT, SHOWN (the owner's round 3 picks, Oct 11: faces = face, extremes = keep,\n// precess = fixed, show = diagram). The page's alone, and words and a picture only: nothing here is state, nothing is\n// stored, no server reads it. The sun's path itself is phase 2's (seasons.mjs axisLean and daylightShare, system-view\n// setSpin and landingSeasonOf); this file says what that path means for where you would land or stand, and draws it,\n// and measures where a star stands over a spot (sunGeometry, below).\n//\n// ── THE OWNER'S DECISIONS, AND WHERE EACH LIVES ──────────────────────────────────────────────────────────────────\n//   FACES = FACE, EXTREMES = KEEP, PRECESS = FIXED: no change to the sun. Daylight stays by the ground: a flat face\n//     shares one sunrise, and only the rolled edges and corners grade between their faces (the sky's up is the walker's,\n//     and on a face that is the face's normal). A world on its side keeps its months of polar day; the axis never\n//     precesses, so a world's seasons are the same every year.\n//   SHOW = DIAGRAM, IN TWO PLACES:\n//     THE CARD'S CHIP (world-card.mjs daylightChip, from daylightCourse here): \"Daylight 31 of 54 min · getting longer\",\n//       or \"· getting shorter\", where Land would put you (from orbit) or where you stand (on foot); round a solstice near a\n//       pole \"Polar night · sun back in 2 days\" or \"Polar day · sunset in 3 days\", the next change found on the season\n//       curve. None on a world with no tilt (under 1°), no star, or no day (one locked to its star).\n//     INFO'S DIAGRAM (daylightDiagramSVG): the corner-up cube world, its spin axis leaning by its tilt with N and S at\n//       its ends, the star's direction now, every face shaded by how much of today it spends in sunlight (the same rule\n//       as the game: each face's normal stands ±35.26° off the equator, and seasons.mjs daylightShare of that against\n//       seasons.mjs declinationDeg), and under it the year: a bar for each hemisphere shaded the same way through the\n//       year, the solstices ticked and a marker at now.\n//\n// CHEAP: nothing here runs per frame. The card's model asks for the chip twice a second at most, and that is one\n// daylightShare and, round a solstice near a pole, a search along the year of a few hundred more. The diagram is an SVG\n// string, built when Info opens and again only when its key moves (daylightDiagramKey: about every 720th of a year), and\n// the card writes its HTML only when that string changes.\n//\n// PURE: no DOM, no clock of its own (the phase and the times are handed in), so tests/daylight-ui.test.mjs runs it in node.\nimport { DAY_MS, SPIN_AXIS, daylightShare, declinationDeg, hasSeasons, hemisphereOf } from './seasons.mjs';\nimport { daylightAmountText } from './world-card.mjs';\n\nconst TAU = 2 * Math.PI;\nconst DEG = Math.PI / 180;\nconst fin = (v) => typeof v === 'number' && Number.isFinite(v);\nconst clamp = (v, lo, hi) => (v < lo ? lo : v > hi ? hi : v);\nconst frac = (v) => v - Math.floor(v);\n\nexport const DAYLIGHT = Object.freeze({\n  // THE SEARCH ALONG THE YEAR for a polar day's sunset or a polar night's sunrise: the year in this many steps, then the\n  // step the change falls in halved this many times (a 28-day year to well under a second).\n  STEPS: 720,\n  BISECT: 24,\n  // THE TREND: the share a short step of the year on (a 2,880th of a year: 3.5 min of the shortest year). A difference\n  // this small or smaller is no trend at all (the equator, where every day is half a day).\n  TREND_STEP: 1 / 2880,\n  TREND_EPS: 1e-12,\n  // THE DIAGRAM'S KEY moves at this many steps a year, which is how often a diagram left open is drawn again.\n  KEY_STEPS: 720,\n});\n\n// A FACE'S LATITUDE, as its sine: its normal's part along the spin axis (seasons.mjs SPIN_AXIS, the voxel grid's (1, 1, 1)\n// diagonal). ±1/√3 for every face (35.26°). +x, +y and +z are the north faces, their opposites the south, by the game's\n// own rule (seasons.mjs hemisphereOf: a hemisphere is the three faces round its pole corner).\nexport const FACES = Object.freeze([\n  { id: '+x', n: [1, 0, 0] }, { id: '+y', n: [0, 1, 0] }, { id: '+z', n: [0, 0, 1] },\n  { id: '-x', n: [-1, 0, 0] }, { id: '-y', n: [0, -1, 0] }, { id: '-z', n: [0, 0, -1] },\n].map((f) => Object.freeze({ ...f, sinLat: f.n[0] * SPIN_AXIS[0] + f.n[1] * SPIN_AXIS[1] + f.n[2] * SPIN_AXIS[2], north: hemisphereOf(f.n).north })));\n\n// THE SEASON CURVE: the share of a day the sun is up, at `sinLat`, on a world tilted `tiltDeg`, at the year's `phase`: the\n// sunrise equation (seasons.mjs daylightShare) against the declination the sky is leaned to (seasons.mjs declinationDeg).\nexport function shareOnCurve(sinLat, tiltDeg, phase) {\n  return daylightShare(sinLat, Math.sin(declinationDeg(tiltDeg, phase) * DEG));\n}\nconst polarOf = (s) => (s >= 1 ? 'day' : s <= 0 ? 'night' : null);\n\n// EVERY FACE'S DAYLIGHT TODAY, the diagram's shading: [{ id, n, sinLat, north, share }] in FACES' order.\n// `offDeg` (optional) moves the declination as daylightCourse moved it to the sky's sun (a moon's), so the faces agree\n// with the chip; the year bar under them is the season curve itself.\nexport function faceDaylight(tiltDeg, phase, offDeg = 0) {\n  const sd = Math.sin(clamp((declinationDeg(tiltDeg, phase) + (fin(offDeg) ? offDeg : 0)) * DEG, -Math.PI / 2, Math.PI / 2));\n  return FACES.map((f) => ({ id: f.id, n: f.n, sinLat: f.sinLat, north: f.north, share: daylightShare(f.sinLat, sd) }));\n}\n\n// THE DAYLIGHT WHERE YOU WOULD LAND, OR STAND, AND WHERE IT IS GOING. `d` is what the view reads there (system-view\n// daylightNow): { sinLat, sinDec, tilt, phase, yearDays, daySec, speed, onFoot, north }. sinLat is the local up's part along the\n// leaning axis and sinDec the brightest sun's, as the sky draws it (sunGeometry upA and sinDec), so today's share is the\n// number Info's \"daylight now\" line gives; left out, everything is read off the season curve. (`share`, when handed in,\n// overrides today's share alone.) `speed` is the speed slider's (the clock runs that much faster,\n// so every time here is that much shorter). `north` is the hemisphere you are in BY ITS FACE (seasons.mjs hemisphereOf at\n// the same place, as the season chip reads it), so the chip and the diagram's \"you\" never name the other one over a\n// rolled equator edge, where the up grades; left out, it is the side sinLat is on. Null for a world with no seasons, no year or no day.\n//   share, polar       today's share of sunlight, and 'day' (it never sets) or 'night' (it never rises) or null\n//   trend              'longer', 'shorter' or 'steady' (on the curve, a moment on)\n//   changeInMs         a polar day's sunset or a polar night's sunrise, in real ms (null when not polar, or never)\n//   turnInMs           the next solstice, where the days stop lengthening or shortening, in real ms\n//   daySec             a day's length in real seconds, the slider's speed counted\n//   north, onFoot, tilt, phase, yearDays, sinLat   as handed in (north, when not, the side sinLat is on)\n//   decDeg, decOffsetDeg   the sun's declination now (the curve's, moved to the sky's), and how far it was moved\nexport function daylightCourse(d) {\n  if (!d || !hasSeasons(d.tilt) || !fin(d.sinLat) || !fin(d.phase) || !fin(d.yearDays) || d.yearDays <= 0) return null;\n  const speed = fin(d.speed) && d.speed > 0 ? d.speed : 1;\n  const daySec = fin(d.daySec) && d.daySec > 0 ? d.daySec / speed : null;\n  if (daySec == null) return null;\n  const tilt = d.tilt, phase = frac(d.phase), sinLat = clamp(d.sinLat, -1, 1), yearMs = d.yearDays * DAY_MS / speed;\n  // THE SKY'S SUN, WHEN THE VIEW HANDS IT IN (`sinDec`): the curve is moved by however far the sun the sky draws stands\n  // off it now, so today's share is the sky's own and the countdown runs from it. On a planet that is nothing (its sun\n  // stands exactly at declinationDeg); a moon's is off its planet's by however far its own orbit carries it round, a few\n  // degrees round a close giant, which round a polar circle is the difference between a sunset in a minute and none.\n  const offRad = fin(d.sinDec) ? Math.asin(clamp(d.sinDec, -1, 1)) - declinationDeg(tilt, phase) * DEG : 0;\n  const at = (p) => daylightShare(sinLat, Math.sin(clamp(declinationDeg(tilt, p) * DEG + offRad, -Math.PI / 2, Math.PI / 2)));\n  const share = fin(d.share) ? clamp(d.share, 0, 1) : at(phase);\n  const polar = polarOf(share);\n  const out = { share, polar, trend: 'steady', changeInMs: null, turnInMs: null, daySec, north: typeof d.north === 'boolean' ? d.north : sinLat >= 0, onFoot: !!d.onFoot,\n                tilt, phase, yearDays: d.yearDays, sinLat, decDeg: declinationDeg(tilt, phase) + offRad / DEG, decOffsetDeg: offRad / DEG };\n  const ds = at(phase + DAYLIGHT.TREND_STEP) - at(phase);\n  out.trend = ds > DAYLIGHT.TREND_EPS ? 'longer' : ds < -DAYLIGHT.TREND_EPS ? 'shorter' : 'steady';\n  // THE NEXT SOLSTICE: the declination's turning points, at a quarter and three quarters of the year.\n  out.turnInMs = (phase < 0.25 ? 0.25 - phase : phase < 0.75 ? 0.75 - phase : 1.25 - phase) * yearMs;\n  if (polar) {\n    const N = DAYLIGHT.STEPS;\n    for (let i = 1; i <= N; i++) {\n      if (polarOf(at(phase + i / N)) === polar) continue;\n      let lo = (i - 1) / N, hi = i / N;\n      for (let k = 0; k < DAYLIGHT.BISECT; k++) { const mid = (lo + hi) / 2; if (polarOf(at(phase + mid)) === polar) lo = mid; else hi = mid; }\n      out.changeInMs = hi * yearMs;\n      break;\n    }\n  }\n  return out;\n}\n\n// ── THE DIAGRAM ──────────────────────────────────────────────────────────────────────────────────────────────────\n// THE SHADE OF A SHARE: the HUD's night ink at no sun, the warm gold of the star at a sun that never sets, and between\n// them a ramp steepened round half a day (tanh, SHADE_GAIN), because that is where nearly every face of nearly every world\n// is: on an Earth-like tilt the long-day faces and the short-day ones are 32 and 22 minutes of a 54-minute day, which an\n// even mix leaves as two tans. Monotonic, so a longer day is always a lighter face, and exported so the test can hold a\n// face's fill to its share.\nconst NIGHT = [28, 39, 64], DAY = [255, 210, 122], SHADE_GAIN = 4;\nconst hex2 = (v) => Math.round(clamp(v, 0, 255)).toString(16).padStart(2, '0');\nexport function shadeOf(share) {\n  const s = fin(share) ? clamp(share, 0, 1) : 0.5;\n  const t = 0.5 + 0.5 * Math.tanh(SHADE_GAIN * (s - 0.5)) / Math.tanh(SHADE_GAIN / 2);\n  return '#' + [0, 1, 2].map((i) => hex2(NIGHT[i] + (DAY[i] - NIGHT[i]) * t)).join('');\n}\n// THE KEY A DIAGRAM IS DRAWN AGAIN BY: everything it reads, to its own precision (the phase to KEY_STEPS a year; the\n// faces and the year are worked from the tilt and the phase, so today's share at the spot is not in it).\nexport function daylightDiagramKey(d) {\n  if (!d) return '';\n  return [Math.round(d.tilt * 10), Math.round(frac(d.phase) * DAYLIGHT.KEY_STEPS), d.north ? 'N' : 'S', d.onFoot ? 'F' : 'O',\n          Math.round(d.daySec)].join('|');\n}\n\n// THE PICTURE'S OWN 3D: x right, y up (the orbit's normal), z out of the page toward the reader. The star is to the LEFT\n// (toward −x), and the world's axis leans by its tilt so that it stands the declination off the star's side: northern\n// midsummer (phase 1/4) leans the north end straight at the star, midwinter straight away from it, and at the equinoxes\n// the lean is across the line to the star (toward and away from the reader), so the sun is on the equator. That is the\n// sky's own geometry (seasons.mjs axisLean) with the star's bearing turned to the left: A · toStar = sin(declination).\n// The camera looks from a little to the right and a little above, so a lean across the line still shows.\nconst V_YAW = 22 * DEG, V_ELEV = 16 * DEG;\nconst VIEW = [Math.sin(V_YAW) * Math.cos(V_ELEV), Math.sin(V_ELEV), Math.cos(V_YAW) * Math.cos(V_ELEV)];   // toward the camera\nconst RIGHT = [Math.cos(V_YAW), 0, -Math.sin(V_YAW)];\nconst UPV = [-Math.sin(V_YAW) * Math.sin(V_ELEV), Math.cos(V_ELEV), -Math.cos(V_YAW) * Math.sin(V_ELEV)];\nconst dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\nconst cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\nconst norm = (a) => { const l = Math.hypot(a[0], a[1], a[2]) || 1; return [a[0] / l, a[1] / l, a[2] / l]; };\n// Rodrigues: `v` turned by `ang` about the unit axis `k`.\nfunction rot(v, k, ang) {\n  const c = Math.cos(ang), s = Math.sin(ang), kv = dot(k, v), kx = cross(k, v);\n  return [v[0] * c + kx[0] * s + k[0] * kv * (1 - c), v[1] * c + kx[1] * s + k[1] * kv * (1 - c), v[2] * c + kx[2] * s + k[2] * kv * (1 - c)];\n}\n// The world's axis in the picture, for a tilt and a phase.\nexport function diagramAxis(tiltDeg, phase) {\n  const t = clamp(tiltDeg, 0, 90) * DEG, p = TAU * phase;\n  return [-Math.sin(t) * Math.sin(p), Math.cos(t), Math.sin(t) * Math.cos(p)];\n}\n// The cube stands corner-up as the game stands it (system-view VOXEL_CORNER_UP: the (1, 1, 1) diagonal up), turned about\n// its axis to a fixed angle that shows a north face and two south ones from this camera, then leaned onto the axis.\nconst CORNER_K = norm(cross(SPIN_AXIS, [0, 1, 0])), CORNER_ANG = Math.acos(SPIN_AXIS[1]);\nconst SPIN = 95 * DEG;\nfunction placeOf(axis) {\n  const k = cross([0, 1, 0], axis), kl = Math.hypot(k[0], k[1], k[2]), ang = Math.acos(clamp(axis[1], -1, 1));\n  return (v) => {\n    let w = rot(v, CORNER_K, CORNER_ANG);\n    w = rot(w, [0, 1, 0], SPIN);\n    return kl > 1e-9 ? rot(w, [k[0] / kl, k[1] / kl, k[2] / kl], ang) : w;\n  };\n}\nconst fx = (v) => (Math.round(v * 10) / 10).toString();\nconst escT = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n// THE DIAGRAM, as an inline SVG string (240 × 140, scaled to the panel's width up to 300 px), from daylightCourse's\n// answer `d`. Every face polygon carries data-face and data-share, so the test can hold the shading to the rule.\n// Empty for no course (no seasons, no star, no day).\nexport function daylightDiagramSVG(d) {\n  if (!d || !fin(d.tilt) || !fin(d.phase)) return '';\n  const W = 240, H = 140, CX = 84, CY = 58, S = 17;\n  const axis = diagramAxis(d.tilt, d.phase), place = placeOf(axis);\n  const faces = faceDaylight(d.tilt, d.phase, d.decOffsetDeg);\n  const P = (v) => [CX + S * dot(v, RIGHT), CY - S * dot(v, UPV)];\n  const pt = (q) => fx(q[0]) + ',' + fx(q[1]);\n  let back = '', front = '', defs = '';\n  // ── THE STAR, AND ITS LIGHT ──\n  const toStar = [-1, 0, 0], sp = [CX + 60 * dot(toStar, RIGHT), CY - 60 * dot(toStar, UPV)];\n  const dir = norm([CX - sp[0], CY - sp[1], 0]), perp = [-dir[1], dir[0]];\n  defs += '<radialGradient id=\"dl-glow\"><stop offset=\"0\" stop-color=\"#fff3cf\"/><stop offset=\"0.35\" stop-color=\"#ffd27a\" stop-opacity=\"0.9\"/>'\n        + '<stop offset=\"1\" stop-color=\"#ffd27a\" stop-opacity=\"0\"/></radialGradient>'\n        + '<marker id=\"dl-arr\" viewBox=\"0 0 6 6\" refX=\"5\" refY=\"3\" markerWidth=\"5\" markerHeight=\"5\" orient=\"auto\"><path d=\"M0,0L6,3L0,6z\" fill=\"#ffd27a\"/></marker>';\n  back += `<circle cx=\"${fx(sp[0])}\" cy=\"${fx(sp[1])}\" r=\"17\" fill=\"url(#dl-glow)\"/><circle cx=\"${fx(sp[0])}\" cy=\"${fx(sp[1])}\" r=\"5\" fill=\"#fff3cf\"/>`;\n  back += `<text x=\"${fx(sp[0])}\" y=\"${fx(sp[1] + 27)}\" text-anchor=\"middle\" font-size=\"8.5\" fill=\"#e8eef4\" fill-opacity=\"0.7\">star</text>`;\n  for (const o of [-9, 0, 9]) {\n    const a = [sp[0] + dir[0] * 13 + perp[0] * o, sp[1] + dir[1] * 13 + perp[1] * o], b = [sp[0] + dir[0] * 30 + perp[0] * o, sp[1] + dir[1] * 30 + perp[1] * o];\n    back += `<line x1=\"${fx(a[0])}\" y1=\"${fx(a[1])}\" x2=\"${fx(b[0])}\" y2=\"${fx(b[1])}\" stroke=\"#ffd27a\" stroke-width=\"1.2\" stroke-opacity=\"0.8\" marker-end=\"url(#dl-arr)\"/>`;\n  }\n  // ── THE AXIS: the end toward the reader is drawn over the cube, the other under it ──\n  const half = Math.sqrt(3), L = half + 1.05;\n  const north = { from: P(axis.map((c) => c * half)), to: P(axis.map((c) => c * L)), lab: P(axis.map((c) => c * (L + 0.42))) };\n  const south = { from: P(axis.map((c) => -c * half)), to: P(axis.map((c) => -c * L)), lab: P(axis.map((c) => -c * (L + 0.42))) };\n  const axisLine = (e, t) => `<line x1=\"${fx(e.from[0])}\" y1=\"${fx(e.from[1])}\" x2=\"${fx(e.to[0])}\" y2=\"${fx(e.to[1])}\" stroke=\"#e8eef4\" stroke-width=\"1.4\" stroke-linecap=\"round\"/>`\n    + `<text x=\"${fx(e.lab[0])}\" y=\"${fx(e.lab[1] + 3.2)}\" text-anchor=\"middle\" font-size=\"9\" font-weight=\"700\" fill=\"#e8eef4\" stroke=\"#0a0d12\" stroke-width=\"2.4\" stroke-opacity=\"0.85\" paint-order=\"stroke\">${t}</text>`;\n  const nFront = dot(axis, VIEW) >= 0;\n  if (nFront) back += axisLine(south, 'S'); else back += axisLine(north, 'N');\n  // ── THE FACES, each shaded by its share of today in sunlight ──\n  let you = null;\n  for (const f of faces) {\n    const n = place(f.n), facing = dot(n, VIEW);\n    if (facing <= 0.02) continue;\n    const ax = f.n.findIndex((c) => c !== 0), sg = f.n[ax], o1 = (ax + 1) % 3, o2 = (ax + 2) % 3;\n    const corners = [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([u, v]) => { const c = [0, 0, 0]; c[ax] = sg; c[o1] = u; c[o2] = v; return P(place(c)); });\n    front += `<polygon data-face=\"${f.id}\" data-share=\"${f.share.toFixed(4)}\" points=\"${corners.map(pt).join(' ')}\" fill=\"${shadeOf(f.share)}\" stroke=\"#e8eef4\" stroke-opacity=\"0.55\" stroke-width=\"0.8\" stroke-linejoin=\"round\"/>`;\n    if (f.north === d.north && (!you || facing > you.facing)) you = { facing, at: P(place(f.n)) };\n  }\n  if (you) front += `<circle cx=\"${fx(you.at[0])}\" cy=\"${fx(you.at[1])}\" r=\"2.6\" fill=\"#0a0d12\" stroke=\"#e8eef4\" stroke-width=\"1.2\"/>`;\n  front += nFront ? axisLine(north, 'N') : axisLine(south, 'S');\n  // ── THE WORDS: each hemisphere's day, and which one you are in ──\n  const share = (north) => faces.find((f) => f.north === north).share;\n  const amount = (s) => (s >= 1 ? 'polar day' : s <= 0 ? 'polar night' : daylightAmountText(s, d.daySec));\n  let words = `<text x=\"150\" y=\"14\" font-size=\"8.5\" letter-spacing=\"0.6\" fill=\"#e8eef4\" fill-opacity=\"0.7\">TILT ${Math.round(d.tilt)}°</text>`;\n  [true, false].forEach((nh, i) => {\n    const y = 30 + i * 26, s = share(nh);\n    words += `<rect x=\"150\" y=\"${y - 8}\" width=\"9\" height=\"9\" rx=\"1.5\" fill=\"${shadeOf(s)}\" stroke=\"#e8eef4\" stroke-opacity=\"0.55\" stroke-width=\"0.8\"/>`\n           + `<text x=\"163\" y=\"${y}\" font-size=\"9.5\" fill=\"#e8eef4\" fill-opacity=\"0.85\">${nh ? 'North' : 'South'} faces</text>`\n           + `<text x=\"163\" y=\"${y + 11}\" font-size=\"10\" font-weight=\"700\" fill=\"#e8eef4\">${escT(amount(s))}</text>`;\n    if (nh === d.north) words += `<circle cx=\"154.5\" cy=\"${y - 3.5}\" r=\"2.2\" fill=\"#0a0d12\" stroke=\"#e8eef4\" stroke-width=\"1\"/>`;\n  });\n  words += `<circle cx=\"154.5\" cy=\"79.5\" r=\"2.2\" fill=\"#0a0d12\" stroke=\"#e8eef4\" stroke-width=\"1\"/>`\n         + `<text x=\"160\" y=\"82.5\" font-size=\"8\" fill=\"#e8eef4\" fill-opacity=\"0.7\">${d.onFoot ? 'you stand here' : 'you\\u2019d land here'}</text>`\n         + `<rect x=\"150\" y=\"88\" width=\"80\" height=\"4\" rx=\"2\" fill=\"url(#dl-key)\"/>`\n         + `<text x=\"150\" y=\"100.5\" font-size=\"8\" fill=\"#e8eef4\" fill-opacity=\"0.65\">no sun</text><text x=\"230\" y=\"100.5\" text-anchor=\"end\" font-size=\"8\" fill=\"#e8eef4\" fill-opacity=\"0.65\">all day</text>`;\n  defs += `<linearGradient id=\"dl-key\"><stop offset=\"0\" stop-color=\"${shadeOf(0)}\"/><stop offset=\"1\" stop-color=\"${shadeOf(1)}\"/></linearGradient>`;\n  // ── THE YEAR: each hemisphere's daylight through it, the solstices, and now ──\n  const X0 = 22, X1 = 230, xAt = (p) => X0 + (X1 - X0) * p;\n  for (const nh of [true, false]) {\n    const sl = nh ? FACES[0].sinLat : FACES[3].sinLat;\n    let stops = '';\n    for (let i = 0; i <= 48; i++) stops += `<stop offset=\"${(i / 48).toFixed(4)}\" stop-color=\"${shadeOf(shareOnCurve(sl, d.tilt, i / 48))}\"/>`;\n    defs += `<linearGradient id=\"dl-y${nh ? 'n' : 's'}\">${stops}</linearGradient>`;\n  }\n  let year = `<text x=\"${X0 - 4}\" y=\"121.5\" text-anchor=\"end\" font-size=\"7\" fill=\"#e8eef4\" fill-opacity=\"0.7\">N</text>`\n           + `<text x=\"${X0 - 4}\" y=\"128\" text-anchor=\"end\" font-size=\"7\" fill=\"#e8eef4\" fill-opacity=\"0.7\">S</text>`\n           + `<rect x=\"${X0}\" y=\"116\" width=\"${X1 - X0}\" height=\"6\" fill=\"url(#dl-yn)\"/><rect x=\"${X0}\" y=\"122\" width=\"${X1 - X0}\" height=\"6\" fill=\"url(#dl-ys)\"/>`\n           + `<rect x=\"${X0}\" y=\"116\" width=\"${X1 - X0}\" height=\"12\" rx=\"1\" fill=\"none\" stroke=\"#e8eef4\" stroke-opacity=\"0.4\" stroke-width=\"0.7\"/>`;\n  for (const [p, lab] of [[0.25, 'N midsummer'], [0.75, 'S midsummer']]) {\n    year += `<line x1=\"${fx(xAt(p))}\" y1=\"114\" x2=\"${fx(xAt(p))}\" y2=\"130\" stroke=\"#e8eef4\" stroke-opacity=\"0.8\" stroke-width=\"0.9\"/>`\n          + `<text x=\"${fx(xAt(p))}\" y=\"137.5\" text-anchor=\"middle\" font-size=\"7.5\" fill=\"#e8eef4\" fill-opacity=\"0.75\">${lab}</text>`;\n  }\n  const xn = xAt(frac(d.phase));\n  year += `<path d=\"M${fx(xn - 4)},108L${fx(xn + 4)},108L${fx(xn)},114z\" fill=\"#e8eef4\"/>`\n        + `<text x=\"${fx(xn + (xn > 200 ? -6 : 6))}\" y=\"112.5\" text-anchor=\"${xn > 200 ? 'end' : 'start'}\" font-size=\"8\" font-weight=\"700\" fill=\"#e8eef4\">now</text>`;\n  const label = `The world's axis leans ${Math.round(d.tilt)}°. North faces: ${amount(share(true))}; south faces: ${amount(share(false))}.`;\n  return `<svg class=\"ip-daylight\" viewBox=\"0 0 ${W} ${H}\" width=\"${W}\" height=\"${H}\" role=\"img\" aria-label=\"${escT(label)}\"`\n       + ` style=\"display:block;width:100%;max-width:300px;height:auto;margin:8px 0 2px;font-family:inherit\">`\n       + `<defs>${defs}</defs>${back}${front}${words}${year}</svg>`;\n}\n\n// ── WHERE A STAR STANDS IN THE SKY ───────────────────────────────────────────────────────────────────────────\n// sunGeometry was diurnal.mjs's (PHY-08), where the walker's day-and-night temperature was worked out from it. That\n// temperature is gone (the owner, Oct 12: \"the entire worlds are one temperature — seasons only affects daylight/\n// geometry\"), and diurnal.mjs with it; what is left of it is this, the geometry of the sun over a spot, which the sky,\n// the daylight chip and Info's daylight lines read. It is light only.\nconst clampD = (v, lo, hi) => (v < lo ? lo : v > hi ? hi : v);\n// Every star and world sits in the Y = 0 plane, and a world without seasons turns about the system's +Y axis, so a\n// star seen from it is always on its equator (a tilted one leans its axis: see `axis` below). From your local up (unit, world frame) and the direction to one star (unit):\n//   mu     how high it stands: the cosine of its angle from straight up (1 overhead, 0 on the horizon, <0 below)\n//   k      how high it CAN stand here over a day: the size of up's component across the spin axis. 0.82 on a cube\n//          face, up to 1 on the edges round the middle, 0 at the two poles, where the sun only circles the horizon\n//   theta  the hour angle: 0 at local noon, negative in the morning, positive after, and ±π at midnight\n// so that mu = k·cos(theta). theta is measured the way the renderer turns things (three's rotation.y, which carries a\n// fixed point to a LOWER atan2(z, x) as it grows), which makes it rise with time on every world that turns faster than\n// it orbits, which is all of them but the locked ones.\n// `out` is filled and returned when given, so the walker can take this every frame without making garbage.\n// …ON A TILTED WORLD (World Seasons phase 2) the world no longer turns about +Y: its axis leans by its tilt (seasons.mjs\n// axisLean), and the star stands its declination off the equator. `axis` (unit, world frame; the world's own north)\n// is then handed in, and everything is measured against it instead: k across it, theta round it, and three more that a\n// leaning axis makes worth having:\n//   mu0    the height the sun would have on the equator, at the same hour: up · (the sun's direction with its part along\n//          the axis taken off, renormalised), which is k·cos(theta)\n//   upA    the local up's part along the axis: the sine of the latitude (daylightShare's sinLat)\n//   sinDec the sun's part along it: the sine of its declination\n// Without one, the axis is +Y and every number is computed as it always was, to the bit (and mu0 is mu, which on an\n// untilted world it is: the sun has no part along the axis).\nexport function sunGeometry(up, dir, out, axis) {\n  const o = out || {};\n  o.mu = 0; o.k = 0; o.theta = 0; o.mu0 = 0; o.upA = 0; o.sinDec = 0;\n  if (!up || !dir) return o;\n  const ux = up.x, uy = up.y, uz = up.z, dx = dir.x, dy = dir.y, dz = dir.z;\n  if (!(fin(ux) && fin(uy) && fin(uz) && fin(dx) && fin(dy) && fin(dz))) return o;\n  if (axis && fin(axis.x) && fin(axis.y) && fin(axis.z)) {\n    const ax = axis.x, ay = axis.y, az = axis.z;\n    const ua = ux * ax + uy * ay + uz * az, da = dx * ax + dy * ay + dz * az;\n    const px = ux - ua * ax, py = uy - ua * ay, pz = uz - ua * az;          // up, across the axis\n    const qx = dx - da * ax, qy = dy - da * ay, qz = dz - da * az;          // the sun, across the axis\n    const ql = Math.hypot(qx, qy, qz);\n    o.k = clampD(Math.hypot(px, py, pz), 0, 1);\n    o.mu = clampD(ux * dx + uy * dy + uz * dz, -1, 1);\n    o.upA = clampD(ua, -1, 1); o.sinDec = clampD(da, -1, 1);\n    // (d × u) · axis, the same handedness as the untilted branch's ux·dz − uz·dx (which is (d × u) · +Y)\n    const cr = (dy * uz - dz * uy) * ax + (dz * ux - dx * uz) * ay + (dx * uy - dy * ux) * az;\n    const theta = o.k > 1e-9 && ql > 1e-9 ? Math.atan2(cr, px * qx + py * qy + pz * qz) : 0;\n    o.theta = fin(theta) ? theta : 0;\n    o.mu0 = ql > 1e-9 ? clampD((px * qx + py * qy + pz * qz) / ql, -1, 1) : 0;\n    return o;\n  }\n  o.k = clampD(Math.hypot(ux, uz), 0, 1);\n  o.mu = clampD(ux * dx + uy * dy + uz * dz, -1, 1);\n  const theta = o.k > 1e-9 ? Math.atan2(ux * dz - uz * dx, ux * dx + uz * dz) : 0;\n  o.theta = fin(theta) ? theta : 0;\n  o.mu0 = o.mu; o.upA = clampD(uy, -1, 1); o.sinDec = clampD(dy, -1, 1);\n  return o;\n}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