:root {
	--bnw-logo-size: 80px;
	--bnw-partner-size: 160px;
	--bnw-gutter: var(--wp--preset--spacing--40, 1.5rem);
	--bnw-section-max: var(--wp--style--global--wide-size, 1200px);
}

@media (max-width: 1024px) {
	:root { --bnw-logo-size: 56px; --bnw-partner-size: 120px; }
}

@media (max-width: 600px) {
	:root { --bnw-logo-size: 40px; --bnw-partner-size: 88px; }
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link:focus {
	position: static;
	width: auto;
	height: auto;
	margin: 0;
	clip-path: none;
}

/* Header */
.site-header {
	position: relative;
	z-index: 10;
	padding: 0.75rem calc(var(--bnw-gutter) / 2);
	/* Slightly smaller than the page text; everything in the header that uses em/inherit follows. */
	font-size: 0.9em;
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
}

.site-header__inner {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 1rem;
	/* Wider than the content column so the side margins stay small on large screens. */
	max-width: calc(var(--wp--style--global--wide-size, 1200px) + 15rem);
	margin-inline: auto;
}

.site-branding {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 0.75rem;
	/* Pushes the toggle, nav and tools to the right. */
	margin-inline-end: auto;
}

.site-branding .custom-logo-link {
	display: block;
	line-height: 0;
}

.site-branding .custom-logo {
	width: var(--bnw-logo-size);
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
}

.site-title {
	font-size: 1.25em;
	font-weight: 700;
	color: inherit;
	text-decoration: none;
}

/* Primary nav */
.site-nav {
	flex: 0 1 auto;
	min-width: 0;
}

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

.site-nav .menu {
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
	gap: clamp(0.1rem, 0.5vw, 0.25rem);
}

.site-nav li {
	position: relative;
}

.site-nav a {
	display: block;
	padding: 0.5rem clamp(0.4rem, 0.9vw, 0.75rem);
	white-space: nowrap;
	border-radius: 0.375rem;
	color: inherit;
	text-decoration: none;
}

.site-nav .menu-icon {
	width: 1.1em;
	height: 1.1em;
	margin-inline-end: 0.4em;
	vertical-align: -0.15em;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav .current-menu-item > a {
	background: rgb(255 255 255 / 0.15);
}

.site-nav .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	width: 0.4em;
	height: 0.4em;
	margin-inline-start: 0.5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-0.15em) rotate(45deg);
	transition: transform 0.15s;
}

.site-nav .is-open > a::after {
	transform: translateY(0.05em) rotate(225deg);
}

.site-nav .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 20;
	min-width: 12rem;
	padding: 0.25rem;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}

.site-nav .is-open > .sub-menu {
	display: block;
}

.site-nav .sub-menu .sub-menu {
	top: 0;
	left: 100%;
}

/* Last dropdown (language): open towards the left so it never extends past the right edge. */
.site-nav .menu > li:last-child > .sub-menu {
	left: auto;
	right: 0;
}

.nav-toggle {
	display: none;
}

/* Tools: search + language */
.site-tools {
	position: relative;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	border: 0;
	border-radius: 0.375rem;
	background: none;
	color: inherit;
	cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
	background: rgb(255 255 255 / 0.15);
}

.search-panel {
	position: absolute;
	top: calc(100% + 0.5rem);
	right: 0;
	z-index: 30;
	width: min(20rem, 90vw);
	padding: 0.5rem;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}

.search-panel .search-form {
	display: flex;
	gap: 0.25rem;
}

/* Ajax Search Lite box inside the panel */
.search-panel .asl_w_container {
	width: 100%;
	margin: 0;
}

.search-panel .search-form input[type="search"] {
	flex: 1;
	min-width: 0;
	padding: 0.5rem 0.75rem;
	border: 1px solid currentColor;
	border-radius: 0.375rem;
	background: rgb(255 255 255 / 0.08);
	color: inherit;
	font: inherit;
}

