/* a quiet document with the font, type scale and colors of piqy.eu (piqy-v5 global.css) */

@font-face {
	font-family: 'PP Neue Montreal';
	src: url('/fonts/neue-montreal.woff2') format('woff2');
	font-style: normal;
	font-weight: 200 800;
	font-display: swap;
}

:root {
	color-scheme: light;

	--color-ink: #0c0c0c;
	--color-ink-secondary: rgb(12 12 12 / 0.6);
	--color-ink-faint: rgb(12 12 12 / 0.15);
	--color-fill: rgb(12 12 12 / 0.05);
	--color-accent: #255af6;
	--color-on-accent: #fff;
	--color-page: #eef3ff;

	--font-sans: 'PP Neue Montreal', ui-sans-serif, system-ui, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--font-weight-medium: 530;

	/* only these sizes; letter spacing is 3% on 14px, 2% on 17px, and 1.5% on 24px */
	--text-sm: 0.875rem;
	--text-sm-line-height: calc(1.25 / 0.875);
	--text-sm-letter-spacing: 0.03em;
	--text-lg: 1.0625rem;
	--text-lg-line-height: calc(1.75 / 1.0625);
	--text-lg-letter-spacing: 0.02em;
	--text-2xl: 1.5rem;
	--text-2xl-line-height: calc(2 / 1.5);
	--text-2xl-letter-spacing: 0.015em;

	--ease-expand: cubic-bezier(0.32, 0.72, 0, 1);

	--container-text: 36.25rem;
	--column: 52rem;
}

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

html {
	background: var(--color-page);
	-webkit-text-size-adjust: 100%;
}

body {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
	color: var(--color-ink-secondary);
	font-family: var(--font-sans);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-medium);
	line-height: var(--text-sm-line-height);
	letter-spacing: var(--text-sm-letter-spacing);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

header,
main,
footer {
	width: 100%;
	max-width: calc(var(--column) + 3rem);
	margin-inline: auto;
	padding-inline: 1.5rem;
}

a {
	color: inherit;
	text-decoration: none;
	transition: color 150ms;
}

a:hover {
	color: var(--color-ink);
}

:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
	border-radius: 0.375rem;
}

h1,
h2 {
	color: var(--color-ink);
	font-size: inherit;
	font-weight: inherit;
	text-wrap: balance;
}

p,
ol {
	max-width: var(--container-text);
	text-wrap: pretty;
}

p + p,
ol + p {
	margin-top: 0.75rem;
}

code {
	color: var(--color-ink);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	letter-spacing: 0;
}

/* the skip link of piqy.eu: hidden until it has keyboard focus */
.skip-link {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 10;
	padding: 0.25rem 0.75rem;
	border-radius: 999px;
	background: var(--color-accent);
	color: var(--color-on-accent);
	translate: 0 -200%;
}

.skip-link:focus-visible {
	translate: none;
}

main:focus {
	outline: none;
}

/* header and footer, as on piqy.eu (Header.astro, Layout.astro) */

header {
	display: flex;
	align-items: center;
	padding-block: 1.25rem;
}

.logo {
	display: inline-flex;
	color: var(--color-ink);
}

header .logo {
	margin: -0.5rem;
	padding: 0.5rem;
	border-radius: 0.5rem;
}

.logo svg {
	width: auto;
	height: 1.25rem;
}

/* the brand on the left, the links on the right, the copyright in line with the last link;
   on phones, the copyright comes last */
footer {
	display: grid;
	gap: 4rem;
	padding-block: 8rem 2.5rem;
}

@media (min-width: 48rem) {
	footer {
		grid-template-columns: 1fr auto;
	}

	footer nav {
		grid-row: span 2;
	}

	.copyright {
		align-self: end;
	}
}

footer > div p {
	max-width: 15rem;
	margin-top: 1rem;
}

footer ul {
	display: grid;
	gap: 0.75rem;
	margin-top: 1.25rem;
	list-style: none;
}

/* introduction: the stores first, the APK for devices without Google Play below */

main {
	flex-grow: 1;
	padding-block: 3.5rem 0;
}

@media (min-width: 48rem) {
	main {
		padding-top: 5.5rem;
	}
}

h1 {
	font-size: var(--text-2xl);
	line-height: var(--text-2xl-line-height);
	letter-spacing: var(--text-2xl-letter-spacing);
}

.lead {
	margin-top: 0.5rem;
	font-size: var(--text-lg);
	line-height: var(--text-lg-line-height);
	letter-spacing: var(--text-lg-letter-spacing);
}

.stores {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 2rem;
}

.stores a {
	display: block;
	border-radius: 0.5rem;
	transition: opacity 150ms;
}

.stores a:hover {
	opacity: 0.85;
}

.stores img {
	display: block;
	width: auto;
	height: 3rem;
}

.apk {
	margin-top: 3.5rem;
}

.apk h2 {
	font-size: var(--text-lg);
	line-height: var(--text-lg-line-height);
	letter-spacing: var(--text-lg-letter-spacing);
}

.apk h2 + p {
	margin-top: 0.25rem;
}

.support {
	color: var(--color-ink);
}

.download {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
}

p + .download {
	margin-top: 1.25rem;
}

.button {
	padding: 0.25rem 0.75rem;
	border-radius: 999px;
	background: var(--color-accent);
	color: var(--color-on-accent);
	transition: background-color 150ms;
}

.button:hover {
	background: color-mix(in srgb, var(--color-accent) 88%, var(--color-ink));
	color: var(--color-on-accent);
}

