/*
 * The blog's one stylesheet (kitecorp/transferify#592): the site's look, copied from kitecorp/transferify-ui at
 * 374c4baab: the colour tokens (src/theme/tokens.ts), the signed-out header (src/nav/normal/NavBar.*,
 * src/nav/BrandMark.tsx), the footer (src/nav/SiteFooter.styles.ts) and the article (src/components/ContentPage.tsx
 * Prose, BlogArticle.styles.ts, ContentFigure.styles.ts). The build hashes this file and rewrites the font URLs to
 * the hashed font files, so a published page always finds the stylesheet and fonts it was built with.
 */

/* Fonts: @fontsource 5.3.0 (OFL-1.1, licences in fonts/), latin and latin-ext subsets only. */
/* instrument-sans-latin-ext-400-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/instrument-sans-latin-ext-400-normal.a7bedd76b9.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* instrument-sans-latin-400-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/instrument-sans-latin-400-normal.9a91efaa35.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* instrument-sans-latin-ext-500-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/blog/assets/instrument-sans-latin-ext-500-normal.37de060fbb.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* instrument-sans-latin-500-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/blog/assets/instrument-sans-latin-500-normal.9d3547da16.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* instrument-sans-latin-ext-600-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/blog/assets/instrument-sans-latin-ext-600-normal.ed24124515.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* instrument-sans-latin-600-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/blog/assets/instrument-sans-latin-600-normal.efb770916e.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* instrument-sans-latin-ext-700-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/blog/assets/instrument-sans-latin-ext-700-normal.3ce67836c4.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* instrument-sans-latin-700-normal */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/blog/assets/instrument-sans-latin-700-normal.bcf650536c.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* instrument-serif-latin-ext-400-normal */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/instrument-serif-latin-ext-400-normal.290e6267dd.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* instrument-serif-latin-400-normal */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/instrument-serif-latin-400-normal.5eb09b5ac0.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* jetbrains-mono-latin-ext-400-normal */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/jetbrains-mono-latin-ext-400-normal.505dfba8ec.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* jetbrains-mono-latin-400-normal */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/blog/assets/jetbrains-mono-latin-400-normal.14425ba9c6.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
	--paper: #ffffff;
	--ink: #15171d;
	--ink2: #585e6b;
	--ink3: #9aa0ad;
	--line: #e7e5df;
	--field: #f3f2ed;
	--field-line: #e3e1d9;
	--blue: #2b50e0;
	--card: #ffffff;
	--card2: #f6f5f1;
	--card-border: #e9e7e1;
	--ring: rgba(43, 80, 224, 0.18);
	--accent-tint: rgba(43, 80, 224, 0.10);
	--shadow-card: 0 1px 2px rgba(20, 22, 27, 0.05), 0 12px 28px rgba(20, 22, 27, 0.09), 0 2px 8px rgba(20, 22, 27, 0.04);
	--logo-blue: #2b50e0;
	--sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
	--serif: 'Instrument Serif', 'Instrument Sans', serif;
	--mono: 'JetBrains Mono', ui-monospace, monospace;
	color-scheme: light;
}

:root[data-theme="dark"] {
	--paper: #0b0c10;
	--ink: #f1f0ec;
	--ink2: #a4a9b4;
	--ink3: #6c7280;
	--line: #23252e;
	--field: #191b22;
	--field-line: #2b2e38;
	--blue: #6486ff;
	--card: #15171d;
	--card2: #1b1e26;
	--card-border: #262932;
	--ring: rgba(100, 134, 255, 0.30);
	--accent-tint: rgba(100, 134, 255, 0.16);
	--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.3);
	color-scheme: dark;
}

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

html {
	background: var(--paper);
}

/* The Back to top link, the page's only fragment link, scrolls smoothly, or jumps for a reader who asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	color: var(--ink2);
	font-family: var(--sans);
	-webkit-font-smoothing: antialiased;
}

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

.sprite {
	display: none;
}

/* The header and the page body together, so the Back to top button's track ends where the footer starts. */
.page-body {
	position: relative;
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
}

