OpenDataVisualizer/client/src/styles.css
Claudio Schaad e729ea3403 Add Thurgau traffic visualizer with animated map
ASP.NET Core 10 API and React client that visualize the canton of
Thurgau's hourly traffic counts by vehicle class (data.tg.ch, CC0).

- Background refresh from data.tg.ch every 6 h into a per-day JSON
  cache, so history grows beyond the source's two-week window
- Road geometry per station direction from swisstopo swissTLM3D,
  oriented by geocoding the direction's target town; roundabout arms
  follow the road outward only
- Leaflet map with canvas animation: dots drive along the road in
  both directions, density by hourly count, colour by vehicle class,
  right-hand traffic; play/pause, time slider and day selection
- Station panel with per-class counts and Chart.js charts (hourly,
  weekday/weekend profile, daily totals, class mix)
- swisstopo base map switcher (grey, colour, aerial)
- Dockerfile and docker-compose with a data volume
- xUnit tests for mapping, cache, geometry, geocoding and analysis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 20:33:58 +01:00

360 lines
5.2 KiB
CSS

:root {
--bg: #f8fafc;
--surface: #ffffff;
--border: #e2e8f0;
--text: #0f172a;
--muted: #64748b;
--accent: #2563eb;
--panel-width: 440px;
font-family:
system-ui,
-apple-system,
'Segoe UI',
sans-serif;
color: var(--text);
background: var(--bg);
}
* {
box-sizing: border-box;
}
html,
body,
#root {
height: 100%;
margin: 0;
}
.app {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto 1fr auto;
grid-template-areas:
'header'
'map'
'footer';
height: 100%;
}
.app.with-panel {
grid-template-columns: 1fr var(--panel-width);
grid-template-areas:
'header header'
'map panel'
'footer footer';
}
.app-header {
grid-area: header;
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
padding: 10px 18px;
background: var(--surface);
border-bottom: 1px solid var(--border);
}
.title h1 {
margin: 0;
font-size: 18px;
letter-spacing: -0.01em;
}
.subtitle {
color: var(--muted);
font-size: 13px;
}
.stats {
display: flex;
gap: 24px;
}
.stats > div {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.stat-value {
font-size: 20px;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.stat-label {
font-size: 11px;
color: var(--muted);
}
.map-area {
grid-area: map;
position: relative;
min-height: 0;
}
.traffic-map {
position: absolute;
inset: 0;
}
.flow-canvas {
position: absolute;
top: 0;
left: 0;
z-index: 450;
pointer-events: none;
transition: opacity 0.15s;
}
.overlay-bottom {
position: absolute;
left: 12px;
right: 12px;
bottom: 22px;
z-index: 800;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
pointer-events: none;
}
.overlay-bottom > * {
pointer-events: auto;
}
.time-controls,
.legend {
background: rgba(255, 255, 255, 0.94);
border: 1px solid var(--border);
border-radius: 10px;
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
}
.time-controls {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
width: min(820px, 100%);
}
.play-button {
width: 38px;
height: 38px;
border-radius: 50%;
border: none;
background: var(--accent);
color: white;
font-size: 14px;
cursor: pointer;
flex: none;
}
.date-picker {
display: flex;
align-items: center;
gap: 2px;
}
.date-picker button {
border: 1px solid var(--border);
background: white;
border-radius: 6px;
width: 26px;
height: 30px;
cursor: pointer;
}
.date-picker button:disabled {
opacity: 0.4;
cursor: default;
}
select {
height: 30px;
border: 1px solid var(--border);
border-radius: 6px;
background: white;
padding: 0 6px;
font: inherit;
font-size: 13px;
}
.clock {
font-size: 20px;
font-weight: 600;
font-variant-numeric: tabular-nums;
width: 60px;
text-align: center;
}
.time-slider {
flex: 1;
accent-color: var(--accent);
}
.legend {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 14px;
padding: 5px 12px;
font-size: 12px;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 6px;
}
.legend-dot {
display: inline-block;
border-radius: 50%;
}
.legend-dot.small {
width: 8px;
height: 8px;
margin-right: 6px;
}
.legend-note {
color: var(--muted);
}
.notice {
position: absolute;
top: 12px;
left: 50%;
transform: translateX(-50%);
z-index: 800;
background: white;
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px 14px;
font-size: 13px;
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
}
.error {
color: #b91c1c;
}
.muted {
color: var(--muted);
}
.station-panel {
grid-area: panel;
overflow-y: auto;
background: var(--surface);
border-left: 1px solid var(--border);
padding: 14px 16px 24px;
}
.station-panel-header {
display: flex;
justify-content: space-between;
gap: 8px;
}
.station-panel h2 {
margin: 0 0 4px;
font-size: 16px;
}
.station-panel-header p {
margin: 0;
color: var(--muted);
font-size: 12px;
}
.close-button {
border: none;
background: none;
font-size: 24px;
line-height: 1;
cursor: pointer;
color: var(--muted);
}
.station-panel section {
margin-top: 18px;
}
.station-panel h3 {
font-size: 13px;
margin: 0 0 8px;
color: #334155;
}
.class-table {
width: 100%;
border-collapse: collapse;
font-size: 12px;
font-variant-numeric: tabular-nums;
}
.class-table th,
.class-table td {
padding: 3px 4px;
border-bottom: 1px solid #f1f5f9;
text-align: right;
}
.class-table th:first-child,
.class-table td:first-child {
text-align: left;
}
.class-table .total-row td {
font-weight: 600;
border-top: 1px solid var(--border);
}
.chart {
position: relative;
height: 200px;
}
.chart-tall {
height: 230px;
}
.app-footer {
grid-area: footer;
font-size: 11px;
color: var(--muted);
padding: 4px 18px;
border-top: 1px solid var(--border);
background: var(--surface);
}
.app-footer a {
color: inherit;
}
@media (max-width: 900px) {
.app.with-panel {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr 45% auto;
grid-template-areas:
'header'
'map'
'panel'
'footer';
}
.stats {
display: none;
}
.time-controls {
flex-wrap: wrap;
}
}