/**
 * @file
 * Hides ALL admin chrome (Gin navigation, top bar, contextual edit links)
 * for authenticated users who are NOT administrators or org admins in the
 * currently active organisation.
 *
 * The body class `dp-no-admin-chrome` is added by devportal_admin_preprocess_html().
 */

/* ── Navigation sidebar, admin toolbar, and Gin top bar ────────────────── */
body.dp-no-admin-chrome #admin-toolbar,
body.dp-no-admin-chrome .admin-toolbar,
body.dp-no-admin-chrome .admin-toolbar-control-bar,
body.dp-no-admin-chrome .admin-toolbar-overlay,
body.dp-no-admin-chrome [data-drupal-admin-styles].admin-toolbar,
body.dp-no-admin-chrome .gin--navigation,
body.dp-no-admin-chrome .gin--navigation-top-bar,
body.dp-no-admin-chrome .gin-secondary-toolbar,
body.dp-no-admin-chrome .gin-secondary-toolbar--frontend,
body.dp-no-admin-chrome .top-bar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  visibility: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* ── Remove ALL offsets reserved by Navigation / Gin ─────────────────────
   The top bar sets --drupal-displace-offset-top: 54px on :root and the
   navigation sidebar sets --drupal-displace-offset-left. Both create empty
   space even when the elements are hidden. Override on html AND body.
   ─────────────────────────────────────────────────────────────────────── */
html:has(body.dp-no-admin-chrome) {
  --drupal-displace-offset-left: 0px !important;
  --drupal-displace-offset-top: 0px !important;
  --drupal-displace-offset-right: 0px !important;
  --admin-toolbar-sidebar-width: 0px !important;
  --admin-toolbar-top-bar-height: 0px !important;
  --gin-toolbar-x-offset: 0px !important;
  --gin-toolbar-y-offset: 0px !important;
}

body.dp-no-admin-chrome {
  --drupal-displace-offset-left: 0px !important;
  --drupal-displace-offset-top: 0px !important;
  --drupal-displace-offset-right: 0px !important;
  --admin-toolbar-sidebar-width: 0px !important;
  --admin-toolbar-top-bar-height: 0px !important;
  --gin-toolbar-x-offset: 0px !important;
  --gin-toolbar-y-offset: 0px !important;
}

/* Remove the margin-top offset that Gin adds below the top bar */
body.dp-no-admin-chrome .gin--navigation-top-bar--offset {
  margin-top: 0 !important;
}

/* ── Contextual edit links (pencil icons on blocks/nodes) ──────────────── */
body.dp-no-admin-chrome .contextual,
body.dp-no-admin-chrome .contextual-region > .contextual {
  display: none !important;
}

/* ── Gin sticky form actions bar ───────────────────────────────────────── */
body.dp-no-admin-chrome .gin-sticky-form-actions,
body.dp-no-admin-chrome .gin-sticky-form-actions--preprocessed {
  display: none !important;
}

/* ── Ensure content area has no leftover offsets ───────────────────────── */
body.dp-no-admin-chrome .dialog-off-canvas-main-canvas {
  padding-left: 0 !important;
  margin-left: 0 !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Reset any padding/margin on the page header region from Gin */
body.dp-no-admin-chrome .region-sticky,
body.dp-no-admin-chrome .region-sticky__items,
body.dp-no-admin-chrome .region-sticky__items__inner {
  display: none !important;
}
