/* pgeo demo page.
   A quiet instrument: a light neutral ground, white panels that float rather than frame,
   and the logo's two colours doing all the signalling - deep blue for anything the user
   can act on, green for a confident answer. One typeface, IBM Plex Sans, with Plex Mono
   wherever digits have to line up. No ornament: the map is the picture. */

:root {
  /* Surfaces, lightest to deepest. --paper is the page ground, --card the panels on it. */
  --paper: #eef0f3;
  --paper-2: #e4e7ec;
  --paper-3: #d8dce3;
  --card: #ffffff;

  /* Text */
  --ink: #16202c;
  --ink-2: #44505f;
  --muted: #76808d;

  /* Lines. Hairlines do most of the separating; --rule is for a deliberate edge. */
  --rule: #cbd2da;
  --hair: rgba(22, 32, 44, 0.09);

  /* From the logo (web/pgeo.svg): the deep blue of the mark and its lighter face, and the
     green of the leaf. Blue is interactive, green is affirmative. */
  --accent: #0264a4;
  --accent-bright: #298ec9;
  --accent-soft: rgba(2, 100, 164, 0.09);
  --ok: #3f8f63;
  --info: #298ec9;
  --danger: #c0392b;

  --shadow: 0 1px 2px rgba(22, 32, 44, 0.06), 0 12px 28px -12px rgba(22, 32, 44, 0.28);
  --shadow-sm: 0 1px 2px rgba(22, 32, 44, 0.08);
  --radius: 12px;
  --radius-sm: 8px;

  --display: 'Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ui: 'Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --narrow: 'Plex Condensed', 'Arial Narrow', sans-serif;
  --mono: 'Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --panel-w: 392px;
  --edge: 0px;              /* the chart neatline is gone; kept so offsets still resolve */
  color-scheme: light;
}


* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
code { font-family: var(--mono); font-size: 0.88em; background: var(--paper-2); padding: 0 3px; }
[hidden] { display: none !important; }

/* ---- Map and frame ----------------------------------------------------------------- */

#map { position: fixed; inset: 0; }
.maplibregl-canvas { outline: none; }

/* The neatline - a chart's graduated border - is gone with the rest of the ornament.
   The element stays in the markup so nothing has to change there; it draws nothing. */
.neatline { display: none; }

/* ---- Cartouche (panel) -------------------------------------------------------------- */

.cartouche {
  position: fixed;
  z-index: 4;
  top: 16px;
  left: 16px;
  width: var(--panel-w);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;              /* so the header's fill follows the corner radius */
  animation: rise 520ms cubic-bezier(.2, .7, .2, 1) both;
}
.cartouche > * { animation: fade 480ms ease both; }
.cartouche > .title { animation-delay: 120ms; }
.cartouche > .tabs { animation-delay: 200ms; }
.cartouche > .panel { animation-delay: 280ms; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }

.title {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--hair);
}
.kicker {
  margin: 0 0 4px;
  font: 500 11px/1 var(--ui);
  letter-spacing: 0.10em;         /* a hint of tracking, not the chart's wide engraving */
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.021em;      /* a large sans needs the tracking pulled in */
}
.t-sub { font-weight: 400; color: var(--accent); }
.edition {
  margin: 8px 0 0;
  font: 400 10.5px/1.4 var(--mono);
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---- Tabs ----------------------------------------------------------------------------- */

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* six tabs: two rows of three */
  margin-top: 4px;
  border-bottom: 1px solid var(--rule);
}
.tabs button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 500 12px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 4px 11px;
  cursor: pointer;
  position: relative;
}
.tabs button + button { border-left: 1px solid var(--hair); }
.tabs button:nth-child(3n + 1) { border-left: 0; }
.tabs button:nth-child(n + 4) { border-top: 1px solid var(--hair); }
.tabs button[aria-selected='true'] { color: var(--ink); font-weight: 600; }
.tabs button[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 18%; right: 18%; bottom: -1px;
  height: 3px;
  background: var(--accent);
}
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.panel {
  padding: 16px 22px 10px;
  overflow-y: auto;
  min-height: 0;
}
.hint { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }

