/* riffpress.com, as DESIGN.md and docs/brand-brief.md have it: paper, the ink wordmark on it,
   and night where the player is. EB Garamond sets the titles and Schibsted Grotesk the rest.
   Every value is tokens.css's; this file only says where each goes. A night band turns the
   words light, the button paper with night on it, and the ring ember, by setting the same
   names again. Everything sits on one 12-column grid.

   The pages share five parts: the bar; a promise (the one loud line and its line); the product,
   real Riff screens standing on the seam where the paper becomes night; then the home page's
   doors and proof, or an audience page's facts and its one action; and the footer. */
:root {
	--bg: var(--white);
	--fg: var(--ink);
	--fg-2: var(--ink-2);
	--line: var(--rule);
	--focus: var(--ember-deep);
	--action: var(--primary);
	--action-hover: var(--primary-hover);
	--on-action: var(--on-primary);
	--select: var(--wash);
	--on-select: var(--ink);
	--section: clamp(var(--space-7), 10vw, var(--space-8));
	--seam: var(--space-8);
}

.product,
footer {
	--bg: var(--black);
	--fg: var(--on-black);
	--fg-2: var(--on-black-2);
	--line: var(--black-line);
	--focus: var(--ember);
	--action: var(--primary-on-black);
	--action-hover: var(--primary-on-black-hover);
	--on-action: var(--on-primary-on-black);
	--select: var(--ember);
	--on-select: var(--black);
}

/* hidden stays hidden, though links set their own display: the signed-in swap depends on it */
[hidden] {
	display: none !important;
}

* {
	box-sizing: border-box;
}

html {
	font-family: var(--sans);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scrollbar-color: var(--rule) var(--white);
	accent-color: var(--ember-deep);
}

body {
	margin: 0;
	background: var(--white);
	color: var(--ink);
	font-size: var(--text-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	overflow-x: clip;
}

/* the page fills the window, so a short one, as the 404 is, still ends on the footer */
body {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
}

main {
	flex: 1;
}

/* the browser's own surfaces, in the palette */
::selection {
	background: var(--select);
	color: var(--on-select);
}

img {
	max-width: 100%;
}

a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: var(--hairline);
	text-underline-offset: 0.25em;
}

a:hover {
	text-decoration-thickness: 2px;
}

p {
	margin: 0;
	text-wrap: pretty;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.wrap {
	position: relative;
	z-index: 1;
	max-width: var(--page-max);
	margin: 0 auto;
	padding-inline: var(--page-edge);
}

/* the grid, for a band whose parts sit side by side */
.grid {
	display: grid;
	grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
	column-gap: var(--grid-gap);
}

.skip {
	position: absolute;
	left: var(--space-2);
	top: calc(var(--space-9) * -1);
	z-index: 20;
	padding: var(--space-1-5) var(--space-2);
	border-radius: var(--radius-control);
	background: var(--ink);
	color: var(--white);
	font-weight: 600;
	text-decoration: none;
}

.skip:focus {
	top: var(--space-1-5);
}

/* type: titles in Garamond, set close; everything else in the grotesk */
h1,
h2 {
	margin: 0;
	color: var(--fg);
	font-family: var(--serif);
	font-weight: 400;
	text-wrap: balance;
}

h1 {
	font-size: var(--text-display);
	line-height: 0.95;
	letter-spacing: -0.03em;
}

.lede {
	max-width: var(--measure);
	color: var(--fg);
	font-size: var(--text-lead);
	line-height: 1.4;
}

section {
	position: relative;
	background: var(--bg);
	color: var(--fg);
}

/* the bar: the ink wordmark, the three audiences' pages, and the one way in for someone with a
   Riff. The page you're on is underlined. */
.bar {
	position: relative;
	z-index: 10;
}

.bar .wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	min-height: var(--bar-height);
}

.mark {
	display: inline-flex;
	flex: none;
	border-radius: var(--radius-control);
}

.mark img {
	display: block;
	width: auto;
	height: var(--wordmark-height);
}

.bar nav {
	display: flex;
	gap: var(--space-4);
}

/* each a 44px target */
.bar nav a {
	padding: var(--space-1-5) 0;
	font-size: var(--text-small);
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	text-decoration: none;
}

.bar nav a:hover,
.bar nav a[aria-current="page"] {
	text-decoration: underline;
}

/* Open my Riff, with the member's own picture (js/me.js): their Gravatar, or their initial in
   a quiet circle, as Riff's own bar has it. The circle is there from the first paint, at the
   picture's size, so nothing moves when it arrives, and the link stays a 44px target. */