/* the QR code helps only when this page is open on another device than the one to install on */
.qr-code {
	display: none;
	align-items: center;
	gap: 1.25rem;
	max-width: var(--container-text);
	margin-top: 1.5rem;
}

@media (min-width: 48rem) {
	.qr-code {
		display: flex;
	}
}

.qr-code button,
.qr-code-large button {
	display: block;
	padding: 0.625rem;
	border: 0;
	border-radius: 0.5rem;
	background: #fff;
	cursor: zoom-in;
	transition: box-shadow 150ms;
}

.qr-code button:hover {
	box-shadow: 0 0 0 1px var(--color-ink-faint);
}

.qr-code button,
.qr-code-large button {
	/* high contrast modes must not recolor the code, or it does not scan */
	forced-color-adjust: none;
}

.qr-code svg,
.qr-code-large svg {
	display: block;
	width: 5.75rem;
	height: auto;
	fill: var(--color-ink);
}

/* the large QR code: in the middle of the screen, over a dimmed page */
.qr-code-large {
	inset: 0;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 1rem;
	background: transparent;
	opacity: 0;
	scale: 0.96;
	transition:
		opacity 200ms,
		scale 200ms cubic-bezier(0.32, 0.72, 0, 1),
		overlay 200ms allow-discrete,
		display 200ms allow-discrete;
}

.qr-code-large:popover-open {
	opacity: 1;
	scale: 1;
}

@starting-style {
	.qr-code-large:popover-open {
		opacity: 0;
		scale: 0.96;
	}
}

.qr-code-large::backdrop {
	background: rgb(12 12 12 / 0.4);
}

.qr-code-large button {
	padding: 1.5rem;
	border-radius: 1rem;
	cursor: zoom-out;
}

.qr-code-large svg {
	width: min(24rem, 80vmin);
}

@media (prefers-reduced-motion: reduce) {
	.qr-code-large {
		transition: none;
	}
}

.qr-code figcaption {
	max-width: 14rem;
}

/* sections: a title above the content and space between them, as on piqy.eu */

section {
	margin-top: 6rem;
}

/* the section titles of piqy.eu: text-2xl in ink */
section h2 {
	font-size: var(--text-2xl);
	line-height: var(--text-2xl-line-height);
	letter-spacing: var(--text-2xl-letter-spacing);
}

section h2 + div {
	margin-top: 1rem;
}

/* the reading text, as on the Legal page of piqy.eu; lists, buttons and links stay text-sm */
.apk p:not(.download),
section p,
.steps {
	font-size: var(--text-lg);
	line-height: var(--text-lg-line-height);
	letter-spacing: var(--text-lg-letter-spacing);
}

.steps {
	margin-bottom: 1.25rem;
	padding-left: 1.25rem;
}

.steps li {
	padding-left: 0.25rem;
}

.steps li + li {
	margin-top: 0.25rem;
}

/* all versions: an accordion, with the section title as its toggle */

.all-versions {
	margin-top: 6rem;
}

.all-versions summary {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	max-width: var(--container-text);
	color: var(--color-ink);
	list-style: none;
	cursor: pointer;
}

.all-versions summary:focus-visible {
	outline-offset: 0.5rem;
	border-radius: 0.5rem;
}

.all-versions summary::-webkit-details-marker {
	display: none;
}

.all-versions h2 {
	font-size: var(--text-2xl);
	line-height: var(--text-2xl-line-height);
	letter-spacing: var(--text-2xl-letter-spacing);
}

.count {
	padding: 0 0.5rem;
	border-radius: 999px;
	background: var(--color-fill);
	color: var(--color-ink-secondary);
}

.chevron {
	width: 1.25rem;
	height: 1.25rem;
	margin-left: auto;
	color: var(--color-ink-secondary);
	transition: rotate 200ms var(--ease-expand);
}

.all-versions summary:hover .chevron {
	color: var(--color-ink);
}

.all-versions[open] .chevron {
	rotate: 180deg;
}

/* the content slides open where the browser can animate to auto height */
.all-versions::details-content {
	height: 0;
	overflow: clip;
	transition:
		height 300ms var(--ease-expand),
		content-visibility 300ms allow-discrete;
}

.all-versions[open]::details-content {
	height: auto;
}

@supports (interpolate-size: allow-keywords) {
	:root {
		interpolate-size: allow-keywords;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chevron,
	.all-versions::details-content {
		transition: none;
	}
}

.all-versions summary + div {
	padding-top: 1rem;
}

.all-versions p {
	font-size: var(--text-lg);
	line-height: var(--text-lg-line-height);
	letter-spacing: var(--text-lg-letter-spacing);
}

/* versions: one line for each file */

.versions {
	max-width: var(--container-text);
	margin-top: 1.5rem;
	list-style: none;
}

.versions li {
	display: grid;
	grid-template-columns: 1fr auto;
	column-gap: 1.5rem;
	padding-block: 0.375rem;
}

/* links in lists: ink and an underline, so they differ from the text around them by more than color */
.versions a {
	color: var(--color-ink);
	text-decoration: underline;
	text-decoration-color: var(--color-ink-faint);
	text-underline-offset: 0.2em;
	transition: text-decoration-color 150ms;
}

.versions a:hover {
	text-decoration-color: currentColor;
}

.versions a {
	grid-column: 1 / -1;
	justify-self: start;
}

@media (min-width: 36rem) {
	.versions li {
		grid-template-columns: 1fr auto 4rem;
	}

	.versions a {
		grid-column: auto;
	}

	.versions span:last-child {
		text-align: right;
	}
}
