/**
 * Tessera theme: the frame around the learning pages.
 *
 * Brand colours come from the engine (Tessera\Front\Branding) as custom
 * properties on :root; the fallbacks below apply only with the engine off.
 */

:root {
	--site-brand: var(--tsr-brand-color, #1f4bd8);
	--site-brand-strong: var(--tsr-brand-color-strong, #173aa9);
	--site-brand-soft: var(--tsr-brand-color-soft, #eaf0ff);
	--site-brand-ink: var(--tsr-brand-ink-color, #ffffff);
	--site-bg: #f5f6f8;
	--site-surface: #ffffff;
	--site-ink: #1a1e24;
	--site-muted: #5c6674;
	--site-line: #e2e5ea;
	--site-font: var(--tsr-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
	--site-header: 64px;

	/* The learning pages keep their sticky outline clear of the header. */
	--tsr-header-height: var(--site-header);

	color-scheme: light;
}

.admin-bar { --tsr-header-height: calc(var(--site-header) + 32px); }

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--site-bg);
	color: var(--site-ink);
	font-family: var(--site-font);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--site-brand); }
img { max-width: 100%; height: auto; }

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

.skip-link {
	position: absolute; left: 12px; top: -60px; z-index: 1000;
	padding: 10px 16px; border-radius: 8px;
	background: var(--site-ink); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--site-brand); outline-offset: 2px; }

/* --- Header ---------------------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--site-surface);
	border-bottom: 1px solid var(--site-line);
}
.admin-bar .site-header { top: 32px; }

.site-header__inner {
	max-width: 1180px;
	height: var(--site-header);
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	align-items: center;
	gap: 32px;
}

.site-brand { display: flex; align-items: center; min-width: 0; color: var(--site-ink); text-decoration: none; }
.site-logo--image { display: block; width: auto; max-width: 200px; max-height: 38px; object-fit: contain; }
.site-logo--text { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Takes the room the logo and the account leave. A link that does not fit there is shown in the
   account menu instead (site.js measures; on a phone, further down, they all go). */
.site-nav { position: relative; flex: 1 1 0; min-width: 0; align-self: stretch; overflow: hidden; }
.site-nav__list { display: flex; gap: 4px; height: 100%; margin: 0; padding: 0; list-style: none; }
.site-nav__list li { display: flex; flex: none; }
.site-nav__list li.is-away { display: none; }
/* A visitor has no account menu: their few links slide sideways if they must. */
.site-header--visitor .site-nav { overflow-x: auto; scrollbar-width: none; }
.site-header--visitor .site-nav::-webkit-scrollbar { display: none; }
.site-nav__list a {
	display: flex; align-items: center; padding: 0 12px;
	color: var(--site-muted); font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
	border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.site-nav__list a:hover { color: var(--site-ink); }
.site-nav__list .current-menu-item > a,
.site-nav__list a[aria-current="page"] { color: var(--site-ink); border-bottom-color: var(--site-brand); }

.site-account { margin-left: auto; display: flex; align-items: center; }

.site-button {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; padding: 10px 20px; border-radius: 8px;
	background: var(--site-brand); color: var(--site-brand-ink);
	font-weight: 600; font-size: .95rem; text-decoration: none; line-height: 1.2;
}
.site-button:hover { background: var(--site-brand-strong); color: var(--site-brand-ink); }
.site-button--large { min-height: 52px; padding: 12px 32px; font-size: 1.05rem; }

/* Account menu */

.account-menu { position: relative; }
.account-menu__toggle {
	position: relative;
	display: flex; align-items: center; gap: 10px;
	min-height: 44px; padding: 4px 8px 4px 4px; border-radius: 999px;
	cursor: pointer; list-style: none; user-select: none;
}
.account-menu__toggle::-webkit-details-marker { display: none; }
.account-menu__toggle:hover,
.account-menu[open] .account-menu__toggle { background: var(--site-bg); }
.account-menu__avatar {
	display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
	background: var(--site-brand-soft); color: var(--site-brand-strong);
	font-size: .85rem; font-weight: 700; letter-spacing: .02em;
}
/* Something is waiting behind a link in this menu. */
.account-menu__dot {
	position: absolute; left: 29px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
	background: #d92d20; border: 2px solid var(--site-surface);
}
/* …behind a link that is beside the logo unless it has been moved here. */
.account-menu__dot.is-menu { display: none; }
.account-menu.has-away-waiting .account-menu__dot.is-menu { display: block; }
.account-menu__name { font-weight: 600; font-size: .95rem; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-menu__chevron { color: var(--site-muted); transition: transform .15s ease; }
.account-menu[open] .account-menu__chevron { transform: rotate(180deg); }

.account-menu__panel {
	position: absolute; right: 0; top: calc(100% + 8px); z-index: 10;
	width: 260px; padding: 8px;
	max-height: calc(100vh - var(--tsr-header-height) - 16px); max-height: calc(100dvh - var(--tsr-header-height) - 16px); overflow-y: auto;
	background: var(--site-surface); border: 1px solid var(--site-line); border-radius: 12px;
	box-shadow: 0 16px 40px -16px rgba(16, 24, 40, .3);
}
.account-menu__who { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 1px solid var(--site-line); margin-bottom: 6px; min-width: 0; }
.account-menu__who strong { font-size: .95rem; }
.account-menu__who span { color: var(--site-muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu__panel ul { margin: 0; padding: 0; list-style: none; }
.account-menu__panel a {
	display: block; padding: 10px 12px; border-radius: 8px;
	color: var(--site-ink); font-size: .95rem; text-decoration: none;
}
.account-menu__panel a:hover { background: var(--site-bg); }
.account-menu__panel .current-menu-item > a,
.account-menu__panel a[aria-current="page"] { background: var(--site-brand-soft); color: var(--site-brand-strong); font-weight: 600; }
.account-menu__out { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--site-line); }
/* The menu's links that are not beside the logo just now: none of them, some, or (a phone) all. */
.account-menu__panel .account-menu__moved { display: none; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--site-line); }
.account-menu__panel .account-menu__moved.has-links { display: block; }
.account-menu__moved li { display: none; }
.account-menu__moved li.is-here { display: block; }

/* --- Main and footer -------------------------------------------------------- */

.site-main { flex: 1 0 auto; outline: none; }

.site-footer { border-top: 1px solid var(--site-line); background: var(--site-surface); color: var(--site-muted); font-size: .92rem; }
.site-footer__inner {
	max-width: 1180px; margin: 0 auto; padding: 48px 24px 32px;
	display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 32px 48px;
}
.site-footer__logo { display: inline-block; text-decoration: none; }
.site-footer__logo .site-logo { max-height: 36px; width: auto; }
.site-footer__tagline { margin: 12px 0 0; max-width: 36ch; }
.site-footer__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.site-footer__heading { margin: 0 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--site-ink); }
.site-footer__cols ul, .site-footer__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--site-muted); text-decoration: none; }
.site-footer a:hover { color: var(--site-ink); text-decoration: underline; }
.site-footer__base { border-top: 1px solid var(--site-line); }
.site-footer__base p { max-width: 1180px; margin: 0 auto; padding: 16px 24px; font-size: .85rem; }
@media (max-width: 760px) {
	.site-footer__inner { grid-template-columns: minmax(0, 1fr); padding-top: 36px; }
	.site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* --- Plain pages ------------------------------------------------------------- */

.page-wrap { max-width: 820px; margin: 0 auto; padding: 48px 24px 72px; }
.page-wrap--narrow { max-width: 560px; }
.page-wrap--center { text-align: center; padding-top: 96px; }
.page-eyebrow { margin: 0 0 6px; color: var(--site-muted); font-weight: 600; letter-spacing: .06em; }
.page-title { margin: 0 0 20px; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.15rem); line-height: 1.2; letter-spacing: -.015em; }
.page-title--small { font-size: 1.3rem; }
.page-title a { color: inherit; text-decoration: none; }
.page-lead { margin: 0 0 28px; color: var(--site-muted); font-size: 1.1rem; }
.page-article + .page-article { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--site-line); }

