/*
Theme Name: Device Test
Theme URI: https://cameratest.app/
Author: itechtics
Description: A block theme for browser-based device testing tools. Each tester — webcam, microphone, speaker, keyboard, mouse, display, dead pixel, touchscreen — ships as an independent Gutenberg block, so any site in the network can compose its own pages from the same toolkit. Colours, typography and spacing are driven entirely by Global Styles, so a site is rebranded from the Site Editor without touching code.
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 8.1
Version: 2.15.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: devicetest
Tags: block-theme, full-site-editing, one-column, block-patterns, accessibility-ready
*/

/*
 * Most styling lives in theme.json so it is editable from the Site Editor.
 * What remains here is what the block editor cannot express: dark mode,
 * focus behaviour, and a handful of composition classes used by patterns.
 */

/* ===========================================================================
   Dark mode

   Overrides the custom properties theme.json emits rather than restyling
   components, so every block — core and custom — follows automatically.
   Backgrounds stay slightly warm to match the light palette; text is
   off-white rather than pure white to cut halation on a dark field.
   =========================================================================== */

@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--wp--preset--color--base: #131316;
		--wp--preset--color--surface: #1b1b20;
		--wp--preset--color--surface-raised: #26262c;
		--wp--preset--color--contrast: #e8e8e3;
		--wp--preset--color--contrast-muted: #9a9aa3;
		--wp--preset--color--border: #30303a;
		--wp--preset--color--accent: #fb923c;
		--wp--preset--color--accent-hover: #fdba74;
		--wp--preset--color--live: #4ade80;
		--wp--preset--color--danger: #f87171;
		--wp--preset--color--warning: #fbbf24;
		--wp--preset--color--inverse: #09090b;

		color-scheme: dark;
	}
}

:root[data-theme='dark'] {
	--wp--preset--color--base: #131316;
	--wp--preset--color--surface: #1b1b20;
	--wp--preset--color--surface-raised: #26262c;
	--wp--preset--color--contrast: #e8e8e3;
	--wp--preset--color--contrast-muted: #9a9aa3;
	--wp--preset--color--border: #30303a;
	--wp--preset--color--accent: #fb923c;
	--wp--preset--color--accent-hover: #fdba74;
	--wp--preset--color--live: #4ade80;
	--wp--preset--color--danger: #f87171;
	--wp--preset--color--warning: #fbbf24;
	--wp--preset--color--inverse: #09090b;

	color-scheme: dark;
}

/* The accent is a burnt orange on light; on dark it lightens, at which point
   white button text loses contrast. Flip to near-black instead. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) .wp-element-button,
	:root:not([data-theme='light']) .devicetest-tool__button.is-primary {
		color: #1a1108;
	}
}

:root[data-theme='dark'] .wp-element-button,
:root[data-theme='dark'] .devicetest-tool__button.is-primary {
	color: #1a1108;
}

/* ===========================================================================
   Base behaviour
   =========================================================================== */

html {
	scroll-behavior: smooth;

	/* Anchor links land under the sticky header without this. */
	scroll-padding-top: 5rem;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

::selection {
	background: var(--wp--preset--color--accent);
	color: #fff;
}

/* Long headings read better balanced than ragged. */
h1,
h2,
h3 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* Respect users who ask for reduced motion — the testers animate a fair amount. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* Visible focus everywhere. Browser defaults get lost against dark surfaces. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
	border-radius: 3px;
}

/* Skip link — hidden until focused. */
.devicetest-skip-link {
	position: absolute;
	top: -100vh;
	left: var(--wp--preset--spacing--30);
	z-index: 999999;
	padding: 0.75rem 1.25rem;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	font-weight: 600;
	text-decoration: none;
	border-radius: 6px;
}

.devicetest-skip-link:focus {
	top: var(--wp--preset--spacing--30);
	clip-path: none;
	width: auto;
	height: auto;
	margin: 0;
	white-space: normal;
}

