/* Pose website. CUBE CSS: tokens, then composition, utilities, blocks, exceptions.
   The palette follows the icon: a slate-blue figure on a cool grey tile. */

/* Tokens */
:root {
	color-scheme: light dark;
	--bg: #f6f7fa;
	--well: #eceff5;
	--ink: #1a2133;
	--mute: #5b647a;
	--line: #d6dbe6;
	--accent: #3f4c6e;
	--accent-2: #5c6d94;
	--on-accent: #ffffff;
	--code-bg: #1a2133;
	--code-ink: #e6eaf3;
	--code-keyword: #d3b8ff;
	--code-string: #f2c58c;
	--code-number: #93d8c9;
	--code-comment: #8b95ad;
	--shadow: rgb(26 33 51 / 0.16);

	--font: system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-mono: ui-monospace, "SF Mono", Menlo, monospace;
	--space-s: 0.75rem;
	--space-m: 1.5rem;
	--space-l: clamp(2rem, 5vw, 3rem);
	--space-xl: clamp(4rem, 10vw, 6rem);
	--measure: 38rem;
	--radius: 14px;
	/* The "Our Mac apps" strip (/shared/apps.css) lines up with .wrapper. */
	--apps-width: min(100% - 2 * var(--space-m), 64rem);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #10131b;
		--well: #181d29;
		--ink: #eef1f7;
		--mute: #98a1b5;
		--line: #2a3142;
		--accent: #aab8dc;
		--accent-2: #8d9cc4;
		--on-accent: #10131b;
		--code-bg: #0b0e15;
		--shadow: rgb(0 0 0 / 0.45);
	}
}

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 1.0625rem/1.55 var(--font);
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: inherit;
}

h1,
h2,
h3 {
	line-height: 1.1;
	letter-spacing: -0.02em;
	margin: 0;
}

h1 {
	font-size: clamp(2.5rem, 7vw, 4.25rem);
	font-weight: 800;
	letter-spacing: -0.04em;
}

/* On a small phone the heading wraps better on its own. */
@media (max-width: 30rem) {
	h1 br {
		display: none;
	}
}

h2 {
	font-size: clamp(1.6rem, 3.5vw, 2.2rem);
	font-weight: 750;
}

h3 {
	font-size: 1.1rem;
}

code,
kbd {
	font-family: var(--font-mono);
	font-size: 0.92em;
}

kbd {
	padding: 0.05em 0.4em;
	border: 1px solid var(--line);
	border-radius: 5px;
	background: var(--bg);
}

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

/* Composition */
.wrapper {
	width: min(100% - 2 * var(--space-m), 64rem);
	margin-inline: auto;
}

.flow > * + * {
	margin-block-start: var(--flow-space, 1em);
}

.cluster {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--gap, var(--space-s));
}

/* Text and picture side by side, stacking when narrow. */
.split {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
	gap: var(--space-l);
	align-items: center;
}

.section {
	padding-block: var(--space-xl) 0;
}

/* Utilities */
.measure {
	max-width: var(--measure);
}

.mute {
	color: var(--mute);
}

.small {
	font-size: 0.875rem;
}

.lead {
	font-size: clamp(1.15rem, 2.2vw, 1.35rem);
}

/* Blocks */
.site-header {
	justify-content: space-between;
	padding-block: var(--space-m);
	font-weight: 700;
}

.brand {
	--gap: 0.6rem;
	text-decoration: none;
	font-size: 1.1rem;
}

.button {
	display: inline-block;
	padding: 0.75rem 1.4rem;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: var(--on-accent);
	font-weight: 700;
	text-decoration: none;
}

.button:active {
	transform: translateY(1px);
}

.button[data-variant="quiet"] {
	background: transparent;
	color: var(--ink);
	box-shadow: inset 0 0 0 2px var(--line);
}

.hero {
	padding-block: var(--space-l) 0;
}

.shot {
	margin: 0;
}

.flow > .shot {
	margin-block-start: var(--space-l);
}

/* Window captures keep their transparent rounded corners, so the shadow follows them. */
.shot img {
	width: 100%;
	filter: drop-shadow(0 0.6rem 1.5rem var(--shadow));
}

.shot figcaption {
	margin-block-start: 0.6rem;
	color: var(--mute);
	font-size: 0.875rem;
}

.pose-file {
	margin: 0;
	padding: var(--space-m);
	border-radius: var(--radius);
	background: var(--code-bg);
	color: var(--code-ink);
	font: 0.9rem/1.6 var(--font-mono);
	overflow-x: auto;
}

/* Coloured as Pose's own Source view colours a pose file. */
.pose-file .kw {
	color: var(--code-keyword);
}

.pose-file .str {
	color: var(--code-string);
}

.pose-file .num {
	color: var(--code-number);
}

.pose-file .comment {
	color: var(--code-comment);
}

.features {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: var(--space-m) var(--space-l);
	padding: 0;
	list-style: none;
}

.features h3 {
	margin-block-end: 0.3rem;
}

.features p {
	margin: 0;
	color: var(--mute);
}

