/* Shared archive header ("Stall header").
   Restyles the header block each archive-type page already prints. CSS only:
   no images, no extra requests, no fixed heights, so no layout shift. The H1,
   its text and the existing description stay exactly as the page prints them.
   Scoped by the esm-ah body classes added in Archive_Header (PHP). */

body.esm-ah.esm-ah {
	--esm-ah-ink: #3C3B6E;
	--esm-ah-tint: #ECEBF7;
	--esm-ah-text: #3d3d4a;

	/* Breadcrumb text starts on the same line as the content (15px / 24px). */
	& .storefront-breadcrumb {
		padding-left: var(--e-sm-content-gutter);
		padding-right: var(--e-sm-content-gutter);
	}

	/* The panel. */
	& :is(.woocommerce-products-header, .page-header, .esm-kb-header, .esm-sm-archive-header, .esm-ah-stores-header) {
		position: relative;
		overflow: hidden;
		margin: 0 0 1.25em;
		padding: 2.25em 1.25em 1.25em;
		background: var(--esm-ah-tint);
		border: 0;
		border-radius: 0.75em;
		text-align: left;

		/* Awning: alternating ink and white stripes, echoing the logo. */
		&::before {
			content: "";
			position: absolute;
			inset: 0 0 auto 0;
			height: 1em;
			background: repeating-linear-gradient(90deg, var(--esm-ah-ink) 0 1.5em, #fff 1.5em 3em);
		}

		/* Scalloped lower edge of the awning. */
		&::after {
			content: "";
			position: absolute;
			inset: 0.75em 0 auto 0;
			height: 0.5em;
			background: radial-gradient(circle at 50% 0, var(--esm-ah-ink) 0 0.5em, transparent 0.5em) 0 0 / 1.5em 0.5em repeat-x;
			opacity: 0.9;
		}

		& :is(h1, .page-title, .entry-title, .esm-kb-title, .esm-sm-title) {
			margin: 0;
			font-size: 2em;
			font-weight: 600;
			line-height: 1.15;
			color: var(--esm-ah-ink);
		}

		/* Existing description text, kept visible and in its place. */
		& :is(.term-description, .taxonomy-description, .esm-kb-subtitle, .esm-sm-intro, .esm-ah-intro) {
			max-width: 40em;
			margin: 0.5em 0 0;
			font-size: 1.125em;
			color: var(--esm-ah-text);

			& p {
				margin: 0;
			}
		}

		& .esm-search-total {
			margin: 0.5em 0 0;
			color: var(--esm-ah-ink);
			font-weight: 600;
		}

		& .esm-kb-back {
			margin: 0.75em 0 0;
		}

		& .esm-kb-search-form,
		& .esm-search-page-form {
			margin: 1em 0 0;
		}
	}

	/* Store listing: only the page's own header, not post headers. */
	& .esm-ah-stores-header {
		margin-bottom: 1.5em;
	}

	/* Search: compact, no awning. */
	&.esm-ah--search .esm-search-header {
		padding: 1.25em;

		&::before,
		&::after {
			content: none;
		}
	}

	/* Help Center / swap meet headers sit in their own narrow containers. */
	&.esm-ah--kb .esm-kb-header {
		margin-bottom: 2em;
	}
}

@media (min-width: 48em) {
	body.esm-ah.esm-ah :is(.woocommerce-products-header, .page-header, .esm-kb-header, .esm-sm-archive-header, .esm-ah-stores-header) {
		padding: 2.5em 1.5em 1.5em;

		& :is(h1, .page-title, .entry-title, .esm-kb-title, .esm-sm-title) {
			font-size: 2.5em;
		}

		& :is(.term-description, .taxonomy-description, .esm-kb-subtitle, .esm-sm-intro, .esm-ah-intro) {
			font-size: 1.25em;
		}
	}

	body.esm-ah.esm-ah.esm-ah--search .esm-search-header {
		padding: 1.5em;

		& .page-title {
			font-size: 2em;
		}
	}
}