/* ---- Search element ------------------------------------------------------------------- */

.ps { display: block; position: relative; }
.ps-input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 400 19px/1.3 var(--display);
  padding: 8px 30px 8px 0;
  outline: none;
  transition: border-color 160ms;
}
.ps-input::placeholder { color: var(--muted); font-style: italic; }
.ps-input:focus { border-bottom-color: var(--accent); }
.ps-input::-webkit-search-cancel-button { appearance: none; display: none; }
.ps.ps-busy::after { /* sweeping sounding line while a request is in flight */
  content: '';
  position: absolute;
  left: 0; right: 0; top: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100% no-repeat;
  animation: sweep 900ms linear infinite;
}
@keyframes sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.ps-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: absolute;
  z-index: 10;
  left: -8px; right: -8px; top: calc(100% + 4px);
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow-y: auto;
}
.ps-option {
  display: grid;
  grid-template-columns: 78px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  padding: 7px 12px 7px 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.ps-option[aria-selected='true'], .ps-option:hover {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.ps-tag { grid-row: span 2; align-self: start; margin-top: 2px; }
.ps-name { font-weight: 600; }
.ps-detail { font-size: 13px; color: var(--muted); }
.ps-status { font: 11px/1.8 var(--mono); color: var(--muted); min-height: 1.8em; }

/* Layer badges share one scheme across the page. */
.ps-tag, .tag {
  display: inline-block;
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 5px 3px;
  border: 1px solid currentColor;
  color: var(--ink-2);
  text-align: center;
  white-space: nowrap;
}
.ps-tag-address, .tag-address { color: var(--info); }
.ps-tag-venue, .tag-venue { color: var(--accent); }
.ps-tag-street, .tag-street { color: var(--muted); }
.ps-tag-locality, .ps-tag-localadmin, .tag-locality, .tag-localadmin { color: var(--ok); }
.ps-tag-postalcode, .tag-postalcode { color: var(--danger); }

/* ---- Options, switches, chips ---------------------------------------------------------- */

.opts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 6px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch input {
  appearance: none;
  width: 30px; height: 16px;
  margin: 0;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 160ms;
}
.switch input::before {
  content: '';
  position: absolute;
  top: 1.5px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 160ms;
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::before { transform: translateX(13px); background: var(--paper); }
.switch input:focus-visible, .chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.select { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.engine { margin-top: 8px; font-size: 13px; }
select, .grid-form input, textarea {
  font: 400 14px/1.3 var(--ui);
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-bottom: 1.5px solid var(--ink);
  padding: 6px 8px;
  border-radius: 0;
}
select:focus, .grid-form input:focus, textarea:focus { outline: none; border-bottom-color: var(--accent); }

.chips { border: 0; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.chips legend {
  font: 500 10.5px/1 var(--ui);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 0;
}
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  font: 400 12px/1 var(--mono);
  padding: 5px 8px 4px;
  border: 1px solid var(--hair);
  color: var(--ink-2);
  transition: background 120ms, color 120ms, border-color 120ms;
}
.chip:hover span { border-color: var(--ink); }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- Buttons and forms ------------------------------------------------------------- */

.btn {
  appearance: none;
  font: 500 13px/1 var(--ui);
  letter-spacing: 0;              /* the engraved small-caps look went with the chart */
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--paper-3); }
/* the one strong colour on the page: the logo blue, for the action that does the work */
.btn-ink { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ink:hover:not(:disabled) { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
/* Reset sits in the header beside the engine, not among the per-tab controls: it undoes the
   whole page, so it should not read as one more control of whichever tab is open. Quiet by
   default - it is a way out, not somewhere to go - and only picks up warning colour on hover. */
.btn-reset {
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--ink-2);
  background: transparent;
}
.btn-reset:hover:not(:disabled) {
  background: var(--paper-2);
  border-color: var(--accent);
  color: var(--accent);
}

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.grid-form label { display: grid; gap: 5px; font: 500 11.5px/1 var(--ui); letter-spacing: 0.02em; color: var(--muted); }
.grid-form input { text-transform: none; letter-spacing: 0; font-size: 15px; }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form input:invalid:not(:placeholder-shown) { border-bottom-color: var(--danger); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }
textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input[type='file'] { font: 12px var(--mono); color: var(--muted); max-width: 230px; }
progress { width: 100%; height: 6px; margin-top: 12px; appearance: none; border: 0; border-radius: 3px; overflow: hidden; background: var(--paper-2); }
progress::-webkit-progress-bar { background: var(--paper-2); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.status { font: 12px/1.6 var(--mono); color: var(--ink-2); margin: 6px 0; min-height: 1.6em; }

.table-wrap { max-height: 220px; overflow: auto; border-top: 1px solid var(--rule); }
.batch-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.batch-table th {
  position: sticky; top: 0;
  background: var(--paper);
  text-align: left;
  font: 500 10px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 7px 6px;
  border-bottom: 1px solid var(--hair);
}
.batch-table td { padding: 5px 6px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.batch-table td:nth-child(3) { font-family: var(--mono); }
.batch-miss td { color: var(--danger); }

/* ---- Result lists ---------------------------------------------------------------------- */

.results { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: r; }
.results:empty { display: none; }
.results li {
  counter-increment: r;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 8px 4px;
  border-top: 1px solid var(--hair);
  cursor: pointer;
}
.results li::before { content: counter(r); font: 500 11px var(--mono); color: var(--accent); }
.results li:hover, .results li:focus-visible { background: var(--accent-soft); outline: none; }
.results .r-label { font-weight: 500; }
.results .r-meta { grid-column: 2 / -1; font: 11px/1.4 var(--mono); color: var(--muted); }

/* ---- Selected result (a "light list" entry) -------------------------------------------- */

.result {
  border-top: 1px solid var(--rule);
  padding: 14px 22px 18px;
  background: var(--paper);      /* a flat tint; the paper gradient went with the chart */
  animation: fade 300ms ease both;
  overflow-y: auto;
  flex-shrink: 0;
  max-height: 46%;
}
.result h2 {
  margin: 6px 0 10px;
  font: 600 21px/1.2 var(--display);
}
.result dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 5px 12px;
  margin: 0;
  font-size: 13px;
}
.result dt {
  font: 500 10px/1.9 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.result dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
.meter { display: inline-grid; grid-template-columns: repeat(10, 9px); gap: 2px; vertical-align: -1px; margin-right: 8px; }
/* Confidence: the logo blue for a normal reading, green when it is high, red when low. */
.meter i { height: 10px; border: 1px solid var(--rule); border-radius: 1px; }
.meter i.on { background: var(--accent); border-color: var(--accent); }
.meter.hi i.on { background: var(--ok); border-color: var(--ok); }
.meter.lo i.on { background: var(--danger); border-color: var(--danger); }
.result details { margin-top: 10px; }
.result summary {
  cursor: pointer;
  font: 500 10.5px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.result pre {
  margin: 8px 0 0;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--hair);
  font: 11px/1.45 var(--mono);
  white-space: pre-wrap;
}
.close {
  float: right;
  appearance: none;
  border: 0;
  background: none;
  font: 20px/1 var(--display);
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
}
.close:hover { color: var(--accent); }

/* ---- Map furniture ------------------------------------------------------------------- */

.readout {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(var(--edge) + 10px);
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  padding: 5px 12px 4px;
  font: 500 12px/1.2 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border: 1px solid var(--rule);
  pointer-events: none;
  white-space: nowrap;
}
#ro-zoom { color: var(--muted); }

/* The compass rose is gone with the rest of the nautical vocabulary; the map's own
   controls say which way is up. */
.compass { display: none; }

/* Result markers. Two roles, two shapes - see makeMarker() in js/map.js.
   primary: a pin whose tip is the coordinate, so it reads as an overlay, not as map data.
   probe:   a dot centred on the coordinate, so it hides nothing underneath. */
.mark { pointer-events: none; }

.mark-primary { width: 22px; height: 30px; line-height: 0; }
.mark-primary .mark-body {
  fill: var(--accent);
  stroke: var(--paper);
  stroke-width: 2;
  /* A cast shadow rather than a flat outline: on a pale ground the pin needs to lift off the
     map to be read at a glance, and a halo alone disappears over the water fill. */
  filter: drop-shadow(0 2px 3px rgba(22, 32, 44, 0.32));
}
.mark-primary .mark-eye { fill: var(--paper); }

.mark-probe {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--info);
  /* ring, then halo - one box-shadow does the work of both, so the element stays 14px and the
     marker anchors exactly on its centre. */
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(22, 32, 44, 0.22), 0 1px 4px rgba(22, 32, 44, 0.28);
}

.maplibregl-ctrl-group {
  background: var(--paper) !important;
  border: 1px solid var(--rule);
  border-radius: 0 !important;
  box-shadow: none !important;
}
.maplibregl-ctrl-top-right { top: calc(var(--edge) + 10px); right: calc(var(--edge) + 10px); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--edge) + 6px); right: calc(var(--edge) + 8px); }
.maplibregl-ctrl-scale {
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  border-color: var(--ink);
  color: var(--ink);
  font: 11px var(--mono);
}
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--paper) 85%, transparent) !important; font: 11px var(--ui); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }

