/* Shared professional color palette for the Engineering and Artist workspaces. */

body {
	--scp-accent: #ff6337;
	--scp-accent-soft: rgba(255, 99, 55, .16);
	--scp-bg: #10161a;
	--scp-surface: #171f24;
	--scp-surface-soft: #202a30;
	--scp-border: #34424b;
	--scp-border-strong: #52636e;
	--scp-text: #f4f7f8;
	--scp-muted: #98a6af;
	--scp-shadow: 0 24px 72px rgba(0, 0, 0, .52);
}

body.artist-mode {
	--scp-accent: #a879ff;
	--scp-accent-soft: rgba(168, 121, 255, .18);
	--scp-bg: #101018;
	--scp-surface: #191923;
	--scp-surface-soft: #232331;
	--scp-border: #373747;
	--scp-border-strong: #55556c;
	--scp-text: #f7f5ff;
	--scp-muted: #a5a2b5;
}

html[data-theme="light"] body {
	--scp-bg: #ffffff;
	--scp-surface: #f6f7f9;
	--scp-surface-soft: #eceff2;
	--scp-border: #d4dbe0;
	--scp-border-strong: #aebbc4;
	--scp-text: #172027;
	--scp-muted: #687983;
	--scp-shadow: 0 24px 72px rgba(27, 39, 47, .22);
}

#sketchColorPickerButton {
	position: relative;
	width: 36px;
	height: 36px;
	min-width: 36px;
	flex: 0 0 36px;
	display: inline-grid;
	place-items: center;
	padding: 0;
	border: 1px solid var(--scp-border);
	border-radius: 9px;
	background: var(--scp-surface);
	color: var(--scp-text);
	cursor: pointer;
	touch-action: manipulation;
}

#sketchColorPickerButton:hover,
#sketchColorPickerButton[aria-expanded="true"] {
	border-color: var(--scp-accent);
	background: var(--scp-accent-soft);
}

#sketchColorPickerButton:focus-visible,
.scp-dialog button:focus-visible,
.scp-dialog input:focus-visible {
	outline: 2px solid var(--scp-accent);
	outline-offset: 2px;
}

.scp-launch-icon {
	position: relative;
	width: 23px;
	height: 23px;
	display: block;
}

.scp-launch-icon::before,
.scp-launch-icon::after {
	position: absolute;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, .82);
	border-radius: 50%;
	content: "";
}

