/* Layout: full-bleed map; a floating search bar on top, a filter dock bottom-left,
   detail sheets on the right (bottom sheets on phones). Blue-plaque roundel as the one bold note. */
:root {
  --paper: #eef1f0;      /* page and map-adjacent ground: cool OS-sheet grey */
  --panel: #ffffff;
  --panel-2: #f5f7f7;
  --ink: #17242e;
  --muted: #586773;
  --line: #d6dcdf;
  --plaque: #1f4e8c;     /* blue plaque */
  --plaque-ink: #ffffff;
  --focus: #1f4e8c;
  --shadow: 0 1px 2px rgb(23 36 46 / .08), 0 6px 24px rgb(23 36 46 / .12);
  --dot-ring: #ffffff;

  --f-display: "Young Serif", Georgia, "Times New Roman", serif;
  --f-ui: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 10px;
  --gap: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171c; --panel: #1a2228; --panel-2: #212b32; --ink: #e6ebee; --muted: #9ba8b1;
    --line: #2e3a42; --plaque: #2f64b4; --plaque-ink: #ffffff; --focus: #8fb4ee;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .4); --dot-ring: #1a1a19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11171c; --panel: #1a2228; --panel-2: #212b32; --ink: #e6ebee; --muted: #9ba8b1;
  --line: #2e3a42; --plaque: #2f64b4; --plaque-ink: #ffffff; --focus: #8fb4ee;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .4); --dot-ring: #1a1a19;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 var(--f-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: var(--focus); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--panel); padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico .fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- map */
.stage { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; background: var(--paper); }
.maplibregl-ctrl-bottom-right { bottom: calc(env(safe-area-inset-bottom, 0px)); }
.maplibregl-ctrl-attrib { font: 11px/1.4 var(--f-ui); background: color-mix(in srgb, var(--panel) 80%, transparent) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a, .maplibregl-ctrl-attrib-inner { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: var(--ctrl-filter, none); }
.maplibregl-ctrl-group { background: var(--panel); box-shadow: var(--shadow) !important; border-radius: 8px; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: var(--ctrl-filter, none); }
:root[data-theme="dark"] { --ctrl-filter: invert(1) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ctrl-filter: invert(1) hue-rotate(180deg); } }

.loading { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 5; display: flex; gap: 10px; align-items: center;
  background: var(--panel); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 500; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--plaque); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tip { position: absolute; z-index: 6; pointer-events: none; max-width: 280px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; box-shadow: var(--shadow); font-size: 13px; line-height: 1.35; }
.tip b { display: block; font-weight: 600; }
.tip span { color: var(--muted); }

/* ---------------------------------------------------------------- top bar */
.bar { position: fixed; z-index: 20; top: calc(10px + env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; gap: 10px; align-items: center; pointer-events: none; }
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); background: var(--panel);
  padding: 5px 14px 5px 5px; border-radius: 999px; box-shadow: var(--shadow); flex: none; }
.plaque { width: 38px; height: 38px; }
.plaque-disc { fill: var(--plaque); }
.plaque-rim { fill: none; stroke: var(--plaque-ink); stroke-width: 1.2; opacity: .9; }
.plaque-mark { fill: none; stroke: var(--plaque-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 17px/1.15 var(--f-display); letter-spacing: .005em; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.search { position: relative; flex: 1 1 320px; max-width: 460px; }
.search input { width: 100%; height: 48px; border: 1px solid transparent; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow);
  padding: 0 16px 0 44px; font-size: 15px; outline: none; }
.search input:focus { border-color: var(--focus); }
.search-ico { position: absolute; left: 15px; top: 14px; color: var(--muted); pointer-events: none; }
.results { position: absolute; top: 54px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--panel); border-radius: 14px;
  box-shadow: var(--shadow); max-height: min(60vh, 460px); overflow: auto; }
.results li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: var(--panel-2); }
.results .r-main { min-width: 0; flex: 1; }
.results .r-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .r-sub { display: block; font-size: 12.5px; color: var(--muted); }
.results .r-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 2px; cursor: default; }
.results .r-head:hover { background: none; }
.results .r-empty { color: var(--muted); cursor: default; }

