diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index abe1343..19e25ea 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -18,8 +18,8 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: + # Keep cache-free so this also runs where no Actions cache service exists. node-version: 22 - cache: npm - name: Check run: make check diff --git a/.impeccable/surfaces/cool.md b/.impeccable/surfaces/cool.md new file mode 100644 index 0000000..13ec5e5 --- /dev/null +++ b/.impeccable/surfaces/cool.md @@ -0,0 +1,42 @@ +--- +version: 1 +slug: "cool" +primary_target: "cool" +related_targets: ["/cool/stage", "/cool/city", "/plan"] +--- + +# Surface brief — Cool City decision demo + +## Scope + +Primary: `/cool` (public, person-first route decision). Related: `/cool/stage` (projector keynote), `/cool/city` (cooling-gap module), `/plan` (retail module, linked only). + +## Audience and job + +Ruth, 78, lives alone — a composite, not a real person. She needs bread from Marktplatz on a hot day. The phone answers which way now; the stage tells the room the same story. The audience votes; the model recommends **Accessible for Ruth**. + +## Success + +- `/cool` is minimal: Ruth card, time slider, three route cards with shade and direct-sun minutes, vote buttons. No map dashboard, sensor table, weather card or methodology paragraphs. +- `/cool?vote=1` is only the question and three buttons. No map, no PII. +- `/cool/stage` is a keynote: Ruth card → Cool places → Data honesty → Find routes → 10:00→16:00 → Start vote → Lock vote → City view → Retail module → close. Quiet presenter controls, exact labels. +- The key insight is visible: the shaded route is 732 m / 9.8 min, 50.0% shade but 4.9 direct-sun min versus the shortest 359 m / 4.8 min, 43.8% shade, 2.7 min, with a 15% ramp. The accessible route is 438 m / 5.8 min, 43.8% shade, 3.3 min, no ramp, water and benches. +- Real route/city JSON only; missing values are hidden or TBD. + +## Constraints + +Real data: `public/cool-city/route.json` (normalised from `shade.json`, `routes.geojson`, `places.json`) and `public/cool-city/city-gap.json`. No retail numbers on Cool City. Onyx stays, themed with the system UI stack. Shared time/phase state is in-memory Nitro; vote per round. No PII. Keep SSR, accessibility, reduced motion, build/tests. + +## Direction contract + +THESIS: A live demo, not a dashboard. One decision: which way should Ruth go now? Apple-like clarity — less information, more confidence — with the map as stage content and a minimal phone flow. + +OWN-WORLD: Warm off-white `#F6F3EE`, near-black `#121212`, heat `#E4572E`, shade/water `#2F6FED`, system UI stack, tabular numerals, 28 px translucent surfaces, soft shadows, generous 8-point space, subtle state motion. Stage inverts to `#0B1114` with bright heat and shade. + +STORY: Ruth card. The city has cool places but no route. Three routes; at 10:00 the shortest is fine; at 16:00 shade % and direct-sun minutes disagree. The shaded route takes twice as long for 4.9 sun minutes; the shortest has a 15% ramp; the accessible route is one minute longer with no ramp, water and benches. The room votes; the model recommends **Accessible for Ruth**. Close: "The pulse is not the people. But the city still has to protect them." + +FIRST VIEWPORT: `/cool` — Ruth card, time slider, route cards with accessible first. `/cool/stage` — Ruth card first; then the dark route board at `Find routes`, with the exact labels and presenter strip. + +FORM: Pinned by `COOL_CITY_DESIGN.md` and `presentation/cool-city-demo-script.md`; no roll. `seed: none (pinned)` — "The frontend is a live demo, not a dashboard. Less information, more confidence. ... Apple-like clarity, not an Apple skin. ... full-bleed map ... floating bottom sheet ... one typeface, one accent, subtle motion, immaculate finish." + +FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance. diff --git a/.impeccable/surfaces/plan.md b/.impeccable/surfaces/plan.md new file mode 100644 index 0000000..3aff8cd --- /dev/null +++ b/.impeccable/surfaces/plan.md @@ -0,0 +1,42 @@ +--- +version: 1 +slug: "plan" +primary_target: "plan" +related_targets: ["/", "/live", "/stage"] +--- + +# Surface brief — decision, stage, phone + +## Scope + +Primary: `/plan` (Operate). Related: `/` (Persuade), `/live` and `/stage` (Experience), with supporting `/forecast`, `/simulate`, `/about`, `/control` to follow in the finish pass. + +## Audience and job + +A Heilbronn duty manager needs the coming week's staffing decision: who works, when, what it costs, and what the trade-off is. A hackathon audience needs the same decision at ten metres on a projector, then in their hand on a phone. The presenter needs to change one scenario and have every surface follow honestly. + +## Success + +- `/plan` answers what to do above the fold: peak shift, staff count, staff-hours, cost vs flat, coverage. +- `/live` answers on a 390×844 phone above the fold: shift, staff count, one-line reason, freshness. +- `/stage` is readable at 10 m without app chrome. +- `/` sets up the story in one screen with the live plan as proof. +- Measured, modelled and assumed stay visibly distinct; the real 14–20 Nov window is labelled. + +## Constraints + +Live API data only; no fabricated numbers. Preserve routes, API contracts, Onyx components, SSR, accessibility, reduced motion and the existing build/tests. The paper brief's 210 h / €3,360 is stale; the demo baseline is the live sunny-saturday-market plan (5 peak, 172 staff-hours, €2,752 vs €5,600 flat, 100% coverage). + +## Direction contract + +THESIS: A shift board, not a dashboard. The week's footfall becomes a physical timetable with an orange peak block; the category's metric-card hero and admin shell are refused. + +OWN-WORLD: Cool paper `#F4EFE6`, ink `#16130F`, signal orange `#E84100` for the peak (text `#B63A00` on paper), board green `#2E6B4F` for coverage. Archivo variable: condensed 78% display, tabular numerals, heavy rules, zero radius, no shadows. `/stage` and `/live` invert to ink `#0E100E` with paper type and bright orange. + +STORY: The manager reads "Five on Saturday, 10:00–14:00", sees the week board, and understands 172 staff-hours cost €2,752 against €5,600 flat with 100% coverage. They approve or export. The judge sees the same plan on stage and phone; a scenario change redraws the pulse and the blocks. + +FIRST VIEWPORT: `/plan` — h1 "Five on Saturday." with shift time and a receipt of staff-hours/cost/coverage on the left, a full-width seven-day shift board with the orange peak on the right/below, and Approve/Export actions. `/` — headline "Saturday needs five." beside the live board. `/live` — giant 5, Saturday 14 Nov, 10:00–14:00, one-line peak-forecast reason, freshness. `/stage` — full-bleed dark board: 5 staff, day/time, week board, cost line, QR. + +FORM: Shift board / timetable. The user pinned the world and its first-surface experience; no roll was needed. `seed: none (pinned)` — "A — Shift board. Full replacement. Paper/ink ground, signal orange for the peak, heavy timetable rules, tabular numerals, physical time blocks. /stage inverts to a dark board." + +FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance. diff --git a/PRODUCT.md b/PRODUCT.md new file mode 100644 index 0000000..0b6da25 --- /dev/null +++ b/PRODUCT.md @@ -0,0 +1,69 @@ +# Product + + + +## Platform + +web + +## Users + +**Primary public user:** Ruth, 78, lives alone in Heilbronn. She is a clearly labelled composite persona, not a real person: the stand-in for an older resident who needs bread, a bench, water and shade on a hot day. The product must work on her phone, one-handed, in bright light. + +**Secondary audiences:** the hackathon room watching a projector; a city climate-adaptation team looking for where shade, water and benches are missing; the retailer who pays for the staffing module. + +## Product Purpose + +Cool City is Heilbronn's public heat-safe route. It tells a person how to reach the places they need — cooler, quieter, step-free — at a given hour, and shows the city where shade, water and benches are missing. The retail staffing plan remains a separate commercial module, not the hero. + +## Positioning + +The city publishes almost 60 cool places on a map and an address list. It does not turn them into a time-aware, person-level route. Cool City connects the public cool-place map, modelled shade, OSM access features and the existing footfall/weather stack into three route choices a person can act on: shortest, shaded, accessible. It shows the room's vote next to the model's recommendation. A private dashboard cannot truthfully copy the public framing or the person-level route. + +## Operating Context + +- Heilbronn inner city. Origin Stadtgalerie, destination Marktplatz. Verify route geometry and place names against OSM and the final route bundle before the demo. +- Three options: shortest; shaded via the Deutschhof passage / Kiliansplatz; accessible with water, benches and step-free access. +- Time stops: 10:00, 12:00, 14:00, 16:00. The recommendation may change with the sun. +- Shade is modelled from solar position and building/tree geometry, not measured. Never claim a temperature difference. +- Sensors are eight inner-city PAX counters: a relative device index, not people. No city-wide heatmap claim. +- Public vote: one vote per random session ID in localStorage; aggregate tally only; no PII, no accounts, no location upload. +- The route/shade bundle lives in `cool-city-data/route/`; the cooling-gap bundle in `cool-city-data/city/`. Final JSON is copied to `public/cool-city/`. If a bundle is missing, label TBD and do not invent values. +- Do not generalise the commissioned FITNAH PET range to every inner-city street. + +## Capabilities and Constraints + +- Nuxt 4 SSR + Onyx + MapLibre available. Routes: `/cool`, `/cool/stage`, `/cool/city`, plus the existing retail routes. +- `/cool` is mobile-first and must also read clearly on a projector. `/cool/stage` is a dark, full-bleed projection surface. +- `/cool/city` ranks eight sensor catchments with a relative cooling-gap index and shows the weights and assumptions. No measured temperature map. +- Vote backend: in-memory Nitro route, aggregate counts, one vote per random session ID, stage polls every 2 s. No database, no Go change. +- Keep `/plan`, `/forecast`, `/simulate`, `/about` working. The retail module is linked, not merged into the Cool City hero. +- Preserve SSR, keyboard access, contrast, reduced motion, responsive behaviour, build and tests. + +## Brand Commitments + +- Name: **Cool City** (public product). Built on the PulseCast stack; the retail plan remains PulseCast's staffing module. +- Visual world pinned by `COOL_CITY_DESIGN.md`: **a live demo, not a dashboard**. Apple-like clarity: warm off-white ground, near-black ink, heat orange, shade/water blue, one system typeface, generous space, 28 px translucent surfaces and soft shadows, subtle motion. `/cool` is a minimal phone/desktop card flow; `/cool/stage` is a full-bleed dark route board with huge type and quiet presenter controls. The retail module keeps the shift-board identity. +- Voice: public, direct, protective, not promotional. Never present Ruth as a real person without consent. + +## Evidence on Hand + +- `COOL_CITY.md` product brief and `Paper/research/cool-city-sources.md` source-checked claims. +- RKI estimate: ~16,000 heat-related deaths in Germany in 2026 through KW37 (95% PI 14,400–17,600). Say estimated, not a count; not Heilbronn. +- FITNAH-3D commissioned model: citywide PET 16.1–44.5 °C; unshaded sealed street space can exceed 41 °C PET. Do not generalise. +- City: almost 60 cool places; map + address list, not a routing or time-aware service. 2021 climate-adaptation concept adopted 2023 with 31 measures; 2025 spatial concept; 2023 heat-health action package. Do not say no heat action plan. +- City tree cadastre Jan 2026 (dl-de/by-2.0); OSM (ODbL); Open-Meteo (CC BY 4.0); population by planning district aggregate. +- The route/shade and city bundles are pending. Use a clearly labelled TBD placeholder; no fake numbers. + +## Product Principles + +1. Public first. The hero is a person trying to reach a place safely, not a retailer's dashboard. +2. The hour matters. A route is not cool in the abstract; it is cool at 14:00 or 16:00. +3. Modelled is not measured. Shade coverage and direct-sun minutes are model outputs; say so. +4. The room is part of the product. The vote is aggregate, anonymous and shown next to the model. +5. The city only sees what the person reveals. The cooling-gap module is a relative planning aid, not a temperature map. +6. Keep the retail proof separate. The staffing module is the commercial layer, not the public story. + +## Accessibility & Inclusion + +WCAG 2.2 AA. Keyboard and visible focus for the time control, route cards and vote; 4.5:1 body text and 3:1 large text; no colour-only meaning; reduced-motion alternatives; 44 px touch targets; stage text legible at 10 m; phone-first reading order with no horizontal page scroll. diff --git a/README.md b/README.md index 2d6a0d2..6b91238 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,38 @@ # PulseCast web -Nuxt 4 SSR frontend for **PulseCast** — a staffing copilot that turns inner-city -footfall into a usable next-week shift plan for a Heilbronn retailer. +Nuxt 4 SSR frontend for **PulseCast**, a staffing copilot that turns inner-city +footfall into a weekly shift plan for a Heilbronn retailer. `/plan` is the +decision surface; `/stage` and `/live` present that plan. The map, weather and +forecast are supporting evidence. -The hero screen is **`/plan`**. The map, weather and forecast are supporting -evidence; the decision is the weekly plan. +## Quick start + +Node 22 is the CI and Docker version. Real data comes from the Go API on +`http://localhost:8080`; mock mode needs no API. + +```bash +npm ci +npm run dev # http://localhost:3000 +``` + +Without the Go API, use the checked-in mock data: + +```bash +NUXT_PUBLIC_USE_MOCK=1 npm run dev +``` + +Build and test exactly as CI does: + +```bash +make check # npm ci, npm run build, npm test +``` + +The built SSR server can also be started directly: + +```bash +NUXT_API_INTERNAL_BASE=http://localhost:8080 \ + PORT=3000 node .output/server/index.mjs +``` ## Stack @@ -18,40 +46,24 @@ Onyx is used for the navigation/app shell, page layout, cards, tables, buttons, badges, tags, selects, segmented control, slider, stepper, accordion and file upload. The app does not ship a parallel component design system. -## Run - -```bash -npm ci -npm run dev # http://localhost:3000, expects Go at http://localhost:8080 -npm run build # production SSR build in .output/ -npm run preview # preview the built app -npm test # heuristic + Go parity tests -``` - -The built SSR server can also be started directly: - -```bash -NUXT_API_INTERNAL_BASE=http://localhost:8080 \ - PORT=3000 node .output/server/index.mjs -``` - ## Live demo: `/stage`, `/live`, `/control` ```text browser ──GET /api/stream──► Nuxt Nitro ──proxy──► Go /api/stream ◄── scenario/ping ── ◄────────── SSE hub -presenter ──POST /api/scenario──► Nitro (Basic auth + control secret) ──► Go +presenter ──POST /api/scenario──► Nitro (Basic auth + control credentials) ──► Go ``` - `app/composables/useLiveScenario.ts` opens one `EventSource` per tab. On a `scenario` event it updates the shared state and tells the page to refetch; `ping` heartbeats keep the connection marked **Live**. - After two SSE errors, or when no heartbeat arrives for 32 s (a buffering - proxy), the client closes ranks and polls `GET /api/scenario` every 5 s. The - badge shows **Live**, **Polling** or **Offline**, never a silent stale plan. + proxy), the client starts polling `GET /api/scenario` every 5 s. The badge + shows **Connecting**, **Live**, **Polling** or **Offline**, never a silent + stale plan. - `POST /api/scenario` goes through Nitro; the Go control credentials stay in the Node process. `/control` itself requires HTTP Basic auth - (`CONTROL_USER`/`CONTROL_PASS`); a signed cookie lets the page POST without + (`CONTROL_USER`/`CONTROL_PASS`); an HMAC cookie lets the page POST without re-prompting. `/stage`, `/live` and all public GETs stay open. - `/stage` renders a local SVG QR code (`/api/qr`) pointing at `/live`; no third-party QR service is called. @@ -102,11 +114,11 @@ real API; mock JSON is an explicit dev fallback only. | `GET /api/train/:job_id` | `GET /api/train/{job_id}` with server-side control auth | | `GET /api/scenarios` | Local UI metadata only (labels/descriptions) | -`/plan` reads Go `/api/staffing` directly. The four local assumption controls -(safety factor, minimum staff, shift length, labour cost) are not query inputs -of the Go contract, so changing them renders an explicit **local preview** from -the API’s forecast hours; “Use API plan” restores the server values. The shared -heuristic is tested against a captured Go response in +`/plan` reads Go `/api/staffing` through Nitro. The four local assumption +controls (safety factor, minimum staff, shift length, labour cost) are not query +inputs of the Go contract, so changing them renders an explicit **local +preview** from the API plan’s hourly footfall; “Use API plan” restores the +server values. The shared heuristic is tested against a captured Go response in `test/fixtures/go-staffing.json`. ### Environment @@ -120,14 +132,15 @@ heuristic is tested against a captured Go response in | `NUXT_PUBLIC_USE_MOCK` / `NUXT_USE_MOCK` | unset | `1` enables the mock fallback | | `NUXT_DISABLE_SSE` | unset | `1` forces the polling fallback (SSE failure drill) | | `CONTROL_USER` / `CONTROL_PASS` | unset | Basic auth for `/control` and `POST /api/scenario`; also attached to Go `/api/train` | -| `CONTROL_TOKEN` | unset | Optional Bearer token for future control auth | +| `CONTROL_TOKEN` | unset | Optional Bearer fallback when Basic is not configured; the Go control API requires Basic today | | `NUXT_PUBLIC_DEMO_NOW` | `2026-11-14T08:12:00Z` | Replay clock used for labels | Control credentials are read only in the Nitro process. They are never placed in `runtimeConfig.public` and never reach the browser bundle. `/control` and `POST /api/scenario` require Basic auth at Nitro, and Nitro then attaches the -same credentials to Go. If `CONTROL_USER`/`CONTROL_PASS` are unset, the control -surface returns `503 control_auth_unconfigured`; public screens keep working. +same credentials to Go. In API mode, if `CONTROL_USER`/`CONTROL_PASS` are +unset, the control surface returns `503 control_auth_unconfigured`; public +screens keep working. The K8s web Deployment must mount the same `control-auth` secret as the API Deployment: @@ -154,17 +167,34 @@ deployed path are the real API. | Route | Purpose | | --- | --- | -| `/` | Now: replay reading, 8-sensor schematic, weather, holiday, data versions | +| `/cool` | **Cool City public hero.** Ruth card, time, three real route options, vote buttons; `/cool?vote=1` is the minimal audience vote page | +| `/cool/stage` | **Cool City projector.** Ruth card, cool places, data honesty, route board with exact labels, live vote, city view, retail link | +| `/cool/city` | Cooling-gap module: eight ranked catchments, one-line reasons, top block and “What would help” | +| `/` | Landing: the live shift board, peak shift, cost vs flat, coverage and the measured/modelled/assumed chain | | `/forecast` | 7-day daily forecast, uncertainty band, weather strip | -| `/plan` | **Hero.** Peak decision, shift blocks, coverage, cost, why, assumptions | +| `/plan` | **Hero.** Peak decision, weekly shift board, coverage, cost vs flat, settings, hourly detail | | `/simulate` | Base vs scenario plan, both read from Go `/api/staffing` | -| `/stage` | Big-screen decision: headline, peak staff, cost, coverage, QR to `/live` | -| `/live` | Phone view: current recommendation, peak shift, scenario, last update | +| `/stage` | Dark projector board: peak shift, weekly board, cost, coverage, QR to `/live` | +| `/live` | Phone answer: peak shift, staff count, reason, freshness, scenario and transport | | `/control` | Presenter preset buttons; authenticated POST through Nitro | | `/about` | Method, metrics, limits, privacy, train form | -The layout is checked at **390 px** (single column, mobile Onyx nav, day cards) -and **1440 px** (Onyx horizontal nav, two-column plan with tables). +The layout targets **390 px** (single column, mobile Onyx nav, day cards) and +**1440 px** (Onyx horizontal nav, two-column plan with tables). + +### Cool City demo data and state + +- `/cool` reads `public/cool-city/route.json`, normalised from + `cool-city-data/route/shade.json`, `routes.geojson` and `places.json`. + `/cool/city` reads `public/cool-city/city-gap.json`. +- Vote and demo state are in-memory Nitro routes: `GET/POST /api/cool/state`, + `GET/POST /api/cool/vote`, `POST /api/cool/reset`. `round` is + `preselection` or `final`; votes never mix. The stage and phones poll every + 2 seconds. No database and no PII. +- Stage labels: `Cool places`, `Data honesty`, `Find routes`, `Shortest`, + `Shaded`, `Accessible`, `Start vote`, `Lock vote`, `City view`, + `Retail module`, `Reset round`. The model recommendation is + **“Accessible for Ruth”**. ## Plan logic @@ -178,9 +208,9 @@ required = max(required, min_staff) Store hours are 10:00–20:00 Europe/Berlin; default blocks are 4 h; labour cost is €16/h; the default service standard is 25 visitors per staff-hour. The flat schedule applies the global peak requirement to every store hour, matching Go -and CONTRACT.md §5. Coverage is at or above requirement by construction because -each block is sized to its local peak — the UI shows the resulting overstaffed -hours instead of hiding them. +and the contract (§5). Coverage is at or above requirement by construction +because each block is sized to its local peak — the UI shows the resulting +overstaffed hours instead of hiding them. ## Checks and CI @@ -200,19 +230,22 @@ staffing, local presets, and 404/400 propagation. `scripts/smoke-live.mjs` proves the live path: unauthorised POST is rejected, `/control` authenticates, `/stage` and `/live` render server-side, `/api/qr` returns SVG, the SSE proxy emits `retry: 3000` and the initial scenario, a -presenter POST produces a `scenario` event (with matching `id` and version) in -well under 2 s, polling reads the same version, and the target staffing and -forecast responses differ from base. It restores the base scenario at the end. +presenter POST produces a `scenario` event (with matching `id` and version) +within the 2 s contract target (the script warns if slower), polling reads the +same version, and the target staffing and forecast responses differ from base. +It restores the base scenario at the end. ## Docker ```bash -docker build -t pulsecast-web . +docker build -t pulsecast-web:local . docker run --rm -p 3000:3000 \ -e NUXT_API_INTERNAL_BASE=http://host.docker.internal:8080 \ - pulsecast-web + pulsecast-web:local ``` +On Linux, add `--add-host=host.docker.internal:host-gateway` or use the host IP. + The multi-stage image copies only `.output/` into `node:22-alpine`. It creates numeric UID/GID **`10001:10001`**, uses `COPY --chown=10001:10001` and runs `USER 10001:10001`. Kubernetes should set `runAsUser: 10001`, diff --git a/app/app.vue b/app/app.vue index f8eacfa..2d92d8e 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,5 +1,101 @@ + + diff --git a/app/assets/css/cool.css b/app/assets/css/cool.css new file mode 100644 index 0000000..6b6cf4c --- /dev/null +++ b/app/assets/css/cool.css @@ -0,0 +1,526 @@ +:root { + --cc-ground: #f6f3ee; + --cc-surface: rgba(255, 255, 255, 0.86); + --cc-surface-solid: #fffdf9; + --cc-ink: #121212; + --cc-ink-2: #343434; + --cc-muted: #6b6b6b; + --cc-line: rgba(18, 18, 18, 0.12); + --cc-line-strong: rgba(18, 18, 18, 0.24); + --cc-heat: #e4572e; + --cc-heat-text: #a83a19; + --cc-heat-soft: #fbe8e2; + --cc-shade: #2f6fed; + --cc-shade-deep: #1f4fae; + --cc-shade-soft: #e5edff; + --cc-water: #3aa6b9; + --cc-focus: #a83a19; + --cc-radius: 28px; + --cc-shadow: 0 18px 60px rgba(18, 18, 18, 0.12); + --cc-shadow-soft: 0 8px 26px rgba(18, 18, 18, 0.07); + --cc-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif; + + --cc-dark: #0b1114; + --cc-dark-2: #14191c; + --cc-dark-3: #1d2428; + --cc-dark-line: rgba(255, 255, 255, 0.14); + --cc-dark-muted: #a3a3a3; + --cc-heat-bright: #ff6b3d; + --cc-shade-bright: #6fa8ff; + --cc-water-bright: #7ad1df; + --cc-focus-dark: #ff9b76; +} + +body.pc-cool-presentation { + background: var(--cc-ground); + color: var(--cc-ink); +} + +body.pc-cool-presentation, +.cc-cool, +.cc-stage { + font-family: var(--cc-font); +} + +.cc-cool, +.cc-cool *, +.cc-cool *::before, +.cc-cool *::after, +.cc-stage, +.cc-stage *, +.cc-stage *::before, +.cc-stage *::after, +.cc-city, +.cc-city *, +.cc-city *::before, +.cc-city *::after { + box-sizing: border-box; + font-family: var(--cc-font); +} + +.cc-cool { + min-height: 100dvh; + padding-bottom: 3rem; + background: var(--cc-ground); + color: var(--cc-ink); +} + +/* Top bar --------------------------------------------------------------- */ + +.cc-topbar { + position: sticky; + top: 0; + z-index: 10; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.55rem 0.9rem; + min-height: 60px; + padding: 0.65rem 1rem; + border-bottom: 1px solid var(--cc-line); + background: color-mix(in srgb, var(--cc-ground) 88%, transparent); + backdrop-filter: blur(18px) saturate(140%); + -webkit-backdrop-filter: blur(18px) saturate(140%); +} + +.cc-wordmark { + display: inline-flex; + align-items: center; + gap: 0.5rem; + color: var(--cc-ink); + font-size: 0.96rem; + font-weight: 800; + letter-spacing: -0.03em; + text-decoration: none; +} + +.cc-mark { + display: block; + width: 0.55rem; + height: 1.25rem; + border-radius: 999px; + background: linear-gradient(180deg, var(--cc-heat) 0 50%, var(--cc-shade) 50% 100%); +} + +.cc-topbar__place { + color: var(--cc-muted); + font-size: 0.72rem; + font-variant-numeric: tabular-nums; +} + +.cc-topbar__status { + display: inline-flex; + align-items: center; + gap: 0.3rem; + margin-inline-start: auto; + color: var(--cc-muted); + font-size: 0.62rem; + font-weight: 600; + letter-spacing: 0.03em; +} + +.cc-topbar__status i { + display: block; + width: 0.4rem; + height: 0.4rem; + border-radius: 50%; + background: var(--cc-shade); +} + +/* Phone ----------------------------------------------------------------- */ + +.cc-phone { + display: flex; + width: 100%; + max-width: 35rem; + flex-direction: column; + gap: 1rem; + margin-inline: auto; + padding: 1rem; +} + +.cc-ruth { + display: flex; + flex-direction: column; + gap: 0.45rem; + padding: 0.4rem 0 0.7rem; +} + +.cc-ruth h1 { + max-width: 13ch; + margin: 0; + font-size: clamp(2.6rem, 10.8vw, 4.2rem); + font-weight: 850; + letter-spacing: -0.06em; + line-height: 0.9; + text-wrap: balance; +} + +.cc-ruth__copy { + max-width: 46ch; + margin: 0.15rem 0 0; + color: var(--cc-muted); + font-size: 0.98rem; + line-height: 1.5; +} + +.cc-ruth__tag { + display: inline-flex; + width: fit-content; + margin-top: 0.25rem; + padding: 0.18rem 0.5rem; + border: 1px solid var(--cc-line); + border-radius: 999px; + color: var(--cc-muted); + font-size: 0.6rem; + font-weight: 600; + letter-spacing: 0.02em; +} + +.cc-panel { + padding: 1rem; + border: 1px solid var(--cc-line); + border-radius: var(--cc-radius); + background: var(--cc-surface); + box-shadow: var(--cc-shadow-soft); + backdrop-filter: blur(18px) saturate(140%); + -webkit-backdrop-filter: blur(18px) saturate(140%); +} + +.cc-time__head { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 0.7rem; + margin-bottom: 0.55rem; +} + +.cc-time__head h2 { + margin: 0; + color: var(--cc-muted); + font-size: 0.72rem; + font-weight: 650; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.cc-time__head strong { + font-size: clamp(2.6rem, 10vw, 3.6rem); + font-weight: 850; + letter-spacing: -0.06em; + line-height: 0.9; + font-variant-numeric: tabular-nums; +} + +.cc-time :deep(.onyx-slider__marks), +.cc-time :deep(.onyx-slider__mark-label) { + color: var(--cc-muted); + font-family: var(--cc-font); + font-size: 0.65rem; + font-variant-numeric: tabular-nums; +} + +.cc-time :deep(.onyx-slider__track) { + accent-color: var(--cc-shade); +} + +.cc-vote-only { + display: flex; + min-height: calc(100dvh - 62px); + align-items: center; + justify-content: center; + padding: 2rem 1rem 3rem; +} + +.cc-vote-only__inner { + width: 100%; + max-width: 34rem; +} + +.cc-vote-only h1 { + max-width: 10ch; + margin: 0; + font-size: clamp(3rem, 12vw, 5rem); + font-weight: 850; + letter-spacing: -0.06em; + line-height: 0.9; +} + +.cc-vote-only__lede { + max-width: 34ch; + margin: 0.8rem 0 1.4rem; + color: var(--cc-muted); + font-size: 1rem; + line-height: 1.45; +} + +.cc-vote-only__buttons { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: 0.5rem; +} + +.cc-vote-only__confirmation { + padding: 1rem; + border: 1px solid var(--cc-line); + border-radius: 24px; + background: var(--cc-surface); +} + +.cc-vote-only__confirmation p { + margin: 0; + font-size: 1rem; + line-height: 1.45; +} + +.cc-details { + border: 1px solid var(--cc-line); + border-radius: 24px; + background: var(--cc-surface); +} + +.cc-details summary:focus-visible, +.cc-city__method summary:focus-visible { + outline: 2px solid var(--cc-focus); + outline-offset: 2px; +} + +.cc-details summary { + padding: 0.9rem 1rem; + color: var(--cc-ink); + font-size: 0.82rem; + font-weight: 650; + cursor: pointer; +} + +.cc-details__body { + display: grid; + gap: 0.6rem; + padding: 0 1rem 1rem; + color: var(--cc-muted); + font-size: 0.82rem; + line-height: 1.55; +} + +.cc-details__body p { + margin: 0; +} + +.cc-details__body strong { + color: var(--cc-ink); +} + +.cc-details__links { + display: flex; + flex-wrap: wrap; + gap: 0.8rem; + padding-top: 0.3rem; +} + +.cc-details__links a { + color: var(--cc-ink); + font-weight: 700; +} + +.cc-phone__footer { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 0.4rem 1rem; + padding-top: 1.1rem; + border-top: 1px solid var(--cc-line); + color: var(--cc-muted); + font-size: 0.68rem; + line-height: 1.45; +} + +/* Onyx theming on the phone --------------------------------------------- */ + +.cc-cool { + --onyx-font-family-paragraph: var(--cc-font); + --onyx-font-family-h1: var(--cc-font); + --onyx-font-family-h2: var(--cc-font); + --onyx-font-family-h3: var(--cc-font); + --onyx-font-family-h4: var(--cc-font); + --onyx-font-family-data: var(--cc-font); + --onyx-radius-component-button: 999px; + --onyx-radius-component-container-soft: var(--cc-radius); + --onyx-radius-component-input: 999px; + --onyx-color-base-primary-500: var(--cc-ink); + --onyx-color-base-primary-600: var(--cc-ink); + --onyx-color-base-primary-900: var(--cc-ink); + --onyx-color-component-cta-default: var(--cc-ink); + --onyx-color-component-cta-default-hover: #000; + --onyx-color-text-icons-neutral-button: #fff; + --onyx-color-component-focus-primary: var(--cc-heat); +} + +.cc-cool :deep(.onyx-button) { + min-height: 52px; + border-radius: 999px; + font-family: var(--cc-font); + font-weight: 650; + letter-spacing: -0.01em; +} + +.cc-cool :deep(.onyx-button--outline) { + border-color: var(--cc-line-strong); + color: var(--cc-ink); +} + +.cc-cool :deep(.onyx-button--outline:hover) { + background: var(--cc-ink); + border-color: var(--cc-ink); + color: var(--cc-ground); +} + +.cc-cool :deep(.onyx-button__label) { + font-size: 0.92rem; +} + +/* Stage ----------------------------------------------------------------- */ + +.cc-stage { + position: relative; + display: flex; + height: 100dvh; + flex-direction: column; + overflow: hidden; + background: var(--cc-dark); + color: var(--cc-ink); +} + +.cc-stage__top { + position: relative; + z-index: 4; + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0.7rem; + padding: 0.65rem clamp(1rem, 2.4vw, 2.4rem); + border-bottom: 1px solid var(--cc-line); + background: color-mix(in srgb, var(--cc-dark) 86%, transparent); + backdrop-filter: blur(16px); + -webkit-backdrop-filter: blur(16px); +} + +.cc-stage__wordmark { + color: var(--cc-ink); +} + +.cc-stage__place { + color: var(--cc-muted); + font-size: 0.72rem; + font-weight: 600; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.cc-stage__round { + margin-inline-start: auto; + color: var(--cc-muted); + font-size: 0.7rem; + font-variant-numeric: tabular-nums; + letter-spacing: 0.03em; +} + +.cc-dark { + --cc-ground: #0b1114; + --cc-surface: rgba(23, 28, 31, 0.88); + --cc-surface-solid: #131a1e; + --cc-ink: #f5f3ef; + --cc-ink-2: #dedbd4; + --cc-muted: #a3a3a3; + --cc-line: rgba(255, 255, 255, 0.14); + --cc-line-strong: rgba(255, 255, 255, 0.26); + --cc-heat: #ff6b3d; + --cc-heat-text: #ff9b76; + --cc-heat-soft: #2b1711; + --cc-shade: #6fa8ff; + --cc-shade-deep: #a9c8ff; + --cc-shade-soft: #142238; + --cc-water: #7ad1df; + --cc-focus: #ff9b76; + --cc-shadow: 0 24px 80px rgba(0, 0, 0, 0.45); + --cc-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3); + color: var(--cc-ink); +} + +.cc-dark .cc-wordmark { + color: var(--cc-ink); +} + +.cc-dark .cc-topbar { + background: color-mix(in srgb, var(--cc-dark) 86%, transparent); +} + +@media (min-width: 900px) { + .cc-phone { + display: grid; + max-width: 72rem; + grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); + grid-template-areas: + "ruth routes" + "time routes" + "details details" + "footer footer"; + gap: 1rem 1.5rem; + align-items: start; + padding: 1.5rem 1.5rem 3rem; + } + + .cc-ruth { + grid-area: ruth; + padding-top: 0.5rem; + } + + .cc-ruth h1 { + font-size: clamp(3rem, 4.6vw, 4.8rem); + } + + .cc-time { + grid-area: time; + } + + .cc-route { + grid-area: routes; + } + + .cc-details { + grid-area: details; + margin-top: 0.5rem; + } + + .cc-phone__footer { + grid-area: footer; + grid-column: 1 / -1; + margin-top: 0.5rem; + } +} + +@media (max-width: 460px) { + .cc-topbar { + min-height: 56px; + padding: 0.55rem 0.8rem; + } + + .cc-topbar__place { + font-size: 0.66rem; + } + + .cc-topbar__status { + font-size: 0.58rem; + } + + .cc-phone { + padding-inline: 0.8rem; + } +} + +@media (prefers-reduced-motion: reduce) { + .cc-topbar, + .cc-panel { + backdrop-filter: none; + -webkit-backdrop-filter: none; + } +} diff --git a/app/assets/css/main.css b/app/assets/css/main.css new file mode 100644 index 0000000..2ed61f9 --- /dev/null +++ b/app/assets/css/main.css @@ -0,0 +1,1723 @@ +@font-face { + font-family: "Archivo"; + src: url("/fonts/archivo-latin-var.woff2") format("woff2"); + font-style: normal; + font-weight: 100 900; + font-stretch: 62% 125%; + font-display: swap; +} + +:root { + /* Shift board world */ + --pc-paper: #f4efe6; + --pc-paper-2: #e9e3d7; + --pc-paper-3: #ded6c7; + --pc-ink: #16130f; + --pc-ink-2: #2a261f; + --pc-muted: #6e665a; + --pc-line: #d3caba; + --pc-line-strong: #a99f8e; + --pc-signal: #e84100; + --pc-signal-text: #b63a00; + --pc-signal-wash: #ffe3d4; + --pc-green: #2e6b4f; + --pc-green-soft: #dcebe2; + --pc-danger: #b3261e; + --pc-dark: #0e100e; + --pc-dark-2: #191c18; + --pc-dark-3: #22261f; + --pc-dark-line: #343a31; + --pc-dark-muted: #b4ae9f; + --pc-signal-bright: #ff6a2a; + --pc-green-bright: #5fc99a; + --pc-danger-bright: #ff7a6e; + --pc-focus: #b63a00; + --pc-focus-dark: #ff6a2a; + --pc-font: "Archivo", "Helvetica Neue", Arial, sans-serif; + --pc-display-stretch: 78%; + --pc-radius: 0; + + /* Onyx is the component system; these tokens make it PulseCast. */ + --onyx-font-family-paragraph: var(--pc-font); + --onyx-font-family-h1: var(--pc-font); + --onyx-font-family-h2: var(--pc-font); + --onyx-font-family-h3: var(--pc-font); + --onyx-font-family-h4: var(--pc-font); + --onyx-font-family-data: var(--pc-font); + --onyx-font-family-mono: var(--pc-font); + --onyx-font-weight-semibold: 650; + + --onyx-radius-component-badge: 0; + --onyx-radius-component-button: 0; + --onyx-radius-component-checkbox: 0; + --onyx-radius-component-container-sharp: 0; + --onyx-radius-component-container-soft: 0; + --onyx-radius-component-flyout: 0; + --onyx-radius-component-icon-button: 0; + --onyx-radius-component-input: 0; + --onyx-radius-component-search-sharp: 0; + --onyx-radius-component-search-soft: 0; + --onyx-radius-component-segmented-control-inside: 0; + --onyx-radius-component-segmented-control-outside: 0; + --onyx-radius-component-skeleton: 0; + --onyx-radius-component-system-button: 0; + --onyx-radius-full: 999px; + --onyx-radius-lg: 0; + --onyx-radius-md: 0; + --onyx-radius-sm: 0; + --onyx-radius-xl: 0; + --onyx-radius-xs: 0; + + --onyx-shadow-medium-top: none; + --onyx-shadow-medium-bottom: none; + --onyx-shadow-medium-left: none; + --onyx-shadow-medium-right: none; + --onyx-shadow-soft-top: none; + --onyx-shadow-soft-bottom: none; + --onyx-shadow-soft-left: none; + --onyx-shadow-soft-right: none; + + --onyx-color-base-background-blank: var(--pc-paper); + --onyx-color-base-background-tinted: var(--pc-paper-2); + --onyx-color-base-neutral-100: var(--pc-paper); + --onyx-color-base-neutral-200: var(--pc-paper-2); + --onyx-color-base-neutral-300: var(--pc-line); + --onyx-color-base-neutral-400: var(--pc-line-strong); + --onyx-color-base-neutral-500: #8b8172; + --onyx-color-base-neutral-600: var(--pc-muted); + --onyx-color-base-neutral-700: #4e473d; + --onyx-color-base-neutral-800: var(--pc-ink-2); + --onyx-color-base-neutral-900: var(--pc-ink); + + --onyx-color-base-primary-100: #e8e1d4; + --onyx-color-base-primary-200: #d8cfbf; + --onyx-color-base-primary-300: #b8ad9b; + --onyx-color-base-primary-400: #8b8172; + --onyx-color-base-primary-500: var(--pc-ink-2); + --onyx-color-base-primary-600: var(--pc-ink); + --onyx-color-base-primary-700: #0c0a08; + --onyx-color-base-primary-800: #000000; + --onyx-color-base-primary-900: #000000; + + --onyx-color-base-success-100: #e1eee7; + --onyx-color-base-success-200: #c6e0d1; + --onyx-color-base-success-300: #9ac7b3; + --onyx-color-base-success-400: #6ba889; + --onyx-color-base-success-500: var(--pc-green); + --onyx-color-base-success-600: #24573f; + --onyx-color-base-success-700: #1b4632; + --onyx-color-base-success-800: #123524; + --onyx-color-base-success-900: #0b2719; + + --onyx-color-base-warning-100: #ffe6d8; + --onyx-color-base-warning-200: #ffd0b5; + --onyx-color-base-warning-300: #ffb185; + --onyx-color-base-warning-400: #ff8a4d; + --onyx-color-base-warning-500: var(--pc-signal); + --onyx-color-base-warning-600: #c23800; + --onyx-color-base-warning-700: #9b2d00; + --onyx-color-base-warning-800: #742200; + --onyx-color-base-warning-900: #4d1700; + + --onyx-color-base-danger-100: #f9dedb; + --onyx-color-base-danger-200: #f3c0bb; + --onyx-color-base-danger-300: #e99a93; + --onyx-color-base-danger-400: #d87369; + --onyx-color-base-danger-500: var(--pc-danger); + --onyx-color-base-danger-600: #941d17; + --onyx-color-base-danger-700: #751510; + --onyx-color-base-danger-800: #560e0a; + --onyx-color-base-danger-900: #380805; + + --onyx-color-component-border-neutral: var(--pc-line-strong); + --onyx-color-component-border-neutral-hover: var(--pc-ink); + --onyx-color-component-border-secondary: var(--pc-line); + --onyx-color-component-cta-default: var(--pc-ink); + --onyx-color-component-cta-default-hover: #000000; + --onyx-color-component-cta-disabled: var(--pc-line); + --onyx-color-component-focus-primary: var(--pc-focus); + --onyx-color-component-focus-neutral: var(--pc-focus); + --onyx-color-component-focus-danger: var(--pc-danger); + --onyx-color-component-focus-success: var(--pc-green); + --onyx-color-component-focus-warning: var(--pc-signal-text); + + --onyx-color-text-icons-neutral-intense: var(--pc-ink); + --onyx-color-text-icons-neutral-medium: #5f584d; + --onyx-color-text-icons-neutral-soft: var(--pc-muted); + --onyx-color-text-icons-neutral-inverted: var(--pc-paper); + --onyx-color-text-icons-neutral-button: var(--pc-paper); + --onyx-color-text-icons-neutral-selected: var(--pc-ink); + --onyx-color-text-icons-primary-intense: var(--pc-signal-text); + --onyx-color-text-icons-primary-bold: var(--pc-ink); + --onyx-color-text-icons-primary-medium: var(--pc-muted); + --onyx-color-text-icons-primary-soft: var(--pc-line-strong); + --onyx-color-text-icons-warning-bold: #8f2d00; + --onyx-color-text-icons-warning-intense: var(--pc-signal-text); + --onyx-color-text-icons-warning-medium: #8f2d00; + --onyx-color-text-icons-success-bold: #123524; + --onyx-color-text-icons-success-intense: var(--pc-green); + --onyx-color-text-icons-success-medium: #24573f; + --onyx-color-text-icons-danger-bold: #560e0a; + --onyx-color-text-icons-danger-intense: var(--pc-danger); + --onyx-color-text-icons-info-bold: var(--pc-ink); + --onyx-color-text-icons-info-intense: var(--pc-ink-2); + --onyx-color-text-icons-info-medium: var(--pc-muted); +} + +html { + color-scheme: light; + min-height: 100%; + scrollbar-color: var(--pc-line-strong) transparent; + scrollbar-width: thin; +} + +body { + margin: 0; + background: var(--pc-paper); + color: var(--pc-ink); + font-family: var(--pc-font); + font-synthesis: none; + text-rendering: optimizeLegibility; +} + +#__nuxt { + min-height: 100%; +} + +::selection { + background: var(--pc-signal); + color: var(--pc-ink); +} + +:where(a, button, input, select, textarea):focus-visible { + outline: 2px solid var(--pc-focus); + outline-offset: 3px; +} + +a { + color: inherit; + text-decoration-color: var(--pc-signal-text); + text-decoration-thickness: 1.5px; + text-underline-offset: 0.2em; +} + +a:hover { + text-decoration-thickness: 2.5px; +} + +::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +::-webkit-scrollbar-thumb { + background: var(--pc-line-strong); + border: 2px solid var(--pc-paper); +} + +::-webkit-scrollbar-track { + background: transparent; +} + +/* Typography ------------------------------------------------------------ */ + +h1, +h2, +h3, +h4, +h5, +h6, +.onyx-headline { + font-family: var(--pc-font); + color: var(--pc-ink); + letter-spacing: -0.02em; +} + +.onyx-headline { + font-weight: 750; +} + +.pc-display { + font-family: var(--pc-font); + font-stretch: var(--pc-display-stretch); + font-weight: 850; + line-height: 0.86; + letter-spacing: -0.04em; + font-variant-numeric: tabular-nums; + text-wrap: balance; +} + +.pc-h1 { + max-width: 13ch; + margin: 0; + font-size: clamp(3rem, 5vw, 5rem); + font-stretch: var(--pc-display-stretch); + font-weight: 850; + line-height: 0.9; + letter-spacing: -0.04em; + text-wrap: balance; +} + +.pc-h2 { + margin: 0; + font-size: clamp(1.5rem, 2.1vw, 2rem); + font-stretch: 88%; + font-weight: 800; + line-height: 0.98; + letter-spacing: -0.03em; +} + +.pc-h3 { + margin: 0; + font-size: 1.05rem; + font-weight: 750; + letter-spacing: -0.015em; +} + +.pc-label { + margin: 0; + color: var(--pc-muted); + font-size: 0.66rem; + font-weight: 700; + letter-spacing: 0.12em; + line-height: 1.3; + text-transform: uppercase; +} + +.pc-num { + font-variant-numeric: tabular-nums; + font-feature-settings: "tnum" 1; +} + +.pc-muted { + color: var(--pc-muted); +} + +.pc-small { + font-size: 0.82rem; + line-height: 1.45; +} + +.pc-mono { + font-family: var(--pc-font); + font-size: 0.76rem; + font-variant-numeric: tabular-nums; + letter-spacing: 0.02em; +} + +.pc-lede { + max-width: 62ch; + margin: 0; + color: var(--pc-muted); + font-size: 1rem; + line-height: 1.5; +} + +.pc-wordmark { + display: inline-flex; + align-items: center; + gap: 0.55rem; + font-size: 0.95rem; + font-weight: 800; + letter-spacing: -0.02em; +} + +.pc-wordmark::before { + content: ""; + display: block; + width: 0.55rem; + height: 1.3rem; + background: var(--pc-signal); +} + +/* Page and shell -------------------------------------------------------- */ + +.page { + width: 100%; + max-width: 1440px; + margin-inline: auto; +} + +.page-stack { + display: flex; + flex-direction: column; + gap: var(--onyx-density-xl); +} + +.pc-page { + display: flex; + width: 100%; + max-width: 1440px; + flex-direction: column; + gap: 1.1rem; + margin-inline: auto; + padding-block: 1.25rem 3rem; +} + +.app-footer { + position: relative; + z-index: 2; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 0.75rem; + width: 100%; + max-width: 1440px; + margin-inline: auto; + padding-block: 0.9rem; + border-top: 1px solid var(--pc-line); + background: var(--pc-paper); + color: var(--pc-muted); + font-size: 0.74rem; + line-height: 1.45; +} + +.app-footer strong { + color: var(--pc-ink); +} + +/* Navigation ------------------------------------------------------------ */ + +.onyx-nav-bar { + --onyx-color-base-background-blank: var(--pc-ink); + --onyx-color-text-icons-neutral-intense: var(--pc-paper); + --onyx-color-text-icons-neutral-medium: var(--pc-dark-muted); + --onyx-color-component-border-neutral: var(--pc-dark-line); + background: var(--pc-ink); + color: var(--pc-paper); + font-family: var(--pc-font); +} + +.onyx-nav-bar::after { + height: 3px; + background: var(--pc-signal); +} + +.onyx-nav-bar__app { + border-right-color: var(--pc-dark-line); +} + +.onyx-nav-bar a, +.onyx-nav-bar button { + color: var(--pc-paper); + font-family: var(--pc-font); + font-weight: 600; +} + +.onyx-nav-bar a:hover, +.onyx-nav-bar button:hover { + color: #fff; + background: var(--pc-dark-2); +} + +.onyx-nav-bar [aria-current="page"], +.onyx-nav-bar .onyx-router-link--active { + position: relative; + color: var(--pc-signal-bright); +} + +.onyx-nav-bar [aria-current="page"]::after, +.onyx-nav-bar .onyx-router-link--active::after { + content: ""; + display: block; + position: absolute; + inset-inline: 0.6rem; + inset-block-end: 0.45rem; + height: 2px; + background: var(--pc-signal-bright); +} + +.pc-present { + display: inline-flex; + align-items: center; + min-height: 2rem; + padding-inline: 0.55rem; + color: var(--pc-dark-muted); + font-size: 0.72rem; + font-weight: 650; + letter-spacing: 0.06em; + text-decoration: none; + text-transform: uppercase; +} + +.pc-present:hover { + color: var(--pc-paper); + background: var(--pc-dark-2); + text-decoration: none; +} + +/* Buttons and controls -------------------------------------------------- */ + +.onyx-button { + min-height: 44px; + padding-inline: 1rem; + border-radius: 0; + font-family: var(--pc-font); + font-weight: 700; + letter-spacing: 0.01em; +} + +a.onyx-button { + color: var(--onyx-button-text-color); + text-decoration: none; +} + +a.onyx-button:hover { + color: var(--onyx-button-text-color-hover); + text-decoration: none; +} + +.onyx-button__label { + font-size: 0.9rem; + font-weight: 700; +} + +.onyx-button--primary.onyx-button--outline { + border-width: 1.5px; +} + +.onyx-button--primary.onyx-button--plain { + min-height: 36px; + text-decoration: underline; + text-decoration-color: var(--pc-signal-text); + text-decoration-thickness: 1.5px; + text-underline-offset: 0.22em; +} + +.onyx-button:focus-visible { + outline: 3px solid var(--pc-focus); + outline-offset: 2px; +} + +.onyx-select-input__wrapper, +.onyx-input, +.onyx-textarea { + border-radius: 0; + background: var(--pc-paper); + font-family: var(--pc-font); +} + +.onyx-select-input__native, +.onyx-select-input__button { + font-family: var(--pc-font); +} + +.onyx-segmented-control { + border-radius: 0; + background: var(--pc-paper-2); +} + +.onyx-segmented-control__button { + border-radius: 0; + font-family: var(--pc-font); +} + +.onyx-slider input, +.onyx-stepper { + accent-color: var(--pc-ink); +} + +.onyx-checkbox, +.onyx-radio { + accent-color: var(--pc-ink); +} + +.onyx-badge { + border: 1px solid currentColor; + border-radius: 0; + font-family: var(--pc-font); + font-size: 0.62rem; + font-weight: 750; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.onyx-card { + border: 1px solid var(--pc-line); + border-radius: 0; + background: var(--pc-paper); + box-shadow: none; +} + +.onyx-card:hover { + box-shadow: none; +} + +.onyx-accordion, +.onyx-accordion-item { + border-radius: 0; +} + +.onyx-table { + border-collapse: collapse; + color: var(--pc-ink); + font-family: var(--pc-font); + font-variant-numeric: tabular-nums; +} + +.onyx-table th { + color: var(--pc-ink-2); + font-size: 0.64rem; + font-weight: 750; + letter-spacing: 0.1em; + text-transform: uppercase; +} + +.onyx-table thead th { + border-bottom: 2px solid var(--pc-ink); +} + +.onyx-table tbody tr { + border-bottom: 1px solid var(--pc-line); +} + +.onyx-table tbody tr:hover { + background: var(--pc-paper-2); +} + +.onyx-table--striped tbody tr:nth-child(odd) { + background: transparent; +} + +.onyx-table td, +.onyx-table th { + padding-block: 0.55rem; +} + +/* Shift-board components ------------------------------------------------ */ + +.pc-hero { + position: relative; + padding: clamp(1.15rem, 2.2vw, 2rem); + border: 2px solid var(--pc-ink); + background: var(--pc-paper); +} + +.pc-hero__top { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 1.1rem; + padding-bottom: 0.65rem; + border-bottom: 1px solid var(--pc-line-strong); +} + +.pc-hero__grid { + display: grid; + grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr); + gap: clamp(1.25rem, 2.6vw, 2.5rem); + align-items: start; +} + +.pc-hero__copy { + display: flex; + min-width: 0; + flex-direction: column; + gap: 0.85rem; +} + +.pc-hero__shift { + margin: 0; + font-size: clamp(1.05rem, 1.5vw, 1.3rem); + line-height: 1.4; +} + +.pc-hero__shift strong { + font-weight: 800; +} + +.pc-receipt { + display: grid; + min-width: 0; + gap: 0; + padding-top: 0.4rem; + border-top: 3px solid var(--pc-ink); +} + +.pc-receipt__head { + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: space-between; + gap: 0.5rem; + padding-block: 0.55rem 0.7rem; + border-bottom: 1px solid var(--pc-line-strong); +} + +.pc-receipt__headline { + margin: 0; + font-size: clamp(1.8rem, 3.2vw, 2.8rem); + font-stretch: 82%; + font-weight: 850; + line-height: 0.9; + letter-spacing: -0.03em; + font-variant-numeric: tabular-nums; +} + +.pc-receipt__row { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 0.75rem; + padding-block: 0.48rem; + border-bottom: 1px solid var(--pc-line); +} + +.pc-receipt__label { + color: var(--pc-muted); + font-size: 0.7rem; + font-weight: 650; + letter-spacing: 0.04em; + text-transform: uppercase; +} + +.pc-receipt__value { + font-size: 0.98rem; + font-weight: 750; + letter-spacing: -0.01em; + text-align: right; + font-variant-numeric: tabular-nums; +} + +.pc-receipt__value--signal { + color: var(--pc-signal-text); +} + +.pc-receipt__value--green { + color: var(--pc-green); +} + +.pc-receipt__note { + margin: 0.65rem 0 0; + color: var(--pc-muted); + font-size: 0.72rem; + line-height: 1.4; +} + +.pc-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.65rem; +} + +.pc-action-note { + color: var(--pc-muted); + font-size: 0.75rem; + line-height: 1.35; +} + +.pc-board-wrap { + margin-top: 1.25rem; + padding-top: 0.7rem; + border-top: 2px solid var(--pc-ink); +} + +.pc-board-wrap__head { + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: space-between; + gap: 0.5rem; + margin-bottom: 0.5rem; +} + +.pc-board-wrap__head p { + margin: 0; +} + +.pc-board-wrap__hint { + color: var(--pc-muted); + font-size: 0.72rem; +} + +.pc-evidence { + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + gap: 0; + border-block: 2px solid var(--pc-ink); +} + +.pc-evidence__item { + min-width: 0; + padding: 0.8rem 0.9rem; + border-inline-end: 1px solid var(--pc-line); +} + +.pc-evidence__item:last-child { + border-inline-end: 0; +} + +.pc-evidence__item dt { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.35rem; + margin: 0; + color: var(--pc-muted); + font-size: 0.62rem; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.pc-evidence__item dd { + margin: 0.3rem 0 0; + font-size: 1.02rem; + font-weight: 750; + line-height: 1.15; + font-variant-numeric: tabular-nums; +} + +.pc-evidence__note { + display: block; + margin-top: 0.15rem; + color: var(--pc-muted); + font-size: 0.68rem; + font-weight: 450; + line-height: 1.35; +} + +.pc-section { + padding-top: 0.9rem; + border-top: 2px solid var(--pc-ink); +} + +.pc-section__head { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 0.85rem; +} + +.pc-section__head p { + margin: 0; +} + +.pc-section__body { + display: grid; + gap: 1rem; +} + +.pc-settings { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: 1.1rem; + align-items: start; +} + +.pc-settings__controls { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 0.8rem; +} + +.pc-settings__actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.6rem; + grid-column: 1 / -1; +} + +.pc-split { + display: grid; + grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 1fr); + gap: 1.25rem; + align-items: start; +} + +.pc-stack { + display: flex; + min-width: 0; + flex-direction: column; + gap: 1rem; +} + +.pc-panel { + padding: 0.9rem 1rem; + border: 1px solid var(--pc-line-strong); + background: var(--pc-paper); +} + +.pc-panel__head { + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: space-between; + gap: 0.5rem; + margin-bottom: 0.55rem; +} + +.pc-panel__head h2, +.pc-panel__head h3 { + margin: 0; +} + +.pc-tag { + display: inline-flex; + align-items: center; + gap: 0.25rem; + width: fit-content; + padding: 0.16rem 0.38rem; + border: 1px solid var(--pc-line-strong); + background: transparent; + color: var(--pc-muted); + font-size: 0.6rem; + font-weight: 750; + letter-spacing: 0.08em; + line-height: 1.2; + text-transform: uppercase; + white-space: nowrap; +} + +.pc-tag--signal { + border-color: var(--pc-signal-text); + background: var(--pc-signal-text); + color: var(--pc-paper); +} + +.pc-tag--green { + border-color: var(--pc-green); + color: var(--pc-green); +} + +.pc-tag--danger { + border-color: var(--pc-danger); + color: var(--pc-danger); +} + +.pc-tag--dark { + border-color: var(--pc-dark-line); + color: var(--pc-dark-muted); +} + +.pc-alert { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.65rem; + padding: 0.75rem 0.9rem; + border: 1px solid var(--pc-signal-text); + background: var(--pc-signal-wash); + color: var(--pc-ink); + font-size: 0.85rem; + line-height: 1.4; +} + +.pc-alert--danger { + border-color: var(--pc-danger); + background: #f9dedb; +} + +.pc-alert--dark { + border-color: var(--pc-dark-line); + background: var(--pc-dark-2); + color: var(--pc-paper); +} + +.pc-skeleton { + display: block; + min-height: 1rem; + background: linear-gradient(90deg, var(--pc-paper-2), var(--pc-paper-3), var(--pc-paper-2)); + background-size: 200% 100%; + animation: pc-shimmer 1.4s ease-in-out infinite; +} + +.pc-skeleton--dark { + background: linear-gradient(90deg, var(--pc-dark-2), var(--pc-dark-3), var(--pc-dark-2)); + background-size: 200% 100%; +} + +@keyframes pc-shimmer { + from { + background-position: 200% 0; + } + to { + background-position: -200% 0; + } +} + +@media (prefers-reduced-motion: reduce) { + .pc-skeleton { + animation: none; + } +} + +/* Presentation surfaces ------------------------------------------------- */ + +.pc-dark { + --pc-focus: var(--pc-focus-dark); + color-scheme: dark; + background: var(--pc-dark); + color: var(--pc-paper); + --onyx-color-base-background-blank: var(--pc-dark); + --onyx-color-base-background-tinted: var(--pc-dark-2); + --onyx-color-base-neutral-100: var(--pc-dark); + --onyx-color-base-neutral-200: var(--pc-dark-2); + --onyx-color-base-neutral-300: var(--pc-dark-line); + --onyx-color-base-neutral-400: #4a5145; + --onyx-color-base-neutral-500: #7c8275; + --onyx-color-base-neutral-600: var(--pc-dark-muted); + --onyx-color-base-neutral-700: #c9c4b8; + --onyx-color-base-neutral-800: #e6e1d6; + --onyx-color-base-neutral-900: var(--pc-paper); + --onyx-color-text-icons-neutral-intense: var(--pc-paper); + --onyx-color-text-icons-neutral-medium: var(--pc-dark-muted); + --onyx-color-text-icons-neutral-soft: var(--pc-dark-muted); + --onyx-color-text-icons-neutral-inverted: var(--pc-dark); + --onyx-color-text-icons-neutral-button: var(--pc-dark); + --onyx-color-component-border-neutral: var(--pc-dark-line); + --onyx-color-component-cta-default: var(--pc-paper); + --onyx-color-component-cta-default-hover: #fff; + --onyx-color-text-icons-primary-bold: var(--pc-paper); + --onyx-color-text-icons-primary-intense: var(--pc-signal-bright); + --onyx-color-text-icons-primary-medium: var(--pc-dark-muted); + --onyx-color-component-focus-primary: var(--pc-focus-dark); +} + +.pc-dark .onyx-card { + border-color: var(--pc-dark-line); + background: var(--pc-dark-2); +} + +.pc-dark .onyx-button--primary.onyx-button--default { + --onyx-button-background-color: var(--pc-paper); + --onyx-button-background-color-hover: #fff; + --onyx-button-text-color: var(--pc-dark); + --onyx-button-border-color: var(--pc-paper); +} + +.pc-dark .onyx-button--primary.onyx-button--outline { + --onyx-button-text-color: var(--pc-paper); + --onyx-button-border-color: var(--pc-dark-line); + --onyx-button-background-color-hover: var(--pc-dark-2); +} + +.pc-dark a { + text-decoration-color: var(--pc-signal-bright); +} + +.pc-dark .onyx-headline { + color: var(--pc-paper); +} + +.pc-dark .pc-label, +.pc-dark .pc-muted { + color: var(--pc-dark-muted); +} + +.pc-dark .pc-tag:not(.pc-tag--signal):not(.pc-tag--green) { + border-color: var(--pc-dark-line); + color: var(--pc-dark-muted); +} + +body.pc-presentation { + background: var(--pc-dark); +} + +.pc-link-button { + display: inline-flex; + align-items: center; + justify-content: center; + min-height: 44px; + padding: 0.6rem 1rem; + border: 1px solid var(--pc-dark-line); + background: transparent; + color: var(--pc-paper); + font-size: 0.9rem; + font-weight: 700; + text-decoration: none; +} + +.pc-link-button:hover { + border-color: var(--pc-paper); + background: var(--pc-dark-2); + text-decoration: none; +} + +.pc-link-button--primary { + border-color: var(--pc-paper); + background: var(--pc-paper); + color: var(--pc-dark); +} + +.pc-link-button--primary:hover { + background: #fff; + color: var(--pc-dark); +} + +/* Legacy utilities used by routes awaiting the finish pass --------------- */ + +.page-header { + display: flex; + flex-wrap: wrap; + align-items: flex-end; + justify-content: space-between; + gap: var(--onyx-density-md); +} + +.eyebrow { + margin: 0 0 var(--onyx-density-xs); + color: var(--pc-signal-text); + font-size: 0.7rem; + font-weight: 750; + letter-spacing: 0.12em; + text-transform: uppercase; +} + +.lede { + max-width: 72ch; + margin: var(--onyx-density-sm) 0 0; + color: var(--pc-muted); + font-size: 1rem; + line-height: 1.5; +} + +.muted { + color: var(--pc-muted); +} + +.onyx-table .muted, +.onyx-table .pc-muted { + color: var(--pc-ink-2); +} + +.small { + font-size: 0.8125rem; + line-height: 1.45; +} + +.mono { + font-family: var(--pc-font); + font-size: 0.8125rem; + font-variant-numeric: tabular-nums; +} + +.hero { + padding: clamp(1.25rem, 2.5vw, 2rem); + border: 2px solid var(--pc-ink); + border-radius: 0; + background: var(--pc-paper); +} + +.hero-grid { + display: grid; + gap: var(--onyx-density-xl); + align-items: start; +} + +.hero-copy { + display: flex; + flex-direction: column; + gap: var(--onyx-density-md); +} + +.hero-copy h1 { + max-width: 22ch; + margin: 0; +} + +.hero-copy p { + margin: 0; +} + +.hero-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--onyx-density-sm); +} + +.hero-decision { + padding: var(--onyx-density-lg); + border: 1px solid var(--pc-line-strong); + border-radius: 0; + background: var(--pc-paper); +} + +.hero-decision__value { + margin: 0; + color: var(--pc-signal-text); + font-size: clamp(2rem, 3vw, 3rem); + font-weight: 800; + line-height: 1; +} + +.hero-decision__label { + margin: var(--onyx-density-xs) 0 0; + color: var(--pc-muted); +} + +.summary-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: var(--onyx-density-sm); +} + +.stat-card { + height: 100%; +} + +.onyx-badge { + width: fit-content; +} + +.stat-label { + display: flex; + align-items: center; + gap: 0.35rem; + margin: 0; + color: var(--pc-muted); + font-size: 0.72rem; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.stat-value { + margin: 0.25rem 0 0; + font-size: clamp(1.35rem, 2vw, 1.75rem); + font-weight: 800; + line-height: 1.1; + font-variant-numeric: tabular-nums; +} + +.stat-hint { + margin: 0.3rem 0 0; + color: var(--pc-muted); + font-size: 0.78rem; + line-height: 1.4; +} + +.split-grid { + display: grid; + gap: var(--onyx-density-lg); + align-items: start; +} + +.card-stack { + display: flex; + min-width: 0; + flex-direction: column; + gap: var(--onyx-density-md); +} + +.split-grid > *, +.summary-grid > *, +.onyx-card, +.onyx-table-wrapper, +.onyx-table-wrapper__container { + min-width: 0; + max-width: 100%; +} + +.onyx-table-wrapper__container, +.onyx-table-wrapper__container--no-scroll { + overflow: auto; +} + +.card-header { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: var(--onyx-density-xs); + margin-bottom: var(--onyx-density-sm); +} + +.card-header h2, +.card-header h3 { + margin: 0; +} + +.form-grid { + display: grid; + gap: var(--onyx-density-md); +} + +.form-grid > *, +.onyx-form-element-v2, +.onyx-form-element-v2 > * { + min-width: 0; +} + +.form-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--onyx-density-sm); +} + +.assumption-grid { + display: grid; + gap: var(--onyx-density-md); +} + +.shift-tags { + display: flex; + flex-wrap: wrap; + gap: var(--onyx-density-2xs); +} + +.day-card-list { + display: none; + flex-direction: column; + gap: var(--onyx-density-sm); +} + +.day-card__header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: var(--onyx-density-sm); +} + +.day-card__date { + margin: 0; + font-weight: 600; +} + +.day-card__metrics { + display: flex; + flex-wrap: wrap; + gap: var(--onyx-density-sm); + margin-top: var(--onyx-density-sm); + color: var(--pc-muted); + font-size: 0.8125rem; +} + +.weather-strip { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); + gap: var(--onyx-density-2xs); + padding-bottom: var(--onyx-density-2xs); +} + +.weather-day { + display: flex; + min-width: 0; + flex-direction: column; + gap: 0.25rem; + padding: var(--onyx-density-xs); + border: 1px solid var(--pc-line); + border-radius: 0; + background: var(--pc-paper); + font-size: 0.75rem; +} + +.weather-day strong { + font-size: 0.8125rem; +} + +.why-list { + display: flex; + flex-direction: column; + gap: var(--onyx-density-sm); + margin: 0; + padding: 0; + list-style: none; +} + +.why-list li { + display: flex; + gap: var(--onyx-density-xs); + align-items: flex-start; + line-height: 1.4; +} + +.why-list .onyx-icon { + flex: none; + margin-top: 0.1rem; +} + +.map-frame { + position: relative; + min-height: 320px; + overflow: hidden; + border: 1px solid var(--pc-line); + border-radius: 0; + background: + linear-gradient(var(--pc-line) 1px, transparent 1px), + linear-gradient(90deg, var(--pc-line) 1px, transparent 1px), + var(--pc-paper); + background-size: 2.5rem 2.5rem; +} + +.map-frame__label { + position: absolute; + top: var(--onyx-density-sm); + left: var(--onyx-density-sm); + z-index: 2; + max-width: 14rem; +} + +.sensor-pin { + position: absolute; + display: flex; + flex-direction: column; + align-items: center; + gap: 0.15rem; + transform: translate(-50%, -50%); + border: 0; + background: transparent; + color: inherit; + cursor: pointer; + font: inherit; +} + +.sensor-pin__dot { + display: grid; + width: 2.25rem; + height: 2.25rem; + place-items: center; + border: 2px solid var(--pc-paper); + border-radius: 50%; + background: var(--pc-ink); + color: var(--pc-paper); + font-size: 0.75rem; + font-weight: 700; +} + +.sensor-pin--active .sensor-pin__dot { + background: var(--pc-signal); + color: var(--pc-ink); + outline: 3px solid var(--pc-signal-text); +} + +.sensor-pin__name { + max-width: 7rem; + overflow: hidden; + padding: 0.1rem 0.3rem; + border-radius: 0; + background: color-mix(in srgb, var(--pc-paper) 88%, transparent); + font-size: 0.6875rem; + line-height: 1.2; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; +} + +.bar-chart { + display: flex; + height: 96px; + align-items: flex-end; + gap: 2px; + padding-top: var(--onyx-density-sm); +} + +.bar-chart__bar { + min-width: 3px; + flex: 1; + border-radius: 0; + background: var(--pc-line-strong); +} + +.bar-chart__bar--now { + background: var(--pc-signal); +} + +.reading-row { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: var(--onyx-density-sm); +} + +.reading-value { + margin: 0; + font-size: clamp(2.5rem, 6vw, 4rem); + font-weight: 800; + line-height: 1; + font-variant-numeric: tabular-nums; +} + +.legend { + display: flex; + flex-wrap: wrap; + gap: var(--onyx-density-sm); + align-items: center; +} + +.legend__item { + display: inline-flex; + align-items: center; + gap: 0.35rem; + color: var(--pc-muted); + font-size: 0.75rem; +} + +.legend__swatch { + width: 0.75rem; + height: 0.75rem; + border-radius: 0; + background: var(--pc-line-strong); +} + +.legend__swatch--under { + background: var(--pc-danger); +} + +.legend__swatch--over { + background: var(--pc-signal); +} + +.table-note { + margin: var(--onyx-density-xs) 0 0; +} + +.callout { + padding: var(--onyx-density-sm) var(--onyx-density-md); + border: 1px solid var(--pc-line-strong); + border-radius: 0; + background: var(--pc-paper-2); +} + +.callout--warning { + border-color: var(--pc-signal-text); + background: var(--pc-signal-wash); +} + +.scenario-grid { + display: grid; + gap: var(--onyx-density-sm); +} + +.scenario-card { + cursor: pointer; +} + +.scenario-card--active { + outline: 2px solid var(--pc-ink); + outline-offset: 2px; +} + +.metric-list { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: var(--onyx-density-md); + margin: 0; +} + +.metric-list div { + min-width: 0; +} + +.metric-list dt { + color: var(--pc-muted); + font-size: 0.72rem; + letter-spacing: 0.04em; + text-transform: uppercase; +} + +.metric-list dd { + margin: 0.15rem 0 0; + font-weight: 700; + font-variant-numeric: tabular-nums; +} + +.train-status { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--onyx-density-sm); + margin-top: var(--onyx-density-sm); +} + +/* Responsive ------------------------------------------------------------ */ + +@media (min-width: 577px) { + .assumption-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (min-width: 769px) { + .summary-grid { + grid-template-columns: repeat(4, minmax(0, 1fr)); + } +} + +@media (min-width: 993px) { + .hero-grid { + grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr); + } + + .split-grid { + grid-template-columns: minmax(0, 1.9fr) minmax(20rem, 1fr); + } + + .scenario-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (max-width: 1100px) { + .pc-evidence { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + + .pc-evidence__item:nth-child(3) { + border-inline-end: 0; + } + + .pc-evidence__item:nth-child(n + 4) { + border-top: 1px solid var(--pc-line); + } +} + +@media (max-width: 900px) { + .pc-hero__grid, + .pc-settings, + .pc-split { + grid-template-columns: minmax(0, 1fr); + } + + .pc-hero__grid { + gap: 1.25rem; + } + + .pc-receipt { + padding-top: 0.35rem; + } +} + +@media (max-width: 768px) { + .desktop-table { + display: none; + } + + .day-card-list { + display: flex; + } + + .pc-settings__controls { + grid-template-columns: minmax(0, 1fr); + } + + .pc-evidence { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .pc-evidence__item { + border-inline-end: 1px solid var(--pc-line); + } + + .pc-evidence__item:nth-child(2n) { + border-inline-end: 0; + } + + .pc-evidence__item:nth-child(n + 3) { + border-top: 1px solid var(--pc-line); + } + + .pc-evidence__item:nth-child(3) { + border-inline-end: 1px solid var(--pc-line); + } + + .pc-evidence__item:last-child { + grid-column: 1 / -1; + border-inline-end: 0; + } +} + +@media (max-width: 576px) { + .sensor-pin__name { + display: none; + } + + .map-frame { + min-height: 360px; + } + + .card-header { + flex-direction: column; + align-items: stretch; + } + + .card-header .onyx-badge { + align-self: flex-start; + } + + .pc-page { + padding-block: 0.9rem 1.5rem; + } + + .pc-h1 { + font-size: clamp(2.6rem, 12vw, 3.4rem); + } + + .pc-hero { + padding: 1rem; + } + + .pc-receipt__headline { + font-size: 2.1rem; + } + + .pc-actions { + align-items: stretch; + } + + .pc-actions .onyx-button { + flex: 1 1 auto; + } +} + +@media (max-width: 640px) { + .pc-board__time { + display: none; + } + + .pc-board__head { + flex-direction: column; + gap: 0; + } + + .pc-board__staff { + font-size: 1rem; + } + + .pc-board__day { + gap: 0.25rem; + padding: 0.35rem 0.22rem 0.3rem; + } + + .pc-board__track { + min-height: 6.5rem; + } + + .pc-board__peak, + .pc-board__peakstaff { + display: none; + } + + .pc-board__foot { + font-size: 0.55rem; + } + + .pc-board__weekday { + font-size: 0.48rem; + } + + .pc-board__date { + font-size: 0.72rem; + } + + .pc-board__block { + padding: 0.15rem 0.22rem; + } +} + +@media (print) { + .hero-actions, + .form-actions, + .desktop-table, + .onyx-nav-bar { + display: none !important; + } +} diff --git a/app/components/CoolPlacesMap.vue b/app/components/CoolPlacesMap.vue new file mode 100644 index 0000000..49df144 --- /dev/null +++ b/app/components/CoolPlacesMap.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/app/components/CoolRouteCard.vue b/app/components/CoolRouteCard.vue new file mode 100644 index 0000000..f4b5664 --- /dev/null +++ b/app/components/CoolRouteCard.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/app/components/CoolRouteMap.vue b/app/components/CoolRouteMap.vue new file mode 100644 index 0000000..18fc673 --- /dev/null +++ b/app/components/CoolRouteMap.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/app/components/LiveStatusBadge.vue b/app/components/LiveStatusBadge.vue new file mode 100644 index 0000000..dac1d63 --- /dev/null +++ b/app/components/LiveStatusBadge.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/app/components/MetricCard.vue b/app/components/MetricCard.vue new file mode 100644 index 0000000..dec4119 --- /dev/null +++ b/app/components/MetricCard.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/app/components/PulseLine.vue b/app/components/PulseLine.vue new file mode 100644 index 0000000..946ec89 --- /dev/null +++ b/app/components/PulseLine.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/app/components/SensorClusterMap.vue b/app/components/SensorClusterMap.vue new file mode 100644 index 0000000..a03b8b7 --- /dev/null +++ b/app/components/SensorClusterMap.vue @@ -0,0 +1,57 @@ + + + diff --git a/app/components/TrainModelCard.vue b/app/components/TrainModelCard.vue new file mode 100644 index 0000000..c462d9a --- /dev/null +++ b/app/components/TrainModelCard.vue @@ -0,0 +1,168 @@ + + + diff --git a/app/components/WeatherStrip.vue b/app/components/WeatherStrip.vue new file mode 100644 index 0000000..ba55608 --- /dev/null +++ b/app/components/WeatherStrip.vue @@ -0,0 +1,25 @@ + + + diff --git a/app/components/WeekBoard.vue b/app/components/WeekBoard.vue new file mode 100644 index 0000000..4f40c20 --- /dev/null +++ b/app/components/WeekBoard.vue @@ -0,0 +1,419 @@ + + + + + diff --git a/app/composables/useCoolCityData.ts b/app/composables/useCoolCityData.ts new file mode 100644 index 0000000..d43b762 --- /dev/null +++ b/app/composables/useCoolCityData.ts @@ -0,0 +1,8 @@ +import type { CoolCityBundle } from '#shared/cool' + +export async function useCoolCityData() { + const { data } = await useFetch('/cool-city/city-gap.json', { + key: 'cool-city-gap', + }) + return { city: data } +} diff --git a/app/composables/useCoolDemo.ts b/app/composables/useCoolDemo.ts new file mode 100644 index 0000000..af66d77 --- /dev/null +++ b/app/composables/useCoolDemo.ts @@ -0,0 +1,72 @@ +import { defaultCoolState, emptyCoolTally } from '#shared/cool' +import type { CoolDemoState, CoolRound, CoolVoteTally } from '#shared/cool' + +/** State + tally polling for the stage and phone. 2 s is the demo fallback. */ +export function useCoolDemo( + round: Ref, + initialState?: CoolDemoState | null, + initialTally?: CoolVoteTally | null, +) { + const state = ref(initialState ?? defaultCoolState(round.value)) + const tally = ref(initialTally ?? emptyCoolTally(round.value)) + const feedError = ref(false) + let timer: ReturnType | undefined + + watch(round, () => { + state.value = defaultCoolState(round.value) + tally.value = emptyCoolTally(round.value) + void poll() + }) + + async function poll() { + const [stateResult, tallyResult] = await Promise.allSettled([ + $fetch('/api/cool/state', { + query: { round: round.value }, + headers: { accept: 'application/json', 'cache-control': 'no-cache' }, + }), + $fetch('/api/cool/vote', { + query: { round: round.value }, + headers: { accept: 'application/json', 'cache-control': 'no-cache' }, + }), + ]) + if (stateResult.status === 'fulfilled') state.value = stateResult.value + if (tallyResult.status === 'fulfilled') tally.value = tallyResult.value + feedError.value = stateResult.status === 'rejected' || tallyResult.status === 'rejected' + } + + async function update(patch: Partial>) { + state.value = { ...state.value, ...patch, updatedAt: new Date().toISOString() } + try { + const next = await $fetch('/api/cool/state', { + method: 'POST', + body: { round: round.value, ...patch }, + }) + state.value = next + } catch { + feedError.value = true + } + } + + async function reset() { + try { + const result = await $fetch<{ state: CoolDemoState; tally: CoolVoteTally }>('/api/cool/reset', { + method: 'POST', + body: { round: round.value }, + }) + state.value = result.state + tally.value = result.tally + feedError.value = false + } catch { + feedError.value = true + } + } + + onMounted(() => { + timer = setInterval(() => void poll(), 2000) + }) + onBeforeUnmount(() => { + if (timer) clearInterval(timer) + }) + + return { state, tally, feedError, update, reset, poll } +} diff --git a/app/composables/useCoolRouteData.ts b/app/composables/useCoolRouteData.ts new file mode 100644 index 0000000..25d5cb1 --- /dev/null +++ b/app/composables/useCoolRouteData.ts @@ -0,0 +1,20 @@ +import { pendingCoolRouteBundle } from '#shared/cool' +import type { CoolRouteBundle, CoolRouteId, CoolRouteValues, CoolTime } from '#shared/cool' + +export async function useCoolRouteData() { + const { data } = await useFetch('/cool-city/route.json', { + key: 'cool-route-bundle', + }) + const bundle = computed(() => data.value ?? pendingCoolRouteBundle()) + const pending = computed(() => bundle.value.status !== 'ready') + + function routeForTime(time: CoolTime | string): CoolRouteId { + return bundle.value.recommendationByTime[time] ?? 'shortest' + } + + function valuesFor(routeId: CoolRouteId, time: CoolTime | string): CoolRouteValues | null { + return bundle.value.routes.find((route) => route.id === routeId)?.values[time] ?? null + } + + return { bundle, pending, routeForTime, valuesFor } +} diff --git a/app/composables/useCoolVote.ts b/app/composables/useCoolVote.ts new file mode 100644 index 0000000..e95a272 --- /dev/null +++ b/app/composables/useCoolVote.ts @@ -0,0 +1,72 @@ +import { isCoolRouteId } from '#shared/cool' +import type { CoolRouteId, CoolRound, CoolVoteResponse, CoolVoteTally } from '#shared/cool' + +const SESSION_KEY = 'cool-city-session-v1' + +/** One anonymous vote per browser and round. No PII. */ +export function useCoolVote(round: Ref) { + const mounted = ref(false) + const sessionId = ref('') + const myVote = ref('') + const busy = ref(false) + const error = ref('') + const tally = ref(null) + + function voteKey(value: CoolRound) { + return `cool-city-vote-v1:${value}` + } + + function makeSessionId(): string { + if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) return crypto.randomUUID() + return `cool_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}` + } + + function readStoredVote(value: CoolRound): CoolRouteId | '' { + const stored = localStorage.getItem(voteKey(value)) + return isCoolRouteId(stored) ? stored : '' + } + + onMounted(() => { + let storedSession = localStorage.getItem(SESSION_KEY) + if (!storedSession || storedSession.length < 8) { + storedSession = makeSessionId() + localStorage.setItem(SESSION_KEY, storedSession) + } + sessionId.value = storedSession + myVote.value = readStoredVote(round.value) + mounted.value = true + }) + + watch(round, (value) => { + if (!mounted.value) return + myVote.value = readStoredVote(value) + tally.value = null + error.value = '' + }) + + async function vote(route: CoolRouteId) { + if (!mounted.value || busy.value || myVote.value || !sessionId.value) return + busy.value = true + error.value = '' + try { + const response = await $fetch('/api/cool/vote', { + method: 'POST', + body: { route, sessionId: sessionId.value, round: round.value }, + }) + myVote.value = response.yourRoute + tally.value = response.tally + localStorage.setItem(voteKey(round.value), response.yourRoute) + } catch (cause) { + const status = (cause as { statusCode?: number; status?: number })?.statusCode ?? + (cause as { status?: number })?.status + error.value = + status === 409 + ? 'Voting is not open right now.' + : 'The vote could not be recorded. Try again.' + } finally { + busy.value = false + } + } + + return { mounted, myVote, busy, error, tally, vote } +} diff --git a/app/composables/useLiveScenario.ts b/app/composables/useLiveScenario.ts new file mode 100644 index 0000000..e092f3c --- /dev/null +++ b/app/composables/useLiveScenario.ts @@ -0,0 +1,276 @@ +import { + LIVE_LABELS, + liveStatus, + parseScenarioEvent, + scenarioChanged, + SCENARIO_POLL_MS, + SSE_FAILURES_BEFORE_POLLING, + SSE_STALE_MS, +} from '#shared/live' +import type { LiveConnection } from '#shared/live' +import type { ScenarioState } from '#shared/types' + +interface LiveStore { + status: LiveConnection + serverScenario: ScenarioState | null + lastEventAt: string + lastPollAt: string + sseFailures: number + pollFailures: number + revision: number + error: string +} + +// One stream per browser tab. The module-level store survives page navigation +// and is only mutated from onMounted/EventSource callbacks (never during SSR). +const store = reactive({ + status: 'connecting', + serverScenario: null, + lastEventAt: '', + lastPollAt: '', + sseFailures: 0, + pollFailures: 0, + revision: 0, + error: '', +}) + +let source: EventSource | null = null +let pollTimer: ReturnType | null = null +let staleTimer: ReturnType | null = null +let reconnectTimer: ReturnType | null = null +let subscribers = 0 +let started = false +let lastStaleRetry = 0 + +function nowIso(): string { + return new Date().toISOString() +} + +function refreshStatus() { + store.status = liveStatus({ + online: import.meta.client ? navigator.onLine !== false : true, + sseOpen: source?.readyState === EventSource.OPEN, + sseFailures: store.sseFailures, + polling: pollTimer !== null, + pollFailures: store.pollFailures, + }) +} + +function clearPolling() { + if (pollTimer) clearInterval(pollTimer) + pollTimer = null +} + +function applyScenario(next: ScenarioState, origin: 'sse' | 'poll') { + const changed = scenarioChanged(store.serverScenario, next) + store.serverScenario = next + store.lastEventAt = nowIso() + store.error = '' + if (origin === 'poll') store.lastPollAt = store.lastEventAt + if (changed) store.revision += 1 +} + +async function pollScenario(): Promise { + if (!import.meta.client) return + try { + const next = await $fetch('/api/scenario', { + headers: { accept: 'application/json' }, + timeout: 5000, + }) + store.pollFailures = 0 + applyScenario(next, 'poll') + // A successful poll proves the API is reachable; stay "Polling" until SSE + // opens again, so the audience can see the fallback is active. + if (store.status === 'offline') store.status = 'polling' + } catch (error) { + store.pollFailures += 1 + store.error = (error as { statusMessage?: string })?.statusMessage ?? 'Scenario polling failed' + } + refreshStatus() +} + +function startPolling() { + if (!import.meta.client || pollTimer) return + void pollScenario() + pollTimer = setInterval(() => void pollScenario(), SCENARIO_POLL_MS) + refreshStatus() +} + +function closeSource() { + if (source) { + source.close() + source = null + } + if (reconnectTimer) clearTimeout(reconnectTimer) + reconnectTimer = null +} + +function connectSse() { + if (!import.meta.client) return + closeSource() + + if (navigator.onLine === false) { + store.status = 'offline' + startPolling() + return + } + + const eventSource = new EventSource('/api/stream') + source = eventSource + + eventSource.onopen = () => { + if (source !== eventSource) return + store.sseFailures = 0 + store.pollFailures = 0 + store.error = '' + // Start the stale watchdog now: a proxy can accept the SSE headers and + // then buffer the body, so "open" does not prove events are flowing. + store.lastEventAt = nowIso() + clearPolling() + refreshStatus() + } + + eventSource.addEventListener('scenario', (event) => { + if (source !== eventSource) return + const parsed = parseScenarioEvent((event as MessageEvent).data) + if (!parsed) { + store.error = 'Ignored a malformed scenario event' + return + } + store.sseFailures = 0 + applyScenario(parsed, 'sse') + refreshStatus() + }) + + eventSource.addEventListener('ping', () => { + if (source !== eventSource) return + store.sseFailures = 0 + store.lastEventAt = nowIso() + if (pollTimer && eventSource.readyState === EventSource.OPEN) clearPolling() + refreshStatus() + }) + + eventSource.onerror = () => { + if (source !== eventSource) return + store.sseFailures += 1 + + // A non-200 response (Nitro 502/503, proxy error) leaves EventSource in + // CLOSED and the browser will not retry it. Treat that as a definitive + // failure: start polling now and try the stream again on a timer. Network + // errors while CONNECTING still use the browser's own retry loop. + const fatal = eventSource.readyState === EventSource.CLOSED + if (fatal) { + store.sseFailures = Math.max(store.sseFailures, SSE_FAILURES_BEFORE_POLLING) + if (!reconnectTimer) { + reconnectTimer = setTimeout(() => { + if (!started) return + connectSse() + }, 5000) + } + } + + if (store.sseFailures >= SSE_FAILURES_BEFORE_POLLING) startPolling() + refreshStatus() + } +} + +function checkStale() { + if (!import.meta.client || !started) return + const sseOpen = source?.readyState === EventSource.OPEN + if (sseOpen && store.lastEventAt) { + const age = Date.now() - Date.parse(store.lastEventAt) + if (age > SSE_STALE_MS) { + // Connection is open but no ping arrived: Cloudflare/path buffering. + // Polling is the contract fallback; retry SSE once a minute. + store.sseFailures = Math.max(store.sseFailures, SSE_FAILURES_BEFORE_POLLING) + startPolling() + refreshStatus() + if (Date.now() - lastStaleRetry > 60000) { + lastStaleRetry = Date.now() + connectSse() + } + } + } + if (store.pollFailures > 0) refreshStatus() +} + +function start() { + if (!import.meta.client || started) return + started = true + store.sseFailures = 0 + store.pollFailures = 0 + store.lastEventAt = '' + store.error = '' + store.status = 'connecting' + window.addEventListener('online', handleOnline) + window.addEventListener('offline', handleOffline) + staleTimer = setInterval(checkStale, 5000) + connectSse() +} + +function stop() { + if (!import.meta.client) return + started = false + closeSource() + clearPolling() + if (staleTimer) clearInterval(staleTimer) + staleTimer = null + window.removeEventListener('online', handleOnline) + window.removeEventListener('offline', handleOffline) + store.status = 'connecting' +} + +function handleOnline() { + if (!started) return + store.pollFailures = 0 + connectSse() + void pollScenario() +} + +function handleOffline() { + if (!started) return + store.status = 'offline' + if (pollTimer) clearInterval(pollTimer) + pollTimer = null +} + +/** + * Subscribe the current page to the Go scenario stream through Nitro. + * + * The first render uses `initial` from SSR; after mount the composable opens + * `/api/stream`, shows Live/Polling/Offline, and falls back to GET + * /api/scenario every 5 s when SSE fails or is buffered. + */ +export function useLiveScenario(initial?: ScenarioState | null) { + const initialScenario = initial ?? null + + const current = computed(() => store.serverScenario ?? initialScenario) + const scenarioId = computed(() => current.value?.scenario.scenario ?? 'base') + const status = computed(() => store.status) + const statusLabel = computed(() => LIVE_LABELS[store.status]) + + onMounted(() => { + // Seed after hydration so the first client paint matches the SSR HTML. + if (initialScenario && !store.serverScenario) store.serverScenario = initialScenario + subscribers += 1 + start() + }) + onBeforeUnmount(() => { + subscribers = Math.max(0, subscribers - 1) + if (subscribers === 0) stop() + }) + + return reactive({ + scenario: current, + scenarioId, + version: computed(() => current.value?.version ?? 0), + scenarioAt: computed(() => current.value?.at ?? ''), + status, + statusLabel, + lastEventAt: computed(() => store.lastEventAt), + lastPollAt: computed(() => store.lastPollAt), + error: computed(() => store.error), + revision: computed(() => store.revision), + pollNow: pollScenario, + }) +} diff --git a/app/pages/about.vue b/app/pages/about.vue new file mode 100644 index 0000000..f5b1f42 --- /dev/null +++ b/app/pages/about.vue @@ -0,0 +1,152 @@ + + + diff --git a/app/pages/control.vue b/app/pages/control.vue new file mode 100644 index 0000000..103dcd5 --- /dev/null +++ b/app/pages/control.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/app/pages/cool/city.vue b/app/pages/cool/city.vue new file mode 100644 index 0000000..17633c6 --- /dev/null +++ b/app/pages/cool/city.vue @@ -0,0 +1,447 @@ + + + + + diff --git a/app/pages/cool/index.vue b/app/pages/cool/index.vue new file mode 100644 index 0000000..dc3397c --- /dev/null +++ b/app/pages/cool/index.vue @@ -0,0 +1,419 @@ + + + + + diff --git a/app/pages/cool/stage.vue b/app/pages/cool/stage.vue new file mode 100644 index 0000000..439733e --- /dev/null +++ b/app/pages/cool/stage.vue @@ -0,0 +1,1092 @@ + + + + + diff --git a/app/pages/forecast.vue b/app/pages/forecast.vue new file mode 100644 index 0000000..dff6bb9 --- /dev/null +++ b/app/pages/forecast.vue @@ -0,0 +1,320 @@ + + + + + diff --git a/app/pages/live.vue b/app/pages/live.vue new file mode 100644 index 0000000..59c5d33 --- /dev/null +++ b/app/pages/live.vue @@ -0,0 +1,506 @@ + + + + + diff --git a/app/pages/plan.vue b/app/pages/plan.vue new file mode 100644 index 0000000..35b74f8 --- /dev/null +++ b/app/pages/plan.vue @@ -0,0 +1,1017 @@ + + + + + diff --git a/app/pages/simulate.vue b/app/pages/simulate.vue new file mode 100644 index 0000000..c6261a1 --- /dev/null +++ b/app/pages/simulate.vue @@ -0,0 +1,270 @@ + + + diff --git a/app/pages/stage.vue b/app/pages/stage.vue new file mode 100644 index 0000000..31c0f66 --- /dev/null +++ b/app/pages/stage.vue @@ -0,0 +1,677 @@ + + + + + diff --git a/app/router.options.ts b/app/router.options.ts new file mode 100644 index 0000000..2f8222d --- /dev/null +++ b/app/router.options.ts @@ -0,0 +1,7 @@ +import type { RouterConfig } from '@nuxt/schema' + +// Onyx scrolls inside .onyx-page__main, not the window, so the default Nuxt +// scroll behaviour does not reach the page container. +export default { + scrollBehavior: createOnyxScrollBehavior(), +} satisfies RouterConfig diff --git a/app/utils/api-error.ts b/app/utils/api-error.ts new file mode 100644 index 0000000..be2b380 --- /dev/null +++ b/app/utils/api-error.ts @@ -0,0 +1,27 @@ +interface ApiErrorLike { + status?: number + statusCode?: number + statusMessage?: string + message?: string + data?: { + error?: { message?: string; code?: string } + message?: string + } +} + +/** Human-readable message from a Nuxt/$fetch error, without leaking tokens. */ +export function apiErrorMessage(error: unknown, fallback: string): string { + const value = error as ApiErrorLike | undefined + return ( + value?.data?.error?.message ?? + value?.data?.message ?? + value?.statusMessage ?? + value?.message ?? + fallback + ) +} + +export function apiErrorStatus(error: unknown): number | undefined { + const value = error as ApiErrorLike | undefined + return value?.status ?? value?.statusCode +} diff --git a/app/utils/cool-map.ts b/app/utils/cool-map.ts new file mode 100644 index 0000000..1f04a5c --- /dev/null +++ b/app/utils/cool-map.ts @@ -0,0 +1,44 @@ +export interface GeoPoint { + lat: number + lon: number +} + +export interface ProjectedPoint { + x: number + y: number +} + +export function createProjection( + points: GeoPoint[], + width = 1200, + height = 800, + padding = 80, +): (point: GeoPoint) => ProjectedPoint { + const lats = points.map((point) => point.lat) + const lons = points.map((point) => point.lon) + const minLat = Math.min(...lats) + const maxLat = Math.max(...lats) + const minLon = Math.min(...lons) + const maxLon = Math.max(...lons) + const spanLat = Math.max(maxLat - minLat, 0.0001) + const spanLon = Math.max(maxLon - minLon, 0.0001) + const innerW = width - padding * 2 + const innerH = height - padding * 2 + + return (point: GeoPoint) => ({ + x: padding + ((point.lon - minLon) / spanLon) * innerW, + y: padding + ((maxLat - point.lat) / spanLat) * innerH, + }) +} + +export function pathFromCoordinates( + coordinates: Array<[number, number]>, + project: (point: GeoPoint) => ProjectedPoint, +): string { + return coordinates + .map(([lon, lat], index) => { + const point = project({ lat, lon }) + return `${index === 0 ? 'M' : 'L'} ${point.x.toFixed(1)} ${point.y.toFixed(1)}` + }) + .join(' ') +} diff --git a/app/utils/cool.ts b/app/utils/cool.ts new file mode 100644 index 0000000..b933f90 --- /dev/null +++ b/app/utils/cool.ts @@ -0,0 +1,52 @@ +import type { CoolRouteValues } from '#shared/cool' + +export function coolValue(value: number | null | undefined, suffix = ''): string { + if (value === null || value === undefined || Number.isNaN(value)) return 'TBD' + return `${value}${suffix}` +} + +export function coolShade(value: number | null | undefined): string { + if (value === null || value === undefined) return 'TBD' + return `${value.toFixed(1)}%` +} + +export function coolDistance(value: number | null | undefined): string { + if (value === null || value === undefined) return 'TBD' + if (value >= 1000) return `${(value / 1000).toFixed(2)} km` + return `${Math.floor(value)} m` +} + +export function coolMinutes(value: number | null | undefined): string { + if (value === null || value === undefined) return 'TBD' + return `${value.toFixed(1)} min` +} + +export function coolYesNo(value: boolean | null | undefined): string { + if (value === null || value === undefined) return 'TBD' + return value ? 'Yes' : 'No' +} + +export function coolStops(value: number | null | undefined): string { + if (value === null || value === undefined) return 'TBD' + return String(value) +} + +export function coolValues(values: CoolRouteValues | null | undefined): CoolRouteValues { + return ( + values ?? { + shadePct: null, + directSunMin: null, + distanceM: null, + durationMin: null, + stepFree: null, + waterStops: null, + benchStops: null, + rampInclinePct: null, + } + ) +} + +export function coolTallyPct(count: number, total: number): number { + if (!total) return 0 + return Math.round((count / total) * 100) +} diff --git a/app/utils/format.ts b/app/utils/format.ts new file mode 100644 index 0000000..960fdf2 --- /dev/null +++ b/app/utils/format.ts @@ -0,0 +1,99 @@ +import { BERLIN_TZ } from '#shared/staffing' + +const dateFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + day: 'numeric', + month: 'short', + year: 'numeric', +}) + +const shortDateFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + day: 'numeric', + month: 'short', +}) + +const weekdayFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + weekday: 'long', +}) + +const weekdayShortFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + weekday: 'short', +}) + +const dateTimeFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + day: 'numeric', + month: 'short', + hour: '2-digit', + minute: '2-digit', + hourCycle: 'h23', +}) + +const timeFormatter = new Intl.DateTimeFormat('en-GB', { + timeZone: BERLIN_TZ, + hour: '2-digit', + minute: '2-digit', + hourCycle: 'h23', +}) + +const euroFormatter = new Intl.NumberFormat('en-GB', { + style: 'currency', + currency: 'EUR', + maximumFractionDigits: 0, +}) + +const numberFormatter = new Intl.NumberFormat('en-GB') + +/** Date-only strings are parsed at noon UTC so the local date never shifts. */ +function toDate(value: string): Date { + return value.length > 10 ? new Date(value) : new Date(`${value}T12:00:00Z`) +} + +function formatWith(formatter: Intl.DateTimeFormat, value: string): string { + const date = toDate(value) + return Number.isNaN(date.getTime()) ? '—' : formatter.format(date) +} + +export function formatDate(date: string): string { + return formatWith(dateFormatter, date) +} + +export function formatShortDate(date: string): string { + return formatWith(shortDateFormatter, date) +} + +export function formatWeekday(date: string): string { + return formatWith(weekdayFormatter, date) +} + +export function formatWeekdayShort(date: string): string { + return formatWith(weekdayShortFormatter, date) +} + +/** Format a wire timestamp in Heilbronn local time. */ +export function formatDateTime(iso: string): string { + return formatWith(dateTimeFormatter, iso) +} + +export function formatTime(iso: string): string { + return formatWith(timeFormatter, iso) +} + +export function formatEuro(value: number): string { + return euroFormatter.format(value) +} + +export function formatNumber(value: number): string { + return numberFormatter.format(value) +} + +export function formatPercent(value: number, digits = 0): string { + return `${value.toFixed(digits)}%` +} + +export function weekLabel(start: string, end: string): string { + return `${formatShortDate(start)} – ${formatDate(end)}` +} diff --git a/app/utils/plan.ts b/app/utils/plan.ts new file mode 100644 index 0000000..9316adc --- /dev/null +++ b/app/utils/plan.ts @@ -0,0 +1,108 @@ +import { berlinParts } from '#shared/staffing' +import type { Point, Shift, StaffingHour, StaffingResponse } from '#shared/types' +import { formatShortDate, formatWeekday, formatWeekdayShort } from '~/utils/format' + +export interface PlanDay { + date: string + dayNumber: string + month: string + weekday: string + weekdayLong: string + shifts: Shift[] + hours: StaffingHour[] + staffHours: number + peakStaff: number + peakFootfall: number + peakHour: number + cost: number + overHours: number + underHours: number +} + +export function maxOf(items: T[], score: (item: T) => number): T | undefined { + let best: T | undefined + for (const item of items) { + if (!best || score(item) > score(best)) best = item + } + return best +} + +export function peakShiftOf(plan: StaffingResponse | null | undefined): Shift | undefined { + return plan ? maxOf(plan.shifts, (shift) => shift.staff) : undefined +} + +export function peakHourOf(plan: StaffingResponse | null | undefined): StaffingHour | undefined { + return plan ? maxOf(plan.hours, (hour) => hour.footfall) : undefined +} + +export function totalStaffHoursOf(plan: StaffingResponse | null | undefined): number { + return plan ? plan.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) : 0 +} + +export function savingOf(plan: StaffingResponse | null | undefined): number { + if (!plan) return 0 + return Math.max(0, plan.summary.flat_schedule_cost_eur - plan.summary.cost_eur) +} + +export function savingPctOf(plan: StaffingResponse | null | undefined): number { + if (!plan || plan.summary.flat_schedule_cost_eur <= 0) return 0 + return (savingOf(plan) / plan.summary.flat_schedule_cost_eur) * 100 +} + +export function planDays(plan: StaffingResponse | null | undefined): PlanDay[] { + if (!plan) return [] + + const shiftsByDate: Record = {} + for (const shift of plan.shifts) (shiftsByDate[shift.date] ??= []).push(shift) + + const hoursByDate: Record = {} + for (const hour of plan.hours) { + const date = berlinParts(hour.t).date + ;(hoursByDate[date] ??= []).push(hour) + } + + const dates = [...new Set([...Object.keys(shiftsByDate), ...Object.keys(hoursByDate)])].sort() + const costPerHour = plan.assumptions.labor_cost_eur_h + + return dates.map((date) => { + const shifts = (shiftsByDate[date] ?? []).slice().sort((a, b) => a.start.localeCompare(b.start)) + const hours = (hoursByDate[date] ?? []).slice().sort((a, b) => a.t.localeCompare(b.t)) + const peakHour = maxOf(hours, (hour) => hour.footfall) + const staffHours = hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) + const [dayNumber = '', month = ''] = formatShortDate(date).split(' ') + + return { + date, + dayNumber, + month, + weekday: formatWeekdayShort(date), + weekdayLong: formatWeekday(date), + shifts, + hours, + staffHours, + peakStaff: Math.max(0, ...hours.map((hour) => hour.scheduled_staff), ...shifts.map((shift) => shift.staff)), + peakFootfall: peakHour?.footfall ?? 0, + peakHour: peakHour ? berlinParts(peakHour.t).hour : 0, + cost: staffHours * costPerHour, + overHours: hours.filter((hour) => hour.coverage === 'over').length, + underHours: hours.filter((hour) => hour.coverage === 'under').length, + } + }) +} + +export function planPulsePoints(plan: StaffingResponse | null | undefined): Point[] { + return (plan?.hours ?? []).map((hour) => ({ t: hour.t, v: hour.footfall })) +} + +export function numberWord(value: number): string { + const words = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'] + return words[value] ?? String(value) +} + +export function shiftLabel(shift: Shift): string { + return `${shift.start}–${shift.end}` +} + +export function coverWord(value: number, singular: string, plural = `${singular}s`): string { + return `${value} ${value === 1 ? singular : plural}` +} diff --git a/nuxt.config.ts b/nuxt.config.ts index c86e1b4..d1b5c5e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -6,8 +6,8 @@ const useMock = export default defineNuxtConfig({ compatibilityDate: '2026-11-01', ssr: true, - modules: ['@nuxt/icon'], - css: ['~/assets/css/tailwind.css'], + modules: ['@sit-onyx/nuxt', '@nuxt/icon'], + css: ['~/assets/css/main.css', '~/assets/css/cool.css', '~/assets/css/tailwind.css'], postcss: { plugins: { tailwindcss: {}, @@ -94,5 +94,6 @@ export default defineNuxtConfig({ }, nitro: { preset: 'node-server', + compressPublicAssets: true, }, }) diff --git a/public/cool-city/city-gap.json b/public/cool-city/city-gap.json new file mode 100644 index 0000000..12c62d2 --- /dev/null +++ b/public/cool-city/city-gap.json @@ -0,0 +1,3557 @@ +{ + "meta": { + "city": "Heilbronn", + "generated": "2026-11-14", + "sensor_source": "https://api-pulse.noelsabia.dev/api/sensors", + "sensor_data_version": "2026-11-07T23:51:00Z", + "sensor_model_version": "histgb-2026-11-14", + "catchment_radius_m": 300.0, + "catchment_area_m2": 282743.3, + "layer_counts": { + "osm_buildings": 4061, + "osm_trees": 405, + "osm_tree_rows": 5, + "osm_wood_forest_polygons": 8, + "osm_benches": 293, + "osm_toilets": 16, + "osm_drinking_water": 3, + "osm_wheelchair_yes": 363, + "official_cool_places": 81, + "official_drinking_fountains": 6, + "official_refill_stations": 25, + "official_water_dispensers": 6, + "official_public_toilets": 19, + "official_accessible_toilets": 13 + }, + "method": "Relative cooling-gap index: weighted sum of normalized footfall, shade deficit, access deficit and vulnerability.", + "weights": { + "footfall": 0.4, + "shade_deficit": 0.3, + "access_deficit": 0.2, + "vulnerability": 0.1 + }, + "weights_note": "Heuristic risk-framework weights (exposure, hazard, adaptive capacity, sensitivity); not calibrated against observed heat outcomes.", + "ranking_note": "Ranks 1 and 2 differ by 0.0165 index points (2.5%); treat them as co-priority. The top-3 set is stable under equal, shade-heavy and access-heavy weights (see sensitivity). Shade deficits cluster in a narrow 0.50-0.65 band, so footfall and access drive most rank differences.", + "subweights": { + "footfall": { + "mean": 0.4, + "p95": 0.6 + }, + "shade": { + "buildings": 0.5, + "trees": 0.5, + "building_reference_share": 0.45, + "canopy_reference_share": 0.25 + }, + "access": { + "water": 0.35, + "bench": 0.2, + "toilet": 0.25, + "step_free": 0.2 + }, + "access_cap_m": 300.0, + "vulnerability": { + "indicator": "share of residents aged 65+", + "normalization": "raw 0-1 share" + } + }, + "assumptions": [ + "Catchment = 300 m Euclidean radius (~4 min walk at 75 m/min); not a network isochrone and does not model the Neckar, rail or major-road barriers.", + "Footfall score = 0.4 * min-max(mean) + 0.6 * min-max(p95); p95 is weighted higher because peak footfall coincides with peak heat. The API fields mean/p95 are treated as footfall per the brief; the endpoint does not document the metric, unit or interval.", + "Shade score = 0.5 * min(1, building footprint share of land / 0.45) + 0.5 * min(1, tree canopy share of land / 0.25); the 0.45 and 0.25 reference densities are planning heuristics, not measured shade. Building footprints use outer rings; inner courtyards are not subtracted.", + "Tree canopy = OSM tree points buffered by 5 m + tree rows buffered by 3 m + wood/forest polygons; no crown diameter or height data.", + "Shade deficit = 1 - shade score; buildings and trees are weighted equally because neither is a measured shadow simulation.", + "Access deficit = 0.35*water + 0.20*bench + 0.25*toilet + 0.20*step-free, each normalized as min(distance, 300 m)/300 m.", + "Step-free is the nearest OSM wheelchair=yes POI/entrance or official accessible toilet; a destination proxy, not a routed barrier-free path.", + "Vulnerability = raw 65+ share for Heilbronn Innenstadt (5,667/32,834 = 17.26%, 31.12.2016), already 0-1; constant across all eight catchments.", + "Gap index = 0.40*footfall + 0.30*shade_deficit + 0.20*access_deficit + 0.10*vulnerability; weights are deliberative, not empirically calibrated.", + "Public drinking water = OSM amenity=drinking_water + official Trinkwasserbrunnen; ornamental fountains, refill shops and seasonal water dispensers are excluded from the access score.", + "All scores are relative to the eight sensors only; min-max normalization means the lowest/highest sensor define 0/1." + ], + "sources": [ + { + "name": "Pulse sensor API", + "url": "https://api-pulse.noelsabia.dev/api/sensors", + "retrieved": "2026-11-14", + "license": "Not stated by the endpoint; treated as internal hackathon data. Confirm before production." + }, + { + "name": "OpenStreetMap via Overpass API", + "url": "https://overpass-api.de/", + "retrieved": "2026-11-14", + "license": "ODbL 1.0, © OpenStreetMap contributors." + }, + { + "name": "Stadt Heilbronn - Karte für heiße Tage (cool places, public toilets, drinking water)", + "url": "https://karten.heilbronn.de/heilbronn/index.php?service=kartefuerheissetage", + "retrieved": "2026-11-14", + "license": "Public city-map data; no explicit open-data licence found. Prototype use only; confirm permission before production." + }, + { + "name": "Stadt Heilbronn - Sozialdatenatlas 2017, 4. Fortschreibung", + "url": "https://www.heilbronn.de/fileadmin/daten/stadtheilbronn/formulare/leben/sozialdatenatlas/Sozialdatenatlas_Heilbronn_2017.pdf", + "retrieved": "2026-11-14", + "license": "© Stadt Heilbronn; public document. Data: Kommunales Melderegister, 31.12.2016." + }, + { + "name": "Nominatim / OpenStreetMap (geocoding checks and city boundary)", + "url": "https://nominatim.openstreetmap.org/", + "retrieved": "2026-11-14", + "license": "ODbL 1.0; geocoding used only for verification." + } + ], + "self_check": { + "catchment_count": 8, + "ranks": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "ranks_unique_1_to_8": true, + "finite_numbers": true, + "all_coordinates_inside_heilbronn": true, + "all_sensors_inside_kernstadt": true, + "geometry_closed": true, + "weights_sum": 1.0, + "max_pairwise_sensor_distance_m": 584.4, + "max_catchment_overlap_fraction": 0.878 + }, + "sensitivity": { + "top3_sensor_ids": [ + "hn-hagenbuchersee-02", + "hn-stadtgalerie-01", + "hn-neckarufer-01" + ], + "top3_stable": true, + "ranks_under_alternative_weights": { + "base_0.40_0.30_0.20_0.10": { + "hn-hagenbuchersee-02": 1, + "hn-stadtgalerie-01": 2, + "hn-neckarufer-01": 3, + "hn-hagenbuchersee-01": 4, + "hn-marahaus-01": 5, + "hn-soleo-01": 6, + "hn-goetzentuem-01": 7, + "density-01": 8 + }, + "equal_0.25_each": { + "hn-hagenbuchersee-02": 1, + "hn-stadtgalerie-01": 2, + "hn-neckarufer-01": 3, + "hn-hagenbuchersee-01": 4, + "hn-soleo-01": 5, + "hn-marahaus-01": 6, + "hn-goetzentuem-01": 7, + "density-01": 8 + }, + "shade_heavy_0.25_0.45_0.20_0.10": { + "hn-hagenbuchersee-02": 1, + "hn-neckarufer-01": 2, + "hn-stadtgalerie-01": 3, + "hn-hagenbuchersee-01": 4, + "hn-soleo-01": 5, + "hn-marahaus-01": 6, + "hn-goetzentuem-01": 7, + "density-01": 8 + }, + "access_heavy_0.30_0.25_0.35_0.10": { + "hn-hagenbuchersee-02": 1, + "hn-stadtgalerie-01": 2, + "hn-neckarufer-01": 3, + "hn-hagenbuchersee-01": 4, + "hn-soleo-01": 5, + "hn-marahaus-01": 6, + "hn-goetzentuem-01": 7, + "density-01": 8 + } + } + }, + "data_gaps": [ + "All eight sensor coordinates lie within ~585 m of each other; 300 m catchments overlap by up to ~88%, so ranks are relative and sensitive to small differences. All sensors are in the Innenstadt; there is no outer-district coverage.", + "Footfall mean/p95 are normalized only; the API does not state the metric, unit or aggregation interval.", + "OSM building footprints are not a measured shadow map: no building heights, street orientation or solar geometry are used.", + "OSM tree coverage is incomplete and has no crown diameter/height; a 5 m crown radius and 3 m tree-row half-width are assumptions.", + "Step-free access is proxied by distance to the nearest wheelchair=yes POI/entrance or official accessible toilet, not by a routed barrier-free path.", + "Vulnerability is a Stadtteil-level 2016 age share (Heilbronn Innenstadt), constant for all eight catchments; it does not vary at catchment scale.", + "Official cool-place, toilet and drinking-water layers are public city-map data; their licence is not an explicit open-data licence.", + "Sensor health: the API reports battery 0 for Götzenturm, 11 for Density 01 and Neckarufer, and 26-43 for three others; low readings may indicate gaps. The battery unit is not documented." + ] + }, + "catchments": [ + { + "rank": 1, + "sensor_id": "hn-hagenbuchersee-02", + "sensor_name": "Hagenbuchersee 2", + "center": { + "lat": 49.14391, + "lon": 9.21695 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.221063, + 49.143902 + ], + [ + 9.221045, + 49.144167 + ], + [ + 9.220987, + 49.144429 + ], + [ + 9.22089, + 49.144686 + ], + [ + 9.220755, + 49.144936 + ], + [ + 9.220583, + 49.145175 + ], + [ + 9.220377, + 49.145403 + ], + [ + 9.220137, + 49.145616 + ], + [ + 9.219867, + 49.145813 + ], + [ + 9.219569, + 49.145991 + ], + [ + 9.219245, + 49.146149 + ], + [ + 9.2189, + 49.146286 + ], + [ + 9.218535, + 49.1464 + ], + [ + 9.218155, + 49.14649 + ], + [ + 9.217764, + 49.146555 + ], + [ + 9.217365, + 49.146595 + ], + [ + 9.216962, + 49.146609 + ], + [ + 9.216559, + 49.146596 + ], + [ + 9.216159, + 49.146558 + ], + [ + 9.215767, + 49.146495 + ], + [ + 9.215387, + 49.146406 + ], + [ + 9.215021, + 49.146294 + ], + [ + 9.214674, + 49.146158 + ], + [ + 9.214349, + 49.146001 + ], + [ + 9.21405, + 49.145824 + ], + [ + 9.213778, + 49.145628 + ], + [ + 9.213536, + 49.145416 + ], + [ + 9.213328, + 49.145189 + ], + [ + 9.213154, + 49.14495 + ], + [ + 9.213017, + 49.144701 + ], + [ + 9.212918, + 49.144444 + ], + [ + 9.212858, + 49.144182 + ], + [ + 9.212837, + 49.143918 + ], + [ + 9.212855, + 49.143653 + ], + [ + 9.212913, + 49.143391 + ], + [ + 9.21301, + 49.143134 + ], + [ + 9.213145, + 49.142884 + ], + [ + 9.213317, + 49.142645 + ], + [ + 9.213523, + 49.142417 + ], + [ + 9.213763, + 49.142204 + ], + [ + 9.214033, + 49.142007 + ], + [ + 9.214331, + 49.141829 + ], + [ + 9.214655, + 49.14167 + ], + [ + 9.215001, + 49.141534 + ], + [ + 9.215365, + 49.14142 + ], + [ + 9.215745, + 49.14133 + ], + [ + 9.216136, + 49.141265 + ], + [ + 9.216535, + 49.141225 + ], + [ + 9.216938, + 49.141211 + ], + [ + 9.217341, + 49.141224 + ], + [ + 9.217741, + 49.141262 + ], + [ + 9.218133, + 49.141325 + ], + [ + 9.218513, + 49.141414 + ], + [ + 9.218879, + 49.141526 + ], + [ + 9.219225, + 49.141662 + ], + [ + 9.21955, + 49.141819 + ], + [ + 9.21985, + 49.141996 + ], + [ + 9.220122, + 49.142192 + ], + [ + 9.220364, + 49.142404 + ], + [ + 9.220572, + 49.142631 + ], + [ + 9.220746, + 49.14287 + ], + [ + 9.220883, + 49.143119 + ], + [ + 9.220982, + 49.143376 + ], + [ + 9.221042, + 49.143638 + ], + [ + 9.221063, + 49.143902 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-hagenbuchersee-01", + "distance_m": 57.6, + "overlap_fraction": 0.878 + }, + "inputs": { + "footfall": { + "mean": 19.3, + "p95": 64.4, + "battery": 27 + }, + "shade": { + "building_footprint_share_of_land": 0.3307, + "tree_canopy_share_of_land_proxy": 0.0178, + "water_share_of_catchment": 0.081, + "building_polygons": 341, + "mapped_tree_points": 41 + }, + "access": { + "nearest_public_drinking_water_m": 236.5, + "nearest_bench_m": 79.0, + "nearest_public_toilet_m": 144.2, + "nearest_step_free_anchor_m": 28.5, + "within_300m": { + "public_drinking_water": 1, + "benches": 12, + "public_toilets": 8, + "step_free_anchors": 65, + "official_cool_places": 6 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.8393, + "footfall_p95": 0.9286, + "shade_buildings": 0.7348, + "shade_canopy": 0.0712, + "access_water": 0.7883, + "access_bench": 0.2632, + "access_toilet": 0.4808, + "access_step_free": 0.095 + }, + "scores": { + "footfall": 0.8929, + "shade_deficit": 0.597, + "access_deficit": 0.4677, + "vulnerability": 0.1726, + "gap_index": 0.6471 + }, + "nearest_cool_place": { + "name": "experimenta Wasserspielplatz", + "category": "water_play", + "distance_m": 87.3 + }, + "reason": "All three components above the 8-sensor median, giving the highest weighted total (0.647): p95 64.4, canopy proxy 1.8%, water 236 m." + }, + { + "rank": 2, + "sensor_id": "hn-stadtgalerie-01", + "sensor_name": "Stadtgalerie", + "center": { + "lat": 49.140242, + "lon": 9.218699 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.222812, + 49.140234 + ], + [ + 9.222793, + 49.140499 + ], + [ + 9.222735, + 49.140761 + ], + [ + 9.222639, + 49.141018 + ], + [ + 9.222504, + 49.141267 + ], + [ + 9.222332, + 49.141507 + ], + [ + 9.222126, + 49.141735 + ], + [ + 9.221886, + 49.141948 + ], + [ + 9.221616, + 49.142145 + ], + [ + 9.221318, + 49.142323 + ], + [ + 9.220994, + 49.142481 + ], + [ + 9.220648, + 49.142618 + ], + [ + 9.220284, + 49.142732 + ], + [ + 9.219904, + 49.142822 + ], + [ + 9.219513, + 49.142887 + ], + [ + 9.219114, + 49.142927 + ], + [ + 9.218711, + 49.142941 + ], + [ + 9.218308, + 49.142928 + ], + [ + 9.217908, + 49.14289 + ], + [ + 9.217516, + 49.142827 + ], + [ + 9.217136, + 49.142738 + ], + [ + 9.21677, + 49.142626 + ], + [ + 9.216424, + 49.14249 + ], + [ + 9.216099, + 49.142333 + ], + [ + 9.215799, + 49.142156 + ], + [ + 9.215527, + 49.14196 + ], + [ + 9.215286, + 49.141748 + ], + [ + 9.215077, + 49.141521 + ], + [ + 9.214903, + 49.141282 + ], + [ + 9.214766, + 49.141033 + ], + [ + 9.214667, + 49.140776 + ], + [ + 9.214607, + 49.140514 + ], + [ + 9.214586, + 49.14025 + ], + [ + 9.214605, + 49.139985 + ], + [ + 9.214663, + 49.139723 + ], + [ + 9.21476, + 49.139466 + ], + [ + 9.214895, + 49.139216 + ], + [ + 9.215066, + 49.138977 + ], + [ + 9.215273, + 49.138749 + ], + [ + 9.215512, + 49.138536 + ], + [ + 9.215782, + 49.138339 + ], + [ + 9.216081, + 49.138161 + ], + [ + 9.216404, + 49.138003 + ], + [ + 9.21675, + 49.137866 + ], + [ + 9.217114, + 49.137752 + ], + [ + 9.217494, + 49.137662 + ], + [ + 9.217885, + 49.137597 + ], + [ + 9.218284, + 49.137557 + ], + [ + 9.218687, + 49.137543 + ], + [ + 9.21909, + 49.137556 + ], + [ + 9.21949, + 49.137594 + ], + [ + 9.219882, + 49.137657 + ], + [ + 9.220262, + 49.137746 + ], + [ + 9.220627, + 49.137858 + ], + [ + 9.220974, + 49.137994 + ], + [ + 9.221299, + 49.138151 + ], + [ + 9.221599, + 49.138328 + ], + [ + 9.221871, + 49.138524 + ], + [ + 9.222112, + 49.138736 + ], + [ + 9.222321, + 49.138963 + ], + [ + 9.222494, + 49.139202 + ], + [ + 9.222631, + 49.139451 + ], + [ + 9.222731, + 49.139708 + ], + [ + 9.222791, + 49.13997 + ], + [ + 9.222812, + 49.140234 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-marahaus-01", + "distance_m": 249.3, + "overlap_fraction": 0.487 + }, + "inputs": { + "footfall": { + "mean": 21.1, + "p95": 67.2, + "battery": 75 + }, + "shade": { + "building_footprint_share_of_land": 0.4237, + "tree_canopy_share_of_land_proxy": 0.0127, + "water_share_of_catchment": 0.0267, + "building_polygons": 330, + "mapped_tree_points": 46 + }, + "access": { + "nearest_public_drinking_water_m": 124.2, + "nearest_bench_m": 145.1, + "nearest_public_toilet_m": 71.6, + "nearest_step_free_anchor_m": 14.8, + "within_300m": { + "public_drinking_water": 2, + "benches": 16, + "public_toilets": 11, + "step_free_anchors": 94, + "official_cool_places": 12 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 1.0, + "footfall_p95": 1.0, + "shade_buildings": 0.9416, + "shade_canopy": 0.0508, + "access_water": 0.4141, + "access_bench": 0.4835, + "access_toilet": 0.2388, + "access_step_free": 0.0493 + }, + "scores": { + "footfall": 1.0, + "shade_deficit": 0.5038, + "access_deficit": 0.3112, + "vulnerability": 0.1726, + "gap_index": 0.6306 + }, + "nearest_cool_place": { + "name": "Otto Rettenmaier Haus - Haus der Stadtgeschichte", + "category": "indoor", + "distance_m": 73.8 + }, + "reason": "Highest peak footfall (p95 67.2); dense building shade (42%), water 124 m and toilet 72 m keep it at #2." + }, + { + "rank": 3, + "sensor_id": "hn-neckarufer-01", + "sensor_name": "Neckarufer", + "center": { + "lat": 49.143313, + "lon": 9.216612 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.220725, + 49.143305 + ], + [ + 9.220707, + 49.14357 + ], + [ + 9.220649, + 49.143832 + ], + [ + 9.220552, + 49.144089 + ], + [ + 9.220417, + 49.144339 + ], + [ + 9.220245, + 49.144578 + ], + [ + 9.220039, + 49.144806 + ], + [ + 9.219799, + 49.145019 + ], + [ + 9.219529, + 49.145216 + ], + [ + 9.219231, + 49.145394 + ], + [ + 9.218907, + 49.145552 + ], + [ + 9.218561, + 49.145689 + ], + [ + 9.218197, + 49.145803 + ], + [ + 9.217817, + 49.145893 + ], + [ + 9.217426, + 49.145958 + ], + [ + 9.217027, + 49.145998 + ], + [ + 9.216624, + 49.146012 + ], + [ + 9.216221, + 49.145999 + ], + [ + 9.215821, + 49.145961 + ], + [ + 9.215429, + 49.145898 + ], + [ + 9.215049, + 49.145809 + ], + [ + 9.214683, + 49.145697 + ], + [ + 9.214336, + 49.145561 + ], + [ + 9.214011, + 49.145404 + ], + [ + 9.213712, + 49.145227 + ], + [ + 9.21344, + 49.145031 + ], + [ + 9.213198, + 49.144819 + ], + [ + 9.21299, + 49.144592 + ], + [ + 9.212816, + 49.144353 + ], + [ + 9.212679, + 49.144104 + ], + [ + 9.21258, + 49.143847 + ], + [ + 9.21252, + 49.143585 + ], + [ + 9.212499, + 49.143321 + ], + [ + 9.212517, + 49.143056 + ], + [ + 9.212575, + 49.142794 + ], + [ + 9.212672, + 49.142537 + ], + [ + 9.212807, + 49.142287 + ], + [ + 9.212979, + 49.142048 + ], + [ + 9.213185, + 49.14182 + ], + [ + 9.213425, + 49.141607 + ], + [ + 9.213695, + 49.14141 + ], + [ + 9.213994, + 49.141232 + ], + [ + 9.214317, + 49.141073 + ], + [ + 9.214663, + 49.140937 + ], + [ + 9.215027, + 49.140823 + ], + [ + 9.215407, + 49.140733 + ], + [ + 9.215798, + 49.140668 + ], + [ + 9.216197, + 49.140628 + ], + [ + 9.2166, + 49.140614 + ], + [ + 9.217003, + 49.140627 + ], + [ + 9.217403, + 49.140665 + ], + [ + 9.217795, + 49.140728 + ], + [ + 9.218175, + 49.140817 + ], + [ + 9.218541, + 49.140929 + ], + [ + 9.218887, + 49.141065 + ], + [ + 9.219212, + 49.141222 + ], + [ + 9.219512, + 49.141399 + ], + [ + 9.219784, + 49.141595 + ], + [ + 9.220026, + 49.141807 + ], + [ + 9.220234, + 49.142034 + ], + [ + 9.220408, + 49.142273 + ], + [ + 9.220545, + 49.142522 + ], + [ + 9.220644, + 49.142779 + ], + [ + 9.220704, + 49.143041 + ], + [ + 9.220725, + 49.143305 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "density-01", + "distance_m": 63.0, + "overlap_fraction": 0.866 + }, + "inputs": { + "footfall": { + "mean": 19.2, + "p95": 61.6, + "battery": 11 + }, + "shade": { + "building_footprint_share_of_land": 0.3312, + "tree_canopy_share_of_land_proxy": 0.0253, + "water_share_of_catchment": 0.0894, + "building_polygons": 339, + "mapped_tree_points": 40 + }, + "access": { + "nearest_public_drinking_water_m": 208.1, + "nearest_bench_m": 10.7, + "nearest_public_toilet_m": 133.0, + "nearest_step_free_anchor_m": 33.4, + "within_300m": { + "public_drinking_water": 1, + "benches": 14, + "public_toilets": 9, + "step_free_anchors": 63, + "official_cool_places": 7 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.8304, + "footfall_p95": 0.8571, + "shade_buildings": 0.7361, + "shade_canopy": 0.1011, + "access_water": 0.6935, + "access_bench": 0.0358, + "access_toilet": 0.4434, + "access_step_free": 0.1112 + }, + "scores": { + "footfall": 0.8464, + "shade_deficit": 0.5814, + "access_deficit": 0.383, + "vulnerability": 0.1726, + "gap_index": 0.6069 + }, + "nearest_cool_place": { + "name": "experimenta Wasserspielplatz", + "category": "water_play", + "distance_m": 78.3 + }, + "reason": "High peak footfall (p95 61.6), canopy proxy 2.5% and public water 208 m." + }, + { + "rank": 4, + "sensor_id": "hn-hagenbuchersee-01", + "sensor_name": "Hagenbuchersee 1", + "center": { + "lat": 49.144402, + "lon": 9.217198 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.221311, + 49.144394 + ], + [ + 9.221293, + 49.144659 + ], + [ + 9.221235, + 49.144921 + ], + [ + 9.221138, + 49.145178 + ], + [ + 9.221003, + 49.145427 + ], + [ + 9.220831, + 49.145667 + ], + [ + 9.220625, + 49.145895 + ], + [ + 9.220385, + 49.146108 + ], + [ + 9.220115, + 49.146305 + ], + [ + 9.219817, + 49.146483 + ], + [ + 9.219493, + 49.146641 + ], + [ + 9.219148, + 49.146778 + ], + [ + 9.218783, + 49.146892 + ], + [ + 9.218403, + 49.146982 + ], + [ + 9.218012, + 49.147047 + ], + [ + 9.217613, + 49.147087 + ], + [ + 9.21721, + 49.147101 + ], + [ + 9.216807, + 49.147088 + ], + [ + 9.216407, + 49.14705 + ], + [ + 9.216015, + 49.146987 + ], + [ + 9.215635, + 49.146898 + ], + [ + 9.215269, + 49.146786 + ], + [ + 9.214922, + 49.14665 + ], + [ + 9.214597, + 49.146493 + ], + [ + 9.214298, + 49.146316 + ], + [ + 9.214026, + 49.14612 + ], + [ + 9.213784, + 49.145908 + ], + [ + 9.213576, + 49.145681 + ], + [ + 9.213402, + 49.145442 + ], + [ + 9.213265, + 49.145193 + ], + [ + 9.213166, + 49.144936 + ], + [ + 9.213105, + 49.144674 + ], + [ + 9.213085, + 49.14441 + ], + [ + 9.213103, + 49.144145 + ], + [ + 9.213161, + 49.143883 + ], + [ + 9.213258, + 49.143626 + ], + [ + 9.213393, + 49.143376 + ], + [ + 9.213565, + 49.143137 + ], + [ + 9.213771, + 49.142909 + ], + [ + 9.214011, + 49.142696 + ], + [ + 9.214281, + 49.142499 + ], + [ + 9.214579, + 49.142321 + ], + [ + 9.214903, + 49.142162 + ], + [ + 9.215249, + 49.142026 + ], + [ + 9.215613, + 49.141912 + ], + [ + 9.215993, + 49.141822 + ], + [ + 9.216384, + 49.141757 + ], + [ + 9.216783, + 49.141717 + ], + [ + 9.217186, + 49.141703 + ], + [ + 9.217589, + 49.141716 + ], + [ + 9.217989, + 49.141754 + ], + [ + 9.218381, + 49.141817 + ], + [ + 9.218761, + 49.141906 + ], + [ + 9.219127, + 49.142018 + ], + [ + 9.219473, + 49.142154 + ], + [ + 9.219798, + 49.142311 + ], + [ + 9.220098, + 49.142488 + ], + [ + 9.22037, + 49.142684 + ], + [ + 9.220612, + 49.142896 + ], + [ + 9.22082, + 49.143123 + ], + [ + 9.220994, + 49.143362 + ], + [ + 9.221131, + 49.143611 + ], + [ + 9.22123, + 49.143868 + ], + [ + 9.22129, + 49.14413 + ], + [ + 9.221311, + 49.144394 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-hagenbuchersee-02", + "distance_m": 57.6, + "overlap_fraction": 0.878 + }, + "inputs": { + "footfall": { + "mean": 13, + "p95": 49.7, + "battery": 43 + }, + "shade": { + "building_footprint_share_of_land": 0.3065, + "tree_canopy_share_of_land_proxy": 0.012, + "water_share_of_catchment": 0.0748, + "building_polygons": 324, + "mapped_tree_points": 38 + }, + "access": { + "nearest_public_drinking_water_m": 272.8, + "nearest_bench_m": 136.5, + "nearest_public_toilet_m": 162.4, + "nearest_step_free_anchor_m": 29.2, + "within_300m": { + "public_drinking_water": 1, + "benches": 8, + "public_toilets": 8, + "step_free_anchors": 51, + "official_cool_places": 5 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.2768, + "footfall_p95": 0.5536, + "shade_buildings": 0.6812, + "shade_canopy": 0.0479, + "access_water": 0.9095, + "access_bench": 0.455, + "access_toilet": 0.5413, + "access_step_free": 0.0973 + }, + "scores": { + "footfall": 0.4429, + "shade_deficit": 0.6355, + "access_deficit": 0.5641, + "vulnerability": 0.1726, + "gap_index": 0.4979 + }, + "nearest_cool_place": { + "name": "Wasserspielplatz am Platz am Bollwerksturm", + "category": "water_play", + "distance_m": 111.6 + }, + "reason": "Canopy proxy 1.2% and farthest toilet (162 m); p95 49.7." + }, + { + "rank": 5, + "sensor_id": "hn-marahaus-01", + "sensor_name": "Marahaus", + "center": { + "lat": 49.141541, + "lon": 9.215912 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.220025, + 49.141533 + ], + [ + 9.220007, + 49.141798 + ], + [ + 9.219949, + 49.14206 + ], + [ + 9.219852, + 49.142317 + ], + [ + 9.219717, + 49.142567 + ], + [ + 9.219545, + 49.142806 + ], + [ + 9.219339, + 49.143034 + ], + [ + 9.219099, + 49.143247 + ], + [ + 9.218829, + 49.143444 + ], + [ + 9.218531, + 49.143622 + ], + [ + 9.218207, + 49.143781 + ], + [ + 9.217861, + 49.143917 + ], + [ + 9.217497, + 49.144031 + ], + [ + 9.217117, + 49.144121 + ], + [ + 9.216726, + 49.144186 + ], + [ + 9.216327, + 49.144226 + ], + [ + 9.215924, + 49.14424 + ], + [ + 9.21552, + 49.144227 + ], + [ + 9.215121, + 49.144189 + ], + [ + 9.214729, + 49.144126 + ], + [ + 9.214349, + 49.144037 + ], + [ + 9.213983, + 49.143925 + ], + [ + 9.213636, + 49.143789 + ], + [ + 9.213312, + 49.143632 + ], + [ + 9.213012, + 49.143455 + ], + [ + 9.21274, + 49.143259 + ], + [ + 9.212498, + 49.143047 + ], + [ + 9.21229, + 49.14282 + ], + [ + 9.212116, + 49.142581 + ], + [ + 9.211979, + 49.142332 + ], + [ + 9.21188, + 49.142075 + ], + [ + 9.21182, + 49.141813 + ], + [ + 9.211799, + 49.141549 + ], + [ + 9.211817, + 49.141284 + ], + [ + 9.211876, + 49.141022 + ], + [ + 9.211973, + 49.140765 + ], + [ + 9.212107, + 49.140515 + ], + [ + 9.212279, + 49.140276 + ], + [ + 9.212486, + 49.140048 + ], + [ + 9.212725, + 49.139835 + ], + [ + 9.212995, + 49.139638 + ], + [ + 9.213294, + 49.13946 + ], + [ + 9.213617, + 49.139301 + ], + [ + 9.213963, + 49.139165 + ], + [ + 9.214327, + 49.139051 + ], + [ + 9.214707, + 49.138961 + ], + [ + 9.215098, + 49.138896 + ], + [ + 9.215497, + 49.138856 + ], + [ + 9.2159, + 49.138842 + ], + [ + 9.216303, + 49.138855 + ], + [ + 9.216703, + 49.138893 + ], + [ + 9.217095, + 49.138956 + ], + [ + 9.217475, + 49.139045 + ], + [ + 9.217841, + 49.139157 + ], + [ + 9.218187, + 49.139293 + ], + [ + 9.218512, + 49.13945 + ], + [ + 9.218812, + 49.139627 + ], + [ + 9.219084, + 49.139823 + ], + [ + 9.219325, + 49.140035 + ], + [ + 9.219534, + 49.140262 + ], + [ + 9.219708, + 49.140501 + ], + [ + 9.219845, + 49.14075 + ], + [ + 9.219944, + 49.141007 + ], + [ + 9.220004, + 49.141269 + ], + [ + 9.220025, + 49.141533 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-goetzentuem-01", + "distance_m": 193.6, + "overlap_fraction": 0.596 + }, + "inputs": { + "footfall": { + "mean": 13.7, + "p95": 38.5, + "battery": 87 + }, + "shade": { + "building_footprint_share_of_land": 0.3558, + "tree_canopy_share_of_land_proxy": 0.0465, + "water_share_of_catchment": 0.0888, + "building_polygons": 271, + "mapped_tree_points": 40 + }, + "access": { + "nearest_public_drinking_water_m": 233.6, + "nearest_bench_m": 23.3, + "nearest_public_toilet_m": 150.9, + "nearest_step_free_anchor_m": 23.0, + "within_300m": { + "public_drinking_water": 2, + "benches": 20, + "public_toilets": 7, + "step_free_anchors": 79, + "official_cool_places": 10 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.3393, + "footfall_p95": 0.2679, + "shade_buildings": 0.7907, + "shade_canopy": 0.1859, + "access_water": 0.7785, + "access_bench": 0.0776, + "access_toilet": 0.503, + "access_step_free": 0.0768 + }, + "scores": { + "footfall": 0.2964, + "shade_deficit": 0.5117, + "access_deficit": 0.4291, + "vulnerability": 0.1726, + "gap_index": 0.3752 + }, + "nearest_cool_place": { + "name": "Deutschordensmünster Sankt Peter und Paul", + "category": "indoor", + "distance_m": 113.4 + }, + "reason": "Mid footfall (p95 38.5) but 234 m to public water and canopy proxy 4.7%." + }, + { + "rank": 6, + "sensor_id": "hn-soleo-01", + "sensor_name": "Soleo", + "center": { + "lat": 49.144933, + "lon": 9.217393 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.221506, + 49.144925 + ], + [ + 9.221488, + 49.14519 + ], + [ + 9.22143, + 49.145452 + ], + [ + 9.221333, + 49.145709 + ], + [ + 9.221198, + 49.145958 + ], + [ + 9.221026, + 49.146198 + ], + [ + 9.22082, + 49.146426 + ], + [ + 9.22058, + 49.146639 + ], + [ + 9.22031, + 49.146836 + ], + [ + 9.220012, + 49.147014 + ], + [ + 9.219688, + 49.147172 + ], + [ + 9.219343, + 49.147309 + ], + [ + 9.218978, + 49.147423 + ], + [ + 9.218598, + 49.147513 + ], + [ + 9.218207, + 49.147578 + ], + [ + 9.217808, + 49.147618 + ], + [ + 9.217405, + 49.147632 + ], + [ + 9.217002, + 49.147619 + ], + [ + 9.216602, + 49.147581 + ], + [ + 9.21621, + 49.147518 + ], + [ + 9.21583, + 49.147429 + ], + [ + 9.215464, + 49.147317 + ], + [ + 9.215117, + 49.147181 + ], + [ + 9.214792, + 49.147024 + ], + [ + 9.214493, + 49.146847 + ], + [ + 9.214221, + 49.146651 + ], + [ + 9.213979, + 49.146439 + ], + [ + 9.213771, + 49.146212 + ], + [ + 9.213597, + 49.145973 + ], + [ + 9.21346, + 49.145724 + ], + [ + 9.213361, + 49.145467 + ], + [ + 9.2133, + 49.145205 + ], + [ + 9.213279, + 49.144941 + ], + [ + 9.213298, + 49.144676 + ], + [ + 9.213356, + 49.144414 + ], + [ + 9.213453, + 49.144157 + ], + [ + 9.213588, + 49.143907 + ], + [ + 9.21376, + 49.143668 + ], + [ + 9.213966, + 49.14344 + ], + [ + 9.214206, + 49.143227 + ], + [ + 9.214476, + 49.14303 + ], + [ + 9.214774, + 49.142852 + ], + [ + 9.215098, + 49.142693 + ], + [ + 9.215444, + 49.142557 + ], + [ + 9.215808, + 49.142443 + ], + [ + 9.216188, + 49.142353 + ], + [ + 9.216579, + 49.142288 + ], + [ + 9.216978, + 49.142248 + ], + [ + 9.217381, + 49.142234 + ], + [ + 9.217784, + 49.142247 + ], + [ + 9.218184, + 49.142285 + ], + [ + 9.218576, + 49.142348 + ], + [ + 9.218956, + 49.142437 + ], + [ + 9.219322, + 49.142549 + ], + [ + 9.219668, + 49.142685 + ], + [ + 9.219993, + 49.142842 + ], + [ + 9.220293, + 49.143019 + ], + [ + 9.220565, + 49.143215 + ], + [ + 9.220807, + 49.143427 + ], + [ + 9.221015, + 49.143654 + ], + [ + 9.221189, + 49.143893 + ], + [ + 9.221326, + 49.144142 + ], + [ + 9.221425, + 49.144399 + ], + [ + 9.221486, + 49.144661 + ], + [ + 9.221506, + 49.144925 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-hagenbuchersee-01", + "distance_m": 60.7, + "overlap_fraction": 0.871 + }, + "inputs": { + "footfall": { + "mean": 10.6, + "p95": 28, + "battery": 26 + }, + "shade": { + "building_footprint_share_of_land": 0.2998, + "tree_canopy_share_of_land_proxy": 0.008, + "water_share_of_catchment": 0.0715, + "building_polygons": 297, + "mapped_tree_points": 30 + }, + "access": { + "nearest_public_drinking_water_m": 321.0, + "nearest_bench_m": 197.2, + "nearest_public_toilet_m": 105.9, + "nearest_step_free_anchor_m": 51.5, + "within_300m": { + "public_drinking_water": 0, + "benches": 4, + "public_toilets": 6, + "step_free_anchors": 40, + "official_cool_places": 6 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.0625, + "footfall_p95": 0.0, + "shade_buildings": 0.6663, + "shade_canopy": 0.0321, + "access_water": 1, + "access_bench": 0.6573, + "access_toilet": 0.353, + "access_step_free": 0.1716 + }, + "scores": { + "footfall": 0.025, + "shade_deficit": 0.6508, + "access_deficit": 0.604, + "vulnerability": 0.1726, + "gap_index": 0.3433 + }, + "nearest_cool_place": { + "name": "Wasserspielplatz am Platz am Bollwerksturm", + "category": "water_play", + "distance_m": 51.1 + }, + "reason": "Lowest canopy proxy (0.8%) and no public water within 300 m (321 m); p95 28.0." + }, + { + "rank": 7, + "sensor_id": "hn-goetzentuem-01", + "sensor_name": "Götzenturm", + "center": { + "lat": 49.139958, + "lon": 9.214804 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.218917, + 49.13995 + ], + [ + 9.218898, + 49.140215 + ], + [ + 9.21884, + 49.140477 + ], + [ + 9.218743, + 49.140734 + ], + [ + 9.218609, + 49.140984 + ], + [ + 9.218437, + 49.141223 + ], + [ + 9.21823, + 49.141451 + ], + [ + 9.217991, + 49.141664 + ], + [ + 9.217721, + 49.141861 + ], + [ + 9.217422, + 49.142039 + ], + [ + 9.217099, + 49.142198 + ], + [ + 9.216753, + 49.142334 + ], + [ + 9.216389, + 49.142448 + ], + [ + 9.216009, + 49.142538 + ], + [ + 9.215618, + 49.142603 + ], + [ + 9.215219, + 49.142643 + ], + [ + 9.214816, + 49.142657 + ], + [ + 9.214412, + 49.142644 + ], + [ + 9.214013, + 49.142606 + ], + [ + 9.213621, + 49.142543 + ], + [ + 9.213241, + 49.142454 + ], + [ + 9.212875, + 49.142342 + ], + [ + 9.212528, + 49.142206 + ], + [ + 9.212204, + 49.142049 + ], + [ + 9.211904, + 49.141872 + ], + [ + 9.211632, + 49.141676 + ], + [ + 9.21139, + 49.141464 + ], + [ + 9.211182, + 49.141237 + ], + [ + 9.211008, + 49.140998 + ], + [ + 9.210871, + 49.140749 + ], + [ + 9.210772, + 49.140492 + ], + [ + 9.210712, + 49.14023 + ], + [ + 9.210691, + 49.139966 + ], + [ + 9.21071, + 49.139701 + ], + [ + 9.210768, + 49.139439 + ], + [ + 9.210865, + 49.139182 + ], + [ + 9.211, + 49.138932 + ], + [ + 9.211171, + 49.138693 + ], + [ + 9.211378, + 49.138465 + ], + [ + 9.211617, + 49.138252 + ], + [ + 9.211887, + 49.138055 + ], + [ + 9.212186, + 49.137877 + ], + [ + 9.212509, + 49.137718 + ], + [ + 9.212855, + 49.137582 + ], + [ + 9.213219, + 49.137468 + ], + [ + 9.213599, + 49.137378 + ], + [ + 9.21399, + 49.137313 + ], + [ + 9.214389, + 49.137273 + ], + [ + 9.214792, + 49.137259 + ], + [ + 9.215196, + 49.137272 + ], + [ + 9.215595, + 49.13731 + ], + [ + 9.215987, + 49.137373 + ], + [ + 9.216367, + 49.137462 + ], + [ + 9.216733, + 49.137574 + ], + [ + 9.217079, + 49.13771 + ], + [ + 9.217404, + 49.137867 + ], + [ + 9.217704, + 49.138044 + ], + [ + 9.217976, + 49.13824 + ], + [ + 9.218217, + 49.138452 + ], + [ + 9.218426, + 49.138679 + ], + [ + 9.218599, + 49.138918 + ], + [ + 9.218737, + 49.139167 + ], + [ + 9.218836, + 49.139424 + ], + [ + 9.218896, + 49.139686 + ], + [ + 9.218917, + 49.13995 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-marahaus-01", + "distance_m": 193.6, + "overlap_fraction": 0.596 + }, + "inputs": { + "footfall": { + "mean": 11.1, + "p95": 29.4, + "battery": 0 + }, + "shade": { + "building_footprint_share_of_land": 0.3367, + "tree_canopy_share_of_land_proxy": 0.0628, + "water_share_of_catchment": 0.0918, + "building_polygons": 299, + "mapped_tree_points": 11 + }, + "access": { + "nearest_public_drinking_water_m": 370.2, + "nearest_bench_m": 36.5, + "nearest_public_toilet_m": 133.7, + "nearest_step_free_anchor_m": 21.5, + "within_300m": { + "public_drinking_water": 0, + "benches": 27, + "public_toilets": 3, + "step_free_anchors": 45, + "official_cool_places": 5 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.1071, + "footfall_p95": 0.0357, + "shade_buildings": 0.7481, + "shade_canopy": 0.2512, + "access_water": 1, + "access_bench": 0.1218, + "access_toilet": 0.4456, + "access_step_free": 0.0717 + }, + "scores": { + "footfall": 0.0643, + "shade_deficit": 0.5004, + "access_deficit": 0.5001, + "vulnerability": 0.1726, + "gap_index": 0.2931 + }, + "nearest_cool_place": { + "name": "Gänsebrunnen", + "category": "fountain", + "distance_m": 135.6 + }, + "reason": "Farthest public water (370 m) and low footfall (p95 29.4); lower overall gap." + }, + { + "rank": 8, + "sensor_id": "density-01", + "sensor_name": "Density 01", + "center": { + "lat": 49.143404, + "lon": 9.217465 + }, + "radius_m": 300.0, + "area_m2": 282743.3, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 9.221578, + 49.143396 + ], + [ + 9.22156, + 49.143661 + ], + [ + 9.221502, + 49.143923 + ], + [ + 9.221405, + 49.14418 + ], + [ + 9.22127, + 49.144429 + ], + [ + 9.221098, + 49.144669 + ], + [ + 9.220892, + 49.144897 + ], + [ + 9.220652, + 49.14511 + ], + [ + 9.220382, + 49.145307 + ], + [ + 9.220084, + 49.145485 + ], + [ + 9.21976, + 49.145643 + ], + [ + 9.219415, + 49.14578 + ], + [ + 9.21905, + 49.145894 + ], + [ + 9.21867, + 49.145984 + ], + [ + 9.218279, + 49.146049 + ], + [ + 9.21788, + 49.146089 + ], + [ + 9.217477, + 49.146103 + ], + [ + 9.217074, + 49.14609 + ], + [ + 9.216674, + 49.146052 + ], + [ + 9.216282, + 49.145989 + ], + [ + 9.215902, + 49.1459 + ], + [ + 9.215536, + 49.145788 + ], + [ + 9.215189, + 49.145652 + ], + [ + 9.214865, + 49.145495 + ], + [ + 9.214565, + 49.145318 + ], + [ + 9.214293, + 49.145122 + ], + [ + 9.214051, + 49.14491 + ], + [ + 9.213843, + 49.144683 + ], + [ + 9.213669, + 49.144444 + ], + [ + 9.213532, + 49.144195 + ], + [ + 9.213433, + 49.143938 + ], + [ + 9.213373, + 49.143676 + ], + [ + 9.213352, + 49.143412 + ], + [ + 9.21337, + 49.143147 + ], + [ + 9.213428, + 49.142885 + ], + [ + 9.213525, + 49.142628 + ], + [ + 9.21366, + 49.142378 + ], + [ + 9.213832, + 49.142139 + ], + [ + 9.214038, + 49.141911 + ], + [ + 9.214278, + 49.141698 + ], + [ + 9.214548, + 49.141501 + ], + [ + 9.214846, + 49.141323 + ], + [ + 9.21517, + 49.141164 + ], + [ + 9.215516, + 49.141028 + ], + [ + 9.21588, + 49.140914 + ], + [ + 9.21626, + 49.140824 + ], + [ + 9.216651, + 49.140759 + ], + [ + 9.21705, + 49.140719 + ], + [ + 9.217453, + 49.140705 + ], + [ + 9.217856, + 49.140718 + ], + [ + 9.218256, + 49.140756 + ], + [ + 9.218648, + 49.140819 + ], + [ + 9.219028, + 49.140908 + ], + [ + 9.219394, + 49.14102 + ], + [ + 9.21974, + 49.141156 + ], + [ + 9.220065, + 49.141313 + ], + [ + 9.220365, + 49.14149 + ], + [ + 9.220637, + 49.141686 + ], + [ + 9.220878, + 49.141898 + ], + [ + 9.221087, + 49.142125 + ], + [ + 9.221261, + 49.142364 + ], + [ + 9.221398, + 49.142613 + ], + [ + 9.221497, + 49.14287 + ], + [ + 9.221557, + 49.143132 + ], + [ + 9.221578, + 49.143396 + ] + ] + ] + }, + "max_overlap_with": { + "sensor_id": "hn-neckarufer-01", + "distance_m": 63.0, + "overlap_fraction": 0.866 + }, + "inputs": { + "footfall": { + "mean": 9.9, + "p95": 28, + "battery": 11 + }, + "shade": { + "building_footprint_share_of_land": 0.35, + "tree_canopy_share_of_land_proxy": 0.0226, + "water_share_of_catchment": 0.0772, + "building_polygons": 413, + "mapped_tree_points": 50 + }, + "access": { + "nearest_public_drinking_water_m": 169.1, + "nearest_bench_m": 61.4, + "nearest_public_toilet_m": 162.0, + "nearest_step_free_anchor_m": 32.8, + "within_300m": { + "public_drinking_water": 2, + "benches": 11, + "public_toilets": 9, + "step_free_anchors": 74, + "official_cool_places": 10 + } + }, + "vulnerability": { + "district": "Heilbronn Innenstadt", + "age_65plus_share": 0.1726, + "age_65plus_count": 5667, + "district_population": 32834, + "reference_date": "2016-12-31" + } + }, + "normalized_inputs": { + "footfall_mean": 0.0, + "footfall_p95": 0.0, + "shade_buildings": 0.7778, + "shade_canopy": 0.0903, + "access_water": 0.5636, + "access_bench": 0.2046, + "access_toilet": 0.5398, + "access_step_free": 0.1093 + }, + "scores": { + "footfall": 0.0, + "shade_deficit": 0.5659, + "access_deficit": 0.395, + "vulnerability": 0.1726, + "gap_index": 0.266 + }, + "nearest_cool_place": { + "name": "Rathaus", + "category": "indoor", + "distance_m": 110.3 + }, + "reason": "Lowest normalized footfall (mean 9.9, p95 28.0), but toilet 162 m and canopy proxy 2.3%; lowest gap." + } + ], + "official_cool_places": [ + { + "name": "Rathaus", + "category": "indoor", + "lat": 49.1425991547852, + "lon": 9.21834969714596, + "distance_to_cluster_center_m": 107.7, + "within_1km": true + }, + { + "name": "experimenta Wasserspielplatz", + "category": "water_play", + "lat": 49.14375540247779, + "lon": 9.21577702358692, + "distance_to_cluster_center_m": 140.9, + "within_1km": true + }, + { + "name": "Deutschordensmünster Sankt Peter und Paul", + "category": "indoor", + "lat": 49.14130556087422, + "lon": 9.21742539182902, + "distance_to_cluster_center_m": 161.5, + "within_1km": true + }, + { + "name": "Brunnen im Kulturzentrum Deutschhof", + "category": "fountain", + "lat": 49.14072936888626, + "lon": 9.21768337304178, + "distance_to_cluster_center_m": 228.2, + "within_1km": true + }, + { + "name": "Siebenröhrenbrunnen", + "category": "fountain", + "lat": 49.14153557453579, + "lon": 9.21946931367244, + "distance_to_cluster_center_m": 229.4, + "within_1km": true + }, + { + "name": "Experimenta-Platz - experimenta Science Center Heilbronn", + "category": "outdoor", + "lat": 49.14406369591456, + "lon": 9.21446205430462, + "distance_to_cluster_center_m": 231.2, + "within_1km": true + }, + { + "name": "Otto Rettenmaier Haus - Haus der Stadtgeschichte", + "category": "indoor", + "lat": 49.14073771750873, + "lon": 9.21802617517849, + "distance_to_cluster_center_m": 234.9, + "within_1km": true + }, + { + "name": "Museum im Deutschhof", + "category": "indoor", + "lat": 49.14049592945036, + "lon": 9.21744927119546, + "distance_to_cluster_center_m": 250.0, + "within_1km": true + }, + { + "name": "Komödiantenbrunnen", + "category": "fountain", + "lat": 49.14121132552234, + "lon": 9.21968725393484, + "distance_to_cluster_center_m": 263.8, + "within_1km": true + }, + { + "name": "Sankt-Georg-Brunnen", + "category": "fountain", + "lat": 49.14301724172003, + "lon": 9.22081955935025, + "distance_to_cluster_center_m": 288.6, + "within_1km": true + }, + { + "name": "Wasserspielplatz am Platz am Bollwerksturm", + "category": "water_play", + "lat": 49.14538938774436, + "lon": 9.21747068283507, + "distance_to_cluster_center_m": 300.7, + "within_1km": true + }, + { + "name": "Gänsebrunnen", + "category": "fountain", + "lat": 49.13931952413135, + "lon": 9.21638843679565, + "distance_to_cluster_center_m": 379.0, + "within_1km": true + }, + { + "name": "Fleiner-Tor-Brunnen", + "category": "fountain", + "lat": 49.13955733087171, + "lon": 9.21907669034463, + "distance_to_cluster_center_m": 385.6, + "within_1km": true + }, + { + "name": "Evangelische Nikolaikirche", + "category": "indoor", + "lat": 49.14487856520481, + "lon": 9.22119804763804, + "distance_to_cluster_center_m": 395.8, + "within_1km": true + }, + { + "name": "Traumbrunnen", + "category": "fountain", + "lat": 49.14488606066576, + "lon": 9.22197965176833, + "distance_to_cluster_center_m": 442.8, + "within_1km": true + }, + { + "name": "Kunsthalle Vogelmann", + "category": "indoor", + "lat": 49.14301297250946, + "lon": 9.2230407630596, + "distance_to_cluster_center_m": 449.4, + "within_1km": true + }, + { + "name": "Stadtbibliothek Heilbronn Hauptstelle", + "category": "indoor", + "lat": 49.14579671798093, + "lon": 9.22087304606035, + "distance_to_cluster_center_m": 449.4, + "within_1km": true + }, + { + "name": "Campuspark", + "category": "outdoor", + "lat": 49.14655682487415, + "lon": 9.21370492916764, + "distance_to_cluster_center_m": 485.8, + "within_1km": true + }, + { + "name": "Theaterbrunnen", + "category": "fountain", + "lat": 49.1455605515828, + "lon": 9.22206493637395, + "distance_to_cluster_center_m": 492.5, + "within_1km": true + }, + { + "name": "Brunnen am Wollhaus", + "category": "fountain", + "lat": 49.13845880631427, + "lon": 9.21964766844006, + "distance_to_cluster_center_m": 514.1, + "within_1km": true + }, + { + "name": "Klimawäldchen, Wollhaus", + "category": "outdoor", + "lat": 49.1386817028232, + "lon": 9.22069061765984, + "distance_to_cluster_center_m": 527.1, + "within_1km": true + }, + { + "name": "Brunnen im Stadtgarten", + "category": "fountain", + "lat": 49.14219075431955, + "lon": 9.224915483498, + "distance_to_cluster_center_m": 587.5, + "within_1km": true + }, + { + "name": "Technisches Rathaus", + "category": "indoor", + "lat": 49.13778321634032, + "lon": 9.22013823623883, + "distance_to_cluster_center_m": 597.2, + "within_1km": true + }, + { + "name": "Stadtgarten", + "category": "outdoor", + "lat": 49.14195636815172, + "lon": 9.22517493104022, + "distance_to_cluster_center_m": 609.3, + "within_1km": true + }, + { + "name": "Platanenallee am Neckar", + "category": "water_play", + "lat": 49.13768993189176, + "lon": 9.21230953759516, + "distance_to_cluster_center_m": 650.0, + "within_1km": true + }, + { + "name": "Neckaruferpark", + "category": "water_play", + "lat": 49.1472101821135, + "lon": 9.2106087348249, + "distance_to_cluster_center_m": 676.8, + "within_1km": true + }, + { + "name": "Bibliothek LIV, Bildungscampus", + "category": "indoor", + "lat": 49.1495379831247, + "lon": 9.21655635236998, + "distance_to_cluster_center_m": 759.3, + "within_1km": true + }, + { + "name": "Friedensplatz", + "category": "outdoor", + "lat": 49.14108889593923, + "lon": 9.22717276617474, + "distance_to_cluster_center_m": 770.3, + "within_1km": true + }, + { + "name": "Aufbaugilde - Tagesstätte Gildetreff Unterstützungszentrum UWi26", + "category": "indoor", + "lat": 49.13571681667342, + "lon": 9.21879928930203, + "distance_to_cluster_center_m": 790.4, + "within_1km": true + }, + { + "name": "Neckarbogen Wasserspielplatz am Floßhafen", + "category": "water_play", + "lat": 49.14726808538256, + "lon": 9.20844241731317, + "distance_to_cluster_center_m": 795.7, + "within_1km": true + }, + { + "name": "Alter Friedhof Heilbronn", + "category": "outdoor", + "lat": 49.14443380482175, + "lon": 9.2278736383603, + "distance_to_cluster_center_m": 822.3, + "within_1km": true + }, + { + "name": "Hafenpark", + "category": "outdoor", + "lat": 49.14546562555619, + "lon": 9.20530853770429, + "distance_to_cluster_center_m": 895.6, + "within_1km": true + }, + { + "name": "Klimawäldchen, Theresienwiese", + "category": "outdoor", + "lat": 49.14046918230771, + "lon": 9.20247723597257, + "distance_to_cluster_center_m": 1076.9, + "within_1km": false + }, + { + "name": "Spielplatz Neckarbogen Flossfahrt am Karlssee", + "category": "water_play", + "lat": 49.15039129021142, + "lon": 9.20744073642936, + "distance_to_cluster_center_m": 1095.6, + "within_1km": false + }, + { + "name": "Sandstrand in der Kaffeebucht", + "category": "water_play", + "lat": 49.13349805076366, + "lon": 9.20737023915083, + "distance_to_cluster_center_m": 1236.3, + "within_1km": false + }, + { + "name": "Freibad Neckarhalde", + "category": "water_play", + "lat": 49.13182946675112, + "lon": 9.20481356094017, + "distance_to_cluster_center_m": 1495.0, + "within_1km": false + }, + { + "name": "Wohlgelegen Beachvolleyballfeld", + "category": "water_play", + "lat": 49.15581867674177, + "lon": 9.21065894411872, + "distance_to_cluster_center_m": 1525.9, + "within_1km": false + }, + { + "name": "Botanischer Obstgarten", + "category": "outdoor", + "lat": 49.15095851718215, + "lon": 9.23532253557208, + "distance_to_cluster_center_m": 1624.9, + "within_1km": false + }, + { + "name": "Hauptfriedhof Heilbronn", + "category": "outdoor", + "lat": 49.13564543493324, + "lon": 9.23674434367716, + "distance_to_cluster_center_m": 1645.0, + "within_1km": false + }, + { + "name": "Brunnen im Pfühlpark", + "category": "fountain", + "lat": 49.14253782388717, + "lon": 9.24017753234523, + "distance_to_cluster_center_m": 1694.9, + "within_1km": false + }, + { + "name": "Freibad Gesundbrunnen", + "category": "water_play", + "lat": 49.15367209676534, + "lon": 9.19863621087601, + "distance_to_cluster_center_m": 1801.5, + "within_1km": false + }, + { + "name": "Wertwiesenpark", + "category": "outdoor", + "lat": 49.1293990183059, + "lon": 9.20065017870902, + "distance_to_cluster_center_m": 1893.6, + "within_1km": false + }, + { + "name": "Cäcilienbrunnen", + "category": "fountain", + "lat": 49.12811908727198, + "lon": 9.23091038548492, + "distance_to_cluster_center_m": 1917.1, + "within_1km": false + }, + { + "name": "Alter Friedhof Böckingen", + "category": "outdoor", + "lat": 49.13399805924609, + "lon": 9.19399257314967, + "distance_to_cluster_center_m": 1926.4, + "within_1km": false + }, + { + "name": "Pfühlpark", + "category": "outdoor", + "lat": 49.14091206489226, + "lon": 9.24332313112695, + "distance_to_cluster_center_m": 1934.0, + "within_1km": false + }, + { + "name": "Stadtteilbibliothek Heilbronn-Böckingen", + "category": "indoor", + "lat": 49.1333692584063, + "lon": 9.19346919319574, + "distance_to_cluster_center_m": 1994.9, + "within_1km": false + }, + { + "name": "Seeräuberbrunnen", + "category": "fountain", + "lat": 49.13358549132585, + "lon": 9.1932644049654, + "distance_to_cluster_center_m": 1995.3, + "within_1km": false + }, + { + "name": "Friedhof Böckingen", + "category": "outdoor", + "lat": 49.14535090342638, + "lon": 9.18816819747418, + "distance_to_cluster_center_m": 2108.9, + "within_1km": false + }, + { + "name": "Pfühlsee im Pfühlpark", + "category": "water_play", + "lat": 49.14030412267714, + "lon": 9.24580175668466, + "distance_to_cluster_center_m": 2120.9, + "within_1km": false + }, + { + "name": "Trappensee", + "category": "water_play", + "lat": 49.13932778687367, + "lon": 9.25221331998755, + "distance_to_cluster_center_m": 2597.8, + "within_1km": false + }, + { + "name": "Literaturhaus Heilbronn", + "category": "indoor", + "lat": 49.1390103394182, + "lon": 9.25340449237228, + "distance_to_cluster_center_m": 2688.7, + "within_1km": false + }, + { + "name": "Ziegeleisee im Ziegeleipark mit Wasserspielplatz", + "category": "water_play", + "lat": 49.13405662314948, + "lon": 9.18005097597423, + "distance_to_cluster_center_m": 2846.8, + "within_1km": false + }, + { + "name": "Südfriedhof Sontheim", + "category": "outdoor", + "lat": 49.11642096580824, + "lon": 9.20443492295586, + "distance_to_cluster_center_m": 3060.5, + "within_1km": false + }, + { + "name": "Ziegeleipark", + "category": "outdoor", + "lat": 49.13238802278145, + "lon": 9.17711135356539, + "distance_to_cluster_center_m": 3112.5, + "within_1km": false + }, + { + "name": "Saureiterbrunnen", + "category": "fountain", + "lat": 49.1201678037141, + "lon": 9.19117022673934, + "distance_to_cluster_center_m": 3127.8, + "within_1km": false + }, + { + "name": "Linsafamerbrunnen", + "category": "fountain", + "lat": 49.16815593613366, + "lon": 9.19788477202241, + "distance_to_cluster_center_m": 3148.3, + "within_1km": false + }, + { + "name": "Spielplatz Corell'sche Insel am Leinbach", + "category": "water_play", + "lat": 49.16768227388094, + "lon": 9.19607210064945, + "distance_to_cluster_center_m": 3162.0, + "within_1km": false + }, + { + "name": "Spielplatz Fischerheim", + "category": "water_play", + "lat": 49.12030515321624, + "lon": 9.1897043211041, + "distance_to_cluster_center_m": 3180.8, + "within_1km": false + }, + { + "name": "Naturschutzgebiet Köpfertal am Pfühlbach und Köpferstausee", + "category": "water_play", + "lat": 49.12814921675653, + "lon": 9.25506253242099, + "distance_to_cluster_center_m": 3215.5, + "within_1km": false + }, + { + "name": "Alter Friedhof Sontheim", + "category": "outdoor", + "lat": 49.1183570663938, + "lon": 9.19276668818006, + "distance_to_cluster_center_m": 3226.8, + "within_1km": false + }, + { + "name": "Leinbachpark", + "category": "outdoor", + "lat": 49.16418392202549, + "lon": 9.18464566804962, + "distance_to_cluster_center_m": 3345.9, + "within_1km": false + }, + { + "name": "Nordfriedhof Neckargartach", + "category": "outdoor", + "lat": 49.17088859693312, + "lon": 9.19900689767329, + "distance_to_cluster_center_m": 3391.9, + "within_1km": false + }, + { + "name": "Köpferbrunnen", + "category": "fountain", + "lat": 49.12015991296825, + "lon": 9.25158161679454, + "distance_to_cluster_center_m": 3558.6, + "within_1km": false + }, + { + "name": "Spielplatz Im Ried am Leinbach", + "category": "water_play", + "lat": 49.16002436008074, + "lon": 9.17548167120215, + "distance_to_cluster_center_m": 3573.5, + "within_1km": false + }, + { + "name": "Stadtwald", + "category": "outdoor", + "lat": 49.12185190921814, + "lon": 9.25529063904551, + "distance_to_cluster_center_m": 3631.9, + "within_1km": false + }, + { + "name": "Westfriedhof Böckingen", + "category": "outdoor", + "lat": 49.12833912395278, + "lon": 9.16563771361902, + "distance_to_cluster_center_m": 4056.1, + "within_1km": false + }, + { + "name": "Friedhof Frankenbach", + "category": "outdoor", + "lat": 49.15970344730802, + "lon": 9.16745676398041, + "distance_to_cluster_center_m": 4060.7, + "within_1km": false + }, + { + "name": "Waldheide", + "category": "outdoor", + "lat": 49.13012125236032, + "lon": 9.27381107692672, + "distance_to_cluster_center_m": 4372.1, + "within_1km": false + }, + { + "name": "Angelsee an der Schozach", + "category": "water_play", + "lat": 49.11217261164032, + "lon": 9.17884814160317, + "distance_to_cluster_center_m": 4380.6, + "within_1km": false + }, + { + "name": "Friedhof Horkheim", + "category": "outdoor", + "lat": 49.11482210093325, + "lon": 9.16969004237733, + "distance_to_cluster_center_m": 4626.8, + "within_1km": false + }, + { + "name": "Dachreiterbrunnen", + "category": "fountain", + "lat": 49.1161745526548, + "lon": 9.16754315190474, + "distance_to_cluster_center_m": 4646.9, + "within_1km": false + }, + { + "name": "Fährbrunnen", + "category": "fountain", + "lat": 49.11894719203219, + "lon": 9.15975456808514, + "distance_to_cluster_center_m": 4925.3, + "within_1km": false + }, + { + "name": "Friedhof Klingenberg", + "category": "outdoor", + "lat": 49.11957413582798, + "lon": 9.15516547988664, + "distance_to_cluster_center_m": 5175.1, + "within_1km": false + }, + { + "name": "Alter Friedhof Biberach", + "category": "outdoor", + "lat": 49.19249521447728, + "lon": 9.14472916290674, + "distance_to_cluster_center_m": 7626.2, + "within_1km": false + }, + { + "name": "Stadtteilbibliothek Heilbronn-Biberach", + "category": "indoor", + "lat": 49.19313601690018, + "lon": 9.14301539603718, + "distance_to_cluster_center_m": 7763.7, + "within_1km": false + }, + { + "name": "Freibad Kirchhausen", + "category": "water_play", + "lat": 49.18123226629113, + "lon": 9.12205535121715, + "distance_to_cluster_center_m": 8117.0, + "within_1km": false + }, + { + "name": "Friedhof Biberach", + "category": "outdoor", + "lat": 49.19892872297578, + "lon": 9.14323799807704, + "distance_to_cluster_center_m": 8230.2, + "within_1km": false + }, + { + "name": "Friedhof Kirchhausen", + "category": "outdoor", + "lat": 49.18175489792748, + "lon": 9.11230033686784, + "distance_to_cluster_center_m": 8756.2, + "within_1km": false + }, + { + "name": "Nepomukbrunnen", + "category": "fountain", + "lat": 49.18480631824264, + "lon": 9.11022137883412, + "distance_to_cluster_center_m": 9058.1, + "within_1km": false + }, + { + "name": "Seebuckel", + "category": "outdoor", + "lat": 49.20338132505518, + "lon": 9.1195839163704, + "distance_to_cluster_center_m": 9774.3, + "within_1km": false + }, + { + "name": "Stöckach", + "category": "outdoor", + "lat": 49.19373014769187, + "lon": 9.06106363137264, + "distance_to_cluster_center_m": 12669.4, + "within_1km": false + } + ] +} diff --git a/public/cool-city/route.json b/public/cool-city/route.json new file mode 100644 index 0000000..3bf66ba --- /dev/null +++ b/public/cool-city/route.json @@ -0,0 +1,952 @@ +{ + "status": "ready", + "generatedAt": "2026-08-14", + "hotDay": { + "date": "2026-08-14", + "temperature_max_c": 35, + "temperature_min_c": 18.2, + "precipitation_mm": 0, + "sunshine_hours": 13.9, + "cloud_cover_pct": { + "10:00": 0, + "12:00": 0, + "14:00": 0, + "16:00": 0 + }, + "source": "Open-Meteo historical archive, 49.1423 N 9.2187 E, Europe/Berlin" + }, + "label": "Modeled shade on the 2026-08-14 hot day (35°C, clear sky).", + "shadeLabel": "modeled shade, not measured", + "origin": { + "name": "Stadtgalerie", + "note": "Stadtgalerie (OSM-tagged main entrance, east side)", + "lat": 49.140269, + "lon": 9.218444 + }, + "destination": { + "name": "Marktplatz", + "lat": 49.142318, + "lon": 9.218659 + }, + "times": [ + "10:00", + "12:00", + "14:00", + "16:00" + ], + "routes": [ + { + "id": "shortest", + "label": "Shortest", + "longName": "Shortest", + "description": "Direct via Fleiner Straße, Kirchbrunnenstraße and Windgasse.", + "fullDescription": "Direct route via Fleiner Straße, Kirchbrunnenstraße and Windgasse.", + "values": { + "10:00": { + "shadePct": 61.6, + "directSunMin": 1.8, + "distanceM": 359.5, + "durationMin": 4.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 8, + "rampInclinePct": 15 + }, + "12:00": { + "shadePct": 46.6, + "directSunMin": 2.6, + "distanceM": 359.5, + "durationMin": 4.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 8, + "rampInclinePct": 15 + }, + "14:00": { + "shadePct": 27.4, + "directSunMin": 3.5, + "distanceM": 359.5, + "durationMin": 4.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 8, + "rampInclinePct": 15 + }, + "16:00": { + "shadePct": 43.8, + "directSunMin": 2.7, + "distanceM": 359.5, + "durationMin": 4.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 8, + "rampInclinePct": 15 + } + }, + "ramp": { + "incline": "15.0%", + "location": "Marktplatz tram crossing", + "wheelchair": "yes" + }, + "accessibilityNotes": [ + "Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.", + "The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.", + "The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.", + "The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel." + ], + "geometry": [ + [ + 9.218444, + 49.140269 + ], + [ + 9.218519, + 49.140295 + ], + [ + 9.21863, + 49.140235 + ], + [ + 9.218708, + 49.140241 + ], + [ + 9.218776, + 49.140433 + ], + [ + 9.218928, + 49.140615 + ], + [ + 9.219171, + 49.140903 + ], + [ + 9.219365, + 49.141179 + ], + [ + 9.219399, + 49.141228 + ], + [ + 9.219422, + 49.141249 + ], + [ + 9.219685, + 49.141379 + ], + [ + 9.219485, + 49.14145 + ], + [ + 9.219432, + 49.14146 + ], + [ + 9.21907, + 49.141483 + ], + [ + 9.218977, + 49.141489 + ], + [ + 9.218891, + 49.141495 + ], + [ + 9.218896, + 49.141614 + ], + [ + 9.218894, + 49.141628 + ], + [ + 9.21889, + 49.14164 + ], + [ + 9.218876, + 49.141673 + ], + [ + 9.218874, + 49.141683 + ], + [ + 9.218873, + 49.141694 + ], + [ + 9.218882, + 49.141756 + ], + [ + 9.218926, + 49.141883 + ], + [ + 9.218973, + 49.141936 + ], + [ + 9.218975, + 49.141945 + ], + [ + 9.218977, + 49.141953 + ], + [ + 9.218981, + 49.141969 + ], + [ + 9.218984, + 49.141979 + ], + [ + 9.218986, + 49.14199 + ], + [ + 9.21899, + 49.142005 + ], + [ + 9.219019, + 49.14205 + ], + [ + 9.219065, + 49.142364 + ], + [ + 9.218659, + 49.142318 + ] + ] + }, + { + "id": "shaded", + "label": "Shaded", + "longName": "Shaded via Deutschhof & Kiliansplatz", + "description": "Via the shaded passage, the Deutschhof courtyard and Kiliansplatz.", + "fullDescription": "Detour via the shaded passage at the Deutschhof, the Deutschhof courtyard (Taubenbrunnen) and Kiliansplatz.", + "values": { + "10:00": { + "shadePct": 61.5, + "directSunMin": 3.8, + "distanceM": 732.3, + "durationMin": 9.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 9, + "rampInclinePct": 15 + }, + "12:00": { + "shadePct": 54.1, + "directSunMin": 4.5, + "distanceM": 732.3, + "durationMin": 9.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 9, + "rampInclinePct": 15 + }, + "14:00": { + "shadePct": 42.6, + "directSunMin": 5.6, + "distanceM": 732.3, + "durationMin": 9.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 9, + "rampInclinePct": 15 + }, + "16:00": { + "shadePct": 50, + "directSunMin": 4.9, + "distanceM": 732.3, + "durationMin": 9.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 9, + "rampInclinePct": 15 + } + }, + "ramp": { + "incline": "15.0%", + "location": "Marktplatz tram crossing", + "wheelchair": "yes" + }, + "accessibilityNotes": [ + "Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.", + "The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.", + "The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.", + "The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel." + ], + "geometry": [ + [ + 9.218444, + 49.140269 + ], + [ + 9.218519, + 49.140295 + ], + [ + 9.21863, + 49.140235 + ], + [ + 9.218708, + 49.140241 + ], + [ + 9.218776, + 49.140433 + ], + [ + 9.218928, + 49.140615 + ], + [ + 9.219171, + 49.140903 + ], + [ + 9.219082, + 49.140927 + ], + [ + 9.218896, + 49.140978 + ], + [ + 9.21888, + 49.140984 + ], + [ + 9.218863, + 49.140991 + ], + [ + 9.218808, + 49.141022 + ], + [ + 9.218788, + 49.14103 + ], + [ + 9.218766, + 49.141036 + ], + [ + 9.218451, + 49.141096 + ], + [ + 9.218408, + 49.140996 + ], + [ + 9.218403, + 49.14098 + ], + [ + 9.218315, + 49.141 + ], + [ + 9.218078, + 49.141029 + ], + [ + 9.218044, + 49.141031 + ], + [ + 9.217998, + 49.141033 + ], + [ + 9.217824, + 49.14104 + ], + [ + 9.217795, + 49.141042 + ], + [ + 9.217769, + 49.141051 + ], + [ + 9.217747, + 49.14104 + ], + [ + 9.21773, + 49.141035 + ], + [ + 9.217711, + 49.141032 + ], + [ + 9.217675, + 49.141027 + ], + [ + 9.217651, + 49.141021 + ], + [ + 9.217642, + 49.141015 + ], + [ + 9.217633, + 49.141009 + ], + [ + 9.217626, + 49.141 + ], + [ + 9.217599, + 49.140959 + ], + [ + 9.217584, + 49.140939 + ], + [ + 9.217576, + 49.14093 + ], + [ + 9.217569, + 49.140923 + ], + [ + 9.217564, + 49.140915 + ], + [ + 9.217561, + 49.140907 + ], + [ + 9.217541, + 49.140834 + ], + [ + 9.217536, + 49.140819 + ], + [ + 9.217534, + 49.140806 + ], + [ + 9.217534, + 49.140793 + ], + [ + 9.21756, + 49.140668 + ], + [ + 9.217534, + 49.140793 + ], + [ + 9.217534, + 49.140806 + ], + [ + 9.217536, + 49.140819 + ], + [ + 9.217541, + 49.140834 + ], + [ + 9.217561, + 49.140907 + ], + [ + 9.217564, + 49.140915 + ], + [ + 9.217569, + 49.140923 + ], + [ + 9.217576, + 49.14093 + ], + [ + 9.217584, + 49.140939 + ], + [ + 9.217599, + 49.140959 + ], + [ + 9.217626, + 49.141 + ], + [ + 9.217633, + 49.141009 + ], + [ + 9.217642, + 49.141015 + ], + [ + 9.217651, + 49.141021 + ], + [ + 9.217675, + 49.141027 + ], + [ + 9.217711, + 49.141032 + ], + [ + 9.21773, + 49.141035 + ], + [ + 9.217747, + 49.14104 + ], + [ + 9.217769, + 49.141051 + ], + [ + 9.217795, + 49.141042 + ], + [ + 9.217824, + 49.14104 + ], + [ + 9.217998, + 49.141033 + ], + [ + 9.218044, + 49.141031 + ], + [ + 9.218078, + 49.141029 + ], + [ + 9.218315, + 49.141 + ], + [ + 9.218403, + 49.14098 + ], + [ + 9.218408, + 49.140996 + ], + [ + 9.218451, + 49.141096 + ], + [ + 9.218766, + 49.141036 + ], + [ + 9.218788, + 49.14103 + ], + [ + 9.218808, + 49.141022 + ], + [ + 9.218863, + 49.140991 + ], + [ + 9.21888, + 49.140984 + ], + [ + 9.218896, + 49.140978 + ], + [ + 9.219082, + 49.140927 + ], + [ + 9.219171, + 49.140903 + ], + [ + 9.219365, + 49.141179 + ], + [ + 9.219399, + 49.141228 + ], + [ + 9.219422, + 49.141249 + ], + [ + 9.219685, + 49.141379 + ], + [ + 9.219914, + 49.141492 + ], + [ + 9.220133, + 49.14176 + ], + [ + 9.220158, + 49.141805 + ], + [ + 9.220171, + 49.141829 + ], + [ + 9.220105, + 49.141838 + ], + [ + 9.219952, + 49.141856 + ], + [ + 9.21981, + 49.141873 + ], + [ + 9.218981, + 49.141969 + ], + [ + 9.218984, + 49.141979 + ], + [ + 9.218986, + 49.14199 + ], + [ + 9.21899, + 49.142005 + ], + [ + 9.219019, + 49.14205 + ], + [ + 9.219065, + 49.142364 + ], + [ + 9.218659, + 49.142318 + ] + ] + }, + { + "id": "accessible", + "label": "Accessible", + "longName": "Step-free with water & benches", + "description": "Step-free with water and benches, via Fleiner Straße and Sülmerstraße.", + "fullDescription": "Step-free route via Fleiner Straße, Sülmerstraße and Falkenstraße, entering Marktplatz from the north to avoid the 15% tram-crossing ramp.", + "values": { + "10:00": { + "shadePct": 67.4, + "directSunMin": 1.9, + "distanceM": 438.2, + "durationMin": 5.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 6, + "rampInclinePct": null + }, + "12:00": { + "shadePct": 55.1, + "directSunMin": 2.6, + "distanceM": 438.2, + "durationMin": 5.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 6, + "rampInclinePct": null + }, + "14:00": { + "shadePct": 30.3, + "directSunMin": 4, + "distanceM": 438.2, + "durationMin": 5.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 6, + "rampInclinePct": null + }, + "16:00": { + "shadePct": 43.8, + "directSunMin": 3.3, + "distanceM": 438.2, + "durationMin": 5.8, + "stepFree": true, + "waterStops": 2, + "benchStops": 6, + "rampInclinePct": null + } + }, + "ramp": null, + "accessibilityNotes": [ + "Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.", + "The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.", + "The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.", + "The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel." + ], + "geometry": [ + [ + 9.218444, + 49.140269 + ], + [ + 9.218519, + 49.140295 + ], + [ + 9.21863, + 49.140235 + ], + [ + 9.218708, + 49.140241 + ], + [ + 9.218776, + 49.140433 + ], + [ + 9.218928, + 49.140615 + ], + [ + 9.219171, + 49.140903 + ], + [ + 9.219365, + 49.141179 + ], + [ + 9.219399, + 49.141228 + ], + [ + 9.219422, + 49.141249 + ], + [ + 9.219685, + 49.141379 + ], + [ + 9.219914, + 49.141492 + ], + [ + 9.220133, + 49.14176 + ], + [ + 9.220158, + 49.141805 + ], + [ + 9.220171, + 49.141829 + ], + [ + 9.220176, + 49.141838 + ], + [ + 9.220212, + 49.141921 + ], + [ + 9.220309, + 49.142145 + ], + [ + 9.220393, + 49.142357 + ], + [ + 9.220161, + 49.142396 + ], + [ + 9.220084, + 49.142408 + ], + [ + 9.219981, + 49.142423 + ], + [ + 9.219843, + 49.142446 + ], + [ + 9.219601, + 49.14249 + ], + [ + 9.219389, + 49.142528 + ], + [ + 9.219329, + 49.142538 + ], + [ + 9.219255, + 49.142545 + ], + [ + 9.219199, + 49.142543 + ], + [ + 9.219139, + 49.142531 + ], + [ + 9.219094, + 49.1425 + ], + [ + 9.219079, + 49.142458 + ], + [ + 9.219065, + 49.142364 + ], + [ + 9.218659, + 49.142318 + ] + ] + } + ], + "recommendationByTime": { + "10:00": "shortest", + "12:00": "shortest", + "14:00": "accessible", + "16:00": "accessible" + }, + "modelLabel": "Accessible for Ruth", + "water": [ + { + "name": "Drinking water fountain (Kiliansplatz)", + "lat": 49.141237, + "lon": 9.219556, + "wheelchair": null, + "nearRoutesM": { + "shortest": 7, + "shaded": 7, + "accessible": 7 + } + }, + { + "name": "Trinkwasser am Marktplatz", + "lat": 49.1422, + "lon": 9.218956, + "wheelchair": "yes", + "nearRoutesM": { + "shortest": 6.1, + "shaded": 6.1, + "accessible": 16.6 + } + } + ], + "meta": { + "city": "Heilbronn", + "hotDay": { + "date": "2026-08-14", + "temperature_max_c": 35, + "temperature_min_c": 18.2, + "precipitation_mm": 0, + "sunshine_hours": 13.9, + "cloud_cover_pct": { + "10:00": 0, + "12:00": 0, + "14:00": 0, + "16:00": 0 + }, + "source": "Open-Meteo historical archive, 49.1423 N 9.2187 E, Europe/Berlin" + }, + "shadeLabel": "modeled shade, not measured", + "method": "NOAA solar position + 2D building-footprint shadow sweep + tree-canopy shadow discs; 5 m route sampling.", + "solarPositions": { + "10:00": { + "altitude_deg": 35.3, + "azimuth_deg": 110.8 + }, + "12:00": { + "altitude_deg": 50.8, + "azimuth_deg": 145 + }, + "14:00": { + "altitude_deg": 54.5, + "azimuth_deg": 193.5 + }, + "16:00": { + "altitude_deg": 43.3, + "azimuth_deg": 235.1 + } + }, + "dataGaps": [ + "Building heights: 445 of 854 main footprints have no height or building:levels in OSM; type-based defaults are used.", + "Tree heights are modeled from cadastre crown diameters, not measured.", + "Shade is clear-sky geometric shade; cloud cover is reported but not applied to direct_sun_min.", + "OSM is crowd-sourced; completeness of benches, water and kerb tags is not guaranteed." + ], + "walkingSpeedMps": 1.25 + } +} \ No newline at end of file diff --git a/public/fonts/archivo-latin-var.woff2 b/public/fonts/archivo-latin-var.woff2 new file mode 100644 index 0000000..e2448d0 Binary files /dev/null and b/public/fonts/archivo-latin-var.woff2 differ diff --git a/public/logo.svg b/public/logo.svg index e4ac442..e2ab2e1 100644 --- a/public/logo.svg +++ b/public/logo.svg @@ -1,4 +1,7 @@ - - + + + + + diff --git a/server/api/cool/reset.post.ts b/server/api/cool/reset.post.ts new file mode 100644 index 0000000..e17a0e2 --- /dev/null +++ b/server/api/cool/reset.post.ts @@ -0,0 +1,17 @@ +import { isCoolRound } from '../../../shared/cool' +import { getCoolVoteTally, resetCoolRound } from '../../utils/cool-votes' + +interface ResetBody { + round?: unknown +} + +export default defineEventHandler(async (event) => { + setHeader(event, 'cache-control', 'no-store') + const body = await readBody(event) + const round = body?.round ?? 'preselection' + if (!isCoolRound(round)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' }) + } + const state = resetCoolRound(round) + return { state, tally: getCoolVoteTally(round) } +}) diff --git a/server/api/cool/state.get.ts b/server/api/cool/state.get.ts new file mode 100644 index 0000000..813db95 --- /dev/null +++ b/server/api/cool/state.get.ts @@ -0,0 +1,12 @@ +import { getCoolState } from '../../utils/cool-votes' +import { isCoolRound } from '../../../shared/cool' + +export default defineEventHandler((event) => { + setHeader(event, 'cache-control', 'no-store') + const query = getQuery(event) + const round = query.round === undefined ? 'preselection' : query.round + if (!isCoolRound(round)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' }) + } + return getCoolState(round) +}) diff --git a/server/api/cool/state.post.ts b/server/api/cool/state.post.ts new file mode 100644 index 0000000..1c67dfd --- /dev/null +++ b/server/api/cool/state.post.ts @@ -0,0 +1,38 @@ +import { isCoolRouteId, isCoolRound, isCoolScene, isCoolTime } from '../../../shared/cool' +import { updateCoolState } from '../../utils/cool-votes' + +interface StateBody { + round?: unknown + time?: unknown + selectedRoute?: unknown + scene?: unknown + voteOpen?: unknown +} + +export default defineEventHandler(async (event) => { + setHeader(event, 'cache-control', 'no-store') + const body = await readBody(event) + const round = body?.round ?? 'preselection' + if (!isCoolRound(round)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' }) + } + if (body.time !== undefined && !isCoolTime(body.time)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid time. Expected 10:00 | 12:00 | 14:00 | 16:00.' }) + } + if (body.selectedRoute !== undefined && !isCoolRouteId(body.selectedRoute)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid route.' }) + } + if (body.scene !== undefined && !isCoolScene(body.scene)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid scene.' }) + } + if (body.voteOpen !== undefined && typeof body.voteOpen !== 'boolean') { + throw createError({ statusCode: 400, statusMessage: 'voteOpen must be a boolean.' }) + } + + return updateCoolState(round, { + ...(isCoolTime(body.time) ? { time: body.time } : {}), + ...(isCoolRouteId(body.selectedRoute) ? { selectedRoute: body.selectedRoute } : {}), + ...(isCoolScene(body.scene) ? { scene: body.scene } : {}), + ...(typeof body.voteOpen === 'boolean' ? { voteOpen: body.voteOpen } : {}), + }) +}) diff --git a/server/api/cool/vote.get.ts b/server/api/cool/vote.get.ts new file mode 100644 index 0000000..e53ee44 --- /dev/null +++ b/server/api/cool/vote.get.ts @@ -0,0 +1,12 @@ +import { isCoolRound } from '../../../shared/cool' +import { getCoolVoteTally } from '../../utils/cool-votes' + +export default defineEventHandler((event) => { + setHeader(event, 'cache-control', 'no-store') + const query = getQuery(event) + const round = query.round === undefined ? 'preselection' : query.round + if (!isCoolRound(round)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' }) + } + return getCoolVoteTally(round) +}) diff --git a/server/api/cool/vote.post.ts b/server/api/cool/vote.post.ts new file mode 100644 index 0000000..9c59ff1 --- /dev/null +++ b/server/api/cool/vote.post.ts @@ -0,0 +1,41 @@ +import { isCoolRouteId, isCoolRound } from '../../../shared/cool' +import { getCoolState, isValidCoolSessionId, recordCoolVote } from '../../utils/cool-votes' + +interface VoteBody { + route?: unknown + sessionId?: unknown + round?: unknown +} + +export default defineEventHandler(async (event) => { + setHeader(event, 'cache-control', 'no-store') + const body = await readBody(event) + const round = body?.round ?? 'preselection' + + if (!isCoolRound(round)) { + throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' }) + } + if (!isCoolRouteId(body?.route)) { + throw createError({ + statusCode: 400, + statusMessage: 'Invalid route. Expected shortest | shaded | accessible.', + }) + } + if (!isValidCoolSessionId(body?.sessionId)) { + throw createError({ + statusCode: 400, + statusMessage: 'Invalid session. Expected an anonymous 8–80 character ID.', + }) + } + if (!getCoolState(round).voteOpen) { + throw createError({ statusCode: 409, statusMessage: 'Voting is not open.' }) + } + + const result = recordCoolVote(round, body.route, body.sessionId) + setResponseStatus(event, result.duplicate ? 200 : 201) + return { + yourRoute: result.route, + duplicate: result.duplicate, + tally: result.tally, + } +}) diff --git a/server/api/stream.get.ts b/server/api/stream.get.ts index ab4dc80..768424d 100644 --- a/server/api/stream.get.ts +++ b/server/api/stream.get.ts @@ -1,12 +1,8 @@ import { apiBaseUrl, isMockMode } from '../utils/api' /** - * Same-origin SSE proxy. The browser never talks to Go directly, so the - * Cloudflare/K8s CORS surface stays closed and the stream can be cached or - * authenticated at one edge only. - * - * h3's proxyRequest pipes response chunks as they arrive (it does not await - * the full body), which preserves the 15 s heartbeat and `retry: 3000`. + * Same-origin SSE proxy: the browser talks only to Nitro, so CORS stays closed. + * proxyRequest forwards chunks as they arrive, preserving heartbeats and retry hints. */ export default defineEventHandler(async (event) => { if (isMockMode() || process.env.NUXT_DISABLE_SSE === '1') { diff --git a/server/api/train.post.ts b/server/api/train.post.ts index 0725f49..716311a 100644 --- a/server/api/train.post.ts +++ b/server/api/train.post.ts @@ -35,8 +35,7 @@ export default defineEventHandler(async (event) => { } } - // Stream the multipart CSV to Go unchanged. The control credentials are - // attached by the Nitro process and never reach the browser bundle. + // Forward the raw multipart CSV to Go; control credentials stay in this process. const contentType = getRequestHeader(event, 'content-type') ?? '' if (!contentType) { throw createError({ diff --git a/server/middleware/control-auth.ts b/server/middleware/control-auth.ts index 2160b51..5f2bbb6 100644 --- a/server/middleware/control-auth.ts +++ b/server/middleware/control-auth.ts @@ -39,10 +39,8 @@ function isProtected(event: import('h3').H3Event): boolean { } /** - * Presenter-only control surface. Basic auth is checked in Nitro; on success - * an HMAC cookie (signed with CONTROL_PASS) lets the page POST /api/scenario - * without re-prompting. The browser never receives the Go credentials, and - * /stage, /live and all public GETs stay open. + * Presenter control: Basic auth at Nitro, then an HMAC cookie (signed with + * CONTROL_PASS) lets /control POST without re-prompting. Public GETs stay open. */ export default defineEventHandler((event) => { if (!isProtected(event)) return diff --git a/server/utils/api.ts b/server/utils/api.ts index ef66820..c15087d 100644 --- a/server/utils/api.ts +++ b/server/utils/api.ts @@ -1,6 +1,5 @@ -// Server-side Go API client. Every Nitro route uses this module so the browser -// only ever talks to the Nuxt origin: the Go base URL and the control -// credentials stay in the Node process. +// Server-side Go API client. Nitro routes use it so the browser only talks to +// this origin and control credentials stay in the Node process. interface ApiErrorEnvelope { error?: { code?: string; message?: string } @@ -39,7 +38,7 @@ export function apiBaseUrl(): string { ).replace(/\/+$/, '') } -/** True only when NUXT_USE_MOCK=1 / NUXT_PUBLIC_USE_MOCK=1 is set. */ +/** Mock mode is opt-in via NUXT_USE_MOCK or NUXT_PUBLIC_USE_MOCK (1/true). */ export function isMockMode(): boolean { const config = useRuntimeConfig() const raw = @@ -54,8 +53,7 @@ function controlAuthorization(): string | undefined { if (user && pass) return `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}` const token = envValue('CONTROL_TOKEN', 'NUXT_CONTROL_TOKEN') || String(config.controlToken ?? '') - // Go currently validates Basic auth; Bearer is accepted here for the future - // token-based control surface without exposing the token to the browser. + // Go requires Basic today; Bearer is a fallback for a future token-based API. if (token) return `Bearer ${token}` return undefined } @@ -121,10 +119,7 @@ export async function apiRequest(path: string, options: ApiRequestOptions = { return response._data as T } -/** - * Forward a request body (training upload) and preserve Go's status code and - * JSON body, including 202/400/409/502 responses that are part of the flow. - */ +/** Forward a training upload and keep Go's status code for 202/4xx/5xx. */ export async function apiForward( event: import('h3').H3Event, path: string, diff --git a/server/utils/cool-votes.ts b/server/utils/cool-votes.ts new file mode 100644 index 0000000..dba4577 --- /dev/null +++ b/server/utils/cool-votes.ts @@ -0,0 +1,121 @@ +import { isCoolRouteId, isCoolScene, isCoolTime } from '../../shared/cool' +import type { + CoolDemoState, + CoolRouteId, + CoolRound, + CoolVoteCounts, + CoolVoteTally, +} from '../../shared/cool' + +type StatePatch = Partial> + +const states = new Map() +const votes = new Map>() +const counts = new Map() +let updatedAt = new Map() + +function blankState(round: CoolRound): CoolDemoState { + return { + round, + time: '10:00', + selectedRoute: 'shortest', + scene: 'ruth', + voteOpen: false, + updatedAt: new Date().toISOString(), + } +} + +function ensureVotes(round: CoolRound): Map { + let map = votes.get(round) + if (!map) { + map = new Map() + votes.set(round, map) + } + return map +} + +function ensureCounts(round: CoolRound): CoolVoteCounts { + let value = counts.get(round) + if (!value) { + value = { shortest: 0, shaded: 0, accessible: 0 } + counts.set(round, value) + } + return value +} + +export function getCoolState(round: CoolRound): CoolDemoState { + let state = states.get(round) + if (!state) { + state = blankState(round) + states.set(round, state) + } + return { ...state } +} + +export function updateCoolState(round: CoolRound, patch: StatePatch): CoolDemoState { + const current = getCoolState(round) + const next: CoolDemoState = { + ...current, + ...(isCoolTime(patch.time) ? { time: patch.time } : {}), + ...(isCoolRouteId(patch.selectedRoute) ? { selectedRoute: patch.selectedRoute } : {}), + ...(isCoolScene(patch.scene) ? { scene: patch.scene } : {}), + ...(typeof patch.voteOpen === 'boolean' ? { voteOpen: patch.voteOpen } : {}), + updatedAt: new Date().toISOString(), + } + states.set(round, next) + return { ...next } +} + +export function resetCoolRound(round: CoolRound): CoolDemoState { + const next = blankState(round) + states.set(round, next) + votes.set(round, new Map()) + counts.set(round, { shortest: 0, shaded: 0, accessible: 0 }) + updatedAt = new Map([...updatedAt].filter(([key]) => key !== round)) + return { ...next } +} + +export function getCoolVoteTally(round: CoolRound): CoolVoteTally { + return { + round, + counts: { ...ensureCounts(round) }, + total: ensureVotes(round).size, + updatedAt: updatedAt.get(round) ?? null, + } +} + +export function recordCoolVote( + round: CoolRound, + route: CoolRouteId, + sessionId: string, +): { duplicate: boolean; route: CoolRouteId; tally: CoolVoteTally } { + const state = getCoolState(round) + if (!state.voteOpen) { + throw new Error('Voting is not open') + } + + const roundVotes = ensureVotes(round) + const existing = roundVotes.get(sessionId) + if (existing) { + return { duplicate: true, route: existing, tally: getCoolVoteTally(round) } + } + + if (!isCoolRouteId(route)) throw new Error(`Invalid route: ${route}`) + roundVotes.set(sessionId, route) + const current = ensureCounts(round) + counts.set(round, { ...current, [route]: current[route] + 1 }) + updatedAt.set(round, new Date().toISOString()) + return { duplicate: false, route, tally: getCoolVoteTally(round) } +} + +export function isValidCoolSessionId(value: unknown): value is string { + return typeof value === 'string' && /^[A-Za-z0-9_-]{8,80}$/.test(value) +} + +/** Test helper only. */ +export function resetCoolDemoStore(): void { + states.clear() + votes.clear() + counts.clear() + updatedAt = new Map() +} diff --git a/server/utils/mock-data.ts b/server/utils/mock-data.ts index 1f99922..2a7e752 100644 --- a/server/utils/mock-data.ts +++ b/server/utils/mock-data.ts @@ -1,6 +1,5 @@ -// Server-side mock dataset. Shapes follow /home/noel/Documents/Hackathon_2026/CONTRACT.md. -// The files are imported (not read from disk at runtime) so the Nitro build bundles them -// into the SSR output and the app renders before the Go API exists. +// Server-side mock dataset. Shapes follow the Go API contract; files are imported +// so Nitro bundles them and mock mode renders without the Go API. import context from '../../mock/context.json' import demo from '../../mock/demo.json' import meta from '../../mock/meta.json' diff --git a/server/utils/train-jobs.ts b/server/utils/train-jobs.ts index c67f5fe..1845712 100644 --- a/server/utils/train-jobs.ts +++ b/server/utils/train-jobs.ts @@ -18,8 +18,7 @@ export function createMockTrainJob(model: 'small' | 'forecast', filename: string const now = new Date().toISOString() const job: MockTrainJob = { job_id: `mock-${Date.now().toString(36)}`, - // The mock completes immediately. Replace this with polling of GET /api/train/{job_id} - // once the Go/FastAPI service exists. + // The mock completes immediately; the real path polls GET /api/train/{job_id}. status: 'succeeded', model, started_at: now, diff --git a/shared/cool.ts b/shared/cool.ts new file mode 100644 index 0000000..ed37a9d --- /dev/null +++ b/shared/cool.ts @@ -0,0 +1,260 @@ +export const COOL_ROUTE_IDS = ['shortest', 'shaded', 'accessible'] as const +export type CoolRouteId = (typeof COOL_ROUTE_IDS)[number] + +export const COOL_TIMES = ['10:00', '12:00', '14:00', '16:00'] as const +export type CoolTime = (typeof COOL_TIMES)[number] + +export const COOL_ROUNDS = ['preselection', 'final'] as const +export type CoolRound = (typeof COOL_ROUNDS)[number] + +export const COOL_SCENES = ['ruth', 'places', 'routes', 'vote', 'locked', 'coda'] as const +export type CoolScene = (typeof COOL_SCENES)[number] + +export const COOL_ROUTE_LABELS: Record = { + shortest: 'Shortest', + shaded: 'Shaded', + accessible: 'Accessible', +} + +export const COOL_ROUTE_DESCRIPTIONS: Record = { + shortest: 'Direct via Fleiner Straße.', + shaded: 'Via the shaded passage and Kiliansplatz.', + accessible: 'Step-free, with water and benches.', +} + +export const COOL_MODEL_LABEL = 'Accessible for Ruth' +export const COOL_COMPOSITE_LABEL = 'Composite persona — illustrative, not a real person' +export const COOL_CLOSING_LINE = + 'The pulse is not the people. But the city still has to protect them.' + +export interface CoolRouteValues { + shadePct: number + directSunMin: number + distanceM: number + durationMin: number + stepFree: boolean + waterStops: number + benchStops: number + rampInclinePct: number | null +} + +export interface CoolRouteOption { + id: CoolRouteId + label: string + longName: string + description: string + fullDescription: string + values: Record + ramp: { incline: string; location: string; wheelchair: string | null } | null + accessibilityNotes: string[] + geometry: Array<[number, number]> +} + +export interface CoolPoint { + name: string + lat: number + lon: number + wheelchair?: string | null + nearRoutesM?: Record +} + +export interface CoolRouteBundle { + status: 'ready' | 'pending' + generatedAt: string + hotDay: { + date: string + temperature_max_c: number + temperature_min_c: number + precipitation_mm: number + sunshine_hours: number + source: string + } | null + label: string + shadeLabel: string + origin: { name: string; note?: string; lat?: number; lon?: number } + destination: { name: string; note?: string; lat?: number; lon?: number } + times: CoolTime[] + routes: CoolRouteOption[] + recommendationByTime: Record + modelLabel: string + water: CoolPoint[] + meta: { + city: string + shadeLabel: string + method: string + solarPositions: Record + dataGaps: string[] + walkingSpeedMps: number + } | null +} + +export interface CoolDemoState { + round: CoolRound + time: CoolTime + selectedRoute: CoolRouteId + scene: CoolScene + voteOpen: boolean + updatedAt: string +} + +export interface CoolVoteCounts { + shortest: number + shaded: number + accessible: number +} + +export interface CoolVoteTally { + round: CoolRound + counts: CoolVoteCounts + total: number + updatedAt: string | null +} + +export interface CoolVoteResponse { + yourRoute: CoolRouteId + duplicate: boolean + tally: CoolVoteTally +} + +export interface CoolCityCatchment { + rank: number + sensor_id: string + sensor_name: string + center: { lat: number; lon: number } + radius_m: number + geometry: { type: string; coordinates: number[][][] } + inputs: { + footfall: { mean: number; p95: number } + shade: { + building_footprint_share_of_land: number + tree_canopy_share_of_land_proxy: number + water_share_of_catchment: number + building_polygons: number + mapped_tree_points: number + } + access: { + nearest_public_drinking_water_m: number + nearest_bench_m: number + nearest_public_toilet_m: number + nearest_step_free_anchor_m: number + within_300m: Record + } + vulnerability: { + district: string + age_65plus_share: number + age_65plus_count: number + district_population: number + reference_date: string + } + } + normalized_inputs: Record + scores: { + footfall: number + shade_deficit: number + access_deficit: number + vulnerability: number + gap_index: number + } + nearest_cool_place: { name: string; category: string; distance_m: number } | null + reason: string + max_overlap_with: { sensor_id: string; distance_m: number; overlap_fraction: number } | null +} + +export interface CoolCityPlace { + name: string + category: string + lat: number + lon: number + distance_to_cluster_center_m: number + within_1km?: boolean +} + +export interface CoolCityBundle { + meta: { + city: string + generated: string + sensor_source: string + sensor_data_version: string + sensor_model_version: string + catchment_radius_m: number + catchment_area_m2: number + method: string + weights: Record + weights_note: string + ranking_note: string + subweights: Record + assumptions: string[] + sources: Array<{ name: string; url: string; retrieved: string; license: string }> + self_check?: Record + sensitivity?: Record + data_gaps?: string[] + layer_counts?: Record + } + catchments: CoolCityCatchment[] + official_cool_places: CoolCityPlace[] +} + +export function isCoolRouteId(value: unknown): value is CoolRouteId { + return typeof value === 'string' && (COOL_ROUTE_IDS as readonly string[]).includes(value) +} + +export function isCoolTime(value: unknown): value is CoolTime { + return typeof value === 'string' && (COOL_TIMES as readonly string[]).includes(value) +} + +export function isCoolRound(value: unknown): value is CoolRound { + return typeof value === 'string' && (COOL_ROUNDS as readonly string[]).includes(value) +} + +export function isCoolScene(value: unknown): value is CoolScene { + return typeof value === 'string' && (COOL_SCENES as readonly string[]).includes(value) +} + +export function defaultCoolState(round: CoolRound = 'preselection'): CoolDemoState { + return { + round, + time: '10:00', + selectedRoute: 'shortest', + scene: 'ruth', + voteOpen: false, + updatedAt: '', + } +} + +export function emptyCoolTally(round: CoolRound = 'preselection'): CoolVoteTally { + return { + round, + counts: { shortest: 0, shaded: 0, accessible: 0 }, + total: 0, + updatedAt: null, + } +} + +/** Runtime fallback only; the shipped route.json has the real modelled values. */ +export function pendingCoolRouteBundle(): CoolRouteBundle { + return { + status: 'pending', + generatedAt: '', + hotDay: null, + label: 'Route/shade bundle pending. No estimates shown.', + shadeLabel: 'modeled shade, not measured', + origin: { name: 'Stadtgalerie' }, + destination: { name: 'Marktplatz' }, + times: [...COOL_TIMES], + routes: COOL_ROUTE_IDS.map((id) => ({ + id, + label: COOL_ROUTE_LABELS[id], + longName: COOL_ROUTE_LABELS[id], + description: COOL_ROUTE_DESCRIPTIONS[id], + fullDescription: '', + values: {}, + ramp: null, + accessibilityNotes: [], + geometry: [], + })), + recommendationByTime: {}, + modelLabel: COOL_MODEL_LABEL, + water: [], + meta: null, + } +} diff --git a/shared/staffing.ts b/shared/staffing.ts index 2c64fe1..9905ce0 100644 --- a/shared/staffing.ts +++ b/shared/staffing.ts @@ -84,11 +84,7 @@ export function hhmm(hour: number): string { return `${String(hour).padStart(2, '0')}:00` } -/** - * Mock scenario behaviour. The contract defines the scenario enum but not the - * size of each perturbation; these multipliers are demo assumptions and are - * shown in the UI. The Go/ML implementation must publish the same numbers. - */ +/** Demo perturbations for the mock fallback; the Go API applies scenarios from ML output. */ export function applyScenario(points: Point[], scenario: Scenario): Point[] { if (scenario === 'base') return points return points.map((point) => { diff --git a/shared/types.ts b/shared/types.ts index a8926c5..f636ab0 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -1,5 +1,4 @@ -// Canonical shapes from /home/noel/Documents/Hackathon_2026/CONTRACT.md (v1 draft). -// Keep these in sync with the Go API; the UI consumes exactly these fields. +// Canonical wire shapes for the Go API; keep them in sync with the contract. export const HORIZONS = ['15m', '1h', '48h', '7d'] as const export type Horizon = (typeof HORIZONS)[number] diff --git a/test/cool-votes.test.ts b/test/cool-votes.test.ts new file mode 100644 index 0000000..77978a1 --- /dev/null +++ b/test/cool-votes.test.ts @@ -0,0 +1,82 @@ +import { beforeEach, describe, expect, it } from 'vitest' +import { + getCoolState, + getCoolVoteTally, + isValidCoolSessionId, + recordCoolVote, + resetCoolDemoStore, + resetCoolRound, + updateCoolState, +} from '../server/utils/cool-votes' + +describe('Cool City demo state and vote tally', () => { + beforeEach(() => resetCoolDemoStore()) + + it('starts with the Ruth card and 10:00, shortest, closed', () => { + const state = getCoolState('preselection') + expect(state.scene).toBe('ruth') + expect(state.time).toBe('10:00') + expect(state.selectedRoute).toBe('shortest') + expect(state.voteOpen).toBe(false) + expect(getCoolVoteTally('preselection').total).toBe(0) + }) + + it('updates scene, time, route and vote phase', () => { + updateCoolState('preselection', { scene: 'routes', time: '16:00', selectedRoute: 'accessible' }) + updateCoolState('preselection', { scene: 'vote', voteOpen: true }) + const state = getCoolState('preselection') + expect(state.scene).toBe('vote') + expect(state.time).toBe('16:00') + expect(state.selectedRoute).toBe('accessible') + expect(state.voteOpen).toBe(true) + }) + + it('does not count duplicate sessions', () => { + updateCoolState('preselection', { scene: 'vote', voteOpen: true }) + const first = recordCoolVote('preselection', 'accessible', 'session_12345678') + expect(first.duplicate).toBe(false) + expect(first.tally.counts.accessible).toBe(1) + + const duplicate = recordCoolVote('preselection', 'shortest', 'session_12345678') + expect(duplicate.duplicate).toBe(true) + expect(duplicate.route).toBe('accessible') + expect(duplicate.tally.counts.shortest).toBe(0) + expect(duplicate.tally.total).toBe(1) + }) + + it('keeps preselection and final rounds separate', () => { + updateCoolState('preselection', { scene: 'vote', voteOpen: true }) + updateCoolState('final', { scene: 'vote', voteOpen: true }) + recordCoolVote('preselection', 'shortest', 'session_aaaaaaaa') + recordCoolVote('final', 'accessible', 'session_bbbbbbbb') + expect(getCoolVoteTally('preselection').counts.shortest).toBe(1) + expect(getCoolVoteTally('final').counts.accessible).toBe(1) + expect(getCoolVoteTally('final').counts.shortest).toBe(0) + }) + + it('refuses votes before the round is open', () => { + expect(() => recordCoolVote('preselection', 'accessible', 'session_12345678')).toThrow( + 'Voting is not open', + ) + }) + + it('resets votes and state for one round only', () => { + updateCoolState('preselection', { scene: 'vote', voteOpen: true }) + updateCoolState('final', { scene: 'vote', voteOpen: true }) + recordCoolVote('preselection', 'accessible', 'session_aaaaaaaa') + recordCoolVote('final', 'shortest', 'session_bbbbbbbb') + resetCoolRound('preselection') + expect(getCoolState('preselection').scene).toBe('ruth') + expect(getCoolVoteTally('preselection').total).toBe(0) + expect(getCoolVoteTally('final').total).toBe(1) + }) + + it('accepts opaque random session IDs and rejects unsafe values', () => { + expect(isValidCoolSessionId('8a1f9a2e-9e2c-4f6b-9c2b-3a4b5c6d7e8f')).toBe(true) + expect(isValidCoolSessionId('session_12345678')).toBe(true) + expect(isValidCoolSessionId('short')).toBe(false) + expect(isValidCoolSessionId('has spaces in it')).toBe(false) + expect(isValidCoolSessionId('')).toBe(false) + expect(isValidCoolSessionId(undefined)).toBe(false) + }) +})