@import 'mixins-common';

// ####################################################################################################################
// WARNING
//
// When a WMenu of Type.BAR is the first child of a WPanel of Type.CHROME or of Type.ACTION (ie a WPanel with exposed
// title) _or_ is the first child of a WPanel child of WSection; **and** that WPanel does not have a Layout applied then
// a negative margin is applied to make the menu "dock" to the header bar.
// This class `.wc-neg-margin` can be used to force this same negative margin on WMenus of Type.BAR when it is not
// feasible to have them in unnested WPanel's in the appropriate circimstance.
//
// WARNING
//
// This makes no attempt to determine the location of the menu, it just uses the section padding as a negative margin.
// This means it will apply wherever it is used.
// It is intended that this **only** be used when the menu is the first visible component in such a section as described
// above but I am not going to enforce that.
//
// WARNING
//
// Well here is the **WARNING**: if you use this willy-nilly your UI _could_ look really silly!
@if ($wc-section-space-normal > 0) {
	.wc-menu-type-bar.wc-neg-margin {
		// the negative margin must be 0 - the padding of WSection content.
		$neg-margin: -$wc-section-space-normal;
		margin: $neg-margin $neg-margin $wc-section-space-normal;
	}

	@if ($wc-gap-reduce-when-narrow == 1) {
		@include respond-phonelike {
			.wc-menu-type-bar.wc-neg-margin {
				$neg-margin: -$wc-section-space-reduced;
				margin: $neg-margin $neg-margin $wc-section-space-reduced;
			}
		}
	}
}
// ####################################################################################################################
