/* ==========================================================================
   open-hw Datasheet — main stylesheet
   GPL-3.0-or-later · open-hw.net
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------ */
:root {
	--paper: #ffffff;
	--panel: #f2f4f7;
	--ink: #111827;
	--ink-2: #374151;
	--muted: #4b5563;
	--rule: #d0d5dd;
	--rule-strong: #111827;
	--link: #1d4ed8;
	--link-hover: #1e3a8a;
	--focus: #1d4ed8;

	/* Overridden by the Customizer accent colour (inline CSS). */
	--openhw-accent: #c2410c;
	--openhw-accent-hover: #a7380a;
	--openhw-on-accent: #ffffff;

	--font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

	--step--1: 0.875rem;
	--step-0: 1.0625rem;
	--step-1: 1.25rem;
	--step-2: 1.5625rem;
	--step-3: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
	--step-4: clamp(2rem, 1.35rem + 2.6vw, 3rem);

	--max: 72rem;
	--measure: 42rem;
	--gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
	--radius: 4px;
	--header-h: 4rem;
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: 1rem;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: var(--step-0);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
canvas,
iframe { max-width: 100%; }

img,
video { height: auto; }

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 0.5em;
	font-weight: 700;
	line-height: 1.2;
	color: var(--ink);
	text-wrap: balance;
}

p,
ul,
ol,
dl,
figure,
blockquote,
pre,
table { margin: 0 0 1.25rem; }

a {
	color: var(--link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

hr {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: 2.5rem 0;
}

::selection { background: #dbe4ff; color: var(--ink); }

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.skip-link:focus {
	clip: auto;
	clip-path: none;
	height: auto;
	width: auto;
	margin: 0;
	left: 1rem;
	top: 1rem;
	z-index: 1000;
	padding: 0.75rem 1rem;
	background: var(--ink);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.site-main {
	flex: 1 0 auto;
	overflow-x: hidden; /* contains .alignfull bleed */
}

.site-main:focus { outline: none; }

.container {
	width: 100%;
	max-width: calc(var(--max) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.icon {
	flex: none;
	width: 1.1em;
	height: 1.1em;
}

/* ---- Buttons ----------------------------------------------------------- */
.button,
.wp-block-button__link,
.wp-block-search__button,
input[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-height: 2.75rem;
	padding: 0.625rem 1.25rem;
	border: 2px solid var(--ink);
	border-radius: var(--radius);
	background: var(--ink);
	color: #fff;
	font-family: var(--font-sans);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.button:hover,
.wp-block-button__link:hover,
.wp-block-search__button:hover,
input[type="submit"]:hover {
	background: var(--ink-2);
	border-color: var(--ink-2);
	color: #fff;
	text-decoration: none;
}

.button--accent,
.wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background) {
	background: var(--openhw-accent);
	border-color: var(--openhw-accent);
	color: var(--openhw-on-accent);
}

.button--accent:hover,
.wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background):hover {
	background: var(--openhw-accent-hover);
	border-color: var(--openhw-accent-hover);
	color: var(--openhw-on-accent);
}

.button--outline,
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--ink);
	border-color: var(--ink);
}

.button--outline:hover,
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--ink);
	color: #fff;
}

/* ---- Forms ------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
select,
textarea {
	width: 100%;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid #98a2b3;
	border-radius: var(--radius);
	background: #fff;
	color: var(--ink);
	font: inherit;
	font-size: 1rem;
}

textarea { min-height: 8rem; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 0;
	border-color: var(--focus);
}

label { font-weight: 600; }

.search-form {
	display: flex;
	gap: 0.5rem;
	max-width: 28rem;
}

.search-form__input { flex: 1 1 auto; min-width: 0; }

/* ---- Header ------------------------------------------------------------ */
.site-header {
	background: var(--paper);
	border-bottom: 2px solid var(--rule-strong);
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 2rem;
	min-height: var(--header-h);
}

.site-header__brand {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	min-width: 0;
}

.site-brand,
.custom-logo-link {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding-block: 0.5rem;
	color: var(--ink);
	text-decoration: none;
}

.site-brand:hover { color: var(--ink); }

.openhw-logo { display: block; flex: none; }
.site-brand .openhw-logo--lockup { height: 1.9rem; width: auto; }
.site-brand .openhw-logo--mark { height: 2rem; width: auto; }

.site-brand__name {
	font-family: var(--font-mono);
	font-weight: 600;
	font-size: 1.125rem;
}

.custom-logo { display: block; max-height: 2.5rem; width: auto; }

/* Primary nav */
.site-nav {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.site-nav .menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav li { position: relative; }

.site-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: 0.9375rem;
	text-decoration: none;
}

.site-nav a:hover { color: var(--link); text-decoration: underline; }

.site-nav .current-menu-item > a,
.site-nav .current_page_item > a,
.site-nav .current-menu-ancestor > a {
	box-shadow: inset 0 -3px 0 var(--openhw-accent);
}

/* Submenus (desktop: dropdown on hover/focus) */
.site-nav .sub-menu,
.site-nav .children {
	margin: 0;
	padding: 0.375rem 0;
	list-style: none;
}

.site-nav__search {
	display: flex;
	align-items: center;
	border: 1px solid #98a2b3;
	border-radius: var(--radius);
	background: #fff;
}

.site-nav__search input[type="search"] {
	width: 9rem;
	min-height: 2.5rem;
	border: 0;
	padding: 0.375rem 0.625rem;
	background: transparent;
	font-size: 0.9375rem;
}

.site-nav__search input[type="search"]:focus-visible { outline: none; }
.site-nav__search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }

