:root { color-scheme: light dark; --text: #1c1c1e; --muted: #6c6c70; --line: #c7c7cc; --bg: #fff; --canvas: #f4f4f4; --link: #0a5bc4; }
@media (prefers-color-scheme: dark) { :root { --text: #f2f2f7; --muted: #a0a0a6; --line: #48484a; --bg: #1c1c1e; --canvas: #2c2c2e; --link: #6cb0ff; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
main, footer { max-width: 560px; margin: 0 auto; padding: 0 16px; }
main { padding-top: 40px; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 19px; line-height: 1.3; margin: 24px 0 4px; }
h2 + p { margin-top: 0; }
.row { display: flex; gap: 8px; }
input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; }
button { font: inherit; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.answer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 3em; margin: 20px 0; }
.answer:has(.pill:not([hidden])) { min-height: 0; margin-bottom: 8px; }
#result { margin: 0; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: inherit; font-size: 14px; line-height: 1.3; text-decoration: none; white-space: nowrap; cursor: pointer; }
.pill[hidden] { display: none; }
.pill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* Phones print from the browser's own Share menu, and the pill would wrap onto its own line. */
@media (max-width: 600px) { #print { display: none; } }
#map { aspect-ratio: 4 / 3; background: #f6f5f5; border-radius: 8px; margin-bottom: 16px; }
#map[hidden] { display: none; }
#map .leaflet-veil-pane, #map .leaflet-boost-pane { mix-blend-mode: saturation; }
/* One line of credits, like Esri's own Leaflet plugin; a tap shows them all. */
#map .leaflet-bottom.leaflet-right { left: 0; }
#map .leaflet-control-attribution { max-width: 100%; box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#map .leaflet-control-attribution:hover { white-space: normal; }
/* On screen the lookup's map fills the window, the search floats over it, and the links stay along the bottom; printing uses the page layout above. */
@media screen {
  html:not(.printing) body.lookup { display: flex; flex-direction: column; height: 100dvh; }
  html:not(.printing) .lookup main { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; background: var(--canvas); }
  html:not(.printing) .lookup #map { flex: 1; aspect-ratio: auto; margin: 0; border-radius: 0; }
  html:not(.printing) .lookup .panel { position: absolute; z-index: 1001; top: 12px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); box-sizing: border-box; padding: 10px 12px; border-radius: 14px; background: var(--bg); box-shadow: 0 2px 8px rgb(0 0 0 / 30%); }
  /* The title takes the place the answer row takes later, so the panel keeps its height. */
  html:not(.printing) .lookup .panel > h1 { height: 26.2px; margin: 0 0 8px; font-size: 20px; line-height: 26.2px; }
  html:not(.printing) .lookup main:has(#map:not([hidden])) .panel > h1 { display: none; }
  html:not(.printing) .lookup .answer, html:not(.printing) .lookup .answer:has(.pill:not([hidden])) { min-height: 0; margin: 8px 0 0; }
  html:not(.printing) .lookup .answer:has(#result:empty) { display: none; }
  html:not(.printing) .lookup footer { box-sizing: border-box; width: 100%; max-width: none; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; padding: 8px 16px; }
  html:not(.printing) .lookup footer p { margin: 0; }
}
a { color: var(--link); }
footer { color: var(--muted); font-size: 15px; padding-top: 16px; padding-bottom: 32px; }
footer p { margin: 8px 0 0; font-size: 13px; }
/* One line when it fits; a bar that wraps to the start of a line is clipped away. */
.links { display: flex; flex-wrap: wrap; margin-left: -.8em; clip-path: inset(0 0 0 .8em); }
.links nav { position: relative; padding-left: .8em; }
.links nav::before { content: "|"; position: absolute; left: .22em; }
/* Printing a precinct: the Print pill sizes the map to the page (.printing) before the dialog opens, so its tiles are drawn at that size. */
.printing main, .printing footer { max-width: 7.2in; padding: 0; }
.printing #map { aspect-ratio: auto; height: 8in; border-radius: 0; }
/* New tiles fade in, and the print starts the moment they load, so they print at full strength. */
.printing #map .leaflet-tile { opacity: 1 !important; }
.print-only, .print-only:empty { display: none; }
@media print {
  :root { --text: #1c1c1e; --muted: #6c6c70; --line: #c7c7cc; --bg: #fff; --link: #1c1c1e; }
  main, footer { padding: 0; }
  .panel > h1, button, footer nav, #print, #map .leaflet-control-zoom, #copy svg, #copy span { display: none; }
  form { display: none; }
  .print-only:not(:empty) { display: block; }
  #address-line { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
  #print-note { margin: 0 0 4px; font-size: 12px; }
  #copy { border: 0; padding: 0; font-size: 15px; color: var(--muted); }
  #copy::after { content: "lookup.usegis.org" attr(href); }
  #map { break-inside: avoid; }
  #map .leaflet-control-attribution { white-space: normal; }
}
