/* Shared glass finish for web navigation and public map panels. */
:root {
  --ara-glass-background: rgba(21, 30, 50, 0.68);
  --ara-glass-blur: 14px;
  --ara-glass-border: rgba(255, 255, 255, 0.10);
}
.heritage-heading { display:flex; align-items:center; gap:8px; margin-bottom:14px; }
.heritage-heading h3 { font-size:14px; font-weight:700; color:#e5edf7; }
.heritage-heading::after { content:""; flex:1; height:1px; margin-left:5px; background:rgb(158 180 210 / 18%); }
.heritage-columns { display:grid; grid-template-columns:fit-content(55%) minmax(0,1fr); gap:14px; }
.heritage-primary { position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:6px; min-width:clamp(84px,7vw,104px); padding-right:11px; font-size:15px; line-height:1.35; font-weight:600; color:#e5edf7; overflow-wrap:anywhere; }
.heritage-primary:only-child { grid-column:1/-1; }
.heritage-primary:not(:only-child)::after { content:""; position:absolute; inset:3px 0 3px auto; width: 1px; border-radius: 1px; background: rgb(158 180 210 / 18%); }
.heritage-primary small { display:block; font-size:9px; text-transform:uppercase; letter-spacing:.06em; color:#b2bdcd; }
.heritage-primary .material-symbols-rounded { display:grid; place-items:center; width:39px; height:39px; font-size:25px; color:var(--tone); background:color-mix(in srgb,var(--tone) 15%,#151a26); border-radius:11px; }
.heritage-tags { display:flex; flex-wrap:wrap; align-content:flex-start; align-items:center; gap:6px; min-width:0; }
.heritage-tag { display:inline-flex; align-items:center; gap:7px; max-width:100%; padding:5px 8px; border-radius:7px; border:1px solid color-mix(in srgb,var(--tone) 32%,#253041); background:color-mix(in srgb,var(--tone) 9%,#131927); font-size:12px; font-weight:600; line-height:1.35; color:#e5edf7; overflow-wrap:anywhere; }
.heritage-tag .material-symbols-rounded { color:var(--tone); font-size:17px; flex:none; }
@media(max-width:460px) { .heritage-columns { gap:10px; } .heritage-primary { font-size:14px; } }
@font-face {
  font-family: 'ARA Cluster Sans';
  src: url('/fonts/navigation/instrument-sans-variable.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

#mapContainer .ara-map-cluster { background: transparent; border: 0; display: grid; place-items: center; pointer-events: none; }
.ara-map-cluster__face {
  pointer-events: auto;
  display: grid; place-items: center; width: 34px; height: 34px; box-sizing: border-box;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.27);
  background: rgba(21,30,50,.79); color: #f4f8fc;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 4px 12px rgba(0,0,0,.3);
  font: 650 12px/1 'ARA Cluster Sans', 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .2s, border-color .2s;
}
.ara-map-cluster__face > span { display: block; line-height: 1; transform: translateY(-.5px); }
.ara-map-cluster__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ara-map-cluster:focus-visible { outline: 0; }
.ara-map-cluster:focus-visible .ara-map-cluster__face { outline: 2px solid #b9ddff; outline-offset: 3px; }
@media (hover: hover) {
  .ara-map-cluster:hover .ara-map-cluster__face {
    transform: scale(1.08); background: rgba(41,60,80,.94); border-color: rgba(213,231,245,.65);
  }
}
.ara-map-cluster:active .ara-map-cluster__face { transform: scale(.98); }

/* An opacity-only outline leaves the pin and its geographic anchor untouched. */
#mapContainer .marker-pin::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.34); opacity: 0; transition: opacity .18s ease;
}
@media (hover: hover) {
  #mapContainer .custom-tree-div-icon:hover .marker-pin::after { opacity: 1; }
}
#mapContainer .custom-tree-div-icon:focus-visible { outline: 0; }
#mapContainer .custom-tree-div-icon:focus-visible .marker-pin::after { opacity: 1; }

.map-cluster-close {
  position: fixed; right: calc(20px + env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 140px);
  z-index: 95; width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  color: #f4f8fc; border: 1px solid var(--ara-map-glass-border); border-radius: 50%;
  background: var(--ara-map-glass-background); backdrop-filter: blur(var(--ara-map-glass-blur)); -webkit-backdrop-filter: blur(var(--ara-map-glass-blur));
  box-shadow: 0 4px 12px rgba(0,0,0,.3); cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.map-cluster-close[hidden] { display: none; }
.map-cluster-close:hover { border-color: rgba(213,231,245,.65); }
.map-cluster-close:active { transform: scale(.95); }
.map-cluster-close:focus-visible { outline: 2px solid #b9ddff; outline-offset: 3px; }
@media (min-width: 1880px) { .map-cluster-close { top: calc(max(12px, env(safe-area-inset-top)) + 68px); } }
body[data-collection-embed] .map-cluster-close { top: 88px; }
@media (max-width: 767px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  body:not(.mobile-public-map) .map-cluster-close { right: calc(12px + env(safe-area-inset-right)); top: calc(max(8px,env(safe-area-inset-top)) + 120px); }
  body.has-cluster-view.web-map-chrome .map-tools { top: calc(max(8px,env(safe-area-inset-top)) + 172px); }
  body.web-map-chrome:has(#sidePanel[data-sheet="full"]) .map-cluster-close,
  body.map-keyboard-open .map-cluster-close { display: none; }
}
body.mobile-public-map .map-cluster-close { top: calc(max(12px,env(safe-area-inset-top)) + 76px); right: calc(16px + env(safe-area-inset-right)); }
@media (max-width: 767px) {
  body.mobile-public-map.has-cluster-view #layerToggle { top: calc(max(12px,env(safe-area-inset-top)) + 128px); }
}
@media (prefers-reduced-motion: reduce) {
  .ara-map-cluster__face, #mapContainer .marker-pin::after, .map-cluster-close { transition: none; }
}
.map-tree-hover-anchor {
  position: fixed; z-index: 95; left: 50%;
  bottom: max(calc(28px + env(safe-area-inset-bottom)), calc(var(--map-credits-height, 0px) + 12px));
  transform: translateX(-50%); width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.map-tree-hover {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--ara-map-glass-border);
  background: var(--ara-map-glass-background); color: #eff5fa;
  backdrop-filter: blur(var(--ara-map-glass-blur)); -webkit-backdrop-filter: blur(var(--ara-map-glass-blur));
  box-shadow: 0 10px 30px rgba(0,0,0,.2); font-family: 'ARA Cluster Sans', 'Inter', sans-serif;
  opacity: 0; transform: translateY(4px); transition: opacity 85ms linear, transform 85ms ease-out;
}
.map-tree-hover.is-visible { opacity: 1; transform: translateY(0); transition-duration: 100ms; }
.map-tree-hover__icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; font-size: 21px; }
.map-tree-hover__copy { min-width: 0; }
.map-tree-hover__name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.map-tree-hover__species { font-size: 11px; line-height: 1.4; color: #c0cfdb; margin-top: 2px; }
.map-tree-hover__name, .map-tree-hover__species { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767px) {
  .map-tree-hover-anchor { bottom: calc(144px + env(safe-area-inset-bottom)); }
  body.mobile-public-map .map-tree-hover-anchor { bottom: calc(104px + env(safe-area-inset-bottom)); }
  body:has(#sidePanel.open) .map-tree-hover-anchor, body.map-keyboard-open .map-tree-hover-anchor { display: none; }
}
@media (prefers-reduced-motion: reduce) { .map-tree-hover { transition: none; transform: none; } }
@font-face {
  font-family: 'ARA Instrument Sans';
  src: url('/fonts/navigation/instrument-sans-variable.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ara-card-surface: #151f30;
  --ara-card-line: #344255;
  --ara-card-button: #f5f8fa;
  --ara-card-button-ink: #132034;
  --ara-card-button-hover: #dbeafe;
  --ara-card-focus: #b1d9ff;
  --ara-card-photo: #223146;
  --ara-card-sheen: rgb(177 217 255 / 12%);
  --ara-card-font: 'ARA Instrument Sans', system-ui, sans-serif;
}

.ara-card-skeleton {
  position: relative; min-width: 0; overflow: hidden; background: var(--ara-card-surface);
  border: 1px solid var(--ara-card-line); border-radius: 12px; overflow-anchor: none;
}
.ara-card-photo-loading { position: relative; overflow: hidden; }
.ara-card-more {
  display: block; margin: 24px auto 0; min-width: 152px; min-height: 44px;
  padding: 12px 24px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ara-card-button); color: var(--ara-card-button-ink);
  font-family: var(--ara-card-font); font-weight: 600; font-size: 14px; line-height: 1.3;
  overflow-anchor: none;
}
.ara-card-more[hidden] { display: none; }
.ara-card-more:focus-visible { outline: 2px solid var(--ara-card-focus); outline-offset: 3px; }
@media (hover: hover) { .ara-card-more:hover { background: var(--ara-card-button-hover); } }
.ara-card-skeleton__photo { aspect-ratio: 1; background: var(--ara-card-photo); }
.ara-card-skeleton__copy { display: grid; gap: 8px; padding: 14px 12px; }
.ara-card-skeleton__copy span {
  width: 52%; height: 7px; border-radius: 3px; background: var(--ara-card-line);
}
.ara-card-skeleton__copy span:first-child { width: 74%; height: 12px; }
.ara-card-skeleton__copy span:last-child { width: 35%; }
@media (prefers-reduced-motion: no-preference) {
  .ara-card-skeleton::after, .ara-card-photo-loading::after {
    content: ''; position: absolute; inset: -20% auto -20% -65%; width: 40%;
    pointer-events: none; background: var(--ara-card-sheen); filter: blur(12px);
    animation: ara-card-sheen 2.2s ease-in-out infinite;
  }
  .ara-card-skeleton:nth-child(3n + 2)::after { animation-delay: .1s; }
  .ara-card-skeleton:nth-child(3n)::after { animation-delay: .2s; }
  @keyframes ara-card-sheen {
    0% { transform: translateX(0) skewX(-14deg); }
    78%, 100% { transform: translateX(500%) skewX(-14deg); }
  }
}
#panelContent:has(> .map-explorer-list--loading) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#panelContent > .map-explorer-header--loading {
  flex-shrink: 0;
}

#panelContent > .map-explorer-list--loading {
  flex: 1;
  min-height: 0;
  padding-bottom: var(--map-explorer-inset);
  overflow: hidden;
}

.map-explorer-skeleton__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.map-explorer-skeleton__row > span,
.map-explorer-skeleton__control::before {
  background: #273347;
}

#panelContent .map-explorer-header--loading h2,
#panelContent .map-explorer-header--loading .map-explorer-skeleton__control {
  color: transparent;
}

#panelContent .map-explorer-skeleton__control {
  cursor: default;
}

.map-explorer-skeleton__control::before {
  content: '';
  position: absolute;
  inset: 50% 0.5rem auto;
  height: 0.5rem;
  transform: translateY(-50%);
  border-radius: 0.25rem;
}

.map-explorer-skeleton__control--settings::before {
  inset: 50% auto auto 50%;
  width: 0.75rem;
  height: 0.75rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.map-explorer-header--loading h2 {
  height: 1.75rem;
}

.map-explorer-header--loading h2::before {
  height: 0.75rem;
}

.map-explorer-skeleton__row.ara-card-skeleton {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
}

.map-explorer-skeleton__row.ara-card-skeleton,
#panelContent .map-explorer-skeleton__control.ara-card-skeleton {
  border-color: rgb(255 255 255 / 6%);
  background: rgb(18 26 41 / 55%);
}

.map-explorer-skeleton__row.ara-card-skeleton::after,
.map-explorer-skeleton__control.ara-card-skeleton::after {
  background: rgb(177 217 255 / 4.5%);
}

.map-explorer-skeleton__icon { width: 2rem; height: 2rem; border-radius: 50%; }
.map-explorer-skeleton__label { width: 78%; height: 0.75rem; border-radius: 0.25rem; }
.map-explorer-skeleton__row:nth-child(even) .map-explorer-skeleton__label { width: 62%; }
.map-explorer-skeleton__count { width: 1.75rem; height: 1.125rem; border-radius: 999px; }
.map-explorer-skeleton__toggle { width: 1.25rem; height: 1.25rem; border-radius: 0.375rem; }
.map-explorer-skeleton__arrow { width: 0.75rem; height: 0.5rem; border-radius: 0.25rem; }

.map-explorer-skeleton__nearby.ara-card-skeleton {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 44px;
  padding-block: 0.5rem;
}

.map-explorer-skeleton__nearby .map-explorer-skeleton__icon { width: 1.25rem; height: 1.25rem; }

body > .map-credits {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 90;
  max-width: min(720px, calc(100% - var(--map-credits-left-clearance, 12px)));
  float: none;
  margin: 0;
  padding: 4px calc(8px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) 8px;
  border: 1px solid var(--ara-map-glass-border);
  border-radius: 8px 0 0;
  background: var(--ara-map-glass-background);
  -webkit-backdrop-filter: blur(var(--ara-map-glass-blur));
  backdrop-filter: blur(var(--ara-map-glass-blur));
  color: #c3cfdd;
  font: 400 11px/1.4 'ARA Instrument Sans', sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-credits--compact {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}

#sidePanel > .map-credits {
  flex: none;
  order: 1;
  justify-content: center;
  padding: 4px 10px 5px;
  padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
  color: #c3cfdd;
  font: 400 11px/1.4 'ARA Instrument Sans', sans-serif;
  text-align: center;
  overflow-wrap: anywhere;
}

#sidePanel:has(> .map-credits:not([hidden])) { --map-panel-content-bottom-padding: 0px; }
.mobile-public-map.has-app-nav #sidePanel:has(> .map-credits:not([hidden])) { padding-bottom: 0; }

.map-credits[hidden],
body > .map-credits:empty,
#mapContainer .map-credits-replaced { display: none; }

.mobile-public-map.has-app-nav > .map-credits--compact {
  bottom: var(--app-nav-height);
  padding-bottom: 4px;
}

.map-credits a, .map-settings-credits a {
  color: #f8fafc;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.map-credits a:hover, .map-settings-credits a:hover { color: #bfdbfe; }

.map-credits a:focus-visible, .map-settings-credits :focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

@media (max-width: 767px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  body > .map-credits { max-width: calc(100% - 12px - env(safe-area-inset-left)); }
  body > .map-credits--compact {
    --credit-side-inset: max(env(safe-area-inset-left), env(safe-area-inset-right));
    left: 50%; right: auto; z-index: 105; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 16px - 2 * var(--credit-side-inset));
    justify-content: center; text-align: center;
    padding: 2px 8px calc(2px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
  }
  .mobile-public-map.has-app-nav > .map-credits--compact { padding-bottom: 2px; }
}

.map-settings-credits {
  border-top: 1px solid var(--ara-map-glass-border);
  color: #e2e8f0;
  font-size: 0.875rem;
}

.map-settings-credits summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding-inline: 4px;
  border-radius: 6px;
  cursor: pointer;
}

.map-settings-credits summary::-webkit-details-marker { display: none; }
.map-settings-credits summary:hover { background: rgba(255, 255, 255, 0.05); }

.map-settings-credits summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-inline-end: 5px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}

.map-settings-credits[open] summary::after { transform: translateY(2px) rotate(225deg); }

.map-settings-credits ul, .map-settings-credits p {
  margin: 0;
  padding: 4px 4px 2px;
  color: #c3cfdd;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.map-settings-credits li + li { margin-top: 6px; }

/* ============================================================
   publicmap.css — Styles for the Public Map page
   Extracted from src/shared/publicmap.html inline \3c style> block
   ============================================================ */

/* Global Overrides */
/* The collection iframe has its own viewport, with navigation in its parent. */
body[data-collection-embed] { --ara-top-nav-height: 0px; }
body[data-collection-embed] #ara-bottom-nav,
body[data-collection-embed] [data-open-map-settings] { display: none; }
@media (min-width: 768px) {
  body[data-collection-embed] .side-panel { top: 16px; bottom: 16px; left: 16px; width: 310px; }
  body[data-collection-embed][data-always-explorer] #mapUiOverlay { padding-left: 346px; padding-right: 16px; }
  body[data-collection-embed] #layerToggle { bottom: 120px; }
  body[data-collection-embed] .locate-me-btn { bottom: 172px; }
}

body {
  --ara-map-glass-background: rgba(21, 30, 50, 0.90);
  --ara-map-glass-blur: 12px;
  --ara-map-glass-border: rgba(255, 255, 255, 0.08);
  font-family: 'Inter', sans-serif;
  background-color: #0B1120;
  overflow: hidden;
}

/* Native map panels keep their existing field-use treatment. */
body:not(.mobile-public-map) {
  --ara-map-glass-background: var(--ara-glass-background);
  --ara-map-glass-blur: var(--ara-glass-blur);
  --ara-map-glass-border: var(--ara-glass-border);
}

/* Scrollbar hiding */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Map Container - Full Screen Background */
#mapContainer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background: #0B1120;
}

/* UI Overlay — top padding adapts to nav height (56px on web, 0px on mobile) + status bar on mobile */
#mapUiOverlay {
  padding-top: calc(var(--ara-top-nav-height, 0px) + 20px + env(safe-area-inset-top, 0px));
}

.public-map-topbar {
  gap: 0.75rem;
}

.public-map-search {
  width: min(24rem, 100%);
}

.public-map-controls {
  z-index: 2;
}

#layerToggle {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(194px + env(safe-area-inset-bottom, 0px));
  z-index: 46;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  background: rgba(21, 30, 50, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#layerToggle .material-symbols-rounded,
.locate-me-btn .material-symbols-rounded {
  color: inherit;
}

#layerToggle:hover {
  background: rgba(21, 30, 50, 1);
  color: #f8fafc;
  border-color: rgba(59, 130, 246, 0.5);
}

#layerToggle:active {
  transform: scale(0.95);
}



body[data-always-explorer] .public-map-topbar {
  align-items: center;
}

body[data-always-explorer] .public-map-controls {
  position: absolute;
  pointer-events: none;
}

body[data-always-explorer] .public-map-controls #layerToggle {
  pointer-events: auto;
}

/* --- SIDE PANEL (GLASSMORPHISM) --- */
.side-panel {
  --map-explorer-inset: 10px;
  position: fixed;
  z-index: 40;
  background: var(--ara-map-glass-background);
  backdrop-filter: blur(var(--ara-map-glass-blur));
  -webkit-backdrop-filter: blur(var(--ara-map-glass-blur));
  border: 1px solid var(--ara-map-glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  flex-direction: column;
}

.side-panel .flex-1::-webkit-scrollbar {
  display: none;
}

.side-panel .flex-1 {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.mobile-public-map.has-app-nav .side-panel.open {
  bottom: calc(var(--app-nav-height) + var(--map-credits-height, 0px));
}

.mobile-public-map .leaflet-control-zoom { display: none !important; }

#panelContent > :has(+ .map-explorer-list),
#panelContent > .map-nearby-legacy-heading {
  padding-inline-start: var(--map-explorer-inset);
}

#sidePanel #panelContent > .map-explorer-header {
  padding-block: 16px 8px;
}

#panelContent > .map-explorer-header > :first-child {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0;
}

#panelContent .map-explorer-header button {
  border-radius: 999px;
}

@media (max-width: 767px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  #sidePanel #panelContent > .map-explorer-header {
    padding-block: 12px 4px;
    padding-inline: var(--map-explorer-inset);
  }
  .mobile-public-map #sidePanel #panelContent > .map-explorer-header { padding-inline-end: 52px; }
  #panelContent > .map-explorer-header > :first-child {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; column-gap: 8px;
  }
  .map-explorer-header h2 { overflow-wrap: anywhere; }
  .map-explorer-actions { gap: 8px; }
  #panelContent .map-explorer-actions > button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; height: auto;
    margin: 0; padding: 0; border: 0; border-radius: 999px;
    background: transparent; font-size: 11px; line-height: 1.2; white-space: nowrap;
  }
  .map-explorer-actions > button:not(:disabled) > span {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 24px; padding-inline: 8px; border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.10); background: rgba(255, 255, 255, 0.10);
  }
  .map-explorer-actions > [data-open-map-settings]:not(:disabled) > span {
    width: 28px; height: 28px; padding: 0; font-size: 16px;
  }
  .map-explorer-actions > button:not(:disabled):hover > span { background: rgba(255, 255, 255, 0.20); }
  .map-explorer-actions > button:focus-visible { outline: 2px solid #93c5fd; outline-offset: -2px; }
}

