Mobile: menu, page titles, hero, retreat carousel, people tiles

- The mobile menu centers when it fits and starts at the top when
  it's taller than the screen (safe center), so its top is
  reachable; its close button is a 44px target.
- Page titles and the hero headline start a size smaller on phones
  and break long words instead of being cut off.
- Hero: the split buttons stack on a phone (the slash from sm); the
  slide dots and pause button are 40px targets and wrap; photo heroes
  leave room for the caption above the buttons.
- Retreat carousel: phone-sized padding and type; on a phone the
  arrows sit beside the dots instead of over the text, dots are 40px
  targets, and a swipe turns it. The narrow event card layout gives
  the logo its own row (it had made a stray column).
- People tiles: the details panel slides to stay on screen with its
  notch under the tile; a third column only when tiles keep 60% of
  their width; a 40px close button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 22:42:20 -05:00
parent 2a926971f7
commit a907a47c24
8 changed files with 145 additions and 76 deletions

View file

@ -748,15 +748,23 @@ function DetailPanel({
onClose: () => void;
}) {
const panelRef = useRef<HTMLDivElement>(null);
const [alignEnd, setAlignEnd] = useState(false);
// How far the panel shifts from the tile's left edge, and where the
// notch sits on it, in px.
const [place, setPlace] = useState<{ shift: number; notch: number } | null>(null);
// Under the tile, starting at its left edge unless that would run
// off the right of the screen; then ending at its right edge.
// Under the tile, starting at its left edge, slid left just enough
// to stay 8px inside the screen on either side (a narrow phone
// included), with the notch kept under the tile's middle.
useLayoutEffect(() => {
if (!anchored || !panelRef.current) return;
const tile = panelRef.current.parentElement?.getBoundingClientRect();
if (!tile) return;
const width = panelRef.current.offsetWidth;
if (tile) setAlignEnd(tile.left + width > document.documentElement.clientWidth - 16);
const screen = document.documentElement.clientWidth;
let shift = Math.min(0, screen - 8 - (tile.left + width));
shift = Math.max(shift, 8 - tile.left);
const notch = Math.min(Math.max(tile.width / 2 - shift - 8, 8), width - 24);
setPlace({ shift, notch });
}, [anchored]);
const org = resolveOrg(person.org);
@ -770,10 +778,14 @@ function DetailPanel({
ref={panelRef}
id={id}
className={anchored ? "pl__bio pl__bio--anchored" : "pl__bio"}
data-align={alignEnd ? "end" : "start"}
style={
{
...(tint ? { "--pl-accent": tint } : null),
...(place ? { left: `${place.shift}px`, "--pl-notch": `${place.notch}px` } : null),
} as CSSProperties
}
role="region"
aria-label={`About ${person.name}`}
style={tint ? ({ "--pl-accent": tint } as CSSProperties) : undefined}
>
<div className="pl__bio-head">
<div>
@ -865,13 +877,17 @@ export function fitsOneRow(counts: number[], width: number, tile: number, gap: n
(never more than there are). If that would leave one tile alone on
the last row, one fewer across, so the last row has two: 7 that fit
6 across go 5 and 2. With only 2 across, a third, narrower column
takes the odd one instead (3 tiles on a phone go 3 across). */
takes the odd one instead, if tiles stay at least 60% of full
width; on a narrow phone a lone last tile beats three unreadable
ones. */
export function balancedColumns(count: number, width: number, tile: number, gap: number): number {
if (count <= 1) return 1;
const fit = Math.floor((width + gap) / (tile + gap));
const cols = Math.min(count, 10, Math.max(2, fit));
if (count % cols !== 1) return cols;
return cols > 2 ? cols - 1 : Math.min(count, 3);
if (cols > 2) return cols - 1;
const third = (width - 2 * gap) / 3;
return count >= 3 && third >= tile * 0.6 ? 3 : 2;
}
/* A string id is a people slug; a numeric or missing one is a