/* PRISM site styles.
   Colours are tokens on :root, redefined for dark mode; the two banner blues are the PRISM identity. */

:root {
	--prism-dark: #272582;
	--prism-light: #6260c1;

	--bg: #ffffff;
	--bg-subtle: #f4f4f8;
	--text: #1b1b24;
	--text-muted: #555566;
	--border: #d4d4e0;
	--link: #2f2ca8;
	--link-visited: #5b2a8c;
	--focus: #e8a400;
	--accent-bg: #ececf8;
	--card-icon: #6260c1;
	--code-bg: #f6f6fa;
	--shell-prompt: #5b58e6; /* the $ before shell commands */
	--shell-out: #74748a; /* command output */
	/* publications: a soft gold, the site's second colour (with green for keys, and matches when filtering a list) */
	--bib-key: #006600;
	--bib-box-bg: #fffbe5;   /* "butter"; a quieter alternative, "pale cream": #fcf9f0 */
	--bib-box-head: #fbefbc; /*   #f3ebd2 */
	--bib-box-border: #eedc8c; /*   #ded0a6 */
	--bib-bar: #e6c443;      /*   #cfb466 */
	--bib-stripe: var(--bg-subtle); /* as the sort and search box above the list */
	--bib-synop: #6e6e80;
	--bib-mark-bg: #ccff99;
	--bib-mark-border: #669966;

	/* header: white top, navy menu bar; the site title in a gradient of the two blues */
	--header-bg: #ffffff;
	--header-border: transparent;
	--wordmark: linear-gradient(90deg, var(--prism-dark), var(--prism-light));
	--tagline: #5a5a78;
	--nav-bg: #1b1a55;
	--nav-link: #d9d9ff;
	--nav-current: #8f8dff;
	/* side menus: a darker band for the title and a darker border again; the search box above is paler */
	--side-bg: var(--bg-subtle);
	--side-head: #e0e0ea;
	--side-border: #c2c2d0;
	--search-bg: #fafafc;
	--news-stripe: #eaeaf2;
	/* panels and callouts (::: box, ::: questions, ::: answer) */
	--box-shadow: 0 2px 8px rgba(30, 30, 90, 0.08);
	--callout-bar: var(--prism-light);
	--callout-bg: #f0f2fc;
	--radius: 10px;   /* panels and side menus */
	--radius-sm: 6px; /* code, inputs and smaller boxes */

	--tok-keyword: #1b1b24;
	--tok-ident: #b3001b;
	--tok-num: #1a1ac0;
	--tok-comment: #2b7a0b;
	--tok-string: #8a4b00;
	--tok-preproc: #8a2be2;

	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	--measure: 60rem; /* content width (tables and images use all of it) */
	--h1-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
	--gutter: clamp(1rem, 3vw, 2rem);
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #15151c;
		--bg-subtle: #1e1e28;
		--text: #e8e8f0;
		--text-muted: #a8a8bc;
		--border: #3a3a4c;
		--link: #a9a7ff;
		--link-visited: #d0a8ff;
		--accent-bg: #23233a;
		--card-icon: #8f8dff;
		--code-bg: #1c1c26;
		--shell-prompt: #8f8dff;
		--shell-out: #9a9ab0;
		--bib-key: #7fcf6a;
		--bib-box-bg: #2a2714;
		--bib-box-head: #3a3519;
		--bib-box-border: #6c6024;
		--bib-bar: #d2b23e;
		--bib-stripe: var(--bg-subtle);
		--bib-synop: #8c8ca0;
		--bib-mark-bg: #223d18;
		--bib-mark-border: #7fcf6a;

		--header-bg: #15151c;
		--header-border: #2c2c3a;
		--wordmark: linear-gradient(90deg, #a9a7ff, #d8d7ff);
		--tagline: #a8a8bc;
		--side-head: #2b2b3b;
		--side-border: var(--border);
		--search-bg: var(--bg-subtle);
		--news-stripe: #262632;
		--box-shadow: none;
		--callout-bg: var(--accent-bg);

		--tok-keyword: #e8e8f0;
		--tok-ident: #ff8a8a;
		--tok-num: #8fb4ff;
		--tok-comment: #7fcf6a;
		--tok-string: #f0b46a;
		--tok-preproc: #d39cff;
	}
}

/* Base */

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	line-height: 1.6;
}
/* The page fills at least the window, so the footer sits at the bottom on short pages */
body:not(.files-page) { display: flex; flex-direction: column; min-height: 100vh; }
.site-footer { margin-top: auto; }

img { max-width: 100%; height: auto; }

a { color: var(--link); text-underline-offset: 0.15em; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 0.5em; }
h1 { font-size: var(--h1-size); margin-top: 0.4em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

/* (monospace letters are wide and heavy, so 0.85 reads as the same size as the text; code inside a listing doesn't shrink again) */
code, pre { font-family: var(--font-mono); font-size: 0.85em; }
pre code { font-size: 1em; }
:not(pre) > code {
	overflow-wrap: anywhere; /* long option names and paths mustn't widen the page on phones */
	background: var(--code-bg);
	padding: 0 0.25em;
}

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: 0.5rem;
	top: -3rem;
	z-index: 10;
	padding: 0.5rem 1rem;
	background: var(--bg);
	color: var(--link);
	font-weight: 600;
}
.skip-link:focus { top: 0.5rem; }

/* Header: white top with the logo (which looks best on white) and a navy menu bar below.
   In dark mode the top turns near-black and the wordmark a lighter blue. */