/* Where the pictures end up: a card per use. */
.uses {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
	gap: var(--space-s);
	padding: 0;
	list-style: none;
}

.uses li {
	padding: var(--space-m);
	border-radius: var(--radius);
	background: var(--well);
}

.uses h3 {
	margin-block-end: 0.3rem;
}

.uses p {
	margin: 0;
	color: var(--mute);
}

/* Every instruction: action, syntax and example in a row; stacked on a phone. */
var {
	color: var(--accent);
	font-style: italic;
}

.syntax {
	margin-block-start: var(--space-l);
}

.more {
	color: var(--accent);
	font-weight: 650;
	text-decoration: none;
}

.more::after {
	content: " →";
}

.more:hover {
	text-decoration: underline;
}

/* Dialogs: every instruction, and the supply chain text. */
.modal {
	width: min(100% - 2 * var(--space-s), 64rem);
	max-width: none;
	max-height: min(100% - 2 * var(--space-s), 56rem);
	padding: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--ink);
	box-shadow: 0 1.5rem 4rem var(--shadow);
	overscroll-behavior: contain;
}

.modal::backdrop {
	background: rgb(16 19 27 / 0.5);
	backdrop-filter: blur(4px);
}

.modal[open] {
	animation: modal-in 180ms ease-out;
}

@keyframes modal-in {
	from {
		opacity: 0;
		transform: translateY(0.75rem) scale(0.98);
	}
}

@media (prefers-reduced-motion: reduce) {
	.modal[open] {
		animation: none;
	}
}

body:has(.modal[open]) {
	overflow: hidden;
}

.modal__head {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	padding: var(--space-s) var(--space-s) var(--space-s) var(--space-m);
	border-block-end: 1px solid var(--line);
	background: var(--bg);
}

.modal__head form {
	margin: 0;
}

.modal[data-size="narrow"] {
	width: min(100% - 2 * var(--space-s), 42rem);
}

/* A dialog without a heading bar keeps its close button in the corner as it scrolls. */
.modal__close {
	position: sticky;
	top: 0;
	float: right;
	padding: var(--space-s);
}

.modal__close form {
	margin: 0;
}

.modal__body > :first-child {
	margin-block-start: 0;
}

.modal__body > :last-child {
	margin-block-end: 0;
}

.close {
	display: grid;
	place-content: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 999px;
	background: var(--well);
	color: var(--ink);
	cursor: pointer;
}

.modal__body {
	padding: var(--space-m) var(--space-m) var(--space-l);
}

.modal__body > p:first-child {
	margin: 0;
}

.syntax h3 {
	font-size: 1.3rem;
}

.syntax p {
	margin: 0;
}

.syntax table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.syntax thead th:first-child {
	width: 34%;
}

.syntax thead th:nth-child(2) {
	width: 36%;
}

/* The markers between choices, quieter than the words to type. */
.syntax .op {
	color: var(--mute);
}

.syntax thead th {
	padding: 0 var(--space-s) 0.5rem 0;
	border-block-end: 2px solid var(--line);
	color: var(--mute);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-align: start;
	text-transform: uppercase;
}

.syntax tbody th,
.syntax td {
	padding: 0.85rem var(--space-s) 0.85rem 0;
	border-block-end: 1px solid var(--line);
	text-align: start;
	vertical-align: top;
}

.syntax tbody th {
	font-weight: 650;
}

.syntax tbody th span {
	display: block;
	margin-block-start: 0.2rem;
	color: var(--mute);
	font-size: 0.875rem;
	font-weight: 400;
}

.syntax td code {
	font-size: 0.85rem;
	overflow-wrap: anywhere;
}

.syntax td:last-child code {
	display: inline-block;
	padding: 0.15em 0.5em;
	border-radius: 6px;
	background: var(--well);
}

@media (max-width: 44rem) {
	.syntax thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.syntax tr {
		display: grid;
		gap: 0.4rem;
		padding-block: 0.9rem;
		border-block-end: 1px solid var(--line);
	}

	.syntax tbody th,
	.syntax td {
		padding: 0;
		border: 0;
	}

	.syntax td::before {
		content: attr(data-label);
		display: block;
		color: var(--mute);
		font-size: 0.75rem;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}
}

.price {
	padding: var(--space-l) var(--space-m);
	border-radius: var(--radius);
	background: var(--well);
	text-align: center;
}

.price .cluster {
	justify-content: center;
}

.price a:not(.button) {
	color: var(--accent);
}

.supply h2 {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

.supply-icon {
	flex: none;
	width: 0.9em;
	height: 0.9em;
	color: var(--accent);
}

.supply ul {
	padding-inline-start: 1.25rem;
}

.supply li + li {
	margin-block-start: var(--space-s);
}

.site-footer {
	--gap: var(--space-m);
	justify-content: space-between;
	margin-block-start: var(--space-xl);
	padding-block: var(--space-m) var(--space-l);
	border-block-start: 1px solid var(--line);
	color: var(--mute);
	font-size: 0.875rem;
}

.site-footer nav {
	--gap: var(--space-m);
}