.scp-launch-icon::before {
	top: 1px;
	left: 1px;
	background: var(--scp-fill, #8b5cf6);
}

.scp-launch-icon::after {
	right: 1px;
	bottom: 1px;
	background: var(--scp-stroke, #111827);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .42);
}

.scp-launch-icon[data-empty-fill="true"]::before,
.scp-launch-icon[data-empty-stroke="true"]::after,
.scp-preview[data-empty="true"],
.scp-target-chip.is-none,
.scp-swatch.is-none {
	background:
		linear-gradient(135deg, #fff 0 44%, #f43f5e 45% 55%, #fff 56%) !important;
}

.scp-backdrop {
	position: fixed;
	z-index: 10020;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: rgba(3, 6, 9, .68);
	backdrop-filter: blur(4px);
	cursor: default;
}

.scp-backdrop[hidden],
.scp-dialog[hidden] {
	display: none !important;
}

.scp-dialog {
	position: fixed;
	z-index: 10021;
	top: 50%;
	left: 50%;
	width: min(720px, calc(100vw - 28px));
	max-height: min(760px, calc(100dvh - 28px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--scp-border-strong);
	border-radius: 18px;
	background: var(--scp-bg);
	box-shadow: var(--scp-shadow);
	color: var(--scp-text);
	font-family: Montserrat, "Segoe UI", sans-serif;
	transform: translate(-50%, -50%);
}

.scp-dialog button,
.scp-dialog input {
	font: inherit;
	touch-action: manipulation;
}

.scp-head {
	min-height: 66px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 14px 12px 18px;
	border-bottom: 1px solid var(--scp-border);
	background: color-mix(in srgb, var(--scp-surface) 94%, transparent);
}

.scp-title {
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.scp-title small {
	color: var(--scp-accent);
	font-size: 8px;
	font-weight: 800;
	letter-spacing: .16em;
	text-transform: uppercase;
}

.scp-title strong {
	margin-top: 5px;
	font-size: 15px;
	font-weight: 720;
}

.scp-close {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border: 0;
	border-radius: 11px;
	background: var(--scp-surface-soft);
	color: var(--scp-muted);
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
}

.scp-close:hover {
	color: var(--scp-text);
}

.scp-body {
	display: grid;
	grid-template-columns: minmax(240px, .84fr) minmax(320px, 1.16fr);
	min-height: 0;
	overflow: auto;
}

.scp-compose,
.scp-library {
	min-width: 0;
	padding: 17px;
}

.scp-compose {
	border-right: 1px solid var(--scp-border);
}

.scp-section-label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0 0 10px;
	color: var(--scp-muted);
	font-size: 9px;
	font-weight: 750;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.scp-preview-row {
	display: grid;
	grid-template-columns: 1fr 46px;
	gap: 9px;
	margin-bottom: 14px;
}

.scp-preview {
	height: 108px;
	display: flex;
	align-items: flex-end;
	padding: 12px;
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 14px;
	background: var(--scp-color, #8b5cf6);
	box-shadow: inset 0 -38px 42px rgba(0, 0, 0, .13);
}

.scp-preview output {
	max-width: 100%;
	overflow: hidden;
	padding: 5px 7px;
	border-radius: 6px;
	background: rgba(6, 8, 12, .68);
	color: #fff;
	font: 10px/1.2 Consolas, "SFMono-Regular", monospace;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.scp-native-wrap {
	position: relative;
	width: 46px;
	height: 108px;
	overflow: hidden;
	border: 1px solid var(--scp-border);
	border-radius: 12px;
	background: var(--scp-surface);
}

.scp-native-wrap input[type="color"] {
	position: absolute;
	inset: -8px;
	width: calc(100% + 16px);
	height: calc(100% + 16px);
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.scp-sliders {
	display: grid;
	gap: 10px;
}

.scp-slider {
	display: grid;
	grid-template-columns: 72px minmax(90px, 1fr) 44px;
	align-items: center;
	gap: 8px;
	color: var(--scp-muted);
	font-size: 9px;
}

.scp-slider input {
	width: 100%;
	margin: 0;
	accent-color: var(--scp-accent);
}

.scp-slider output {
	color: var(--scp-text);
	font: 9px/1 Consolas, "SFMono-Regular", monospace;
	text-align: right;
}

.scp-targets,
.scp-formats {
	display: grid;
	gap: 7px;
}

.scp-targets {
	grid-template-columns: repeat(2, 1fr);
}

.scp-formats {
	grid-template-columns: repeat(3, 1fr);
}

.scp-targets button,
.scp-formats button {
	min-height: 38px;
	border: 1px solid var(--scp-border);
	border-radius: 9px;
	background: var(--scp-surface);
	color: var(--scp-muted);
	cursor: pointer;
	font-size: 9px;
	font-weight: 720;
}

.scp-targets button[aria-pressed="true"],
.scp-formats button[aria-pressed="true"] {
	border-color: var(--scp-accent);
	background: var(--scp-accent-soft);
	color: var(--scp-text);
}

.scp-targets button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
}

.scp-target-chip {
	width: 17px;
	height: 17px;
	border: 2px solid rgba(255, 255, 255, .72);
	border-radius: 5px;
	background: var(--scp-chip, #8b5cf6);
}

.scp-input-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
	margin-top: 9px;
}

.scp-color-input {
	width: 100%;
	height: 42px;
	min-width: 0;
	padding: 0 11px;
	border: 1px solid var(--scp-border);
	border-radius: 9px;
	outline: 0;
	background: var(--scp-surface);
	color: var(--scp-text);
	font: 12px/1 Consolas, "SFMono-Regular", monospace;
}

.scp-color-input[aria-invalid="true"] {
	border-color: #ff6b7d;
	box-shadow: 0 0 0 2px rgba(255, 107, 125, .12);
}

.scp-eyedropper {
	width: auto;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 0 11px;
	border: 1px solid var(--scp-border);
	border-radius: 9px;
	background: var(--scp-surface);
	color: var(--scp-text);
	cursor: pointer;
	font-size: 9px;
	font-weight: 750;
	white-space: nowrap;
}

.scp-eyedropper svg {
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.scp-eyedropper:hover:not(:disabled) {
	border-color: var(--scp-accent);
	background: var(--scp-accent-soft);
}

.scp-eyedropper:disabled {
	opacity: .38;
	cursor: not-allowed;
}

.scp-help {
	min-height: 18px;
	margin: 5px 0 0;
	color: var(--scp-muted);
	font-size: 8px;
	line-height: 1.45;
}

.scp-help[data-state="error"] {
	color: #ff8a9a;
}

.scp-palette,
.scp-recents {
	display: grid;
	grid-template-columns: repeat(8, minmax(28px, 1fr));
	gap: 7px;
}

.scp-swatch {
	position: relative;
	aspect-ratio: 1;
	min-width: 28px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .24);
	border-radius: 9px;
	background: var(--scp-swatch);
	cursor: pointer;
}

.scp-swatch:hover,
.scp-swatch[aria-pressed="true"] {
	z-index: 1;
	border-color: #fff;
	box-shadow: 0 0 0 2px var(--scp-accent);
	transform: translateY(-1px);
}

.scp-recents {
	min-height: 35px;
	margin-bottom: 15px;
}

.scp-empty-recents {
	grid-column: 1 / -1;
	padding: 10px;
	border: 1px dashed var(--scp-border);
	border-radius: 9px;
	color: var(--scp-muted);
	font-size: 8px;
	text-align: center;
}

.scp-actions {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 8px;
	margin-top: 16px;
}

.scp-actions button {
	min-height: 42px;
	padding: 0 13px;
	border: 1px solid var(--scp-border);
	border-radius: 9px;
	background: var(--scp-surface);
	color: var(--scp-text);
	cursor: pointer;
	font-size: 9px;
	font-weight: 750;
}

.scp-actions .scp-apply {
	border-color: color-mix(in srgb, var(--scp-accent) 72%, #fff 8%);
	background: var(--scp-accent);
	color: #fff;
}

.scp-actions .scp-none {
	color: #ff93a2;
}

.scp-actions .scp-done {
	border-color: #34d399;
	background: #16845f;
	color: #fff;
}

.scp-actions .scp-done:hover,
.scp-actions .scp-done:focus-visible {
	background: #1aa876;
}

@media (max-width: 900px), (pointer: coarse) {
	#sketchColorPickerButton {
		width: 44px;
		height: 44px;
		min-width: 44px;
		flex-basis: 44px;
	}

	.scp-dialog {
		top: max(8px, env(safe-area-inset-top, 0px));
		right: max(8px, env(safe-area-inset-right, 0px));
		bottom: calc(76px + env(safe-area-inset-bottom, 0px));
		left: max(8px, env(safe-area-inset-left, 0px));
		width: auto;
		max-height: none;
		border-radius: 18px;
		transform: none;
	}

	.scp-head {
		min-height: 64px;
	}

	.scp-close,
	.scp-targets button,
	.scp-formats button,
	.scp-color-input,
	.scp-eyedropper,
	.scp-actions button {
		min-width: 44px;
		min-height: 44px;
	}

	.scp-color-input {
		height: 44px;
		font-size: 16px;
	}

	.scp-slider input {
		min-height: 44px;
	}

	.scp-palette,
	.scp-recents {
		grid-template-columns: repeat(8, 44px);
		overflow-x: auto;
		overflow-y: hidden;
		padding: 2px 2px 7px;
		scrollbar-width: thin;
	}

	.scp-swatch {
		width: 44px;
		min-width: 44px;
		min-height: 44px;
	}
}

@media (max-width: 680px) {
	.scp-body {
		grid-template-columns: 1fr;
	}

	.scp-compose {
		border-right: 0;
		border-bottom: 1px solid var(--scp-border);
	}

	.scp-preview {
		height: 82px;
	}

	.scp-native-wrap {
		height: 82px;
	}

	.scp-palette,
	.scp-recents {
		grid-template-columns: repeat(6, minmax(44px, 1fr));
		overflow: visible;
	}
}

@media (max-height: 520px) and (max-width: 932px) and (orientation: landscape) {
	.scp-dialog {
		top: calc(54px + env(safe-area-inset-top, 0px));
		right: max(8px, env(safe-area-inset-right, 0px));
		bottom: 8px;
		left: calc(70px + env(safe-area-inset-left, 0px));
	}

	.scp-body {
		grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr);
	}

	.scp-compose {
		border-right: 1px solid var(--scp-border);
		border-bottom: 0;
	}

	.scp-preview-row {
		grid-template-columns: 1fr 44px;
	}

	.scp-preview,
	.scp-native-wrap {
		height: 70px;
	}

	.scp-palette,
	.scp-recents {
		grid-template-columns: repeat(8, 44px);
		overflow-x: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.scp-dialog *,
	.scp-dialog *::before,
	.scp-dialog *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
}
