:root {
  color-scheme: light;
  --bg: #f5f5f2;
  --panel: rgba(255, 255, 255, 0.96);
  --text: #141414;
  --muted: #6f6f69;
  --line: rgba(20, 20, 20, 0.11);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body, .app-shell, .map-stage, #map { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }

.map-stage { position: relative; }
#map { position: absolute; inset: 0; background: #e9e9e4; }

.toolbar {
  position: absolute;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: auto minmax(220px, 500px) auto auto;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toolbar > * { pointer-events: auto; }
.brand-block, .search-box, .filters, .result-count, .day-night-toggle {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.75);
  box-shadow: 0 8px 28px rgba(0,0,0,.10);
  backdrop-filter: blur(16px);
}

.brand-block {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border-radius: 16px;
  white-space: nowrap;
}
.brand-mark { font-size: 13px; }
.brand-block strong, .brand-block span { display: block; }
.brand-block strong { font-size: 14px; letter-spacing: -.01em; }
.brand-block span { color: var(--muted); font-size: 11px; margin-top: 1px; }

.search-box { border-radius: 16px; overflow: hidden; }
.search-box input {
  width: 100%; height: 50px; border: 0; outline: 0; padding: 0 17px; background: transparent; color: var(--text);
}
.search-box input::placeholder { color: #8d8d88; }

.filters { display: flex; overflow: hidden; border-radius: 16px; }
.filters label + label { border-left: 1px solid var(--line); }
.filters select {
  height: 50px; max-width: 160px; border: 0; outline: 0; padding: 0 34px 0 13px; background: transparent; color: var(--text);
}

.map-status { display: flex; gap: 8px; min-width: 0; }
.result-count {
  height: 50px; display: flex; align-items: center; padding: 0 14px; border-radius: 16px; color: var(--muted); white-space: nowrap; font-size: 12px;
}
.day-night-toggle {
  height: 50px; border: 1px solid rgba(255,255,255,.75); border-radius: 16px; padding: 0 11px; cursor: pointer; color: var(--text); white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.day-night-toggle.is-active { color: var(--text); background: rgba(255,255,255,.98); }
.day-night-toggle:focus-visible { outline: 2px solid #222; outline-offset: 2px; }
.day-night-symbol { color: var(--muted); font-size: 13px; letter-spacing: -1px; }
.day-night-state { min-width: 17px; color: var(--muted); font-size: 10px; text-align: left; }
.toggle-track {
  position: relative; width: 34px; height: 20px; flex: 0 0 34px; border-radius: 999px;
  background: rgba(20,20,20,.16); transition: background .16s ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.28); transition: transform .16s ease;
}
.day-night-toggle.is-active .toggle-track { background: #26384c; }
.day-night-toggle.is-active .toggle-thumb { transform: translateX(14px); }

.camera-panel {
  position: absolute;
  z-index: 6;
  top: 82px;
  right: 14px;
  width: min(390px, calc(100vw - 28px));
  max-height: calc(100% - 96px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-close {
  position: absolute; z-index: 2; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.88); color: #222; font-size: 22px; line-height: 1;
}
.image-shell { position: relative; aspect-ratio: 16 / 9; background: #deded8; overflow: hidden; border-radius: 21px 21px 0 0; }
.camera-image-link { display: block; width: 100%; height: 100%; padding: 0; border: 0; color: inherit; background: transparent; cursor: zoom-in; }
.camera-image-link:disabled { cursor: default; }
.camera-image-link[hidden] { display: none; }
.camera-preview-credit { display: block; margin: 6px 0; font-size: 13px; color: #4b514d; text-underline-offset: 2px; }
.camera-preview-credit[hidden] { display: none; }
.camera-lightbox { width: min(94vw, 1200px); max-width: none; padding: 46px 12px 12px; border: 0; border-radius: 18px; background: #111; }
.camera-lightbox::backdrop { background: rgba(0,0,0,.72); }
.camera-lightbox img { display: block; width: 100%; max-height: 84vh; object-fit: contain; }
.camera-lightbox button { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: #fff; font-size: 28px; cursor: pointer; }
.image-shell img { width: 100%; height: 100%; object-fit: contain; display: block; background: #deded8; }
.image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.health-badge { position: absolute; bottom: 10px; left: 10px; background: rgba(17,17,17,.78); color: white; border-radius: 999px; padding: 6px 9px; font-size: 11px; pointer-events: none; }

.camera-copy { padding: 20px; }
.eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.camera-copy h1 { margin: 0; font-size: 25px; line-height: 1.1; letter-spacing: -.035em; }
.camera-copy > p { margin: 11px 0 0; color: #555550; }
.camera-geographic-context { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #d9e5de; border-radius: 14px; background: #eef5f1; color: #344c41; font-size: 13px; }
.camera-geographic-context h3 { margin: 0 0 8px; font-size: 15px; }
.camera-geographic-context dl { margin: 0; }
.camera-geographic-context dl div { display: grid; grid-template-columns: 112px 1fr; gap: 8px; padding: 4px 0; }
.camera-geographic-context dt { color: #5a6d61; }
.camera-geographic-context dd { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chips span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: #555550; font-size: 11px; }
.camera-meta { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.camera-meta div { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 4px 0; }
.camera-meta dt { color: var(--muted); }
.camera-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.source-link { display: inline-block; margin-top: 16px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.camera-primary-link { padding: 9px 13px; border-radius: 9px; background: #1d5245; color: white; text-decoration: none; font-weight: 650; }
.camera-source-rights { margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--line); }
.camera-source-rights h3 { margin: 0 0 5px; font-size: 13px; color: #555550; }
.camera-source-rights a { display: block; width: fit-content; }
.camera-source-rights [hidden] { display: none; }
.attribution { margin: 4px 0; font-size: 12px; line-height: 1.4; color: #696963 !important; }

.empty-state {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 18px 22px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); text-align: center;
}
.empty-state strong, .empty-state span { display: block; }
.empty-state span { color: var(--muted); margin-top: 4px; }

.site-footer.compact {
  position: absolute;
  z-index: 4;
  left: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
  max-width: min(760px, calc(100vw - 120px));
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 13px;
  background: rgba(255,255,255,.90);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  backdrop-filter: blur(14px);
  font-size: 10px;
  color: var(--muted);
}
.site-footer.compact nav { display: flex; flex-wrap: wrap; gap: 8px 11px; }
.site-footer.compact a { color: var(--muted); text-decoration: none; }
.site-footer.compact a:hover, .site-footer.compact a:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.site-footer.compact .site-version { white-space: nowrap; color: #8a8a84; }

.browse-menu {
  position: absolute;
  z-index: 9;
  right: 14px;
  bottom: 66px;
  color: var(--text);
  pointer-events: none;
}
.browse-menu > summary { display: none; }
.browse-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(620px, calc(100vw - 28px));
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 18px;
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}
.browse-panel > div + div { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.browse-panel strong { display: block; margin-bottom: 9px; font-size: 12px; }
.browse-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.browse-grid a {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4f4f4b;
  text-decoration: none;
  font-size: 11px;
}
.browse-grid a:hover, .browse-grid a:focus-visible { border-color: rgba(20,20,20,.28); color: var(--text); }
.browse-grid span { color: #92928c; font-size: 10px; }

.maplibregl-ctrl-bottom-right { right: 8px; bottom: 8px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-group { border-radius: 12px !important; overflow: hidden; }

.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; }

@media (max-width: 900px) {
  .toolbar { grid-template-columns: 1fr auto; }
  .brand-block { display: none; }
  .search-box { grid-column: 1; }
  .filters { grid-column: 1 / -1; width: fit-content; }
  .map-status { grid-column: 2; grid-row: 1; }
  .camera-panel { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); left: 10px; right: 10px; width: auto; max-height: 62vh; border-radius: 22px; }
  .site-footer.compact { left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); }
  .browse-menu { right: 10px; bottom: 66px; }
  .browse-panel { width: min(620px, calc(100vw - 20px)); max-height: 46vh; }
}

@media (max-width: 700px) {
  .browse-menu {
    display: block;
    left: 10px;
    right: 10px;
    bottom: max(92px, calc(env(safe-area-inset-bottom) + 80px));
  }
  .browse-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-height: 46vh;
  }
}

@media (max-width: 560px) {
  .toolbar { left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); gap: 7px; }
  .search-box input, .filters select, .result-count, .day-night-toggle { height: 46px; }
  .filters { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label { min-width: 0; }
  .filters label:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .filters label:nth-child(4) { border-top: 1px solid var(--line); }
  .filters select { width: 100%; max-width: none; }
  .result-count { padding: 0 10px; }
  .map-status .result-count { display: none; }
  .day-night-toggle { padding: 0 11px; }
  .camera-copy { padding: 16px; }
  .camera-copy h1 { font-size: 22px; }
  .site-footer.compact { gap: 6px 9px; padding: 7px 9px; font-size: 9px; }
}
