/* The flagship page. Its frame follows the active style (STY-60): the script sets the site
   tokens on <body> from the style's own tokens, so header, rail and footer read as one piece
   with the report. Opaque surfaces, three radii, 150 to 200 ms transitions on `out` only. */

body[data-richview-page="showcase"] {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 400 0.95rem / 1.5 var(--font-ui);
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
/* The label is the hidden name's containing block, so the name scrolls with the rail and is clipped
   by it. Left to the page, it sat where the rail's overflow put it, past a phone's right edge, and
   made the whole document that much wider. */
.style-more {
	position: relative;
}
.style-rail {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem 1rem;
	padding: 0.6rem var(--gutter);
	border-bottom: 1px solid var(--rule);
	background: var(--paper);
}
.style-rail .themes__group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem;
	padding: 0.25rem;
	border: 1px solid var(--rule);
	border-radius: var(--r-pill);
}
.style-rail .themes__group button {
	font: 600 0.9rem / 1 var(--font-ui);
	color: var(--ink);
	background: none;
	border: 0;
	border-radius: var(--r-pill);
	padding: 0.5rem 0.95rem;
	cursor: pointer;
	transition: background 150ms cubic-bezier(0.33, 1, 0.68, 1), color 150ms cubic-bezier(0.33, 1, 0.68, 1);
}
.style-rail .themes__group button:hover {
	background: color-mix(in oklch, var(--ink) 8%, transparent);
}
.style-rail .themes__group button[aria-checked="true"] {
	background: var(--ink);
	color: var(--paper);
}
.style-rail .themes__group button[aria-checked="true"]::after {
	content: " ✓";
}
.style-more select,
.pane-label select,
#compare-toggle {
	font: 600 0.85rem / 1 var(--font-ui);
	color: var(--soft);
	background: var(--paper);
	border: 1px solid var(--rule);
	border-radius: var(--r-pill);
	padding: 0.55rem 0.85rem;
	cursor: pointer;
}
#compare-toggle[aria-pressed="true"] {
	color: var(--paper);
	background: var(--ink);
	border-color: var(--ink);
}
/* One line at the top (Daniel, 16 Nov): on a wide window the rail sits in the header's row, after
   the wordmark, so the report starts right under it. The header is the build's and the rail is
   this page's, so the rail is lifted into the row above and sticks there with it; the wordmark is
   Geist 600 on every page (STY-03), which fixes where the rail starts. A narrower window keeps
   the rail as its own row, on one line that scrolls sideways instead of wrapping. */
body[data-richview-page="showcase"] {
	--rail-h: 3.25rem;
}
.style-rail {
	flex-wrap: nowrap;
	box-sizing: border-box;
	height: var(--rail-h);
	padding-block: 0;
	overflow-x: auto;
	scrollbar-width: none;
}
.style-rail::-webkit-scrollbar {
	display: none;
}
.style-rail > *,
.style-rail .themes__group button {
	flex: none;
	white-space: nowrap;
}
.style-rail .themes__group {
	flex-wrap: nowrap;
}
@media (min-width: 1280px) {
	body[data-richview-page="showcase"] {
		--rail-h: 0rem;
	}
	.style-rail {
		position: sticky;
		top: 0;
		z-index: 11;
		width: fit-content;
		height: var(--nav-h);
		margin: calc(-1 * var(--nav-h)) 0 0 calc(var(--gutter) + 9rem);
		padding: 0;
		border-bottom: 0;
		background: none;
		overflow: visible;
	}
	.style-rail .themes__group button {
		font-size: 0.85rem;
		padding: 0.45rem 0.8rem;
	}
}
/* The report takes the rest of the window: the note on the fixed evidence follows it, one scroll
   further, so only the report's own progress line is at the bottom of the screen. */