.site-nav__search button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	min-height: 2.5rem;
	border: 0;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}

/* Menu toggle (mobile) */
.menu-toggle {
	display: none;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.75rem;
	min-width: 2.75rem;
	padding: 0 0.75rem;
	border: 2px solid var(--ink);
	border-radius: var(--radius);
	background: transparent;
	color: var(--ink);
	font: 600 0.9375rem var(--font-mono);
	cursor: pointer;
}

.menu-toggle__close { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__close { display: inline; }

@media (min-width: 60.001em) {
	.site-nav .menu-item-has-children > a::after,
	.site-nav .page_item_has_children > a::after {
		content: "";
		width: 0.4em;
		height: 0.4em;
		margin-left: 0.45em;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		transform: translateY(-0.15em) rotate(45deg);
	}

	.site-nav .sub-menu,
	.site-nav .children {
		position: absolute;
		top: 100%;
		left: -0.75rem;
		z-index: 50;
		min-width: 13rem;
		background: var(--paper);
		border: 2px solid var(--ink);
		visibility: hidden;
		opacity: 0;
	}

	.site-nav li:hover > .sub-menu,
	.site-nav li:focus-within > .sub-menu,
	.site-nav li:hover > .children,
	.site-nav li:focus-within > .children {
		visibility: visible;
		opacity: 1;
	}

	.site-nav .sub-menu a,
	.site-nav .children a {
		display: flex;
		padding: 0 0.875rem;
	}
}

@media (max-width: 60em) {
	.menu-toggle { display: inline-flex; }

	.site-nav {
		display: none;
		flex: 1 0 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
		padding: 0.5rem 0 1.25rem;
		border-top: 1px solid var(--rule);
	}

	.site-nav.is-open,
	.no-js .site-nav { display: flex; }

	.no-js .menu-toggle { display: none; }

	.site-nav .menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.site-nav .menu > li { border-bottom: 1px solid var(--rule); }

	.site-nav a { display: flex; min-height: 3rem; }

	.site-nav .sub-menu,
	.site-nav .children { padding: 0 0 0.5rem 1rem; }

	.site-nav .current-menu-item > a,
	.site-nav .current_page_item > a { box-shadow: inset 3px 0 0 var(--openhw-accent); padding-left: 0.75rem; }

	.site-nav__search input[type="search"] { width: 100%; }
}

/* ---- Title block (signature element) ------------------------------------ */
.title-block {
	width: 100%;
	margin: 0;
	border: 2px solid var(--ink);
	border-collapse: collapse;
	background: var(--paper);
	font-family: var(--font-mono);
	font-size: 0.875rem;
	line-height: 1.35;
}

.title-block th,
.title-block td {
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--ink);
	text-align: left;
	vertical-align: top;
}

.title-block tr:last-child th,
.title-block tr:last-child td { border-bottom: 0; }

.title-block th {
	width: 7.5rem;
	border-right: 1px solid var(--ink);
	color: var(--muted);
	font-weight: 400;
}