/* Screen-reader-only helper, matching core's naming so it composes with WP output. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ===========================================================================
   Composition classes used by the homepage patterns
   =========================================================================== */

/* --- Eyebrow: small capitalised label above a heading --------------------- */

.dt-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast-muted);
}

/* --- Header on narrow screens --------------------------------------------- */

/*
 * The header row is a nowrap flex, so at phone widths its contents overflow
 * the viewport: at 375px it asks for roughly 440px once the brand, the menu
 * button, the theme toggle and the CTA are laid out with their gaps.
 *
 * The wordmark is what gives way. It repeats the domain already in the address
 * bar, while the CTA is the only control in the header that does anything and
 * the mark still links home. Kept in the accessibility tree rather than
 * display:none, because the SVG beside it is aria-hidden — this span is the
 * home link's only accessible name, and hiding it outright would leave an
 * unnamed link.
 */
@media (max-width: 35.999em) {
	.dt-brand__word {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
		border: 0;
	}
}

/* Below the CTA's own breakpoint the row is tight enough that the 24px gaps
   are the last thing left to recover. */
@media (max-width: 29.999em) {
	header .wp-block-group.alignwide {
		gap: 0.75rem;
	}
}

/* --- Sibling tool grid ---------------------------------------------------- */

.dt-toolgrid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}

@media (min-width: 34rem) {
	.dt-toolgrid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 60rem) {
	.dt-toolgrid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.dt-toolcard {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-height: 44px;
	padding: 1rem 1.1rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	background: var(--wp--preset--color--base);
	text-decoration: none;
	color: inherit;
	transition:
		border-color 0.15s ease,
		background-color 0.15s ease;
}

.dt-toolcard:hover,
.dt-toolcard:focus-visible {
	border-color: var(--wp--preset--color--accent);
	background: var(--wp--preset--color--surface);
	text-decoration: none;
}

.dt-toolcard__name {
	font-weight: 650;
	letter-spacing: -0.015em;
	color: var(--wp--preset--color--contrast);
}

.dt-toolcard__desc {
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--wp--preset--color--contrast-muted);
}

/* --- Fix cards: the troubleshooting sections ------------------------------ */

.dt-fixcard {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--base);
	height: 100%;
}

.dt-fixcard h3 {
	margin-block-start: 0;
}

/* --- Numbered cause list -------------------------------------------------- */

.dt-causes {
	counter-reset: dt-cause;
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 0.75rem;
}

.dt-causes > li {
	counter-increment: dt-cause;
	position: relative;
	padding: 1rem 1.1rem 1rem 3.25rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	background: var(--wp--preset--color--base);
}

.dt-causes > li::before {
	content: counter(dt-cause);
	position: absolute;
	left: 1.1rem;
	top: 1rem;
	display: grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* --- Feature cards: what the tool checks, quality tips -------------------- */

.dt-feature {
	position: relative;
	padding: var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	background: var(--wp--preset--color--base);
	height: 100%;
}

/* A short accent rule instead of an icon. Carries the eye down the grid
   without inventing eight pieces of decorative artwork. */
.dt-feature::before {
	content: '';
	position: absolute;
	inset-block-start: -1px;
	inset-inline-start: var(--wp--preset--spacing--30);
	width: 2rem;
	height: 3px;
	border-radius: 0 0 3px 3px;
	background: var(--wp--preset--color--accent);
}

.dt-feature > *:first-child {
	margin-block-start: 0;
}

.dt-feature > *:last-child {
	margin-block-end: 0;
}

.dt-feature h3 {
	font-size: 1.0625rem;
	font-weight: 650;
	letter-spacing: -0.018em;
	margin-block-end: 0.4rem;
}

.dt-feature p {
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--wp--preset--color--contrast-muted);
	margin-block: 0;
}

/* --- Trust strip ---------------------------------------------------------- */

/* Sits directly under the tool rather than above it. These are reassurances a
   visitor wants *while deciding whether to grant camera access*, not preamble
   to read before reaching the button. */