.tools-menu {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.lang-switch,
.tools-menu a {
	white-space: nowrap;
	padding: 0.25rem 0.75rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.lang-switch:hover,
.lang-switch:focus-visible,
.tools-menu a:hover,
.tools-menu a:focus-visible {
	background: rgb(255 255 255 / 0.15);
}

/* Mobile header */
@media (max-width: 782px) {
	.site-header__inner { flex-wrap: wrap; }
	.site-branding { order: 1; margin-inline-end: auto; }
	.site-tools { order: 2; }
	.nav-toggle { order: 3; }
	.site-nav { order: 4; flex-basis: 100%; display: none; }
	.site-nav.is-open { display: block; }

	.nav-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.5rem;
		height: 2.5rem;
		border: 0;
		border-radius: 0.375rem;
		background: none;
		color: inherit;
		cursor: pointer;
	}

	.nav-toggle__bars,
	.nav-toggle__bars::before,
	.nav-toggle__bars::after {
		display: block;
		width: 1.5rem;
		height: 2px;
		background: currentColor;
	}

	.nav-toggle__bars { position: relative; }
	.nav-toggle__bars::before,
	.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
	.nav-toggle__bars::before { top: -7px; }
	.nav-toggle__bars::after { top: 7px; }

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

	.site-nav .sub-menu,
	.site-nav .sub-menu .sub-menu {
		position: static;
		padding-inline-start: 1rem;
		background: none;
		color: inherit;
		box-shadow: none;
	}
}

/* Sticky footer: the body is a column at least as tall as the viewport, and main takes the free space. */
/* "html body": the block editor rewrites a bare `body` onto its wrapper and must not pick this up. */
html body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}

/* Main + footer */
.site-main {
	flex: 1 0 auto;
	box-sizing: border-box;
	/* Auto margins stop a flex item from stretching, so the width is explicit. */
	width: 100%;
	max-width: calc(var(--wp--style--global--wide-size, 1200px) + 2 * var(--bnw-gutter));
	margin-inline: auto;
	padding: 2rem var(--bnw-gutter);
}

/* Front page: main is full-bleed so the hero spans the viewport; sections re-constrain themselves. */
.home .site-main {
	max-width: none;
	padding: 0;
}

.home .site-main > :not(.hero-main):not(.front-sections) {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-inline: auto;
	padding-inline: var(--bnw-gutter);
}

/* One white panel (95% of the viewport, centered) holding every .front-section. */
.front-sections {
	box-sizing: border-box;
	width: 95%;
	margin: 3rem auto 0;
	overflow: hidden;
	border-radius: 0.5rem;
	background: #fff;
	box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}

.front-sections:not(:has(.front-section:not([hidden]))) {
	display: none;
}

/*
 * Sections inside the panel, separated by a #a5a5a5 rule.
 * The inline padding keeps the content within --bnw-section-max and centered.
 */
.front-section {
	--bnw-section-pad: max(1.5rem, calc((100% - var(--bnw-section-max)) / 2));
	position: relative;
	box-sizing: border-box;
	padding: 1.5rem;
	padding-inline: var(--bnw-section-pad);
	scroll-margin-top: 1rem;
}

