/* paskvil-design - site: layout and components of the content sites, paskvil.com and its wiki
   (needs tokens.css + base.css; markup in DESIGN.md) */

.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;
}
/* sub-site name after the wordmark: <a class="wordmark">paskvil<span>wiki</span></a> */
.wordmark span { font-weight: 400; color: var(--gold); margin-left: 0.4em; letter-spacing: -0.02em; }
.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;
	/* taller than the window -> scrolls on its own, not with the page */
	max-height: calc(100vh - 4rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--rule) transparent;
}
.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); }

/* text keeps the measure, wide blocks (code, figures) get the whole column - :where() keeps it
   overridable, e.g. `.prose > my-demo { max-width: 50rem }` */
.prose > :where(:not(h2, pre, .code-wrap, details, figure)) { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }

.page-head { margin-bottom: 2rem; }
.subtitle { margin: 0.6rem 0 0; color: var(--text-dim); font-size: 1rem; }

/* collapsible code samples: <details><summary>…</summary><pre>…</pre></details> */
.prose details {
	margin: 0 0 1.1rem;
	border: 1px solid var(--rule);
}
.prose details > summary {
	position: relative;
	cursor: pointer;
	padding: 0.6rem 3rem 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); }
/* console icon on the right edge - easier to spot while scrolling than the "+" */
.prose details > summary::after {
	content: "";
	position: absolute;
	right: 1rem;
	top: 50%;
	width: 1.5rem;
	height: 1.5rem;
	transform: translateY(-50%);
	background: var(--gold);
	-webkit-mask: var(--icon-console) right center / 1.5rem no-repeat;
	mask: var(--icon-console) right center / 1.5rem no-repeat;
}
.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, .prose details .code-wrap > pre { margin: 0; border: 0; }

/* copy button, top right of a code block: <div class="code-wrap"><pre>…</pre><button class="copy"></div>
   (added by the page's script) */
.code-wrap { position: relative; }
.code-wrap > pre { padding-right: 3rem; }
.copy {
	position: absolute;
	/* inside the pre's border */
	top: 1px;
	right: 1px;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	cursor: pointer;
	background: var(--prussian-deep);
}
.copy::before {
	content: "";
	position: absolute;
	inset: 0.55rem;
	background: var(--text-dim);
	-webkit-mask: var(--icon-copy) center / contain no-repeat;
	mask: var(--icon-copy) center / contain no-repeat;
}
.copy:hover::before, .copy:focus-visible::before { background: var(--text-strong); }
.copy.copied::before { background: var(--gold); -webkit-mask-image: var(--icon-check); mask-image: var(--icon-check); }

/* "#" after headings (added by the page's script) - shows on hover, click copies the link */
.heading-link {
	margin-left: 0.4em;
	font-family: var(--mono);
	font-weight: 400;
	color: var(--gold);
	text-decoration: none;
	opacity: 0;
	transition: opacity 0.15s;
}
:is(h1, h2, h3, h4):hover > .heading-link, .heading-link:focus-visible, .heading-link.copied { opacity: 1; }
.heading-link.copied::after { content: " copied"; font-size: 0.7em; color: var(--text-dim); }
/* no hover on touch screens - keep it faintly visible there */
@media (hover: none) { .heading-link { opacity: 0.4; } }

/* table of contents: <nav class="toc"><p>contents</p><ul>…</ul></nav> */
.toc { margin: 0 0 2.5rem; padding: 1rem 0 0.25rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.toc p { margin: 0 0 0.75rem; font: 500 0.75rem/1.3 var(--mono); color: var(--text-dim); letter-spacing: 0.04em; }
.toc ul { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.toc li { margin: 0 0 0.3rem; }
.toc > ul > li > a { font: 400 0.8125rem/1.4 var(--mono); color: var(--text-strong); }
.toc ul ul { margin: 0.3rem 0 0.6rem 1.25rem; }
.toc ul ul a { font-size: 0.9375rem; color: var(--text); }
.toc a { text-decoration: none; }
.toc a:hover { color: var(--gold); }

/* child listings on section pages and home: <ul class="index"><li><a>…</a><span>blurb</span></li></ul> */
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; }

/* 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";
		/* its own rows - with the desktop ones the site map row takes the stretch on tall screens */
		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; max-height: none; overflow: visible; }
	.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: " −"; }
}
