/* fonts - self-hosted variable woff2, same as paskvil.com */
@font-face {
	font-family: "Martian Mono";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	font-stretch: 75% 112.5%;
	src: url(../fonts/martian-mono-latin-ext-standard-normal.woff2) format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Martian Mono";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	font-stretch: 75% 112.5%;
	src: url(../fonts/martian-mono-latin-standard-normal.woff2) format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Schibsted Grotesk";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url(../fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Schibsted Grotesk";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url(../fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* tokens - from paskvil.com */
:root {
	--prussian: #00111c;
	--prussian-deep: #000a12;
	--prussian-raised: #062033;
	--rule: #16324a;
	--text: #88aaff;
	--text-dim: #6680bf;
	--text-strong: #e0e7f5;
	--gold: #d6a84a;
	--gold-soft: rgb(214 168 74 / 0.45);

	--mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
	--sans: "Schibsted Grotesk", system-ui, sans-serif;

	--top: 3rem;
	--tools: 3.25rem;
	--panel: 15rem;
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	overflow: hidden;
	background: var(--prussian);
	color: var(--text);
	font: 400 0.9375rem/1.5 var(--sans);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--prussian); }
button, select, input { font: inherit; color: inherit; }
kbd {
	font: 400 0.8em/1 var(--mono);
	padding: 0.15em 0.4em;
	border: 1px solid var(--rule);
	border-radius: 3px;
	color: var(--text-strong);
}

.brand {
	font: 600 1rem/1 var(--mono);
	font-stretch: 112.5%;
	letter-spacing: -0.03em;
	color: var(--text-strong);
	white-space: nowrap;
}
.brand a { color: var(--gold); text-decoration: none; }
.brand a:hover { text-decoration: underline 1px var(--gold-soft); text-underline-offset: 0.2em; }

.ico, [data-icon] { display: inline-flex; }
.ico svg { width: 1.1em; height: 1.1em; }

/* buttons */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	height: 2rem;
	padding: 0 0.75rem;
	background: transparent;
	border: 1px solid var(--rule);
	border-radius: 4px;
	font: 400 0.8125rem/1 var(--mono);
	cursor: pointer;
}
.btn:hover { border-color: var(--gold-soft); color: var(--gold); }
.btn.primary { border-color: var(--gold); color: var(--gold); height: 2.5rem; padding: 0 1.1rem; }
.btn.primary:hover { background: var(--gold); color: var(--prussian); }

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 4px;
	cursor: pointer;
}
.icon-btn:hover { background: var(--prussian-raised); color: var(--text-strong); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; color: inherit; }

/* welcome / drop screen */
.welcome {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 1.5rem;
}
.drop {
	width: min(40rem, 100%);
	padding: 4rem 2rem;
	border: 1px dashed var(--rule);
	border-radius: 8px;
	text-align: center;
	transition: border-color 0.15s, background 0.15s;
}
.drop.over, body.dragging .drop { border-color: var(--gold); background: var(--prussian-raised); }
.brand-big { font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem); margin: 0 0 2rem; }
.lead { margin: 0 0 1.25rem; }
.note { margin: 2rem 0 0; font-size: 0.8125rem; color: var(--text-dim); }

/* editor frame */
.editor {
	position: fixed;
	inset: 0;
	display: grid;
	grid-template-columns: var(--tools) minmax(0, 1fr) var(--panel);
	grid-template-rows: var(--top) minmax(0, 1fr);
	grid-template-areas: "top top top" "tools stage panel";
}

.topbar {
	grid-area: top;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0 0.5rem 0 1rem;
	border-bottom: 1px solid var(--rule);
	background: var(--prussian);
}
.actions { display: flex; align-items: center; gap: 0.25rem; }
.sep { width: 1px; height: 1.25rem; background: var(--rule); margin: 0 0.4rem; }

.zoom {
	height: 2rem;
	padding: 0 0.5rem;
	background: var(--prussian);
	border: 1px solid var(--rule);
	border-radius: 4px;
	font: 400 0.8125rem/1 var(--mono);
	cursor: pointer;
	min-width: 7.5rem;
}
.zoom:hover { border-color: var(--gold-soft); }

.menu-wrap { position: relative; }
.menu {
	position: absolute;
	right: 0;
	top: calc(100% + 0.35rem);
	z-index: 20;
	min-width: 11rem;
	padding: 0.3rem;
	display: flex;
	flex-direction: column;
	background: var(--prussian-raised);
	border: 1px solid var(--rule);
	border-radius: 6px;
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.menu button {
	text-align: left;
	padding: 0.5rem 0.65rem;
	background: none;
	border: 0;
	border-radius: 4px;
	font: 400 0.8125rem/1 var(--mono);
	cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--prussian); color: var(--gold); outline: none; }

