diff --git a/frontend/src/scripts/emailApi.js b/frontend/src/scripts/emailApi.js index dab6626..cbca926 100644 --- a/frontend/src/scripts/emailApi.js +++ b/frontend/src/scripts/emailApi.js @@ -3,11 +3,7 @@ * Sends registration confirmation emails through the Node.js Nodemailer backend. */ -const BACKEND_URL = ( - import.meta.env?.VITE_BACKEND_URL || - import.meta.env?.VITE_EMAIL_API_URL || - '' -) +const BACKEND_URL = (import.meta.env?.VITE_BACKEND_URL || import.meta.env?.VITE_EMAIL_API_URL || '') .trim() .replace(/\/+$/, ''); diff --git a/frontend/src/scripts/event-cards.js b/frontend/src/scripts/event-cards.js index 07fc616..359e17b 100644 --- a/frontend/src/scripts/event-cards.js +++ b/frontend/src/scripts/event-cards.js @@ -4,6 +4,10 @@ import { prefersReducedMotion } from './device.js'; * "Our other haunts": each card starts closed (picture + title). Tapping it * rattles the frame like something unseen knocked it, then opens the details. * Tapping again closes it. Reduced-motion users get the open/close without the rattle. + * + * The full card surface is the click target (via a ::after overlay on .event-card). + * Clicks anywhere on the card — including the image well, tag, and hint — are + * forwarded to the toggle button so that aria-expanded stays in sync. */ export function initEventCards(root = document) { const cards = root.querySelectorAll('[data-event-card]'); @@ -16,7 +20,7 @@ export function initEventCards(root = document) { if (e.animationName === 'frame-rattle') card.classList.remove('is-rattling'); }); - toggle.addEventListener('click', () => { + function activateToggle() { const open = toggle.getAttribute('aria-expanded') !== 'true'; toggle.setAttribute('aria-expanded', String(open)); card.classList.toggle('is-open', open); @@ -26,6 +30,18 @@ export function initEventCards(root = document) { void card.offsetWidth; // restart the animation if tapped again quickly card.classList.add('is-rattling'); } + } + + // The toggle button handles its own clicks (keyboard, direct click). + toggle.addEventListener('click', activateToggle); + + // The card ::after overlay catches clicks that land outside the toggle button + // (on the image well, tag badge, hint text, etc.). We check that the click + // did NOT originate from inside the toggle itself to avoid double-firing. + card.addEventListener('click', (e) => { + if (!toggle.contains(e.target) && e.target !== toggle) { + activateToggle(); + } }); }); } diff --git a/frontend/src/styles/sections/curriculum.css b/frontend/src/styles/sections/curriculum.css index 8488cd7..14c1bdb 100644 --- a/frontend/src/styles/sections/curriculum.css +++ b/frontend/src/styles/sections/curriculum.css @@ -284,38 +284,82 @@ } @media (max-width: 700px) { - /* On phones the signs sit in a row under the picture instead of over the houses. */ + /* + * Layout on phones: + * + * ┌──────────────────────────────┐ order 0 — village frame (image) + * │ [Sign 1] [Sign 2] │ order 1 & 2 — both signs in one row + * ├──────────────────────────────┤ + * │ details panel (whichever │ order 3 — whichever scroll is visible + * │ session is open) │ + * └──────────────────────────────┘ + * + * Both signs always stay together. The details area sits entirely below + * them, so opening session 1 never pushes session 2's sign downward. + */ .village__stage { display: flex; flex-wrap: wrap; - justify-content: space-between; /* each sign sits under its own house */ + justify-content: space-between; gap: 14px; padding-inline: 2%; } .village__frame { flex: 0 0 100%; + order: 0; margin-inline: -2%; } + /* Both signs share order 1 — they sit side by side in the same flex row */ .sign { position: relative; inset: auto; translate: none; - padding: 7px 12px 8px; + padding: 7px 10px 8px; + flex: 1 1 0; + min-width: 0; + max-width: calc(50% - 7px); + order: 1; + } + .sign--one, + .sign--two { + order: 1; + } + .sign__kicker { + font-size: 0.75rem; } .sign__title { - font-size: 0.9375rem; + font-size: 0.875rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; } - .scroll { - position: absolute; - inset: 6px; - width: auto; - max-width: none; - padding: 16px 18px; + /* Both scroll panels sit after the sign row (order 3). + Only one is visible at a time (the other has [hidden]), so the + details area never shifts the signs. */ + .scroll, + .scroll--one, + .scroll--two { + position: relative; + inset: auto; + top: auto; + left: auto; + right: auto; + bottom: auto; + flex: 0 0 100%; + width: 100%; + max-width: 100%; + box-sizing: border-box; + order: 3; + margin-top: 6px; + padding: 18px 20px; border-radius: 18px; - overflow-y: auto; - z-index: 35; + overflow-y: visible; + z-index: 5; } - .scroll::before { + .scroll::before, + .scroll--one::before, + .scroll--two::before { display: none; } } diff --git a/frontend/src/styles/sections/events.css b/frontend/src/styles/sections/events.css index fc6b0d2..54e7bd1 100644 --- a/frontend/src/styles/sections/events.css +++ b/frontend/src/styles/sections/events.css @@ -108,6 +108,11 @@ outline: 3px solid var(--c-candle); outline-offset: 4px; } +/* Keep the ::after overlay below any interactive children that might be added inside the body */ +.event-card__body { + position: relative; + z-index: 2; +} .event-card__toggle { padding: 0; @@ -117,16 +122,24 @@ font: inherit; text-align: left; cursor: pointer; + /* Reset: the card itself is now the full click target */ } .event-card__toggle:focus-visible { outline: none; } -/* the whole card is the click target */ -.event-card__toggle::after { + +/* ------------------------------------------------------------------ + * The whole card face is the click target. + * We put the overlay on .event-card (position: relative) so it sits + * above all flex-children without fighting their stacking order. + * ------------------------------------------------------------------ */ +.event-card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; + cursor: pointer; + z-index: 1; } .event-card__hint {