/**
 * @file
 * The site's stacking scale (biopama_libraries/layers). Every overlay takes
 * its z-index from these tokens, lowest first, so a new overlay never
 * re-fights the others: pick its layer, never a number. Tooltips and
 * popovers are on top of everything. Selectors are `:root body …` (0,2,1),
 * which beats the akp_config presets' `html body …` (0,1,2) without
 * !important.
 *
 * Attached site-wide by the akp theme (akp.info.yml). The table and the
 * tooltip placement rule are in NOTES-map-regions.md § "Stacking".
 *
 * Values local to a component's own stacking context stay where they are
 * (mapPopups.css 5, datatable/table.css 5, a card's 1).
 */
:root {
  --biopama-z-map-region: 1;     /* map regions: Bootstrap's z-1 on the regions row, which is !important, so this token documents the layer (Mapbox's corners are 2, inside the map) */
  --biopama-z-map-control: 3;    /* the sidebar chevrons, the drawer toggle, busy overlays */
  --biopama-z-contextual: 50;    /* the staff pencils (core's .contextual is 500): under the tool overlays and the sticky navbar */
  --biopama-z-tool-overlay: 90;  /* the map drawer and the small-screen sidebar */
  --biopama-z-navbar: 100;       /* #navbar-main: above the tool overlays (user rule), under the admin toolbar (501+) */
  --biopama-z-header: 101;       /* the header band (akp's #navbar-top): one above the bar, so the band's dropdowns open over it */
  --biopama-z-notice: 1000;      /* site messages, the map's loading and problem notices */
  --biopama-z-fixed: 1030;       /* the scroll-top button (Bootstrap's "fixed" tier) */
  --biopama-z-nav-open: 1040;    /* #navbar-main while its site menu panel is open: above the admin toolbar (decision D2, 2026-10-26); closed it stays at --biopama-z-navbar */
  --biopama-z-loader: 10000;     /* the page loader (busy/css/busy.css) */
  --biopama-z-tray: 10080;       /* the results tray, Drupal's off-canvas trays */
  --biopama-z-backdrop: 10090;   /* the modal backdrop */
  --biopama-z-dialog: 10100;     /* Drupal modals */
  --biopama-z-popup: 10110;      /* tooltips and popovers */
}

:root body #navbar-main {
  z-index: var(--biopama-z-navbar);
}

:root body .offcanvas {
  --bs-offcanvas-zindex: var(--biopama-z-tray);
}

:root body .modal-backdrop {
  --bs-backdrop-zindex: var(--biopama-z-backdrop);
}

:root body .modal {
  --bs-modal-zindex: var(--biopama-z-dialog);
}

:root body .tooltip {
  --bs-tooltip-zindex: var(--biopama-z-popup);
}

:root body .popover {
  --bs-popover-zindex: var(--biopama-z-popup);
}

:root body .contextual {
  z-index: var(--biopama-z-contextual);
}

/* A larger hit area on touch screens; the visible size does not change.
   Put .biopama-touch-target on the control itself, which must be positioned
   (add position-relative where it is static). Never on an icon-font element
   (its ::before is the icon), inside an overflow-hidden ancestor (the area is
   clipped) or in a gap-1 row (neighbouring areas would overlap). */
@media (any-pointer: coarse) {
  .biopama-touch-target::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 2.75rem);
    height: max(100%, 2.75rem);
    transform: translate(-50%, -50%);
  }
}