.title-block td {
	font-weight: 600;
	overflow-wrap: anywhere;
}

/* ---- Hero -------------------------------------------------------------- */
.hero { border-bottom: 1px solid var(--rule); }

.hero__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
	gap: 2.5rem 4rem;
	align-items: start;
	padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
}

.hero__kicker {
	margin-bottom: 0.75rem;
	color: var(--openhw-accent);
	font-family: var(--font-mono);
	font-size: 0.9375rem;
	font-weight: 600;
}

.hero__title {
	max-width: 18ch;
	margin-bottom: 1rem;
	font-size: var(--step-4);
	letter-spacing: -0.015em;
	line-height: 1.08;
}

.hero__lead {
	max-width: 38rem;
	margin-bottom: 1.75rem;
	color: var(--ink-2);
	font-size: var(--step-1);
	line-height: 1.5;
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.5rem;
}

.hero__link { font-weight: 600; }

@media (max-width: 52em) {
	.hero__inner { grid-template-columns: minmax(0, 1fr); }
	.hero__block { max-width: 26rem; }
}

/* ---- Sections & lists -------------------------------------------------- */
.section { padding-block: clamp(2rem, 1.25rem + 3vw, 3.5rem); }

.section--panel {
	background: var(--panel);
	border-bottom: 1px solid var(--rule);
}

.section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem 1.5rem;
	margin-bottom: 1.5rem;
}

.section__title {
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--step-1);
	font-weight: 600;
}

.section__more { font-weight: 600; }

.list-header {
	padding-block: clamp(2rem, 1.25rem + 3vw, 3.25rem) clamp(1.5rem, 1rem + 2vw, 2.25rem);
	border-bottom: 1px solid var(--rule);
}

.list-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.25rem 2rem;
}

.list-header__inner > div { flex: 1 1 22rem; }
.list-header__inner .search-form { flex: 0 1 24rem; }

.list-header__title {
	margin: 0;
	font-size: var(--step-3);
	letter-spacing: -0.01em;
}

.list-header__desc {
	max-width: var(--measure);
	margin-top: 0.5rem;
	color: var(--ink-2);
}

.list-header__desc p:last-child { margin-bottom: 0; }

/* ---- Cards ------------------------------------------------------------- */
.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
	gap: 1.25rem;
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
}

.card:hover { border-color: var(--ink); }

.card:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

.card__media {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--panel);
	border-bottom: 1px solid var(--rule);
	border-radius: var(--radius) var(--radius) 0 0;
}

.card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.card__media--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #c4cad3;
	background-color: var(--panel);
	background-image: radial-gradient(#d0d5dd 1px, transparent 1px);
	background-size: 16px 16px;
}

.card__media--empty .openhw-logo { width: 18%; height: auto; }

.card:hover .card__media--empty { color: #98a2b3; }

.card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem 1.125rem 1.125rem;
}

.card__spec {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin: 0;
	font-family: var(--font-mono);
	font-size: 0.8125rem;
}

.card__part { color: var(--openhw-accent); font-weight: 600; }
.card__rev { color: var(--muted); white-space: nowrap; }

.card__title {
	margin: 0;
	font-size: var(--step-1);
	line-height: 1.25;
}

.card__title a {
	color: var(--ink);
	text-decoration: none;
}

/* Whole card clickable; the title stays the only link for screen readers. */
.card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.card__title a:focus-visible { outline: none; }
.card__title a:hover { color: var(--ink); text-decoration: underline; }

.card__excerpt {
	color: var(--ink-2);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.card__excerpt p { margin: 0; }

.card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem 1rem;
	margin: auto 0 0;
	padding-top: 0.75rem;
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
}

.card__foot:empty { display: none; }

.status {
	padding: 0.05rem 0.45rem;
	border: 1px solid currentColor;
	border-radius: 2px;
	color: var(--ink);
	font-weight: 600;
}

.status--released,
.status--maintained { color: #166534; }
.status--prototype,
.status--concept { color: #92400e; }
.status--archived { color: var(--muted); }

.sticky .card__title a::before {
	content: "★ ";
	color: var(--openhw-accent);
}

/* ---- Pagination -------------------------------------------------------- */
.pagination { margin-top: 2.5rem; }

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--font-mono);
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0 0.75rem;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
	text-decoration: none;
}

.pagination a.page-numbers:hover { border-color: var(--ink); }

