/* The shared header and footer (opf/site_chrome.py renders the markup).

   Every rule is scoped under .olf-hdr, .olf-menu or .olf-ftr and sets the properties it
   depends on, because each page still carries its own stylesheet and several of them
   style bare `header`, `nav a` and `footer`. The header is a fixed 56px tall so that the
   full-height app pages (map, Site Finder, CAD Studio) can subtract a known number. */

/* The height lives on :root so a page can place its own sticky bar under the header
   (the report's section strip, Find sites' sidebar) instead of writing 56px in. */
:root { --olf-hdr-h: 56px; }
@media (max-width: 600px) { :root { --olf-hdr-h: 52px; } }

header.olf-hdr {
  position: sticky; top: 0; z-index: 900;
  display: block; height: var(--olf-hdr-h); margin: 0; padding: 0;
  background: var(--olf-paper-raised, #FFFEFA);
  border: 0; border-bottom: 1px solid var(--olf-line, #C8C1B3);
  box-shadow: none; flex: 0 0 auto;
  font: 500 14px/1 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
  color: var(--olf-ink, #102033);
  text-transform: none; letter-spacing: normal;
}
header.olf-hdr .olf-hdr-in {
  display: flex; align-items: center; gap: 24px; height: 100%;
  width: min(1360px, calc(100% - 40px)); margin: 0 auto; padding: 0;
}
header.olf-hdr a.olf-brand {
  display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; min-height: 44px;
  color: var(--olf-ink, #102033); text-decoration: none; white-space: nowrap;
  padding: 0; border: 0; background: none;
}
header.olf-hdr a.olf-brand b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
header.olf-hdr a.olf-brand span {
  font: 600 11px/1 var(--olf-font-mono, "IBM Plex Mono", ui-monospace, monospace);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--olf-ink-secondary, #334B68);
}
header.olf-hdr .olf-mark { display: block; width: 22px; height: 22px; flex: 0 0 22px; }

header.olf-hdr nav.olf-nav {
  display: flex; align-items: center; gap: 4px; margin: 0 0 0 auto; padding: 0;
  flex: 0 1 auto; min-width: 0; background: none; border: 0; position: static;
}
header.olf-hdr nav.olf-nav a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 10px; margin: 0;
  color: var(--olf-ink-secondary, #334B68); text-decoration: none; white-space: nowrap;
  font: 500 14px/1 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
  letter-spacing: normal; text-transform: none; background: none; border: 0;
  border-radius: var(--olf-radius-control, 4px); box-shadow: none;
}
header.olf-hdr nav.olf-nav a:hover { color: var(--olf-ink, #102033); background: var(--olf-paper-muted, #ECE7DB); }
header.olf-hdr nav.olf-nav a[aria-current="page"] {
  color: var(--olf-ink, #102033); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--olf-cobalt, #155FC0); border-radius: 0;
}
/* A long display name pushed the header past the page and gave every signed-in page a
   sideways scrollbar at 1280px. */
header.olf-hdr nav.olf-nav a.olf-acct {
  display: inline-block; max-width: 18ch; overflow: hidden; text-overflow: ellipsis;
  line-height: 34px; margin-left: 8px; padding: 0 14px; color: var(--olf-cobalt, #155FC0); font-weight: 600;
  border: 1px solid var(--olf-cobalt, #155FC0); border-radius: var(--olf-radius-control, 4px);
}
header.olf-hdr nav.olf-nav a.olf-acct:hover { background: var(--olf-cobalt-soft, #E8F0FC); }
header.olf-hdr nav.olf-nav a.olf-acct[aria-current="page"] { box-shadow: none; background: var(--olf-cobalt-soft, #E8F0FC); }
header.olf-hdr a:focus-visible, header.olf-hdr button:focus-visible,
.olf-menu a:focus-visible, .olf-menu button:focus-visible, footer.olf-ftr a:focus-visible {
  outline: 3px solid var(--olf-focus, #155FC0); outline-offset: 2px;
}

header.olf-hdr button.olf-menu-btn {
  display: none; align-items: center; justify-content: center; margin: 0 0 0 auto;
  width: 44px; height: 44px; padding: 0; flex: 0 0 44px;
  color: var(--olf-ink, #102033); background: none; cursor: pointer;
  border: 1px solid var(--olf-line, #C8C1B3); border-radius: var(--olf-radius-control, 4px);
}

/* The Tools menu. A <details>, so it opens without script. */
header.olf-hdr details.olf-drop { position: relative; margin: 0; padding: 0; }
header.olf-hdr details.olf-drop > summary {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; margin: 0;
  list-style: none; cursor: pointer; white-space: nowrap; color: var(--olf-ink-secondary, #334B68);
  font: 500 14px/1 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
  border-radius: var(--olf-radius-control, 4px);
}
header.olf-hdr details.olf-drop > summary::-webkit-details-marker { display: none; }
header.olf-hdr details.olf-drop > summary::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
header.olf-hdr details.olf-drop[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
header.olf-hdr details.olf-drop > summary:hover,
header.olf-hdr details.olf-drop[open] > summary { color: var(--olf-ink, #102033); background: var(--olf-paper-muted, #ECE7DB); }
header.olf-hdr details.olf-drop > summary.olf-here {
  color: var(--olf-ink, #102033); font-weight: 600; box-shadow: inset 0 -2px 0 var(--olf-cobalt, #155FC0); border-radius: 0;
}
header.olf-hdr .olf-drop-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 950; width: 300px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--olf-paper-raised, #FFFEFA); border: 1px solid var(--olf-line, #C8C1B3);
  border-radius: 8px; box-shadow: var(--olf-shadow-float, 0 8px 28px rgb(16 32 51 / 0.18));
}
header.olf-hdr nav.olf-nav .olf-drop-menu a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; height: auto;
  padding: 10px 12px; white-space: normal; color: var(--olf-ink, #102033);
}
header.olf-hdr nav.olf-nav .olf-drop-menu a b { font-weight: 600; font-size: 14px; }
header.olf-hdr nav.olf-nav .olf-drop-menu a span { font-size: 13px; line-height: 1.3; color: var(--olf-ink-muted, #647388); }
/* The footer's pages at the foot of the Tools menu, for the pages that have no footer. */
header.olf-hdr .olf-drop-menu .olf-drop-group {
  margin: 8px 12px 2px; padding-top: 8px; border-top: 1px solid var(--olf-line, #C8C1B3);
  font: 600 11px/1.4 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
  letter-spacing: .06em; text-transform: uppercase; color: var(--olf-ink-muted, #647388);
}
header.olf-hdr .olf-drop-menu .olf-drop-foot { display: flex; flex-wrap: wrap; }
header.olf-hdr nav.olf-nav .olf-drop-menu .olf-drop-foot a {
  display: inline-flex; flex-direction: row; padding: 6px 12px; font-size: 13px; color: var(--olf-ink-secondary, #334B68);
}
header.olf-hdr nav.olf-nav .olf-drop-menu a[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--olf-cobalt, #155FC0); border-radius: 0; background: var(--olf-cobalt-soft, #E8F0FC);
}

/* Seven items and the account fit in about 820px. Below that the same links live in the menu. */
@media (max-width: 899px) {
  header.olf-hdr nav.olf-nav { display: none; }
  header.olf-hdr button.olf-menu-btn { display: inline-flex; }
}
@media (max-width: 600px) {
  header.olf-hdr .olf-hdr-in { width: calc(100% - 32px); }
}

/* The menu is a popover: it opens with no script, sits in the top layer above maps and
   canvases, and closes on Escape or a click outside. */
.olf-menu[popover] {
  position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: 100dvh;
  width: min(340px, 88vw); padding: 0 0 24px; overflow-y: auto;
  background: var(--olf-paper-raised, #FFFEFA); color: var(--olf-ink, #102033);
  border: 0; border-left: 1px solid var(--olf-line, #C8C1B3);
  box-shadow: var(--olf-shadow-float, 0 8px 28px rgb(16 32 51 / 0.18));
  font: 500 15px/1.3 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
}
.olf-menu::backdrop { background: rgb(16 32 51 / 0.35); }
/* Without the Popover API (iOS Safari before 17) the menu button did nothing.
   site-chrome.js opens it with this class instead. */
@supports not selector(:popover-open) {
  .olf-menu { display: none; }
  .olf-menu.olf-open { display: block; z-index: 10001; }
}
.olf-menu .olf-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--olf-line, #C8C1B3);
}
.olf-menu .olf-menu-head button {
  width: 44px; height: 44px; font-size: 26px; line-height: 1; cursor: pointer;
  color: var(--olf-ink, #102033); background: none; border: 0;
}
.olf-menu nav { display: flex; flex-direction: column; padding: 8px 0; }
.olf-menu nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 20px;
  color: var(--olf-ink, #102033); text-decoration: none; text-transform: none; letter-spacing: normal;
}
.olf-menu nav a:hover { background: var(--olf-paper-muted, #ECE7DB); }
.olf-menu nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 3px 0 0 var(--olf-cobalt, #155FC0); }
.olf-menu .olf-menu-group {
  margin: 8px 0 0; padding: 12px 20px 4px; border-top: 1px solid var(--olf-line, #C8C1B3);
  font: 600 11px/1 var(--olf-font-mono, "IBM Plex Mono", ui-monospace, monospace);
  letter-spacing: .12em; text-transform: uppercase; color: var(--olf-ink-muted, #647388);
}
.olf-menu .olf-menu-tools {
  display: flex; flex-direction: column; padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--olf-line, #C8C1B3);
}
.olf-menu details.olf-menu-more { border-top: 1px solid var(--olf-line, #C8C1B3); }
.olf-menu details.olf-menu-more > summary {
  display: flex; align-items: center; min-height: 44px; padding: 0 20px; cursor: pointer;
  font-size: 14px; color: var(--olf-ink-secondary, #334B68);
}
.olf-menu nav.olf-menu-foot { padding-top: 0; }
.olf-menu nav.olf-menu-foot a { min-height: 44px; font-size: 14px; color: var(--olf-ink-secondary, #334B68); }

footer.olf-ftr {
  display: block; margin: 64px 0 0; padding: 28px 0 36px;
  background: var(--olf-paper, #F6F3EA); border: 0; border-top: 1px solid var(--olf-line, #C8C1B3);
  color: var(--olf-ink-muted, #647388); text-align: left;
  font: 400 14px/1.6 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
}
footer.olf-ftr .olf-ftr-in { width: min(1360px, calc(100% - 40px)); margin: 0 auto; }
footer.olf-ftr nav.olf-ftr-links { display: flex; flex-wrap: wrap; gap: 0 22px; margin: 0 0 16px; }
footer.olf-ftr nav.olf-ftr-links a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--olf-ink-secondary, #334B68); font-weight: 500; text-decoration: none;
}
footer.olf-ftr nav.olf-ftr-links a:hover { color: var(--olf-ink, #102033); text-decoration: underline; }
footer.olf-ftr p { margin: 0; max-width: 88ch; }
footer.olf-ftr p a { color: inherit; text-decoration: underline; }
@media (max-width: 600px) {
  footer.olf-ftr .olf-ftr-in { width: calc(100% - 32px); }
}
#olf-notices {
  position: fixed; z-index: 10000; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100% - 32px));
}
.olf-notice {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 8px;
  font: 500 14px/1.5 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
  background: var(--olf-ink, #102033); color: #fff; box-shadow: 0 6px 24px rgba(16, 32, 51, .22);
}
.olf-notice span { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
.olf-notice-error { background: #7a2410; }
.olf-notice button {
  flex: none; background: none; border: 0; color: inherit; font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0 2px; opacity: .8;
}
.olf-notice button:hover { opacity: 1; }
/* Every page set its own input size, and eleven were under 16px: iOS zooms the whole page
   into an input smaller than that when it takes focus, and leaves it zoomed. */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { font-size: max(16px, 1em) !important; }
}
@media print {
  #olf-notices { display: none; }
  header.olf-hdr nav.olf-nav, header.olf-hdr button.olf-menu-btn, footer.olf-ftr nav { display: none; }
}
/* "Building the report…", shown by site-chrome.js while a report link loads. */
#olf-loading {
  position: fixed; inset: 0; z-index: 2147483001; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgb(16 32 51 / 0.6);
  font: 400 15px/1.4 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
}
#olf-loading .olf-ld {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 440px; padding: 20px 22px;
  background: #fff; color: var(--olf-ink, #102033); border-radius: 10px; box-shadow: 0 20px 50px rgb(0 0 0 / 0.3);
}
#olf-loading .olf-spin {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--olf-cobalt-soft, #E8F0FC); border-top-color: var(--olf-cobalt, #155FC0);
  animation: olf-spin .75s linear infinite;
}
#olf-loading b { display: block; font-size: 15px; }
#olf-loading .olf-ld-addr { display: block; font-size: 13px; color: var(--olf-ink-muted, #647388); overflow-wrap: anywhere; }
@keyframes olf-spin { to { transform: rotate(360deg); } }
/* Controls that measured under 44px at 390 px on 8 October 2026 (tests/test_touch_targets.py
   measures them again on every page). A thumb needs about 44; these were 13 to 39.
   :root raises each above the page's own rule for the same class, which loads after this. */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  :root .intent-chip, :root .hint-row button, :root a.btn, :root button.btn, :root label.btn,
  :root .btn-sm, :root .grid-tab, :root .demo-pill, :root .drawer-close, :root .cat-pill,
  :root .sample-tag, :root .basemap-dropdown, :root .sheet-handle-bar, :root .archived-toggle,
  :root #btn-toggle-login, :root #btn-toggle-register, :root #cmp button, :root .tool-btn,
  :root .doc-title-input, :root #cad-address, :root .layer-row,
  :root .row-btn, :root .filter-tab, :root .tab-btn {
    min-height: 44px; box-sizing: border-box;
  }
  :root .drawer-close, :root .tool-btn, :root .row-btn { min-width: 44px; }
  :root .sample-tag, :root .hint-row button { display: inline-flex; align-items: center; }
  :root .layer-checkbox { width: 20px; height: 20px; }
  :root summary.faq-q { min-height: 44px; padding-block: 10px; box-sizing: border-box; }
  .leaflet-touch .leaflet-bar a, .leaflet-control-zoom a {
    width: 44px !important; height: 44px !important; line-height: 44px !important;
  }
}

/* The account menu: the signed-in name opens the person's own pages. */
header.olf-hdr details.olf-acct-drop > summary {
  display: inline-block; max-width: 18ch; overflow: hidden; text-overflow: ellipsis;
  line-height: 34px; height: auto; margin-left: 8px; padding: 0 14px; color: var(--olf-cobalt, #155FC0); font-weight: 600;
  border: 1px solid var(--olf-cobalt, #155FC0); border-radius: var(--olf-radius-control, 4px);
}
header.olf-hdr details.olf-acct-drop > summary::after { display: none; }
header.olf-hdr details.olf-acct-drop .olf-drop-menu { left: auto; right: 0; width: 220px; }
header.olf-hdr nav.olf-nav details.olf-acct-drop .olf-drop-menu a { padding: 10px 12px; font-weight: 500; }
.olf-menu .olf-acct-tools { margin-top: 4px; }

/* olfDialog: a choice, a line of text or a link, in the page rather than a prompt(). */
dialog.olf-dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: auto;
  color: var(--olf-ink, #102033); background: var(--olf-paper-raised, #FFFEFA);
  border: 1px solid var(--olf-line, #C8C1B3); border-radius: 10px;
  box-shadow: 0 20px 50px rgb(0 0 0 / .3);
  font: 400 15px/1.45 var(--olf-font-sans, "Instrument Sans", system-ui, sans-serif);
}
dialog.olf-dialog::backdrop { background: rgb(16 32 51 / .5); }
dialog.olf-dialog form { display: block; margin: 0; padding: 18px 18px 14px; }
dialog.olf-dialog .olf-dialog-title { margin: 0 0 12px; font-size: 17px; line-height: 1.3; }
dialog.olf-dialog .olf-dialog-opt {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; margin: 0 0 8px;
  border: 1px solid var(--olf-line, #C8C1B3); border-radius: 6px; cursor: pointer;
}
/* Twenty pixels whatever the page's own touch rules say (Site Finder's made the radio 44 tall and its
   focus ring an oval); the whole 48 px row is the target. */
dialog.olf-dialog .olf-dialog-opt input { width: 20px; height: 20px !important; min-height: 0 !important; margin: 0; flex: none;
  accent-color: var(--olf-cobalt, #155FC0); }
dialog.olf-dialog .olf-dialog-opt input:focus-visible { outline: 2px solid var(--olf-cobalt, #155FC0); outline-offset: 3px; border-radius: 50%; }
dialog.olf-dialog .olf-dialog-opt small { display: block; font-size: 13px; color: var(--olf-ink-muted, #647388); }
dialog.olf-dialog .olf-dialog-label { display: block; font-size: 14px; font-weight: 600; }
dialog.olf-dialog .olf-dialog-text {
  display: block; width: 100%; box-sizing: border-box; margin: 6px 0 0; min-height: 44px; padding: 10px 12px;
  font: inherit; font-size: 16px; border: 1px solid var(--olf-line, #C8C1B3); border-radius: 6px;
}
dialog.olf-dialog textarea.olf-dialog-text { min-height: 96px; resize: vertical; }
dialog.olf-dialog .olf-dialog-p { margin: 0 0 8px; }
dialog.olf-dialog .olf-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
dialog.olf-dialog .olf-dialog-foot button {
  min-height: 44px; min-width: 88px; padding: 0 18px; font: inherit; font-weight: 600; border-radius: 6px; cursor: pointer;
}
dialog.olf-dialog .olf-dialog-ok { color: #fff; background: var(--olf-cobalt, #155FC0); border: 1px solid var(--olf-cobalt, #155FC0); }
dialog.olf-dialog .olf-dialog-cancel { color: var(--olf-ink, #102033); background: none; border: 1px solid var(--olf-line, #C8C1B3); }
/* No <dialog> in the browser: the same box, placed over the page by hand. */
dialog.olf-dialog.olf-dialog-plain { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 2147483002; }