.tools { display: flex; gap: 6px; margin-left: auto; background: var(--panel); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn[aria-expanded="true"] { background: var(--plaque); color: var(--plaque-ink); }
.icon-btn.small { width: 34px; height: 34px; }

/* ---------------------------------------------------------------- sheets (panel, card, list) */
.sheet { position: fixed; z-index: 15; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(70px + env(safe-area-inset-top, 0px));
  width: min(380px, calc(100vw - 24px)); max-height: calc(100% - 150px - env(safe-area-inset-top, 0px)); overflow: auto;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 4px 18px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.sheet-head h2 { margin: 0; font: 18px/1.25 var(--f-display); }
.sheet-body { padding: 4px 18px 18px; display: grid; gap: 18px; }
.block h3, .frow h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.note { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.basemaps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.basemaps button { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 11px; cursor: pointer; }
.basemaps button b { display: block; font-weight: 600; font-size: 14px; }
.basemaps button span { font-size: 12px; color: var(--muted); }
.basemaps button[aria-checked="true"] { border-color: var(--plaque); box-shadow: inset 0 0 0 1px var(--plaque); }
.jumps { display: flex; flex-wrap: wrap; gap: 6px; }
.jumps button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; }
.jumps button:hover { background: var(--panel-2); }
.sizes { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.sizes span { display: inline-flex; align-items: center; gap: 6px; }
.sizes i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--muted); }

/* card */
.card { padding-bottom: 6px; }
.card-body { padding: 0 18px 16px; display: grid; gap: 14px; }
.card .kind { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.card .kind i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--line); }
.card h2 { font: 21px/1.25 var(--f-display); margin: 4px 0 0; text-wrap: balance; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.badge.grade { background: var(--plaque); color: var(--plaque-ink); border-color: var(--plaque); }
.facts { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--f-mono); font-size: 13px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a, .links button { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; text-decoration: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; background: var(--panel); color: var(--ink); cursor: pointer; }
.links a.primary { background: var(--plaque); color: var(--plaque-ink); border-color: var(--plaque); }
.links .ico { width: 16px; height: 16px; }
.card .fine { font-size: 12px; color: var(--muted); margin: 0; }

/* list */
.list-info { margin: 0; padding: 0 18px 8px; color: var(--muted); font-size: 13.5px; }
.list-items { list-style: none; margin: 0; padding: 0 8px 10px; }
.list-items li button { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.list-items li button:hover { background: var(--panel-2); }
.list-items i { margin-top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.list-items .l-main { min-width: 0; }
.list-items .l-name { display: block; }
.list-items .l-sub { display: block; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- dock */
.dock { position: fixed; z-index: 14; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(560px, calc(100vw - 24px)); display: grid; gap: 8px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.dock-actions { display: flex; gap: 8px; justify-self: start; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--panel-2); }
.btn[aria-expanded="true"] { outline: 2px solid var(--plaque); outline-offset: -2px; }
.btn-plaque { background: var(--plaque); color: var(--plaque-ink); }
.btn-plaque:hover { background: color-mix(in srgb, var(--plaque) 88%, black); }
.btn:disabled { opacity: .5; cursor: default; }

.filters { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); max-height: calc(100vh - 210px); display: flex; flex-direction: column; }
.filters-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; }
.fold { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 10px; border-radius: 10px; cursor: pointer; min-width: 0; flex: 1; text-align: left; }
.fold:hover { background: var(--panel-2); }
.fold h2 { margin: 0; font: 16px/1.2 var(--f-display); }
.summary { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chev { margin-left: auto; transition: rotate .2s; }
.fold[aria-expanded="false"] .chev { rotate: 180deg; }
.count { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters-body { padding: 4px 16px 14px; display: grid; gap: 12px; overflow: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px 4px 9px;
  cursor: pointer; font-size: 13.5px; line-height: 1.3; }
.chip:hover { background: var(--panel-2); }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--panel); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .75; }
.chip.empty { opacity: .45; }

/* ---------------------------------------------------------------- dialog, toast */
.about { border: 0; padding: 0; border-radius: 18px; background: var(--panel); color: var(--ink); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow); }
.about::backdrop { background: rgb(10 16 20 / .45); }
.about-body { padding: 4px 22px 22px; font-size: 14.5px; }
.about-body p, .about-body li { max-width: 65ch; }
.about-body h3 { font: 15px/1.3 var(--f-display); margin: 18px 0 6px; }
.about-body ul { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
.about-body table { border-collapse: collapse; font-size: 13.5px; width: 100%; font-variant-numeric: tabular-nums; }
.about-body td, .about-body th { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); text-align: left; }
.about-body td:not(:first-child), .about-body th:not(:first-child) { text-align: right; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); translate: -50% 20px; opacity: 0; transition: .2s;
  background: var(--ink); color: var(--panel); padding: 9px 16px; border-radius: 999px; font-weight: 500; pointer-events: none; }
.toast.on { opacity: 1; translate: -50% 0; }
.nojs { position: fixed; inset: 40% 20px auto; text-align: center; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 760px) {
  .brand { padding: 4px; }
  .brand-text { display: none; }
  .tools { padding: 2px; gap: 0; }
  .icon-btn { width: 38px; height: 38px; }
  .search input { height: 46px; }
  .search { flex-basis: 0; }
  .sheet { left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); width: auto; top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)); max-height: 62%; z-index: 25; border-radius: 18px; }
  .dock { left: max(8px, env(safe-area-inset-left, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
  .filters { max-height: 52vh; }
  .count { font-size: 12px; }
  .maplibregl-ctrl-bottom-right { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
  .bar { gap: 6px; left: 8px; right: 8px; }
  #btn-about { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }

/* Open Scans: the 3D / photos link in the site card */
.links.contrib { margin-bottom: 8px; }