.pagination .page-numbers.current {
	background: var(--ink);
	border-color: var(--ink);
	color: #fff;
}

.pagination .page-numbers.dots { border: 0; background: none; }

/* ---- Single project ---------------------------------------------------- */
.project__header { border-bottom: 1px solid var(--rule); }

.project__header-inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem);
	gap: 2rem 4rem;
	align-items: start;
	padding-block: clamp(2rem, 1.25rem + 3vw, 3.5rem);
}

.project__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin-bottom: 0.75rem;
	font-family: var(--font-mono);
	font-size: 0.875rem;
}

.project__cats a {
	color: var(--openhw-accent);
	font-weight: 600;
	text-decoration: none;
}

.project__cats a:hover { text-decoration: underline; }

.project__title {
	max-width: 24ch;
	margin-bottom: 0.75rem;
	font-size: var(--step-4);
	letter-spacing: -0.015em;
	line-height: 1.1;
}

.project__lead {
	max-width: 38rem;
	margin-bottom: 1.5rem;
	color: var(--ink-2);
	font-size: var(--step-1);
	line-height: 1.5;
}

.project__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.project__widgets { margin-top: 1.5rem; }

.project__figure {
	margin: clamp(1.5rem, 1rem + 2vw, 2.5rem) 0 0;
}

.project__figure img {
	display: block;
	width: 100%;
	border: 1px solid var(--rule);
}

.project__figure figcaption,
.entry-content figcaption,
.wp-caption-text {
	margin-top: 0.5rem;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	line-height: 1.45;
}

@media (max-width: 52em) {
	.project__header-inner { grid-template-columns: minmax(0, 1fr); }
	.project__block { max-width: 28rem; }
}

.project__tags { margin-top: 2.5rem; }

.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tag-list a {
	display: inline-flex;
	align-items: center;
	min-height: 2rem;
	padding: 0 0.625rem;
	border: 1px solid var(--rule);
	border-radius: 2px;
	color: var(--ink);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	text-decoration: none;
}

.tag-list a:hover { border-color: var(--ink); }

/* Previous / next */
.post-nav {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 2px solid var(--ink);
}

.post-nav .nav-links {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
	gap: 1rem 2rem;
}

.post-nav .nav-next { text-align: right; }

.post-nav a {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	color: var(--ink);
	text-decoration: none;
}

.post-nav .nav-next a { align-items: flex-end; }

.post-nav__label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
}

.post-nav__title { font-weight: 600; }
.post-nav a:hover .post-nav__title { text-decoration: underline; }

/* ---- Entry content (posts & pages) -------------------------------------- */
.entry-content {
	padding-block: clamp(1.75rem, 1.25rem + 2vw, 2.75rem) 0;
}

.entry-content > * {
	max-width: var(--measure);
	margin-left: 0;
	margin-right: 0;
}

.entry-content > .alignwide { max-width: none; }

