/*
 * ZoneInspector.ai design tokens and global styles. Light theme only.
 *
 * The language is inspired by Uber's Base (base.uber.com): an ink-on-white core
 * where color only carries meaning, filled fields, 8px controls, a 4px grid, few
 * shadows and quintic motion. The token names are realstate-front's, so code
 * moved over from there picks up this look; the comments say which role of the
 * language each one plays. Rules of use are in README.md.
 */
:root {
	color-scheme: light;

	/* Brand */
	--primary: #16203a; /* Ink: text, primary buttons, anything selected */
	--primary-dark: #0c1322; /* Night: dark surfaces (top bar, toasts) */
	--primary-off: #eef0f5; /* Ink at a tint: quiet selected rows */
	--paper: #faf7f0; /* Paper: the warm surface for brand moments */

	/* Brass, the brand's accent. A fill, with ink on it: too light for text. */
	--accent: #c98b3a;
	--accent-dark: #855714; /* Brass at text strength */
	--accent-off: #fbf3e6;

	/* Surfaces and content */
	--white: #ffffff; /* Background, primary */
	--off: #ffffff; /* Page background */
	--dark: #16203a; /* Content, primary */

	/* Neutrals, cooled toward the ink */
	--gray-50: #f4f5f7; /* Background, secondary: panels, disabled */
	--gray-100: #eaecf0; /* Background, tertiary: fields, secondary buttons, hairlines */
	--gray-200: #dcdfe6; /* Borders */
	--gray-300: #c4c9d4; /* Strong borders, inactive tracks */
	--gray-400: #a2a9b6; /* Content, disabled */
	--gray-500: #5b6273; /* Content, tertiary: hints, placeholders, captions */
	--gray-600: #434b5e; /* Content, secondary */
	--gray-700: #252d42; /* Dark fills */

	/* Meaning. The plain one is a fill, -dark is text, -off is a tint. */
	--success: #0e8345;
	--success-dark: #166c3b;
	--success-off: #eaf6ed;

	--warning: #f6bc2f;
	--warning-dark: #845201;
	--warning-off: #fdf2dc;

	--danger: #de1135;
	--danger-dark: #bb032a;
	--danger-off: #fff0ee;

	--info: #276ef1;
	--info-dark: #175bcc;
	--info-off: #eff4fe;

	/* Chart series, in this order: told apart by color-blind readers too, as long as
	   the order is kept. A series keeps its color when others come and go. */
	--chart-1: #276ef1;
	--chart-2: #bf7f2c;
	--chart-3: #0097a7;
	--chart-4: #7c3ec3;
	--chart-5: #0e8345;
	--chart-6: #e142bc;

	/* States: an overlay on whatever the surface is */
	--hover: rgba(22, 32, 58, 0.05);
	--pressed: rgba(22, 32, 58, 0.1);
	--hover-inverse: rgba(255, 255, 255, 0.12);
	--pressed-inverse: rgba(255, 255, 255, 0.22);
	--scrim: rgba(12, 19, 34, 0.5);
	--focus: var(--info);

	/* Spacing scale, on the 4px grid */
	--p-sm: 4px;
	--p: 8px;
	--p-md: 12px;
	--p-lg: 16px;
	--p-xl: 24px;
	--p-xxl: 40px;
	--p-xxxl: 64px;

	/* Corner radius: larger components get larger corners */
	--r-sm: 4px; /* Badges, checks */
	--r: 6px;
	--r-md: 8px; /* Buttons, fields, anything nested in a card */
	--r-lg: 12px; /* Cards, banners, tiles, toasts */
	--r-xl: 16px; /* Dialogs, sheets */
	--r-xxl: 24px;
	--r-pill: 999px;

	/* Type scale. Each size goes with a line height on the 4px grid. */
	--fw-regular: 400;
	--fw-medium: 500;
	--fw-semibold: 600;
	--fw-bold: 700;
	--fw-black: 800;

	--fs-xs: 12px;
	--fs-sm: 14px;
	--fs-base: 16px;
	--fs-md: 18px;
	--fs-lg: 20px;
	--fs-xl: 24px;
	--fs-2xl: 32px;
	--fs-3xl: 40px;
	--fs-4xl: 52px;

	/* Elevation, for what floats. Use a border or a fill to separate the rest. */
	--shadow-none: 0 0 transparent;
	--shadow-xs: 0 1px 2px rgba(12, 19, 34, 0.1);
	--shadow-sm: 0 1px 4px rgba(12, 19, 34, 0.14); /* Map controls, handles */
	--shadow: 0 2px 8px rgba(12, 19, 34, 0.14); /* Tooltips */
	--shadow-md: 0 4px 16px rgba(12, 19, 34, 0.14); /* Menus, popovers */
	--shadow-lg: 0 16px 48px rgba(12, 19, 34, 0.22); /* Dialogs, toasts */
	--shadow-above: 0 -4px 16px rgba(12, 19, 34, 0.12); /* Docks, sheets */

	/* Motion: fast in the middle, gentle at the ends. Linear for color, opacity. */
	--ease-in-out: cubic-bezier(0.83, 0, 0.17, 1); /* 400–500ms: moving, resizing */
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* 400–500ms: entering */
	--ease-in: cubic-bezier(0.11, 0, 0.5, 0); /* 200ms: dismissed */
	--fast: 200ms linear; /* Color, opacity, state overlays */

	--font-family-sans-serif: 'Archivo', ui-sans-serif, system-ui, -apple-system,
		BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji',
		'Segoe UI Emoji';
	--font-family-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/*
 * FONTS. Archivo is the wordmark's own typeface; Geist Mono is for figures that
 * stand alone. Both under the SIL Open Font License (static/font/*-LICENSE.txt).
 */
@font-face {
	font-family: 'Archivo';
	font-weight: 100 900;
	font-display: swap;
	src: url('../font/Archivo-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-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}
@font-face {
	font-family: 'Archivo';
	font-weight: 100 900;
	font-display: swap;
	src: url('../font/Archivo.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: 'Geist Mono';
	font-weight: 100 900;
	font-display: swap;
	src: url('../font/GeistMono.woff2') format('woff2');
}

/*
 * BASE
 */
*,
*::before,
*::after {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
body {
	margin: 0;
	background: var(--off);
	color: var(--dark);
	font-family: var(--font-family-sans-serif);
	font-size: var(--fs-base);
	font-weight: var(--fw-regular);
	line-height: 24px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	-webkit-tap-highlight-color: transparent;
}
p {
	margin: 0;
}
a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
}
img,
svg {
	vertical-align: middle;
}
hr {
	width: 100%;
	height: 1px;
	margin: 0;
	border: 0;
	background: var(--gray-200);
}
button {
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	cursor: pointer;
}
button:disabled {
	cursor: not-allowed;
}
input,
textarea,
select {
	margin: 0;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
}
::placeholder {
	color: var(--gray-500);
	opacity: 1;
}
::selection {
	background: var(--accent);
	color: var(--primary-dark);
}

/* The keyboard's ring. Fields show an ink outline instead (.field). */
:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
}
:focus:not(:focus-visible) {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
	/* On its own: a browser that does not know it drops the whole rule it is in */
	*::details-content {
		transition-duration: 0.01ms !important;
	}
}

/*
 * TYPE STYLES. Display and heading set in bold; label is medium, for anything
 * short; paragraph is regular, for anything read; mono is for lone figures.
 */
h1,
h2,
h3,
h4,
h5,
h6,
.display-lg,
.display-md,
.display-sm,
.display-xs,
.heading-xxl,
.heading-xl,
.heading-lg,
.heading-md,
.heading-sm,
.heading-xs {
	margin: 0;
	color: var(--dark);
	font-weight: var(--fw-bold);
	letter-spacing: -0.015em;
	text-wrap: balance;
}
.display-lg {
	font-size: 96px;
	line-height: 104px;
	letter-spacing: -0.03em;
}
.display-md {
	font-size: 52px;
	line-height: 60px;
	letter-spacing: -0.02em;
}
.display-sm {
	font-size: 44px;
	line-height: 52px;
	letter-spacing: -0.02em;
}
.display-xs {
	font-size: 36px;
	line-height: 44px;
}
h1,
.heading-xxl {
	font-size: 40px;
	line-height: 48px;
}
.heading-xl {
	font-size: 36px;
	line-height: 44px;
}
h2,
.heading-lg {
	font-size: 32px;
	line-height: 40px;
}
.heading-md {
	font-size: 28px;
	line-height: 36px;
}
h3,
.heading-sm {
	font-size: 24px;
	line-height: 32px;
}
h4,
.heading-xs {
	font-size: 20px;
	line-height: 28px;
}
h5,
h6,
.label-lg,
.label-md,
.label-sm,
.label-xs {
	margin: 0;
	font-weight: var(--fw-medium);
	letter-spacing: 0;
}
h5,
.label-lg {
	font-size: 18px;
	line-height: 24px;
}
h6,
.label-md {
	font-size: 16px;
	line-height: 20px;
}
.label-sm {
	font-size: 14px;
	line-height: 16px;
}
.label-xs {
	font-size: 12px;
	line-height: 16px;
}
.paragraph-lg {
	font-size: 18px;
	line-height: 28px;
}
.paragraph-md {
	font-size: 16px;
	line-height: 24px;
}
.paragraph-sm {
	font-size: 14px;
	line-height: 20px;
}
.paragraph-xs {
	font-size: 12px;
	line-height: 20px;
}
.mono {
	font-family: var(--font-family-mono);
	letter-spacing: -0.02em;
}
@media (max-width: 599.98px) {
	.display-lg {
		font-size: 52px;
		line-height: 60px;
	}
	.display-md,
	.display-sm {
		font-size: 36px;
		line-height: 44px;
	}
	.display-xs,
	.heading-xxl,
	.heading-xl,
	h1 {
		font-size: 32px;
		line-height: 40px;
	}
	.heading-lg,
	.heading-md,
	h2 {
		font-size: 28px;
		line-height: 36px;
	}
}

/*
 * LAYOUT. Margins and the widest measure of Base's grid: 16 on a phone, 36 from
 * 600, 64 from 1136.
 */
.container,
.container-wide,
.container-narrow {
	display: flex;
	flex-direction: column;
	gap: var(--p-lg);
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding-inline: 16px;
}
.container-wide {
	max-width: 1800px;
}
.container-narrow {
	max-width: 768px;
}
@media (min-width: 600px) {
	.container,
	.container-wide,
	.container-narrow {
		padding-inline: 36px;
	}
}
@media (min-width: 1136px) {
	.container,
	.container-wide {
		padding-inline: 64px;
	}
}
.row,
.row-responsive {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: var(--p-lg);
	width: 100%;
}
.row > *,
.row-responsive > * {
	flex: 1;
	min-width: 0;
}
@media (max-width: 991.98px) {
	.row-responsive {
		flex-direction: column;
	}
	.row-responsive > * {
		width: 100%;
	}
}
.column {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--p-lg);
	width: 100%;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

/*
 * FIELDS. One look for everything typed into or picked from: a filled box whose
 * outline turns to ink while it is active.
 */
.field {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--p);
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	border: 2px solid transparent;
	border-radius: var(--r-md);
	background: var(--gray-100);
	color: var(--dark);
	font-size: 16px;
	line-height: 24px;
	text-align: start;
	transition:
		background var(--fast),
		border-color var(--fast),
		box-shadow var(--fast);
}
.field.is-small {
	min-height: 36px;
	padding: 0 10px;
	font-size: 14px;
	line-height: 20px;
}
.field.is-large {
	min-height: 56px;
	font-size: 18px;
	line-height: 28px;
}
@media (hover: hover) {
	.field:hover:not(.is-disabled, .is-readonly, .is-open, :focus-within) {
		box-shadow: inset 0 0 0 999px var(--hover);
	}
}
.field.is-invalid {
	border-color: var(--danger);
	background: var(--white);
}
.field.is-success {
	border-color: var(--success);
	background: var(--white);
}
.field:focus-within,
.field.is-open {
	border-color: var(--dark);
	background: var(--white);
	box-shadow: inset 0 0 0 1px var(--dark);
}
.field.is-invalid:focus-within,
.field.is-invalid.is-open {
	border-color: var(--danger);
	box-shadow: inset 0 0 0 1px var(--danger);
}
.field.is-readonly {
	border-color: var(--gray-200);
	background: var(--white);
}
.field.is-readonly:focus-within {
	border-color: var(--dark);
}
.field.is-disabled {
	background: var(--gray-50);
	color: var(--gray-400);
	cursor: not-allowed;
}
.field.is-disabled ::placeholder {
	color: var(--gray-400);
}
.field > input,
.field > textarea {
	flex: 1;
	width: 100%;
	min-width: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	appearance: none;
	text-overflow: ellipsis;
}
/* A press on the field's edge, where nothing sits beside the text, is on the text */
.field > input {
	align-self: stretch;
}
.field > :is(input, textarea):first-child {
	margin-inline-start: -14px;
	padding-inline-start: 14px;
}
.field > :is(input, textarea):last-child {
	margin-inline-end: -14px;
	padding-inline-end: 14px;
}
.field > input:disabled,
.field > textarea:disabled {
	cursor: not-allowed;
	color: var(--gray-400);
	-webkit-text-fill-color: var(--gray-400);
}
/* The browser's own clear and spin buttons: the components draw theirs */
.field > input::-webkit-search-cancel-button,
.field > input::-webkit-outer-spin-button,
.field > input::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}
.field > input[type='number'] {
	appearance: textfield;
}
/* An autofilled field keeps the field's own ground */
.field > input:-webkit-autofill {
	-webkit-text-fill-color: var(--dark);
	transition: background-color 999999s;
}
/* What sits beside the text: an icon, a unit, a small button */
.field__icon {
	display: flex;
	flex-shrink: 0;
}
.field__addon {
	flex-shrink: 0;
	color: var(--gray-500);
	white-space: nowrap;
}
.field__button {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	margin-inline-end: -6px;
	border-radius: var(--r-md);
	transition: background var(--fast);
}
.field__button:hover:not(:disabled) {
	background: var(--hover);
}
.field__button:active:not(:disabled) {
	background: var(--pressed);
}
.field__button:disabled {
	color: var(--gray-400);
}

/*
 * MENUS. The list a field, a popover or a button opens.
 */
.menu {
	display: flex;
	flex-direction: column;
	padding: var(--p) 0;
	border-radius: var(--r-md);
	background: var(--white);
	box-shadow: var(--shadow-md);
}
.menu__item {
	display: flex;
	align-items: center;
	gap: var(--p-md);
	width: 100%;
	min-height: 44px;
	padding: var(--p) var(--p-lg);
	color: var(--dark);
	font-size: 16px;
	line-height: 20px;
	text-align: start;
	text-decoration: none;
	transition: background var(--fast);
}
.menu__item:hover,
.menu__item.is-highlighted {
	background: var(--hover);
}
.menu__item:active {
	background: var(--pressed);
}
.menu__item.is-selected {
	font-weight: var(--fw-medium);
}
.menu__item:focus-visible {
	outline-offset: -3px;
}

/*
 * CHARTS. The legend over a chart and the readout that follows the pointer.
 */
.chart {
	position: relative;
	width: 100%;
	font-size: 12px;
	line-height: 16px;
}
.chart svg {
	display: block;
	width: 100%;
	overflow: visible;
}
.chart text {
	fill: var(--gray-500);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}
.chart__legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--p-sm) var(--p-lg);
	margin-bottom: var(--p-md);
	color: var(--gray-600);
	font-size: 14px;
	line-height: 20px;
}
.chart__legend > * {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: inherit;
	font: inherit;
}
.chart__legend .is-off {
	color: var(--gray-400);
	text-decoration: line-through;
}
/* A line's key is a stroke, a bar's or a slice's is a square */
.chart__key {
	flex-shrink: 0;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background: var(--key);
}
.chart__key.is-line {
	width: 16px;
	height: 3px;
	border-radius: 2px;
}
.is-off .chart__key {
	background: var(--gray-300);
}
.chart__tip {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	min-width: 120px;
	max-width: 240px;
	padding: var(--p) var(--p-md);
	border-radius: var(--r-md);
	background: var(--white);
	box-shadow: var(--shadow-md);
	pointer-events: none;
}
.chart__tip-title {
	margin-bottom: 4px;
	color: var(--gray-500);
}
.chart__tip-row {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	line-height: 20px;
}
.chart__tip-row strong {
	font-weight: var(--fw-medium);
	font-variant-numeric: tabular-nums;
}
.chart__tip-row span:last-child {
	color: var(--gray-500);
}
.chart__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--gray-500);
	font-size: 14px;
}

