/* Class location demonstration: shared styles for the map and methods pages. */

:root {
  --c1: #35b04a;
  --c2: #f5a623;
  --c3: #e0301e;
  --c4: #8e44ad;
  --ink: #1b2531;
  --muted: #586675;
  --line: #d9e0e7;
  --panel: #f6f8fa;
  --paper: #ffffff;
  --accent: #1d5ea8;
  --top: #142231;
  --focus: #ffbf47;
  --panel-w: 360px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* top bar ------------------------------------------------------------------------ */

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 12px;
  background: var(--top); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { margin-left: auto; display: flex; gap: 4px; }
.topnav a { color: #d7e3ef; text-decoration: none; padding: 6px 10px; border-radius: 4px; font-size: 13.5px; }
.topnav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.topnav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.14); }
.topbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 4px;
  background: transparent; color: #fff; cursor: pointer;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.12); }
.burger, .burger::before, .burger::after {
  display: block; width: 18px; height: 2px; background: #fff; position: relative; content: "";
}
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }

/* map page layout ------------------------------------------------------------------ */

body.map-page {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.layout { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
#panel {
  flex: 0 0 var(--panel-w); width: var(--panel-w);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-right: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
body.panel-collapsed #panel { display: none; }
#map-wrap { flex: 1 1 auto; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #1f262e; }
.noscript { position: absolute; top: 40%; left: 0; right: 0; text-align: center; color: #fff; }

.panel-sec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-sec h2 {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.panel-sec.intro p { margin: 0; }
.panel-sec.small { font-size: 12.5px; color: var(--muted); }
.panel-sec.small p { margin: 0; }
.note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.btn {
  font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 4px;
  border: 1px solid #b9c4cf; background: #fff; color: var(--ink); cursor: pointer;
}
.btn:hover { background: #eef3f8; }
.btn[aria-pressed="true"] { background: var(--top); color: #fff; border-color: var(--top); }

/* year and summary */

.year-row { display: flex; align-items: center; gap: 10px; }
.year-row input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--top); }
.year-row output { font-weight: 700; font-size: 18px; min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; }
.summary { margin-top: 10px; }
.sum-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: #e3e8ee; }
.sum-bar span { display: block; height: 100%; }
.sum-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.sum-table td { padding: 2px 0; }
.sum-table td.num { text-align: right; font-weight: 600; }
.sum-lines { margin: 8px 0 0; padding: 0; list-style: none; }
.sum-lines li { margin: 3px 0; }
.sum-lines b { font-variant-numeric: tabular-nums; }
.sw {
  display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px;
  vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.15);
}
.sw.c1 { background: var(--c1); } .sw.c2 { background: var(--c2); }
.sw.c3 { background: var(--c3); } .sw.c4 { background: var(--c4); }
.sw.line { height: 4px; vertical-align: 2px; border: 0; border-radius: 1px; }
.sw.dash { height: 0; border: 0; border-top: 3px dashed; vertical-align: 3px; background: none; }
.sw.dot { height: 0; border: 0; border-top: 3px dotted; vertical-align: 3px; background: none; }
.sw.round { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.sw.poly { background: transparent; border-width: 2px; border-style: solid; }
.sw.poly.dashed { border-style: dashed; }
.sw.halo { height: 9px; border: 0; opacity: 0.55; }

/* layer list */

.lgroup { margin: 0 0 10px; }
.lgroup:last-child { margin-bottom: 0; }
.lgroup h3 { margin: 0 0 4px; font-size: 12.5px; color: var(--ink); font-weight: 650; }
.lrow { display: flex; align-items: flex-start; gap: 6px; padding: 3px 0; }
.lrow input { margin: 3px 2px 0 0; flex: 0 0 auto; }
.lrow label { cursor: pointer; flex: 1 1 auto; }
.lrow .ldesc { display: block; font-size: 12px; color: var(--muted); }
.lrow .lstate { flex: 0 0 auto; font-size: 11px; color: var(--muted); min-width: 16px; }
.lrow.loading .lstate::before {
  content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #9fb0c2; border-top-color: transparent; animation: spin 0.8s linear infinite;
}
.legend { margin: 2px 0 6px 22px; padding: 0; list-style: none; font-size: 12px; color: #34414f; }
.legend li { margin: 2px 0; }
.legend[hidden] { display: none; }

/* prediction controls */

.ctl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ctl-label { font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid #b9c4cf; border-radius: 4px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 13px; padding: 5px 10px; border: 0; background: #fff; cursor: pointer;
  border-right: 1px solid #b9c4cf; color: var(--ink);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--top); color: #fff; }
.radios { border: 0; margin: 0; padding: 0; }
.radios label { display: block; padding: 3px 0; cursor: pointer; }
.radios input { margin: 0 6px 0 0; vertical-align: -2px; }

/* places and jump */

.bookmarks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bookmarks button { text-align: left; }
.jump { display: flex; gap: 8px; }
.jump input { flex: 1 1 auto; min-width: 0; font: inherit; padding: 5px 8px; border: 1px solid #b9c4cf; border-radius: 4px; }

/* record card (segment record, building ledger) */

.record { background: #fff; border-bottom: 2px solid var(--top); padding: 12px 14px 14px; }
.record h3 { margin: 0 0 6px; font-size: 15px; padding-right: 30px; }
.record h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.record dl { margin: 0; display: grid; grid-template-columns: 9.5em 1fr; gap: 3px 10px; }
.record dt { color: var(--muted); }
.record dd { margin: 0; }
.record ul, .record ol { margin: 0; padding-left: 18px; }
.record li { margin: 2px 0; }
.record .close {
  float: right; margin: -4px -6px 0 0; width: 30px; height: 30px; border: 0; background: transparent;
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted);
}
.record .close:hover { color: var(--ink); }
.record .links { margin-top: 10px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 3px; color: #fff; font-weight: 700; font-size: 12.5px;
  margin-right: 4px;
}
.badge.c1 { background: var(--c1); } .badge.c2 { background: var(--c2); color: #1b1b1b; }
.badge.c3 { background: var(--c3); } .badge.c4 { background: var(--c4); }
.badge.gray { background: #7b8794; }

/* map overlays */

.loading {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 8px;
  background: rgba(20, 34, 49, 0.92); color: #fff; padding: 6px 12px; border-radius: 16px; font-size: 13px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); max-width: calc(100% - 120px);
}
.loading[hidden] { display: none; }
.loading.error { background: #a8231a; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: transparent; animation: spin 0.8s linear infinite;
}
.loading.error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.tooltip {
  position: absolute; z-index: 4; pointer-events: none; max-width: 290px;
  background: rgba(255, 255, 255, 0.97); color: var(--ink); border-radius: 4px; padding: 7px 9px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35); font-size: 12.5px; line-height: 1.4;
}
.tooltip[hidden] { display: none; }
.tooltip b { font-variant-numeric: tabular-nums; }

.maplibregl-popup-content { padding: 10px 12px; font-size: 13px; line-height: 1.4; max-width: 300px; }
.maplibregl-popup-content h4 { margin: 0 0 4px; font-size: 13.5px; padding-right: 14px; }
.maplibregl-popup-content p { margin: 3px 0; }
.maplibregl-popup-content table { border-collapse: collapse; }
.maplibregl-popup-content td { padding: 1px 8px 1px 0; vertical-align: top; }
.maplibregl-popup-content td:first-child { color: var(--muted); }
.maplibregl-popup-content .btn { margin-top: 6px; font-size: 12px; padding: 3px 8px; }
.maplibregl-ctrl-attrib-inner { font-size: 11px; }

/* footer */

.site-footer {
  flex: 0 0 auto; background: #eef2f6; border-top: 1px solid var(--line);
  padding: 6px 14px; font-size: 11.5px; color: #3c4855; line-height: 1.4; position: relative;
}
.site-footer p { margin: 0; }
.footer-more { display: none; }

/* methods page ------------------------------------------------------------------ */

body.doc-page { background: #fff; }
.doc { max-width: 860px; margin: 0 auto; padding: 18px 20px 40px; }
.doc h1 { font-size: 28px; margin: 18px 0 6px; line-height: 1.2; }
.doc .lede { font-size: 16px; color: #2c3a48; margin: 0 0 18px; }
.doc h2 { font-size: 21px; margin: 34px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 16px; margin: 22px 0 6px; }
.doc p, .doc li { font-size: 15px; line-height: 1.6; }
.doc ul, .doc ol { padding-left: 22px; }
.doc blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 4px solid #b9c7d6; background: #f5f8fb; color: #2b3947;
}
.doc blockquote p { margin: 4px 0; font-size: 14.5px; }
.doc figure { margin: 16px 0; }
.doc figure img { max-width: 100%; height: auto; border: 1px solid var(--line); }
.doc figcaption { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.doc code { font-size: 13.5px; background: #f2f5f8; padding: 1px 4px; border-radius: 3px; }
.toc { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 16px; margin: 14px 0 6px; }
.toc ol { margin: 4px 0; columns: 2; column-gap: 28px; }
.toc li { font-size: 14px; line-height: 1.6; }
.tbl-wrap { overflow-x: auto; margin: 10px 0; }
.doc table { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.doc th { background: #f3f6f9; font-weight: 650; }
.doc td.num, .doc th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc .callout { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 4px; padding: 10px 14px; }
.doc .callout p { margin: 4px 0; }
.doc-footer { border-top: 1px solid var(--line); margin-top: 30px; }
body.doc-page .site-footer { padding: 14px 20px; font-size: 13px; }
body.doc-page .site-footer p { max-width: 860px; margin: 0 auto; }

/* small screens ------------------------------------------------------------------ */

@media (max-width: 760px) {
  .topnav a { padding: 6px 7px; font-size: 13px; }
  .brand { font-size: 14px; }
  #panel {
    position: absolute; z-index: 6; top: 0; bottom: 0; left: 0;
    width: min(92vw, 380px); box-shadow: 2px 0 10px rgba(0, 0, 0, 0.35);
  }
  body.map-page .site-footer { padding: 5px 54px 5px 10px; font-size: 11px; max-height: 2.9em; overflow: hidden; }
  body.map-page .site-footer.open { max-height: 40vh; overflow-y: auto; }
  body.map-page .footer-more {
    display: block; position: absolute; right: 6px; top: 4px; font: inherit; font-size: 11px;
    border: 1px solid #b9c4cf; background: #fff; border-radius: 3px; padding: 2px 6px; cursor: pointer;
  }
  .toc ol { columns: 1; }
  .doc { padding: 12px 16px 30px; }
  .doc h1 { font-size: 24px; }
}

@media (max-width: 420px) {
  .brand { display: none; }
  .topnav { margin-left: 0; }
}
