/* ========================================================================== 
   Systems Place design-system ownership layer

   Shared foundations and cross-page responsive contracts live here. The
   earlier theme, atlas, editorial, hero, and block files retain ownership of
   their distinctive compositions; this file is enqueued last so foundations
   have one authoritative source.
   ========================================================================== */

:root {
	/* Brand and cool-neutral palette. */
	--sp-black: #000000;
	--sp-nero: #1c1c1c;
	--sp-white: #ffffff;
	--sp-charcoal: #4a4a4a;
	--sp-gainsboro: #e6e6e6;
	--sp-neutral-50: #f1f1f4;
	--sp-neutral-100: #e4e4e9;
	--sp-neutral-200: #d0d1d7;
	--sp-neutral-300: #bdbdc6;
	--sp-neutral-400: #a0a0aa;
	--sp-neutral-500: #8a8a94;
	--sp-neutral-600: #686876;
	--sp-neutral-700: #585864;
	--sp-neutral-800: #484857;
	--sp-neutral-850: #3b3b4a;
	--sp-neutral-900: #30303d;
	--sp-neutral-950: #282733;
	--sp-base: var(--sp-white);
	--sp-contrast: var(--sp-black);

	/* Semantic colour roles. */
	--bg: var(--sp-base);
	--bg-elev: #fafafb;
	--bg-muted: var(--sp-neutral-50);
	--bg-inset: var(--sp-gainsboro);
	--bg-invert: var(--sp-contrast);
	--fg: var(--sp-nero);
	--fg-muted: var(--sp-charcoal);
	--fg-soft: var(--sp-neutral-600);
	--fg-faint: var(--sp-neutral-400);
	--fg-invert: var(--sp-white);
	--border: var(--sp-gainsboro);
	--border-strong: var(--sp-neutral-300);
	--border-invert: var(--sp-neutral-800);
	--accent: var(--sp-black);
	--accent-hover: var(--sp-neutral-900);
	--accent-press: var(--sp-nero);
	--accent-fg: var(--sp-white);
	--bg-disabled: var(--sp-neutral-100);
	--fg-disabled: var(--sp-neutral-400);
	--status-success: #2e7d5b;
	--status-warning: #b98326;
	--status-danger: #b53b3b;
	--status-info: var(--sp-neutral-700);

	/* Type roles. B612 remains a sans display face. */
	--font-display: "B612", "Helvetica Neue", "Arial Nova", Arial, sans-serif;
	--font-sans: "Montserrat", "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--font-mono: "B612 Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	--wp--preset--font-family--heading: var(--font-sans);
	--fs-xs: .75rem;
	--fs-sm: .875rem;
	--fs-base: 1rem;
	--fs-md: 1.125rem;
	--fs-lg: 1.25rem;
	--fs-xl: 1.5rem;
	--fs-2xl: 2rem;
	--fs-3xl: 2.5rem;
	--fs-4xl: 3.25rem;
	--fs-5xl: 4.5rem;
	--fs-display: 6rem;
	--lh-tight: 1.04;
	--lh-snug: 1.2;
	--lh-normal: 1.45;
	--lh-loose: 1.65;
	--fw-regular: 400;
	--fw-medium: 500;
	--fw-semibold: 600;
	--fw-bold: 700;
	--tracking-tighter: -.03em;
	--tracking-tight: -.02em;
	--tracking-snug: -.01em;
	--tracking-normal: 0;
	--tracking-wide: .04em;
	--tracking-wider: .16em;

	/* Spacing, shape, elevation, focus, controls, and motion. */
	--space-0: 0;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 20px;
	--space-6: 24px;
	--space-8: 32px;
	--space-10: 40px;
	--space-12: 48px;
	--space-16: 64px;
	--space-20: 80px;
	--space-24: 96px;
	--space-32: 128px;
	--radius-none: 0;
	--radius-xs: 2px;
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 12px;
	--radius-card: 16px;
	--radius-xl: 20px;
	--radius-panel: 28px;
	--radius-pill: 999px;
	--shadow-hairline: 0 0 0 1px rgba(28, 28, 28, .08);
	--shadow-xs: 0 1px 0 rgba(28, 28, 28, .04);
	--shadow-sm: 0 1px 2px rgba(28, 28, 28, .06), 0 1px 1px rgba(28, 28, 28, .04);
	--shadow-md: 0 4px 12px rgba(28, 28, 28, .08), 0 1px 2px rgba(28, 28, 28, .04);
	--shadow-lg: 0 12px 28px rgba(28, 28, 28, .10), 0 4px 8px rgba(28, 28, 28, .05);
	--shadow-xl: 0 24px 48px rgba(28, 28, 28, .14), 0 8px 16px rgba(28, 28, 28, .06);
	--shadow-inner: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -1px 0 rgba(0, 0, 0, .04);
	--ring-focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg);
	--control-h-sm: 32px;
	--control-h-md: 40px;
	--control-h-lg: 48px;
	--control-pad-x: 16px;
	--control-gap: 8px;
	--ease-out: cubic-bezier(.16, 1, .3, 1);
	--ease-in-out: cubic-bezier(.65, 0, .35, 1);
	--dur-fast: 120ms;
	--dur-base: 200ms;
	--dur-slow: 400ms;
	--dur-slower: 600ms;
}

