/* Whetstone Geo: stacking for swipe compares and overlay panels.
   Swipe handles, divider lines, and section labels live in .wg-cmp-layer
   (z index 450, isolated). Legend, About, Credits, layer controls, Details,
   title, compare panel, collapse tabs, and feature popups sit above that
   (z index 1000 and up) with solid, opaque backgrounds.
   Load this after whetstone-map.css, style.css, and wg-theme.css so these
   rules win. Include it on every map so a later swipe control gets the same
   layering. Pair with wg-swiper.js so popups can leave the map pane
   (Leaflet applies a transform there, which would keep them under the swipe). */

.wg-map {
  --wg-z-map: 0;
  --wg-z-swiper: 450;
  --wg-z-ui: 1000;
  --wg-z-popup: 1100;
  --wg-z-panel: 1200;
}

/* Let Leaflet panes and the swipe layer share one stacking context so
   promoted popups can sit above swipe handles. */
.wg-map-canvas {
  z-index: auto;
}
.wg-map .leaflet-map-pane {
  z-index: auto;
}

.wg-cmp-layer {
  position: absolute;
  inset: 0;
  z-index: var(--wg-z-swiper, 450);
  isolation: isolate;
  pointer-events: none;
}

.wg-cmp-layer .wg-cmp-divider { z-index: 2; }
.wg-cmp-layer .wg-cmp-divider-y { z-index: 3; }
.wg-cmp-layer .wg-cmp-tag { z-index: 1; }

/* Overlay chrome above the swipe layer. !important beats styles injected
   later by wg-collapse.js and wg-mobile-popups.js. */
.wg-map-legends,
.wg-map-legend,
.wg-left-stack,
.wg-map-title,
.wg-map-footer,
.wg-bottom-stack,
.wg-map-views,
.wg-collapse-tab,
.wg-credits-tab,
.wg-map .leaflet-control-container,
.wg-map .leaflet-top,
.wg-map .leaflet-bottom {
  z-index: var(--wg-z-ui, 1000) !important;
}

.wg-map .leaflet-popup-pane,
.wg-map .leaflet-tooltip-pane,
.wg-map .leaflet-container > .leaflet-popup-pane,
.wg-map .leaflet-container > .leaflet-tooltip-pane {
  z-index: var(--wg-z-popup, 1100) !important;
}

.wg-about-panel,
.wg-credits-panel,
#credits-panel {
  z-index: var(--wg-z-panel, 1200) !important;
}

/* Solid, fully opaque panel backgrounds so text stays readable over handles.
   This overrides the 94 percent paper fill in wg-theme.css. */
.wg-map .wg-map-legend,
.wg-map .wg-map-title,
.wg-map .wg-map-footer,
.wg-about-dialog,
.wg-credits-panel,
#credits-panel,
.wg-cmp-panel,
.wg-time,
.wg-anim,
.leaflet-popup-content-wrapper {
  background: #fcfaf6 !important;
  background-color: #fcfaf6 !important;
  background-image: none !important;
}

/* One crosshair handle at the line crossing. Lines are visual only. */
.wg-cmp-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  cursor: move;
  color: var(--forest-900, #10241c);
  background: var(--paper, #fcfaf6);
  border: 2px solid var(--forest-800, #204435);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(16, 36, 28, 0.4);
}
.wg-cmp-handle:focus-visible { outline: 3px solid var(--ochre-500, #c4962a); outline-offset: 2px; }
.wg-cmp-handle.is-drag { background: var(--ochre-200, #ead49a); }
.wg-cmp-divider,
.wg-cmp-divider-y,
.wg-cmp-line,
.wg-cmp-line-y,
.wg-cmp-divider::before,
.wg-cmp-divider-y::before {
  pointer-events: none !important;
  cursor: default;
}
.wg-cmp-modes,
.wg-cmp-fade { display: none !important; }
