/* Literary — components.

   NO raw colours, sizes, durations or shadows in this file. Everything comes from
   tokens.css; if a value is missing, add a token rather than a literal. See DESIGN.md.

   Full-bleed map inside a rounded frame on warm neutral ground. Nothing is open
   until a place is clicked. Chrome sits over the map as pills, never as a sidebar. */

@import url("tokens.css");

* { box-sizing: border-box; }

html { font-size: 16px; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--page);
  /* --ink-on-page is gone: NOTHING renders on the surround. It existed when the page
     behind the frame was near-black and a stray heading had to survive there; the
     surrounds are mid-tone now, on which no light text can reach 4.5:1 at all, and
     the frame covers the band completely. Inheriting the normal ink means anything
     accidentally placed here is at least legible on the white it would land on. */
  color: var(--ink);
  font-family: var(--face);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: var(--pad);
  background: var(--page-gradient), var(--page);
  background-attachment: fixed;
}

/* ── the moving surround ───────────────────────────────────────────────────
   Four discs in the city's own family, heavily blurred so their edges dissolve into
   each other. Each drifts between four waypoints carried as inline custom properties
   — the same shape as the reference component, whose "random values between -0.5 and
   0.5" are fixed here rather than random, because a surround that is different on
   every reload is a surround nobody can design.

   The blur is what turns four circles into one gradient. Without it you see four
   circles; at 70px you cannot tell where any of them ends. */

.glow {
  position: fixed;
  inset: -20vmax;              /* overhang, so a drifting disc never shows an edge */
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  filter: blur(70px);
}

.glow span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70vmax;
  height: 70vmax;
  margin: -35vmax 0 0 -35vmax;
  border-radius: 50%;
  /* Derived from the surround tone, so the whole thing follows the city. */
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--page-deep) 55%, #FFFFFF 45%) 0%,
    color-mix(in srgb, var(--page-deep) 78%, #FFFFFF 22%) 55%,
    transparent 100%);
  will-change: transform;
  animation: drift 34s var(--ease) infinite alternate;
}
.glow span:nth-child(2) { animation-duration: 41s; animation-delay: -8s;  opacity: .85; }
.glow span:nth-child(3) { animation-duration: 47s; animation-delay: -19s; opacity: .75; }
.glow span:nth-child(4) { animation-duration: 38s; animation-delay: -27s; opacity: .70; }

@keyframes drift {
  0%   { transform: translate(calc(var(--tx1) * 100%), calc(var(--ty1) * 100%)); }
  33%  { transform: translate(calc(var(--tx2) * 100%), calc(var(--ty2) * 100%)); }
  66%  { transform: translate(calc(var(--tx3) * 100%), calc(var(--ty3) * 100%)); }
  100% { transform: translate(calc(var(--tx4) * 100%), calc(var(--ty4) * 100%)); }
}

/* A slow ambient drift is exactly the kind of motion this setting is for. */
@media (prefers-reduced-motion: reduce) {
  .glow span { animation: none; }
}

/* the grain sits over the gradient and under everything else */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
}
.frame { z-index: 1; }


/* ── the frame ─────────────────────────────────────────────────────────── */

.frame {
  position: relative;
  height: calc(100vh - var(--pad) * 2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--map-bg);
  isolation: isolate;
  box-shadow: var(--shadow-frame);
}

#map { position: absolute; inset: 0; }

.leaflet-container { background: var(--map-bg); font-family: var(--face); }

.leaflet-control-zoom {
  margin: 0 1.5rem 3.25rem 0 !important;
  border: 0 !important;
}
.leaflet-control-zoom a {
  background: color-mix(in srgb, var(--card) 94%, transparent) !important;
  backdrop-filter: blur(8px);
  color: var(--ink) !important;
  border: 0 !important;
  width: 36px !important; height: 36px !important;
  line-height: 36px !important;
  font-size: var(--fs-lead) !important;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--thistle) 18%, transparent);
}
.leaflet-control-zoom a:first-child { border-radius: var(--radius-pill) 999px 6px 6px !important; }
.leaflet-control-zoom a:last-child  { border-radius: 6px 6px 999px 999px !important; }

