/* ServeDMD house style: every number the site is drawn with, declared once.
   Nothing else declares a colour, a font, a radius, a spacing or a width of its own;
   every sheet reads from here. Light is parchment; dark is the same parchment at night. */

:root {
	/* Faces: titles in the old uncial, reading in a serif, everything that is a control in the UI face. */
	--font-titles: 'Uncial Antiqua', serif;
	--font-prose: 'Crimson Pro', Georgia, 'Times New Roman', serif;
	--font-ui: 'Segoe UI', system-ui, -apple-system, sans-serif;
	--font-mono: ui-monospace, Consolas, 'Cascadia Mono', monospace;

	/* Type scale. --text-prose is the reading size; the rest are UI sizes. */
	--text-xs: 0.72rem;
	--text-sm: 0.85rem;
	--text-md: 1rem;
	--text-lg: 1.2rem;
	--text-xl: 1.5rem;
	--text-2xl: 2rem;
	--text-3xl: clamp(2.2rem, 4.5vw, 3rem);
	--text-prose: 1.2rem;
	--leading: 1.5;
	--leading-prose: 1.62;
	--tracking-caps: 0.09em;
	--tracking-wide: 0.14em;
	--tracking-tight: 0.03em;
	--underline-offset: 0.18em;

	/* Space. Layouts are flex or grid and use these as gap; margins are not stacked. */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.5rem;
	--space-6: 2rem;
	--space-7: 3rem;
	--space-8: 4rem;
	/* Between the blocks of an article, and between a form's fields. */
	--flow: var(--space-4);

	/* Shape. One radius; circles are circles. No shadows except the drawer that slides over the page. */
	--radius: 4px;
	--radius-round: 50%;
	--rule: 1px solid var(--line);
	--rule-strong: 2px solid var(--accent);
	--shadow-drawer: 0 0 24px rgba(0, 0, 0, 0.7);

	/* Widths. The page, its reading column, and the two side columns beside it. */
	--page-max: 1440px;
	--prose-max: 42rem;
	--narrow-max: 44rem;
	--wide-max: 72rem;
	--nav-col: 22rem;
	--aside-col: 15rem;
	--col-gap: var(--space-7);
	--gutter: clamp(1rem, 3vw, 2rem);
	--control-h: 2.25rem;
	--target: 44px;

	/* Depth order. */
	--z-bar: 50;
	--z-drawer-backdrop: 90;
	--z-drawer: 100;
	--z-fab: 60;
	--z-dialog: 200;

	--ease: 0.15s ease;

	/* The house is dark: parchment at night. Light is a choice (data-theme="light" on <html>), not the OS's. */
	--paper: #151413;
	/* The ground is an image laid over --paper: none at night, the texture by day. Never a colour: two colours in one background shorthand are dropped whole. */
	--ground: none;
	--surface: #1c1a19;
	--surface-open: #2b2826;
	--ink: #d4cdc2;
	--ink-muted: #a39b90;
	--ink-faint: color-mix(in srgb, var(--ink-muted) 65%, transparent);
	--line: color-mix(in srgb, var(--ink) 16%, transparent);
	--line-strong: color-mix(in srgb, var(--ink) 34%, transparent);
	--accent-default: #e0a44a;
	--ok: #6cc28f;
	--warn: #d9b860;
	--danger: #e08a7c;
	--on-accent: #1a1511;
	/* The old paper texture, for worlds that ask for it; veiled in the page colour at night. */
	--parchment: url(/ui/background_texture.webp);
	--parchment-veil: color-mix(in srgb, var(--paper) 88%, transparent);
	--backdrop-veil: color-mix(in srgb, var(--paper) 80%, transparent);
	--on-dark: #ffffff;
}

:root[data-theme="light"] {
	--paper: #f3f2ef;
	--ground: url(/ui/background_texture.webp);
	--surface: #e7dec8;
	--surface-open: #e1d6bb;
	--ink: #2a2420;
	--ink-muted: #4a423b;
	--line: color-mix(in srgb, var(--ink) 14%, transparent);
	--line-strong: color-mix(in srgb, var(--ink) 30%, transparent);
	--accent-default: #c98a2e;
	--ok: #3f8f5a;
	--warn: #b7791f;
	--danger: #b3392f;
	--shadow-drawer: 0 0 24px rgba(0, 0, 0, 0.3);
}

/* A page takes its world's accent (set inline on <body> by the layout); every other page keeps the house
   one. Accents are picked on parchment; on the dark ground they are lifted so they read. */
body {
	--accent: color-mix(in srgb, var(--world-accent, var(--accent-default)) 78%, white);
	--accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
	--accent-ink: color-mix(in srgb, var(--accent) 85%, var(--ink));
}

:root[data-theme="light"] body {
	--accent: var(--world-accent, var(--accent-default));
	--accent-ink: color-mix(in srgb, var(--accent) 70%, var(--ink));
}

/* Legacy names, read by nothing new. Kept while scripts and world markup still name them. */
body {
	--color-active: var(--accent);
	--color-active-soft: var(--accent-soft);
	--color-text-main: var(--ink);
	--color-text-muted: var(--ink-muted);
	--color-surface: var(--surface);
	--color-surface-open: var(--surface-open);
	--color-bg-soft: var(--paper);
	--color-link: var(--ink);
}
