/* File-backed SVG article heroes */

main:has(> article.reading-width > .illustrated-hero),
main:has(> .hub-hero) {
	padding-block-start: 0;
}

article.reading-width:has(> .illustrated-hero) {
	max-width: var(--mc-reading-width);
}

.illustrated-hero {
	position: relative;
	display: grid;
	width: 100vw;
	min-height: clamp(19rem, 32vw, 24rem);
	margin-inline: calc(50% - 50vw);
	align-items: center;
	overflow: hidden;
	isolation: isolate;
	border-block-end: var(--mc-border-width) solid var(--mc-border);
	border-radius: 0;
	background: var(--mc-surface);
}

.illustrated-hero > .hero-illustration {
	position: absolute;
	z-index: -2;
	inset: 0 0 0 auto;
	display: block;
	width: 58%;
	max-width: none;
	height: 100%;
	border-radius: 0;
	object-fit: cover;
	object-position: center;
}

.illustrated-hero .featured-media {
	display: none;
}

.illustrated-hero::after {
	position: absolute;
	z-index: -1;
	inset: 0;
	background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(255 255 255 / 92%) 53%, rgb(255 255 255 / 20%) 72%, transparent 84%);
	content: "";
}

.illustrated-hero-content {
	width: min(100%, calc(max(var(--mc-gutter), calc((100vw - var(--mc-content-width)) / 2)) + 39rem));
	padding: clamp(1.75rem, 5vw, 3.5rem);
	padding-inline-start: max(var(--mc-gutter), calc((100vw - var(--mc-content-width)) / 2));
}

.illustrated-hero-content > :is(h1, p) {
	max-width: 39rem;
}

.illustrated-hero .eyebrow {
	color: var(--mc-accent);
}

.illustrated-hero h1 {
	font-size: clamp(2rem, 3.6vw, 3.35rem);
	font-weight: 800;
	letter-spacing: -0.04em;
	line-height: 1.05;
}

.illustrated-hero-content > p:last-child {
	color: var(--mc-text-muted);
	font-size: clamp(1rem, 1.5vw, 1.15rem);
}

.illustrated-hero-content > p.hero-links {
	padding-block-start: var(--mc-space-3);
	border-block-start: var(--mc-border-width) solid var(--mc-border);
	color: var(--mc-text);
	font-size: 0.95rem;
	font-weight: 600;
}

article.reading-width > .illustrated-hero + * {
	margin-block-start: clamp(2rem, 4vw, 3rem);
}

article.reading-width:has(> .featured-media) > .featured-media {
	height: clamp(19rem, 32vw, 24rem);
}