/* Delimiter: as wide as the section's content, 4px thick, fading out at both ends. */
.front-section:not([hidden]) ~ .front-section:not([hidden])::before {
	content: "";
	position: absolute;
	top: 0;
	inset-inline: var(--bnw-section-pad);
	height: 4px;
	border-radius: 2px;
	background: linear-gradient(to right, transparent, #a5a5a5 20%, #a5a5a5 80%, transparent);
}

.home .site-main > :last-child {
	margin-bottom: 2rem;
}

/* Pages: same white panel as .front-section (95% wide, centered, content capped at --bnw-section-max). */
.page:not(.home) .site-main,
.error404 .site-main,
.error500 .site-main {
	max-width: none;
	padding-inline: 0;
}

.page:not(.home) .site-main > article,
.error404 .site-main > article,
.error500 .site-main > article {
	box-sizing: border-box;
	width: 95%;
	margin-inline: auto;
	padding: 1.5rem;
	padding-inline: max(1.5rem, calc((100% - var(--bnw-section-max)) / 2));
	border-radius: 0.5rem;
	background: #fff;
	color: var(--wp--preset--color--contrast, #111827);
	box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
	overflow-wrap: anywhere;
}

.page:not(.home) .site-main > article :is(img, video, figure, iframe),
.error404 .site-main > article :is(img, video, figure, iframe),
.error500 .site-main > article :is(img, video, figure, iframe) {
	max-width: 100%;
}

.page:not(.home) .site-main > article :is(img, video, figure) {
	height: auto;
}

/* Single post: white card on top of the body gradient. */
.single-post .site-main {
	/* Content width + half of the free space on each side, i.e. (viewport + content) / 2. */
	--bnw-post-width: min(calc((100vw + var(--wp--style--global--content-size, 720px)) / 2), calc(100vw - 2 * var(--bnw-gutter)));
}

.single-post .site-main > article,
.single-post .post-navigation {
	position: relative;
	left: 50%;
	width: var(--bnw-post-width);
	transform: translateX(-50%);
}

.single-post .site-main > article {
	box-sizing: border-box;
	padding: 2rem clamp(1.5rem, 8vw, 6rem);
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #111827);
	font-size: 0.9375rem;
	border-radius: 0.5rem;
	box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
	overflow-wrap: anywhere;
}

/* Keep media inside the card when the window shrinks. */
.single-post .site-main > article img,
.single-post .site-main > article video,
.single-post .site-main > article figure {
	max-width: 100%;
	height: auto;
}

.single-post .site-main > article iframe {
	max-width: 100%;
}

.single-post .post-navigation {
	margin-top: 1.5rem;
}

/* Prev/next bar: grey, previous link at the left end, next link at the right end. */
.post-navigation {
	box-sizing: border-box;
	padding: 1rem clamp(1.5rem, 8vw, 6rem);
	border-radius: 0.5rem;
	background: #dddddd;
}

.post-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 1.5rem;
}

.post-navigation .nav-next {
	margin-inline-start: auto;
	text-align: end;
}

.post-navigation a,
.post-navigation a:visited,
.post-navigation a:active,
.post-navigation a:focus {
	color: #242424;
	text-decoration: none;
}

.post-navigation a:hover,
.post-navigation a:focus-visible {
	color: #242424;
	text-decoration: underline;
}

/* Site-wide defaults: serif text (set on body in theme.json); headings, titles, links and controls in sans-serif. */
:is(h1, h2, h3, h4, h5, h6, a, button, input, select, textarea, label, .entry-title, .page-title, .site-title) {
	font-family: var(--wp--preset--font-family--post-sans, 'Open Sans', 'DejaVu Sans', 'Sans', sans-serif);
}

/* Blog typography (AsciiDoctor-like): serif body, sans-serif titles. */
.single-post .site-main > article,
.blog .site-main > article,
.archive .site-main > article,
.search .site-main > article,
.post-card {
	font-family: var(--wp--preset--font-family--post-serif, 'Noto Serif', 'DejaVu Serif', 'Serif', serif);
}

.single-post .site-main > article :is(h1, h2, h3, h4, h5, h6),
.blog .site-main > article :is(h1, h2, h3, h4, h5, h6),
.archive .site-main > article :is(h1, h2, h3, h4, h5, h6),
.search .site-main > article :is(h1, h2, h3, h4, h5, h6),
.post-card__title,
.post-navigation {
	font-family: var(--wp--preset--font-family--post-sans, 'Open Sans', 'DejaVu Sans', 'Sans', sans-serif);
}

/* Sans-serif for the header (navbar included) and for front-page titles, links and buttons. */
.site-header,
.site-header :is(a, button),
.home .site-main :is(h1, h2, h3, h4, h5, h6, a, button) {
	font-family: var(--wp--preset--font-family--post-sans, 'Open Sans', 'DejaVu Sans', 'Sans', sans-serif);
}

/* Front-page paragraphs: same serif stack as the blog. */
.home .site-main p {
	font-family: var(--wp--preset--font-family--post-serif, 'Noto Serif', 'DejaVu Serif', 'Serif', serif);
}

/* Footer text: sans-serif. */
.site-footer,
.site-footer :is(p, a, h1, h2, h3, h4, h5, h6, li, button) {
	font-family: var(--wp--preset--font-family--post-sans, 'Open Sans', 'DejaVu Sans', 'Sans', sans-serif);
}

/* Footer */
.site-footer {
	padding: 2.5rem var(--bnw-gutter) 1.25rem;
	background: var(--wp--preset--gradient--steel-footer, linear-gradient(180deg, #323232 0%, #868686 100%));
	color: #f5f5f5;
	text-align: center;
}

.site-footer__inner {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-inline: auto;
}

.site-footer__partners {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.site-footer__partners[hidden] {
	display: none;
}

.site-footer__cooperation {
	margin: 0;
	font-size: 1.125rem;
	letter-spacing: 0.04em;
}

.partner-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-evenly;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.partner-logos a {
	display: block;
	line-height: 0;
}

.partner-logos img {
	width: var(--bnw-partner-size);
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
	filter: grayscale(1);
	transition: filter 0.25s;
}

.partner-logos a:hover img,
.partner-logos a:focus-visible img {
	filter: none;
}

.site-footer__copy {
	margin: 0;
	padding-top: 1rem;
	font-size: 0.8125rem;
	color: #111;
}

/* Latest posts */
.latest-posts__title {
	margin: 0 0 1.5rem;
	text-align: center;
}

.latest-posts__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 1.5rem;
}

.post-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #111);
	box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}

.post-card__image img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

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

.post-card__date {
	font-size: 0.8125rem;
	opacity: 0.7;
}

.post-card__title {
	margin: 0;
	font-size: 1.25rem;
}

.post-card__title a {
	color: inherit;
	text-decoration: none;
}

.post-card__title a:hover,
.post-card__title a:focus-visible {
	text-decoration: underline;
}

.post-card__excerpt p {
	margin: 0;
}

.blog-list {
	margin-top: 1.5rem;
}

.blog-list__pagination {
	margin-top: 1.5rem;
	text-align: center;
}

.blog-list__pagination .page-numbers {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 0.375rem;
	color: inherit;
	text-decoration: none;
}

.blog-list__pagination .page-numbers.current,
.blog-list__pagination a.page-numbers:hover,
.blog-list__pagination a.page-numbers:focus-visible {
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
}

.latest-posts__more {
	margin: 1.5rem 0 0;
	text-align: right;
}

.button-link {
	display: inline-block;
	padding: 0.4rem 1rem;
	border-radius: 999px;
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
}

.button-link:hover,
.button-link:focus-visible {
	background: #4a3e41;
}

/* Smooth scroll to #portals */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

/* Hero */
.hero-main {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	/* Fill the viewport below the header (header height is set by main.js). */
	min-height: max(
		20rem,
		calc(100vh - var(--bnw-header-h, 4.5rem) - var(--wp-admin--admin-bar--height, 0px))
	);
	min-height: max(
		20rem,
		calc(100dvh - var(--bnw-header-h, 4.5rem) - var(--wp-admin--admin-bar--height, 0px))
	);
	overflow: hidden;
	background: #1b1428;
	color: #fff;
	text-align: center;
}

.hero-main__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero-main::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgb(0 0 0 / 0.35);
}

.hero-main__content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2rem;
	padding: 2rem var(--bnw-gutter);
}