@media (max-width: 360px) {
  .mobile-public-map .map-explorer-header h2 { font-size: 1rem; line-height: 1.25; }
}

#panelContent > .map-explorer-list,
#panelContent > .map-explorer-empty,
#panelContent > .map-record-panel {
  padding-inline: var(--map-explorer-inset);
}

#sidePanel #panelContent > .map-record-panel.map-record-panel--tree {
  padding-top: 4px;
}

.map-record-panel--tree .map-detail-back {
  min-height: 44px;
  max-width: calc(100% - 48px);
  text-align: left;
}

#panelContent .map-record-panel--tree .tree-points--compact {
  margin-bottom: 8px;
}

#panelContent [data-explorer-tree-list] {
  --map-tree-row-inset: var(--map-explorer-inset);
  padding-inline: var(--map-tree-row-inset);
}

#panelContent [data-explorer-category] > [data-explorer-tree-list] {
  --map-tree-row-inset: 4px;
}

.map-tree-stat--functional-circumference {
  padding-inline: 0.125rem;
}

.map-tree-stat--functional-circumference > span:first-child {
  font-size: 0.625rem;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
  overflow-wrap: anywhere;
}

.map-photo-strip {
  max-width: 100%;
  min-width: 0;
  padding-right: 1rem;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(147, 197, 253, 0.4) rgba(255, 255, 255, 0.06);
}