.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 1.8em; font-size: 1.4rem; line-height: 1.3; }
.prose h3 { margin-top: 1.5em; font-size: 1.15rem; }
.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose img,
.prose figure { border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th,
.prose td { padding: 10px 12px; border-bottom: 1px solid var(--site-line); text-align: left; }
.prose blockquote { margin-left: 0; padding-left: 16px; border-left: 3px solid var(--site-brand); color: var(--site-muted); }

/* --- Welcome ---------------------------------------------------------------- */

.welcome {
	background:
		radial-gradient(1200px 400px at 50% -120px, var(--site-brand-soft), transparent 70%),
		var(--site-bg);
}
.welcome__inner { max-width: 720px; margin: 0 auto; padding: 120px 24px 128px; text-align: center; }
.welcome__title { margin: 0; font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); line-height: 1.12; letter-spacing: -.02em; }
.welcome__lead { margin: 16px auto 36px; max-width: 52ch; color: var(--site-muted); font-size: 1.15rem; }

/* --- Small screens ----------------------------------------------------------- */

@media (max-width: 782px) {
	.admin-bar { --tsr-header-height: var(--site-header); }
	.admin-bar .site-header { top: 0; }
}

/* A little less air, and the name left to the account menu, before any link has to move. */
@media (max-width: 1100px) {
	.site-header__inner { gap: 20px; }
	.account-menu__name { display: none; }
}

@media (max-width: 720px) {
	:root { --site-header: 58px; }
	.site-header__inner { gap: 12px; padding: 0 16px; }
	.account-menu__name,
	.account-menu__chevron { display: none; }
	.account-menu__toggle { padding: 4px; }
	.account-menu__dot { left: 27px; top: 1px; }

	/* A phone: no room for a row of links. Someone signed in finds them all under their
	   initials, the menu's first and then their own. No script is needed for this. */
	.site-header--member .site-nav { display: none; }
	.account-menu__panel .account-menu__moved,
	.account-menu__moved li { display: block; }
	.account-menu__dot.is-menu { display: block; }
	.account-menu__panel { width: min(290px, calc(100vw - 24px)); }
	.account-menu__panel a { padding: 11px 12px; }

	/* A visitor has no menu of their own to hold the links: they sit in a row of their own
	   beneath the logo, and slide sideways if there are many. */
	.site-header--visitor .site-header__inner { flex-wrap: wrap; height: auto; row-gap: 0; }
	.site-header--visitor .site-brand { min-height: var(--site-header); }
	.site-header--visitor .site-nav { order: 3; flex: 0 0 calc(100% + 32px); height: 42px; margin: 0 -16px; padding: 0 6px; border-top: 1px solid var(--site-line); }


	.welcome__inner { padding: 72px 20px 80px; }
	.page-wrap { padding: 32px 16px 56px; }
}

@media (prefers-reduced-motion: reduce) {
	.account-menu__chevron { transition: none; }
}
