:root {
  color-scheme: light;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1c2938;
  background: #111c2a;
  --sidebar-width: 260px;
  --drawer-width: 390px;
  --sidebar-occupied: 0px;
  --drawer-occupied: 0px;
  --drawer-bottom: 0px;
  --map-top: 0px;
  --sidebar-bg: #111c2a;
  --sidebar-border: #2c3a4b;
  --muted: #607084;
  --border: #e2e7ed;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.app-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
}
.drawer-open { --drawer-occupied: var(--drawer-width); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 10px 16px; color: #152337; background: white; border-radius: 4px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

/* The logo stays on the map; only the compact utility card expands. */
#sidebar { position: absolute; top: 8px; left: 12px; width: var(--sidebar-width); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; min-height: 0; color: #f2f5f9; pointer-events: none; z-index: 3; }
.branding { flex-shrink: 0; width: 240px; background: transparent; }
.brand-logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 1px 3px rgb(255 255 255 / 85%)); }
.creator-credit { margin: 0 0 8px; padding: 3px 0; color: #fff; font-size: 11px; font-weight: 500; line-height: 1.6; text-align: center; text-shadow: 0 1px 2px #111c2a, 0 0 4px #111c2a, 0 0 1px #111c2a; transform: translateY(-11px); }
.creator-credit a, #about-toggle { color: inherit; text-decoration: none; pointer-events: auto; }
.creator-credit a:hover, #about-toggle:hover { color: #dce9fa; }
#about-toggle { padding: 0; color: inherit; background: transparent; border: 0; font: inherit; text-shadow: inherit; }
.explorer-panel { display: flex; flex-direction: column; align-self: flex-start; min-height: 0; max-width: 100%; background: var(--sidebar-bg); border: 1px solid var(--sidebar-border); border-radius: 7px; box-shadow: 0 3px 14px rgb(0 0 0 / 18%); overflow: hidden; pointer-events: auto; }
.sidebar-open .explorer-panel { width: 100%; }
.rail-navigation { display: flex; flex-shrink: 0; }
#sidebar-toggle { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 44px; padding: 9px 13px; color: #c7d5e6; background: transparent; border: 0; font-size: 12px; font-weight: 600; }
.rail-navigation button:hover { background: #263b52; color: #fff; }
.rail-navigation button:focus-visible { outline-color: #a5c8f2; outline-offset: -3px; }
.rail-navigation svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.sidebar-open .rail-navigation { border-bottom: 1px solid var(--sidebar-border); }
.sidebar-open #sidebar-toggle { justify-content: space-between; }
.sidebar-open #sidebar-toggle svg { transform: rotate(-90deg); }
#sidebar-content {
  display: none;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #4c5e73 var(--sidebar-bg);
}
.sidebar-open #sidebar-content { display: flex; }
.section-eyebrow { display: block; margin: 0; color: #a7b6c8; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.explorer-intro h1 { margin: 0 0 4px; color: #f6f8fb; font-size: 16px; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; }
.explorer-intro p { margin: 0; color: #a7b6c8; font-size: 12px; line-height: 1.5; }

/* Search results stay in the sidebar's reading flow. */
#asset-search { min-width: 0; }
#asset-search label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.search-input-wrap { position: relative; }
.search-input-wrap svg { position: absolute; left: 12px; top: 14px; color: #b0bfd0; pointer-events: none; }
.search-input-wrap svg, #sidebar-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
#asset-search-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 10px 11px 38px;
  color: #f5f8fc;
  background: #1c2a3b;
  border: 1px solid #42516a;
  border-radius: 5px;
  font-size: 12px;
  color-scheme: dark;
}
#asset-search-input::placeholder { color: #a7b6c8; opacity: 1; }
#asset-search-input:focus { border-color: #93b5dc; }
#asset-search-input:focus-visible, #sidebar-content button:focus-visible { outline-color: #a5c8f2; }
#asset-search-results { margin-top: 8px; max-height: min(220px, 28dvh); overflow-y: auto; overscroll-behavior: contain; border: 1px solid #34455a; border-radius: 5px; background: #172536; scrollbar-width: thin; scrollbar-color: #53677f #172536; }
.search-result { display: block; width: 100%; padding: 13px 12px; background: transparent; border: 0; border-bottom: 1px solid #2b3b50; text-align: left; }
.search-result:last-of-type { border-bottom: 0; }
.search-result:hover, .search-result:focus-visible { background: #263b52; }
.search-result:focus-visible { outline-offset: -3px; }
.search-result-title, .search-result-detail { display: block; overflow-wrap: anywhere; }
.search-result-title { color: #f5f8fc; font-size: 12px; font-weight: 600; line-height: 1.55; }
.search-result-detail { margin-top: 5px; color: #aabbd0; font-size: 11px; line-height: 1.5; }
.search-empty, .search-more { margin: 0; padding: 12px; color: #b8c7d9; font-size: 11px; }
#map-legend { padding-top: 13px; border-top: 1px solid var(--sidebar-border); }
#legend-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; color: #d7e0ea; font-size: 12px; }
.legend-item:last-child { grid-column: 1 / -1; }
.legend-dot { display: block; width: 9px; height: 9px; flex-shrink: 0; border-radius: 50%; }

/* Full-viewport canvas; overlays never change its width or height. */
#workspace { position: absolute; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }
#map .maplibregl-ctrl-top-left, #map .mapboxgl-ctrl-top-left,
#map .maplibregl-ctrl-bottom-left, #map .mapboxgl-ctrl-bottom-left { left: var(--sidebar-occupied); }
#map .maplibregl-ctrl-top-right, #map .mapboxgl-ctrl-top-right,
#map .maplibregl-ctrl-bottom-right, #map .mapboxgl-ctrl-bottom-right { right: var(--drawer-occupied); }
#map .maplibregl-ctrl-top-left, #map .mapboxgl-ctrl-top-left,
#map .maplibregl-ctrl-top-right, #map .mapboxgl-ctrl-top-right { top: var(--map-top); }
#map .maplibregl-ctrl-bottom-left, #map .mapboxgl-ctrl-bottom-left,
#map .maplibregl-ctrl-bottom-right, #map .mapboxgl-ctrl-bottom-right { bottom: var(--drawer-bottom); }
#map .maplibregl-ctrl-group, #map .mapboxgl-ctrl-group { border: 1px solid #d2d9e2; border-radius: 5px; box-shadow: 0 1px 4px rgb(0 0 0 / 12%); }
#map .maplibregl-ctrl button:focus-visible, #map .mapboxgl-ctrl button:focus-visible { outline-offset: -3px; }

/* Persistent provider links stay readable without an opaque attribution bar. */
#map .maplibregl-ctrl-bottom-left { max-width: calc(100% - var(--drawer-occupied) - 92px); }
#map .map-provider-credit { margin: 0 0 2px 10px; color: #fff; font-size: 11px; line-height: 1.5; text-shadow: 0 1px 2px #111c2a, 0 0 4px #111c2a, 0 0 1px #111c2a; }
#map .map-provider-credit a { display: inline-block; color: inherit; white-space: nowrap; text-decoration: none; }
#map .map-provider-credit a:hover { color: #dce9fa; }

/* Align the SDK's Sources control beside its logo; expand above the footer. */
#map .maplibregl-ctrl-bottom-right { left: 112px; right: auto; max-width: calc(100% - var(--drawer-occupied) - 64px); }
#map .maplibregl-ctrl-bottom-right:has(.maplibregl-compact-show) { left: 12px; bottom: calc(var(--drawer-bottom) + 60px); width: min(568px, calc(100% - var(--drawer-occupied) - 64px)); z-index: 5; }
#map .maplibregl-ctrl-attrib { box-sizing: border-box; margin: 4px; color: #f2f5f9; background: transparent; border: 0; box-shadow: none; font-size: 11px; line-height: 1.5; text-align: left; }
#map .maplibregl-ctrl-attrib.maplibregl-compact { min-width: 72px; min-height: 30px; padding: 0; border-radius: 4px; }
#map .maplibregl-ctrl-attrib.maplibregl-compact-show { width: calc(100% - 8px); padding: 32px 10px 8px; background: rgb(17 28 42 / 88%); border: 1px solid rgb(255 255 255 / 24%); }
#map .maplibregl-ctrl-attrib-inner { max-height: min(220px, calc(100dvh - var(--drawer-bottom) - 260px)); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #a7b6c8 #172536; }
#map .maplibregl-ctrl-attrib a { color: #c6dfff; text-decoration: none; }
#map .maplibregl-ctrl-attrib a:hover { color: #fff; }
#map .maplibregl-ctrl-attrib-button { width: 72px; height: 30px; padding: 0 6px; color: #fff; background: transparent; border-radius: 4px; font: inherit; line-height: 30px; text-align: center; text-decoration: none; text-shadow: 0 1px 2px #111c2a, 0 0 4px #111c2a; }
#map .maplibregl-ctrl-attrib-button:focus:not(:focus-visible) { outline: none; box-shadow: none; }
#map .maplibregl-ctrl-attrib-button:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; box-shadow: none; }
#map .maplibregl-compact-show .maplibregl-ctrl-attrib-button { width: 32px; font-size: 24px; }

@media (max-width: 900px) {
  /* Wrapped provider links and the official logo remain clear of open credits. */
  #map .maplibregl-ctrl-bottom-right:has(.maplibregl-compact-show) { bottom: calc(var(--drawer-bottom) + 84px); }
  #map .maplibregl-ctrl-attrib-inner { max-height: min(220px, calc(100dvh - var(--drawer-bottom) - 284px)); }
}

/* Opaque corner panel, with the upper-right map left open. */
#asset-panel { position: absolute; right: 0; bottom: 0; width: var(--drawer-width); min-width: 0; min-height: 0; height: 70vh; height: 70dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b5c0cd #fafbfd; background: #fafbfd; border: 1px solid var(--border); border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; z-index: 4; }
#asset-panel:focus { outline: none; }
#asset-panel:focus-visible { outline: 2px solid #6888ae; outline-offset: -2px; }
.asset-header { position: sticky; top: 0; z-index: 1; padding: 12px 25px; background: #fff; border-bottom: 1px solid var(--border); }
.asset-header-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.asset-kicker { color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.asset-close { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; padding: 0; background: transparent; color: #53657b; border: 1px solid var(--border); border-radius: 5px; font-size: 24px; line-height: 1; }
.asset-close:hover { color: #142237; background: #edf1f6; }
.asset-heading { margin: 6px 0; color: #172638; font-size: 23px; font-weight: 600; letter-spacing: -.025em; line-height: 1.25; overflow-wrap: anywhere; }
.asset-subtitle { margin: 0 0 6px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.asset-status { display: inline-block; padding: 5px 8px; color: #226347; background: #edf6f0; border: 1px solid #d9eadf; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1.5; }
.asset-status-pending { color: #855409; background: #fff8e8; border-color: #efdfba; }
.asset-body { padding: 18px 25px 30px; }
.asset-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; padding-bottom: 23px; }
.asset-metric { min-width: 0; padding-left: 12px; border-left: 2px solid #cbd5e1; }
.asset-metric-label { display: block; margin-bottom: 6px; color: #66778d; font-size: 9px; font-weight: 700; letter-spacing: .055em; }
.asset-metric-value { display: block; color: #172638; font-size: 14px; font-weight: 600; line-height: 1.55; overflow-wrap: anywhere; }
.asset-section-heading { margin: 0 0 12px; color: #24364d; font-size: 13px; font-weight: 650; line-height: 1.5; }
.asset-overview { padding: 23px 0; border-top: 1px solid var(--border); }
.asset-overview-text { margin: 0; color: #53657b; font-size: 13px; line-height: 1.8; }
.asset-details { padding-top: 22px; border-top: 1px solid var(--border); }
.asset-details-list { margin: 0; }
.asset-detail-row { display: grid; grid-template-columns: 36% minmax(0, 1fr); gap: 15px; padding: 13px 0; border-bottom: 1px solid #e8edf3; }
.asset-detail-row:last-child { border-bottom: 0; }
.asset-detail-label { color: #66778d; font-size: 11px; line-height: 1.65; }
.asset-detail-value { margin: 0; color: #24364d; font-size: 12px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.phase-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.phase-button { display: block; width: 100%; margin-top: 8px; padding: 12px; background: #fff; color: #314b6b; border: 1px solid #d9e1eb; border-radius: 4px; text-align: left; font-size: 12px; line-height: 1.6; }
.phase-button:hover { background: #edf2f8; border-color: #a4b6cd; }
.back-button { display: block; padding: 8px 0; background: transparent; color: #3e5f87; border: 0; text-align: left; font-size: 11px; line-height: 1.5; }
.asset-header .back-button { margin-top: 7px; }
.back-button:hover { color: #193c68; text-decoration: underline; }
.asset-sources { margin-top: 24px; padding-top: 15px; border-top: 1px solid var(--border); }
.asset-sources summary { padding: 7px 0; color: #3a526e; cursor: pointer; font-size: 12px; font-weight: 600; }
.asset-sources ul { margin: 9px 0 0; padding-left: 18px; }
.asset-sources li { padding: 4px 0; color: #7e8ea1; font-size: 12px; line-height: 1.65; }
.asset-sources a { color: #365e8b; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.asset-sources a:hover { color: #123b6c; }
.asset-error { padding: 25px; }

/* A small accessible dialog leaves the existing map and attribution unchanged. */
#about-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); margin: auto; padding: 0; overflow-y: auto; color: #24364d; background: #fafbfd; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 32px rgb(0 0 0 / 24%); }
#about-dialog::backdrop { background: rgb(17 28 42 / 30%); }
.about-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 20px 24px 0; background: #fafbfd; }
.about-header h2 { margin: 0; color: #172638; font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.about-content { padding: 0 24px 24px; font-size: 13px; line-height: 1.8; }
.about-content p { margin: 16px 0 0; }
.about-content a { color: #365e8b; text-decoration: underline; text-underline-offset: 3px; }
.about-content a:hover { color: #123b6c; }
.about-independence { padding-top: 16px; border-top: 1px solid var(--border); }

@media (max-height: 640px) {
  /* Keep the map credits visible on short screens while About scrolls. */
  #about-dialog { max-height: calc(100vh - 176px); max-height: calc(100dvh - 176px); margin: 16px auto auto; }
  .about-header { padding-bottom: 12px; }
}

@media (min-width: 901px) {
  /* Leave room for the existing zoom, navigation, terrain and fullscreen stack. */
  #asset-panel { max-height: calc(100vh - 260px); max-height: calc(100dvh - 260px); }
  #map .maplibregl-ctrl-top-right, #map .mapboxgl-ctrl-top-right { right: 0; }
}
@media (min-width: 901px) and (max-height: 560px) {
  #asset-panel { max-height: none; }
  .drawer-open #map .maplibregl-ctrl-top-right,
  .drawer-open #map .mapboxgl-ctrl-top-right { right: var(--drawer-occupied); }
  .asset-header { position: static; }
}

@media (min-width: 901px) and (max-width: 1150px) {
  .asset-header { padding-inline: 21px; }
  .asset-body { padding-inline: 21px; }
}

/* Floating branding and utility card; scroll above an open mobile profile. */
@media (max-width: 900px) {
  :root { --sidebar-occupied: 0px; --map-top: 72px; --sheet-height: min(52dvh, calc(100dvh - 320px)); }
  .drawer-open { --drawer-occupied: 0px; --drawer-bottom: var(--sheet-height); }
  #sidebar { width: min(var(--sidebar-width), calc(100vw - 72px)); max-height: min(70dvh, calc(100dvh - 48px)); }
  .drawer-open #sidebar { max-height: min(70dvh, calc(100dvh - var(--sheet-height) - 20px)); }
  .branding { width: 190px; max-width: 100%; }
  #asset-search-input { font-size: 16px; }
  #asset-search-results { max-height: 25dvh; }
  #asset-panel { top: auto; width: 100%; height: var(--sheet-height); border-left: 0; border-top: 1px solid #cbd5e1; border-radius: 0; }
  .asset-header { padding: 10px 20px 12px; }
  .asset-heading { font-size: 21px; }
  .asset-body { padding: 21px 20px 28px; }
  .asset-close { width: 40px; height: 40px; }
  .asset-header .back-button { padding-top: 4px; padding-bottom: 3px; }
  .asset-metrics { gap: 18px 22px; }
  .asset-detail-row { grid-template-columns: 30% minmax(0, 1fr); }
}

@media (max-height: 640px) and (max-width: 900px) {
  .asset-header { position: static; }
}
@media (max-height: 560px) and (max-width: 900px) and (orientation: landscape) {
  :root { --drawer-width: min(360px, 52vw); }
  .drawer-open { --drawer-occupied: var(--drawer-width); --drawer-bottom: 0px; }
  .drawer-open #sidebar { width: min(var(--sidebar-width), calc(100vw - var(--drawer-width) - 24px)); max-height: calc(100dvh - 24px); }
  #asset-panel { top: 72px; height: auto; width: var(--drawer-width); border-left: 1px solid var(--border); border-top: 0; }
}

/* Let the explorer scroll above the permanent credits, including open sheets. */
.sidebar-open #sidebar { max-height: calc(100dvh - var(--drawer-bottom) - 96px); }
@media (max-width: 900px) {
  .sidebar-open #sidebar { max-height: min(70dvh, calc(100dvh - var(--drawer-bottom) - 96px)); }
}
