.justice-mercy-wrapper {
width: 100%;
box-sizing: border-box;
padding: 28px 10px 32px;
text-align: center;
font-family: Verdana, Arial, sans-serif;
color: inherit;
}
.justice-mercy-poem {
width: 100%;
margin: 0 auto;
line-height: 1.18;
}
.justice-mercy-title {
font-weight: bold;
margin-bottom: 16px;
}
.justice-mercy-stanza {
margin-bottom: 16px;
}
.justice-mercy-line {
white-space: nowrap;
}
.justice-mercy-author {
margin-top: 10px;
margin-bottom: 26px;
}
.justice-mercy-references {
width: 100%;
max-width: 700px;
margin: 0 auto;
font-size: inherit;
line-height: 1.3;
text-align: center;
white-space: normal;
}
.justice-mercy-ref-title {
margin-bottom: 10px;
}
.justice-mercy-reference {
margin-bottom: 8px;
white-space: normal;
}
(function () {
function fitJusticeMercyPoem() {
const poem = document.getElementById(‘justiceMercyPoem’);
if (!poem) return;
const lines = poem.querySelectorAll(‘.justice-mercy-line’);
if (!lines.length) return;
const availableWidth = poem.clientWidth – 8;
poem.style.fontSize = ’16px’;
let longestWidth = 0;
lines.forEach(function(line) {
longestWidth = Math.max(longestWidth, line.scrollWidth);
});
let newSize = 16;
if (longestWidth > availableWidth) {
newSize = 16 * (availableWidth / longestWidth);
}
newSize = Math.min(16, Math.max(8, newSize));
poem.style.fontSize = newSize + ‘px’;
const references = document.querySelector(‘.justice-mercy-references’);
if (references) {
references.style.fontSize = newSize + ‘px’;
}
}
fitJusticeMercyPoem();
window.addEventListener(‘resize’, fitJusticeMercyPoem);
setTimeout(fitJusticeMercyPoem, 250);
setTimeout(fitJusticeMercyPoem, 1000);
})();