hackertours/assets/css/_tour-map.css

123 lines
2.8 KiB
CSS

/* Tour map shortcode: Leaflet map of the tour locations, a plain list without JavaScript. */
.tour-map {
margin-block: var(--spacing-l);
}
/* Without JavaScript only the list is shown. */
.tour-map__canvas {
display: none;
}
.tour-map--ready {
.tour-map__canvas {
display: block;
height: clamp(20rem, 60vh, 36rem);
border: 1px solid color-mix(in oklch, var(--color-text) 20%, transparent);
border-radius: var(--radius-m);
}
/* Kept for screen readers, which can't use the map itself. */
.tour-map__list {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
}
.tour-map__marker span {
display: grid;
place-items: center;
width: 2rem;
height: 2rem;
/* Leaflet positions the icon's top left corner; centre it on the location. */
margin: -1rem 0 0 -1rem;
border: 2px solid #fff;
border-radius: 50%;
background: var(--tour-map-color, #555);
box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
}
/* The icon is drawn in white through its shape, whatever colours the SVG uses. */
.tour-map__marker i {
width: 60%;
height: 60%;
background: #fff;
mask: var(--tour-map-icon) center / contain no-repeat;
}
.tour-map__marker--origin span {
width: 2.75rem;
height: 2.75rem;
margin: -1.375rem 0 0 -1.375rem;
background: #111;
}
.tour-map {
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: var(--color-body-bg);
color: var(--color-text);
}
.leaflet-popup-content {
margin: 0.75rem 1rem;
font-family: var(--ff-alt);
font-size: var(--fs-s);
line-height: 1.4;
}
}
.tour-map__popup-title {
font-family: var(--ff-headings);
font-size: var(--fs-m);
font-weight: 600;
}
.tour-map__directions {
ul {
margin: 0.5rem 0 0;
padding-inline-start: 1.1rem;
}
p {
margin: 0.5rem 0 0;
}
}
/* The credit line on an opaque background, so its contrast doesn't depend on the map below.
As specific as Leaflet's own semi-transparent rule plus one, which it would lose to otherwise. */
.tour-map .leaflet-container .leaflet-control-attribution {
background: #fff;
color: #333;
a {
color: #0b5394;
}
}
/* Leaflet blends tiles with plus-lighter to hide seams while they fade in; the map doesn't fade
tiles (tour-map.js), and axe, which pa11y uses, fails on that blend mode. */
.tour-map .leaflet-container img.leaflet-tile {
mix-blend-mode: normal;
}
.tour-map .leaflet-bar a {
color: #111;
}
/* The zoom icons (SVG, see tour-map.js) centred in their buttons. */
.tour-map .leaflet-control-zoom a {
display: grid;
place-items: center;
}
/* Dark map tiles to match the dark colour scheme. */
@media (prefers-color-scheme: dark) {
.tour-map .leaflet-tile-pane {
filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9);
}
}