/*
 * The shell every template shares, on the parts' and templates' groups: the header, the
 * footer, the docs' two columns, and the openings of pages and sections. global.css's rules
 * of the same names, on WordPress's markup. Loaded on every page with base.css.
 */

/* ---------- Header ---------- */

.site-header {
	border-block-end: 1px solid var(--wp--preset--color--line);
}

.site-header > .wrap {
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-areas: "brand nav cta";
	align-items: center;
	gap: var(--wp--preset--spacing--xxs) var(--wp--preset--spacing--l);
	padding-block: var(--wp--preset--spacing--s);
}

/* The core Buttons and Button wrappers take no box: the link is the grid's item, as the
   Astro site's is. */
.site-header .wp-block-buttons {
	display: contents;
}

.site-header .wp-block-button__link.wp-element-button {
	grid-area: cta;
}

@media (max-width: 40rem) {
	.site-header > .wrap {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"brand cta"
			"nav nav";
	}

	.site-nav {
		justify-self: start;
	}
}

/* ---------- Page openings ---------- */

.page-head {
	padding-block: var(--wp--preset--spacing--section) var(--wp--preset--spacing--xl);
}

.page-head h1 {
	font-size: var(--wp--preset--font-size--step-4);
}

.hero {
	display: grid;
	align-items: center;
	gap: var(--wp--preset--spacing--xl);
	padding-block: var(--wp--preset--spacing--section) calc(var(--wp--preset--spacing--section) * 0.8);
}

.hero h1 {
	max-inline-size: 16ch;
	font-size: var(--wp--preset--font-size--step-5);
}

.hero-art {
	position: relative;
	isolation: isolate;
	justify-self: center;
	inline-size: min(100%, 18rem);
	margin: 0;
}

.hero-art img {
	inline-size: 100%;
}

/* A soft glow in the brand colours behind the art. */
.hero-art::before {
	content: "";
	position: absolute;
	inset: 12%;
	z-index: -1;
	border-radius: var(--wp--custom--radius--circle);
	background: var(--wp--preset--gradient--brand);
	filter: blur(56px);
	opacity: 0.3;
}

@media (min-width: 56rem) {
	.hero {
		grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
	}

	.hero-art {
		inline-size: min(100%, 28rem);
	}
}

/* The row of buttons: core Buttons, with each Button's wrapper taking no box. */
.wp-block-buttons.actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--xs);
	margin-block-start: var(--wp--preset--spacing--l);
}

/* ---------- Sections ---------- */

.section {
	padding-block: var(--wp--preset--spacing--section);
	border-block-start: 1px solid var(--wp--preset--color--line);
}

/* The footer's margin already separates the last section from it. */
.wp-block-post-content > .section:last-child {
	padding-block-end: 0;
}

.section > .wrap > h2 {
	margin-block-end: var(--wp--preset--spacing--l);
	font-size: var(--wp--preset--font-size--step-3);
}

/* ---------- Docs ---------- */

.docs {
	display: grid;
	gap: var(--wp--preset--spacing--xl);
	padding-block: var(--wp--preset--spacing--section) 0;
}

/* The sidebar's template part takes no box, so the <nav> is the grid's item and can stick. */
.docs > .wp-block-template-part {
	display: contents;
}

.docs-nav-title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.docs-nav .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
	padding: 0;
	list-style: none;
}

.docs-nav .wp-block-post-title {
	margin: 0;
	/* A <p> to core; the Astro sidebar's links sit in their list items, where no paragraph's
	   text-wrap reaches them. */
	text-wrap: wrap;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: normal;
	word-break: normal;
}

.docs-nav .wp-block-post-title a {
	display: block;
	padding: 0.4rem var(--wp--preset--spacing--xs);
	border-inline-start: 2px solid transparent;
	border-radius: var(--wp--custom--radius--s);
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.docs-nav .wp-block-post-title a:hover {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
}

.docs-nav .wp-block-post-title a[aria-current="page"] {
	border-inline-start-color: var(--wp--preset--color--accent);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-weight: 600;
}

.docs-article h1 {
	font-size: var(--wp--preset--font-size--step-4);
	word-break: normal;
}

.docs-article > .is-style-callout {
	margin-block-start: var(--wp--preset--spacing--l);
}

.docs-article > .is-style-prose {
	margin-block-start: var(--wp--preset--spacing--xl);
}

@media (min-width: 56rem) {
	.docs {
		grid-template-columns: var(--wp--custom--width--sidebar) minmax(0, 1fr);
		align-items: start;
	}

	.docs-nav {
		position: sticky;
		inset-block-start: var(--wp--preset--spacing--l);
	}

	.docs-nav .wp-block-post-template {
		grid-template-columns: 1fr;
	}
}

/* ---------- Footer ---------- */

.site-footer {
	margin-block-start: var(--wp--preset--spacing--section);
	padding-block: var(--wp--preset--spacing--xl) var(--wp--preset--spacing--l);
	border-block-start: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--step-minus-1);
}

/* Wrapping rather than a grid: at 200% text the columns' min-content widths outgrew the page
   (WCAG 1.4.10 in German and Dutch). Flex items wrap. */
.site-footer > .wrap {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--l);
}

.site-footer > .wrap > * {
	flex: 1 1 11rem;
	/* Without this a long word (an email address) sets a floor the item cannot go below. */
	min-inline-size: 0;
}

.site-footer a {
	overflow-wrap: break-word;
}

.footer-brand .brand img {
	block-size: 2rem;
}

.footer-brand p {
	max-inline-size: var(--wp--custom--width--tagline);
	margin-block-start: var(--wp--preset--spacing--xs);
}

.site-footer ul {
	padding: 0;
	list-style: none;
}

.site-footer li a {
	display: inline-block;
	padding-block: 0.3rem;
	color: inherit;
	text-decoration: none;
}

.site-footer li a:hover {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
}

/* Who runs the service, on every page. */
.footer-operator {
	max-inline-size: var(--wp--custom--width--wrap);
	margin: var(--wp--preset--spacing--l) auto 0;
	padding-inline: var(--wp--custom--width--gutter);
}

/* ---------- The docs list (/docs/) ---------- */

.doc-list .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
	gap: var(--wp--preset--spacing--s);
	padding: 0;
	list-style: none;
}

.doc-list .is-style-card {
	block-size: 100%;
}

.doc-list .wp-block-post-title {
	margin-block-end: var(--wp--preset--spacing--xxs);
	font-size: var(--wp--preset--font-size--step-1);
}

.doc-list .wp-block-post-title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.doc-list .wp-block-post-excerpt {
	margin: 0;
}
