/* pierre's -override properties must land on the diffs-container element
   itself, its :host stylesheet beats inheriting from a wrapper. these rules
   must stay UNLAYERED: pierre injects its :host stylesheet unlayered, which
   beats anything in @layer. the doubled class lifts specificity above it
   regardless of order */

diffs-container.diffs-container {
	--diffs-font-family: var(--font-mono);
	--diffs-font-size: 0.875rem;
	--diffs-line-height: 1.5;
	/* the "tangled" theme (pierre.ts) binds --diffs-bg/--diffs-fg to these and
	   forces color-scheme: dark. without them the bg chain goes
	   guaranteed-invalid and light-dark() is stuck on the dark branch */
	--diffs-background: var(--color-background-default);
	--diffs-foreground: var(--color-foreground-default);
	color-scheme: light dark;
	--diffs-light-bg: var(--color-background-default);
	--diffs-dark-bg: var(--color-background-default);
	--diffs-bg-separator-override: var(--color-background-inset);
	--diffs-fg-number-override: var(--color-foreground-placeholder);

	/* pierre blends line backgrounds 88/12 (light) toward these, so they must
	   be the saturated tokens. the *-color overrides drive the indicators and
	   number gutter */
	--diffs-bg-addition-override: var(--color-foreground-success);
	--diffs-bg-deletion-override: var(--color-foreground-danger);
	--diffs-addition-color-override: var(--color-foreground-success-strong);
	--diffs-deletion-color-override: var(--color-foreground-danger-strong);

	/* syntax palette for the "tangled" theme registered in pierre.ts */
	--diffs-token-comment: var(--color-foreground-placeholder);
	--diffs-token-string: var(--color-foreground-success);
	--diffs-token-string-expression: var(--color-foreground-success);
	--diffs-token-keyword: #c084fc;
	--diffs-token-function: #60a5fa;
	--diffs-token-constant: #f59e0b;
	--diffs-token-parameter: var(--color-foreground-default);
	--diffs-token-punctuation: var(--color-foreground-muted);
	--diffs-token-link: var(--color-foreground-info);
	--diffs-token-inserted: var(--color-foreground-success);
	--diffs-token-deleted: var(--color-foreground-danger);
	--diffs-token-changed: var(--color-foreground-warning);
}

@media (prefers-color-scheme: dark) {
	diffs-container.diffs-container {
		--diffs-fg-number-override: var(--color-foreground-subtle);

		/* the dark blend is 80/20, hence the subtle backgrounds */
		--diffs-bg-addition-override: var(--color-background-success-subtle);
		--diffs-bg-deletion-override: var(--color-background-danger-subtle);
		--diffs-addition-color-override: var(--color-foreground-success);
		--diffs-deletion-color-override: var(--color-foreground-danger);
	}
}