/* Power-tool hub heroes use the existing hub intro and anchor row. */
main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) {
	padding-block-start: 0;
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section.stack:has(> .table-wrap) {
	--mc-stack-space: 0;
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section[aria-labelledby="articles"] {
	margin-block-start: var(--mc-space-7);
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child {
	position: relative;
	display: grid;
	width: 100vw;
	max-width: none;
	min-height: clamp(19rem, 32vw, 24rem);
	margin-inline: calc(50% - 50vw);
	align-content: center;
	gap: var(--mc-space-4);
	padding: clamp(1.75rem, 5vw, 3.5rem);
	padding-inline-start: max(var(--mc-gutter), calc((100vw - var(--mc-content-width)) / 2));
	overflow: hidden;
	isolation: isolate;
	border-block-end: var(--mc-border-width) solid var(--mc-border);
	background: var(--mc-surface);
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::before {
	position: absolute;
	z-index: -2;
	inset: 0 0 0 auto;
	width: 58%;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	content: "";
}

main:has(#drill-machine-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/drill-machine.svg");
}

main:has(#angle-grinder-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/angle-grinder.svg");
}

main:has(#drill-press-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/drill-press.svg");
}

main:has(#impact-driver-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/impact-driver.svg");
}

main:has(#impact-wrench-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/impact-wrench.svg");
}

main:has(#miter-saw-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/miter-saw.svg");
}

main:has(#torque-wrench-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/torque-wrench.svg");
}

main:has(#wheels-heading) > section:first-child::before {
	background-image: url("/assets/illustrations/wheels.svg");
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after {
	position: absolute;
	z-index: -1;
	inset: 0;
	background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(255 255 255 / 92%) 53%, rgb(255 255 255 / 20%) 72%, transparent 84%);
	content: "";
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > * {
	width: min(100%, 39rem);
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > .eyebrow {
	color: var(--mc-accent);
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > h1 {
	font-size: clamp(2.4rem, 5vw, 4.5rem);
	font-weight: 800;
	letter-spacing: -0.045em;
	line-height: 1.02;
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > p:not(.eyebrow, :last-child) {
	color: var(--mc-text-muted);
	font-size: clamp(1rem, 1.5vw, 1.15rem);
}

main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > p:last-child {
	padding-block-start: var(--mc-space-3);
	border-block-start: var(--mc-border-width) solid var(--mc-border);
	font-size: 0.95rem;
	font-weight: 600;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) .illustrated-hero::after,
	:root:not([data-theme]) main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after {
		background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(39 35 31 / 94%) 53%, rgb(39 35 31 / 28%) 72%, transparent 84%);
	}
}

[data-theme="dark"] .illustrated-hero::after,
[data-theme="dark"] main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after {
	background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(39 35 31 / 94%) 53%, rgb(39 35 31 / 28%) 72%, transparent 84%);
}

@media (max-width: 40rem) {
	.illustrated-hero {
		display: flex;
		min-height: 0;
		flex-direction: column;
		align-items: stretch;
	}

	.illustrated-hero > .hero-illustration {
		position: static;
		z-index: auto;
		width: 100%;
		max-width: 100%;
		height: 14rem;
		object-fit: cover;
		object-position: center;
	}

	.illustrated-hero::after,
	[data-theme="dark"] .illustrated-hero::after,
	:root:not([data-theme]) .illustrated-hero::after {
		display: none;
	}

	.illustrated-hero-content {
		width: 100%;
		padding: var(--mc-space-6) var(--mc-gutter);
		background: var(--mc-surface);
	}

	.illustrated-hero h1 {
		font-size: clamp(1.9rem, 9vw, 2.7rem);
		letter-spacing: -0.035em;
		line-height: 1.08;
	}

	article.reading-width:has(> .featured-media) > .featured-media {
		height: 14rem;
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child {
		display: flex;
		min-height: 0;
		flex-direction: column;
		align-items: stretch;
		gap: var(--mc-space-4);
		padding: 0 0 var(--mc-space-6);
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::before {
		position: static;
		z-index: auto;
		width: 100%;
		height: 14rem;
		flex: 0 0 14rem;
		background-position: center;
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after,
	[data-theme="dark"] main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after,
	:root:not([data-theme]) main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child::after {
		display: none;
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > * {
		width: auto;
		margin-inline: var(--mc-gutter);
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > .eyebrow {
		margin-block-start: var(--mc-space-3);
	}

	main:has(:is(#drill-machine-heading, #angle-grinder-heading, #drill-press-heading, #impact-driver-heading, #impact-wrench-heading, #miter-saw-heading, #torque-wrench-heading, #wheels-heading)) > section:first-child > h1 {
		font-size: clamp(2rem, 10vw, 3rem);
		letter-spacing: -0.035em;
		line-height: 1.08;
	}
}

/* Article heroes mirror the hub composition while keeping article titles smaller. */
main:has(> article.reading-width > .featured-media) {
	padding-block-start: 0;
}

article.reading-width:has(> .featured-media) {
	display: grid;
	max-width: var(--mc-reading-width);
	grid-template-columns: minmax(0, 1fr);
}

article.reading-width:has(> .featured-media) > h1,
article.reading-width:has(> .featured-media) > .featured-media {
	grid-area: 1 / 1;
}

article.reading-width:has(> .featured-media) > .featured-media {
	position: relative;
	z-index: 0;
	width: 100vw;
	height: clamp(19rem, 32vw, 24rem);
	margin: 0 calc(50% - 50vw);
	overflow: hidden;
	isolation: isolate;
	border-block-end: var(--mc-border-width) solid var(--mc-border);
	background: var(--mc-surface);
}

article.reading-width:has(> .featured-media) > .featured-media::after {
	position: absolute;
	z-index: 1;
	inset: 0;
	background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(255 255 255 / 92%) 53%, rgb(255 255 255 / 20%) 72%, transparent 84%);
	content: "";
	pointer-events: none;
}

article.reading-width:has(> .featured-media) > .featured-media img {
	position: absolute;
	z-index: 0;
	inset: 0 0 0 auto;
	width: 58%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

article.reading-width:has(> .featured-media) > h1 {
	position: relative;
	z-index: 2;
	width: min(34rem, calc(100vw - (var(--mc-gutter) * 2)));
	align-self: center;
	justify-self: start;
	margin: 0;
	margin-inline-start: calc(50% - 50vw + max(var(--mc-gutter), calc((100vw - var(--mc-content-width)) / 2)));
	padding-block: clamp(1.75rem, 5vw, 3.5rem);
	color: var(--mc-text);
	font-size: clamp(2rem, 3.6vw, 3.35rem);
	font-weight: 800;
	letter-spacing: -0.04em;
	line-height: 1.05;
	text-shadow: none;
}

article.reading-width:has(> .featured-media) > h1::before {
	display: block;
	margin-block-end: var(--mc-space-3);
	color: var(--mc-accent);
	content: "Article";
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.2;
	text-transform: uppercase;
}

article.reading-width:has(> .featured-media) > .featured-media + * {
	margin-block-start: clamp(2rem, 4vw, 3rem);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) article.reading-width:has(> .featured-media) > .featured-media::after {
		background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(39 35 31 / 94%) 53%, rgb(39 35 31 / 28%) 72%, transparent 84%);
	}
}

[data-theme="dark"] article.reading-width:has(> .featured-media) > .featured-media::after {
	background: linear-gradient(90deg, var(--mc-surface) 0 43%, rgb(39 35 31 / 94%) 53%, rgb(39 35 31 / 28%) 72%, transparent 84%);
}

@media (max-width: 40rem) {
	article.reading-width:has(> .featured-media) {
		display: flex;
		flex-direction: column;
	}

	article.reading-width:has(> .featured-media) > .featured-media {
		order: -2;
		height: 14rem;
		margin-inline: calc(50% - 50vw);
	}

	article.reading-width:has(> .featured-media) > .featured-media::after,
	[data-theme="dark"] article.reading-width:has(> .featured-media) > .featured-media::after,
	:root:not([data-theme]) article.reading-width:has(> .featured-media) > .featured-media::after {
		display: none;
	}

	article.reading-width:has(> .featured-media) > .featured-media img {
		inset: 0;
		width: 100%;
		height: 100%;
		object-position: center;
	}

	article.reading-width:has(> .featured-media) > h1 {
		order: -1;
		width: 100%;
		margin: 0 0 var(--mc-space-5);
		padding-block: var(--mc-space-6) 0;
		color: var(--mc-text);
		font-size: clamp(1.9rem, 9vw, 2.7rem);
		letter-spacing: -0.035em;
		line-height: 1.08;
		text-shadow: none;
	}

	article.reading-width:has(> .featured-media) > .featured-media + * {
		margin-block-start: 0;
	}
}

/* Match illustrated article heroes to the exact tool-hub layout mechanics. */
.illustrated-hero {
	align-content: center;
	align-items: initial;
	gap: var(--mc-space-4);
	padding: clamp(1.75rem, 5vw, 3.5rem);
	padding-inline-start: max(var(--mc-gutter), calc((100vw - var(--mc-content-width)) / 2));
}

.illustrated-hero-content {
	display: contents;
}

.illustrated-hero-content > :is(h1, p) {
	width: min(100%, 39rem);
	max-width: none;
}

@media (max-width: 40rem) {
	.illustrated-hero {
		gap: var(--mc-space-4);
		padding: 0 0 var(--mc-space-6);
	}

	.illustrated-hero > .hero-illustration {
		flex: 0 0 14rem;
	}

	.illustrated-hero-content > :is(h1, p) {
		width: auto;
		margin-inline: var(--mc-gutter);
	}

	.illustrated-hero .eyebrow {
		margin-block-start: var(--mc-space-3);
	}
}
