@font-face {
  font-family: "Radio Canada";
  src: url("vendor/radio-canada/RadioCanada-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #26231e;
  --muted: #655e55;
  --line: #ddd8ce;
  --paper: #fffefa;
  --accent: #285a72;
  --focus: #176989;
  --card-shadow: 0 8px 26px #342d2329;
  --atlas-font: "Radio Canada", "Helvetica Neue", Arial, sans-serif;
  --map-water: #bbe7ff;
  font: 14px/1.4 var(--atlas-font);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { color: inherit; font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); text-underline-offset: .16em; }
:where(button, a, summary, select, input):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
h1, h2, h3, p, dl, ul { margin: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
  min-height: 370px;
  position: relative;
}
.map-frame { flex: 1; isolation: isolate; min-height: 0; position: relative; }
#map { background: var(--map-water); font-family: var(--atlas-font); inset: 0; position: absolute; }
#map:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
#map .maplibregl-ctrl-group { border: 1px solid #c8c4b9; box-shadow: 0 1px 5px #342d232b; }
#map .maplibregl-ctrl-group button { background: var(--paper); color: var(--ink); }
#map .maplibregl-ctrl-group button:hover { background: #f2efe8; }
#map .maplibregl-ctrl.atlas-attribution {
  background: #ffffffd9;
  border-radius: 0;
  color: #575651;
  font-size: 10px;
  line-height: 1.4;
  margin: 0;
  max-width: calc(100vw - 8px);
  padding: 1px 5px;
  text-align: right;
}
#map .atlas-attribution a { color: inherit; white-space: nowrap; }
.atlas-city-label {
  color: #394d50;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 0 2px white, 1px 1px 0 white, -1px -1px 0 white;
  white-space: nowrap;
}
.atlas-point-tooltip { color: var(--ink); font: 13px/1.4 var(--atlas-font); }
.atlas-point-tooltip .maplibregl-popup-content { padding: 6px 9px; pointer-events: none; }
.atlas-point-tooltip strong, .atlas-point-tooltip span span { display: block; }
.atlas-point-tooltip span span { color: var(--muted); }

.atlas-toolbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 7px 14px;
  grid-template-areas: "title links controls";
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 9px 14px;
  position: relative;
  z-index: 1;
}
.atlas-toolbar h1 {
  font-size: clamp(17px, 2vw, 25px);
  grid-area: title;
  letter-spacing: -.025em;
  line-height: 1.17;
}
.title-actions { display: flex; flex-wrap: wrap; gap: 5px; grid-area: links; }
.title-actions button, .title-actions a, .quiet-button, .map-modes button, #map-controls > summary {
  background: #fffefaeb;
  border: 1px solid #d4cfc3;
  border-radius: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  padding: 5px 8px;
  text-decoration: none;
}
.title-actions :is(button, a):hover, .quiet-button:not(:disabled):hover, .map-modes button:hover,
#map-controls > summary:hover {
  background: #f3f0e9;
}
.quiet-button:disabled { opacity: .5; }

.control-panel { grid-area: controls; justify-self: end; }
.story-map-embed .workspace { min-height: 0; }
.story-map-embed .atlas-toolbar {
  grid-template-areas: "controls";
  grid-template-columns: 1fr;
  padding: 4px 10px;
}
.story-map-embed .atlas-toolbar h1, .story-map-embed .title-actions { display: none; }
.controls-content, .map-legend {
  background: #fffef9f5;
  border: 1px solid #ddd8ce;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}
#map-controls > summary {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 9px;
  white-space: nowrap;
}
#map-controls[open] > summary { background: #eae7de; border-color: #9a9283; }
.controls-content {
  max-height: calc(100dvh - 100px);
  overflow: auto;
  overscroll-behavior: contain;
  position: absolute;
  right: 14px;
  top: calc(100% + 7px);
  width: min(316px, calc(100vw - 28px));
}
.map-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: space-between;
  padding: 10px 10px 4px;
}
.map-modes { display: flex; gap: 3px; }
.map-modes button[aria-pressed="true"] {
  background: #eae7de;
  border-color: #9a9283;
}