.entry-content > .alignfull {
	max-width: none;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.entry-content > .aligncenter,
.entry-content .aligncenter { margin-left: auto; margin-right: auto; }

.entry-content .alignleft { float: left; margin: 0.35rem 1.5rem 1rem 0; }
.entry-content .alignright { float: right; margin: 0.35rem 0 1rem 1.5rem; }

@media (max-width: 36em) {
	.entry-content .alignleft,
	.entry-content .alignright { float: none; margin: 0 0 1.25rem; }
}

.entry-content::after { content: ""; display: table; clear: both; }

.entry-content h2 { margin-top: 2.5rem; font-size: var(--step-2); }
.entry-content h3 { margin-top: 2rem; font-size: var(--step-1); }
.entry-content h4 { margin-top: 1.75rem; font-size: 1.0625rem; }
.entry-content h5,
.entry-content h6 { margin-top: 1.5rem; font-size: 1rem; }

.entry-content h2:first-child,
.entry-content h3:first-child { margin-top: 0; }

.entry-content li { margin-bottom: 0.35rem; }
.entry-content li > ul,
.entry-content li > ol { margin: 0.35rem 0 0; }

.entry-content blockquote,
.wp-block-quote {
	padding: 0.25rem 0 0.25rem 1.25rem;
	border-left: 3px solid var(--ink);
	color: var(--ink-2);
}

.entry-content blockquote cite,
.wp-block-quote cite {
	display: block;
	margin-top: 0.5rem;
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	font-style: normal;
}

/* Notes / warnings: use a Group block with class "note" or "warning". */
.entry-content .note,
.entry-content .warning {
	padding: 1rem 1.25rem;
	border: 2px solid var(--ink);
	background: var(--panel);
}

.entry-content .warning { border-color: #b45309; background: #fffbeb; }
.entry-content .note > :last-child,
.entry-content .warning > :last-child { margin-bottom: 0; }

/* Code */
code,
kbd,
samp,
pre {
	font-family: var(--font-mono);
	font-size: 0.875em;
}

:not(pre) > code {
	padding: 0.1em 0.35em;
	border: 1px solid var(--rule);
	border-radius: 3px;
	background: var(--panel);
	overflow-wrap: anywhere;
}

pre,
.wp-block-code,
.wp-block-preformatted {
	max-width: 100%;
	overflow-x: auto;
	padding: 1rem 1.25rem;
	border: 1px solid var(--rule);
	border-left: 3px solid var(--ink);
	border-radius: 0;
	background: var(--panel);
	color: var(--ink);
	line-height: 1.55;
	tab-size: 4;
	white-space: pre;
}

.entry-content > pre,
.entry-content > .wp-block-code { max-width: min(100%, 52rem); }

pre code,
.wp-block-code code { padding: 0; border: 0; background: none; font-size: inherit; white-space: pre; overflow-wrap: normal; }

kbd {
	padding: 0.1em 0.4em;
	border: 1px solid #98a2b3;
	border-bottom-width: 2px;
	border-radius: 3px;
	background: #fff;
}

/* Tables — BOMs, pinouts, specs */
.entry-content table,
.wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
}

.wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.entry-content > table { display: block; overflow-x: auto; }

.entry-content > .wp-block-table { max-width: min(100%, 60rem); }

.entry-content th,
.entry-content td,
.wp-block-table th,
.wp-block-table td {
	padding: 0.5rem 0.75rem;
	border: 0;
	border-bottom: 1px solid var(--rule);
	text-align: left;
	vertical-align: top;
}

.entry-content thead th,
.wp-block-table thead th {
	border-bottom: 2px solid var(--ink);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	font-weight: 600;
	white-space: nowrap;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--panel); }
.wp-block-table.is-style-stripes { border-bottom: 0; }
.wp-block-table figcaption { text-align: left; }

/* Media */
.entry-content img { border-radius: 0; }

.wp-block-image img { display: block; }

.wp-block-gallery { gap: 0.75rem; }

.wp-block-embed { margin-bottom: 1.5rem; }

.wp-block-separator {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: 2.5rem 0;
}

.wp-block-separator.is-style-wide { border-top-width: 2px; border-color: var(--ink); }

/* File block — downloads of zips, gerbers, PDFs */
.wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--rule);
	background: var(--paper);
	font-family: var(--font-mono);
	font-size: 0.9375rem;
}

.wp-block-file .wp-block-file__button {
	margin-left: auto;
	padding: 0.5rem 1rem;
	border-radius: var(--radius);
	background: var(--openhw-accent);
	color: var(--openhw-on-accent);
	font-family: var(--font-sans);
	font-weight: 600;
	text-decoration: none;
}

.wp-block-file .wp-block-file__button:hover { background: var(--openhw-accent-hover); }

.wp-block-file__embed { width: 100%; border: 1px solid var(--rule); }

.wp-block-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Details block — handy for errata and changelogs */
.wp-block-details {
	padding: 0.75rem 1rem;
	border: 1px solid var(--rule);
}

.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
}

/* Page links */
.page-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 2rem;
	font-family: var(--font-mono);
}

/* Colour presets from theme.json */
.has-text-align-center { text-align: center; }
.has-text-align-right { text-align: right; }

/* ---- Comments ---------------------------------------------------------- */
.comments {
	max-width: var(--measure);
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 2px solid var(--ink);
}

.comments__title,
.comment-reply-title { font-size: var(--step-1); }

.comment-list,
.comment-list .children {
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
}

.comment-list .children { margin: 1rem 0 0 1.25rem; padding-left: 1rem; border-left: 1px solid var(--rule); }

.comment-body {
	padding: 1rem 0;
	border-bottom: 1px solid var(--rule);
}

