/* FILE: custom/_others.scss */
@use 'sass:map';
@use 'sass:math';

// Hide element if no featured image.

	.hide-if-no-featured-image,
	.is-hidden-if-no-featured-image {
		// These styles have to be very specific to prevent false positives.

		.is-singular:not(.has-post-thumbnail) .is-style-page-header &,
		.wp-block-post:not(.has-post-thumbnail) &,
		.is-singular:not(.has-post-thumbnail) .entry-content > .alignfull:first-child & {
			display: none;
		}
	}

// Border radius.

	.has-background {

		&:not(.alignfull) {

			:where( & ) {
				border-radius: var(--wp--custom--border-radius--bg);
			}

			header > &,
			footer > & {

				:where( & ) {
					border-radius: inherit;
				}
			}
		}
	}

	.wp-block-cover.alignwide {

		:where( & ) {
			border-radius: var(--wp--custom--border-radius--bg);
		}

		> span,
		> img {

			:where( & ) {
				border-radius: inherit;
			}
		}
	}

	.alignfull {

		&,
		&.wp-block-gallery img,
		> img,
		> a > img {
			border-radius: 0;
		}
	}

// Text meant only for screen readers.

	body[class] .screen-reader-text,
	.is-style-screen-reader-text {

		&:focus {
			border-radius: var(--wp--custom--button--border--radius);
		}
	}

// Quote.

	blockquote {

		@include media( map.get( $breakpoint, 'l' ) ) {

			&:not( .has-background, [class*="has-text-align-"] ) {
				position: relative;
				padding-inline-start: calc( var(--wp--custom--quote--decoration--font-size) / 2 );

				p:first-of-type::before {
					display: none;
				}

				&::before {
					content: var(--wp--custom--quote--decoration--content);
					speak: none;
					position: absolute;
					inset-inline-start: 0;
					inset-block-start: 0;
					height: 100%;
					font-family: var(--wp--custom--quote--decoration--font-family);
					font-size: var(--wp--custom--quote--decoration--font-size);
					font-weight: 700;
					line-height: 1;
					background-image: linear-gradient( to bottom, currentColor, currentColor );
					background-position: 50% 100%;
					background-repeat: no-repeat;
					background-size: 2px calc( 100% - math.div( 1em, 1 + $ratio_min ) );
					opacity: var(--wp--custom--quote--decoration--opacity);
					transform: translateX(-50%);

					.rtl & {
						transform: translateX(50%);
					}
				}

				&::after {
					content: no-close-quote; // Resetting quotes.
				}
			}
		}
	}

// Responsive alignment.

	.has-justify-content-right,
	.has-justify-content-flex-end {
		@include media( ( 782, 'max-width' ) ) { // WP breakpoint.
			justify-content: flex-start !important;
		}
	}

// Custom background.

	.custom-background.custom-background {
		background-color: var(--wp--preset--color--base);
	}

// Archives.

	.term-description {
		max-width: 560px;
		font-size: var(--wp--preset--font-size--l);
	}

	// Useful for breadcrumbs trail.
	.home .is-hidden-on-homepage {
		display: none;
	}