.records-controls { padding: 7px 10px 8px; }
.search-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
#search {
  background: white;
  border: 1px solid #cbc6bb;
  border-radius: 5px;
  font-size: 14px;
  padding: 6px 8px;
  width: 100%;
}
#search::placeholder { color: var(--muted); }
.ownership-filters { margin-top: 7px; }
.ownership-filters summary { color: var(--accent); font-size: 12px; font-weight: 650; }
#owner-filters { border: none; margin: 5px 0 0; padding: 0; }
#owner-filters label { align-items: center; display: flex; font-size: 12px; gap: 7px; min-height: 24px; }
#owner-filters input { accent-color: var(--accent); margin: 0; }
#owner-filters .filter-total { color: var(--muted); margin-left: auto; }
#filter-count { color: var(--muted); margin-left: 3px; }
.results-toolbar {
  align-items: center;
  background: #f6f3ed;
  border-block: 1px solid var(--line);
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 5px 10px;
}
#record-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#sort {
  background: var(--paper);
  border: 1px solid #d4cfc3;
  border-radius: 4px;
  font-size: 12px;
  padding: 3px;
}
.results-scroll { max-height: min(34vh, 335px); overflow: auto; overscroll-behavior: contain; }
.record-list { list-style: none; padding: 0; }
.record-list li + li { border-top: 1px solid #ebe7de; }
.record-button {
  background: transparent;
  border: none;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}
.record-button:hover, .record-button[aria-pressed="true"] { background: #f1ede4; }
.record-button:focus-visible { outline-offset: -2px; }
.record-title { align-items: baseline; display: flex; font-size: 13px; font-weight: 700; gap: 7px; }
.record-title .status-dot { height: 8px; width: 8px; flex-basis: 8px; }
.record-address, .record-owner, .record-sort-value { color: var(--muted); font-size: 11px; padding-left: 15px; }
.record-sort-value { color: var(--accent); font-weight: 650; }
.show-more { display: block; margin: 8px auto; }
.no-results { color: var(--muted); font-size: 13px; padding: 11px; }

.map-legend {
  bottom: 23px;
  left: 8px;
  max-width: calc(100% - 110px);
  padding: 8px 13px;
  pointer-events: none;
  position: absolute;
  width: max-content;
  z-index: 550;
}
.map-legend h2 { font-size: 13px; margin-bottom: 5px; }
.map-legend ul { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; padding: 0; }
.map-legend li {
  align-items: center;
  color: #463f36;
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.25;
}
.legend-dot, .status-dot {
  background: var(--marker);
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 10px;
  height: 10px;
  width: 10px;
}
.map-empty {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  left: 50%;
  max-width: 85%;
  padding: 8px 10px;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  z-index: 550;
}

.atlas-property-popup .maplibregl-popup-content, .docked-popup {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--card-shadow);
}
.atlas-property-popup .maplibregl-popup-content { border-radius: 8px; line-height: 1.35; padding: 0; }
#map .atlas-property-popup .maplibregl-popup-close-button, .popup-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 21px;
  height: 33px;
  line-height: 31px;
  position: absolute;
  right: 3px;
  text-align: center;
  top: 3px;
  width: 33px;
}
.atlas-property-popup .maplibregl-popup-close-button:focus-visible,
.popup-close:focus-visible { outline-offset: -3px; }
.docked-popup {
  border: 1px solid #ddd8ce;
  border-radius: 8px;
  left: 50%;
  max-height: min(63vh, 420px);
  overflow: auto;
  position: absolute;
  top: 46%;
  transform: translate(-50%, -46%);
  width: min(320px, calc(100% - 36px));
  z-index: 950;
}
.docked-popup.story-pinned {
  left: auto;
  right: 12px;
  top: 12px;
  transform: none;
  width: min(280px, calc(100% - 24px));
}
.property-card { font: 13px/1.4 var(--atlas-font); padding: 13px 29px 13px 14px; }
.atlas-property-popup .property-card {
  max-height: clamp(115px, calc(100dvh - 150px), 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  width: min(320px, calc(100vw - 52px));
}
.property-card h2 { font-size: 19px; letter-spacing: -.015em; line-height: 1.15; }
.property-card h2:focus { outline: none; }
.property-card .detail-address, .property-card .location-note { color: var(--muted); margin: 4px 0 0; }
.property-card .detail-status { align-items: center; display: flex; gap: 6px; margin: 7px 0 0; }
.record-facts {
  border-block: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin: 9px 0;
  padding: 8px 0;
}
.measure dt { color: var(--muted); font-size: 11px; }
.record-facts dt { color: var(--ink); font-size: 10.25pt; font-weight: 700; }
.record-facts dd, .measure dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.record-facts dd { font-size: 11.75pt; font-weight: 400; }
.record-measures { display: grid; gap: 5px; grid-template-columns: 1fr 1fr; margin: 0 0 9px; }
.measure { background: #f1efe8; border-radius: 4px; padding: 5px 6px; }
.measure dd { font-size: 16px; font-weight: 650; }
.measure dd.missing { color: var(--muted); font-size: 12px; font-weight: 400; }
.property-sources { color: var(--muted); font-size: 9pt; font-weight: 400; }
.property-sources h3 { color: var(--ink); font: inherit; margin: 0 0 3px; }
.property-sources p + p { margin-top: 4px; }
.property-sources .detail-notes { overflow-wrap: anywhere; white-space: pre-wrap; }

dialog {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  max-width: min(515px, calc(100% - 28px));
  padding: 18px;
}
dialog::backdrop { background: #211e1880; }
.dialog-heading { align-items: center; display: flex; gap: 14px; justify-content: space-between; }
dialog p { color: var(--muted); margin-top: 12px; }

@media (max-width: 720px) {
  .atlas-toolbar {
    grid-template-areas: "title controls" "links links";
    grid-template-columns: minmax(0, 1fr) auto;
    padding-inline: 10px;
  }
  .controls-content { right: 10px; width: min(316px, calc(100vw - 20px)); }
  #search { font-size: 16px; }
  .map-legend { padding: 7px 9px; }
}

@media (max-width: 320px) {
  .map-legend { bottom: 37px; }
}
