/*
Theme Name: DRV Solutions
Theme URI: https://drv-solutions.com/
Author: DRV Solutions BV
Description: Block theme for DRV Solutions BV – rare-earth-free motors and engineering services. Designed for use with the DRV Core plugin.
Version: 1.0.11
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 8.3
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: drv-theme
*/

/*
 * Only what theme.json cannot express. Colours, fonts, sizes and spacing come from the
 * theme.json presets (--wp--preset--*); keep it that way.
 */

/*
 * Context colours. Navy is the default; light sections (paper) and white cards switch them,
 * a navy box inside a light section switches them back. Components only use these variables,
 * so the same block looks right on either background.
 */
:root,
.is-style-navy-box {
	--drv-text: var(--wp--preset--color--light);
	--drv-muted: var(--wp--preset--color--light-muted);
	--drv-subtle: var(--wp--preset--color--light-subtle);
	--drv-accent: var(--wp--preset--color--copper);
	--drv-line: var(--wp--preset--color--line-dark);
	--drv-line-strong: rgba(255, 255, 255, 0.12);
	--drv-card: var(--wp--preset--color--navy-card);
	--drv-input: var(--wp--preset--color--navy-card);
	--drv-input-border: rgba(255, 255, 255, 0.35);
	--drv-chip: transparent;
	--drv-chip-border: rgba(255, 255, 255, 0.22);
	--drv-focus: var(--wp--preset--color--copper);
	--drv-error: #ffb4a9;
	--drv-slant: 64px;
}

/* Light sections switch the accent and hairline colours for contrast. */
.is-style-section-paper,
.is-style-section-paper-slant {
	--drv-text: var(--wp--preset--color--navy);
	--drv-muted: var(--wp--preset--color--ink-muted);
	--drv-subtle: var(--wp--preset--color--ink-subtle);
	--drv-accent: var(--wp--preset--color--copper-dark);
	--drv-line: var(--wp--preset--color--line-light);
	--drv-line-strong: var(--wp--preset--color--line-light);
	--drv-card: var(--wp--preset--color--white);
	--drv-input: var(--wp--preset--color--white);
	--drv-input-border: var(--wp--preset--color--input-border);
	--drv-chip: var(--wp--preset--color--tint);
	--drv-chip-border: transparent;
	--drv-focus: var(--wp--preset--color--navy);
	--drv-error: #b42318;
}

.is-style-navy-box {
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--light);
	--drv-slant: 64px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

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

/* Focus: always visible, never colour alone. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--drv-focus);
	outline-offset: 3px;
	border-radius: 2px;
}

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

/* Slanted top edge ("/", white side on the right) for light sections that follow navy. */
.is-style-section-paper-slant {
	clip-path: polygon(0 var(--drv-slant), 100% 0, 100% 100%, 0 100%);
	margin-top: -1px;
}

.is-style-section-paper-slant::before {
	content: "";
	display: block;
	height: var(--drv-slant);
}

.is-style-section-band {
	border-top: 1px solid var(--wp--preset--color--line-dark);
	border-bottom: 1px solid var(--wp--preset--color--line-dark);
}

.is-style-eyebrow {
	color: var(--drv-accent);
}

/* Template-level sections sit flush against each other. */
.wp-site-blocks > *,
main > .wp-block-post-content > .alignfull,
main > .alignfull {
	margin-block-start: 0;
}

/* ---------- Buttons ---------- */

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	text-decoration: none;
}

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

/*
 * Sticky header (decided 2 Nov 2026). --drv-header-height is the header's rendered height per
 * breakpoint: scroll-padding keeps anchor targets and keyboard focus clear of it (WCAG 2.4.11).
 * Below 600 px the admin bar scrolls away, so the header sticks to the very top there.
 */
:root {
	--drv-header-height: 94px;
	--drv-header-top: var(--wp-admin--admin-bar--height, 0px);
}

html {
	scroll-padding-top: calc(var(--drv-header-top) + var(--drv-header-height) + 8px);
}

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--drv-header-top);
	z-index: 100;
	background-color: var(--wp--preset--color--navy);
}

/* Phones held sideways: too little height to spare, so the header scrolls away again. */
@media (max-height: 500px) {
	.wp-site-blocks > header.wp-block-template-part {
		position: static;
	}

	html {
		scroll-padding-top: 0;
	}
}

.drv-site-header {
	border-bottom: 1px solid var(--wp--preset--color--line-dark);
}

.drv-site-header .drv-logo {
	margin: 0;
	flex-shrink: 0;
}

.drv-site-header .drv-logo a,
.drv-site-header .drv-logo img {
	display: block;
}

.drv-site-header .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	text-decoration: none;
}

.drv-site-header .wp-block-navigation-item__content[aria-current="page"],
.drv-site-header .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--copper);
}

.drv-site-header .wp-block-button__link {
	min-height: 44px;
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	color: var(--wp--preset--color--light);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	--navigation-layout-justification-setting: flex-start;
	--navigation-layout-justify: flex-start;
	align-items: flex-start;
	padding-top: 24px;
}