/* The header: the brand on the left, the pill on the right, floating over the page. */
.topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 66px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30px;
	z-index: 30;
}

/* The Back to top link's focus target, not a control: the next Tab shows the ring on the control it reaches. */
.topbar:focus {
	outline: none;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--ink);
	font-weight: 700;
	font-size: 20px;
	letter-spacing: -0.03em;
	text-decoration: none;
}

.logo-mark {
	width: 30px;
	height: 30px;
	padding-top: 3px;
	border-radius: 8px;
	background: var(--logo-blue);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	font-family: var(--serif);
	font-weight: 400;
	font-size: 22px;
	line-height: 1;
	box-shadow: 0 2px 8px var(--ring);
}

.pill {
	display: flex;
	align-items: center;
	gap: 2px;
	background: var(--card);
	border: 1px solid var(--card-border);
	border-radius: 12px;
	padding: 4px;
	box-shadow: var(--shadow-card);
}

.pill-link {
	display: inline-flex;
	align-items: center;
	color: var(--ink2);
	font-weight: 500;
	font-size: 14px;
	padding: 9px 13px;
	border-radius: 8px;
	text-decoration: none;
	cursor: pointer;
	list-style: none;
	transition: 0.16s;
}

.pill-link::-webkit-details-marker {
	display: none;
}

.pill-link:hover,
.resources[open] > .pill-link {
	background: var(--field);
	color: var(--ink);
}

.pill-icon {
	display: none;
}

.pill-icon svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pill-separator {
	width: 1px;
	align-self: stretch;
	margin: 4px;
	background: var(--card-border);
	flex: none;
}

.login {
	color: var(--blue);
	font-weight: 600;
	font-size: 14px;
	padding: 8px 15px;
	white-space: nowrap;
	border: 1px solid var(--blue);
	border-radius: 8px;
	text-decoration: none;
}

.login:hover {
	background: var(--accent-tint);
}

.resources {
	position: relative;
}

.resources-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 40;
	width: max-content;
	max-width: calc(100vw - 200px);
	padding: 8px;
	background: var(--card);
	border: 1px solid var(--card-border);
	border-radius: 16px;
	box-shadow: var(--shadow-card);
}

.resource-columns {
	display: flex;
	flex-wrap: wrap;
}

.resource-group {
	display: flex;
	flex-direction: column;
	min-width: 0;
	gap: 1px;
}

.resource-group-label {
	display: block;
	padding: 10px 12px 6px;
	color: var(--blue);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.resource-row {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 40px;
	padding: 8px 12px;
	border-radius: 10px;
	color: var(--ink2);
	font-size: 14px;
	text-decoration: none;
}

.resource-row:hover {
	background: var(--field);
	color: var(--ink);
}

.resource-row svg {
	width: 20px;
	height: 20px;
	flex: none;
	fill: currentColor;
}

/* The page body: one column, under the floating header. */
.content {
	position: relative;
	z-index: 1;
	flex: 1 0 auto;
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	padding: calc(66px + 28px) 24px 72px;
}

.back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	margin: 0 0 6px;
	color: var(--ink2);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
}

.back:hover {
	color: var(--blue);
	text-decoration: underline;
}

.back svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.prose {
	font-size: 15.5px;
	line-height: 1.68;
	color: var(--ink2);
}

.prose h1 {
	margin: 0 0 8px;
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(34px, 5vw, 50px);
	line-height: 1.04;
	letter-spacing: -0.015em;
	color: var(--ink);
}

.prose h2 {
	margin: 44px 0 12px;
	font-weight: 700;
	font-size: clamp(24px, 3.2vw, 30px);
	letter-spacing: -0.015em;
	line-height: 1.15;
	color: var(--ink);
}

.prose h3 {
	margin: 30px 0 8px;
	font-weight: 700;
	font-size: 18px;
	letter-spacing: -0.01em;
	color: var(--ink);
}