.map-photo-strip::-webkit-scrollbar {
  display: block;
  height: 8px;
}

.map-photo-strip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.map-photo-strip::-webkit-scrollbar-thumb {
  background: rgba(147, 197, 253, 0.4);
  border-radius: 999px;
}

.map-photo-strip__end {
  width: max(1rem, env(safe-area-inset-right, 0px));
}

.close-panel-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.close-panel-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}

body[data-always-explorer] .close-panel-btn {
  display: none;
}

/* Sibling of the scroller, pinned below the panel content. */
.panel-scroll-cue {
  flex: none;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 34px;
  border-top: 1px solid var(--ara-map-glass-border);
  color: #d9e9f9;
  background: rgb(21 30 50 / 42%);
  cursor: pointer;
}
.panel-scroll-cue[hidden] { display: none; }
.panel-scroll-cue:hover { background: rgb(85 116 151 / 22%); }
.panel-scroll-cue:focus-visible { outline: 2px solid #93c5fd; outline-offset: -3px; }
.panel-scroll-cue span { font-size: 23px; line-height: 1; }

/* Desktop: Floating Dock Left */
@media (min-width: 768px) {
  body[data-always-explorer] #mapUiOverlay {
    padding-left: calc(420px + 1.5rem);
  }

  body[data-always-explorer] .public-map-topbar {
    width: 100%;
  }

  .side-panel {
    top: calc(var(--ara-top-nav-height, 0px) + 20px);
    bottom: 20px;
    left: 20px;
    width: 400px;
    border-radius: 1.5rem;
    transform: translateX(-120%);
  }

  .side-panel.open {
    transform: translateX(0);
  }

}