/*
 * SPINNER
 */
.spinner {
	display: inline-block;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: spin 700ms linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
@media (prefers-reduced-motion: reduce) {
	.spinner {
		animation: spin 2s linear infinite !important;
	}
}

/*
 * TOASTS (utils/toasts.ts): snackbars, at the foot of the page
 */
#toasts {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 2000;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--p);
	padding: var(--p) var(--p) max(var(--p), env(safe-area-inset-bottom));
	pointer-events: none;
}
@media (min-width: 600px) {
	#toasts {
		align-items: flex-end;
		padding: var(--p-xl);
	}
}
.toast {
	display: flex;
	align-items: flex-start;
	gap: var(--p-md);
	width: 100%;
	min-width: 0;
	max-width: 480px;
	padding: var(--p-lg);
	border-radius: var(--r-lg);
	background: var(--primary-dark);
	color: var(--white);
	box-shadow: var(--shadow-lg);
	pointer-events: auto;
	overflow-wrap: anywhere;
	animation: toastIn 500ms var(--ease-out);
}
@media (min-width: 600px) {
	.toast {
		width: auto;
		min-width: 320px;
	}
}
.toast.is-leaving {
	animation: toastOut 200ms var(--ease-in) forwards;
}
.toast__icon {
	display: flex;
	flex-shrink: 0;
}
.toast__icon.is-success {
	color: #7fd99a;
}
.toast__icon.is-warning {
	color: var(--warning);
}
.toast__icon.is-danger {
	color: #fc7f79;
}
.toast__icon.is-info {
	color: #6daafb;
}
.toast__text {
	min-width: 0;
	padding: 2px 0;
}
.toast__title {
	font-weight: var(--fw-medium);
	line-height: 20px;
}
.toast__description {
	margin-top: var(--p-sm);
	color: var(--gray-200);
	font-size: 14px;
	line-height: 20px;
}
.toast.is-actionable {
	cursor: pointer;
}
.toast.is-actionable .toast__description {
	color: var(--white);
	text-decoration: underline;
	text-underline-offset: 3px;
}
@keyframes toastIn {
	from {
		opacity: 0;
		transform: translateY(100%);
	}
}
@keyframes toastOut {
	to {
		opacity: 0;
		transform: translateY(24px);
	}
}
