:root {
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --fg: #1c2430;
  --fg-soft: #5b6676;
  --line: #dde2ea;
  /* the site's skin (sites.toml) sets --header, --accent, --accent-text,
     --link, --font and --logo-height */
  --header: var(--bg);
  --accent: #1a56db;
  --accent-text: #ffffff;
  --link: var(--accent);
  --accent-soft: color-mix(in srgb, var(--link) 11%, white);
  --logo-height: 36px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --warn: #8a4b00;
  --warn-soft: #fff4e0;
  --shadow: 0 2px 12px rgba(16, 24, 40, .2);
  --radius: 12px;
  /* the gap between the map's edge and what floats on it */
  --edge: 12px;
  font: 14px/1.45 var(--font);
  color: var(--fg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #e5e3df; }
#map { position: absolute; inset: 0; }

aside { position: absolute; z-index: 3; background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- search ------------------------------------------------------------ */
/* above the tools and the card: the list of results drops over them */
#finder { top: var(--edge); left: var(--edge); width: 380px; max-width: calc(100vw - 2 * var(--edge)); overflow: hidden; z-index: 4; }
#finder.unskinned { visibility: hidden; }
.finder-body { padding: 8px; }
#brand { background: var(--header); padding: 12px 14px; box-shadow: inset 0 -1px 0 rgba(16, 24, 40, .1); }
#brand img { display: block; height: var(--logo-height); max-width: 100%; object-fit: contain; object-position: left center; }
/* a dark logo on a dark band, as mydeedsearch has it */
#brand.plate img { height: calc(var(--logo-height) + 12px); padding: 6px 10px; background: #fff; border-radius: 8px; }
h1 { font-size: 17px; margin: 4px 4px 10px; }
/* Inside a site's page the site's own header is right above the map: the
   logo band and the heading would only take the map's room (the heading
   stays for screen readers) */
.embedded #brand { display: none !important; }
.embedded h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
#search-form { display: flex; gap: 6px; }
#search {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit; color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); outline: none;
}
#search:focus { border-color: var(--link); background: var(--bg); }
#search-form button {
  display: flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; padding: 0 14px; border-radius: 8px; border: 0;
  background: var(--accent); color: var(--accent-text); cursor: pointer;
}
#search-form button .icon { display: none; width: 20px; height: 20px; }
#results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 40vh; overflow-y: auto; }
#results li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#results li:hover, #results li[aria-selected="true"] { background: var(--accent-soft); }
#results .meta { font-size: 12px; color: var(--fg-soft); }
#results .empty { color: var(--fg-soft); cursor: default; font-size: 12px; }
#results .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-soft); cursor: default; padding: 10px 10px 2px; }
#results .group:hover { background: none; }
.badge { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px;
         border-radius: 10px; background: var(--warn-soft); color: var(--warn); vertical-align: 1px; }
/* the examples: while the box is empty and has the cursor, never under a list */
#help { display: none; padding: 0 4px 2px; }
#finder.focused.empty #help { display: block; }
#results:not([hidden]) + #help { display: none !important; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--fg-soft); }
#powered { margin: 6px 0 0; font-size: 11px; color: var(--fg-soft); text-align: right; }

/* ---- the tools: Map | Satellite on a phone, full screen ----------------- */
/* beside the search bar on a wide map (Google's own Map | Hybrid is top right) */
#tools { position: absolute; z-index: 3; top: var(--edge); left: calc(2 * var(--edge) + 380px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; min-width: 42px; padding: 0 12px; border: 0; border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 13px; color: var(--fg); background: var(--bg);
  box-shadow: var(--shadow); cursor: pointer;
}
.tool:hover { color: var(--link); }
.tool svg { width: 22px; height: 22px; }
#fullscreen { padding: 0; }
#maptype { display: none; }

