/* Keep project context visible while browsing long Unit lists. */
/* overflow-x:hidden implicitly creates a scroll container with overflow-y:auto.
   The asset workspace class also applies to Units; use clip so sticky follows
   the document scroll instead of a non-scrolling page-shell ancestor. */
body.asset-workspace-active[data-storyboard-navigation],
body.asset-workspace-active[data-storyboard-navigation] .page-shell {
  overflow-x: clip;
  overflow-y: visible;
}
body[data-storyboard-navigation] .topbar {
  position: sticky;
  top: calc(var(--announcement-height, 0px) + var(--storyboard-primary-nav-height, 0px));
  z-index: 8;
  background: var(--dz-page);
}
body[data-storyboard-navigation] .storyboard-projectbar {
  position: sticky;
  top: calc(var(--announcement-height, 0px) + var(--storyboard-primary-nav-height, 0px) + var(--storyboard-topbar-height, 94px));
  z-index: 7;
  padding: 8px 0;
  background: var(--dz-subtle);
  box-shadow: 0 1px 0 var(--dz-border);
}
body[data-storyboard-navigation] .storyboard-shell { overflow: visible; }
body[data-storyboard-navigation] .storyboard-sidebar {
  position: sticky;
  top: calc(var(--announcement-height, 0px) + var(--storyboard-primary-nav-height, 0px) + var(--storyboard-topbar-height, 94px) + var(--storyboard-projectbar-height, 62px));
  align-self: start;
  max-height: calc(100dvh - var(--announcement-height, 0px) - var(--storyboard-primary-nav-height, 0px) - var(--storyboard-topbar-height, 94px) - var(--storyboard-projectbar-height, 62px));
  overflow-y: auto;
  z-index: 6;
}
.storyboard-back-to-top {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--orange);
  border-radius: 10px;
  background: var(--dz-surface);
  color: var(--orange-dark);
  box-shadow: 0 4px 16px rgba(31, 35, 41, .12);
  font-size: 12px;
}
.storyboard-back-to-top[hidden] { display: none; }
.storyboard-back-to-top:hover { background: var(--orange-soft); }
.storyboard-back-to-top:focus-visible { outline: 2px solid var(--orange-dark); outline-offset: 3px; }
.storyboard-back-to-top svg { width: 20px; height: 20px; }
@media (max-width: 900px) {
  body[data-storyboard-navigation] .topbar { height: auto; min-height: 94px; flex-wrap: wrap; padding: 12px 16px; gap: 8px; }
  body[data-storyboard-navigation] .global-cdk { width: 100%; min-width: 0; transform: none; margin-top: 0; }
  body[data-storyboard-navigation] .cdk-entry { flex-wrap: wrap; }
  body[data-storyboard-navigation] .cdk-input-stack { min-width: 0; }
  body[data-storyboard-navigation] .storyboard-sidebar { gap: 2px; padding: 6px; }
  body[data-storyboard-navigation] .storyboard-side-item { height: 32px; padding: 0 7px; gap: 5px; }
}
@media (max-width: 720px) {
  body[data-storyboard-navigation] > .sidebar { position: sticky; top: var(--announcement-height, 0px); z-index: 9; height: auto; }
  body[data-storyboard-navigation] > .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body[data-storyboard-navigation] > .sidebar .nav-item { padding: 0 5px; gap: 5px; font-size: 12px; }
  body[data-storyboard-navigation] .storyboard-project-select { min-width: 0; flex: 1; }
  body[data-storyboard-navigation] .storyboard-project-tools { min-width: 0; }
  body[data-storyboard-navigation] .storyboard-project-select select { min-width: 0; }
  .storyboard-back-to-top { right: 12px; bottom: max(16px, env(safe-area-inset-bottom)); }
}
