////
/// @group o-grid
/// @link http://registry.origami.ft.com/components/o-grid
////

// ----------------------------------------------------------------------------
// Responsive behaviour configuration
// ----------------------------------------------------------------------------

/// Silent mode
///
/// @type Bool
///
/// @link http://origami.ft.com/docs/syntax/scss/#silent-styles "Silent" styles in Origami's documentation
$o-grid-is-silent: true !default;


/// Offset, push and pull selectors
///
/// @type Bool
///
/// Toggle outputting offset, push and pull selectors
$o-grid-shuffle-selectors: true !default;

/// Human-friendly selectors
///
/// @type Bool
///
/// Toggle outputting offset, push and pull selectors
$o-grid-human-friendly-selectors: true !default;


/// Grid mode
/// - fluid: full width up to the largest layout's width
/// - snappy: fluid width until the layout defined in $o-grid-start-snappy-mode-at (default: M),
///           and then snaps into a larger fixed layout at each breakpoint
/// - fixed: always fixed-width with the layout defined by $o-grid-fixed-layout (default: L)
///
/// @type String - one of fluid (default), snappy, fixed
$o-grid-mode: 'fluid' !default;

/// Layout to default to when the grid has a fixed width (not fluid)
///
/// @type String - One of $o-grid-layouts
$o-grid-fixed-layout: 'L' !default;

/// When the grid start snapping between fixed-width layouts
/// in the case where a row has the `o-grid-row--snappy` class
///
/// @type String
$o-grid-start-snappy-mode-at: 'M' !default;

/// Show the currently active breakpoint and output loaded settings
/// @link https://github.com/sass-mq/sass-mq#seeing-the-currently-active-breakpoint
///
/// @type Bool
$o-grid-debug-mode: false !default;

/// Output IE 8-specific rules?
/// - false: no IE8 support at all
/// - 'only': serve code compatible with IE8 only
/// - 'inline' (default): serve IE8 specific code alongside modern browsers code
///
/// @type Bool | String
$o-grid-ie8-rules: 'inline' !default;


// ----------------------------------------------------------------------------
// Grid settings and dimensions
// ----------------------------------------------------------------------------

/// Number of columns
///
/// @type Number (unitless)
$o-grid-columns: 12 !default;

/// Minimum width, in pixels
///
/// @type Number
$o-grid-min-width: 240px !default;

/// Layouts
///
/// Each layout is calculated following a specific column width,
/// in order to base breakpoints on the structure of the grid itself
///
/// @type Map
$o-grid-layouts: (
	S:  490px,  // column-width: 30px, inner width: 470px
	M:  740px,  // column-width: 40px, inner width: 700px
	L:  980px,  // column-width: 60px, inner width: 940px
	XL: 1220px, // column-width: 80px, inner width: 1180px
) !default;

/// Layout names
///
/// @access private
/// @type List
$_o-grid-layout-names: map-keys($o-grid-layouts);

/// Gutter sizes
///
/// @type Map
$o-grid-gutters: (
	default: 10px,
	M:       20px,
) !default;

// If layouts have changed but gutters haven't,
// prune non-existant layouts.
@each $layout-name, $gutter-size in $o-grid-gutters {
	@if ($layout-name != 'default') and (not map-has-key($o-grid-layouts, $layout-name)) {
		$o-grid-gutters: map-remove($o-grid-gutters, $layout-name);
	}
}

/// Maximum grid width
/// Defaults to the largest layout width
///
/// @access private
/// @type Number
$_o-grid-max-width: map-get($o-grid-layouts, nth($_o-grid-layout-names, -1));

// When snappy mode is enabled, force $_o-grid-max-width to the largest layout width
// instead of the default $_o-grid-max-width
@if $o-grid-mode == 'snappy' {
	$_o-grid-max-width: map-get($o-grid-layouts, nth($_o-grid-layout-names, -1)) !global;
}

/// Current scope
///
/// @access private
/// @type String
$_o-grid-scope: 'global';