.dt-trust {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.7rem 1.5rem;
	margin-block-start: var(--wp--preset--spacing--30);
	padding: 0;
	list-style: none;
}

@media (min-width: 34rem) {
	.dt-trust {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 62rem) {
	.dt-trust {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.dt-trust li {
	display: flex;
	align-items: flex-start;
	gap: 0.55rem;
	font-size: 0.9375rem;
	line-height: 1.45;
	color: var(--wp--preset--color--contrast-muted);
}

.dt-trust li::before {
	content: '';
	flex: none;
	width: 1.05rem;
	height: 1.05rem;
	margin-block-start: 0.12rem;
	border-radius: 50%;
	background: var(--wp--preset--color--live);

	/* Tick drawn with a mask so it takes the background colour and needs no
	   second element or icon font. */
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* --- Answer-first paragraph ----------------------------------------------- */

/* A direct answer to the query, high in the DOM, in the shape search engines
   and AI summarisers lift for a snippet. Placed after the tool rather than
   before it so it earns its position without pushing the button below the
   fold. */
.dt-answer {
	margin-block-start: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--30);
	border-inline-start: 3px solid var(--wp--preset--color--accent);
	border-radius: 0 10px 10px 0;
	background: var(--wp--preset--color--surface);
	font-size: 0.9375rem;
	line-height: 1.65;
	max-width: 68ch;
}

/* --- Card grids ----------------------------------------------------------- */

/*
 * WordPress builds grid layouts with auto-fill, which keeps empty tracks. A
 * section with two cards in a three-track grid therefore renders both at a
 * third of the width with dead space to the right — it reads as a narrower
 * content column even though the container is the same width as everything
 * else.
 *
 * auto-fit collapses the unused track so the cards stretch to fill the row.
 * Grids that already fill every track are unaffected, so this only ever
 * corrects the ragged case.
 *
 * Doubled class for specificity: WordPress emits its rule on a single
 * .wp-container-* class, at the same weight, later in the cascade.
 */
.dt-grid.dt-grid.is-layout-grid {
	grid-template-columns: repeat(auto-fit, minmax(min(21rem, 100%), 1fr));
}

/* --- Post cards: archive, blog index, related ----------------------------- */

.dt-postcard {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.dt-postcard .wp-block-post-featured-image {
	margin: 0;
	overflow: hidden;
	border-radius: 10px;
	background: var(--wp--preset--color--surface);
}

.dt-postcard .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.dt-postcard:hover .wp-block-post-featured-image img {
	transform: scale(1.02);
}

.dt-postcard .wp-block-post-title {
	margin-block: 0.15rem;
	letter-spacing: -0.022em;
	line-height: 1.25;
}

.dt-postcard .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.dt-postcard:hover .wp-block-post-title a {
	color: var(--wp--preset--color--accent);
}

.dt-postcard .wp-block-post-excerpt__excerpt {
	margin-block-start: 0.3rem;
}

/* The category label above each title. post-terms renders links, which would
   otherwise inherit the accent underline and compete with the heading. */
.dt-postcard .wp-block-post-terms a,
.dt-byline a {
	text-decoration: none;
}

.dt-postcard .wp-block-post-terms a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* --- Single post byline --------------------------------------------------- */

.dt-byline {
	font-size: var(--wp--preset--font-size--small);
}

.dt-byline p {
	margin: 0;
}

/* core/post-date renders an empty string when displayType is "modified" and the
   post has never been revised, which would leave the "Updated" label stranded
   with no date after it. Hide the whole pair unless a <time> actually landed. */
.dt-byline__revised:not(:has(time)) {
	display: none;
}

/* --- Single post hero ----------------------------------------------------- */

/*
 * Title, lede, byline and image share one band rather than stacking, so the
 * opening paragraph stays above the fold. The prose track is fixed at the same
 * width the article body uses below, which keeps a single left edge running
 * down the whole page.
 */
.dt-posthead {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

@media (min-width: 62em) {
	.dt-posthead {
		grid-template-columns: minmax(0, 46rem) minmax(0, 1fr);
		gap: var(--wp--preset--spacing--50);
		align-items: center;
	}
}

/* The featured image exists for Discover and social cards, both of which read
   og:image rather than the rendered element — so it only has to establish the
   subject here, not dominate the fold. */
.dt-posthead__figure img {
	width: 100%;
	max-height: 20rem;
	object-fit: cover;
}

/* --- Article with contents sidebar ---------------------------------------- */

/*
 * post-content is its own constrained container, so it caps its direct
 * children. .dt-doc is the only direct child once the contents filter has run,
 * and it needs the full wide track to hold both columns — hence the explicit
 * override. WordPress marks the auto margins !important on constrained
 * children but not max-width, so the margin reset needs the same weight.
 */
.dt-article > .dt-doc {
	max-width: none;
	margin-inline: 0 !important;
}

.dt-doc {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

.dt-doc__body {
	min-inline-size: 0;
}

/* Anchor jumps have to clear the sticky header, or every heading lands
   underneath it. */
.dt-doc__body :where(h2, h3) {
	scroll-margin-block-start: 6rem;
}

.dt-toc__heading {
	margin-block: 0 0.75rem;
}

.dt-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.1rem;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.35;
}

.dt-toc__list a {
	display: block;
	padding: 0.35rem 0 0.35rem 0.85rem;
	border-inline-start: 2px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--contrast-muted);
	text-decoration: none;
	transition:
		color 0.15s ease,
		border-color 0.15s ease;
}

.dt-toc__list a:hover,
.dt-toc__list a:focus-visible {
	color: var(--wp--preset--color--contrast);
	border-inline-start-color: var(--wp--preset--color--contrast-muted);
	text-decoration: none;
}

.dt-toc__list a[aria-current] {
	color: var(--wp--preset--color--contrast);
	border-inline-start-color: var(--wp--preset--color--accent);
}

.dt-toc__l3 a {
	padding-inline-start: 1.6rem;
	font-size: var(--wp--preset--font-size--x-small);
}

/* Narrow screens: a compact panel above the article. Third-level entries drop
   out — at that width the list is for orientation, not an index. */
@media (max-width: 61.999em) {
	.dt-toc {
		padding: var(--wp--preset--spacing--30);
		border: 1px solid var(--wp--preset--color--border);
		border-radius: 10px;
		background: var(--wp--preset--color--surface);
	}

	.dt-toc__l3 {
		display: none;
	}
}

@media (min-width: 62em) {
	.dt-doc {
		grid-template-columns: minmax(0, 46rem) 15rem;
		justify-content: start;
		gap: var(--wp--preset--spacing--50);
		align-items: start;
	}

	/* DOM order is nav-then-body; the grid swaps them back. */
	.dt-toc {
		grid-column: 2;
		grid-row: 1;
		position: sticky;
		inset-block-start: 6rem;
		max-block-size: calc(100vh - 8rem);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.dt-doc__body {
		grid-column: 1;
		grid-row: 1;
	}
}

/*
 * The article body is left-aligned in the wide container so it can sit beside
 * the contents list. Everything else on a post — the closing sections, the
 * previous/next pair — is centred by the constrained layout, which would leave
 * each one starting 200px to the right of the text above it. Pull them back to
 * the same edge and the same measure. Blocks that opt into a wide alignment are
 * left alone: those are meant to span.
 */
.single main > :not([class*='align']),
.single .dt-section > :not([class*='align']) {
	max-width: 46rem;
	margin-inline: 0 !important;
}

/* Longer measure needs a slightly larger face to keep the line comfortable.
   The size lives here rather than on the block because WordPress rewrites a
   block font-size into its own fluid clamp, and that clamp's floor works out
   at 14px — too small to read comfortably on a phone, which is where most of
   this traffic lands. This curve floors at 17px instead. */
.dt-article {
	font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);
	letter-spacing: -0.003em;
}

/* The global heading scale is built for landing pages, where an h2 opens a
   full-width section and has room to shout. Inside an article it competes with
   the h1 — both resolve to 48px at desktop — and flattens the hierarchy. Step
   the whole scale down so the title stays dominant and subheads read as
   waypoints in the text rather than as new pages. */
.dt-article h2 {
	font-size: clamp(1.75rem, 1.55rem + 1vw, 2.125rem);
	line-height: 1.2;
	margin-block-start: 2.25em;
}

.dt-article h3 {
	font-size: clamp(1.3rem, 1.2rem + 0.5vw, 1.5rem);
	line-height: 1.3;
	margin-block-start: 1.8em;
}

.dt-article h4 {
	font-size: 1.125rem;
	margin-block-start: 1.6em;
}

.dt-article > h2:first-child,
.dt-article > h3:first-child {
	margin-block-start: 0;
}

/* --- Screenshots inside a guide ------------------------------------------- */

/* A screenshot of a UI sits on the same white as the page, so without a border
   it bleeds into the text and its edges become ambiguous. */
.dt-shot img {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
}

/* Portrait captures — dialog boxes, mostly — would otherwise run taller than
   the viewport and push the surrounding instructions apart. */
.dt-shot.is-narrow img {
	max-width: min(26rem, 100%);
	margin-inline: auto;
}

.dt-shot figcaption {
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--wp--preset--color--contrast-muted);
	text-align: left;
}

/* --- Section rhythm ------------------------------------------------------- */

/* Consistent air above every section heading, so the page has a predictable
   beat rather than spacing that varies with whatever block came before.

   Doubled selector for specificity: WordPress emits per-block layout rules
   like .wp-container-core-group-is-layout-1 > * { margin-block-start: … } at
   the same (0,1,0) weight, and they land later in the cascade, so a single
   class loses. Repeating the class wins on specificity without !important. */
.dt-section.dt-section {
	margin-block-start: var(--wp--preset--spacing--60);
}

.dt-section > h2:first-child,
.dt-section > .wp-block-heading:first-child {
	margin-block-start: 0;
}

.dt-lede {
	max-width: 60ch;
	color: var(--wp--preset--color--contrast-muted);
}

/* --- FAQ: restyle core/details ------------------------------------------- */

/* Answers are open by default, so these read as cards rather than a stack of
   collapsed rows. Still collapsible — the disclosure remains useful once a
   visitor has found the one they want and wants the rest out of the way. */
.wp-block-details {
	padding: var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	background: var(--wp--preset--color--base);
	height: 100%;
}

.wp-block-details > summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	font-weight: 650;
	font-size: 1.0625rem;
	letter-spacing: -0.018em;
	line-height: 1.35;
	cursor: pointer;
	color: var(--wp--preset--color--contrast);
	list-style-position: outside;
}

.wp-block-details > summary::marker {
	color: var(--wp--preset--color--accent);
}

.wp-block-details > summary:hover {
	color: var(--wp--preset--color--accent);
}

.wp-block-details > *:not(summary) {
	color: var(--wp--preset--color--contrast-muted);
	font-size: 0.9375rem;
	line-height: 1.65;
}

.wp-block-details > *:first-of-type:not(summary) {
	margin-block-start: 0.7rem;
}

.wp-block-details > *:last-child {
	margin-block-end: 0;
}

/* --- Jump navigation ------------------------------------------------------ */

.dt-jump {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.dt-jump a {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	color: var(--wp--preset--color--contrast-muted);
	transition:
		border-color 0.15s ease,
		color 0.15s ease;
}

.dt-jump a:hover,
.dt-jump a:focus-visible {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

/* --- Navigation collapse breakpoint --------------------------------------- */

/*
 * Core collapses the navigation to an overlay below 600px. That suited four
 * top-level items; with five — one of them "Keyboard & mouse" — the inline bar
 * needs about 780px, so between 600 and 780 it wrapped onto three rows and the
 * header grew from 70px to nearly 200.
 *
 * Rather than shorten the labels into uselessness, the collapse point moves up
 * to 900px. Both halves of core's rule have to be reversed: show the toggle
 * again, and re-hide the inline container that core reveals from 600px.
 */
@media (min-width: 600px) and (max-width: 899.98px) {
	.wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

/* --- Footer tool index ---------------------------------------------------- */

/*
 * A grid rather than core columns: nineteen tools in four groups of uneven
 * length, and columns would give each the same width regardless of content and
 * collapse to a single stack on the first narrow breakpoint. auto-fit lets the
 * four groups become two and then one as the room runs out.
 *
 * This is the only place every tool is linked from every page, which is what
 * makes it worth the space.
 */
.dt-footergrid {
	display: grid;
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
}

/* The intro paragraph reads badly at 76rem; the links beside it do not. */
.dt-footerbrand > p {
	max-width: 46ch;
}

/* --- Footer link lists ---------------------------------------------------- */

.dt-footerlinks {
	list-style: none;
	margin: 0.6rem 0 0;
	padding: 0;
	display: grid;
	gap: 0.45rem;
}

.dt-footerlinks a {
	color: var(--wp--preset--color--contrast-muted);
	text-decoration: none;
}

.dt-footerlinks a:hover,
.dt-footerlinks a:focus-visible {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ===========================================================================
   Header and navigation
   =========================================================================== */

.wp-site-blocks > header {
	position: sticky;
	top: 0;
	z-index: 100;
	backdrop-filter: blur(10px);
	background: color-mix(in srgb, var(--wp--preset--color--base) 88%, transparent);
}

@supports not (backdrop-filter: blur(10px)) {
	.wp-site-blocks > header {
		background: var(--wp--preset--color--base);
	}
}

/* Top-level items read as quiet until hovered — the logo and the tool should
   win the first look, not the navigation. */
.wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast-muted);
	text-decoration: none;
	font-weight: 550;
	padding-block: 0.4rem;
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .wp-block-navigation-item__content:focus-visible {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

/* Current page gets a rule beneath it rather than a colour change, so it
   still reads as navigation rather than a link you have not visited. */
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
	box-shadow: inset 0 -2px 0 0 var(--wp--preset--color--accent);
}

/* --- Submenu -------------------------------------------------------------- */

.wp-block-navigation .wp-block-navigation__submenu-container {
	min-width: 15rem;
	padding: 0.4rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--raised);
}

.wp-block-navigation
	.wp-block-navigation__submenu-container
	.wp-block-navigation-item__content {
	padding: 0.55rem 0.7rem;
	border-radius: 7px;
	color: var(--wp--preset--color--contrast);
	font-weight: 500;
}

.wp-block-navigation
	.wp-block-navigation__submenu-container
	.wp-block-navigation-item__content:hover,
.wp-block-navigation
	.wp-block-navigation__submenu-container
	.wp-block-navigation-item__content:focus-visible {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--accent);
}

/* --- Mobile overlay ------------------------------------------------------- */

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	/* 44px touch target — the default icon button is smaller than that. */
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-inline-end: -0.6rem;
	color: var(--wp--preset--color--contrast);
}

.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
}

.wp-block-navigation__responsive-container.is-menu-open
	.wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	padding-block: 0.5rem;
}

/* In the overlay the submenu is always expanded — a nested disclosure inside
   a full-screen menu is one interaction too many on a phone. */
.wp-block-navigation__responsive-container.is-menu-open
	.wp-block-navigation__submenu-container {
	border: 0;
	padding: 0;
	background: transparent;
	box-shadow: none;
}

.wp-block-navigation__responsive-container.is-menu-open
	.wp-block-navigation__submenu-container
	.wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 450;
	color: var(--wp--preset--color--contrast-muted);
	padding-inline-start: 0;
}