#showcase-panes {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	height: calc(100svh - var(--nav-h) - var(--rail-h));
	min-height: 30rem;
}
#showcase-panes[data-compare="true"] {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.report-pane {
	display: grid;
	grid-template-rows: minmax(0, 1fr);
	min-width: 0;
	min-height: 0;
}
/* `display: grid` above would otherwise show the closed comparison pane and halve the report's height. */
.report-pane[hidden] {
	display: none;
}
#compare-pane {
	border-left: 1px solid var(--rule);
}
.pane-label {
	display: none;
	align-items: center;
	gap: 0.6rem;
	padding: 0.4rem var(--gutter);
	color: var(--soft);
	font-size: 0.85rem;
	border-bottom: 1px solid var(--rule);
}
[data-compare="true"] .report-pane {
	grid-template-rows: 3rem minmax(0, 1fr);
}
[data-compare="true"] .pane-label {
	display: flex;
	min-height: 3rem;
	box-sizing: border-box;
}
.frame-host {
	position: relative;
	min-height: 0;
	min-width: 0;
	background: var(--paper);
}
.frame-host iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: var(--paper);
	transition: opacity 200ms cubic-bezier(0.33, 1, 0.68, 1);
}
.frame-host iframe[data-entering] {
	opacity: 0;
}
.flag-foot {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.2rem;
	padding: 0.7rem var(--gutter);
	border-top: 1px solid var(--rule);
	font-size: 0.82rem;
	color: var(--soft);
	background: var(--paper);
}
.flag-foot a {
	color: inherit;
}
.flag-foot code {
	font-family: var(--font-mono);
}
.citation-card {
	position: fixed;
	z-index: 30;
	width: 340px;
	padding: 0.8rem 1rem;
	background: var(--panel);
	color: var(--ink);
	border: 1px solid var(--rule);
	border-radius: var(--r-panel);
	box-shadow: var(--shadow-float);
	font-size: 0.85rem;
	line-height: 1.45;
}
.citation-card p {
	margin: 0 0 0.4rem;
}
.citation-card blockquote {
	margin: 0.4rem 0;
	padding-left: 0.8rem;
	color: var(--soft);
}
.citation-kind {
	font: 600 0.72rem / 1 var(--font-mono);
	color: var(--soft);
}
.citation-title {
	font-weight: 600;
}
@media (max-width: 899px) {
	#showcase-panes[data-compare="true"] {
		grid-template-columns: minmax(0, 1fr);
		grid-auto-rows: 80svh;
		height: auto;
	}
	#compare-pane {
		border-left: 0;
		border-top: 1px solid var(--rule);
	}
}
/* A phone (Daniel, 17 Nov): one line at the top, then the report, and nothing under it. The row of
   style names becomes one menu in the header's own row, which lays it out between the mark and the
   links; the build puts it there, so the line is the same with and without the script. The mark
   stands alone where the wordmark would crowd the menu. Two reports side by side need the room, so
   no comparison opens. The report takes the rest of the screen and the page itself does not scroll:
   a page that scrolled under the report's own scrolling left the note and the footer standing over
   the report's last lines once they were reached. The source and its ledger stay linked from the
   gallery's Reports page, the footer's links from the home page the mark opens. */
