/* fonts - self-hosted variable woff2, copied from @fontsource-variable by eleventy */
@font-face {
	font-family: "Martian Mono";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	font-stretch: 75% 112.5%;
	src: url(/assets/fonts/martian-mono-latin-ext-standard-normal.woff2) format("woff2-variations");
	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;
}
@font-face {
	font-family: "Martian Mono";
	font-style: normal;
	font-display: swap;
	font-weight: 100 800;
	font-stretch: 75% 112.5%;
	src: url(/assets/fonts/martian-mono-latin-standard-normal.woff2) format("woff2-variations");
	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;
}
@font-face {
	font-family: "Schibsted Grotesk";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url(/assets/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format("woff2-variations");
	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;
}
@font-face {
	font-family: "Schibsted Grotesk";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url(/assets/fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2-variations");
	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;
}
@font-face {
	font-family: "Schibsted Grotesk";
	font-style: italic;
	font-display: swap;
	font-weight: 400 900;
	src: url(/assets/fonts/schibsted-grotesk-latin-wght-italic.woff2) format("woff2-variations");
	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;
}

/* tokens */
:root {
	--prussian: #00111c;
	--prussian-deep: #000a12;
	--prussian-raised: #062033;
	--rule: #16324a;
	--text: #88aaff;
	--text-dim: #6680bf;
	--text-strong: #e0e7f5;
	--gold: #d6a84a;
	--gold-soft: rgb(214 168 74 / 0.45);

	--mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
	--sans: "Schibsted Grotesk", system-ui, sans-serif;

	--measure: 68ch;
	--gap: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
	color-scheme: dark;
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--prussian);
	color: var(--text);
	font: 400 1.0625rem/1.6 var(--sans);
	font-kerning: normal;
	text-rendering: optimizeLegibility;
}
a { color: var(--gold); text-decoration: underline 1px var(--gold-soft); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
strong, b { color: var(--text-strong); font-weight: 600; }
::selection { background: var(--gold); color: var(--prussian); }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--gold); color: var(--prussian); padding: 0.4rem 0.8rem; z-index: 10; }
.skip:focus { left: 0.5rem; }

/* frame: content left, site map right */
.frame {
	max-width: 74rem;
	margin: 0 auto;
	padding: 0 var(--gap);
	display: grid;
	grid-template-columns: minmax(0, 1fr) 17rem;
	grid-template-areas:
		"mast mast"
		"content map"
		"foot foot";
	min-height: 100vh;
	grid-template-rows: auto 1fr auto;
}

.masthead {
	grid-area: mast;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 1.75rem 0 1rem;
	border-bottom: 1px solid var(--rule);
}
.wordmark {
	font: 600 1.5rem/1 var(--mono);
	font-stretch: 112.5%;
	letter-spacing: -0.03em;
	color: var(--text-strong);
	text-decoration: none;
	border-bottom: 3px solid var(--gold);
	padding-bottom: 0.15rem;
}
.external { display: flex; gap: 1.25rem; font: 400 0.8125rem/1 var(--mono); }
.external a { color: var(--text); text-decoration: none; }
.external a:hover { color: var(--gold); }

.content {
	grid-area: content;
	min-width: 0;
	padding: 2.5rem var(--gap) 4rem 0;
}
.up { margin: 0 0 1.5rem; font: 400 0.8125rem/1.4 var(--mono); color: var(--text-dim); }

/* site map */
.sitemap {
	grid-area: map;
	border-left: 1px solid var(--rule);
	padding: 2.5rem 0 2rem var(--gap);
	font: 400 0.8125rem/1.5 var(--mono);
}
.sitemap details { position: sticky; top: 2rem; }
.sitemap summary {
	list-style: none;
	color: var(--text-dim);
	margin-bottom: 1rem;
	cursor: pointer;
}
.sitemap summary::-webkit-details-marker { display: none; }
.sitemap ul { list-style: none; margin: 0; padding: 0; }
.sitemap > details > ul > li { margin-bottom: 1.25rem; }
.sitemap > details > ul > li > a { color: var(--text-strong); font-weight: 500; }
.sitemap ul ul { margin-top: 0.5rem; border-left: 1px solid var(--rule); }
.sitemap ul ul a { display: block; padding: 0.2rem 0 0.2rem 0.85rem; margin-left: -1px; border-left: 2px solid transparent; }
.sitemap a { color: var(--text); text-decoration: none; }
.sitemap a:hover { color: var(--gold); }
.sitemap a[aria-current="page"] { color: var(--gold); }
.sitemap ul ul a[aria-current="page"] { border-left-color: var(--gold); }

.colophon {
	grid-area: foot;
	border-top: 1px solid var(--rule);
	padding: 1.25rem 0 2rem;
	font-size: 0.8125rem;
	color: var(--text-dim);
}
.colophon p { margin: 0; max-width: var(--measure); }
.colophon a { color: var(--text); }

/* type */
/* text keeps the measure, wide blocks (code, figures, demos) get the whole column */
.prose > :not(h2, pre, figure, details, bdpt-demo) { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
p, ul, ol, dl, pre { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }
li::marker { color: var(--text-dim); }

.page-head { margin-bottom: 2rem; }
h1 {
	font: 500 clamp(1.75rem, 1.2rem + 2vw, 2.5rem)/1.15 var(--mono);
	font-stretch: 100%;
	letter-spacing: -0.035em;
	color: var(--text-strong);
	margin: 0;
	text-wrap: balance;
}
.subtitle { margin: 0.6rem 0 0; color: var(--text-dim); font-size: 1rem; }
h2 {
	font: 500 1rem/1.3 var(--mono);
	color: var(--text-strong);
	letter-spacing: -0.01em;
	margin: 2.75rem 0 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--rule);
}
h3 { font: 500 1.0625rem/1.3 var(--sans); color: var(--text-strong); margin: 2rem 0 0.6rem; }