.comment-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin-bottom: 0.5rem;
	font-size: 0.875rem;
}

.comment-author { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.comment-author .avatar { border-radius: 2px; }
.comment-author .says { display: none; }
.comment-metadata a { color: var(--muted); font-family: var(--font-mono); font-size: 0.8125rem; text-decoration: none; }
.comment-content p:last-child { margin-bottom: 0.5rem; }

.reply a,
.comment-reply-link {
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	font-weight: 600;
}

.comment-form p { margin-bottom: 1rem; }
.comment-form label { display: block; margin-bottom: 0.25rem; }
.comment-form-cookies-consent { display: flex; gap: 0.5rem; align-items: flex-start; }
.comment-form-cookies-consent label { font-weight: 400; }
.comment-notes,
.logged-in-as { color: var(--muted); font-size: 0.9375rem; }

/* ---- Empty state & 404 ------------------------------------------------- */
.empty-state {
	max-width: 36rem;
	padding: 2rem;
	border: 1px dashed #98a2b3;
	background: var(--paper);
}

.empty-state h2 { font-size: var(--step-1); }

.notfound__code {
	margin-bottom: 0.25rem;
	color: var(--openhw-accent);
	font-family: var(--font-mono);
	font-size: 0.9375rem;
	font-weight: 600;
}

.notfound__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.5rem;
}

.notfound__actions .search-form { flex: 1 1 20rem; }

/* ---- Widgets ----------------------------------------------------------- */
.widget { margin-bottom: 1.75rem; }
.widget:last-child { margin-bottom: 0; }

.widget-title,
.widget h2,
.wp-block-heading.widget-title {
	margin-bottom: 0.75rem;
	font-family: var(--font-mono);
	font-size: 0.9375rem;
	font-weight: 600;
}

.widget ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.widget li { padding: 0.3rem 0; }

/* ---- Footer ------------------------------------------------------------ */
.site-footer {
	margin-top: auto;
	border-top: 2px solid var(--ink);
	background: var(--paper);
	font-size: 0.9375rem;
}

.site-footer__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 2rem 3rem;
	padding-block: 2.5rem;
}

.site-footer__about { max-width: 26rem; }

.site-footer__mark {
	display: inline-flex;
	margin-bottom: 0.75rem;
	color: var(--ink);
}

.site-footer__mark .openhw-logo { height: 2rem; width: auto; }

.site-footer__about p { color: var(--ink-2); margin: 0; }

.site-footer__nav .menu {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__nav a {
	display: inline-flex;
	align-items: center;
	min-height: 2.25rem;
	color: var(--ink);
	font-family: var(--font-mono);
	text-decoration: none;
}

.site-footer__nav a:hover { color: var(--link); text-decoration: underline; }

.site-footer__base {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	padding-block: 1rem;
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
}

.site-footer__base p { margin: 0; }
.site-footer__top { color: var(--muted); }

/* ---- WordPress core classes ------------------------------------------- */
.wp-caption { max-width: 100%; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.gallery-item { margin: 0; }
.bypostauthor > .comment-body .fn::after { content: " (author)"; color: var(--muted); font-weight: 400; }

/* ---- Motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
	.site-nav .sub-menu,
	.site-nav .children { transition: opacity 0.12s ease, visibility 0.12s; }
	html { scroll-behavior: smooth; }
}

/* ---- Print: project pages print like a datasheet ----------------------- */
@media print {
	@page { margin: 16mm 14mm; }

	body { font-size: 10.5pt; color: #000; background: #fff; }

	.site-footer__grid,
	.menu-toggle,
	.site-nav,
	.post-nav,
	.comments,
	.project__actions,
	.project__widgets,
	.skip-link,
	.pagination { display: none !important; }

	.site-header { border-bottom: 1px solid #000; }

	.section--panel { background: none; }

	.project__header-inner { grid-template-columns: 1fr 6.5cm; padding-block: 0 6mm; }

	.entry-content > * { max-width: none; }

	a { color: #000; text-decoration: none; }

	.entry-content a[href^="http"]::after {
		content: " <" attr(href) ">";
		font-family: var(--font-mono);
		font-size: 8pt;
		word-break: break-all;
	}

	pre,
	table,
	figure,
	img { break-inside: avoid; }

	h2,
	h3 { break-after: avoid; }

	.site-footer { border-top: 1px solid #000; }
}