:where(.sp-section-dark, .sp-dark, .sp-cta-band, .sp-footer, [data-sp-theme="dark"]) {
	--bg: var(--sp-black);
	--bg-elev: var(--sp-nero);
	--bg-muted: var(--sp-neutral-950);
	--bg-inset: var(--sp-neutral-900);
	--bg-invert: var(--sp-white);
	--fg: var(--sp-white);
	--fg-muted: var(--sp-neutral-200);
	--fg-soft: var(--sp-neutral-400);
	--fg-faint: var(--sp-neutral-600);
	--fg-invert: var(--sp-nero);
	--border: var(--sp-neutral-800);
	--border-strong: var(--sp-neutral-700);
	--border-invert: var(--sp-neutral-300);
	--accent: var(--sp-white);
	--accent-hover: var(--sp-neutral-100);
	--accent-press: var(--sp-neutral-200);
	--accent-fg: var(--sp-black);
	--bg-disabled: var(--sp-neutral-900);
	--fg-disabled: var(--sp-neutral-600);
}

::selection {
	background: var(--sp-nero);
	color: var(--sp-white);
}

.wp-site-blocks h1,
.wp-site-blocks h2,
.editor-styles-wrapper h1,
.editor-styles-wrapper h2 {
	font-family: var(--font-display);
}

.wp-site-blocks h3,
.wp-site-blocks h4,
.wp-site-blocks h5,
.editor-styles-wrapper h3,
.editor-styles-wrapper h4,
.editor-styles-wrapper h5 {
	font-family: var(--font-sans);
}

.sp-eyebrow,
.sp-footer__col-title,
.sp-post-card__date {
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	font-weight: var(--fw-regular);
	letter-spacing: var(--tracking-wider);
	line-height: 1;
	text-transform: uppercase;
}

:where(a, button, input, textarea, select, summary, [tabindex], .wp-block-button__link):focus-visible {
	outline: 0;
	box-shadow: var(--ring-focus) !important;
}

/* Firefox exposes keyboard-scrollable overflow regions in the tab order even
   without a tabindex attribute. Keep that browser-provided stop visible. */
.wp-block-navigation__responsive-container-content:focus-visible {
	outline: 0;
	box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 4px var(--fg) !important;
}

/* Keep the unfocused skip link completely outside the viewport even though
   its focused position sits below the opaque header. */
.sp-skip-link {
	transform: translateY(calc(-100% - 100px));
}

.sp-skip-link:focus-within {
	transform: none;
}

