/* Shared depth for the Campus and admin's outer surfaces only. */
:is(#campus-app, #campus-dialog, #app, #dialog-root) {
  --surface-depth-soft:
    0 14px 48px -10px rgb(68 58 92 / .16),
    0 4px 14px -5px rgb(68 58 92 / .10),
    0 1px 2px rgb(68 58 92 / .04);
  --surface-depth-raised:
    0 20px 64px -12px rgb(68 58 92 / .25),
    0 8px 22px -7px rgb(68 58 92 / .13),
    0 1px 3px rgb(68 58 92 / .05);
}

/* Main white cards carry the depth; nested rows and illustrations do not. */
#campus-app :is(.campus-card, .course-content-card, .course-video-preview, .course-detail-outline),
#app :is(.analytics-metric, .analytics-panel, .split-panel, .brand-section, .auth-card),
#app .workspace-planning .column {
  --surface-depth-shadow: var(--surface-depth-raised);
  box-shadow: var(--surface-depth-raised);
}

/* The search wrapper owns the outer shadow; the input keeps its focus ring. */
#app .workspace-planning .board-toolbar .search {
  --surface-depth-shadow: var(--surface-depth-soft);
  box-shadow: var(--surface-depth-soft);
}

#campus-dialog .campus-dialog,
#dialog-root .dialog {
  box-shadow: var(--surface-depth-raised);
}

/* Give the floating desktop navigation a quieter level of the same shadow. */
#campus-app .campus-sidebar,
#app .workspace > .sidebar {
  --surface-depth-shadow: 0 5px 24px #39284508;
}

@media (width > 760px) {
  #campus-app .campus-sidebar,
  #app .workspace > .sidebar {
    --surface-depth-shadow: var(--surface-depth-soft);
    box-shadow: var(--surface-depth-soft);
  }
}

/* The enhancement paints every shadow together, below every real card face.
   Native shadows above remain the fallback until the shared module is ready. */
#campus-app[data-surface-depth-ready],
#app[data-surface-depth-ready] {
  position: relative;
  z-index: 1;
}

:is(#campus-app, #app)[data-surface-depth-ready] [data-surface-depth-managed],
#app[data-surface-depth-ready] .workspace-planning .board-toolbar .search[data-surface-depth-managed] {
  box-shadow: none;
}

.surface-depth-plane {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.surface-depth-clip {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.surface-depth-shadow {
  position: absolute;
  pointer-events: none;
  background: transparent;
}

/* Smaller surfaces need less spread on a narrow screen. */
@media (max-width: 760px) {
  :is(#campus-app, #campus-dialog, #app, #dialog-root) {
    --surface-depth-soft:
      0 10px 30px -8px rgb(68 58 92 / .13),
      0 3px 10px -3px rgb(68 58 92 / .08),
      0 1px 2px rgb(68 58 92 / .035);
    --surface-depth-raised:
      0 12px 36px -7px rgb(68 58 92 / .18),
      0 4px 14px -4px rgb(68 58 92 / .11),
      0 1px 2px rgb(68 58 92 / .045);
  }
}