.nav__style {
	display: none;
}
@media (max-width: 640px) {
	body[data-richview-page="showcase"] {
		--rail-h: 0rem;
	}
	.style-rail,
	.flag-foot,
	body[data-richview-page="showcase"] .foot,
	#compare-pane {
		display: none;
	}
	.nav__style {
		/* The hidden name's containing block, as for the rail's menu above. */
		position: relative;
		display: block;
		flex: 1 1 auto;
		min-width: 4.5rem;
		max-width: 9rem;
	}
	/* 16 px keeps a phone from zooming the page when the menu opens. The arrow is drawn, so the
	   menu is as wide as its row allows and a long name ends in an ellipsis. The pill is 44 px tall,
	   a finger's target, and fits the 56 px header. */
	.nav__style select {
		-webkit-appearance: none;
		appearance: none;
		box-sizing: border-box;
		width: 100%;
		min-height: 2.75rem;
		padding: 0 1.9rem 0 0.8rem;
		font: 600 1rem / 1.2 var(--font-ui);
		color: var(--ink);
		text-overflow: ellipsis;
		border: 1px solid var(--rule);
		border-radius: var(--r-pill);
		background:
			linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 1.05rem) 50% / 0.3rem 0.3rem no-repeat,
			linear-gradient(135deg, currentColor 50%, transparent 50%) calc(100% - 0.75rem) 50% / 0.3rem 0.3rem no-repeat,
			var(--paper);
		cursor: pointer;
	}
	.nav__style select:focus-visible {
		outline: 2px solid var(--blue);
		outline-offset: 2px;
	}
	/* The open list (Chart design, 17 Nov): each style in its own face, the current one marked with a
	   check and not by colour alone. A browser that draws a customizable select draws the list in the
	   page, as an opaque panel with a hairline and 12 px corners and no shadow (STY-48 keeps soft
	   shadows to the site's sheets and citation cards; STY-66); any other keeps its native list,
	   which marks the current item itself. */
	@supports (appearance: base-select) {
		.nav__style select,
		.nav__style select::picker(select) {
			appearance: base-select;
		}
		/* The drawn pill lays its text out itself: centre it on the arrow. */
		.nav__style select {
			display: flex;
			align-items: center;
		}
		.nav__style select::picker-icon {
			display: none;
		}
		.nav__style select::picker(select) {
			margin-top: 0.25rem;
			padding: 0.25rem;
			border: 1px solid var(--rule);
			border-radius: var(--r-panel);
			background: var(--paper);
			color: var(--ink);
		}
		.nav__style optgroup {
			font: 600 0.72rem / 1 var(--font-mono);
			color: var(--soft);
		}
		.nav__style optgroup::part(label),
		.nav__style legend {
			padding: 0.6rem 0.75rem 0.3rem;
		}
		.nav__style option {
			min-height: 2.75rem;
			padding: 0 0.75rem;
			font: 600 1rem / 1.2 var(--font-ui);
			color: var(--ink);
			border-radius: var(--r-small);
		}
		.nav__style option:hover,
		.nav__style option:focus-visible {
			background: color-mix(in oklch, var(--ink) 8%, transparent);
		}
		.nav__style option::checkmark {
			order: 1;
			margin-left: auto;
			content: "✓";
		}
		/* Each builtin's name in its own display face and case, as on the row it replaces (STY-08). */
		.nav__style option[value="sleek"],
		.nav__style option[value="air"] {
			font-family: "Space Grotesk", var(--font-ui);
			font-weight: 600;
		}
		.nav__style option[value="scientific"] {
			font-family: "RichView Serif", Georgia, serif;
			font-weight: 400;
		}
		.nav__style option[value="brutalist"] {
			font-family: "Big Shoulders", "Arial Narrow", sans-serif;
			font-weight: 800;
			text-transform: uppercase;
			letter-spacing: 0.04em;
		}
		.nav__style option[value="hand-drawn"] {
			font-family: "Patrick Hand", var(--font-ui);
			font-weight: 400;
		}
	}
	#showcase-panes,
	#showcase-panes[data-compare="true"] {
		grid-template-columns: minmax(0, 1fr);
		grid-auto-rows: auto;
		height: calc(100dvh - var(--nav-h));
		min-height: 0;
	}
	[data-compare="true"] .report-pane {
		grid-template-rows: minmax(0, 1fr);
	}
	[data-compare="true"] .pane-label {
		display: none;
	}
}
@media (max-width: 480px) {
	body[data-richview-page="showcase"] .nav__brand {
		font-size: 0;
	}
}
@media (max-width: 360px) {
	body[data-richview-page="showcase"] .nav__links a.nav__github {
		display: none;
	}
}
@media (prefers-reduced-motion: reduce) {
	.frame-host iframe,
	.style-rail .themes__group button {
		transition: none;
	}
}