.wp-block-navigation__responsive-container.is-menu-open :is(.wp-block-navigation__container, .wp-block-navigation-item) {
	--navigation-layout-justification-setting: flex-start;
	align-items: flex-start;
	text-align: left;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--lead);
}

/*
 * Below 900 px the full menu no longer fits beside the logo and wraps onto extra rows, too tall
 * for a sticky header. Logo, datasheet button and menu button stay on one row instead; core only
 * collapses the menu below 600 px, so 600–899 px is collapsed here.
 */
@media (min-width: 600px) and (max-width: 899px) {
	.drv-site-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.drv-site-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
}

@media (max-width: 899px) {
	.drv-site-header .drv-header-actions {
		gap: 8px;
	}

	.drv-site-header .drv-header-actions .wp-block-buttons {
		order: -1;
	}
}

/* Phones: smaller logo and button to keep that row within 360 px. */
@media (max-width: 599px) {
	:root {
		--drv-header-height: 74px;
		--drv-header-top: 0px;
	}

	.drv-site-header .drv-logo img {
		width: 96px !important;
		height: auto !important;
	}

	.drv-site-header .wp-block-button__link {
		padding-left: 12px;
		padding-right: 12px;
	}
}

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

.drv-site-footer {
	border-top: 1px solid var(--wp--preset--color--line-dark);
}

.drv-site-footer p {
	margin: 0;
}

.drv-footer-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0 24px;
}

.drv-footer-links a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

/* ---------- Long-form text (privacy policy, legal pages) ---------- */

.drv-prose {
	color: var(--wp--preset--color--ink-body);
	line-height: 1.6;
}

.drv-prose td strong {
	font-weight: 600;
}

.drv-prose > * + * {
	margin-block-start: 14px;
}

.drv-prose :where(h2, h3, strong, th) {
	color: var(--wp--preset--color--navy);
}

.drv-prose h2 {
	font-size: 26px;
	line-height: 1.2;
	letter-spacing: 0;
}

.drv-prose > * + h2 {
	margin-block-start: 48px;
}

.drv-prose h3 {
	font-size: 19px;
	line-height: 1.3;
}

.drv-prose > * + h3 {
	margin-block-start: 22px;
}

.drv-prose :where(ul, ol) {
	padding-left: 22px;
}

.drv-prose li + li {
	margin-top: 6px;
}

.drv-prose :where(h2, h3)[id] {
	scroll-margin-top: 24px;
}

/* "On this page" index beside the text; stacks above it on narrow screens. */
.drv-toc-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 48px 80px;
}

.drv-toc-layout > .drv-toc {
	flex: 1 1 220px;
	margin: 0;
}

.drv-toc-layout > .drv-prose {
	flex: 999 1 640px;
	min-width: 0;
	max-width: 760px;
	margin: 0;
}

.drv-toc .is-style-eyebrow {
	letter-spacing: 0.08em;
	margin: 0 0 6px;
}

.drv-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: var(--wp--preset--font-size--small);
}

.drv-toc-list a {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	color: var(--wp--preset--color--navy);
	text-decoration: none;
}

.drv-toc-list a:hover {
	color: var(--wp--preset--color--copper-dark);
	text-decoration: underline;
}

@media (pointer: coarse) {
	.drv-toc-list a {
		min-height: 44px;
	}
}

/* Label/value grid (e.g. company details), hairlines between cells. */
.drv-details {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1px;
	background: var(--drv-line);
	border: 1px solid var(--drv-line);
	border-radius: 4px;
	overflow: hidden;
}

.drv-details > .drv-details__item {
	margin: 0;
	padding: 14px 16px;
	background: var(--wp--preset--color--white);
}

.drv-details__item p {
	margin: 0;
}

.drv-details__label {
	font-size: var(--wp--preset--font-size--caption);
	color: var(--wp--preset--color--ink-subtle);
}

.drv-details__value {
	font-weight: 600;
	color: var(--wp--preset--color--navy);
}

/* Postal address box. */
.drv-address {
	padding: 16px 20px;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--drv-line);
	border-radius: 4px;
}

/* Tables: white card with hairlines. */
.wp-block-table {
	overflow-x: auto;
	border: 1px solid var(--drv-line);
	border-radius: 4px;
}

.is-style-section-paper .wp-block-table,
.is-style-section-paper-slant .wp-block-table {
	background: var(--wp--preset--color--white);
}

.wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--compact);
}

.wp-block-table th,
.wp-block-table td {
	padding: 12px 16px;
	border: 0;
	text-align: left;
	vertical-align: top;
}

.wp-block-table thead,
.wp-block-table tfoot {
	border-bottom: 0;
}

.wp-block-table thead th {
	background: var(--wp--preset--color--tint);
}

.wp-block-table tbody tr {
	border-top: 1px solid var(--drv-line);
}

/* Text for screen readers only (e.g. "(opens LinkedIn)"). */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
