/**
 * Base: brand tokens, glass system, reset, typography.
 *
 * Palette is sampled directly from the AllInOneLMS logo:
 *   #405AA6 — deep indigo (wordmark, cap, flame)
 *   #5271FF — bright blue (the "One", the tagline, flame highlight)
 */

:root {
	/* ---- Brand ---- */
	--aio-brand-900: #1e2a52;
	--aio-brand-800: #2c3d70;
	--aio-brand-700: #35497f;
	--aio-brand-600: #405aa6; /* logo indigo */
	--aio-brand-500: #5271ff; /* logo bright blue */
	--aio-brand-400: #7b91ff;
	--aio-brand-300: #a8b8ff;
	--aio-brand-100: #e8ecff;
	--aio-brand-50: #f3f5ff;

	--aio-primary: var(--aio-brand-600);
	--aio-primary-dark: var(--aio-brand-700);
	--aio-primary-bright: var(--aio-brand-500);
	--aio-primary-tint: var(--aio-brand-100);

	--aio-accent: #f5a524;
	--aio-success: #14a05c;
	--aio-danger: #dc2626;

	/* ---- Radii ---- */
	--aio-radius-sm: 10px;
	--aio-radius: 16px;
	--aio-radius-lg: 24px;
	--aio-radius-xl: 32px;
	--aio-radius-pill: 999px;

	/* ---- Layout ---- */
	--aio-content: 760px;
	--aio-wide: 1240px;
	--aio-gutter: clamp(1rem, 4vw, 2rem);
	--aio-header-height: 66px;

	/* ---- Motion ---- */
	--aio-ease: cubic-bezier(0.4, 0, 0.2, 1);
	--aio-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
	--aio-transition: 200ms var(--aio-ease);

	/* ---- Type ---- */
	--aio-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--aio-font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
	--aio-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Light scheme ---------- */

[data-scheme="light"],
:root:not([data-scheme]) {
	--aio-bg: #f7f8fd;
	--aio-surface: #ffffff;
	--aio-surface-2: #eef1f9;
	--aio-card: #ffffff;
	--aio-ink: #16203d;
	--aio-text: #414c6b;
	/* Kept at 4.9:1 on frosted surfaces — a lighter grey drops below WCAG AA
	   once the glass blurs the page behind it. */
	--aio-muted: #626c88;
	--aio-line: #e2e7f3;
	--aio-line-strong: #c9d1e6;
	--aio-overlay: rgba(22, 32, 61, 0.5);

	/* Glass */
	--aio-glass-bg: rgba(255, 255, 255, 0.62);
	--aio-glass-bg-strong: rgba(255, 255, 255, 0.82);
	--aio-glass-border: rgba(255, 255, 255, 0.7);
	--aio-glass-edge: rgba(64, 90, 166, 0.1);
	--aio-glass-shadow: 0 1px 2px rgba(30, 42, 82, 0.04), 0 12px 32px rgba(30, 42, 82, 0.08);
	--aio-glass-shadow-lg: 0 2px 6px rgba(30, 42, 82, 0.06), 0 24px 60px rgba(30, 42, 82, 0.12);
	--aio-glass-blur: 18px;

	/* Ambient gradient mesh sitting behind everything */
	--aio-mesh-1: rgba(82, 113, 255, 0.16);
	--aio-mesh-2: rgba(64, 90, 166, 0.13);
	--aio-mesh-3: rgba(168, 184, 255, 0.18);

	--aio-shadow-sm: 0 1px 2px rgba(30, 42, 82, 0.04), 0 6px 18px rgba(30, 42, 82, 0.06);
	--aio-shadow: 0 2px 6px rgba(30, 42, 82, 0.06), 0 18px 44px rgba(30, 42, 82, 0.1);

	color-scheme: light;
}

/* ---------- Dark scheme ---------- */

[data-scheme="dark"] {
	--aio-bg: #0a0f22;
	--aio-surface: #121a33;
	--aio-surface-2: #18213f;
	--aio-card: #131c38;
	--aio-ink: #eef2ff;
	--aio-text: #c3cbe6;
	--aio-muted: #8d98bb;
	--aio-line: #253157;
	--aio-line-strong: #35446f;
	--aio-overlay: rgba(3, 6, 18, 0.68);

	--aio-primary: var(--aio-brand-400);
	--aio-primary-dark: var(--aio-brand-300);
	--aio-primary-bright: var(--aio-brand-400);
	--aio-primary-tint: rgba(82, 113, 255, 0.16);

	--aio-glass-bg: rgba(24, 33, 63, 0.6);
	--aio-glass-bg-strong: rgba(18, 26, 51, 0.85);
	--aio-glass-border: rgba(255, 255, 255, 0.1);
	--aio-glass-edge: rgba(123, 145, 255, 0.16);
	--aio-glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
	--aio-glass-shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.45);

	--aio-mesh-1: rgba(82, 113, 255, 0.2);
	--aio-mesh-2: rgba(64, 90, 166, 0.22);
	--aio-mesh-3: rgba(123, 145, 255, 0.14);

	--aio-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
	--aio-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.4);

	color-scheme: dark;
}

