)
============================================================ */
function initSolPrehome() {
var wrapper = document.getElementById('solPageWrapper');
var prehome = document.getElementById('solPrehome');
if (!wrapper || !prehome) return;
var columns = Array.prototype.slice.call(prehome.querySelectorAll('.sol-column'));
if (!columns.length) return;
var EXPANDED_W = '75%';
var COLLAPSED_W = '12.5%'; // (100 - 75) / 2 = 12.5%
var DEFAULT_W = '33.33%';
var activeIndex = -1; // -1 = no column active
/* ---------- helpers ---------- */
function setColumnWidths(expandedIdx) {
columns.forEach(function (col, i) {
if (i === expandedIdx) {
col.style.width = EXPANDED_W;
col.classList.add('is-active');
} else {
col.style.width = expandedIdx === -1 ? DEFAULT_W : COLLAPSED_W;
col.classList.remove('is-active');
}
/* Color-tag: hide (slide down out) on active column,
show normally on the others */
var tag = col.querySelector('.sol-color-tag');
if (tag) {
tag.style.transform = (i === expandedIdx) ? 'translateY(100%)' : 'translateY(0)';
}
});
activeIndex = expandedIdx;
}
function resetAll() {
setColumnWidths(-1);
}
/* ---------- desktop mouse events ---------- */
columns.forEach(function (col, i) {
col.addEventListener('mouseenter', function () {
if (activeIndex !== i) {
setColumnWidths(i);
}
});
});
prehome.addEventListener('mouseleave', function () {
resetAll();
});
/* ---------- touch / mobile: tap to toggle ---------- */
columns.forEach(function (col, i) {
col.addEventListener('click', function (e) {
/* On desktop, clicking a link inside should navigate normally */
if (e.target.tagName === 'A') return;
if (activeIndex === i) {
/* Tapping the already-active column collapses it */
resetAll();
} else {
setColumnWidths(i);
}
});
});
/* ---------- keyboard / accessibility ---------- */
columns.forEach(function (col, i) {
col.setAttribute('tabindex', '0');
col.setAttribute('role', 'button');
col.addEventListener('focus', function () {
setColumnWidths(i);
});
col.addEventListener('keydown', function (e) {
/* Enter or Space activates; Escape resets */
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
var link = col.querySelector('a.sol-cta');
if (link) link.click();
}
if (e.key === 'Escape') {
resetAll();
col.blur();
}
});
});
/* Blur-out: reset when focus leaves the entire prehome */
prehome.addEventListener('focusout', function (e) {
/* Only reset if focus moved outside the prehome entirely */
if (!prehome.contains(e.relatedTarget)) {
resetAll();
}
});
/* ---------- initial state: activate first column ---------- */
setColumnWidths(0);
/* After a moment, reset so it's in the neutral (no hover) state
but with the first column subtly "invited" — or keep it active.
Remove the setTimeout below if you want it to stay expanded. */
setTimeout(function () {
resetAll();
}, 1800);
}
/* Run after DOM is ready */
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initSolPrehome);
} else {
initSolPrehome();
}
})();