/* ---- Small screens: the cartouche becomes a bottom sheet ------------------------------- */

@media (max-width: 720px) {
  :root { --edge: 5px; }
  .cartouche {
    top: auto;
    left: calc(var(--edge) + 8px);
    right: calc(var(--edge) + 8px);
    bottom: calc(var(--edge) + 8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 58dvh;
  }
  .title { padding: 12px 16px 8px; }
  h1 { font-size: 28px; }
  .edition, .kicker { display: none; }
  .panel { padding: 12px 16px 8px; }
  .result { padding: 12px 16px 14px; }
  .compass { display: none; }
  .readout { top: calc(var(--edge) + 10px); bottom: auto; left: calc(var(--edge) + 10px); transform: none; font-size: 11px; gap: 10px; }
  .grid-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Engine switch ---------------------------------------------------------------- */

.engine-note { font: 11px/1 var(--mono); color: var(--muted); }

/* ---- Search: more filters ------------------------------------------------------------ */

.more { margin: 10px 0 0; border-top: 1px solid var(--hair); padding-top: 8px; }
.more > summary {
  cursor: pointer;
  font: 500 10.5px/1.8 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.more[open] > summary { color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-top: 10px; }
.field input, .area-row input, #compare-text {
  font: 400 14px/1.3 var(--ui);
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-bottom: 1.5px solid var(--ink);
  padding: 6px 8px;
  border-radius: 0;
  min-width: 0;
}
.field input:focus, .area-row input:focus, #compare-text:focus { outline: none; border-bottom-color: var(--accent); }
.area-pick { margin-top: 10px; font-size: 13px; }
.area-pick > label { display: block; margin-bottom: 4px; }
.area-row { display: flex; gap: 6px; }
.area-row input { flex: 1; }
.area-list { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--hair); background: var(--paper); }
.area-list li { padding: 6px 8px; cursor: pointer; font-size: 13px; }
.area-list li:hover, .area-list li:focus-visible { background: var(--accent-soft); outline: none; }
.area-chosen { margin: 6px 0 0; font: 12px/1.4 var(--mono); color: var(--accent); }

/* ---- Address tab ---------------------------------------------------------------------- */

.addr-row { align-items: flex-end; }
.addr-row .unit { margin-top: 0; width: 96px; }
.best {
  appearance: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  cursor: pointer;
  font: 13px/1.3 var(--ui);
}
.best:hover, .best:focus-visible { background: var(--paper-2); outline: none; }
.best-k { font: 600 10px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.best-c { font: 11px/1 var(--mono); color: var(--ink-2); }
.usps { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 12px; animation: fade 300ms ease both; }
.usps h2 { margin: 6px 0 10px; font: 600 19px/1.2 var(--display); }
.usps-head .badge {
  display: inline-block;
  font: 600 10px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 6px;
  border: 1px solid currentColor;
}
.badge.exact { color: var(--ok); }
.badge.nearest { color: var(--ok); }
.badge.place { color: var(--muted); }
.usps-wrap { position: relative; margin: 0 0 12px; }
.usps-block {
  margin: 0;
  padding: 14px 16px;
  font: 600 15px/1.55 var(--mono);
  letter-spacing: 0.04em;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--paper-3);
  white-space: pre;
  overflow-x: auto;
}
.usps-wrap .copy { position: absolute; top: 8px; right: 8px; padding: 6px 9px 5px; font-size: 10.5px; }
.usps dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 5px 12px;
  margin: 0 0 10px;
  font-size: 13px;
}
.usps dt { font: 500 10px/1.9 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.usps dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
.usps details summary {
  cursor: pointer;
  font: 500 10.5px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.usps pre:not(.usps-block) { font: 11px/1.4 var(--mono); overflow-x: auto; }

/* ---- Compare tab ---------------------------------------------------------------------- */

#compare-form input { flex: 1; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.cmp-col h3 {
  margin: 0;
  font: 600 11px/1.6 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 3px solid;
}
.cmp-pelias h3 { border-color: #1f5f8b; }
.cmp-pgeo h3 { border-color: #c0392b; }
.cmp-col .results li { font-size: 13px; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }

/* The pgeo wordmark in the cartouche header. Sized by width so the 3:1 mark keeps its
   proportions, and dimmed slightly so it sits behind the page title rather than competing. */
.cartouche .title .brand {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 0 0.6rem;
  opacity: 0.92;
}

/* ---- Form filler, Confidence, Area, Nearby (js/demo-tabs.js) --------------------------------- */

/* The callout that follows the best candidate on the chart. MapLibre supplies the popup box; this
   styles what is inside it in the page's own paper-and-ink. */
.maplibregl-popup-content { background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 4px; padding: 0.55rem 0.7rem; font: inherit; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.maplibregl-popup-tip { border-top-color: var(--paper) !important; border-bottom-color: var(--paper) !important; }
.callout { font-size: 0.82rem; line-height: 1.3; }
.callout strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.callout-conf { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.35rem; color: var(--ink-2); font-size: 0.76rem; }

/* Read-only contact form: fields brighten for a moment when they are filled. */
#contact-form input[readonly] { background: var(--paper-2); }
#contact-form.filled input[readonly] { transition: background 0.2s; background: var(--paper-3); }
#form-confirm:disabled { opacity: 0.45; cursor: not-allowed; }

/* Ranked candidate lists (Confidence and Area tabs). */
.conf-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.conf-row { display: grid; grid-template-columns: 1fr; gap: 0.5rem; align-items: start;
  padding: 0.45rem 0.25rem; border-bottom: 1px solid var(--paper-3); cursor: pointer; }
.conf-row:hover { background: var(--paper-2); }
.conf-row .r-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* Nearby: groups by kind, rows with the distance first. */
.near-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.near-group { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2);
  margin-top: 0.6rem; padding-bottom: 0.15rem; border-bottom: 1px solid var(--rule); }
.near-row { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.5rem; padding: 0.3rem 0.25rem; cursor: pointer; }
.near-row:hover { background: var(--paper-2); }
.near-d { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.82rem; }
/* The nearby list is grouped, not ranked: no counters, and headings are not rows. */
.near-list li { counter-increment: none; }
.near-list li::before { content: none; }
.near-list .near-group:hover { background: transparent; }

/* API key entry (Phase 11): in the header, shown until a key is accepted. */
.apikey { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 8px; align-items: center;
  margin-top: 10px; padding: 8px 10px; border: 1.5px solid var(--ink); background: var(--paper-2); }
.apikey label { font: 500 10.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.apikey input { min-width: 0; font: 13px var(--mono); padding: 6px 8px; border: 1px solid var(--hair);
  background: var(--paper); color: var(--ink); }
.apikey .btn { padding: 6px 10px; }
.apikey-note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--ink-2); }
.apikey-note:empty { display: none; }
