/* ═══════════════════════════════════════════════════════════════════════ THE BUTTON UNDER "HOW IT WORKS" FOLLOWS THE RING. One button for eight chapters used to say one fixed thing and go one fixed place. It now names whichever chapter has turned to the front and links to that chapter, so it is always offering the thing being looked at. It reads the ring rather than being told by it: orbit.js already marks the front card `is-front`, and the card already carries its chapter's name, its one-line description and its address. Nothing new had to be plumbed through, and if the ring ever changes how it turns, this keeps working. The words are NOT written here. The line under the name is the chapter's own `role`, edited in Backstage → Map — a claim about what a chapter delivers belongs to whoever is accountable for it, not to a script. ═══════════════════════════════════════════════════════════════════════ */ (function () { var link = document.querySelector('[data-howmore]'); var ring = document.querySelector('#orbitHow'); if (!link || !ring) return; var nameEl = link.querySelector('[data-howmorename]'); var roleEl = link.querySelector('[data-howmorerole]'); var showing = ''; function follow() { var front = ring.querySelector('.orbit__node.is-front .ocard'); if (!front) return; var href = front.getAttribute('data-href') || ''; if (!href || href === showing) return; // nothing has changed showing = href; var strong = front.querySelector('.ocard__body strong'); var em = front.querySelector('.ocard__body em'); var name = strong ? strong.textContent.trim() : ''; var role = em ? em.textContent.trim() : ''; link.href = href; if (nameEl) nameEl.textContent = name; if (roleEl) roleEl.textContent = role; link.setAttribute('aria-label', name + ' — ' + role); /* so Backstage → Presses can say WHICH chapter was the one that persuaded somebody, not just that the section's button was pressed */ link.setAttribute('data-cta-label', 'Chapter: ' + name); } /* The ring is driven by its own animation frame and never announces itself, so this watches the class it sets. A MutationObserver rather than a timer: it fires when the front card actually changes and costs nothing when the ring is holding still under a pointer. */ if (window.MutationObserver) { new MutationObserver(follow).observe(ring, { subtree: true, attributes: true, attributeFilter: ['class'], }); } /* and once at the start, for the card that is already at the front */ follow(); })();