/* Lift the explorer alongside the 1000px pill when its 400px dock
   and a 20px gap fit to the left of the centered navigation. */
@media (min-width: 1880px) {
  body[data-always-explorer]:not(.mobile-public-map):not([data-collection-embed]) .side-panel {
    top: 12px;
  }
}

@media (min-width: 768px) and (max-width: 1080px) {
  body[data-always-explorer] #mapUiOverlay {
    padding-left: calc(420px + 0.75rem);
    padding-right: 0.75rem;
  }

  body[data-always-explorer] .public-map-search {
    width: min(100%, 22rem);
  }

  body[data-always-explorer] .public-map-controls {
    width: auto;
  }
}

/* Mobile: Bottom Sheet */
@media (max-width: 767px) {
  body.mobile-public-map .public-map-topbar {
    min-height: 48px;
    padding-right: 56px;
    padding-left: 56px;
  }

  body.mobile-public-map .public-map-search {
    width: 100%;
    max-width: none;
  }

  body.mobile-public-map .public-map-controls {
    position: static;
  }

  body.mobile-public-map #legendToggle {
    position: fixed;
    top: calc(24px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    z-index: 46;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }

  #layerToggle {
    top: calc(var(--ara-top-nav-height, 0px) + 80px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: auto;
  }

  body.mobile-public-map #layerToggle {
    position: fixed;
    display: flex;
    z-index: 46;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .side-panel {
    left: 0;
    right: 0;
    bottom: 0;
    height: 50vh;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    transform: translateY(110%);
    border-bottom: none;
    padding-bottom: 20px;
    z-index: 60;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), height 0.3s ease;
  }

  .side-panel.open {
    transform: translateY(0);
  }

  .side-panel.expanded {
    height: 70vh;
  }


  .leaflet-control-zoom {
    display: none !important;
  }
}