/* ---- the property card -------------------------------------------------- */
/* below Google's Map | Hybrid switch, top right */
#card { top: 62px; right: var(--edge); width: 360px; max-width: calc(100vw - 2 * var(--edge)); max-height: calc(100% - 120px); overflow-y: auto; padding: 16px 16px 14px; }
.close { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--fg-soft); cursor: pointer; width: 30px; height: 30px; border-radius: 6px; }
.close:hover { background: var(--bg-soft); }
.kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-soft); display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 14px; height: 10px; border: 2px solid; border-radius: 2px; }
.title { font-size: 20px; font-weight: 700; margin: 2px 0 2px; padding-right: 24px; }
.subtitle { color: var(--fg-soft); margin-bottom: 8px; }
.btn { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--fg); cursor: pointer; }
.btn:hover { border-color: var(--link); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; padding: 9px 14px; width: 100%; margin-top: 12px; }
/* "More details": a phone's card opens small (below) */
.more { display: none; font: inherit; font-size: 13px; padding: 2px 0; border: 0; background: none; color: var(--link); cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
td { padding: 4px 0; vertical-align: top; }
td:first-child { color: var(--fg-soft); width: 38%; padding-right: 8px; }
.note { margin: 10px 0; padding: 9px 11px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.note.ok { background: var(--accent-soft); color: var(--fg); }
.also { margin-top: 12px; font-size: 13px; color: var(--fg-soft); }
.also a, .note a { color: var(--link); cursor: pointer; text-decoration: none; }
.payload { margin-top: 10px; font: 12px ui-monospace, monospace; background: var(--bg-soft); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; }
.loading { color: var(--fg-soft); }

/* ---- legend, hints ------------------------------------------------------ */
#legend { left: var(--edge); bottom: 28px; padding: 8px 12px; font-size: 13px; }
#legend label { display: flex; align-items: center; gap: 7px; padding: 2px 0; cursor: pointer; }
#legend input { accent-color: var(--link); }
#legend label.off-zoom { color: var(--fg-soft); }
#legend .z { font-size: 11px; color: var(--fg-soft); margin-left: auto; padding-left: 10px; }
/* at the bottom, clear of the search bar and the card */
#zoom-hint {
  position: absolute; z-index: 2; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(28, 36, 48, .85); color: #fff; padding: 7px 14px; border-radius: 20px; font-size: 13px; pointer-events: none;
}
#setup {
  position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; background: rgba(20, 26, 34, .55);
}
#setup > div { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; max-width: 520px; }
#setup code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }

@media (min-width: 721px) {
  /* a wide map has room for the examples until the visitor starts */
  #finder.empty:not(.used) #help { display: block; }
}

/* ---- a phone: a search bar at the top, the card a sheet at the bottom --- */
@media (max-width: 720px) {
  :root { --edge: 8px; }
  #finder { right: var(--edge); width: auto; max-width: none; }
  .finder-body { padding: 6px; }
  /* the bar is all there is room for */
  #brand { display: none !important; }
  h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  /* 16px: a smaller box makes iOS zoom the page in when it gets the cursor */
  #search { font-size: 16px; padding: 8px 10px; }
  #search-form button { padding: 0 12px; }
  #search-form button .label { display: none; }
  #search-form button .icon { display: block; }
  #results { max-height: 50vh; }

  /* under the search bar (6 + 40 + 6), at the right */
  #tools { top: calc(2 * var(--edge) + 52px); right: var(--edge); left: auto; }
  #maptype { display: inline-flex; }

  #card {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 62%;
    border-radius: var(--radius) var(--radius) 0 0; padding: 14px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .title { font-size: 18px; }
  .note { margin: 6px 0 8px; padding: 7px 10px; font-size: 12px; }
  .btn.primary { margin-top: 10px; padding: 11px 14px; }
  .more { display: inline-block; }
  .details { margin-top: 6px; }
  /* opened small: what it is, what else is here, the warnings and the
     button; the details and the reassurances are a tap away */
  #card.peek .details, #card.peek .note.ok { display: none; }

  #legend { display: none; }
  /* under the search bar, at the left: the tools are at the right */
  #zoom-hint { top: calc(2 * var(--edge) + 56px); bottom: auto; left: var(--edge); transform: none; max-width: calc(100% - 2 * var(--edge) - 110px); }
}