/* left tools */
.tools {
	grid-area: tools;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	padding: 0.5rem 0;
	border-right: 1px solid var(--rule);
	overflow-y: auto;
	scrollbar-width: none;
}
.tools hr { width: 1.5rem; border: 0; border-top: 1px solid var(--rule); margin: 0.3rem 0; }
.tools .icon-btn[aria-pressed="true"] {
	color: var(--gold);
	background: var(--prussian-raised);
	border-color: var(--gold-soft);
}

/* canvas */
.stage {
	grid-area: stage;
	position: relative;
	overflow: hidden;
	background: var(--prussian-deep);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.text-edit {
	position: absolute;
	margin: 0;
	padding: 0;
	border: 0;
	outline: 1px dashed var(--gold);
	outline-offset: 2px;
	background: transparent;
	resize: none;
	overflow: hidden;
	white-space: pre;
	line-height: 1.25;
	caret-color: var(--gold);
}

/* right panel */
.panel {
	grid-area: panel;
	border-left: 1px solid var(--rule);
	overflow-y: auto;
	padding: 0.85rem 1rem 1.5rem;
	scrollbar-width: thin;
	scrollbar-color: var(--rule) transparent;
	font-size: 0.875rem;
}
.panel h2 {
	margin: 0 0 1rem;
	font: 500 0.8125rem/1.3 var(--mono);
	color: var(--text-strong);
}
.panel h2 small { color: var(--text-dim); font-weight: 400; }
.field { margin: 0 0 1.1rem; }
.field > label, .field > .label {
	display: flex;
	justify-content: space-between;
	margin-bottom: 0.45rem;
	font: 400 0.75rem/1.2 var(--mono);
	color: var(--text-dim);
}
.field output { color: var(--text-strong); }
.hint { color: var(--text-dim); font-size: 0.8125rem; margin: 0 0 0.8rem; }
.hint:last-child { margin-bottom: 0; }

.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.35rem; }
.swatch {
	position: relative;
	aspect-ratio: 1;
	padding: 0;
	border: 1px solid rgb(255 255 255 / 0.15);
	border-radius: 4px;
	cursor: pointer;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 2px; }
.swatch.none {
	background:
		linear-gradient(to top right, transparent calc(50% - 1px), #e53935 calc(50% - 1px), #e53935 calc(50% + 1px), transparent calc(50% + 1px)),
		var(--prussian);
}
.swatch.custom {
	overflow: hidden;
	background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

input[type="range"] {
	width: 100%;
	margin: 0;
	height: 1.25rem;
	background: transparent;
	appearance: none;
	cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--rule); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--rule); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: var(--gold); border: 0; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 0; }

.panel select, .panel input[type="number"] {
	width: 100%;
	height: 2rem;
	padding: 0 0.5rem;
	background: var(--prussian);
	border: 1px solid var(--rule);
	border-radius: 4px;
	font-size: 0.875rem;
}
.row { display: flex; gap: 0.5rem; align-items: center; }
.row > * { flex: 1; }

.seg { display: flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.seg button {
	flex: 1;
	height: 2rem;
	background: none;
	border: 0;
	border-left: 1px solid var(--rule);
	font: 400 0.75rem/1 var(--mono);
	cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text-strong); }
.seg button[aria-pressed="true"] { background: var(--prussian-raised); color: var(--gold); }

.panel .btn { width: 100%; justify-content: center; }
.panel .btn.danger:hover { border-color: #e5393599; color: #ff6b66; }

.keys { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; font-size: 0.8125rem; }
.keys dt { font: 400 0.75rem/1.6 var(--mono); color: var(--text-strong); white-space: nowrap; }
.keys dd { margin: 0; color: var(--text-dim); }
.panel hr { border: 0; border-top: 1px solid var(--rule); margin: 1.25rem 0; }

.toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	transform: translateX(-50%);
	z-index: 50;
	padding: 0.55rem 1rem;
	background: var(--prussian-raised);
	border: 1px solid var(--gold-soft);
	border-radius: 6px;
	font: 400 0.8125rem/1.3 var(--mono);
	color: var(--text-strong);
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}

@media (max-width: 52rem) {
	:root { --panel: 12.5rem; }
	.topbar .btn .ico + * { display: none; }
	.zoom { min-width: 0; }
}
