/* Brand face — shared by every Stratagem prototype page. */
@font-face {
	font-family: "Stratagem";
	src: url("fonts/Stratagem.woff2") format("woff2");
	font-display: swap;
}

/* Light / dark / system control shared by every Stratagem prototype page. */
.theme-toggle {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-self: end;
	gap: var(--spacing-0-5);
	height: calc(var(--spacing) * 7);
	padding: var(--spacing-0-5);
	border-radius: var(--spacing-2);
	background-color: color-mix(in srgb, currentColor 14%, transparent);
	color: inherit;
}

.theme-toggle__option {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--spacing-6);
	height: var(--spacing-6);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: calc(var(--spacing) * 1.5);
	background: transparent;
	color: inherit;
	font-size: 0.875rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.55;
}

.theme-toggle__option .bi {
	display: block;
	font-size: 0.875rem;
	line-height: 1;
	/* Clicks hit the button, not the icon — keeps headless/locator clicks reliable. */
	pointer-events: none;
}

.theme-toggle__option:hover,
.theme-toggle__option:focus-visible {
	opacity: 1;
	outline: none;
}

.theme-toggle__option:focus-visible {
	box-shadow: inset 0 0 0 1px currentColor;
}

html[data-theme-preference="light"] .theme-toggle__option[data-theme-value="light"],
html[data-theme-preference="dark"] .theme-toggle__option[data-theme-value="dark"],
html[data-theme-preference="system"] .theme-toggle__option[data-theme-value="system"] {
	background-color: color-mix(in srgb, currentColor 22%, transparent);
	opacity: 1;
}

/*
 * Prototype variants bar — sits under the prototype concept nav.
 * Shared by any demo that exposes caption / Favorites / similar switches.
 */
.variants-bar {
	display: flex;
	flex-shrink: 0;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--spacing-3);
	padding: var(--spacing-2) var(--spacing-4);
	border-bottom: 1px solid rgb(var(--gray-500));
	background-color: rgb(var(--gray-600));
}

.variants-bar__label {
	margin: 0;
	flex-shrink: 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgb(var(--gray-300));
}

.variants-bar__toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-2);
	padding: calc(var(--spacing) * 1.5) var(--spacing-3);
	border: 1px solid rgb(var(--gray-500));
	border-radius: var(--spacing-2);
	background-color: rgb(var(--gray-700));
	color: rgb(var(--gray-100));
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.variants-bar__toggle:hover {
	border-color: rgb(var(--muted));
	background-color: rgb(var(--gray-600));
}

.variants-bar__toggle:focus-visible {
	outline: 2px solid rgb(var(--action-click));
	outline-offset: 2px;
}

.variants-bar__toggle[aria-pressed="true"] {
	border-color: color-mix(in srgb, rgb(var(--action-click)) 50%, transparent);
	background-color: rgb(var(--gray-800));
}

.variants-bar__toggle-title {
	font-size: 0.75rem;
	font-weight: 600;
	color: rgb(var(--gray-100));
}

.variants-bar__toggle-state {
	flex-shrink: 0;
	padding: var(--spacing-0-5) calc(var(--spacing) * 1.5);
	border-radius: calc(var(--spacing) * 1);
	background-color: rgb(var(--gray-800));
	font-size: 0.65rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: rgb(var(--gray-300));
}

.variants-bar__toggle[aria-pressed="true"] .variants-bar__toggle-state {
	background-color: color-mix(in srgb, rgb(var(--action-click)) 20%, transparent);
	color: rgb(var(--action-click));
}

.variants-bar__choice {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-2);
	padding: calc(var(--spacing) * 1.5) var(--spacing-3);
	border: 1px solid rgb(var(--gray-500));
	border-radius: var(--spacing-2);
	background-color: rgb(var(--gray-700));
}

.variants-bar__segment {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--spacing-0-5);
	padding: var(--spacing-0-5);
	border-radius: calc(var(--spacing) * 1);
	background-color: rgb(var(--gray-800));
}

