:root {
  --ink: #172126;
  --muted: #647077;
  --paper: #f9f7f1;
  --paper-strong: #fffdf7;
  --line: rgba(23, 33, 38, .14);
  --sea: #e8ece7;
  --accent: #0f766e;
  --hotel: #315f73;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 var(--sans); }
button, input, select { font: inherit; }
button, a, select, input { touch-action: manipulation; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 4px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }

/* London's flush paper sidebar, editorial title and uninterrupted map. */
main { display: grid; grid-template-columns: 390px minmax(0, 1fr); height: 100svh; min-height: 640px; background: var(--sea); border-bottom: 1px solid var(--line); }
.sidebar { position: relative; z-index: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 34px 30px 24px; overflow-y: auto; background: var(--paper); border-right: 1px solid var(--line); box-shadow: 10px 0 32px #1b262b0b; }
.masthead { margin: 0 0 17px; }
h1 { margin: 0; font: 500 46px/.97 var(--serif); line-height: calc(.97em + 1pt); letter-spacing: calc(-.048em + 1pt); text-wrap: balance; }
h1 span { display: block; }
.intro { margin: 0 0 23px; font-size: 15.5px; line-height: 1.52; color: #47545b; }
.layers { margin: 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); }
.layers legend { float: left; width: 100%; margin-bottom: 10px; color: #59666d; font-size: 10px; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.layers label { display: flex; clear: both; align-items: center; gap: 10px; margin-bottom: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: #ffffffa6; cursor: pointer; transition: background .15s, border-color .15s; }
.layers label:hover { background: #fff; border-color: #17212650; }
.layers label:has(input:checked) { background: #e5ede7; border-color: #0f766e70; }
.layers input { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--accent); }
.layers span { font-size: 13px; font-weight: 650; }
.layers small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
#layers-empty { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
#choose-comparisons { display: block; margin-top: 8px; padding: 7px 10px; color: var(--ink); background: #ffffffa6; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-weight: 600; }
#choose-comparisons:hover { background: #fff; border-color: #17212650; }
.sidebar-footer { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.method-link { font-size: 13px; }
.edition { color: var(--muted); font-size: 12px; }
.edition > span { display: block; margin-top: 2px; }

/* Compact map controls sit over the tiles, leaving the legend in the sidebar. */
.mobile-comparison { display: none; }
.map-section { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.map-toolbar { position: absolute; z-index: 2; top: 20px; left: 20px; right: 78px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.map-toolbar > * { pointer-events: auto; }
.view-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #f9f7f1f5; box-shadow: 0 2px 7px #17212612; }
.view-switch button { min-height: 34px; padding: 6px 13px; border: 0; border-radius: 4px; background: transparent; font-size: 12px; font-weight: 600; }
.view-switch .active { background: #e3e8e1; }
.hotel-toggle { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f9f7f1f5; box-shadow: 0 2px 7px #17212612; font-size: 12px; font-weight: 600; }
.hotel-toggle input { accent-color: var(--hotel); }
.map-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.map-wrap > svg { position: absolute; inset: 0; height: 100%; width: 100%; cursor: grab; touch-action: none; }
.map-wrap > svg.dragging { cursor: grabbing; }
#map:focus-visible { outline-offset: -3px; }
.neighborhood { stroke: #f9f7f1; stroke-width: 1.1; vector-effect: non-scaling-stroke; cursor: inherit; transition: fill .2s; }
.hotel { fill: var(--hotel); fill-opacity: .7; stroke: #fffdf7; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: inherit; }
.map-name { fill: #394b50; stroke: #f9f7f1; stroke-width: 2.5; stroke-opacity: .9; paint-order: stroke; stroke-linejoin: round; text-anchor: middle; font-weight: 500; letter-spacing: 0; }
.zoom-controls { position: absolute; z-index: 2; right: 20px; top: 20px; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #f9f7f1f5; box-shadow: 0 2px 7px #17212612; }
.zoom-controls button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 24px; line-height: 1; }
.zoom-controls button + button { border-top: 1px solid var(--line); }
.zoom-controls button:hover { background: #17212608; }
.zoom-controls button:disabled { color: #65747770; cursor: default; background: transparent; }
.map-distance { position: absolute; z-index: 2; left: 20px; bottom: 30px; color: #394b50; font: 11px/1.5 var(--sans); pointer-events: none; }
.map-distance > div { padding: 0 4px; border: solid #59666d; border-width: 0 1px 2px; background: #f9f7f1db; white-space: nowrap; }
.map-distance > div + div { margin-top: 3px; }
.navigation-help { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-settings-toggle { position: absolute; z-index: 2; top: 100px; right: 20px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; background: #f9f7f1f5; box-shadow: 0 2px 7px #17212612; }
.map-settings-toggle:hover, .map-settings-toggle[aria-expanded="true"] { background: #e3e8e1; }
.map-settings-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.north { position: absolute; top: 150px; right: 30px; font: 22px/1 var(--serif); text-align: center; color: #657477; pointer-events: none; }
.north span { display: block; margin-top: 5px; font: 12px var(--sans); }
.tooltip { position: absolute; z-index: 5; max-width: 260px; padding: 13px 16px; color: var(--ink); background: var(--paper-strong); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 25px #17212620; pointer-events: none; font-size: 13px; }
.tooltip strong { display: block; margin-bottom: 5px; font: 400 22px/1.12 var(--serif); letter-spacing: -.025em; }
.map-legend { width: 100%; margin-top: 20px; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 12px; }
.map-legend > strong { display: block; margin-bottom: 11px; color: #59666d; font-size: 10px; font-weight: 760; letter-spacing: .07em; text-transform: uppercase; }
.map-legend .density-scale { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: start; }
.density-band { min-width: 0; text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.density-band i { display: block; height: 9px; margin-bottom: 5px; }
.density-band:first-child i { border-radius: 5px 0 0 5px; }
.density-band:last-child i { border-radius: 0 5px 5px 0; }
.density-band > span { display: block; overflow-wrap: anywhere; }
.density-band .band-name { min-height: 2.5em; padding: 0 2px; line-height: 1.2; font-weight: 600; overflow-wrap: normal; }
.map-legend .scale-meaning { position: relative; display: flex; justify-content: space-between; margin: 4px 0 10px; color: var(--muted); font-size: 11px; }
.scale-meaning .average-marker { position: absolute; left: calc(100% * 3 / 7); transform: translateX(-50%); }
.scale-meaning span { text-align: center; }
.scale-meaning span:first-child { text-align: left; }
.scale-meaning span:last-child { text-align: right; }
.map-legend > div:last-of-type { display: flex; align-items: center; gap: 10px; padding-top: 7px; border-top: 1px solid var(--line); }
.map-legend svg { width: 65px; height: 30px; fill: var(--hotel); fill-opacity: .7; stroke: #fffdf7; }
.map-legend small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.missing-key { display: inline-block; width: 14px; height: 10px; border: 1px solid #bec8cb; background: repeating-linear-gradient(135deg, #edf0f0 0px, #edf0f0 4px, #bec8cb 4px, #bec8cb 5px); }

/* Settings use the same warm paper and quiet control styling as the map. */
.map-settings-panel { position: fixed; inset: 20px 66px auto auto; width: 360px; max-width: calc(100vw - 24px); max-height: calc(100svh - 40px); margin: 0; padding: 22px; overflow-y: auto; overscroll-behavior: contain; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 45px #17212626; }
.map-settings-panel::backdrop { background: #17212624; }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-header h2 { margin: 0; font: 400 29px/1.1 var(--serif); letter-spacing: -.035em; }
#settings-close { flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin: -5px -5px -5px 0; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: 26px; line-height: 1; }
#settings-close:hover { color: var(--ink); background: #17212608; }
#settings-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.settings-intro { margin: 12px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-group { min-width: 0; margin: 0; padding: 0 0 16px; border: 0; }
.settings-group + .settings-group { padding-top: 16px; border-top: 1px solid var(--line); }
.settings-group legend { padding: 0 0 8px; color: #59666d; font-size: 10px; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.settings-option { display: flex; align-items: flex-start; gap: 10px; margin: 0 -7px 2px; padding: 8px 7px; border-radius: 6px; cursor: pointer; }
.settings-option:hover { background: #ffffffa6; }
.settings-option input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.settings-option > span { min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.45; }
.settings-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.settings-option:has(input:disabled) { cursor: default; opacity: .65; }
.settings-option:has(input:disabled):hover { background: transparent; }
.settings-unavailable { margin: 0; padding: 15px 0 17px; border-top: 1px solid var(--line); }
.settings-unavailable h3 { margin: 0 0 6px; color: #59666d; font-size: 10px; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.settings-unavailable p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
#settings-reset { flex: none; min-height: 36px; padding: 7px 10px; background: #ffffffa6; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-weight: 600; }
#settings-reset:hover { background: #fff; border-color: #17212650; }
.settings-actions small { flex: 1 1 120px; color: var(--muted); font-size: 11px; line-height: 1.45; }

/* Source notes follow the map on the same warm paper. */
.methodology { padding: 40px 30px; border-top: 1px solid var(--line); background: var(--paper); scroll-margin-top: 20px; }
.methodology > h2 { margin: 0 0 30px; font: 400 34px/1.1 var(--serif); letter-spacing: -.04em; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 32px; }
.method-grid h3 { margin: 0; font-size: 15px; font-weight: 650; }
.method-grid p { color: #596463; font-size: 14px; line-height: 1.6; }
.method-grid a { font-size: 13px; overflow-wrap: anywhere; }
.method-grid a + a, #context-source-links a { display: block; margin-top: 8px; }
footer { display: flex; justify-content: space-between; gap: 20px; margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
noscript { display: block; padding: 20px; }

@media (max-width: 1120px) {
  main { grid-template-columns: 340px minmax(0, 1fr); }
  .sidebar { padding: 28px 24px 22px; }
  .methodology { padding-inline: 24px; }
  h1 { font-size: 42px; }
}
@media (max-width: 760px), (max-height: 500px) and (max-width: 1000px) {
  main { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .sidebar { display: contents; }
  .masthead { order: 0; margin: 0; padding: 24px 22px 13px; background: var(--paper); }
  h1 { max-width: 580px; font-size: 28px; line-height: calc(1em + 1pt); text-wrap: balance; }
  h1 span { display: inline; font-size: 1em; }
  .intro { order: 1; margin: 0; padding: 0 22px 20px; font-size: 15px; background: var(--paper); }
  .layers { display: none; order: 3; padding: 22px 22px 0; border: 0; background: var(--paper); }
  .layers legend { float: left; width: 100%; margin-bottom: 9px; }
  .layers label { clear: both; padding: 12px; }
  .layers small { display: inline; margin-left: 6px; }
  #layers-empty { order: 3; margin: 12px 0 0; padding: 0 22px; background: var(--paper); }
  #choose-comparisons { min-height: 42px; }
  .map-section { order: 2; flex: none; height: clamp(400px, 64svh, 560px); margin: 0; border-block: 1px solid var(--line); }
  .map-toolbar { top: 14px; left: 14px; right: 70px; gap: 7px; }
  .view-switch button { min-height: 44px; padding: 6px 12px; }
  .hotel-toggle { min-height: 44px; padding: 8px 10px; }
  .map-legend { order: 5; width: auto; margin: 20px 22px 0; }
  .zoom-controls { top: 14px; right: 14px; }
  .zoom-controls button { width: 44px; height: 44px; }
  .map-settings-toggle { top: 114px; right: 14px; width: 44px; height: 44px; }
  .map-settings-toggle svg { width: 21px; height: 21px; }
  .north { top: 173px; right: 29px; }
  .mobile-comparison { display: block; flex: none; position: relative; z-index: 2; padding: 10px max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left)); background: var(--paper); border-top: 1px solid var(--line); }
  .mobile-comparison label { display: block; margin-bottom: 5px; color: #59666d; font-size: 12px; font-weight: 650; }
  #mobile-layer { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-strong); font-size: 16px; }
  .map-settings-panel { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; padding: 0 max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); border: 0; border-radius: 0; }
  html:has(.map-settings-panel[open]) { overflow: hidden; }
  .settings-header { position: sticky; top: 0; z-index: 1; margin: 0 -1px; padding: max(14px, env(safe-area-inset-top)) 1px 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
  #settings-close { width: 44px; height: 44px; margin: 0; }
  .settings-option > span { font-size: 14px; }
  .settings-group legend { font-size: 12px; }
  .density-band { font-size: 12px; }
  .density-band .band-name { min-height: 3.7em; }
  .map-legend > strong { font-size: 12px; }
  .settings-option { min-height: 44px; padding-block: 10px; }
  #settings-reset { min-height: 44px; font-size: 14px; }
  .sidebar-footer { order: 6; flex-direction: row; justify-content: space-between; align-items: end; gap: 16px; margin: 20px 22px 0; padding: 20px 0 24px; background: var(--paper); }
  .edition { text-align: right; }
  .methodology { padding: 30px 22px; }
  .methodology > h2 { font-size: 30px; }
  .method-grid p { font-size: 16px; }
  .method-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  footer { display: block; }
  footer span { display: block; margin-bottom: 8px; }
}
@media (max-width: 430px) {
  .layers small { display: block; margin-left: 0; }
  .view-switch button { padding-inline: 10px; font-size: 13px; }
  .hotel-toggle { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Detail follows the data automatically; the map is a comparison surface. */
.geography-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.fine-grid .neighborhood { stroke: none; }
@media (max-width: 760px), (max-height: 500px) and (max-width: 1000px) { main { background: var(--paper); } .map-section { background: var(--sea); } .geography-note { order: 4; font-size: 12px; margin: 0; padding: 8px 22px 0; background: var(--paper); } }

/* Subdued streets remain legible through the data colors. */
#map { isolation: isolate; user-select: none; }
#map-tiles { opacity: .8; filter: saturate(.35); }
#geography { mix-blend-mode: multiply; }
.neighborhood { fill-opacity: .64; }
.map-attribution { position: absolute; right: 0; bottom: 0; z-index: 2; padding: 2px 5px; background: #f9f7f1eb; color: #49575c; font-size: 12px; line-height: 1.4; }
.map-attribution a { color: inherit; text-decoration-thickness: 1px; }

/* Short landscape phones retain the phone controls and a scrollable page. */
@media (max-height: 500px) and (max-width: 1000px) {
  .map-section { height: clamp(340px, 94svh, 470px); }
  .masthead { padding-top: max(18px, env(safe-area-inset-top)); }
}
