:root {
  --db-background-color: white;
  --db-text-color: black;
  --db-background-image: repeating-linear-gradient(45deg, oklch(100% 0 0), oklch(100% 0 0) 13px, var(--sl-color-neutral-100) 13px, var(--sl-color-neutral-100) 14px);
  --db-background-size: 40px 40px;
  --db-toolbar-height: 75px;
  /* Drupal admin toolbar is 502 */
  --db-z-index: 401;
}

body:has(.display-builder) .dialog-off-canvas-main-canvas {
  /* margin-inline-start: var(--db-body-margin-left, 0); */
  margin-inline-start: var(--drupal-displace-offset-left, 0);
}

/* Fullscreen button toggle @see components/fullscreen_button. */
.display-builder--fullscreen {
  position: fixed;
  z-index: 900;
  top: 0;
  left: 0;
  overflow: auto;
  width: 100%;
  height: 100%;
  /* @todo get the body background color? */
  background-color: var(--db-background-color);
}

/* Olivero fix for fullscreen */
.display-builder-is-fullscreen {
  #toolbar-administration {
    display: none;
  }

  .site-header {
    z-index: 1;
    opacity: 0;
  }
}

.display-builder {
  /* Shoelace avoid clipping before the web components are attached */
  :not(:defined) {
    visibility: hidden;
  }

  /* Lighter global focus. */
  *:focus {
    outline: 2px solid transparent !important;
    box-shadow: none !important;
  }

  /* Disable the builder until htmx is done. */
  /* @see assets/js/display_builder.js */
  &.db-htmx-before-request {
    pointer-events: none;

    > * {
      opacity: 0.6;
    }
  }

  .db-background,
  .db-background::part(panel),
  .db-background.shoelace-button::part(base) {
    background-image: var(--db-background-image);
    background-size: var(--db-background-size);
    box-shadow: var(--sl-shadow-medium);
  }

  /* When on a viewport switch context. */
  &.viewport-active {
    .display-builder__main {
      box-shadow:
        rgb(0, 0, 0, 0.02) 0 1px 3px 0,
        rgb(27, 31, 35, 0.15) 0 0 0 1px;
    }
    /* Viewport switch menu active state */
    .switch-viewport {
      .viewport-menu .active::part(label) {
        font-weight: bold;
      }
    }
  }

  .display-builder__main {
    max-width: 100%;
    margin: 1rem auto 0;
    transition: margin-left 0.1s ease;
    transition: max-width 0.3s ease;

    .db-message {
      margin: 1rem 0 0 0;
    }
  }

  .shoelace-tabs__tab[tabindex]:focus {
    outline: 0 none;
    box-shadow: unset;
  }

  /* Keyboard shortcut */
  .db-toolbar code {
    color: var(--sl-color-danger-400);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
  }

  /* Full reset island specifics */
  .db-devel-reset {
    padding: 0.5rem;
  }

  /* Preview Island specific */
  .db-preview-placeholder {
    padding: 0.3rem;
  }
}