.leaflet-tile.basemap-tile-previewing {
  visibility: inherit;
}

.basemap-tile-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

/* Filter Checkbox (Glassmorphism) */
.filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.filter-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.filter-checkbox:checked::after {
  content: 'check';
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: black;
  font-weight: bold;
}

/* Stop propagation helper */
.stop-prop {
  cursor: default;
}

.public-map-explorer-legal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.25rem 0.25rem 0.35rem;
  color: rgba(203, 213, 225, 0.62);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
}

.public-map-explorer-legal__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.public-map-explorer-legal a {
  color: rgba(219, 234, 254, 0.78);
  text-decoration: none;
  font-weight: 700;
}

.public-map-explorer-legal a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Custom Range Slider */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.leaflet-popup-content {
  font-size: 0.95rem;
}

.leaflet-popup-content b {
  color: var(--accent-2);
}

a.leaflet-popup-close-button {
  color: var(--muted) !important;
}

.leaflet-popup-content .popup-table {
  margin-top: 8px;
  width: 100%;
  border-collapse: collapse;
}

.leaflet-popup-content .popup-table td {
  padding: 3px 5px;
  font-size: 0.85rem;
}

.leaflet-popup-content .popup-table td:first-child {
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.popup-view-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #001528;
  border: 1px solid transparent;
  text-align: center;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.popup-view-btn:hover {
  background-color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.home-btn i {
  font-size: 20px;
  line-height: 1;
}

.local-tree-marker {
  background-color: var(--accent-2);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.leaflet-control-layers {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.leaflet-control-layers-base label {
  color: var(--text);
}

/* Marker Cluster Customization for Dark Theme */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(11, 34, 53, 0.6) !important;
  border: 2px solid var(--accent);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: rgba(11, 34, 53, 0.8) !important;
  color: var(--text) !important;
  font-weight: 700;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  line-height: normal !important;
  border-radius: 50%;
}

.marker-cluster span {
  line-height: 0 !important;
  display: block !important;
}

.local-tree-marker-cluster .marker-cluster-small,
.local-tree-marker-cluster .marker-cluster-medium,
.local-tree-marker-cluster .marker-cluster-large {
  border-color: var(--accent-2);
}

/* User Avatar in Popup */
.avatar-tiny {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #001528;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.70rem;
  flex-shrink: 0;
}

.popup-submitter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* --- Heritage Pin Marker Style --- */
.custom-tree-div-icon {
  position: relative;
  background: transparent;
  border: none;
}

.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color);
  border: 2px solid white;
  position: absolute;
  /* Keep the pin and counter-rotated glyph in the normal paint path.
     A forced 3D layer rasterizes the small glyph before rotation and can soften it. */
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -14px 0 0 -14px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
}

.marker-pin span {
  transform: rotate(45deg);
  color: white;
  font-size: 16px;
  pointer-events: none;
}

.marker-pin.active {
  box-shadow: 0 0 20px 4px var(--pin-color), 0 0 0 4px white;
  z-index: 1000 !important;
  animation: pulse-glow 2s infinite;
  border-color: white;
}

.custom-forest-div-icon {
  position: relative;
  background: transparent;
  border: 0;
}

.forest-stand-pin {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #15803d;
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(21, 128, 61, 0.28);
  display: grid;
  place-items: center;
  transform: translateZ(0);
}

.forest-stand-pin svg {
  width: 15px;
  height: 15px;
  color: #fff;
  fill: none;
  pointer-events: none;
}

.forest-stand-pin--conifer svg {
  width: 17px;
  height: 17px;
}

.forest-icon-fill {
  fill: currentColor;
}

.forest-icon-cut {
  fill: none;
  stroke: #15803d;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.forest-panel-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(34, 197, 94, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(22, 101, 52, 0.24), rgba(15, 23, 42, 0.28)),
    rgba(15, 23, 42, 0.48);
  padding: 14px;
}

.forest-panel-icon {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #15803d;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32), 0 0 0 4px rgba(21, 128, 61, 0.24);
}

.forest-panel-icon svg {
  width: 31px;
  height: 31px;
  color: #fff;
  fill: none;
}

.forest-panel-icon--conifer svg {
  width: 34px;
  height: 34px;
}

.forest-panel-stat {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.forest-panel-stat span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.forest-panel-stat strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7), 0 0 20px 4px var(--pin-color);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0), 0 0 30px 8px var(--pin-color);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 0 20px 4px var(--pin-color);
  }
}

