/*
 * Crush Connector: the blocks of an article Crush wrote, at home in any theme.
 *
 * The fonts, the sizes and the text colour are the theme's own. Lines and
 * tints are made from the text colour (currentColor), so the same rules work
 * on a light theme and on a dark one. Logical properties throughout, so a
 * right-to-left site mirrors by itself. Nothing here is loaded on any page
 * but a post Crush wrote.
 */

.crush-answer,
.crush-key-takeaways,
.crush-toc,
.crush-product-cards,
.crush-product-card,
.crush-chart,
.crush-cta,
.crush-contact-card,
.crush-map-card,
.crush-from-business,
.crush-illustration,
.crush-cover,
.crush-related-reads,
.crush-credit,
.crush-ai-note {
	--crush-line: rgba(127, 127, 127, 0.35);
	--crush-tint: rgba(127, 127, 127, 0.1);
	--crush-radius: 10px;
	box-sizing: border-box;
	max-inline-size: 100%;
	color: inherit;
}

@supports (color: color-mix(in srgb, currentColor 10%, transparent)) {
	.crush-answer,
	.crush-key-takeaways,
	.crush-toc,
	.crush-product-cards,
	.crush-product-card,
	.crush-chart,
	.crush-cta,
	.crush-contact-card,
	.crush-map-card,
	.crush-from-business,
	.crush-illustration,
	.crush-cover,
	.crush-related-reads,
	.crush-credit,
	.crush-ai-note {
		--crush-line: color-mix(in srgb, currentColor 22%, transparent);
		--crush-tint: color-mix(in srgb, currentColor 6%, transparent);
	}
}

/* The reading time: a quiet line under the title. */
.crush-reading-time {
	margin-block: 0 1em;
	opacity: 0.75;
}

/* The direct answer, first thing under the title. */
.crush-answer {
	margin-block: 0 1.5em;
	padding-block: 0.15em;
	padding-inline-start: 1em;
	border-inline-start: 3px solid currentColor;
	font-size: 1.08em;
	line-height: 1.6;
}

/* Key points: the one highlighted box. */
.crush-key-takeaways {
	margin-block: 1.5em;
	padding: 1.1em 1.25em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
	background-color: var(--crush-tint);
}

/* Contents: an outlined list, lighter than the key points. */
.crush-toc {
	margin-block: 1.5em;
	padding: 1em 1.25em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
}

.crush-key-takeaways > p:first-child,
.crush-toc > p:first-child,
.crush-related-reads > p:first-child {
	margin-block: 0 0.5em;
}

.crush-key-takeaways ul,
.crush-key-takeaways ol,
.crush-toc ul,
.crush-toc ol,
.crush-related-reads ul {
	margin: 0;
	padding-inline-start: 1.3em;
}

.crush-key-takeaways li,
.crush-toc li,
.crush-related-reads li {
	margin-block: 0.3em;
}

.crush-toc a,
.crush-related-reads a,
.crush-contact-card a,
.crush-map-card a,
.crush-credit a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--crush-line);
	text-underline-offset: 0.18em;
}

.crush-toc a:hover,
.crush-toc a:focus-visible,
.crush-related-reads a:hover,
.crush-related-reads a:focus-visible,
.crush-contact-card a:hover,
.crush-contact-card a:focus-visible,
.crush-map-card a:hover,
.crush-map-card a:focus-visible,
.crush-credit a:hover,
.crush-credit a:focus-visible {
	text-decoration-color: currentColor;
}

/* Product cards: as many columns as fit, one on a phone. */
.crush-product-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 13em), 1fr));
	gap: 1em;
	margin-block: 1.75em;
	padding: 0;
	list-style: none;
}

.crush-product-card {
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	min-inline-size: 0;
	margin: 0;
	padding: 0.9em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
}

.crush-product-card img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: calc(var(--crush-radius) - 4px);
}

.crush-product-card p {
	margin: 0;
}