.leaflet-control-attribution {
  background: color-mix(in srgb, var(--card) 82%, transparent) !important;
  backdrop-filter: blur(6px);
  border-radius: var(--radius-pill) 0 0 0;
  padding: .3rem .8rem !important;
  font-family: var(--face) !important;
  font-size: .75rem !important;
  color: var(--ink-faint) !important;
}
.leaflet-control-attribution a { color: var(--ink-soft) !important; }

/* ── the panel ─────────────────────────────────────────────────────────────
   A slice of the top-left corner: the name, one picker, one line of count and the
   legend. White, with a dark stroke; no grain and no translucency. It was a
   full-height column with the whole list open for one round, which took a fifth of
   the map to answer a question asked once. */

/* The panel is a postage stamp (Janne, 25 September 2026: "postage stamps
   have that very particular edge"): a white sheet with a perforated edge,
   the holes punched by a mask along its four sides, a hairline frame
   inside as stamps have. The mask clips the sheet's own shadow, so the
   shadow is a filter on the panel round it. --hole is a hole's radius,
   --pitch the distance between holes; the edges repeat by rounding, so
   the holes always come out whole at the corners. */
.panel {
  color: var(--ink);
  position: absolute;
  z-index: 600;
  top: calc(1.5rem + 36px + .9rem); left: 1.5rem;
  width: max-content;
  max-width: 21rem;
  filter: drop-shadow(0 10px 24px rgb(20 30 40 / .18)) drop-shadow(0 1px 2px rgb(20 30 40 / .12));
}
.stamp {
  --hole: 4px;
  --pitch: 12px;
  position: relative;
  background: var(--card);
  mask-image:
    linear-gradient(#000, #000),
    radial-gradient(circle at 50% 0, #0000 var(--hole), #000 calc(var(--hole) + .5px)),
    radial-gradient(circle at 50% 100%, #0000 var(--hole), #000 calc(var(--hole) + .5px)),
    radial-gradient(circle at 0 50%, #0000 var(--hole), #000 calc(var(--hole) + .5px)),
    radial-gradient(circle at 100% 50%, #0000 var(--hole), #000 calc(var(--hole) + .5px));
  mask-position: var(--hole) var(--hole), top center, bottom center, left center, right center;
  mask-size:
    calc(100% - 2 * var(--hole)) calc(100% - 2 * var(--hole)),
    var(--pitch) var(--hole),
    var(--pitch) var(--hole),
    var(--hole) var(--pitch),
    var(--hole) var(--pitch);
  mask-repeat: no-repeat, round no-repeat, round no-repeat, no-repeat round, no-repeat round;
}
.panel .stamp { padding: calc(var(--hole) + 1.35rem) calc(var(--hole) + 1.5rem) calc(var(--hole) + 1.45rem); }
.stamp::before {
  /* the frame inside the perforation */
  content: "";
  position: absolute;
  inset: calc(var(--hole) + 7px);
  border: 1px solid var(--stroke-strong);
  pointer-events: none;
}
/* the book on the map, under the wordmark: its title in the display face,
   then author, year and city small (Janne, 25 September 2026: the one-line
   version "doesn't read right") */
.now { margin: 1.15rem 0 0; }
.now b { display: block; font-family: var(--face-display); font-weight: 500; font-size: 1.05rem; line-height: 1.25; }
.now span { display: block; margin-top: .15rem; font-size: 13px; line-height: 1.4; color: var(--ink-soft); }
/* the back button stands on its own above the panel, not in its box
   (Janne, 25 September 2026) */
.back { position: absolute; z-index: 610; top: 1.5rem; left: 1.5rem; }
/* The portfolio's back button, the same as on its case studies (globals.css
   .back): a 36px circle in the site's accent, icon only. */
.back {
  display: inline-flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  /* the stamps' paper, the arrow in their red (Janne, 25 September 2026) */
  background: var(--card);
  color: #C8102E;
  box-shadow: 0 2px 8px rgb(20 30 40 / .12);
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease;
}
.back svg { display: block; }
.back:hover { background: color-mix(in srgb, #C8102E 8%, var(--card)); }
.back:active { transform: scale(0.92); }
.back:focus-visible { outline: 2px solid #C8102E; outline-offset: 2px; }

/* ── the shelf ─────────────────────────────────────────────────────────────
   A belt along the bottom of the map: the books face front, cover out, each
   overlapping the one before it like a row fanned on a table (Janne, 25
   September 2026, after a spine-out version: real spines are not to be had,
   so "they should be facing front ... a bit overlapping each other"). --cw is
   a cover's width; --lap how much of it the next book covers. */
.shelf {
  --cw: 84px;
  --lap: 34px;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  /* tall enough for a lifted book and the caption over it; the floor is only
     the lower 230px */
  height: 330px;
  z-index: 620;
  overflow: hidden;
  pointer-events: none;
  /* a pale floor for the books to stand on, fading up into the map */
  background: linear-gradient(to top, rgb(255 255 255 / .92) 0, rgb(255 255 255 / .55) 38%, rgb(255 255 255 / 0) 100%) bottom / 100% 230px no-repeat;
}
.shelf-track {
  position: absolute;
  left: 0; bottom: 26px;
  display: flex;
  align-items: flex-end;
  padding-left: 1.5rem;
  will-change: transform;
}
.book {
  position: relative;
  flex: none;
  width: var(--cw);
  /* the cover's own height, never cut: the books stand at their own
     heights on the belt (Janne, 25 September 2026) */
  height: auto;
  margin: 0 0 0 calc(-1 * var(--lap));
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--book, var(--ink));
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: -3px 0 8px rgb(0 0 0 / .18), inset 0 0 0 1px rgb(0 0 0 / .12);
  transform: translate(0, 0);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .35s ease;
  outline: none;
}
.book:first-child { margin-left: 0; }
/* the pile (Janne, 25 September 2026: "form a nice pile"): every book slides
   to one spot at the right end of the shelf, each a little turned and a
   little higher than the one before, over .7s with a stagger set inline;
   the second copy fades out so the pile is 28 books, not 56. A click on the
   pile spreads them back. Hover does nothing in the pile. */
.shelf.is-piled .book {
  transform: translate(var(--px, 0px), var(--py, 0px)) rotate(var(--pr, 0deg));
  transition-duration: .7s, .35s;
}
.shelf.is-piled .book.is-copy { opacity: 0; pointer-events: none; }
.shelf.is-piled .book:hover, .shelf.is-piled .book:focus-visible,
.shelf.is-piled .book.is-before, .shelf.is-piled .book.is-after {
  transform: translate(var(--px, 0px), var(--py, 0px)) rotate(var(--pr, 0deg));
  z-index: auto;
}
/* the stack button, just under the map's zoom control at the right (Janne,
   25 September 2026), the zoom control's width and manner; in the pile it
   reads as the spread control */
.shelf-stack {
  position: absolute;
  right: 10px; bottom: 192px;
  z-index: 640;
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 29px; height: 29px;
  padding: 0; border: 0; border-radius: 4px;
  background: #FFFFFF; color: var(--ink);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgb(0 0 0 / .1);
  transition: transform 160ms cubic-bezier(.23, 1, .32, 1);
}
.shelf-stack:hover { background: #F2F2F2; }
.shelf-stack:active { transform: scale(.94); }
.shelf-stack:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.shelf-stack svg { transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.shelf.is-piled .shelf-stack svg { transform: rotate(90deg); }
.book-cover { display: block; }
.book-cover img { display: block; width: 100%; height: auto; }
/* a book with no cover file (the ones still in copyright) wears its title */
.book-cover .book-plain {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  /* in the strip the next book leaves uncovered (the cover less --lap) */
  padding: 10px calc(var(--lap) + 6px) 10px 8px;
  color: #FFFFFF;
  font-family: var(--face-display);
  font-size: 11px; line-height: 1.15;
  text-align: left;
  hyphens: auto;
}
.book-cover .book-plain small { display: block; font-family: var(--face); font-size: 9px; opacity: .8; }
/* under the pointer, or with focus: the book lifts and comes to the top,
   and its neighbours part, the one before it to the left and the one after
   it to the right, so it stands in its own space (Janne, 25 September 2026:
   "A should move leftwards, C should move rightwards, and B should lift
   upwards. They should create a negative space for it"). The overlap is
   --lap, so half a cover of parting each side clears it whole. */
/* gentler at Janne's word the same evening: a quarter larger as it rises,
   the neighbours only a little aside */
.book:hover, .book:focus-visible { transform: translate(0, -40px) scale(1.25); transform-origin: 50% 100%; z-index: 4; }
.book.is-before { transform: translate(-14px, 0); }
.book.is-after { transform: translate(14px, 0); }
.book[aria-selected="true"]::after {
  /* the chosen book: a hairline of ink round its cover */
  content: ""; position: absolute; inset: 0; border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--ink);
  pointer-events: none;
}
.book:focus-visible { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--ink); }
/* the caption just over the raised book: a label as on an envelope, a
   crisp rectangle in a double rule, the book's name bold over its author
   and year in small capitals (Janne, 25 September 2026: "crisp corners ...
   like signage that you have on letters") */
.shelf-caption {
  position: absolute;
  bottom: 244px; /* the raised book's top is about 224px up */
  z-index: 5; /* over the lifted neighbours */
  margin: 0;
  transform: translateX(-50%);
  padding: .35rem .7rem .4rem;
  border-radius: 0;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--ink);
  color: var(--ink);
  font-family: var(--face);
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  pointer-events: none;
}
.shelf-caption b { display: block; font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.shelf-caption span { display: block; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.shelf-caption[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  /* no belt: the line stands, and scrolls sideways by hand */
  .shelf { overflow-x: auto; pointer-events: auto; }
  .shelf-track { position: static; transform: none !important; padding-bottom: 26px; padding-top: 80px; }
  .book { transition: none; }
}
@media (max-width: 768px) {
  .shelf { --cw: 66px; --lap: 26px; height: 290px; background-size: 100% 190px; }
  .book { height: auto; }
  .shelf-caption { bottom: 196px; }
  .maplibregl-ctrl-bottom-right { bottom: 190px; }
  .shelf-stack { bottom: 152px; }
}
/* the zoom control sits just above the shelf, at the frame's right edge,
   where the belt does not run under it; the attribution at the very bottom
   left, under the books, closed to its ⓘ until hovered or clicked */
.maplibregl-ctrl-bottom-right { bottom: 230px; z-index: 630; }
.maplibregl-ctrl-bottom-left { bottom: 0; z-index: 630; }
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show):not([open]) .maplibregl-ctrl-attrib-inner { display: none; }

/* the name in a darker bright red, a stamp's ink (Janne, 25 September 2026) */
.wordmark {
  margin: 0;
  color: #C8102E;
  font-family: var(--face-display);
  font-weight: 500;
  /* a quarter larger than the quote size (Janne, 25 September 2026) */
  font-size: calc(var(--fs-quote) * 1.25);
  line-height: var(--lh-tight);
  letter-spacing: -.005em;
}

/* ── the picker ────────────────────────────────────────────────────────────
   Quiet. The chosen title in the text face and size with a caret, over a hairline: not a
   field, and no stroke of its own. The card's edge is the only dark line on the
   panel; a second one inside it, on the control, read as aggressive. The menu is the
   same white with a hairline edge and the menu shadow, every work grouped under a
   sentence-case city heading, each row a title over one quiet line, all in the text
   face at the text size; the serif is for the two headers only. The chosen row sits
   on the faint field tint. */

.picker { position: relative; }

.picker-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .3rem 0 .55rem;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  font-family: var(--face);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.picker-btn:hover, .picker-btn[aria-expanded="true"] { border-bottom-color: var(--ink-faint); }

.picker-value {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-caret {
  flex: none;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-faint);
  transition: transform var(--med) var(--ease);
}
.picker-btn[aria-expanded="true"] .picker-caret { transform: rotate(180deg); }

.picker-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + .45rem);
  width: 100%;
  max-height: min(30rem, calc(100vh - 12rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: .2rem 0 .4rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-menu);
  animation: rise var(--med) var(--ease);
}
.picker-menu[hidden] { display: none; }

.works-heading {
  margin: .8rem 1rem .3rem;
  font-family: var(--face);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--ink-faint);
}

.works-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.work {
  display: block;
  width: 100%;
  padding: .5rem 1rem .6rem;
  border: 0;
  border-top: 1px solid var(--rule);
  background: none;
  text-align: left;
  font-family: var(--face);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.work-title {
  display: block;
  font-family: var(--face);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
}

.work-meta {
  display: block;
  margin-top: .1rem;
  font-size: var(--fs-small);
  color: var(--ink-faint);
}

.work:hover { background: var(--card-warm); }
.work[aria-selected="true"] { background: var(--field); }
.work:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ── the legend ────────────────────────────────────────────────────────────
   The key to the three marks, on one line under the picker, at the text size. The swatches are the marks themselves at that scale, same tokens
   and same geometry, so the legend cannot drift from what the map draws. */

.legend {
  margin: .9rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.1rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.legend dt { margin: 0; display: flex; }
.legend dd {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--ink-faint);
}

.key {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mark-exists);
}
.key--gone { background: var(--mark-gone); }
/* The area key is the epicentre in miniature: white centre, green ring. */
.key--area {
  background: var(--mark-collar);
  border: 1.5px dotted var(--mark-area);
}

/* ── the hover tooltip ─────────────────────────────────────────────────────
   Ported from Aceternity's animated-tooltip, which is a React/framer-motion
   component and could not be dropped in — this project has no React, no build step
   and no npm. What transferred is the BEHAVIOUR, which is the part worth having:

     • it springs up out of the mark rather than fading in beside it
     • it tilts and slides with the pointer as you move across the mark

   Replaces a leader line and arrowhead, kept on the `arrow-callout` branch.

   The colours are ours: the tooltip wears its mark's colour, white type on it. */

/* ── the connector ─────────────────────────────────────────────────────────
   A plain straight line, nothing else — it was dashed with a dart head first, and
   the trimmings went one by one: the motion is the character, so the geometry can
   be silent. Redrawn from JS every frame, because its length is driven by the same
   springs as the tooltip — a static path under a bouncing label would look
   bolted on. */

.connector {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 570;                /* under the flag, over the map */
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity .13s var(--ease);
}
.connector.is-on { opacity: 1; }

.connector-line {
  fill: none;
  stroke: var(--conn, var(--mark-exists));
  stroke-width: 2;
  stroke-linecap: round;
}

.flag {
  position: absolute;
  z-index: 575;
  left: 0; top: 0;
  pointer-events: none;
  padding: .4rem .7rem .44rem;
  border-radius: 5px;
  background: var(--flag-bg, var(--mark-exists));
  color: #FFFFFF;
  font-family: var(--face);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .045em;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 8px 22px -6px rgb(0 0 0 / .45);
  transform-origin: 50% 120%;   /* pivots about a point below it, so the tilt swings */

  opacity: 0;
  /* NOTHING TRANSITIONS `transform` HERE. It is written every frame by the springs in
     script.js — entrance, tilt and slide composed into one string. A CSS transition on
     the same property was what swallowed the bounce: the tilt spring rewrote transform
     ~60×/s, restarting the transition before it could reach its overshoot. Only opacity
     is left to CSS, because nothing else touches it.

     The rest position (translateY 14px, scale .62) is set by render() on show, not
     here, so there is exactly one place that decides what transform says. */
  transform: translate(-50%, 14px) scale(.62);
  transition: opacity .13s var(--ease);
}

.flag.is-on { opacity: 1; }

/* The hairline under the label, which in the original is two gradient rules in
   emerald and sky. Ours takes the mark's own colour lightened, so it stays inside
   the palette instead of importing two new hues. */
.flag::after {
  content: "";
  position: absolute;
  left: 18%; right: 18%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(to right,
    transparent,
    color-mix(in srgb, #FFFFFF 75%, var(--flag-bg, var(--mark-exists))),
    transparent);
}

@media (prefers-reduced-motion: reduce) {
  /* !important because render() writes transform inline every frame. */
  .flag, .flag.is-on { transform: translate(-50%, 0) !important; transition: opacity .1s linear; }
}

/* ── map pins ──────────────────────────────────────────────────────────────
   Solid discs in a white collar, exactly as the reference draws them. The collar is
   what makes a dot survive whatever the basemap puts under it — a red dot on a red
   roof needs a boundary, and the collar supplies one that no single hue can. */

/* Sized to the dot exactly, so MapLibre's own translate(-50%, -50%) lands the
   VISIBLE circle on the coordinate. line-height:0 keeps the span from adding a
   text descender to the box. */
.pin-wrap {
  background: none;
  border: 0;
  cursor: pointer;
  width: var(--pin-size);
  height: var(--pin-size);
  line-height: 0;
}

.pin {
  display: block;
  width: var(--pin-size);
  height: var(--pin-size);
  /* NO negative margin. It was Leaflet's: a divIcon is anchored at its top-left, so
     the icon had to pull itself half its own width up and left to sit on the point.
     MapLibre centres the marker ELEMENT instead, with translate(-50%, -50%) — and
     with both corrections applied the wrap collapsed to 9x9 and every visible dot
     sat 6.6px up-left of its own coordinate. A geocoded point drawn 6.6px off is
     exactly the quiet lie this project exists to avoid. */
  border-radius: 50%;
  background: var(--mark-exists);
  box-shadow: 0 0 0 3px var(--mark-collar), 0 1px 3px rgb(0 0 0 / .32);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}

.pin--gone { background: var(--mark-gone); }

/* The epicentre of a region: the solid dots INVERTED — white fill, green collar.
   The inversion is the meaning: a filled dot asserts "the place is this point",
   the white centre says "the point only anchors the ring around it". */
.pin--area {
  background: var(--mark-collar);
  /* the collar in the place's own colour: green still there, red gone */
  box-shadow: 0 0 0 3px var(--mark, var(--mark-area)), 0 1px 3px rgb(0 0 0 / .32);
}

/* Hovering raises the pin, so the flag and its mark are obviously one thing. */
.pin-wrap.is-hovered .pin,
.pin-wrap.is-active  .pin {
  transform: scale(1.4);
  box-shadow: 0 0 0 3.5px var(--mark-collar), 0 3px 9px rgb(0 0 0 / .38);
}
/* the epicentre keeps its green collar when raised — flipping it white on hover
   would turn it into a "still there" dot for exactly as long as you look at it */
.pin-wrap.is-hovered .pin--area,
.pin-wrap.is-active  .pin--area {
  box-shadow: 0 0 0 3.5px var(--mark, var(--mark-area)), 0 3px 9px rgb(0 0 0 / .38);
}

/* ── the card ──────────────────────────────────────────────────────────── */

/* The place card, a postage stamp like the panel (Janne, 25 September
   2026), level with it: the same top, the same distance from its edge.
   The aside places it and casts the shadow; the .stamp inside carries the
   sheet, the perforation and the scrolling. */
.card {
  color: var(--ink);
  position: absolute;
  z-index: 650;
  right: 1.5rem;
  top: calc(1.5rem + 36px + .9rem);
  width: min(27rem, calc(100% - 3rem));
  max-height: calc(100% - 3rem);
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 10px 24px rgb(20 30 40 / .18)) drop-shadow(0 1px 2px rgb(20 30 40 / .12));
}
.card[hidden] { display: none; }
.card .stamp {
  padding: calc(var(--hole) + 2rem) calc(var(--hole) + 2rem) calc(var(--hole) + 2.4rem);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(.9rem) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.card-close {
  position: absolute;
  top: .7rem; right: 1rem;
  border: 0; background: none;
  font-family: var(--face);
  font-size: 1.5rem; line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color .28s var(--ease);
}
.card-close:hover { color: var(--accent); }

.card-name {
  /* the wordmark's red and size (Janne, 25 September 2026) */
  color: #C8102E;
  margin: 0 0 1.3rem;
  font-family: var(--face-display);
  font-size: calc(var(--fs-quote) * 1.25);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.002em;
  text-wrap: balance;
}

/* Under the name, two sections, and everything in them at ONE size, the small one:
   a heading, then the lines. The heading is bold in the fainter ink; every line of
   text under it, the street line, the note and the summary, is the same face, size
   and ink, and darker than the heading. Nothing is separated by a rule; the space
   between the sections is larger than the space inside them, and that is the whole
   hierarchy. A card with four hairlines on it read as a form. */
.card-section { margin: 0 0 1.4rem; }

.card-sub {
  margin: 0 0 .3rem;
  font-family: var(--face);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-faint);
}

.card-today {
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}

/* Where the modern address needs explaining: which street was renamed, and when. */
.card-note {
  margin: .3rem 0 0;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}

.card-summary {
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}

/* A disclosure, not a call to action. This was a filled pill, which made reading the
   author's own sentence look like the primary thing to do on the card; it is the
   optional deeper step. It is set exactly like the two section headings above it,
   bold in the fainter ink, with the caret beside the label rather than pushed to
   the far edge, and it stands the same distance below the text as one section
   stands below the last, so it reads as a third heading that happens to open. */
.reveal {
  /* flex, not inline-flex: an inline box sits on a line and takes its leading, which
     put it 5px lower than the heading above it sits below its own text. */
  display: flex;
  width: max-content;
  align-items: center;
  gap: .45rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--face);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color var(--med) var(--ease);
}
/* `display: flex` above beats the UA stylesheet's [hidden] { display: none }, so a
   card with no quote, which must render no "Show full text" at all, kept showing the
   control with the attribute set. Any element given a display here needs its own
   hidden rule. */
.reveal[hidden] { display: none; }
/* The quote and its citation open under the control at the same gap. */
.fulltext { margin-top: .9rem; }

.reveal:hover { color: var(--ink); }
.reveal[aria-expanded="true"] { color: var(--ink); }

.reveal-caret {
  flex: none;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform var(--med) var(--ease);
}
.reveal[aria-expanded="true"] .reveal-caret { transform: rotate(180deg); }

.fulltext { animation: rise .42s var(--ease); }

.card-quote {
  margin: 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--timber);
}
/* The author's own prose, in the same face and size as everything else on the card:
   the quotation marks, the italic and the bar say it is borrowed. It was the serif
   at 22px, and the one block on the card in a different face and size. */
.card-quote p {
  margin: 0;
  font-family: var(--face);
  font-size: var(--fs-small);
  line-height: 1.6;
  font-style: italic;
  color: var(--ink);
  text-wrap: pretty;
}

.card-cite {
  margin: 1.1rem 0 0;
  padding-left: 1.2rem;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink);
}

/* ── narrow ────────────────────────────────────────────────────────────── */

@media (max-width: 48rem) {
  :root { --pad: .6rem; --radius: 1.25rem; --fs-title: 1.875rem; }

  .topbar { flex-direction: column; align-items: stretch; gap: .5rem; top: 1rem; left: 1rem; right: 1rem; }
  .card {
    right: .6rem; left: .6rem;
    top: auto; bottom: .6rem;
    width: auto;
    max-height: 64%;
    padding: 1.6rem 1.5rem 2rem;
  }
  .chip { display: none; }
  .leaflet-control-zoom { display: none; }
  .panel { position: static; width: auto; border: 0; border-top: 1.5px solid var(--stroke-strong); border-radius: 0; box-shadow: none; }
  .picker-menu { top: auto; bottom: calc(100% + .45rem); }
  .frame { display: flex; flex-direction: column; }
  #map { position: relative; flex: 1; inset: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .fulltext, .picker-menu, .pin, .reveal-arrow, .work, .reveal, .card-close, .picker-caret {
    animation: none !important;
    transition: none !important;
  }
}
