/* PanPhy design system: Spectrum.
   One file of fonts, color tokens and a few shared components for every app.
   Apps keep their own layout CSS and map their variables to these tokens.
   Load after /assets/fonts/fonts.css (for IBM Plex Mono) and before app CSS.
   Font URLs are relative to this file and resolve to /assets/fonts/.
   Every change here changes the shared files, so every offline app prompts to update. */

/* ---------- Fonts ---------- */

@font-face {
	font-family: 'Figtree';
	font-style: normal;
	font-weight: 300 900;
	font-display: swap;
	src: url('fonts/figtree-normal-300-900-latin-ext.woff2') format('woff2');
	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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: 'Figtree';
	font-style: normal;
	font-weight: 300 900;
	font-display: swap;
	src: url('fonts/figtree-normal-300-900-latin.woff2') format('woff2');
	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: 'Unbounded';
	font-style: normal;
	font-weight: 200 900;
	font-display: swap;
	src: url('fonts/unbounded-normal-200-900-latin-ext.woff2') format('woff2');
	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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: 'Unbounded';
	font-style: normal;
	font-weight: 200 900;
	font-display: swap;
	src: url('fonts/unbounded-normal-200-900-latin.woff2') format('woff2');
	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 ---------- */

:root {
	color-scheme: light;

	/* Type: Figtree for reading, Unbounded for page and app titles only, IBM Plex Mono for numbers and readouts. */
	--font-body: 'Figtree', system-ui, sans-serif;
	--font-display: 'Unbounded', 'Figtree', system-ui, sans-serif;
	--font-mono: 'IBM Plex Mono', ui-monospace, monospace;

	/* Surfaces, from the page background up to raised controls. */
	--bg: #F5F6FA;
	--bg-grid: rgba(28, 40, 90, 0.05);
	--surface: #FFFFFF;
	--surface-2: #F9FAFC;
	--surface-3: #EEF0F6;

	--ink: #0B0D14;
	--ink-2: #4F5568;
	--ink-3: #858B9D;
	--line: #E3E6EE;
	--line-strong: #CDD2DE;

	/* Interactive blue; the red-orange brand marks PanPhy itself. */
	--accent: #1C64D8;
	--accent-hover: #1550B3;
	--accent-ink: #FFFFFF;
	--accent-soft: rgba(28, 100, 216, 0.1);
	--brand: #DB3F27;
	--brand-soft: rgba(219, 63, 39, 0.1);

	--good: #0F7B4F;
	--warn: #B25A06;
	--danger: #BA2B23;
	--danger-soft: rgba(200, 50, 42, 0.08);
	--focus: rgba(28, 100, 216, 0.38);

	/* The visible spectrum, violet to red. Decoration only: never encode data with it. */
	--spectrum: linear-gradient(90deg, #7B2FF7 0%, #3B5BFF 16%, #14B8E6 32%, #1BC77A 48%, #E8D41A 64%, #FF8A1F 80%, #F0263A 100%);

	--radius: 16px;
	--radius-sm: 10px;
	--shadow-1: 0 1px 2px rgba(11, 13, 20, 0.05), 0 4px 14px rgba(11, 13, 20, 0.05);
	--shadow-2: 0 24px 60px -18px rgba(28, 40, 90, 0.35);

	/* Names read by the shared theme and fullscreen buttons and older app CSS. */
	--brand-primary: var(--accent);
	--brand-secondary: var(--brand);
	--brand-accent: var(--accent);
	--card-bg: var(--surface);
	--card-border: var(--line);
	--text-main: var(--ink);
	--text-secondary: var(--ink-2);
	--standalone-top-bg: var(--bg);
}

[data-theme="dark"] {
	color-scheme: dark;
	--bg: #07080C;
	--bg-grid: rgba(150, 175, 255, 0.05);
	--surface: #111319;
	--surface-2: #151821;
	--surface-3: #1C202B;

	--ink: #F1F3F9;
	--ink-2: #A2A8BA;
	--ink-3: #6F7689;
	--line: #232836;
	--line-strong: #333A4C;

	--accent: #54A6FF;
	--accent-hover: #82BEFF;
	--accent-ink: #04101F;
	--accent-soft: rgba(84, 166, 255, 0.14);
	--brand: #FF6A4D;
	--brand-soft: rgba(255, 106, 77, 0.13);

	--good: #4FDB98;
	--warn: #FFB45A;
	--danger: #FF7A70;
	--danger-soft: rgba(255, 122, 112, 0.1);
	--focus: rgba(84, 166, 255, 0.42);

	--shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
	--shadow-2: 0 24px 70px -20px rgba(84, 166, 255, 0.3);
}

/* ---------- Shared components (opt in with the ds- classes) ---------- */

/* Page background: a faint 24px grid, like ruled paper under glass. */
.ds-canvas {
	background-color: var(--bg);
	background-image:
		linear-gradient(var(--bg-grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
	background-size: 24px 24px;
	color: var(--ink);
	font-family: var(--font-body);
}

/* A thin spectrum line, used once per screen under an app bar or a heading. */
.ds-spectrum-rule {
	position: relative;
}

.ds-spectrum-rule::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background: var(--spectrum);
	pointer-events: none;
}

/* Solid panel. Apps never put blur over live content. */
.ds-panel {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
}

/* Small uppercase label above a group of controls. */
.ds-label {
	font-family: var(--font-mono);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-3);
}

/* Numeric readout. */
.ds-readout {
	font-family: var(--font-mono);
	font-variant-numeric: tabular-nums;
	color: var(--ink);
}

/* App title set in the display face. */
.ds-title {
	font-family: var(--font-display);
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.05;
}

.ds-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 8px 16px;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: 600 0.9rem var(--font-body);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ds-button:hover { background: var(--surface-3); }

.ds-button-primary {
	border-color: transparent;
	background: var(--accent);
	color: var(--accent-ink);
}

.ds-button-primary:hover { background: var(--accent-hover); }

/* Selected chip: a spectrum edge around a solid fill. */
.ds-chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: transparent;
	color: var(--ink-2);
	font: 600 0.72rem var(--font-mono);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ds-chip[aria-pressed="true"],
.ds-chip.is-selected {
	color: var(--ink);
	border-color: transparent;
	background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--spectrum) border-box;
}

:where(.ds-canvas) :focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}
