diff --git a/hackathon_site/event/jinja2/event/landing.html b/hackathon_site/event/jinja2/event/landing.html
index 33971b8..13bb05f 100644
--- a/hackathon_site/event/jinja2/event/landing.html
+++ b/hackathon_site/event/jinja2/event/landing.html
@@ -393,29 +393,7 @@
@@ -494,6 +472,7 @@
Contact Us
+
diff --git a/hackathon_site/event/jinja2/event/stats-component.html b/hackathon_site/event/jinja2/event/stats-component.html
new file mode 100644
index 0000000..d72fab4
--- /dev/null
+++ b/hackathon_site/event/jinja2/event/stats-component.html
@@ -0,0 +1,56 @@
+
diff --git a/hackathon_site/event/static/event/js/stats-component.js b/hackathon_site/event/static/event/js/stats-component.js
new file mode 100644
index 0000000..556a6d8
--- /dev/null
+++ b/hackathon_site/event/static/event/js/stats-component.js
@@ -0,0 +1,222 @@
+// Keep the original scroll-driven lighting sequence while the compact stats
+// section stays at one page position in either direction.
+function initStatsScroll() {
+ const board = document.querySelector(".hackathonStats-board");
+ if (!board) return;
+ const section = board.closest(".hackathonStats");
+ const digits = Array.from(board.querySelectorAll(".hackathonStats-digit"));
+ const pins = Array.from(board.querySelectorAll(".hackathonStats-pin")).map(
+ (pin) => {
+ const boxDigits = pin
+ .closest(".hackathonStats-stat")
+ .querySelectorAll(".hackathonStats-digit");
+ const isRight =
+ pin.classList.contains("hackathonStats-pin--topRight") ||
+ pin.classList.contains("hackathonStats-pin--bottomRight");
+ return {
+ element: pin,
+ digitIndex: digits.indexOf(
+ boxDigits[isRight ? boxDigits.length - 1 : 0]
+ ),
+ };
+ }
+ );
+ const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
+ let travel = 0;
+ let distance = 0;
+ let enabled = false;
+ let locked = false;
+ let lastY = window.scrollY;
+ let touchY = null;
+
+ const clamp = (value) => Math.max(0, Math.min(1, value));
+
+ function paint() {
+ if (!enabled) return;
+ const lightProgress = clamp((distance / travel - 0.08) / 0.84);
+ const brightnesses = digits.map((digit, index) => {
+ const amount = clamp(lightProgress * digits.length - index);
+ return amount * amount * (3 - 2 * amount);
+ });
+ digits.forEach((digit, index) => {
+ const brightness = brightnesses[index];
+ const channel = Math.round(240 * (1 - brightness));
+ digit.style.setProperty(
+ "--stat-segment-color",
+ `rgb(${channel}, ${channel}, ${channel})`
+ );
+ digit.style.setProperty(
+ "--stat-segment-glow",
+ `0 0 5px rgba(245, 166, 35, ${brightness * 0.35})`
+ );
+ });
+ pins.forEach(({ element, digitIndex }) => {
+ element.style.setProperty("--pin-power", brightnesses[digitIndex]);
+ });
+ }
+
+ function measure() {
+ // Short viewports must still be able to scroll through the whole board.
+ enabled =
+ !reducedMotion.matches && section.offsetHeight <= window.innerHeight + 2;
+ board.classList.toggle("is-scroll-lit", enabled);
+ if (!enabled) {
+ locked = false;
+ pins.forEach(({ element }) => element.style.removeProperty("--pin-power"));
+ digits.forEach((digit) => {
+ digit.style.removeProperty("--stat-segment-color");
+ digit.style.removeProperty("--stat-segment-glow");
+ });
+ return;
+ }
+ travel = Math.max(720, window.innerHeight * 1.15);
+ paint();
+ }
+
+ function lockPosition() {
+ // Center the compact, naturally sized section before taking scroll input.
+ return (
+ section.getBoundingClientRect().top +
+ window.scrollY -
+ Math.max(0, (window.innerHeight - section.offsetHeight) / 2)
+ );
+ }
+
+ function holdPosition(anchor) {
+ lastY = anchor;
+ if (Math.abs(window.scrollY - anchor) > 0.5) {
+ window.scrollTo({ top: anchor, behavior: "instant" });
+ }
+ }
+
+ function consumeScroll(event, delta) {
+ if (!enabled || !delta) return;
+ const anchor = lockPosition();
+ const current = window.scrollY;
+ if (!locked) {
+ if (delta > 0 && current <= anchor + 1 && current + delta >= anchor) {
+ distance = 0;
+ delta -= Math.max(0, anchor - current);
+ } else if (
+ delta < 0 &&
+ current >= anchor - 1 &&
+ current + delta <= anchor
+ ) {
+ distance = travel;
+ delta += Math.max(0, current - anchor);
+ } else {
+ return;
+ }
+ locked = true;
+ } else if (
+ (distance === travel && delta > 0) ||
+ (distance === 0 && delta < 0)
+ ) {
+ locked = false;
+ return;
+ }
+
+ // scroll guard still restores Y while their deltas reverse the lights.
+ if (event.cancelable) event.preventDefault();
+ distance = Math.max(0, Math.min(travel, distance + delta));
+ holdPosition(anchor);
+ paint();
+ }
+
+ function guardScroll() {
+ if (!enabled) {
+ lastY = window.scrollY;
+ return;
+ }
+ const anchor = lockPosition();
+ const current = window.scrollY;
+ if (locked) {
+ holdPosition(anchor);
+ } else if (lastY < anchor - 1 && current >= anchor) {
+ // Covers scrolling initiated inside an iframe or by browser momentum.
+ locked = true;
+ distance = 0;
+ holdPosition(anchor);
+ paint();
+ } else if (lastY > anchor + 1 && current <= anchor) {
+ locked = true;
+ distance = travel;
+ holdPosition(anchor);
+ paint();
+ } else {
+ lastY = current;
+ }
+ }
+
+ window.addEventListener(
+ "wheel",
+ (event) => {
+ if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;
+ const unit =
+ event.deltaMode === 1
+ ? 16
+ : event.deltaMode === 2
+ ? window.innerHeight
+ : 1;
+ consumeScroll(event, event.deltaY * unit);
+ },
+ { passive: false }
+ );
+ window.addEventListener("keydown", (event) => {
+ if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey)
+ return;
+ if (event.target.closest("input, textarea, select, [contenteditable]")) return;
+ const step = window.innerHeight * 0.85;
+ const deltas = {
+ ArrowDown: 40,
+ ArrowUp: -40,
+ PageDown: step,
+ PageUp: -step,
+ " ": event.shiftKey ? -step : step,
+ };
+ consumeScroll(event, deltas[event.key]);
+ });
+ window.addEventListener(
+ "touchstart",
+ (event) => {
+ touchY = event.touches.length === 1 ? event.touches[0].clientY : null;
+ },
+ { passive: true }
+ );
+ window.addEventListener(
+ "touchmove",
+ (event) => {
+ if (touchY === null || event.touches.length !== 1) return;
+ const nextY = event.touches[0].clientY;
+ const delta = touchY - nextY;
+ touchY = nextY;
+ consumeScroll(event, delta);
+ },
+ { passive: false }
+ );
+ window.addEventListener("touchend", () => {
+ touchY = null;
+ });
+ window.addEventListener("scroll", guardScroll, { passive: true });
+ window.addEventListener("resize", measure);
+ window.addEventListener("pageshow", measure);
+ reducedMotion.addEventListener("change", measure);
+ if (typeof ResizeObserver !== "undefined") {
+ new ResizeObserver(measure).observe(section.querySelector(".section"));
+ }
+ measure();
+
+ // Direct links to the heading should show the centered board at its start.
+ function alignStatsLink() {
+ if (window.location.hash !== "#hackathon-stats-title") return;
+ distance = 0;
+ locked = true;
+ holdPosition(lockPosition());
+ paint();
+ }
+ window.addEventListener("hashchange", alignStatsLink);
+ window.addEventListener("pageshow", alignStatsLink);
+ alignStatsLink();
+}
+
+$(document).ready(initStatsScroll);
diff --git a/hackathon_site/event/static/event/styles/scss/_stats-component.scss b/hackathon_site/event/static/event/styles/scss/_stats-component.scss
new file mode 100644
index 0000000..f27ed63
--- /dev/null
+++ b/hackathon_site/event/static/event/styles/scss/_stats-component.scss
@@ -0,0 +1,401 @@
+// "Hackathon stats" section
+.hackathonStats {
+ background: #fff;
+ color: #333;
+ padding: 34px 0 24px;
+
+ .section {
+ max-width: 1000px;
+ padding: 0;
+ width: 90%;
+ }
+
+ h3 {
+ color: #333;
+ font-size: 25px;
+ font-weight: 700;
+ letter-spacing: 3px;
+ line-height: 1.4;
+ margin: 0 0 24px;
+ text-align: center;
+ }
+
+ &-board {
+ aspect-ratio: 800 / 146;
+ container-type: inline-size;
+ margin: 0 auto;
+ max-width: 800px;
+ position: relative;
+ }
+
+ &-wiring,
+ &-readouts {
+ inset: 0;
+ margin: 0;
+ position: absolute;
+ }
+
+ &-bus {
+ background: #398dc1;
+ height: 0.375cqw;
+ left: 3%;
+ position: absolute;
+ top: 38.356%;
+ transform: translateY(-50%);
+ width: 93.75%;
+ }
+
+ // A skewed border supplies each diagonal without SVG or image assets.
+ &-trace {
+ border-left: 0.225cqw solid #65abda;
+ border-top: 0.225cqw solid #65abda;
+ position: absolute;
+ transform: translateY(var(--trace-rise));
+
+ &--diagonal {
+ background: #65abda;
+ border: 0;
+ clip-path: polygon(
+ 0 0,
+ 0.225cqw 0,
+ 100% calc(100% - 0.225cqw),
+ 100% 100%,
+ calc(100% - 0.225cqw) 100%,
+ 0 0.225cqw
+ );
+ transform: translateY(var(--trace-rise)) scaleX(var(--trace-direction));
+ }
+ }
+
+ &-node,
+ &-terminal,
+ &-resistor {
+ position: absolute;
+ top: 38.356%;
+ transform: translate(-50%, -50%);
+ }
+
+ &-terminal {
+ background: #398dc1;
+ border-radius: 2px;
+ height: 4cqw;
+ width: 0.375cqw;
+ }
+
+ &-node {
+ background: #fff;
+ border: 0.1875cqw solid #f5a623;
+ border-radius: 50%;
+ height: 1.125cqw;
+ width: 1.125cqw;
+ z-index: 1;
+ }
+
+ &-resistor {
+ background: repeating-linear-gradient(
+ 90deg,
+ #fff 0,
+ #fff 0.75cqw,
+ #f5a623 0.75cqw,
+ #f5a623 0.95cqw
+ );
+ border: 0.1875cqw solid #f5a623;
+ border-radius: 0.3cqw;
+ height: 1.75cqw;
+ width: 3cqw;
+ }
+
+ &-stat {
+ height: 60.274%;
+ position: absolute;
+ top: 8.219%;
+
+ dt {
+ color: #333;
+ font-size: 13px;
+ left: 50%;
+ letter-spacing: 1.8px;
+ position: absolute;
+ top: 132%;
+ transform: translateX(-50%);
+ text-transform: uppercase;
+ }
+
+ dd {
+ align-items: center;
+ background: #fff;
+ border: 0.225cqw solid #333;
+ display: flex;
+ height: 100%;
+ justify-content: center;
+ margin: 0;
+ position: relative;
+
+ &::before,
+ &::after {
+ background: #f5b13d;
+ content: "";
+ height: 0.75cqw;
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 1.5cqw;
+ }
+
+ &::before {
+ left: -0.75cqw;
+ }
+ &::after {
+ right: -0.75cqw;
+ }
+ }
+ }
+
+ &-hackers {
+ left: 20.25%;
+ width: 18%;
+ }
+ &-projects {
+ left: 45.75%;
+ width: 14%;
+ }
+ &-sponsors {
+ left: 67.25%;
+ width: 11.75%;
+ }
+
+ &-digits {
+ display: flex;
+ gap: 1.125cqw;
+ }
+ &-digit {
+ height: 7.5cqw;
+ position: relative;
+ width: 3.75cqw;
+ }
+
+ &-segment {
+ background: #f0f0f0;
+ position: absolute;
+
+ &--a,
+ &--d,
+ &--g {
+ clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
+ height: 10%;
+ left: 6.667%;
+ width: 86.667%;
+ }
+
+ &--a {
+ top: 0;
+ }
+ &--d {
+ bottom: 0;
+ }
+ &--g {
+ top: 45%;
+ }
+
+ &--b,
+ &--c,
+ &--e,
+ &--f {
+ clip-path: polygon(50% 0, 100% 10%, 100% 90%, 50% 100%, 0 90%, 0 10%);
+ height: 40%;
+ width: 20%;
+ }
+
+ &--b {
+ right: 0;
+ top: 6.667%;
+ }
+ &--c {
+ right: 0;
+ bottom: 6.667%;
+ }
+ &--e {
+ left: 0;
+ bottom: 6.667%;
+ }
+ &--f {
+ left: 0;
+ top: 6.667%;
+ }
+ }
+
+ // Each digit switches on the matching seven-segment pieces.
+ $digit-segments: (
+ "0": (
+ a,
+ b,
+ c,
+ d,
+ e,
+ f,
+ ),
+ "1": (
+ b,
+ c,
+ ),
+ "2": (
+ a,
+ b,
+ d,
+ e,
+ g,
+ ),
+ "3": (
+ a,
+ b,
+ c,
+ d,
+ g,
+ ),
+ "4": (
+ b,
+ c,
+ f,
+ g,
+ ),
+ "5": (
+ a,
+ c,
+ d,
+ f,
+ g,
+ ),
+ "6": (
+ a,
+ c,
+ d,
+ e,
+ f,
+ g,
+ ),
+ "7": (
+ a,
+ b,
+ c,
+ ),
+ "8": (
+ a,
+ b,
+ c,
+ d,
+ e,
+ f,
+ g,
+ ),
+ "9": (
+ a,
+ b,
+ c,
+ d,
+ f,
+ g,
+ ),
+ );
+
+ @each $digit, $segments in $digit-segments {
+ @each $segment in $segments {
+ &-digit[data-digit="#{$digit}"] .hackathonStats-segment--#{$segment} {
+ background: var(--stat-segment-color, #000);
+ box-shadow: var(--stat-segment-glow, none);
+ }
+ }
+ }
+
+ &-board.is-scroll-lit &-digit {
+ --stat-segment-color: #f0f0f0;
+ }
+
+ &-segment {
+ transition: background-color 180ms ease, box-shadow 180ms ease;
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ &-segment {
+ transition: none;
+ }
+ }
+
+ &-board.is-scroll-lit &-pin {
+ --pin-power: 0;
+ }
+
+ &-pin {
+ --pin-power: 1;
+ background: rgb(
+ calc(91 + 164 * var(--pin-power)),
+ calc(76 + 140 * var(--pin-power)),
+ calc(40 + 24 * var(--pin-power))
+ );
+ border: 1.5px solid #f5a623;
+ border-radius: 2px;
+ box-shadow: 0 0 5px rgba(255, 190, 0, var(--pin-power)),
+ 0 0 13px rgba(255, 174, 0, calc(var(--pin-power) * 0.8)),
+ 0 0 22px rgba(255, 174, 0, calc(var(--pin-power) * 0.4));
+ height: clamp(7px, 1.25cqw, 10px);
+ position: absolute;
+ transition: background-color 180ms ease, box-shadow 180ms ease;
+ width: clamp(7px, 1.25cqw, 10px);
+ z-index: 2;
+
+ &--topLeft {
+ left: 0;
+ top: 0;
+ transform: translate(-50%, -50%);
+ }
+ &--topRight {
+ right: 0;
+ top: 0;
+ transform: translate(50%, -50%);
+ }
+ &--bottomLeft {
+ left: 0;
+ bottom: 0;
+ transform: translate(-50%, 50%);
+ }
+ &--bottomRight {
+ right: 0;
+ bottom: 0;
+ transform: translate(50%, 50%);
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ &-pin {
+ transition: none;
+ }
+ }
+
+ &-value {
+ clip-path: inset(50%);
+ height: 1px;
+ overflow: hidden;
+ position: absolute;
+ white-space: nowrap;
+ width: 1px;
+ }
+
+ @media (max-width: 600px) {
+ padding: 28px 0 20px;
+ .container {
+ width: 96%;
+ }
+ h3 {
+ font-size: clamp(15px, 4.5vw, 19px);
+ letter-spacing: 1.5px;
+ margin-bottom: 20px;
+ }
+ &-stat dt {
+ font-size: clamp(9px, 2.5vw, 10px);
+ letter-spacing: 0.8px;
+ }
+ &-board {
+ margin-bottom: 10px;
+ }
+ }
+}
+// End of "Hackathon stats" section
diff --git a/hackathon_site/event/static/event/styles/scss/styles.scss b/hackathon_site/event/static/event/styles/scss/styles.scss
index 01a65be..34e214d 100644
--- a/hackathon_site/event/static/event/styles/scss/styles.scss
+++ b/hackathon_site/event/static/event/styles/scss/styles.scss
@@ -379,19 +379,7 @@ nav ul a {
}
// End of "Schedule" section
-// "Hackathon stats" section
-.stat {
- @include flexPosition($alIte: center, $dir: column);
- &-number {
- margin: 10px 0;
- font-weight: 700;
- }
-
- @include responsive(sm-down) {
- margin-bottom: 25px;
- }
-}
-// End of "Hackathon stats" section
+@import "stats-component";
// "Sponsors" section
.sponsorImgs {