.hero-main__title {
	margin: 0;
	font-size: clamp(2.5rem, 7vw, 5rem);
	text-shadow: 0 2px 16px rgb(0 0 0 / 0.5);
}

/* Tagline: a third of the title size, directly under it. */
.home .site-main .hero-main__description {
	margin: -1rem 0 0;
	font-family: var(--wp--preset--font-family--post-sans, 'Open Sans', 'DejaVu Sans', 'Sans', sans-serif);
	font-size: clamp(0.8333rem, 2.3333vw, 1.6667rem);
	text-shadow: 0 2px 16px rgb(0 0 0 / 0.5);
}

.hero-main__button {
	display: inline-block;
	padding: 0.75rem 2rem;
	border-radius: 999px;
	background: var(--wp--preset--color--header-text, #f5ece8);
	color: var(--wp--preset--color--header, #332a2c);
	font-weight: 600;
	text-decoration: none;
	transition: transform 0.15s, background 0.15s;
}

.hero-main__button:hover,
.hero-main__button:focus-visible {
	background: #fff;
	transform: translateY(-2px);
}

/* Introduction & tools/portals: centered titles (panel styles live in .front-section) */
.intro[hidden] {
	display: none;
}

.intro__title,
.portals__title,
.api-demo__title {
	margin: 0 0 1.5rem;
	text-align: center;
}

.intro__content > :first-child {
	margin-top: 0;
}

.intro__content > :last-child {
	margin-bottom: 0;
}

/* Tools & portals */

.portals__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.portal-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	height: 100%;
	padding: 1.25rem 1rem;
	border-radius: 0.5rem;
	color: var(--wp--preset--color--contrast, #111);
	font-weight: 600;
	text-decoration: none;
	transition: transform 0.15s;
}

.portal-link img {
	width: var(--bnw-portal-size, 120px);
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
	filter: grayscale(1);
	transition: filter 0.25s;
}

.portal-link:hover,
.portal-link:focus-visible {
	transform: translateY(-2px);
}

.portal-link:hover img,
.portal-link:focus-visible img {
	filter: none;
}

@media (max-width: 1024px) {
	.portals__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
	.portals__grid { grid-template-columns: 1fr; }
	.portal-link img { --bnw-portal-size: 96px; }
}

/* API example (logged-in users) */
.api-demo__intro,
.api-demo__actions,
.api-demo__status {
	text-align: center;
}

.api-demo__button {
	display: inline-block;
	padding: 0.5rem 1.25rem;
	text-decoration: none;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--header, #332a2c);
	color: var(--wp--preset--color--header-text, #f5ece8);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.api-demo__button:disabled {
	opacity: 0.6;
	cursor: wait;
}

.api-demo__output {
	max-height: 20rem;
	margin: 0;
	padding: 1rem;
	overflow: auto;
	border-radius: 0.5rem;
	background: #f4f1f0;
	font-size: 0.875rem;
}

.api-demo__output[hidden] {
	display: none;
}

/* Block editor (main.css is also its editor stylesheet): white canvas instead of the site gradient. */
html .editor-styles-wrapper {
	background: #fff;
}

/* Paragraph blocks: 1rem, slightly above the 0.9375rem of single-post cards (also applies in the editor). */
.wp-block-paragraph {
	font-size: 1rem;
}