.variants-bar__segment-btn {
	padding: var(--spacing-1) var(--spacing-2);
	border: 0;
	border-radius: calc(var(--spacing) * 0.5);
	background: transparent;
	font-size: 0.65rem;
	font-weight: 600;
	text-align: center;
	color: rgb(var(--gray-300));
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.variants-bar__segment-btn:hover {
	color: rgb(var(--gray-100));
}

.variants-bar__segment-btn:focus-visible {
	outline: 2px solid rgb(var(--action-click));
	outline-offset: 2px;
}

.variants-bar__segment-btn[aria-checked="true"] {
	background-color: rgb(var(--gray-600));
	color: rgb(var(--action-click));
}

/*
 * Shared color palette for every prototype, in dark (default) and light.
 * Extracted from demos/ledger/index.html (the :root / :root[data-theme="light"] blocks);
 * this file is ~213 lines. Archived Iterations stay in the ledger HTML — they were not part of the move.
 * Former navy-100…300 / 600…900 surface steps were replaced by gray role tokens; navy-400/500 remain for selection.
 * Pages read these through Tailwind (`demos/assets/tailwind/stratagem-theme.css`) or rgb(var(--token)) in hand-written CSS.
 * Channels are space-separated RGB so Tailwind opacity modifiers (bg-gray-500/60) keep working.
 * data-theme on <html> is set by theme.js (always the resolved light or dark).
 */
:root {
	color-scheme: dark;
	/* Neutral surfaces + text: Tailwind zinc steps, numbered by role (100 = foreground, 700 = page)
	   so the light theme can invert them. Navy below is reserved for selection tint. */
	--gray-100: 244 244 245;
	--gray-200: 212 212 216;
	--gray-300: 161 161 170;
	--gray-400: 82 82 91;
	--gray-500: 63 63 70;
	--gray-600: 39 39 42;
	--gray-700: 24 24 27;
	--gray-800: 9 9 11;
	--gray-900: 0 0 0;
	/* Navy: selection tint (active entry card, pressed toggles) and toolbars. Never a panel or field. */
	--navy-400: 86 92 122;
	--navy-500: 46 51 76;
	--toolbar-background: 32 36 53; /* #202435, dark navy */
	--pink-100: 249 242 247;
	--pink-200: 239 218 232;
	--pink-300: 211 157 194;
	--pink-400: 173 71 141;
	--pink-500: 145 10 103;
	--pink-600: 101 7 72;
	--pink-700: 72 5 51;
	--pink-800: 51 3 36;
	--pink-900: 29 2 21;
	--surface-error: 70 24 25;
	--surface-orange: 70 40 24;
	--surface-warning: 61 50 20;
	--surface-info: 24 32 70;
	--surface-success: 24 56 28;
	--surface-teal: 15 46 40;
	--surface-neutral: 34 35 38;
	--icon-error: 232 136 136;
	--icon-orange: 240 166 106;
	--icon-warning: 224 192 106;
	--icon-info: 154 166 219;
	--icon-success: var(--tag-green); /* alias: same green as tag chips and document icons */
	--icon-teal: 94 196 176;
	--icon-neutral: 197 201 216;
	--icon-on-hover: 255 255 255;
	--icon-accent: 211 157 194;
	--icon-action: 211 157 194;
	--icon-action-hover: 239 218 232;
	--icon-required: 240 138 60;
	--icon-tag-purple: var(--tag-purple); /* alias: one purple for attachment icons and chips */
	--muted: 115 116 121;
	--body: 180 181 183;
	--tag-purple: 155 133 173; /* lightened from 119 98 140 so purple icons and chips match */
	--tag-blue: 101 112 169;
	--tag-green: 107 169 101;
	--tag-yellow: 169 164 101;
	--tag-red: 169 101 102;
	--panel-background: var(--gray-600);
	--dropzone-border: 183 171 194;
	--dropzone-background: 37 23 51;
	--dropzone-foreground: 183 171 194;

	/* Semantic aliases: components read these; palette steps stay the source of truth. */
	--bg-page: var(--gray-700);
	--bg-header: var(--gray-800);
	--bg-field: var(--gray-700); /* dark: one step darker than the panel, not a hard well */
	--action-click: var(--pink-300); /* focused labels, links: AA on the dark panel */
	--text-link-hover: var(--pink-200); /* hovered entry and attachment names */
	--read-bar: 48 49 53; /* #303135: unread-bar tone for read entries */
	--resize-grip: var(--gray-400); /* docs | ledger resize bar */
	--bg-hover: var(--gray-500); /* rendered at 40% opacity */
	--bg-selected: var(--navy-500);
	--bg-toolbar: var(--toolbar-background);
	--bg-selected-edge: var(--navy-400);
	--bg-panel: var(--panel-background);
	--bg-dropzone: var(--dropzone-background);
	--text-primary: var(--gray-100);
	--text-secondary: var(--gray-200);
	--text-metadata: var(--body);
	--text-label: var(--gray-300);
	--text-action: var(--action-click);
	--text-accent: var(--icon-accent);
	--shadow-elevated: 0 25px 50px -12px rgb(0 0 0 / 0.6); /* dark: black on gray-600 needs more opacity to read */
}

:root[data-theme="light"] {
	color-scheme: light;
	--gray-100: 9 9 11;
	--gray-200: 39 39 42;
	--gray-300: 82 82 91;
	--gray-400: 212 212 216;
	--gray-500: 228 228 231;
	--gray-600: 244 244 245;
	--gray-700: 255 255 255;
	--gray-800: 244 244 245;
	--gray-900: 228 228 231;
	--navy-400: 185 190 205;
	--navy-500: 212 216 228;
	--toolbar-background: 228 231 240; /* #e4e7f0, pale navy */
	--surface-error: 249 225 225;
	--surface-orange: 255 240 223;
	--surface-warning: 255 245 213;
	--surface-info: 229 234 255;
	--surface-success: 229 244 227;
	--surface-teal: 220 244 239;
	--surface-neutral: 236 238 243;
	--icon-error: 139 30 34;
	--icon-orange: 135 68 14;
	--icon-warning: 115 84 0;
	--icon-info: 48 69 143;
	--icon-success: var(--tag-green); /* alias: same green as tag chips and document icons */
	--icon-teal: 8 107 91;
	--icon-neutral: 69 74 87;
	--icon-on-hover: 9 10 15;
	--icon-accent: 101 7 72;
	--icon-action: 173 71 141;
	--icon-action-hover: 101 7 72;
	--icon-required: 163 84 26;
	--icon-tag-purple: var(--tag-purple); /* alias: one purple for attachment icons and chips */
	--muted: 94 98 110;
	--body: 48 52 65;
	--tag-purple: 91 69 111;
	--tag-blue: 74 84 141;
	--tag-green: 71 116 65;
	--tag-yellow: 113 108 53;
	--tag-red: 138 68 69;
	--panel-background: var(--gray-600);
	--dropzone-border: 119 98 140;
	--dropzone-background: 246 241 248;
	--dropzone-foreground: 89 72 108;

	/* Semantic aliases: components read these; palette steps stay the source of truth. */
	--bg-page: var(--gray-700);
	--bg-header: var(--gray-800);
	--bg-field: var(--gray-700); /* light: white inset on the gray-600 panel; gray-800 matched the panel and erased fields */
	--bg-hover: var(--gray-500); /* rendered at 40% opacity */
	--bg-selected: var(--navy-500);
	--bg-toolbar: var(--toolbar-background);
	--bg-selected-edge: var(--navy-400);
	--bg-panel: var(--panel-background);
	--bg-dropzone: var(--dropzone-background);
	--text-primary: var(--gray-100);
	--text-secondary: var(--gray-200);
	--text-metadata: var(--body);
	--text-label: var(--gray-300);
	--action-click: var(--pink-500); /* pink-300 is too pale on white; pink-500 is AA on the panel */
	--text-link-hover: var(--pink-600);
	--read-bar: var(--gray-400);
	--resize-grip: 161 161 170; /* zinc-400: darker than gray-400, which is the read-bar tone on light */
	--text-action: var(--action-click);
	--text-accent: var(--icon-accent);
	--shadow-elevated: 0 25px 50px -12px rgb(0 0 0 / 0.25); /* light: same as shadow-2xl */
}
