/*
 * Analingua base layer — design tokens + site chrome owned by the PLUGIN.
 *
 * These used to live in the custom `analingua` theme, which made the whole UI
 * collapse under any other theme. Keeping them here makes the plugin
 * theme-portable: the visual language travels with the functionality.
 *
 * Loaded site-wide and declared as a dependency of every other plugin
 * stylesheet, so tokens are always defined before they are consumed.
 */

/*
 * TOKENS NOW ALIAS THE THEME'S.
 *
 * These used to carry their own hex values — the old sky-blue Wordwall look —
 * and because the plugin still renders the shortcode pages, the site had two
 * competing palettes: one in theme-4eck's _constants.scss and one here, with
 * `html body` making this one win. Anything the redesign changed would have to
 * be changed twice, and the two would drift apart the first time one was
 * forgotten.
 *
 * Every --an-* is therefore a pointer at a --theme-* token, with the old value
 * kept only as the fallback for the case where the plugin runs under a theme
 * that does not define them. The fallback is what makes the plugin still
 * theme-portable, which is why these tokens moved here in the first place.
 *
 * The plugin's screens are being replaced by Gutenberg blocks; until they are,
 * this is what lets the old ones look like the new design instead of like the
 * design they were built for.
 */
:root {
	/* Brand */
	--an-primary: var(--theme-primary-color, #125a8f);
	--an-primary-hover: var(--theme-primary-hover, #0d4670);
	--an-primary-accent: var(--theme-primary-link, #0f5182);
	--an-primary-border: var(--theme-primary-color, #125a8f);
	--an-primary-ink: var(--theme-base-light, #ffffff);
	--an-link: var(--theme-primary-link, #0f5182);

	/* Text */
	--an-text: var(--theme-text-color-default, #4a5a6a);
	--an-heading: var(--theme-heading-color, #111e2b);
	--an-muted: var(--theme-text-color-alternative, #5f6f7c);
	--an-faint: var(--theme-text-on-dark, #9fb2c4);

	/* Surfaces */
	--an-bg: var(--theme-bg-page, #eef2f6);
	--an-bg-top: var(--theme-bg-page, #eef2f6);
	--an-surface: var(--theme-base-light, #ffffff);
	--an-border: var(--theme-border-color, #dfe6ee);
	--an-border-soft: var(--theme-border-nested, #e4eaf1);
	--an-tile-ring: var(--theme-border-interactive, #d3dce6);

	/* Shape */
	--an-radius-card: var(--theme-radius-lg, 16px);
	--an-radius-btn: var(--theme-button-radius, 11px);
	--an-shadow: var(--theme-xs-shadow, 0 1px 2px rgba(20, 40, 60, 0.1));
	--an-shadow-card: var(--theme-sm-shadow, 0 8px 24px rgba(20, 40, 60, 0.09));

	/* Type */
	--an-font-body: var(--theme-text-ff, "Onest", system-ui, sans-serif);
	--an-font-head: var(--theme-heading-ff, "Onest", system-ui, sans-serif);
	--an-font-de: var(--theme-de-ff, "Literata", Georgia, serif);

	/* Layout */
	--an-container: 1120px;
	--an-gutter: 20px;

	/* Activity-type accent colors (template tiles) */
	--an-c-cards: #6a5cff;
	--an-c-quiz: #35b7ff;
	--an-c-match: #1bbf8a;
	--an-c-pairs: #ff7a59;
	--an-c-anagram: #f5a623;
	--an-c-wheel: #e85d9c;
	--an-c-learn: #2bb673;
}

/* ---- Base canvas ------------------------------------------------------ */
/* The plugin owns the site's visual identity, so it carries the page canvas
   rather than depending on whichever theme happens to be active. */
* { box-sizing: border-box; }

/* `html body` (0,0,2) beats theme-4eck's `body` font/color at any print order. */
html body {
	font-family: var(--an-font-body);
	/* Body size and leading come from the theme's tokens now: fixing 15px here
	   left the whole shortcode UI a step smaller than the design's 17px, and no
	   amount of editing _constants.scss could reach it. */
	font-size: var(--theme-base-fs, 17px);
	line-height: var(--theme-text-lh, 1.55);
	color: var(--an-text);
	background-color: var(--an-bg);
	-webkit-font-smoothing: antialiased;
}

/* ---- Breadcrumbs ------------------------------------------------------ */
.an-crumbs { border-bottom: 1px solid var(--an-border); background: var(--an-surface); }

.an-crumbs__inner {
	max-width: var(--an-container);
	margin: 0 auto;
	padding: 9px var(--an-gutter);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 7px;
	font-size: 13px;
}

.an-crumbs__link { color: var(--an-link); text-decoration: none; }
.an-crumbs__link:hover { text-decoration: underline; }
.an-crumbs__sep { color: var(--an-muted); opacity: 0.7; }
.an-crumbs__cur { color: var(--an-text, #2a2a33); font-weight: 600; }

/* ---- User bar + language switch --------------------------------------- */
/* Injected into the active theme's primary menu, so it must survive being
   rendered as <li> items inside an arbitrary theme's <ul>. */
.an-userbar {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	list-style: none;
}

.an-userbar a { text-decoration: none; }

.an-user { display: inline-flex; align-items: center; gap: 14px; }

.an-user__name {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--an-text);
}

.an-user__name:hover { color: var(--an-primary-accent); }

.an-user__badge {
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	background: var(--an-primary);
	padding: 1px 8px;
	border-radius: 999px;
}

.an-user__logout { font-size: 14px; color: var(--an-muted); }
.an-user__logout:hover { color: var(--an-text); }

.an-login {
	background: var(--an-primary);
	border: 1px solid var(--an-primary-border);
	color: var(--an-primary-ink);
	padding: 9px 18px;
	border-radius: var(--an-radius-btn);
	font-size: 14px;
	font-weight: 700;
	transition: background 0.12s ease;
}

.an-login:hover { background: var(--an-primary-hover); color: var(--an-primary-ink); }

.an-lang {
	display: inline-flex;
	gap: 2px;
	border: 1px solid var(--an-border);
	border-radius: 999px;
	padding: 2px;
}

.an-lang__opt {
	padding: 3px 11px;
	border-radius: 999px;
	font-size: 13px;
	color: var(--an-muted);
	line-height: 1.5;
}

.an-lang__opt:hover { color: var(--an-text); }
.an-lang__opt.is-active { background: var(--an-primary); color: var(--an-primary-ink); font-weight: 600; }