/* ---------- Reset ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--aio-header-height) + 1rem);
}

/*
 * Last-resort guard against sideways scroll. `clip` rather than `hidden`
 * on purpose: `hidden` turns the element into a scroll container and would
 * kill position:sticky on the header and the sidebar rails.
 */
html,
body {
	overflow-x: clip;
}

body {
	position: relative;
	margin: 0;
	min-height: 100vh;
	background: var(--aio-bg);
	color: var(--aio-text);
	font-family: var(--aio-font-sans);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	transition: background-color var(--aio-transition), color var(--aio-transition);
}

/**
 * Ambient gradient mesh.
 *
 * Fixed and behind all content, this is what the frosted surfaces blur.
 * Without something coloured to refract, glass just looks grey.
 */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(60rem 40rem at 12% -8%, var(--aio-mesh-1), transparent 60%),
		radial-gradient(50rem 36rem at 92% 4%, var(--aio-mesh-3), transparent 62%),
		radial-gradient(46rem 34rem at 74% 88%, var(--aio-mesh-2), transparent 60%);
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 0.5em;
	color: var(--aio-ink);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.022em;
	text-wrap: balance;
}

/* Long unbroken strings (URLs, slugs, plugin names) are a common source of
   overflow on narrow screens. */
h1, h2, h3, h4, h5, h6, p, li, dd, dt, td, th, figcaption {
	overflow-wrap: break-word;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2rem); }
h3 { font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem); }
h4 { font-size: 1.0625rem; }

p,
ul,
ol,
dl,
figure,
blockquote,
pre,
table {
	margin: 0 0 1.25rem;
}

p:last-child,
ul:last-child,
ol:last-child {
	margin-bottom: 0;
}

a {
	color: var(--aio-primary);
	text-decoration: none;
	transition: color var(--aio-transition);
}

a:hover,
a:focus-visible {
	color: var(--aio-primary-bright);
	text-decoration: underline;
	text-underline-offset: 2px;
}

hr {
	height: 1px;
	margin: 2.5rem 0;
	border: 0;
	background: var(--aio-line);
}

blockquote {
	padding-left: 1.25rem;
	border-left: 3px solid var(--aio-primary-bright);
	font-family: var(--aio-font-serif);
	font-size: 1.125rem;
}

code,
kbd,
pre,
samp {
	font-family: var(--aio-font-mono);
	font-size: 0.875em;
}

code {
	padding: 0.15em 0.4em;
	border-radius: 6px;
	background: var(--aio-surface-2);
}

pre {
	padding: 1rem 1.25rem;
	overflow-x: auto;
	border-radius: var(--aio-radius);
	background: var(--aio-surface-2);
}