.prose h4 {
	margin: 22px 0 6px;
	font-weight: 700;
	font-size: 15.5px;
	color: var(--ink);
}

.prose p {
	margin: 0 0 14px;
}

.prose ul,
.prose ol {
	margin: 0 0 16px;
	padding-left: 22px;
}

.prose li {
	margin: 0 0 8px;
}

.prose strong {
	color: var(--ink);
	font-weight: 700;
}

.prose a {
	color: var(--blue);
	text-decoration: underline;
	text-underline-offset: 0.16em;
	overflow-wrap: anywhere;
}

.prose code {
	font-family: var(--mono);
	font-size: 0.86em;
	background: var(--field);
	border: 1px solid var(--field-line);
	border-radius: 5px;
	padding: 1px 5px;
}

/* A long URL or JSON value in running text has no space to break at and would widen a phone's page. Table cells
   keep their code whole: the table scrolls inside its region instead. */
.prose p code,
.prose li code {
	overflow-wrap: anywhere;
}

.table-region {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-inline: contain;
	margin: 0 0 16px;
}

/* Tables read as aligned plain text, a before-and-after list in columns: monospace, no grid, no cell
   backgrounds, and code values without their chip, so the columns line up and nothing is padded apart. A long
   value wraps between words inside its column; on a phone the text is smaller so a header name such as
   `application/grpc+proto` still fits one column. */
.prose table {
	border-collapse: collapse;
	font-family: var(--mono);
	font-size: 13px;
	line-height: 1.6;
}

.prose th,
.prose td {
	padding: 0 32px 4px 0;
	text-align: left;
	vertical-align: top;
	overflow-wrap: break-word;
}

.prose th {
	padding-bottom: 6px;
	font-family: var(--sans);
	font-size: 13px;
	font-weight: 700;
	color: var(--ink);
}

.prose td {
	color: var(--ink);
}

.prose td code {
	padding: 0;
	border: none;
	background: none;
	font-size: inherit;
}

/* A fenced code block reads as plain text in the tables' style, its lines and indentation kept. A line too long
   for a phone wraps at a space rather than running off the edge. */
.prose pre {
	margin: 0 0 16px;
	white-space: pre-wrap;
	overflow-wrap: break-word;
	font-family: var(--mono);
	font-size: 13px;
	line-height: 1.6;
	color: var(--ink);
}

.prose pre code {
	padding: 0;
	border: none;
	background: none;
	font-size: inherit;
}

@media (max-width: 640px) {
	.prose table {
		font-size: 11.5px;
	}

	.prose pre {
		font-size: 11px;
	}

	.prose th,
	.prose td {
		padding-right: 14px;
	}
}

.post-meta {
	margin: 0 0 28px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ink2);
}

.post-meta time {
	font-variant-numeric: tabular-nums;
}

.meta-separator {
	padding: 0 7px;
}

/* Figures: two images of one file, the light one and the same file with #dark, one shown per theme. */
.prose figure {
	margin: 24px 0 28px;
}

.figure-frame {
	background: var(--card2);
	border: 1px solid var(--card-border);
	border-radius: 16px;
	padding: 18px;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
}

.figure-frame img {
	display: block;
	width: 100%;
	min-width: 600px;
	height: auto;
}

.figure-frame .figure-dark,
:root[data-theme="dark"] .figure-frame .figure-light {
	display: none;
}

:root[data-theme="dark"] .figure-frame .figure-dark {
	display: block;
}

.prose figcaption {
	margin-top: 10px;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--ink2);
}

/* The index: one row per post between hairlines. */
.post-list {
	list-style: none;
	margin: 26px 0 0;
	padding: 0;
}

.post-list li {
	margin: 0;
	padding: 22px 0 20px;
	border-top: 1px solid var(--line);
}

.post-list li:last-child {
	border-bottom: 1px solid var(--line);
}

.post-list h2 {
	margin: 0 0 6px;
	font-size: clamp(20px, 2.5vw, 24px);
	line-height: 1.22;
	text-wrap: balance;
}