.bar nav a.me {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	padding-block: 8px;
}

.me-face {
	display: grid;
	flex: none;
	place-items: center;
	width: 28px;
	height: 28px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--select);
	color: var(--fg);
	font-size: 0.8125rem;
	line-height: 1;
}

.me-face img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* the strings, where neck.js draws them */
.neck-live {
	display: block;
	overflow: visible;
	touch-action: none;
	cursor: pointer;
}

.neck-live svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.neck-chord {
	order: 1;
	flex: none;
	min-width: 2.5em;
	color: var(--ink-2);
	font: 600 var(--text-label)/1 var(--sans);
	font-variant-numeric: var(--numerals);
	pointer-events: none;
}

.neck-mute {
	order: 1;
	flex: none;
	width: var(--space-3);
	height: var(--space-3);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ink-2);
	font: var(--text-label)/1 var(--sans);
	cursor: pointer;
}

.neck-mute[aria-pressed="true"] {
	opacity: 0.45;
}

/* the one button, in the band's colours */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--control-height);
	padding: 0 var(--control-pad);
	border-radius: var(--radius-control);
	background: var(--action);
	color: var(--on-action);
	font-size: var(--text-body);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--t) var(--ease-out);
}

.btn:hover {
	background: var(--action-hover);
}

/* the promise: the page's one loud line, and the line that says it plainly */
.promise {
	row-gap: var(--space-3);
	padding-block: var(--space-7) var(--space-6);
}

.promise h1 {
	grid-column: 1 / 11;
}

.promise .lede {
	grid-column: 1 / 7;
}

/* the hero's action sits close under the lede; the facts lists below need the taller margin */
.promise .act {
	margin-top: var(--space-1);
}

/* the product: real screens on the seam where the paper becomes night. The wide screen is raised
   on the page, and the phone, over its corner, is the layer above it. */
.product {
	padding-bottom: var(--space-7);
	background: linear-gradient(var(--white) var(--seam), var(--black) var(--seam));
}

.stack {
	position: relative;
	margin: 0;
	padding-bottom: var(--space-6);
}

.stack img {
	display: block;
	width: 100%;
	height: auto;
	background: var(--black-3);
	outline: var(--hairline) solid var(--edge-light);
	outline-offset: calc(var(--hairline) * -1);
}

.stack-wide img {
	width: calc(100% / 12 * 11);
	border-radius: var(--radius-frame);
	box-shadow: var(--elevation-raised);
}

/* a wide screen whose lower part is empty is cut to its top, where the content is */
.stack-crop img {
	aspect-ratio: 16 / 8;
	object-fit: cover;
	object-position: top;
}

.stack-phone img {
	position: absolute;
	right: 0;
	bottom: 0;
	width: calc(100% / 12 * 2.5);
	border-radius: calc(var(--radius-frame) * 2);
	box-shadow: var(--elevation-overlay);
}

.stack figcaption {
	display: flex;
	align-items: center;
	gap: var(--space-1);
	margin-top: var(--space-2);
	color: var(--fg-2);
	font-size: var(--text-label);
}

.stack figcaption i {
	color: var(--fg);
	font-style: normal;
	font-weight: 500;
}

/* what is playing: ember, the one place it shows on a page */
.playing {
	flex: none;
	fill: var(--ember);
}

/* home: the three doors, a typographic list on the grid, each line a link the whole row wide */
.doors {
	padding-block: var(--section) var(--space-6);
}

.doors ul {
	margin: 0;
	padding: 0;
	border-bottom: var(--hairline) solid var(--line);
	list-style: none;
}

.doors a {
	display: grid;
	grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
	column-gap: var(--grid-gap);
	align-items: baseline;
	padding-block: var(--space-4);
	border-top: var(--hairline) solid var(--line);
	text-decoration: none;
}

.door-line {
	grid-column: 1 / 9;
	font: 400 var(--text-heading)/1 var(--serif);
	letter-spacing: -0.02em;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.12em;
	transition: text-decoration-color var(--t) var(--ease-out);
}

.doors a:hover .door-line,
.doors a:focus-visible .door-line {
	text-decoration-color: currentcolor;
}

.door-gloss {
	grid-column: 9 / -1;
	color: var(--fg-2);
	font-size: var(--text-small);
	text-align: left;
}

.proof {
	padding-block: 0 var(--space-8);
}

.proof p {
	grid-column: 1 / 8;
	color: var(--fg-2);
}

/* an audience page: three facts, plain sentences on hairlines, then the one action */
.facts {
	padding-block: var(--section) var(--space-8);
}

