/*
 * Blueprint grid: a light ledger grid on solid banners and boxes, with a few
 * tinted cells and a soft glow in the leading top corner, fading out toward
 * the content. Pure background layers: no pseudo-elements, no markup.
 * All languages; in RTL the pattern starts in the top-right corner.
 * (html:root keeps these above the dark-mode background shorthand.)
 */

html:root body :is(
	.amr-hero,
	.is-style-amr-panel-dark,
	.amr-sec-question,
	.amr-footer,
	.amr-cap,
	.amr-quote,
	.amr-contact-card,
	.amr-tl__card,
	.amr-cred,
	.amr-cred-fact,
	.amr-symptom,
	.amr-facts,
	.amr-aside,
	.amr-route,
	.amr-get,
	.amr-inside
) {
	/* Defaults: light box. */
	--g-s: 36px;
	--g-bg: var(--amr-surface);
	--g-line: rgb(17 24 39 / 5%);
	--g-cell: rgb(17 24 39 / 3%);
	--g-hi: rgb(255 196 0 / 9%);
	--g-glow: rgb(31 41 55 / 4%);
	--g-reach: 70%;
	--gx: left;
	--g-dir: to bottom right;
	--g-at: 0%;

	background-image:
		linear-gradient(var(--g-dir), transparent 8%, color-mix(in srgb, var(--g-bg) 94%, transparent) var(--g-reach)),
		radial-gradient(circle at var(--g-at) 0%, var(--g-glow), transparent 34%),
		linear-gradient(var(--g-cell), var(--g-cell)),
		linear-gradient(var(--g-hi), var(--g-hi)),
		linear-gradient(var(--g-cell), var(--g-cell)),
		linear-gradient(var(--g-cell), var(--g-cell)),
		linear-gradient(to right, var(--g-line) 1px, transparent 1px),
		linear-gradient(to bottom, var(--g-line) 1px, transparent 1px);
	background-size:
		100% 100%,
		100% 100%,
		var(--g-s) var(--g-s),
		var(--g-s) var(--g-s),
		var(--g-s) var(--g-s),
		var(--g-s) var(--g-s),
		var(--g-s) var(--g-s),
		var(--g-s) var(--g-s);
	background-position:
		0 0,
		0 0,
		var(--gx) 0 top 0,
		var(--gx) var(--g-s) top 0,
		var(--gx) 0 top var(--g-s),
		var(--gx) calc(var(--g-s) * 2) top var(--g-s),
		var(--gx) 0 top 0,
		var(--gx) 0 top 0;
	background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
}

/* Soft boxes sit on the lighter page tone. */
html:root body .amr-quote {
	--g-bg: var(--amr-soft);
}

/* Dark banners and panels: wider cells, white lines, a gold glow. */
html:root body :is(.amr-hero, .is-style-amr-panel-dark, .amr-sec-question, .amr-footer) {
	--g-s: 56px;
	--g-bg: var(--amr-navy);
	--g-line: rgb(255 255 255 / 4.5%);
	--g-cell: rgb(255 255 255 / 3%);
	--g-hi: rgb(255 255 255 / 6%);
	--g-glow: rgb(255 196 0 / 6%);
	--g-reach: 78%;
}

html:root body .amr-footer {
	--g-bg: #111827;
	--g-reach: 55%;
}

/* Dark mode: text tokens turn light, so fade into the actual dark backgrounds. */
html:root[data-amr-color="dark"] body :is(.amr-cap, .amr-quote, .amr-contact-card, .amr-tl__card, .amr-cred, .amr-cred-fact, .amr-symptom, .amr-facts, .amr-aside, .amr-route, .amr-get, .amr-inside) {
	--g-line: rgb(255 255 255 / 4%);
	--g-cell: rgb(255 255 255 / 2.5%);
	--g-hi: rgb(255 196 0 / 7%);
	--g-glow: rgb(255 255 255 / 3%);
}

html:root[data-amr-color="dark"] body :is(.amr-hero, .is-style-amr-panel-dark, .amr-sec-question, .amr-footer) {
	--g-bg: var(--amr-navy);
}

/* Panels are smaller than heroes. */
html:root body .is-style-amr-panel-dark {
	--g-s: 44px;
}

/* Small screens: a lighter touch. */
@media (max-width: 640px) {
	html:root body :is(.amr-hero, .is-style-amr-panel-dark, .amr-sec-question, .amr-footer) {
		--g-s: 40px;
	}
}

/* Right-to-left: the pattern starts in the top-right corner. */
html:root[dir="rtl"] body :is(
	.amr-hero,
	.is-style-amr-panel-dark,
	.amr-sec-question,
	.amr-footer,
	.amr-cap,
	.amr-quote,
	.amr-contact-card,
	.amr-tl__card,
	.amr-cred,
	.amr-cred-fact,
	.amr-symptom,
	.amr-facts,
	.amr-aside,
	.amr-route,
	.amr-get,
	.amr-inside
) {
	--gx: right;
	--g-dir: to bottom left;
	--g-at: 100%;
}