/* --- Locate Me Button --- */
.locate-me-btn {
  position: fixed;
  z-index: 45;
  bottom: calc(170px + env(safe-area-inset-bottom, 0px));
  right: calc(10px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(21, 30, 50, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.locate-me-btn:hover {
  background: rgba(21, 30, 50, 1);
  color: #f8fafc;
  border-color: rgba(59, 130, 246, 0.5);
}

.locate-me-btn:active {
  transform: scale(0.95);
}

.locate-me-btn.active {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.locate-me-btn.locating {
  animation: locating-pulse 1.5s infinite;
}

@keyframes locating-pulse {
  0%, 100% { color: #cbd5e1; }
  50% { color: #93c5fd; }
}

@media (min-width: 768px) {
  .locate-me-btn {
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 767px) {
  #locateMeBtn {
    top: calc(var(--ara-top-nav-height, 0px) + 132px + env(safe-area-inset-top, 0px)) !important;
    right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 46 !important;
  }

  #demoHelpBtn {
    top: calc(var(--ara-top-nav-height, 0px) + 132px + env(safe-area-inset-top, 0px)) !important;
    right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 46 !important;
  }
}

/* --- User Location Blue Dot --- */
.user-location-dot {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  position: relative;
}

.user-location-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  animation: location-ring 2s ease-out infinite;
}

@keyframes location-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* --- Nearby Panel Styles --- */
.nearby-tree-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  text-align: start;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nearby-tree-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nearby-tree-row:active {
  background: rgba(255, 255, 255, 0.12);
}

.nearby-distance-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', monospace;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nearby-distance-badge.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.nearby-distance-badge.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.nearby-distance-badge.gray {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

/* --- Toast Notification --- */
.ara-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(21, 30, 50, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ara-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Photo Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
  margin-top: 12px;
  color: #9caac3;
  font-size: 0.9rem;
  font-weight: 600;
}

.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10000;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close__label {
  font-size: 0.78rem;
  font-weight: 800;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  font-size: 28px;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

@media (max-width: 520px) {
  .lightbox-close {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    height: 42px;
  }

  .lightbox-close__label {
    display: none;
  }
}

/* Demo-only one-shot pulse applied to #demoSurveyFab after the welcome modal
   is dismissed, so first-time visitors notice the floating survey button.
   Runs exactly once (no `infinite`); the JS handler also removes the class
   on animationend or first click so returning visitors never see it. */
@keyframes araDemoFabPulse {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); transform: scale(1); }
  50%  { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0);   transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);      transform: scale(1); }
}
.ara-demo-fab-pulse {
  animation: araDemoFabPulse 1.1s ease-out 2;
}