.site-header__top {
	background: var(--header-bg);
	border-bottom: 1px solid var(--header-border);
}
.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	max-width: 80rem;
	margin: 0 auto;
	padding: 0.9rem var(--gutter);
}

.brand {
	display: flex;
	align-items: center;
	gap: 1rem;
	text-decoration: none;
}
.brand img { display: block; flex: none; }
.brand__name {
	font-size: 2.2rem;
	font-weight: 800;
	letter-spacing: 0.03em;
	line-height: 1;
	background: var(--wordmark);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.brand__tagline {
	/* matches the visible space left of the rule (the 1rem gap plus the wordmark's letter-spacing and side bearing) */
	padding-left: 1.2rem;
	border-left: 1px solid var(--border);
	color: var(--tagline);
	font-size: 1rem;
	line-height: 1.2;
}
/* High-contrast modes ignore background images, so gradient text needs a plain colour */
@media (forced-colors: active) {
	.brand__name { background: none; color: LinkText; }
}

.site-search { display: flex; gap: 0.25rem; margin-left: auto; }
.site-search input {
	width: 13rem;
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--search-bg);
	color: var(--text);
	font: inherit;
	font-size: 0.95rem;
}

button, .button {
	padding: 0.4rem 0.85rem;
	border: 1px solid currentColor;
	border-radius: var(--radius-sm);
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.95rem;
	cursor: pointer;
}
button:hover { background: var(--accent-bg); }
.site-search button { background: var(--prism-dark); border-color: var(--prism-dark); color: #fff; display: flex; align-items: center; }
.site-search button:hover { background: var(--prism-light); border-color: var(--prism-light); }
/* The search box on the "page not found" page */
.search-404 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1.25rem 0; }
.search-404 input {
	flex: 1 1 14rem;
	max-width: 24rem;
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--search-bg);
	color: var(--text);
	font: inherit;
}
.search-404 button { background: var(--prism-dark); border-color: var(--prism-dark); color: #fff; }
.search-404 button:hover { background: var(--prism-light); border-color: var(--prism-light); }
.menu-toggle { color: var(--link); }

.site-nav { background: var(--nav-bg); }
.site-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem;
	max-width: 80rem;
	margin: 0 auto;
	padding: 0 var(--gutter);
	list-style: none;
}
.site-nav a {
	display: block;
	padding: 0.6rem 0.85rem;
	color: var(--nav-link);
	text-decoration: none;
	font-weight: 500;
}
.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.site-nav a[aria-current] { color: #fff; box-shadow: inset 0 -3px 0 var(--nav-current); }
.site-nav :focus-visible { outline-color: #fff; outline-offset: -3px; }
/* GitHub: its logo at the right-hand end of the bar (on small screens, with its name, as the last item) */
.site-nav__github { margin-left: auto; }
.site-nav__github a { display: flex; align-items: center; gap: 0.5rem; height: 100%; }
.site-nav__github-label { display: none; }
/* Links off the site in side menus */
.ext { margin-left: 0.3em; font-size: 0.85em; color: var(--text-muted); }

/* Small screens: tagline hidden, search on its own row, menu behind a button (only when JS is running, see site.js) */
@media (max-width: 47.99rem) {
	.brand__name { font-size: 1.8rem; }
	.brand img { width: 44px; height: 44px; }
	.site-header__inner { row-gap: 1rem; }
	.brand__tagline { display: none; }
	.menu-toggle { margin-left: auto; }
	.site-search { order: 3; width: 100%; margin-left: 0; }
	.site-search input { flex: 1; width: auto; }
	.js .menu-toggle { display: inline-block; }
	.js .site-nav:not(.is-open) { display: none; }
	.site-nav ul { flex-direction: column; padding-top: 0.25rem; padding-bottom: 0.5rem; }
	.site-nav a[aria-current] { box-shadow: inset 3px 0 0 var(--nav-current); }
	.site-nav__github { margin-left: 0; }
	.site-nav__github svg { width: 18px; height: 18px; }
	.site-nav__github .site-nav__github-label { display: inline; }
	/* With the menu closed, a side menu's title bar sits one gap below the search box, not two */
	.js .site-header:has(.site-nav:not(.is-open)):has(+ .page--with-nav) .site-header__top { border-bottom: 0; }
	.js .site-header:has(.site-nav:not(.is-open)):has(+ .page--with-nav) .site-header__inner { padding-bottom: 0; }
}
@media (min-width: 48rem) {
	.menu-toggle { display: none !important; }
}

/* Page layout: optional local menu + content */

.page {
	width: 100%; /* (in the body's column, auto margins would otherwise shrink it to its content) */
	max-width: 80rem;
	margin: 0 auto;
	padding: 1rem var(--gutter) 3rem;
}
.page--with-nav {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem 2.5rem;
}
@media (min-width: 60rem) {
	.page--with-nav { grid-template-columns: 15rem minmax(0, 1fr); }
	/* Line the top of the side menu up with the top of the page heading's letters: the heading's top
	   margin (0.4em), plus the space above capital letters in its line (0.3em), plus any breadcrumb
	   line above it (0.9rem text at line-height 1.6). Manual headings have a 0.3em margin. */
	.page--with-nav > nav { margin-top: calc(0.7 * var(--h1-size)); }
	.page--with-nav:has(> .content > .breadcrumb) > nav { margin-top: calc(1.44rem + 0.7 * var(--h1-size)); }
	/* (the home page's news panel too, though it has no breadcrumb: the left column starts at one height everywhere) */
	.page--home > nav { margin-top: calc(1.44rem + 0.7 * var(--h1-size)); }
	.page--manual > nav { margin-top: calc(0.6 * var(--h1-size)); }
	.page--manual:has(> .content > .breadcrumb) > nav { margin-top: calc(1.44rem + 0.6 * var(--h1-size)); }
	.local-nav, .manual-nav { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

.content { min-width: 0; max-width: min(100%, var(--measure)); overflow-wrap: break-word; /* long URLs used as link text */ }

/* Pages in the folders of files (/files/, /subm/): plain HTML with no site header or menu.
   These aren't in this repo: they link to this stylesheet from the server. */
body.files-page { max-width: 60rem; margin: 0 auto; padding: 1rem 1rem 3rem; overflow-wrap: break-word; }
.content .prism-rule { border: 0; border-top: 1px solid var(--border); margin: 2rem 0 1rem; height: 0; }
.content ul.prism-list { padding-left: 1.4rem; }

/* Side menus (section menus and the manual's contents): a light grey rounded box,
   with its title in a darker band across the top and a darker border again */
.local-nav {
	background: var(--side-bg);
	border: 1px solid var(--side-border);
	border-radius: var(--radius);
	box-shadow: var(--box-shadow);
	overflow: hidden;
}
.local-nav, .manual-nav { font-size: 0.95rem; }
.local-nav__title, .manual-nav__title {
	margin: 0;
	padding: 0.6rem 1rem;
	background: var(--side-head);
	font-size: 1.1rem;
	font-weight: 700;
}
/* The title links to the section's index page, but looks like a heading */
.local-nav .local-nav__title a, .manual-nav .manual-nav__title a {
	display: inline; padding: 0; color: inherit; text-decoration: none;
}
.local-nav .local-nav__title a:hover, .manual-nav .manual-nav__title a:hover { background: none; text-decoration: underline; }

/* Items, the same in both menus: each a block that shades on hover, the current page in blue on a tint.
   Item text lines up with the title text (0.5rem box padding + 0.5rem item padding = the title's 1rem). */
.local-nav ul, .manual-nav ul { list-style: none; margin: 0; padding: 0; }
.local-nav li, .manual-nav li { margin: 0; }
.local-nav__details { padding: 0.5rem 0.5rem 0.75rem; }
.local-nav a, .manual-nav a {
	display: block; padding: 0.2rem 0.5rem; border-radius: 4px;
	text-decoration: none; color: var(--text);
}
.local-nav a:hover, .manual-nav a:hover { background: var(--side-head); }
.local-nav a[aria-current], .manual-nav a[aria-current="page"] {
	background: var(--accent-bg); color: var(--link); font-weight: 600;
}
/* A page's own sub-pages (the tutorial's parts), under it, as the manual's headings are under its page */
.local-nav .local-nav__sub { margin: 0.15rem 0 0.4rem 0.5rem; border-left: 2px solid var(--border); }
.local-nav .local-nav__sub a { font-size: 0.9rem; padding-left: 0.6rem; }
/* On small screens, the title bar shows and hides the menu (see site.js), with a triangle to say so */
@media (max-width: 59.99rem) {
	.js :is(.local-nav, .manual-nav):has(.local-nav__details) :is(.local-nav__title, .manual-nav__title) { position: relative; padding-right: 2.5rem; cursor: pointer; }
	.js :is(.local-nav, .manual-nav):has(.local-nav__details) :is(.local-nav__title, .manual-nav__title)::after {
		content: "▾"; position: absolute; top: 0.6rem; right: 1rem; color: var(--text-muted);
	}
	.js :is(.local-nav, .manual-nav):has(.local-nav__details:not([hidden])) :is(.local-nav__title, .manual-nav__title)::after { transform: rotate(180deg); }
}

.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

.pager {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}
.pager a { display: flex; flex-direction: column; text-decoration: none; }
.pager span { font-size: 0.85rem; color: var(--text-muted); }
.pager__next { margin-left: auto; text-align: right; }

/* Content elements */

figure { margin: 1.5rem 0; }
figcaption { font-size: 0.9rem; color: var(--text-muted); }

/* Tables: wrap in .table-scroll so wide tables scroll rather than the page */
.table-scroll { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; }
th, td { padding: 0.35rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; }
th { background: var(--bg-subtle); }

/* Code listings */

pre {
	background: var(--code-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.8rem 1rem;
	overflow-x: auto;
	line-height: 1.45;
	tab-size: 4;
}
/* A listing of a file (prismCode, and the file viewer): the code in a box, with the file's download link
   in a darker band along the bottom */
figure.code { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
figure.code pre { margin: 0; border: 0; border-radius: 0; }
figure.code figcaption {
	padding: 0.3rem 1rem; background: var(--side-head); border-top: 1px solid var(--border);
	font-size: 0.85rem; color: var(--text-muted);
}
/* Shell commands (```shell): a blue $ prompt before each command (not part of the text, so not copied), output in grey */
.language-shell .cmd::before { content: "$ "; color: var(--shell-prompt); font-weight: 700; user-select: none; }
.language-shell .out { color: var(--shell-out); }
/* Copy button on code boxes: faint until the box is hovered or the button focused (always shown on touch screens) */
.codebox, figure.code { position: relative; }
.codebox > pre { margin: 0; }
:is(.codebox, figure.code) > pre { padding-right: 5.5rem; } /* (room for the button, so it never covers a short command) */
.codebox { margin: 1rem 0; }
.copy-code {
	position: absolute; top: 0.55rem; right: 0.55rem;
	display: inline-flex; align-items: center; gap: 0.3em;
	padding: 0.15rem 0.45rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
	background: var(--bg); color: var(--text-muted); font: inherit; font-size: 0.75rem; cursor: pointer;
	opacity: 0; transition: opacity 0.15s;
}
:is(.codebox, figure.code):hover .copy-code, .copy-code:focus-visible, .copy-code.is-done { opacity: 1; }
.copy-code:hover { color: var(--link); border-color: var(--link); }
.copy-code.is-done { color: var(--bib-key); border-color: currentColor; }
@media (hover: none) { .copy-code { opacity: 0.85; } }
pre code { background: none; } /* (some old pages style all code elements, meaning inline code) */
.tok-keyword { color: var(--tok-keyword); font-weight: 700; }
.tok-ident { color: var(--tok-ident); }
.tok-num { color: var(--tok-num); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-string { color: var(--tok-string); }
.tok-preproc { color: var(--tok-preproc); }
/* The same colours for other languages, highlighted by highlight.js (its class names) */
:is(.hljs-keyword, .hljs-literal, .hljs-section) { color: var(--tok-keyword); font-weight: 700; }
:is(.hljs-built_in, .hljs-name, .hljs-title, .hljs-type, .hljs-selector-tag) { color: var(--tok-ident); }
:is(.hljs-number, .hljs-symbol) { color: var(--tok-num); }
:is(.hljs-comment, .hljs-quote) { color: var(--tok-comment); font-style: italic; }
:is(.hljs-string, .hljs-regexp) { color: var(--tok-string); }
:is(.hljs-meta, .hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable) { color: var(--tok-preproc); }

/* Maths (KaTeX): a little smaller than its default 1.21em, closer to the text; a wide formula scrolls on narrow screens */
:root .katex { font-size: 1.1em; white-space: nowrap; } /* (:root, to win over katex.min.css, which loads later; nowrap: an inline formula isn't split across lines) */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.2em 0; }

/* News and bibliography lists */

.news { list-style: none; padding: 0; }
.news li { margin: 0 0 1rem; }
.news time { display: block; font-weight: 700; font-size: 0.95rem; }
/* Striped: items run edge to edge, every second one a little darker (the home page's news panel,
   and the news page, where the list is a panel of its own) */
.news--striped li { margin: 0; padding: 0.6rem 0.9rem; scroll-margin-top: 1rem; }
.news--striped li:nth-child(even) { background: var(--news-stripe); }
.news-panel .news--striped { margin: 0; }
.content .news--striped {
	margin: 1.5rem 0; overflow: hidden; background: var(--side-bg);
	border: 1px solid var(--side-border); border-radius: var(--radius); box-shadow: var(--box-shadow);
}

.bib-list { list-style: none; padding: 0; }
/* entries on alternate pale grey bands (counting only those shown when the list is filtered) */
.bib-list li { margin: 0; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); }
.bib-list li:nth-child(even of :not([hidden])) { background: var(--bib-stripe); }
.bib-list li > span, .bib-entry > span, .bib-cite > span { margin-right: 0.25em; }
.bib-key { color: var(--bib-key); font-weight: 700; }
.bib-title { font-weight: 700; }
.bib-files a { font-size: 0.9rem; }
.bib-files a::before { content: "["; color: var(--text-muted); }
.bib-files a::after { content: "]"; color: var(--text-muted); }
.bib-synop { color: var(--bib-synop); }

/* In lists, key, authors, title and synopsis each get their own line (as on the old site) */
.bib-list .bib-key, .bib-list .bib-auth, .bib-list .bib-title, .bib-list .bib-synop { display: block; }
.bib-list .bib-synop { margin-top: 0.15rem; }
.bib-entry .bib-synop { display: none; }

/* Section heads of publication lists (years, types, ...): a gold bar down the left, its tint fading to half strength on the right */
.bib-head, :is(h2, h3):has(+ .bib-list) {
	padding: 0.25rem 0.75rem;
	background: linear-gradient(to right, var(--bib-box-head), color-mix(in srgb, var(--bib-box-head) 50%, transparent));
	border-left: 4px solid var(--bib-bar);
}
.bib-head small, :is(h2, h3):has(+ .bib-list) small { color: var(--text-muted); font-size: 0.7em; font-weight: 400; }

/* Item pages: the citation reads as one paragraph under the title (downloads are listed below it) */
.bib-cite { font-size: 1.05rem; }
.bib-cite .bib-title { font-weight: 400; }
.bib-cite .bib-files { display: none; }
.bib-cite .bib-synop { display: none; } /* (synopses are for the lists) */
.bib-item dl { margin: 1.5rem 0; }
.bib-item dt { font-weight: 700; margin-top: 1rem; }
.bib-item dd { margin: 0.25rem 0 0; }
/* Item pages: each download as a pale rounded chip with its file icon, type and size */
.bib-downloads { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bib-downloads a {
	display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.8rem 0.35rem 0.55rem; line-height: 1.2;
	background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 999px;
	color: var(--text); font-weight: 600; text-decoration: none;
}
.bib-downloads a:hover { border-color: var(--link); color: var(--link); }
.bib-downloads small { font-weight: 400; font-size: 0.8rem; color: var(--text-muted); }
/* The abstract: a gold panel like the side menus, its heading in a darker band across the top */
.bib-abstract {
	margin: 1.5rem 0;
	padding: 0 1rem 0.75rem;
	background: var(--bib-box-bg);
	border: 1px solid var(--bib-box-border);
	border-radius: var(--radius);
	box-shadow: var(--box-shadow);
	overflow: hidden;
}
.bib-abstract h2 { font-size: 1.1rem; margin: 0 -1rem 0.6rem; padding: 0.6rem 1rem; background: var(--bib-box-head); }
.bib-entry { font-size: 1.05rem; padding: 1rem; background: var(--bg-subtle); border-radius: var(--radius-sm); }

/* Publication lists: sort links, and the search box that filters the list (js/bib-filter.js) */
.bib-tools { margin: 1rem 0; padding: 0.75rem 1rem; background: var(--bg-subtle); border-radius: var(--radius-sm); }
.bib-sort { margin: 0; }
.bib-sort strong { font-weight: 700; }
.bib-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin-top: 0.6rem; }
.bib-filter[hidden] { display: none; }
.bib-filter label { font-weight: 600; }
.bib-filter input {
	flex: 1 1 16rem; max-width: 28rem; padding: 0.4rem 0.6rem;
	border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit;
}
.bib-filter-status { flex-basis: 100%; margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.bib-filter-status:empty { display: none; }
.bib-group[hidden], .bib-list li[hidden], .year-nav li[hidden] { display: none; }
.bib-group > .bib-group > h3 { font-size: 1.05rem; }
mark.bib-highlight { background: var(--bib-mark-bg); color: inherit; border-bottom: 1px solid var(--bib-mark-border); padding: 0; }

/* Links to a list's sections (years, ...), separated by "·" as other inline lists of links are. Each bullet hangs
   to the left of its link, so the one starting each line is clipped off rather than left dangling */
.year-nav { display: flex; flex-wrap: wrap; row-gap: 0.25rem; padding: 0; list-style: none; overflow: hidden; }
.year-nav li { margin: 0 1.4em 0 -1.4em; }
.year-nav li::before { content: "·"; display: inline-block; width: 1.4em; text-align: center; color: var(--text-muted); }

/* Footer */

.site-footer {
	border-top: 1px solid var(--border);
	background: var(--bg-subtle);
	color: var(--text-muted);
	font-size: 0.9rem;
	padding: 1rem var(--gutter);
	text-align: center;
}

/* Search page (Pagefind UI) */

#search {
	--pagefind-ui-primary: var(--link);
	--pagefind-ui-text: var(--text);
	--pagefind-ui-background: var(--bg);
	--pagefind-ui-border: var(--border);
	--pagefind-ui-tag: var(--bg-subtle);
	--pagefind-ui-font: var(--font-body);
}

@media print {
	.site-header, .local-nav, .site-footer, .pager, .skip-link { display: none; }
	.page--with-nav { display: block; }
}

/* Manual: full contents in a sidebar (as in the Rust book), current page's headings nested under it */

.manual-nav { background: var(--side-bg); border: 1px solid var(--side-border); border-radius: var(--radius); box-shadow: var(--box-shadow); }
.manual-nav__head { background: var(--side-bg); }
.manual-nav__title { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.manual-nav__search { padding: 0.6rem 0.5rem 0; }
.manual-nav__version {
	font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
	border: 1px solid var(--border); border-radius: 999px; padding: 0 0.45rem; vertical-align: 0.1em;
}
.manual-nav__search input {
	width: 100%; padding: 0.35rem 0.5rem; margin-bottom: 0.25rem;
	border: 1px solid var(--border); border-radius: 4px;
	background: var(--bg); color: var(--text); font: inherit; font-size: 0.9rem;
}
/* Three levels: sections (linking to their contents pages), pages, and the current page's headings */
.manual-nav__section, .manual-nav .manual-nav__top > li > a {
	font-size: 0.95rem; font-weight: 700; color: var(--text);
}
.manual-nav__section, .manual-nav .manual-nav__top { margin: 1rem 0 0.3rem; }
.manual-nav .manual-nav__section a { color: inherit; }
/* (a section heading that is the current page keeps its weight, highlighted like any current page) */
.manual-nav .manual-nav__section a[aria-current] { font-weight: inherit; color: var(--link); }
/* Sections fold: the heading links to the section's contents page, the triangle beside it opens and closes it.
   Closed sections sit close together, so the list of them reads as one menu; an open one has space below it. */
.manual-nav__group > summary { list-style: none; position: relative; cursor: pointer; padding-right: 1.6rem; }
.manual-nav__group > summary::-webkit-details-marker { display: none; }
.manual-nav__group > summary::after {
	content: "▸"; position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
	color: var(--text-muted); font-size: 0.95rem; transition: transform 0.15s;
}
.manual-nav__group[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
.manual-nav__group > summary:hover::after { color: var(--text); }
.manual-nav__group > summary .manual-nav__section { margin: 0.35rem 0; }
/* (an open section's space goes below its pages, so its heading stays put when it opens) */
.manual-nav__group[open] > ul { margin-bottom: 0.95rem; }
.manual-nav .manual-nav__headings { margin: 0.15rem 0 0.4rem 0.5rem; border-left: 2px solid var(--border); }
.manual-nav .manual-nav__headings a { font-size: 0.88rem; color: var(--text-muted); padding-left: 0.6rem; }

@media (min-width: 60rem) {
	.page--manual { grid-template-columns: 17rem minmax(0, 1fr); }
	/* title and search stay in view while the contents scroll */
	.manual-nav__head { position: sticky; top: 0; z-index: 1; }
}

.manual-page h1 { margin-top: 0.3em; }
.manual-page h2 { scroll-margin-top: 1rem; }
.edit-link { margin-top: 2.5rem; font-size: 0.9rem; }

/* Page content */

.todo { background: #fff3cd; color: #5c4400; padding: 0.25rem 0.5rem; border-radius: 4px; }
.tag { display: inline-block; font-size: 0.8rem; padding: 0 0.45rem; margin-right: 0.25rem; border-radius: 999px; background: var(--accent-bg); color: var(--link); }

.content hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0 1rem; height: 0; }
.content img.prism-image { display: block; margin: 1rem auto; padding: 4px; border: 1px solid var(--border); background: #fff; }
/* Search page: a filter with nothing to choose from for these results (Year or Type, when no papers match) */
#search .pagefind-ui__filter-block:not(:has(input)) { display: none; }
/* Search page: each page's URL under its title (not for the sections within a page) */
#search .pagefind-ui__result-inner > .pagefind-ui__result-title > .pagefind-ui__result-link::after { content: attr(href); display: block; width: fit-content; margin-top: 2px; font-size: 0.85em; font-weight: normal; color: var(--bib-key); }

/* "How to cite" boxes */
.content .prism-citebox { margin: 1.5rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--accent-bg); font-size: 0.9rem; overflow: auto; }
.content .prism-citeboxheader { padding: 0.35rem 0.8rem; background: var(--bg-subtle); border-bottom: 1px solid var(--border); font-weight: 600; }

/* Styles for Markdown pages: *text*{.caption}, *text*{.note}, ::: answer */
.content .caption { display: block; text-align: center; font-size: 0.9rem; font-style: normal; color: var(--text-muted); }
/* Figures: an image with a caption (its Markdown title), alone or in a "::: plots" grid. The image is on white
   with a thin border, at most its own size; one that's shown smaller than its file can be clicked to enlarge (site.js) */
.content figure.figure { margin: 1.25rem auto; display: flex; flex-direction: column; align-items: center; }
.content figure.figure img, .content .plots img { display: block; background: #fff; border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 0.4rem; }
.content figure.figure figcaption { margin-top: 0.45rem; font-size: 0.9rem; color: var(--text-muted); text-align: center; line-height: 1.35; max-width: 40rem; }
.content figure.figure figcaption :is(b, strong) { color: var(--text); }
.content .plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1.25rem 1rem; margin: 1.25rem 0 1.75rem; align-items: start; }
.content .plots.pairs { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 30rem) { .content .plots.pairs { grid-template-columns: 1fr; } }
.content .plots figure.figure { margin: 0; }
/* Sizes for a single image: ![...](x.png "Caption"){.small} (otherwise its own size, at most the column's width) */
.content img.small { width: min(100%, 16rem); }
.content img.medium { width: min(100%, 28rem); }
.content img.large { width: min(100%, 44rem); }
/* Click to enlarge */
.content img.zoomable { cursor: zoom-in; transition: border-color 0.15s, box-shadow 0.15s; }
.content img.zoomable:hover { border-color: var(--link); box-shadow: 0 2px 8px rgba(20, 20, 60, 0.12); }
dialog.zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
dialog.zoom::backdrop { background: rgba(10, 10, 30, 0.8); }
dialog.zoom img { display: block; max-width: 96vw; max-height: 86vh; width: auto; height: auto; background: #fff; border-radius: var(--radius-sm); padding: 0.6rem; cursor: zoom-out; }
dialog.zoom p { color: #fff; text-align: center; margin: 0.6rem auto 0; max-width: 50rem; font-size: 0.95rem; }

/* Several images in one paragraph: side by side */
.content .gallery { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1rem; }
.content .gallery img.prism-image { margin: 0; }
.content img.right { float: right; margin: 0.25rem 0 1rem 1rem; }
.content .note { font-style: normal; font-size: 0.9em; }
.content .note, .content .note a { color: var(--text-muted); }
.content .answer { margin: 1rem 0; padding: 0.6rem 1rem; border-left: 3px solid var(--callout-bar); background: var(--callout-bg); }
.content .answer > :first-child { margin-top: 0; }
.content .answer > :last-child { margin-bottom: 0; }
/* <details> in Markdown pages (e.g. the manual's Troubleshooting): a question that opens to show its answer */
.content details { margin: 0.5rem 0; border: 1px solid var(--border); border-radius: 4px; }
.content details > summary { cursor: pointer; padding: 0.5rem 0.75rem; font-weight: 600; list-style: none; position: relative; padding-left: 1.9rem; }
.content details > summary::-webkit-details-marker { display: none; }
.content details > summary::before { content: "▸"; position: absolute; left: 0.75rem; color: var(--text-muted); transition: transform 0.15s; }
.content details[open] > summary::before { transform: rotate(90deg); }
.content details > summary:hover { background: var(--callout-bg); }
.content details[open] > summary { border-bottom: 1px solid var(--border); }
.content details > :not(summary) { margin-left: 0.75rem; margin-right: 0.75rem; }
.content details > :last-child { margin-bottom: 0.75rem; }

.content pre.code-scroll { max-height: 32rem; overflow: auto; }

/* Data tables */
.content table.prism-table { border-collapse: collapse; margin: 1rem auto; max-width: 100%; }
.content table.prism-table td, .content table.prism-table th { border: 1px solid var(--border); padding: 0.25rem 0.6rem; vertical-align: top; }
.content table.prism-table tr.prism-th td, .content table.prism-table tr.prism-th th, .content table.prism-table tr.prism-thl td { background: var(--bg-subtle); font-weight: 700; }
.content table.prism-table tr.prism-th td, .content table.prism-table tr.prism-th th { text-align: center; }
.content table.prism-table td.benchmark-property { min-width: 16rem; }
.content table.prism-table thead th { text-align: center; }
/* Groups of columns (colgroup) and of rows (tbody) */
.content table.prism-table colgroup + colgroup { border-left: 3px solid var(--border); }
.content table.prism-table tbody + tbody { border-top: 3px solid var(--border); }

/* {% task %} icons in practicals sit in a margin, so that all the lines of a task stay aligned */
.content p:has(> img.prism-task:first-child) { position: relative; padding-left: 2.4rem; }
.content img.prism-task { position: absolute; left: 0; top: 0.1rem; height: 28px; width: auto; margin: 0; }

.content iframe { max-width: 100%; height: auto; aspect-ratio: 4 / 3; } /* embedded videos */


/* The manual on one page (src/manual-all.njk) */
.manual-single__version { color: var(--text-muted); font-weight: 400; font-size: 0.7em; }
.manual-single__page, .manual-single__section > :first-child { border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 0.5rem; }
.manual-single [id] { scroll-margin-top: 1rem; }

/* Panels, for any Markdown page (README.md: "Styles for Markdown pages") */

/* ::: banner: white text on the blue gradient, with an optional ::: slideshow floated right */
.banner {
	display: flow-root; margin: 1.2rem 0 1.5rem; padding: 1.5rem 1.8rem; border-radius: var(--radius);
	background: linear-gradient(120deg, var(--prism-dark), var(--prism-light)); color: #fff;
}
.banner > h2 { font-size: 1.2rem; margin: 0 0 1rem; }
.banner p { margin: 0 0 0.7rem; }
.banner > :last-child { margin-bottom: 0; }
.banner a, .banner a:visited { color: #fff; }
/* a list in a banner: outlined labels, with no bullets */
.banner ul { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.banner li { margin: 0; padding: 0.25rem 0.8rem; border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-size: 0.92rem; }
@media (max-width: 47.99rem) {
	.banner { display: flex; flex-direction: column; }
	.banner ul { margin-top: 1.1rem; }
}

/* ::: slideshow: its images one at a time, a new one sliding in every few seconds (site.js) */
.slideshow { position: relative; height: 14rem; margin: 1rem 0; overflow: hidden; border-radius: 8px; background: #fff; }
.banner .slideshow { float: right; width: 40%; margin: 0 0 0 1.5rem; }
.slideshow p { height: 100%; margin: 0; }
.content .slideshow img.prism-image { width: 100%; height: 100%; margin: 0; padding: 6px; border: 0; object-fit: contain; }
.slideshow p:not(:first-child) { display: none; }
/* (site.js adds these: each image waits off to the right, slides in, then slides out to the left) */
.slideshow.is-running p { display: block; position: absolute; inset: 0; transform: translateX(100%); }
.slideshow.is-running p.is-current { transform: none; transition: transform 0.8s ease; }
.slideshow.is-running p.is-leaving { transform: translateX(-100%); transition: transform 0.8s ease; }
@media (max-width: 47.99rem) {
	.banner .slideshow { float: none; order: 1; width: 100%; margin: 0.8rem 0 0; }
}

/* ::: columns: the blocks inside side by side, as many as fit (one on phones) */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.5rem; margin: 1.5rem 0; }

/* ::: box: a white panel with a border and a light shadow */
.box {
	padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius);
	background: var(--bg); box-shadow: var(--box-shadow);
}
.box > h2 { font-size: 1.2rem; margin: 0 0 1rem; }
.box p { margin: 0.3rem 0; }
.box pre { margin: 0; }
.content .box img.prism-image { width: 100%; max-width: 23rem; margin: 0.8rem auto 0; padding: 0; border: 0; background: none; }

/* Cards (partials/cards.njk): a grid of linked panels, each with an optional icon at the top right */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin: 1.5rem 0; padding: 0; list-style: none; }
.card {
	position: relative; display: flex; flex-direction: column; margin: 0; padding: 1rem 1.1rem;
	border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); box-shadow: var(--box-shadow);
	transition: border-color 0.15s, transform 0.15s;
}
.card:hover, .card:focus-within { border-color: var(--prism-light); transform: translateY(-2px); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.card__icon { flex: none; width: 2.75rem; height: 2.75rem; color: var(--card-icon); }
.card__icon svg { width: 100%; height: 100%; display: block; }
.content .card__title { margin: 0.15rem 0 0; font-size: 1.1rem; line-height: 1.3; }
.card__title a { color: var(--text); text-decoration: none; }
/* (the title's link covers the whole card) */
.card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card__title a:focus-visible { outline: none; }
.card:has(.card__title a:focus-visible) { outline: 2px solid var(--link); outline-offset: 2px; }
.card__note { align-self: flex-start; margin: 0 0 0.4rem; padding: 0 0.5rem; border-radius: 999px; background: var(--prism-dark); color: #fff; font-size: 0.75rem; font-weight: 600; }
.card__text { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 0.92rem; }
.card__tags { margin: auto 0 0; }

/* ::: logos: linked logos in a wrapping row, centred on a line, at most 4.5rem high (never enlarged);
   each on a white tile, so logos drawn for a white page also work in dark mode */
.content .logos p { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 1rem 1.5rem; margin: 1.25rem 0; }
.content .logos img {
	display: block; width: auto; height: auto; max-width: 10rem; max-height: 4.5rem; margin: 0;
	padding: 6px; border: 0; border-radius: var(--radius-sm); background: #fff;
}
/* (an icon with its name beside it, as text: one tile, linked) */
.content .logos a:has(> img.icon) {
	display: inline-flex; align-items: center; gap: 0.5rem; padding: 6px 12px 6px 6px; border-radius: var(--radius-sm);
	background: #fff; color: #3c4043; font-size: 1.25rem; font-weight: 500; text-decoration: none;
}
.content .logos img.icon { display: block; width: auto; height: 2.5rem; max-height: none; margin: 0; padding: 0; }

/* ::: questions: each paragraph and the code block after it as one item, with a bar down the side */
.questions > p { margin: 1rem 0 0; padding: 0.4rem 0.7rem 0.3rem 0.9rem; border-left: 3px solid var(--callout-bar); background: var(--callout-bg); }
.questions > pre {
	margin: 0; padding: 0 0.7rem 0.5rem 0.9rem; overflow: visible; white-space: pre-wrap; font-size: 0.85rem;
	border: 0; border-left: 3px solid var(--callout-bar); border-radius: 0; background: var(--callout-bg);
}

/* ::: labels: a list as pale labels in the word cloud's colours, for a plain background */
.labels ul { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0; padding: 0; list-style: none; }
.labels li { margin: 0; padding: 0.25rem 0.8rem; border: 1.5px solid #272582; border-radius: 999px; background: #e0e0f5; color: #1c1b5e; font-size: 0.92rem; }
.labels li:nth-child(5n+2) { border-color: #1f7a8c; background: #d9f0f4; }
.labels li:nth-child(5n+3) { border-color: #8a3fa8; background: #f3e4f9; }
.labels li:nth-child(5n+4) { border-color: #3f6fd1; background: #dfe9fb; }
.labels li:nth-child(5n) { border-color: #6260c1; background: #ecebfb; }

/* {.wordmark}: text in the blue gradient of the site title, as in **PRISM**{.wordmark} */
.wordmark { background: var(--wordmark); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (forced-colors: active) {
	.wordmark { background: none; color: CanvasText; }
}

/* Home page (src/index.md): news in the side panel; all the main text one size, and all the headings another */
.page--home .content { max-width: none; font-size: 1rem; }
.page--home .content h2 { font-size: 1.2rem; margin: 0 0 1rem; }
.page--home .content pre, .page--home .content code { font-size: 0.85rem; }
.page--home .content hr { margin: 2rem 0 1rem; }
/* The current release, as a tinted strip: on the home page with links to download it, the manual and the tutorial;
   on the download pages with a link to what's new */
.release-strip {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.25rem;
	margin: 1rem 0 1.5rem; padding: 0.7rem 1rem;
	background: var(--accent-bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.release-strip p { margin: 0; }
.release-strip strong { font-size: 1.05rem; }
.release-strip span { font-size: 0.85rem; color: var(--text-muted); }

/* Download pages (partials/download-list.njk): a box of rows, one per operating system (the visitor's tinted), and one for the source code */
.downloads { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.downloads__row { display: flex; align-items: center; gap: 0.5rem 1rem; padding: 0.65rem 1rem; border-top: 1px solid var(--border); }
.downloads__row:first-child { border-top: 0; }
.downloads__os { flex: 0 0 8rem; font-weight: 700; }
.downloads__files { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.downloads__file {
	display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.9rem; line-height: 1.2;
	border: 1.5px solid var(--link); border-radius: var(--radius-sm); background: var(--bg);
	color: var(--link); font-weight: 600; text-decoration: none;
}
.downloads__file:hover { background: var(--accent-bg); }
.downloads__file small { font-weight: 400; font-size: 0.8rem; color: var(--text-muted); }
.downloads__row.is-yours { background: var(--accent-bg); }
.downloads__row.is-yours .downloads__os::after { content: "your system"; display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
@media (max-width: 30rem) {
	.downloads__row { flex-direction: column; align-items: flex-start; }
	.downloads__os { flex-basis: auto; }
}
.release-strip__links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.release-strip__links a {
	display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 1.1rem; line-height: 1.2;
	border: 1.5px solid var(--link); border-radius: var(--radius-sm); background: var(--bg);
	color: var(--link); font-weight: 600; text-decoration: none;
}
.release-strip__links a:hover { background: var(--accent-bg); }
.release-strip__links .release-strip__download { background: var(--prism-dark); border-color: var(--prism-dark); color: #fff; }
.release-strip__links .release-strip__download:hover { background: var(--prism-light); border-color: var(--prism-light); }
@media (max-width: 30rem) {
	.release-strip__links { width: 100%; gap: 0.5rem; }
	.release-strip__links a { flex: 1; justify-content: center; padding: 0.5rem 0.4rem; }
}
.page--home .bib-entry { font-size: 1rem; }
.page--home .visually-hidden + p { margin: 0 0 0.6rem; }
.local-nav__details:has(> .news-panel) { padding: 0; }
.news-panel p { margin: 0; padding: 0.6rem 0.9rem; }
.local-nav .news-panel a, .local-nav .news-panel a:hover { display: inline; padding: 0; color: var(--link); text-decoration: underline; background: none; }
@media (min-width: 60rem) {
	.page--home > .local-nav { position: static; max-height: none; }
	/* The tops of the first line's letters line up with the top of the news panel */
	.page--home .content { padding-top: calc(1.44rem + 0.7 * var(--h1-size) - 0.4rem); }
}

/* End-of-proof mark (in place of the old qed.gif) */
.qed { float: right; margin-left: 1em; color: var(--text-muted); }