.crush-product-card a {
	color: inherit;
	font-weight: 600;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.crush-product-card a:hover,
.crush-product-card a:focus-visible {
	text-decoration: underline;
}

.crush-product-card__price {
	opacity: 0.8;
}

/* A chart: an inline drawing or a table, with its caption. */
.crush-chart {
	margin-block: 1.75em;
	margin-inline: 0;
	padding: 1em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
	overflow-x: auto;
}

.crush-chart svg,
.crush-chart img {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
	margin-inline: auto;
}

.crush-chart table {
	inline-size: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 0.95em;
}

.crush-chart th,
.crush-chart td {
	padding: 0.5em 0.6em;
	border: 0;
	border-block-end: 1px solid var(--crush-line);
	text-align: start;
	vertical-align: top;
}

.crush-chart figcaption,
.crush-illustration figcaption,
.crush-cover figcaption {
	margin-block-start: 0.75em;
	font-size: 0.85em;
	opacity: 0.75;
	text-align: start;
}

/* The brand card after the intro: the name, one line, one button. */
.crush-cta {
	margin-block: 1.75em;
	padding: 1.25em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
	background-color: var(--crush-tint);
}

.crush-cta > :first-child,
.crush-contact-card > :first-child,
.crush-map-card > :first-child,
.crush-from-business > :first-child,
.crush-answer > :first-child {
	margin-block-start: 0;
}

.crush-cta > :last-child,
.crush-contact-card > :last-child,
.crush-map-card > :last-child,
.crush-from-business > :last-child,
.crush-key-takeaways > :last-child,
.crush-toc > :last-child,
.crush-answer > :last-child,
.crush-related-reads > :last-child {
	margin-block-end: 0;
}

.crush-cta a.crush-cta-button,
.crush-cta a.crush-button,
.crush-cta > :last-child > a:only-child,
.crush-cta > a:last-child {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	padding: 0.45em 1.2em;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.crush-cta a.crush-cta-button:hover,
.crush-cta a.crush-button:hover,
.crush-cta > :last-child > a:only-child:hover,
.crush-cta > a:last-child:hover {
	background-color: var(--crush-tint);
}

.crush-cta a:focus-visible,
.crush-contact-card a:focus-visible,
.crush-map-card a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Contact and map cards of a local business. */
.crush-contact-card,
.crush-map-card {
	margin-block: 1.75em;
	padding: 1.1em 1.25em;
	border: 1px solid var(--crush-line);
	border-radius: var(--crush-radius);
}

.crush-contact-card ul,
.crush-map-card ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1.25em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.crush-contact-card li a,
.crush-map-card li a {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
}

.crush-map-card img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	border-radius: calc(var(--crush-radius) - 4px);
}

/* The business in its own words. */
.crush-from-business {
	margin-block: 1.75em;
	padding: 1em 1.25em;
	border-inline-start: 3px solid currentColor;
	border-start-end-radius: var(--crush-radius);
	border-end-end-radius: var(--crush-radius);
	background-color: var(--crush-tint);
}

/* Pictures: the cover the plugin prints when the theme prints none, and the ones inside the article. */
.crush-illustration,
.crush-cover {
	margin-block: 1.75em;
	margin-inline: 0;
	padding: 0;
}

.crush-cover {
	margin-block-start: 0;
}

.crush-illustration img,
.crush-cover img {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
	margin-inline: auto;
	border-radius: var(--crush-radius);
}

.crush-cover img {
	inline-size: 100%;
}

/* Related articles, at the end. */
.crush-related-reads {
	margin-block: 2em 1em;
	padding-block-start: 1em;
	border-block-start: 1px solid var(--crush-line);
}

/* The credit line and the AI note: the last quiet lines. */
.crush-credit,
.crush-ai-note {
	margin-block: 0.35em;
	opacity: 0.7;
}

.crush-credit,
:not(.crush-credit) + .crush-ai-note {
	margin-block-start: 2em;
	padding-block-start: 1em;
	border-block-start: 1px solid var(--crush-line);
}

@media (max-width: 480px) {
	.crush-key-takeaways,
	.crush-toc,
	.crush-cta,
	.crush-contact-card,
	.crush-map-card,
	.crush-from-business {
		padding: 0.9em 1em;
	}

	.crush-chart {
		padding: 0.75em;
	}
}
