/*
 * Aptuem Support Portal (v6 app): design tokens.
 *
 * The one source of the app's colours, type, spacing, corners, shadows and motion. It starts from
 * docs/design/tokens.css and takes the values of the approved v6 prototype: aptuem.com's navy,
 * lifted into a ladder of tones (ground, rail, card, raised) so that an element comes forward by
 * being lighter. The app page has no theme and no Elementor kit, so the values are set here.
 * Nothing else in the plugin's app stylesheet writes a raw colour, font size, radius or shadow
 * (a PHPUnit test checks it). Scoped under .apx, which is the <html> element of the app page.
 */

.apx {
	color-scheme: dark;

	/* ---- Colour: the navy ladder, dark look ---- */
	--apx-color-night: #0a1b40;      /* page ground */
	--apx-color-rail: #0e2350;       /* side rail, bars */
	--apx-color-deep: #163165;       /* card base */
	--apx-color-tide: #1e417f;       /* card top, tiles */
	--apx-color-raised: #24498a;     /* menus, team bubbles, hover */
	--apx-color-sky: #8fc2f2;        /* light blue: links, highlights */
	--apx-color-blue: #4f9fe6;       /* primary action */
	--apx-color-head: #eef4fd;       /* headings */
	--apx-color-text: #c2d0e8;       /* body text */
	--apx-color-white: #f5f9ff;      /* strongest text */
	--apx-color-ice: #adcdf5;        /* base of the thin lines */
	--apx-color-well: #122a5b;       /* inputs and wells */
	--apx-color-muted: #9aaccb;      /* meta text */

	/* ---- Colour: states, one per status group ---- */
	--apx-color-violet: #9b8cff;     /* in progress, the plan */
	--apx-color-amber: #f5bd63;      /* waiting on you, high priority */
	--apx-color-green: #4ad8a0;      /* resolved, active, success */
	--apx-color-red: #ff7a7a;        /* critical, errors, cancelled */
	--apx-color-grey: #93a2bf;       /* closed */

	/* ---- Colour: on top of a filled colour ---- */
	--apx-color-on-accent: #ffffff;
	--apx-color-on-amber: #1b1200;
	--apx-color-on-green: #032617;
	--apx-color-scrim: color-mix(in srgb, #00040f 62%, transparent);
	--apx-color-bar: color-mix(in srgb, var(--apx-color-rail) 72%, transparent);
	--apx-color-bar-solid: color-mix(in srgb, var(--apx-color-night) 88%, transparent);
	--apx-color-sheet: color-mix(in srgb, var(--apx-color-rail) 94%, transparent);
	--apx-color-table-head: color-mix(in srgb, var(--apx-color-deep) 92%, var(--apx-color-tide));
	--apx-color-viewer: color-mix(in srgb, #00040f 88%, transparent);

	/* ---- Colour: derived ---- */
	--apx-color-line: color-mix(in srgb, var(--apx-color-ice) 12%, transparent);
	--apx-color-line-faint: color-mix(in srgb, var(--apx-color-ice) 5%, transparent);
	--apx-color-edge: color-mix(in srgb, var(--apx-color-sky) 26%, transparent);
	--apx-color-edge-strong: color-mix(in srgb, var(--apx-color-sky) 55%, transparent);
	--apx-color-stripe: color-mix(in srgb, var(--apx-color-sky) 11%, transparent);
	--apx-color-stripe-hover: color-mix(in srgb, var(--apx-color-sky) 20%, transparent);
	--apx-color-focus-fill: color-mix(in srgb, var(--apx-color-blue) 18%, transparent);
	--apx-color-selected: color-mix(in srgb, var(--apx-color-blue) 16%, transparent);
	--apx-color-selected-soft: color-mix(in srgb, var(--apx-color-blue) 7%, transparent);
	--apx-color-chip-count: color-mix(in srgb, var(--apx-color-sky) 14%, transparent);
	--apx-color-rating-off: color-mix(in srgb, var(--apx-color-sky) 32%, transparent);

	/* ---- Surfaces and gradients ---- */
	--apx-surface-card: linear-gradient(165deg, var(--apx-color-tide) 0%, var(--apx-color-deep) 100%);
	--apx-surface-raised: var(--apx-color-raised);
	--apx-surface-rail: var(--apx-color-rail);
	--apx-gradient-heading: linear-gradient(92deg, var(--apx-color-on-accent) 0%, color-mix(in srgb, var(--apx-color-on-accent) 86%, var(--apx-color-sky)) 50%, var(--apx-color-sky) 100%);
	--apx-gradient-brand: linear-gradient(135deg, var(--apx-color-blue), var(--apx-color-violet));
	--apx-gradient-bubble: linear-gradient(160deg, color-mix(in srgb, var(--apx-color-blue) 78%, var(--apx-color-deep)), color-mix(in srgb, var(--apx-color-blue) 62%, var(--apx-color-deep)));
	--apx-gradient-page: radial-gradient(1200px 520px at 60% -12%, color-mix(in srgb, var(--apx-color-blue) 34%, transparent), transparent 62%), radial-gradient(800px 420px at 0% 100%, color-mix(in srgb, var(--apx-color-violet) 12%, transparent), transparent 60%);
	--apx-gradient-nav: linear-gradient(90deg, color-mix(in srgb, var(--apx-color-blue) 34%, transparent), color-mix(in srgb, var(--apx-color-blue) 8%, transparent));
	--apx-gradient-meter-fade: linear-gradient(180deg, var(--apx-color-blue), color-mix(in srgb, var(--apx-color-blue) 25%, transparent));
	--apx-gradient-meter-now: linear-gradient(180deg, var(--apx-color-violet), color-mix(in srgb, var(--apx-color-violet) 30%, transparent));
	--apx-gradient-mask-end: linear-gradient(90deg, #000 85%, transparent);

	/* ---- Type ---- */
	--apx-font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
	--apx-font-3xs: 11px;    /* counters, kbd, tags */
	--apx-font-2xs: 12px;    /* meta, chips */
	--apx-font-xs: 13px;     /* labels, helper text, table rows */
	--apx-font-sm: 14px;     /* buttons, form fields, bubbles */
	--apx-font-md: 15px;     /* body text */
	--apx-font-lg: 16px;     /* card titles */
	--apx-font-xl: 19px;     /* section titles */
	--apx-font-2xl: 24px;    /* KPI numbers */
	--apx-font-3xl: 30px;    /* page title on a phone, ring number */
	--apx-font-display: 40px; /* page title */
	--apx-font-emoji: 20px;
	--apx-font-brand: 21px;
	--apx-weight-regular: 400;
	--apx-weight-medium: 600;
	--apx-weight-bold: 700;
	--apx-weight-heavy: 800;
	--apx-leading-tight: 1.15;
	--apx-leading-snug: 1.35;
	--apx-leading-body: 1.55;
	--apx-tracking-tight: -0.02em;

	/* ---- Space ---- */
	--apx-space-3xs: 4px;
	--apx-space-2xs: 8px;
	--apx-space-xs: 12px;
	--apx-space-sm: 14px;
	--apx-space-md: 16px;
	--apx-space-lg: 20px;
	--apx-space-xl: 24px;
	--apx-space-2xl: 32px;
	--apx-space-3xl: 48px;
	--apx-space-4xl: 72px;

	/* ---- Corners ---- */
	--apx-radius-2xs: 6px;
	--apx-radius-xs: 8px;
	--apx-radius-sm: 12px;
	--apx-radius-md: 16px;
	--apx-radius-lg: 22px;
	--apx-radius-pill: 999px;
	--apx-radius-bubble-tail: 4px;

	/* ---- Lines and focus ---- */
	--apx-border-thin: 1px;
	--apx-border-bar: 3px;
	--apx-focus-ring: 0 0 0 3px color-mix(in srgb, var(--apx-color-blue) 45%, transparent);

	/* ---- Shadows and glow ---- */
	--apx-shadow-glow: 0 0 0 1px color-mix(in srgb, var(--apx-color-sky) 14%, transparent), 0 18px 40px -22px color-mix(in srgb, #00040f 75%, transparent);
	--apx-shadow-card: 0 20px 44px -30px color-mix(in srgb, #00040f 90%, transparent);
	--apx-shadow-raised: 0 24px 48px -20px color-mix(in srgb, #00040f 75%, transparent);
	--apx-shadow-cta: 0 0 36px -6px color-mix(in srgb, var(--apx-color-blue) 60%, transparent);
	--apx-shadow-dot: 0 0 18px -2px var(--apx-color-blue);
	--apx-shadow-fab: 0 0 0 5px var(--apx-color-night), 0 0 26px -2px var(--apx-color-blue);
	--apx-shadow-logo: 0 6px 18px -8px color-mix(in srgb, var(--apx-color-blue) 80%, transparent);
	--apx-shadow-none: none;

	/* ---- Size of fixed parts ---- */
	--apx-size-icon: 18px;
	--apx-size-icon-sm: 14px;
	--apx-size-icon-box: 36px;
	--apx-size-avatar: 32px;
	--apx-size-avatar-sm: 26px;
	--apx-size-avatar-xs: 22px;
	--apx-size-logo: 40px;
	--apx-size-control: 44px;    /* the smallest tap target */
	--apx-size-field: 40px;
	--apx-size-cta: 48px;
	--apx-size-fab: 54px;
	--apx-size-viewas: 40px;       /* the fixed banner of "View as client" */
	--apx-size-tabbar: 76px;       /* the phone tab bar and the room it takes above the page end */
	--apx-size-tabbar-clear: 110px; /* bottom padding of a phone screen: the tab bar and its centre button */
	--apx-size-ring: 120px;
	--apx-width-page: 1280px;
	--apx-width-side: 340px;
	--apx-width-rail: 256px;
	--apx-width-rail-narrow: 76px;
	--apx-width-palette: 620px;
	--apx-width-menu: 320px;
	--apx-width-bubble: 82%;
	--apx-width-thumb: 220px;

	/* ---- Motion ---- */
	--apx-motion-fast: 120ms;
	--apx-motion-base: 200ms;
	--apx-motion-slow: 320ms;
	--apx-motion-enter: 600ms;
	--apx-motion-draw: 1300ms;
	--apx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

	/* ---- Layers ---- */
	--apx-layer-sticky: 20;
	--apx-layer-bar: 30;
	--apx-layer-menu: 40;
	--apx-layer-overlay: 50;
	--apx-layer-toast: 60;

	/*
	 * Breakpoints (custom properties cannot be used in @media, so they are listed here and used as
	 * literal numbers in the portal stylesheet): 1180px the side column moves under the main one, 920px the rail
	 * shrinks to icons, 720px phone layout (bottom tab bar), 420px small phone.
	 */
}

.apx[data-theme="light"] {
	color-scheme: light;
	--apx-color-night: #eef2f9;
	--apx-color-rail: #ffffff;
	--apx-color-deep: #ffffff;
	--apx-color-tide: #ffffff;
	--apx-color-raised: #ffffff;
	--apx-color-sky: #2f7fd0;
	--apx-color-blue: #2f7fd0;
	--apx-color-head: #0b1c40;
	--apx-color-text: #45526e;
	--apx-color-white: #0b1c40;
	--apx-color-ice: #0b1c40;
	--apx-color-well: color-mix(in srgb, #0b1c40 4%, transparent);
	--apx-color-muted: #6a7691;
	--apx-color-violet: #6d5ce8;
	--apx-color-amber: #b9761a;
	--apx-color-green: #18935e;
	--apx-color-red: #d64545;
	--apx-color-grey: #6b7690;
	--apx-color-on-green: #ffffff;
	--apx-color-on-amber: #ffffff;
	--apx-color-scrim: color-mix(in srgb, #0b1c40 40%, transparent);
	--apx-color-bar: color-mix(in srgb, #ffffff 82%, transparent);
	--apx-color-bar-solid: color-mix(in srgb, #ffffff 90%, transparent);
	--apx-color-sheet: color-mix(in srgb, #ffffff 94%, transparent);
	--apx-color-table-head: #f3f6fb;
	--apx-color-line: color-mix(in srgb, #0b1c40 8%, transparent);
	--apx-color-line-faint: color-mix(in srgb, #0b1c40 4%, transparent);
	--apx-color-edge: color-mix(in srgb, #2f7fd0 22%, transparent);
	--apx-color-edge-strong: color-mix(in srgb, #2f7fd0 50%, transparent);
	--apx-color-stripe: color-mix(in srgb, #2f7fd0 6%, transparent);
	--apx-color-stripe-hover: color-mix(in srgb, #2f7fd0 12%, transparent);
	--apx-color-rating-off: color-mix(in srgb, #0b1c40 22%, transparent);
	--apx-surface-card: linear-gradient(160deg, #ffffff, #f7f9fd);
	--apx-gradient-heading: linear-gradient(92deg, #0b1c40 0%, #24406f 70%, #4c6390 100%);
	--apx-gradient-bubble: linear-gradient(160deg, color-mix(in srgb, #2f7fd0 16%, transparent), color-mix(in srgb, #2f7fd0 8%, transparent));
	--apx-gradient-page: none;
	--apx-gradient-nav: linear-gradient(90deg, color-mix(in srgb, #2f7fd0 18%, transparent), transparent);
	--apx-gradient-mask-end: linear-gradient(90deg, #000 85%, transparent);
	--apx-shadow-glow: 0 0 0 1px color-mix(in srgb, #2f7fd0 14%, transparent), 0 10px 30px -18px color-mix(in srgb, #0b1c40 35%, transparent);
	--apx-shadow-card: 0 10px 30px -18px color-mix(in srgb, #0b1c40 30%, transparent);
	--apx-shadow-raised: 0 24px 48px -24px color-mix(in srgb, #0b1c40 35%, transparent);
	--apx-shadow-fab: 0 0 0 5px var(--apx-color-night), 0 0 26px -6px var(--apx-color-blue);
}

@media (prefers-reduced-motion: reduce) {
	.apx {
		--apx-motion-fast: 0ms;
		--apx-motion-base: 0ms;
		--apx-motion-slow: 0ms;
		--apx-motion-enter: 0ms;
		--apx-motion-draw: 0ms;
	}
}