.facts ul {
	grid-column: 1 / 9;
	margin: 0;
	padding: 0;
	border-bottom: var(--hairline) solid var(--line);
	list-style: none;
}

.facts li {
	padding-block: var(--space-3);
	border-top: var(--hairline) solid var(--line);
	font-size: var(--text-lead);
	line-height: 1.4;
	text-wrap: pretty;
}

.act {
	grid-column: 1 / 9;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-4);
	margin-top: var(--space-5);
}

.act a:not(.btn) {
	padding-block: var(--space-1-5);
	font-weight: 600;
}

.fine {
	color: var(--fg-2);
	font-size: var(--text-small);
}

/* the footer: the white wordmark, and the links someone needs to trust it */
footer {
	padding-block: var(--space-5);
	background: var(--bg);
	color: var(--fg-2);
	font-size: var(--text-small);
}

footer .wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-4);
}

footer img {
	display: block;
	width: auto;
	height: var(--space-3);
}

footer nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--space-3);
}

footer nav a {
	padding-block: var(--space-1-5);
	color: var(--fg);
	text-decoration: none;
}

footer nav a:hover {
	text-decoration: underline;
}

/* a page to read, as /principles is: one column at a reading measure, its title the page's one
   loud line, and each part a Garamond heading with more room above it than below */
.read {
	padding-block: var(--space-7) var(--space-8);
}

/* on the page's own left edge, as every other page's words are, at a reading measure */
.read > * {
	max-width: var(--measure-read);
}

.read h1 {
	margin-bottom: var(--space-5);
}

.read h2 {
	margin: var(--space-6) 0 var(--space-2);
	font-size: var(--text-title);
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.read p {
	font-size: var(--text-body);
	line-height: 1.7;
}

.read h1 + p {
	font-size: var(--text-lead);
	line-height: 1.45;
}

/* the 404: the promise, and one way back */

.lost .act {
	grid-column: 1 / -1;
	margin-top: var(--space-3);
}

/* what is the page's chrome cannot be selected, so a strum across the strings picks up words
   and not the bar, the buttons or the pictures */
.bar,
.btn,
.neck-live,
.neck-mute,
.neck-chord,
.stack {
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* a phone: one column in reading order, the phone still over the wide screen's corner */
@media (max-width: 760px) {

	:root {
		--seam: var(--space-7);
	}

	.bar nav {
		gap: var(--space-2);
	}

	/* Open my Riff is the member's picture alone, as the music apps have it, so the bar fits a
	   phone; its words stay its name for a screen reader. */
	.bar nav a.me {
		padding-inline: var(--space-1);
	}

	.me-name {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.promise {
		padding-block: var(--space-5);
	}

	.product {
		padding-bottom: var(--space-5);
	}

	.promise h1,
	.promise .lede,
	.proof p,
	.facts ul,
	.act {
		grid-column: 1 / -1;
	}

	.stack-wide img {
		width: 100%;
		border-radius: var(--radius-card);
	}

	.stack-phone img {
		right: calc(var(--page-edge) * -0.5);
		width: 34%;
		border-radius: var(--radius-frame);
	}

	.stack figcaption {
		max-width: 60%;
	}

	.doors a {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--space-1);
		padding-block: var(--space-3);
	}

	.door-line,
	.door-gloss {
		grid-column: 1;
		text-align: left;
	}

	.door-line {
		font-size: var(--text-title);
	}

	.facts {
		padding-block: var(--space-6) var(--space-7);
	}

	/* the footer's links in four even columns, so none is left alone on a line */
	footer nav {
		display: grid;
		grid-template-columns: repeat(4, auto);
		justify-content: space-between;
		width: 100%;
	}
}

/* motion, once a page: the phone settles onto the wide screen as the pair comes into view, from
   where it already is. Nothing else moves on its own. */
@media (prefers-reduced-motion: no-preference) {

	html {
		scroll-behavior: smooth;
	}

	@supports (animation-timeline: view()) {

		.stack-phone img {
			animation: settle linear both;
			animation-timeline: view();
			animation-range: entry 20% cover 45%;
		}

		@keyframes settle {

			from {
				translate: 0 var(--space-4);
			}
		}
	}
}

/* The legal pages' unfinished parts, marked until the owner fills them in. */
.read mark.placeholder {
	background: none;
	color: var(--ember-deep);
	box-shadow: inset 0 -1px var(--ember-deep);
}

/* while the network takes no new Riffs (js/sign-ups.js): a short line beside the button, where Make my Riff was */
.act .paused {
	color: var(--fg-2);
}

.act .paused a {
	color: var(--fg);
}