.post-list h2 a {
	color: var(--ink);
	text-decoration: none;
}

.post-list h2 a:hover {
	color: var(--blue);
	text-decoration: underline;
}

.post-list .post-meta {
	margin: 0 0 8px;
	font-size: 13.5px;
}

.post-list p:last-child {
	margin: 0;
}

/*
 * Back to top (kitecorp/transferify#665): phones and tablets only, never in print, and with no script. The button is
 * sticky in a track that covers the page down to the footer. Its natural place is one and a half screens down, so at the
 * top of the page it is below the fold. It sticks in the bottom right corner, so it slides in once half a screen has been
 * scrolled, and slides out the same way. The track ends at the footer, so at the end of the page the button stops above
 * the footer, in the empty space at the bottom of the content, and covers neither. No ancestor may set overflow: the
 * button would then stick inside that box instead of the page.
 *
 * On a page too short to fit the button above the footer, the query below removes it. Otherwise it would make the page
 * longer, or show a sliver, and be a tab stop no one can see. A browser too old for the query or for dvh gets no button.
 */
.to-top-track {
	display: none;
}

@media screen and (max-width: 960px) {
	@supports (container-type: size) and (top: 1dvh) {
		.to-top-track {
			display: block;
			position: absolute;
			inset: 0;
			z-index: 20;
			container-type: size;
			/* It lies over the whole page, and only the button may take a tap. */
			pointer-events: none;
		}

		.to-top {
			position: sticky;
			top: calc(100dvh - 44px - 16px - env(safe-area-inset-bottom, 0px));
			display: flex;
			align-items: center;
			gap: 6px;
			width: fit-content;
			height: 44px;
			/* 8px below, not the corner's 16px: 52px in all fits the 56px of empty space a phone's content ends in. */
			margin: 150dvh calc(16px + env(safe-area-inset-right, 0px)) 8px auto;
			padding: 0 16px;
			background: var(--card);
			border: 1px solid var(--card-border);
			border-radius: 999px;
			box-shadow: var(--shadow-card);
			color: var(--ink);
			font-size: 15px;
			font-weight: 600;
			line-height: 1;
			white-space: nowrap;
			text-decoration: none;
			pointer-events: auto;
		}

		.to-top:hover {
			background: var(--field);
		}

		.to-top svg {
			width: 17px;
			height: 17px;
			flex: none;
			fill: none;
			stroke: currentColor;
			stroke-width: 2.4;
			stroke-linecap: round;
			stroke-linejoin: round;
		}

		/* 150dvh + 44px + 8px: the button's place, its height and its margin. */
		@container (max-height: calc(150dvh + 52px)) {
			.to-top {
				display: none;
			}
		}
	}
}

.site-footer {
	flex: none;
	width: 100%;
	padding: 10px 24px;
	border-top: 1px solid var(--line);
	background-color: var(--paper);
	text-align: center;
}

.site-footer ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--ink2);
	font-size: 13px;
	line-height: 1.2;
	text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
	color: var(--ink);
	text-decoration: underline;
}

@media (max-width: 640px) {
	.topbar {
		height: 56px;
		padding: 0 18px;
	}

	.brand {
		font-size: 18px;
		min-width: 44px;
		min-height: 44px;
	}

	.wordmark,
	.pill-label,
	.pill-separator {
		display: none;
	}

	.pill {
		position: relative;
	}

	.pill-link {
		width: 44px;
		height: 44px;
		padding: 0;
		justify-content: center;
	}

	.pill-icon {
		display: inline-flex;
	}

	.login {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		padding: 0 12px;
	}

	.resources {
		position: static;
	}

	.resources-panel {
		left: 0;
		right: 0;
		width: 100%;
		max-width: none;
		max-height: 80dvh;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.resource-columns {
		flex-direction: column;
	}

	.content {
		padding: calc(56px + 20px) 18px 56px;
	}

	.figure-frame {
		padding: 12px;
	}

	.site-footer {
		padding: 10px 16px;
	}
}