/* A sticky header must remain opaque over dense page evidence. */
.sp-site-header {
	background: var(--sp-white);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

/* Canonical action states. Component files own composition; this owns state. */
.wp-site-blocks .wp-block-button > .wp-block-button__link,
.editor-styles-wrapper .wp-block-button > .wp-block-button__link {
	min-height: var(--control-h-md);
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: var(--radius-md);
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
	letter-spacing: var(--tracking-wide);
	line-height: 1.2;
	transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.wp-site-blocks .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link,
.editor-styles-wrapper .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link {
	border-color: transparent;
	background: var(--accent);
	color: var(--accent-fg);
}

.wp-site-blocks .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link:hover,
.editor-styles-wrapper .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link:hover {
	background: var(--accent-hover);
	color: var(--accent-fg);
}

.wp-site-blocks .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link:active,
.editor-styles-wrapper .wp-block-button:not(.is-style-outline):not(.sp-btn--tertiary):not(.sp-btn--ghost) > .wp-block-button__link:active {
	background: var(--accent-press);
}

.wp-site-blocks .wp-block-button.is-style-outline > .wp-block-button__link,
.editor-styles-wrapper .wp-block-button.is-style-outline > .wp-block-button__link {
	border-color: var(--fg);
	background: transparent;
	color: var(--fg);
}

.wp-site-blocks .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.editor-styles-wrapper .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	border-color: var(--fg);
	background: var(--fg);
	color: var(--bg);
}

.wp-site-blocks .wp-block-button.is-style-outline > .wp-block-button__link:active,
.editor-styles-wrapper .wp-block-button.is-style-outline > .wp-block-button__link:active {
	border-color: var(--fg-muted);
	background: var(--fg-muted);
	color: var(--bg);
}

.wp-site-blocks .wp-block-button.sp-btn--tertiary > .wp-block-button__link,
.editor-styles-wrapper .wp-block-button.sp-btn--tertiary > .wp-block-button__link {
	border-color: transparent;
	background: var(--bg-muted);
	color: var(--fg);
}

.wp-site-blocks .wp-block-button.sp-btn--tertiary > .wp-block-button__link:hover,
.editor-styles-wrapper .wp-block-button.sp-btn--tertiary > .wp-block-button__link:hover {
	background: var(--bg-inset);
}

.wp-site-blocks .wp-block-button.sp-btn--tertiary > .wp-block-button__link:active,
.editor-styles-wrapper .wp-block-button.sp-btn--tertiary > .wp-block-button__link:active {
	background: var(--sp-neutral-200);
}

.wp-site-blocks .wp-block-button.sp-btn--ghost > .wp-block-button__link,
.editor-styles-wrapper .wp-block-button.sp-btn--ghost > .wp-block-button__link {
	border-color: transparent;
	background: transparent;
	color: var(--fg);
}

.wp-site-blocks .wp-block-button.sp-btn--ghost > .wp-block-button__link:hover,
.editor-styles-wrapper .wp-block-button.sp-btn--ghost > .wp-block-button__link:hover {
	background: var(--bg-muted);
}

.wp-site-blocks .wp-block-button.sp-btn--ghost > .wp-block-button__link:active,
.editor-styles-wrapper .wp-block-button.sp-btn--ghost > .wp-block-button__link:active {
	background: var(--bg-inset);
}

.wp-site-blocks .wp-block-button > .wp-block-button__link:is([aria-disabled="true"], :disabled),
.editor-styles-wrapper .wp-block-button > .wp-block-button__link:is([aria-disabled="true"], :disabled) {
	border-color: transparent;
	background: var(--bg-disabled);
	color: var(--fg-disabled);
	cursor: not-allowed;
	pointer-events: none;
}

/* Editorial labels stay legible without enlarging the atlas micro-diagrams. */
.sp-service-comparison .sp-card__meta,
.sp-service-comparison .sp-tag {
	min-width: 0;
	max-width: 100%;
}

.sp-service-comparison .sp-tag {
	display: block;
	box-sizing: border-box;
	line-height: var(--lh-normal);
	overflow-wrap: anywhere;
	white-space: normal;
}

.sp-card__index,
.sp-question-grid .sp-tag,
.sp-receipt__bar,
.sp-receipt__label,
.sp-receipt__foot,
.sp-flow__meta,
.sp-arch__verbs li,
.sp-flow--question-contract .sp-flow__node::after {
	font-size: var(--fs-xs);
}

.sp-odh__caption {
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	font-weight: var(--fw-regular);
	letter-spacing: var(--tracking-wider);
	line-height: 1;
}

/* Post Template blocks wrap each card in a grid item. Stretch the shared
   Insight card inside that wrapper so the ledger background only forms the
   sanctioned one-pixel dividers, even when excerpts differ in length. */
.sp-post-list > .wp-block-post {
	display: flex;
	min-width: 0;
}

.sp-post-list > .wp-block-post > .sp-post-card {
	box-sizing: border-box;
	flex: 1 1 auto;
	width: 100%;
}

/* A trailing odd Insight becomes one deliberate wide feature, not a gap. */
@media (min-width: 641px) and (max-width: 900px) {
	.sp-post-list > :last-child:nth-child(odd),
	.sp-card-grid--3 > :last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
}

@media (min-width: 901px) {
	.sp-post-list > :last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}

	.sp-post-list > :last-child:nth-child(odd) .sp-post-card {
		display: grid;
		grid-template-columns: minmax(10rem, .38fr) minmax(0, 1.62fr);
		grid-template-rows: auto auto;
		column-gap: clamp(2rem, 5vw, 5rem);
		row-gap: 1rem;
		align-content: center;
		min-height: 14rem;
	}

	.sp-post-list > :last-child:nth-child(odd) .sp-post-card__date {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.sp-post-list > :last-child:nth-child(odd) .wp-block-post-title,
	.sp-post-list > :last-child:nth-child(odd) .wp-block-post-excerpt {
		grid-column: 2;
	}
}

/* Fixed column counts step down before cards become cramped. */
@media (min-width: 901px) and (max-width: 1180px) {
	.sp-card-grid--3,
	.sp-card-grid--4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 641px) and (max-width: 900px) {
	.sp-card-grid--2,
	.sp-card-grid--3,
	.sp-card-grid--4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Full table on desktop, labelled record cards on phones and small tablets. */
@media (min-width: 1181px) {
	.sp-compatibility-table table {
		min-width: 0;
	}

	.sp-compatibility-table :is(th, td) {
		font-size: var(--fs-sm);
	}

	.sp-compatibility-table thead th {
		font-size: var(--fs-xs);
	}
}

@media (max-width: 780px) {
	.sp-compatibility-table {
		overflow: visible;
		border: 0;
		background: transparent;
		box-shadow: none;
	}

	.sp-compatibility-table table,
	.sp-compatibility-table tbody {
		display: block;
		min-width: 0;
		width: 100%;
	}

	.sp-compatibility-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
		border: 0;
	}

	.sp-compatibility-table tbody {
		display: grid;
		gap: var(--space-4);
	}

	.sp-compatibility-table tbody tr {
		display: block;
		overflow: hidden;
		border: 1px solid var(--border);
		border-radius: var(--radius-lg);
		background: var(--bg);
		box-shadow: var(--shadow-xs);
	}

	.sp-compatibility-table tbody th {
		display: block;
		box-sizing: border-box;
		width: auto;
		padding: var(--space-4);
		border: 0;
		background: var(--sp-black);
		color: var(--sp-white);
		font-family: var(--font-sans);
		font-size: var(--fs-base);
		line-height: var(--lh-normal);
	}

	.sp-compatibility-table tbody td {
		display: block;
		box-sizing: border-box;
		padding: var(--space-4);
		border: 0;
		border-bottom: 1px solid var(--border);
		font-size: var(--fs-sm);
		line-height: var(--lh-normal);
	}

	.sp-compatibility-table tbody td:last-child {
		border-bottom: 0;
	}

	.sp-compatibility-table tbody td::before {
		display: block;
		margin-bottom: var(--space-2);
		color: var(--fg-soft);
		font-family: var(--font-mono);
		font-size: var(--fs-xs);
		font-weight: var(--fw-regular);
		letter-spacing: var(--tracking-wider);
		line-height: var(--lh-normal);
		text-transform: uppercase;
	}

	.sp-compatibility-table tbody td:nth-of-type(1)::before {
		content: "Surface and administration";
	}

	.sp-compatibility-table tbody td:nth-of-type(2)::before {
		content: "Connection and authentication";
	}

	.sp-compatibility-table tbody td:nth-of-type(3)::before {
		content: "Network constraint";
	}

	.sp-compatibility-table tbody td:nth-of-type(4)::before {
		content: "Limitations and status";
	}
}

/* The compact mobile and small-tablet footer keeps two balanced link columns
   and full targets without becoming a second page on short templates. */
@media (max-width: 780px) {
	.sp-skip-link {
		top: calc(64px + var(--space-3));
	}

	.sp-footer {
		padding-top: var(--space-8);
		padding-bottom: var(--space-5);
	}

	.sp-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-6) var(--space-5);
		padding-bottom: var(--space-6);
	}

	.sp-footer__col--start {
		grid-column: 1 / -1;
		padding-right: 0;
	}

	.sp-footer__col-title {
		margin-bottom: var(--space-2);
	}

	.sp-footer__links {
		gap: var(--space-1);
	}

	.sp-footer__links a {
		min-height: 44px;
		font-size: var(--fs-xs);
		line-height: var(--lh-normal);
	}

	.sp-footer__col--start .sp-footer__links {
		max-width: none;
	}

	.sp-footer__meta {
		gap: var(--space-2) var(--space-4);
		padding-top: var(--space-4);
	}

	.sp-footer__meta > * {
		flex: 1 1 100%;
		margin-block: 0;
	}
}

/* Search pagination is a keyboard path, not microcopy. Every link keeps the
   canonical minimum target while the group can wrap cleanly at 320px. */
.wp-block-query-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-8);
}

.wp-block-query-pagination-numbers {
	display: inline-flex;
	flex-wrap: wrap;
	gap: var(--space-1);
	margin: 0;
}

.wp-block-query-pagination :is(a, .page-numbers) {
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
	line-height: 1.2;
	text-decoration: none;
}

.wp-block-query-pagination a:hover,
.wp-block-query-pagination .page-numbers.current {
	border-color: var(--fg);
	background: var(--fg);
	color: var(--bg);
}

@media (min-width: 601px) {
	.sp-skip-link {
		top: calc(72px + var(--space-3));
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
