// TODO This is a temporary variable, until we can use the new sass `@use` feature
// that will not have the problem of re-outputting placeholders on every import
$_o-quote-first-import: true !default;

@import '@financial-times/o-spacing/main';
@import '@financial-times/o-colors/main';
@import '@financial-times/o-typography/main';
@import '@financial-times/o-icons/main';

@import 'src/scss/variables';
@import 'src/scss/brand';
@import 'src/scss/placeholders';
@import 'src/scss/mixins';

/// Default styles for o-quote
///
/// @example Output all o-quote rules.
/// 	@include oQuote();
///
/// @example Output a selection of o-quote rules.
///     @include oQuote((
///     	'cite': false,
///     	'editorial': true
///     ));
///
/// @param {Map} $opts [('cite': true, 'standard': true, 'editorial': true] - The feature set to output rules for.
/// @output The output includes the `.o-quote*` selectors
@mixin oQuote(
	$opts: (
		'cite': true,
		'standard': true,
		'editorial': true,
	)
) {
	// Enabled if the option is given and the current brand supports the feature.
	$standard-enabled: map-get($opts, 'standard') and _oQuoteSupports('standard');
	$editorial-enabled: map-get($opts, 'editorial') and
		_oQuoteSupports('editorial');
	$cite-enabled: map-get($opts, 'cite');

	// Output base quote styles.
	.o-quote {
		@extend %_o-quote;
	}

	@if $cite-enabled {
		.o-quote__cite,
		.o-quote__source,
		.o-quote__author {
			display: block;
		}
	}

	// Output editorial quote styles.
	@if $editorial-enabled {
		.o-quote.o-quote--editorial {
			@include oQuoteEditorial();
		}
	}

	@if $editorial-enabled and $cite-enabled {
		.o-quote--editorial .o-quote__cite {
			@include oQuoteEditorialCite();
		}

		.o-quote--editorial .o-quote__author {
			@include oQuoteEditorialCiteAuthor();
		}

		.o-quote--editorial .o-quote__source {
			@include oQuoteEditorialCiteSource();
		}
	}

	// Output standard quote styles.
	@if $standard-enabled {
		.o-quote.o-quote--standard {
			@include oQuoteStandard();
		}
	}

	@if $standard-enabled and $cite-enabled {
		.o-quote--standard .o-quote__cite {
			@include oQuoteStandardCite();
		}

		.o-quote--standard .o-quote__author {
			@include oQuoteStandardCiteAuthor();
		}

		.o-quote--standard .o-quote__source {
			@include oQuoteStandardCiteSource();
		}
	}
}

@if (not $o-quote-is-silent) {
	@include oQuote();
	// Set to silent again to avoid being output twice
	$o-quote-is-silent: true !global;
}

$_o-quote-first-import: false;
