@import 'style';

$content-width: 1129px;

.wp-block {
	max-width: 90%;

	@include breakpoint( small only ) {
		max-width:100%;
	}

	@include breakpoint( medium only ) {
		max-width: 80%;
	}

	&[data-align="full"] {
		max-width: none;
		@include breakpoint( large ) {
			margin-left:auto;
			margin-right:auto;
		}
	}

	&[data-align="wide"] {
		max-width: $global-width + rem-calc( 200 );
	}

	&[data-align="left"] .editor-block-list__block-edit {
		margin-right: $global-margin;
	}
	&[data-align="right"] .editor-block-list__block-edit {
		margin-left: $global-margin;
	}
}



// Fix conflicting styles
.editor-block-list__insertion-point-inserter .editor-inserter__toggle {
	margin-top: -4px;
	border-radius: 50%;
	color: #007cba;
	background: #fff;
	height: 36px;
	width: 36px;
	padding: 8px;
}

button {
	overflow:hidden;
}


// Headings
.wp-block-heading {
	h1, .h1,
	h2, .h2,
	h3, .h3,
	h4, .h4,
	h5, .h5,
	h6, .h6 {
		font-family: $header-font-family;
		font-style: $header-font-style;
		font-weight: $header-font-weight;
		color: $header-color;
		text-rendering: $header-text-rendering;

		small {
			line-height: 0;
			color: $header-small-font-color;
		}
	}

	// Heading styles
	@each $size, $headers in $header-styles {
		@include breakpoint($size) {
			@each $header, $header-defs in $headers {
				$font-size-temp: 1rem;
				#{$header}, .#{$header} {

					$font-size-temp: map-get($header-defs, font-size);
					font-size: $font-size-temp + px;
					@if map-has-key($header-defs, line-height) {
						line-height: unitless-calc(map-get($header-defs, line-height), $font-size-temp);
					} @else if map-has-key($header-defs, lh) {
						line-height: unitless-calc(map-get($header-defs, lh), $font-size-temp);
					} @else if $size == $-zf-zero-breakpoint {
						line-height: unitless-calc($header-lineheight, $font-size-temp);
					}

					@if map-has-key($header-defs, margin-top) {
						margin-top: map-get($header-defs, margin-top);
					} @else if map-has-key($header-defs, mt) {
						margin-top: map-get($header-defs, mt);
					} @else if $size == $-zf-zero-breakpoint {
						margin-top: 0;
					}
					@if map-has-key($header-defs, margin-bottom) {
						margin-bottom: map-get($header-defs, margin-bottom);
					} @else if map-has-key($header-defs, mb) {
						margin-bottom: map-get($header-defs, mb);
					} @else if $size == $-zf-zero-breakpoint {
						margin-bottom: ($header-margin-bottom);
					}
				}
			}
		}
	}
}

// Paragraph
.wp-block-paragraph {
	line-height: $global-lineheight;
}

// Pullquote
.wp-block-pullquote {
	border-top:none;
	border-bottom: none;
}

// Buttons
@include gutenberg-block-button( true );

// Separator
hr.wp-block-separator {
	clear: both;

	max-width: $content-width !important;
	height: 0;
	margin: $hr-margin;

	border-top: 0;
	border-right: 0;
	border-bottom: $hr-border;
	border-left: 0;
}

// Blockquote
blockquote.wp-block-quote {
	margin: 0 0 $paragraph-margin-bottom;
	padding: $blockquote-padding;
	border-#{$global-left}: $blockquote-border !important;

	&, p {
		line-height: $paragraph-lineheight;
		color: $blockquote-color;
	}

	.wp-block-quote__citation {
		display: block;
		font-size: $cite-font-size;
		color: $cite-color;

		&:before {
			content: $cite-pseudo-content;
		}
	}
}

/** Blocks **/
/** - List **/
.wp-block[data-type="core/list"] {
	padding-left:0;
}

/** - Sparator **/
.wp-block[data-type="core/separator"] hr {
	max-width:1300px;
}

/** - Tables **/
.wp-block[data-type="core/table"] td,
.wp-block[data-type="core/table"] th {
	border:none;
}
@include gutenberg-block-table();

/** - Latest posts **/
.wp-block[data-type="core/latest-posts"] {
	padding-left:0;
}

/** - Blockquote **/
.wp-block[data-type="core/quote"] blockquote {
	border-left:1px solid #cacaca
}

.wp-block[data-type="core/quote"] blockquote .wp-block-quote__citation:before {
	content: "— ";
}

/** - Buttons **/
.wp-block[data-type="core/button"] .wp-block-button__link {
	line-height:39.6px;
	padding: 12px 24px;
}
.wp-block[data-type="core/button"][data-align="left"] .editor-block-list__block-edit {
	margin-right:0;
	padding-right:19px;
	margin-bottom:0;
}

.wp-block[data-type="core/button"][data-align="right"] .editor-block-list__block-edit {
	margin-left:0;
	padding-left:19px;
	margin-bottom:0;
}

/** - Categories **/
.wp-block[data-type="core/categories"] {
	padding-left:0;
}

/** - Archives **/
.wp-block[data-type="core/archives"] {
	padding-left:0;
}

/** - Pullquote **/
.wp-block[data-type="core/pullquote"] .wp-block-pullquote__citation {
	text-transform: none;
}
.wp-block[data-type="core/pullquote"] .wp-block-pullquote__citation:before {
	content: "— ";
}
.wp-block[data-type="core/pullquote"] .wp-block-pullquote {
	border:none;
}

/** - Images **/
.wp-block[data-type="core/image"][data-align="left"] .editor-block-list__block-edit {
	margin-right:0;
	padding-right:19px;
	margin-bottom:0;
}

.wp-block[data-type="core/image"][data-align="right"] .editor-block-list__block-edit {
	margin-left:0;
	padding-left:19px;
	margin-bottom:0;
}


// Color palette styles
@include gutenberg-editor-color-palette-styles( 'domestic-color', $primary-color );
@include gutenberg-editor-color-palette-styles( 'domestic-black', $black );
@include gutenberg-editor-color-palette-styles( 'domestic-light-gray', $light-gray );
@include gutenberg-editor-color-palette-styles( 'domestic-white', $white );
@include gutenberg-editor-color-palette-styles( 'domestic-dark-gray', $dark-gray );