pre code {
	padding: 0;
	background: none;
}

iframe,
embed,
object {
	max-width: 100%;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

/* A five-column comparison table cannot fit a 360px phone. Let it scroll
   inside itself rather than dragging the page sideways. */
@media (max-width: 640px) {
	.entry-content table,
	.comparison__table,
	.spec-table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
		white-space: nowrap;
	}
}

th,
td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--aio-line);
	text-align: left;
	vertical-align: top;
}

th {
	color: var(--aio-ink);
	font-weight: 600;
}

/**
 * Respect a stated preference for less transparency.
 *
 * backdrop-filter is the single most expensive thing this theme paints —
 * every frosted surface forces the compositor to re-blur what is behind it
 * on scroll. Users who ask for reduced transparency get flat opaque
 * surfaces instead, which is both the accessible answer and a large
 * rendering win on low-powered devices.
 */
@media (prefers-reduced-transparency: reduce) {
	*,
	*::before,
	*::after {
		-webkit-backdrop-filter: none !important;
		backdrop-filter: none !important;
	}

	.glass,
	.stat-card,
	.auth-card,
	.btn--ghost {
		background: var(--aio-surface) !important;
		border-color: var(--aio-line) !important;
	}
}

/* ---------- Glass primitives ---------- */

/**
 * .glass — the base frosted surface.
 *
 * backdrop-filter is progressive: browsers without it fall back to the
 * opaque --aio-surface set first, so nothing becomes unreadable.
 */
.glass {
	position: relative;
	background: var(--aio-surface);
	border: 1px solid var(--aio-line);
	border-radius: var(--aio-radius);
	box-shadow: var(--aio-glass-shadow);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
	.glass {
		background: var(--aio-glass-bg);
		border-color: var(--aio-glass-border);
		-webkit-backdrop-filter: blur(var(--aio-glass-blur)) saturate(180%);
		backdrop-filter: blur(var(--aio-glass-blur)) saturate(180%);
	}

	.glass--strong {
		background: var(--aio-glass-bg-strong);
	}
}

/* Specular highlight along the top edge — what sells the glass illusion. */
.glass--lit::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 1px;
	border-radius: inherit;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.75),
		transparent
	);
	pointer-events: none;
}

[data-scheme="dark"] .glass--lit::before {
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.22),
		transparent
	);
}

/**
 * Users who ask for reduced transparency get flat opaque surfaces.
 * Blur behind text is a genuine readability problem for some people.
 */
@media (prefers-reduced-transparency: reduce) {
	.glass,
	.glass--strong {
		background: var(--aio-surface) !important;
		-webkit-backdrop-filter: none !important;
		backdrop-filter: none !important;
	}

	body::before {
		display: none;
	}
}

/* ---------- Accessibility ---------- */

:focus-visible {
	outline: 2px solid var(--aio-primary-bright);
	outline-offset: 2px;
	border-radius: 6px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: -100px;
	left: 1rem;
	z-index: 999;
	padding: 0.75rem 1.25rem;
	border-radius: 0 0 var(--aio-radius-sm) var(--aio-radius-sm);
	background: var(--aio-primary);
	color: #fff;
	font-weight: 600;
	transition: top var(--aio-transition);
}

.skip-link:focus {
	top: 0;
	color: #fff;
	text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- WordPress core classes ---------- */

.alignleft {
	float: left;
	margin: 0.5rem 1.5rem 1rem 0;
}

.alignright {
	float: right;
	margin: 0.5rem 0 1rem 1.5rem;
}

.aligncenter {
	margin-inline: auto;
}

.wp-caption-text,
.wp-element-caption figcaption {
	margin-top: 0.5rem;
	color: var(--aio-muted);
	font-size: 0.8125rem;
}

.sticky .card__title::before {
	content: "★ ";
	color: var(--aio-accent);
}