code, pre, dt { font-family: var(--mono); }
:not(pre) > code {
	font-size: 0.8125em;
	color: var(--text-strong);
	background: var(--prussian-raised);
	padding: 0.1em 0.3em;
	border-radius: 2px;
	white-space: nowrap;
}
pre {
	font-size: 0.8125rem;
	line-height: 1.65;
	background: var(--prussian-deep);
	border: 1px solid var(--rule);
	padding: 1rem 1.25rem;
	overflow-x: auto;
	color: var(--text-strong);
}
dl { margin-bottom: 1.5rem; }
dt { font-size: 0.875rem; color: var(--text-strong); margin-top: 1.25rem; }
dt code { font-size: 1em; background: none; padding: 0; }
dd { margin: 0.3rem 0 0 1.5rem; }

/* collapsible code samples */
.prose details {
	margin: 0 0 1.1rem;
	border: 1px solid var(--rule);
}
.prose details > summary {
	cursor: pointer;
	padding: 0.6rem 1rem;
	font: 400 0.8125rem/1.4 var(--mono);
	color: var(--text);
	list-style: none;
}
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before { content: "+ "; color: var(--gold); }
.prose details[open] > summary::before { content: "− "; }
.prose details > summary:hover { color: var(--gold); }
.prose details[open] > summary { border-bottom: 1px solid var(--rule); }
.prose details > pre { margin: 0; border: 0; }

/* figures */
figure { margin: 2rem 0; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); }
/* images in a row, each at most its natural size, shrinking to fit; wraps on narrow screens */
figure.pair { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; }
figure.pair img { flex: 1 1 8rem; min-width: 0; max-width: max-content; }
figure.pair figcaption { flex-basis: 100%; }
figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--text-dim); max-width: var(--measure); }

/* interactive demo (custom element from paskvil-bdpt) */
bdpt-demo { display: block; width: 100%; max-width: 50rem; margin: 2rem 0; }

.file-meta { color: var(--text-dim); font-size: 0.875rem; white-space: nowrap; }
.file-dl { font-size: 0.875rem; }

/* child listings on section pages and home */
ul.index { list-style: none; padding: 0; margin: 2rem 0; border-bottom: 1px solid var(--rule); }
ul.index li { margin: 0; padding: 0.9rem 0; border-top: 1px solid var(--rule); }
ul.index a { font: 500 0.9375rem/1.3 var(--mono); text-decoration: none; }
ul.index a:hover { text-decoration: underline 1px var(--gold); }
ul.index span { display: block; margin-top: 0.25rem; color: var(--text); font-size: 0.9375rem; }

/* home: the dictionary entry */
.entry { margin: 1rem 0 3.5rem; max-width: var(--measure); }
.headword {
	font: 600 clamp(3.25rem, 1.5rem + 8vw, 7rem)/0.95 var(--mono);
	font-stretch: 112.5%;
	letter-spacing: -0.06em;
	color: var(--text-strong);
	margin: 0 0 1.25rem;
}
.headword .dot { color: var(--gold); }
.gram { font-size: 1.0625rem; margin: 0 0 1.25rem; padding-bottom: 1.25rem; border-bottom: 3px solid var(--gold); max-width: 24rem; }
.gram span { font-family: var(--mono); font-size: 0.9375rem; color: var(--text-strong); margin-right: 0.5rem; }
.senses { font-size: 1.1875rem; line-height: 1.5; padding-left: 1.75rem; color: var(--text-strong); }
.senses li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.senses li::marker { font: 600 0.875rem var(--mono); color: var(--gold); }

/* source viewer */
.source { max-width: none; }
.source .subtitle { font-family: var(--mono); font-size: 0.8125rem; }
.source .subtitle a { margin-left: 1rem; }
.listing {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	border: 1px solid var(--rule);
	background: var(--prussian-deep);
}
.listing pre { margin: 0; border: 0; }
.listing .gutter { color: var(--rule); text-align: right; padding-right: 0.75rem; border-right: 1px solid var(--rule); user-select: none; overflow: hidden; }
.listing .code { padding-left: 1rem; }

/* prism tokens, in palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--text-dim); font-style: italic; }
.token.punctuation { color: #8aa0b6; }
.token.keyword, .token.important, .token.builtin, .token.atrule, .token.car, .token.attr-name { color: var(--gold); }
.token.string, .token.char, .token.attr-value, .token.regex { color: #9fc6e0; }
.token.number, .token.boolean, .token.symbol, .token.constant { color: #e6c27e; }
.token.function, .token.class-name, .token.defun { color: #ffffff; }
.token.variable, .token.parameter { color: #c6d6e6; }
.token.operator { color: var(--text); }

/* narrow: site map folds under the masthead */
@media (max-width: 52rem) {
	.frame {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "mast" "map" "content" "foot";
		grid-template-rows: auto auto 1fr auto;
	}
	.content { padding-right: 0; padding-top: 2rem; }
	.sitemap { border-left: 0; border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
	.sitemap details { position: static; }
	.sitemap summary { margin: 0; color: var(--text); }
	.sitemap summary::after { content: " +"; color: var(--gold); }
	.sitemap details[open] summary { margin-bottom: 1rem; }
	.sitemap details[open] summary::after { content: " −"; }
	/* long inline code may break on phones rather than run off the screen */
	:not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
	/* two equal columns, so a lone last image doesn't come out bigger than the rest */
	figure.pair { display: grid; grid-template-columns: 1fr 1fr; }
	figure.pair img { width: 100%; max-width: none; }
	figure.pair figcaption { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; }
}
