/*
Theme Name: DMARC Manager Knowledge Base
Theme URI: https://dmarcmanager.app/
Author: Jeroen Verschoor
Description: Knowledge Base theme for DMARC Manager, styled to match the eu-developer.dmarcmanager.app/guides/ documentation site (Inter + JetBrains Mono, slate/persianred design system), built around a per-screen article structure with Polylang-ready multilingual support.
Version: 1.9.37
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: dmarc-kb
Tags: custom-colors, custom-menu, translation-ready, docs, knowledge-base
*/

/* ==========================================================================
   Design tokens
   Captured live from https://eu-developer.dmarcmanager.app/guides/
   (Tailwind's default slate scale + a custom "persianred" brand accent)
   ========================================================================== */

:root {
	--kb-font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
	--kb-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	/* Slate scale */
	--kb-slate-50: #f8fafc;
	--kb-slate-100: #f1f5f9;
	--kb-slate-200: #e2e8f0;
	--kb-slate-300: #cbd5e1;
	--kb-slate-400: #94a3b8;
	--kb-slate-500: #64748b;
	--kb-slate-600: #475569;
	--kb-slate-700: #334155;
	--kb-slate-800: #1e293b;
	--kb-slate-900: #0f172a;

	/* Brand accent ("persianred" in the reference site's own Tailwind config) */
	--kb-brand-50: #fdf1f1;
	--kb-brand-100: #fbe1e1;
	--kb-brand-600: #b82c2c;
	--kb-brand-700: #9a2424;

	/* The red of the app's own menu (#cc3333), used as a transparent layer on the guide menu */
	--kb-tool-red: 204, 51, 51;
	--kb-menu-tint: rgba(var(--kb-tool-red), 0.06);
	--kb-menu-line: rgba(var(--kb-tool-red), 0.16);
	--kb-menu-hover: rgba(var(--kb-tool-red), 0.09);
	--kb-menu-active: rgba(var(--kb-tool-red), 0.14);

	/* Callout colors (GitHub-style markdown alerts) */
	--kb-note: #3b82f6;
	--kb-tip: #16a34a;
	--kb-warning: #d97706;
	--kb-important: #b82c2c;

	/* Surfaces and special cases (overridden in dark mode, see the end of this file) */
	--kb-surface: #fff;
	--kb-footer-bg: #f0f4f8; /* a touch darker than the page, so the footer reads as the end of the page */
	--kb-header-bg: rgba(255, 255, 255, 0.9);
	--kb-glass: rgba(255, 255, 255, 0.55);
	--kb-faint: #d3dbe6;
	--kb-code-bg: var(--kb-slate-900);
	--kb-btn-bg: var(--kb-brand-600);
	--kb-btn-hover: var(--kb-brand-700);
	color-scheme: light;

	--kb-radius: 6px;
	--kb-header-h: 64px;
	--kb-sidebar-w: 280px;
	--kb-toc-w: 224px;
	--kb-maxw: 1600px;
}

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

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

/* overflow-y: scroll (not auto) — always reserves the scrollbar's track,
   even on a page short enough to never need it. Without this, the
   centered .kb-layout (max-width + margin: 0 auto) sits a few pixels
   further right on a short page (Home, "Using the platform", Guidelines —
   no scrollbar) than on a taller one (an article with the "On this page"
   sidebar, tall enough to scroll) — confirmed live: the scrollbar itself
   measured 15px, and centered content shifted by exactly that behavior
   appearing/disappearing. Reserving it unconditionally keeps every page's
   available width identical, so nothing ever shifts when navigating
   between them. */
html { scroll-behavior: smooth; overflow-y: scroll; }

body {
	margin: 0;
	background: var(--kb-slate-50);
	color: var(--kb-slate-800);
	font-family: var(--kb-font-sans);
	font-size: 16px;
	line-height: 24px;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

.kb-container {
	max-width: var(--kb-maxw);
	margin: 0 auto;
}

/* ==========================================================================
   Header
   ========================================================================== */

.kb-header {
	position: sticky;
	top: 0;
	z-index: 30;
	height: var(--kb-header-h);
	background: var(--kb-header-bg);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--kb-slate-200);
}

.kb-header__inner {
	display: flex;
	align-items: center;
	gap: 32px;
	height: 100%;
	max-width: 1600px;
	margin: 0 auto;
	padding: 0 24px;
}
@media (min-width: 768px) {
	.kb-header__inner { padding: 0 40px; }
}

.kb-header__logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 18px;
	color: var(--kb-slate-900);
	white-space: nowrap;
}
.kb-header__logo a {
	display: flex;
	align-items: center;
}
.kb-header__logo img {
	display: block;
	height: 28px;
	max-height: 28px;
	width: auto;
}

.kb-header__nav {
	display: flex;
	align-items: flex-end;
	min-width: 0;
	gap: 24px;
	font-size: 14px;
	font-weight: 500;
	color: var(--kb-slate-600);
	flex: 1;
	height: 100%;
}
.kb-header__nav a {
	display: flex;
	align-items: center;
	white-space: nowrap;
	flex-shrink: 0;
	padding-bottom: 10px;
	margin-bottom: 10px;
	border-bottom: 2px solid transparent;
}
.kb-header__nav a:hover { color: var(--kb-slate-900); }
.kb-header__nav a.is-active {
	color: var(--kb-brand-600);
	border-bottom-color: var(--kb-brand-600);
}

/* Terminology's own nav link (see header.php): lighter and lighter-weight
   than the main items above by default, since it's reference material to
   dip into rather than a primary section — still reads normally on hover,
   and gets the same active-state color as every other item once you're
   actually on that page. */
.kb-header__nav a.kb-header__nav-item--muted { color: var(--kb-slate-400); font-weight: 400; }
.kb-header__nav a.kb-header__nav-item--muted:hover { color: var(--kb-slate-600); }
.kb-header__nav a.kb-header__nav-item--muted.is-active {
	color: var(--kb-brand-600);
	font-weight: 500;
	border-bottom-color: var(--kb-brand-600);
}

.kb-header__actions {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 16px;
	margin-left: auto;
}
.kb-btn { white-space: nowrap; }
/* The login link inside the mobile nav panel; only shown on very small screens. */
.kb-header__nav a.kb-header__nav-login { display: none; }

.kb-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 16px;
	border-radius: var(--kb-radius);
	background: var(--kb-btn-bg);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
	border: none;
	cursor: pointer;
}
.kb-btn:hover { background: var(--kb-btn-hover); color: #fff; }

/* Language switcher */
.kb-lang {
	position: relative;
}
.kb-lang__toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 500;
	color: var(--kb-slate-600);
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px 10px;
	border-radius: var(--kb-radius);
}
.kb-lang__toggle:hover { background: var(--kb-slate-100); color: var(--kb-slate-900); }
.kb-lang__menu {
	display: none;
	position: absolute;
	right: 0;
	top: calc(100% + 4px);
	background: var(--kb-surface);
	border: 1px solid var(--kb-slate-200);
	border-radius: var(--kb-radius);
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
	min-width: 160px;
	padding: 4px;
	z-index: 40;
}
.kb-lang.is-open .kb-lang__menu { display: block; }
.kb-lang__menu a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 14px;
	color: var(--kb-slate-700);
}
.kb-lang__menu a:hover { background: var(--kb-slate-100); }
.kb-lang__menu a.is-current { color: var(--kb-brand-700); font-weight: 500; background: var(--kb-brand-50); }
.kb-lang__flag { display: inline-block; width: 18px; height: 13px; line-height: 0; overflow: hidden; border-radius: 2px; flex-shrink: 0; }
/* Whatever markup Polylang hands us for the flag, keep it flag-sized (the inline style may say 100%). */
.kb-lang img { display: block; width: 18px !important; height: 13px !important; max-width: none; object-fit: cover; border-radius: 2px; flex-shrink: 0; }

/* Header search box. Wide screens: a field with an icon. Below 1280px it is
   collapsed to just the icon; clicking it opens the field as a small popover. */
.kb-search {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: var(--kb-radius);
	background: var(--kb-slate-100);
}
.kb-search__btn {
	display: inline-flex;
	align-items: center;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--kb-slate-400);
}
.kb-search__icon { color: var(--kb-slate-400); flex-shrink: 0; }
.kb-search__input {
	border: none;
	background: none;
	outline: none;
	font-size: 14px;
	font-family: inherit;
	color: var(--kb-slate-800);
	width: 160px;
}
.kb-search__input::placeholder { color: var(--kb-slate-400); }
.kb-search__input::-webkit-search-cancel-button { cursor: pointer; }

@media (max-width: 1279px) {
	.kb-search { padding: 0; background: none; }
	.kb-search__btn {
		width: 36px;
		height: 36px;
		justify-content: center;
		border-radius: var(--kb-radius);
		color: var(--kb-slate-600);
	}
	.kb-search__btn:hover { background: var(--kb-slate-100); color: var(--kb-slate-900); }
	.kb-search__input {
		position: absolute;
		right: 0;
		top: calc(100% + 8px);
		width: min(320px, calc(100vw - 32px));
		padding: 10px 12px;
		background: var(--kb-surface);
		border: 1px solid var(--kb-slate-200);
		border-radius: var(--kb-radius);
		box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
		opacity: 0;
		pointer-events: none;
		z-index: 40;
	}
	.kb-search:focus-within .kb-search__input,
	.kb-search.is-open .kb-search__input {
		opacity: 1;
		pointer-events: auto;
	}
	.kb-search:focus-within .kb-search__btn,
	.kb-search.is-open .kb-search__btn { background: var(--kb-slate-100); color: var(--kb-slate-900); }
}

/* Tighter header between 1025px and 1279px so nothing wraps */
@media (max-width: 1279px) {
	.kb-header__inner { gap: 16px; padding: 0 24px; }
	.kb-header__nav { gap: 16px; font-size: 13.5px; }
	.kb-header__actions { gap: 8px; }
}

.kb-mobile-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	margin-left: -8px;
	border-radius: var(--kb-radius);
	color: var(--kb-slate-700);
}
.kb-mobile-toggle:hover { background: var(--kb-slate-100); }

/* Up to 1024px the main navigation moves into a panel under the header,
   opened with the hamburger button. */
@media (max-width: 1024px) {
	.kb-mobile-toggle { display: inline-flex; }
	.kb-header__nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		height: auto;
		flex: none;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 4px 24px 12px;
		background: var(--kb-surface);
		font-size: 16px;
		border-bottom: 1px solid var(--kb-slate-200);
		box-shadow: 0 8px 16px -8px rgba(15, 23, 42, 0.18);
	}
	.kb-header.is-nav-open .kb-header__nav { display: flex; }
	.kb-header__nav a,
	.kb-header__nav a.kb-header__nav-item--muted {
		margin: 0;
		padding: 14px 0;
		border-bottom: 1px solid var(--kb-slate-100);
		color: var(--kb-slate-700);
		font-weight: 500;
	}
	.kb-header__nav a:last-child { border-bottom: none; }
	.kb-header__nav a.is-active,
	.kb-header__nav a.kb-header__nav-item--muted.is-active {
		color: var(--kb-brand-600);
		border-bottom-color: var(--kb-slate-100);
	}
	.kb-header__actions { margin-left: auto; }
	.kb-header__inner { gap: 12px; }
}
@media (max-width: 520px) {
	.kb-header__inner { padding: 0 16px; }
	.kb-header__nav { padding: 4px 16px 12px; }
	/* Not enough room for the login button next to the logo: it moves into the panel. */
	.kb-header__actions .kb-btn { display: none; }
	.kb-header__nav a.kb-header__nav-login {
		display: flex;
		margin-top: 12px;
		padding: 12px 16px;
		justify-content: center;
		background: var(--kb-btn-bg);
		color: #fff;
		border-radius: var(--kb-radius);
		border-bottom: none;
	}
	.kb-header__nav a.kb-header__nav-login:hover { background: var(--kb-btn-hover); color: #fff; }
	.kb-header.is-nav-open .kb-header__nav a:nth-last-child(2) { border-bottom: none; }
}

/* ==========================================================================
   Layout: sidebar / main / toc
   ========================================================================== */

.kb-layout {
	display: flex;
	/* stretch (not flex-start): the sidebar's own content is often much
	   shorter than the main column's (or vice versa on a short landing
	   page) — stretch keeps every column exactly as tall as the row
	   itself, so the sidebar's vertical border-right always reaches all
	   the way down to the horizontal rule below, instead of stopping
	   wherever its own last menu item happens to end. */
	align-items: stretch;
	max-width: var(--kb-maxw);
	margin: 0 auto;
}

.kb-sidebar {
	width: var(--kb-sidebar-w);
	flex-shrink: 0;
	background: var(--kb-menu-tint);
	border-right: 1px solid var(--kb-menu-line);
	padding: 32px 12px;
	position: sticky;
	top: var(--kb-header-h);
	max-height: calc(100vh - var(--kb-header-h));
	overflow-y: auto;
	/* Scrollbar: only needed when a menu section is open and very long, so
	   it is invisible until the pointer is over the menu, then thin and in
	   the brand red instead of the browser's grey. */
	scrollbar-width: thin;
	scrollbar-color: transparent transparent;
}
.kb-sidebar:hover,
.kb-sidebar:focus-within { scrollbar-color: var(--kb-brand-600) transparent; }

/* Section names follow the spelling of the app's own menu (Sender Manager,
   DMARC Management, ...), so they are shown exactly as written: no uppercase. */
.kb-sidebar__label {
	padding: 0 12px;
	font-size: 14px;
	font-weight: 500;
	color: var(--kb-slate-600);
	margin: 0 0 8px;
}
.kb-sidebar__label,
.kb-sidebar__single {
	display: flex;
	align-items: center;
	gap: 12px;
}
.kb-sidebar__icon { flex-shrink: 0; color: var(--kb-slate-400); }
.kb-sidebar__name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-sidebar__section + .kb-sidebar__section { margin-top: 8px; }

/* Collapsible section groups (accordion main menu, like the app itself) */
.kb-sidebar__group > summary {
	list-style: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 8px 12px;
	border-radius: var(--kb-radius);
	user-select: none;
}
.kb-sidebar__group > summary::-webkit-details-marker { display: none; }
.kb-sidebar__group > summary::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
	flex-shrink: 0;
}
.kb-sidebar__group[open] > summary::after { transform: rotate(45deg); }
.kb-sidebar__group > summary:hover { background: var(--kb-menu-hover); color: var(--kb-slate-700, var(--kb-slate-600)); }
.kb-sidebar__group[open] > summary { color: var(--kb-slate-900); margin-bottom: 4px; }
.kb-sidebar__group > summary:focus-visible { outline: 2px solid var(--kb-brand-600); outline-offset: -2px; }
.kb-sidebar__group .kb-sidebar__list { padding-left: 34px; }

/* Single-page sections (Dashboard, First Steps): a direct link, no accordion */
.kb-sidebar__single {
	padding: 8px 12px;
	border-radius: var(--kb-radius);
	font-size: 14px;
	font-weight: 500;
	color: var(--kb-slate-600);
}
.kb-sidebar__single:hover { background: var(--kb-menu-hover); color: var(--kb-slate-900); }
.kb-sidebar__single:hover .kb-sidebar__icon,
.kb-sidebar__group > summary:hover .kb-sidebar__icon { color: var(--kb-slate-600); }
.kb-sidebar__single.is-active { background: var(--kb-menu-active); color: var(--kb-brand-700); }
.kb-sidebar__single.is-active .kb-sidebar__icon,
.kb-sidebar__group[open] > summary .kb-sidebar__icon { color: var(--kb-brand-600); }
.kb-sidebar__single:focus-visible { outline: 2px solid var(--kb-brand-600); outline-offset: -2px; }

/* First Steps: stands apart from the app's own menu items */
.kb-sidebar__section--start {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--kb-menu-line);
}
.kb-sidebar__section--start .kb-sidebar__single,
.kb-sidebar__section--start .kb-sidebar__icon { color: var(--kb-brand-700); }

/* Shared functionalities: not an item of the app's menu, so it is set apart and tinted */
.kb-sidebar__section--shared {
	margin-top: 32px;
	background: var(--kb-glass);
	border: 1px solid var(--kb-menu-line);
	border-radius: var(--kb-radius);
	padding: 4px;
}
.kb-sidebar__section--shared > summary { color: var(--kb-slate-600); }
.kb-sidebar__section--shared > summary:hover { background: var(--kb-menu-hover); }
.kb-sidebar__section--shared .kb-sidebar__list a:hover { background: var(--kb-menu-hover); }

.kb-sidebar__list { list-style: none; margin: 0; padding: 0; }
.kb-sidebar__list a {
	display: block;
	padding: 6px 12px;
	border-radius: var(--kb-radius);
	font-size: 14px;
	color: var(--kb-slate-600);
}
.kb-sidebar__list a:hover { background: var(--kb-menu-hover); color: var(--kb-slate-900); }
.kb-sidebar__list a.is-active {
	background: var(--kb-menu-active);
	color: var(--kb-brand-700);
	font-weight: 500;
}

.kb-main {
	flex: 1 1 auto;
	min-width: 0;
	padding: 40px;
}
@media (max-width: 1024px) {
	.kb-main { padding: 32px 24px; }
}

.kb-toc {
	width: var(--kb-toc-w);
	flex-shrink: 0;
	padding: 32px 16px;
	position: sticky;
	top: var(--kb-header-h);
	max-height: calc(100vh - var(--kb-header-h));
	overflow-y: auto;
}
.kb-toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--kb-slate-200); }
.kb-toc__list a {
	display: block;
	padding: 4px 16px;
	font-size: 13px;
	color: var(--kb-slate-500);
	border-left: 2px solid transparent;
	margin-left: -1px;
}
.kb-toc__list a:hover { color: var(--kb-slate-900); }
.kb-toc__list a.is-active { color: var(--kb-brand-700); border-left-color: var(--kb-brand-600); font-weight: 500; }
.kb-toc__list--sub a { padding-left: 28px; font-size: 12.5px; }

@media (max-width: 1279px) {
	.kb-toc { display: none; }
}
/* The bar that opens the sidebar on small screens (rendered by sidebar-nav.php) */
.kb-sidebar-toggle { display: none; }
@media (max-width: 767px) {
	.kb-layout { flex-direction: column; }
	.kb-sidebar-toggle {
		display: flex;
		align-items: center;
		gap: 10px;
		position: sticky;
		top: var(--kb-header-h);
		z-index: 26;
		width: 100%;
		padding: 12px 24px;
		background: linear-gradient(var(--kb-menu-tint), var(--kb-menu-tint)), var(--kb-surface);
		border: none;
		border-bottom: 1px solid var(--kb-menu-line);
		font: inherit;
		font-size: 14px;
		font-weight: 500;
		color: var(--kb-slate-700);
		cursor: pointer;
		text-align: left;
	}
	.kb-sidebar-toggle[aria-expanded="true"] { color: var(--kb-brand-700); }
	.kb-sidebar { display: none; }
	.kb-sidebar.is-open {
		display: block;
		position: fixed;
		inset: calc(var(--kb-header-h) + 45px) 0 0 0;
		z-index: 25;
		background: linear-gradient(var(--kb-menu-tint), var(--kb-menu-tint)), var(--kb-surface);
		width: 100%;
		max-height: none;
		border-right: none;
	}
}

/* ==========================================================================
   Article / prose content
   ========================================================================== */

.kb-article { max-width: 768px; }

.kb-eyebrow {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--kb-brand-600);
	margin: 0 0 8px;
}

.kb-article h1 {
	font-size: 36px;
	line-height: 40px;
	font-weight: 600;
	color: var(--kb-slate-900);
	margin: 0 0 32px;
}

/* Title row: the article title with the PDF and share-by-email icons on the right */
.kb-article__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 32px;
}
.kb-article__head h1 { margin: 0; min-width: 0; }
.kb-article__tools {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
	margin-top: 2px;
}
.kb-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--kb-slate-200);
	border-radius: var(--kb-radius);
	background: var(--kb-surface);
	color: var(--kb-slate-500);
	text-decoration: none;
	transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.kb-tool:hover,
.kb-tool:focus-visible {
	color: var(--kb-brand-600);
	border-color: var(--kb-menu-line);
	background: var(--kb-menu-tint);
}
.kb-tool:focus-visible { outline: 2px solid var(--kb-brand-600); outline-offset: 2px; }
@media (max-width: 600px) {
	.kb-article__head { flex-direction: column-reverse; gap: 12px; margin-bottom: 24px; }
	.kb-tool { width: 36px; height: 36px; }
}
@media print {
	.kb-article__tools { display: none; }
}
.kb-article h2 {
	font-size: 24px;
	line-height: 32px;
	font-weight: 600;
	color: var(--kb-slate-900);
	margin: 48px 0 24px;
	scroll-margin-top: calc(var(--kb-header-h) + 16px);
}
.kb-article h3 {
	font-size: 19px;
	line-height: 28px;
	font-weight: 600;
	color: var(--kb-slate-900);
	margin: 32px 0 16px;
	scroll-margin-top: calc(var(--kb-header-h) + 16px);
}
.kb-article p {
	font-size: 16px;
	line-height: 28px;
	color: var(--kb-slate-700);
	margin: 20px 0;
}
.kb-article a { color: var(--kb-brand-600); text-decoration: underline; text-underline-offset: 2px; }
.kb-article a:hover { color: var(--kb-brand-700); }

.kb-article ul, .kb-article ol {
	color: var(--kb-slate-700);
	font-size: 16px;
	line-height: 28px;
	padding-left: 1.6em;
	margin: 20px 0;
}
.kb-article li { margin: 6px 0; }
.kb-article li > p { margin: 8px 0; }

.kb-article strong { color: var(--kb-slate-900); font-weight: 600; }

.kb-article code {
	font-family: var(--kb-font-mono);
	font-size: 14px;
	font-weight: 500;
	color: var(--kb-brand-600);
	background: var(--kb-brand-50);
	border-radius: 5.6px;
	padding: 2.4px 6.4px;
}
.kb-article pre {
	background: var(--kb-code-bg);
	color: #e2e8f0;
	border-radius: 8px;
	padding: 16px 20px;
	overflow-x: auto;
	font-family: var(--kb-font-mono);
	font-size: 13.5px;
	line-height: 1.7;
	margin: 24px 0;
}
.kb-article pre code {
	background: none;
	color: inherit;
	padding: 0;
	font-weight: 400;
}

.kb-article table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	margin: 28px 0;
}
.kb-article th {
	text-align: left;
	color: var(--kb-slate-900);
	font-weight: 600;
	padding: 8px 8px 8px 0;
	border-bottom: 1px solid var(--kb-slate-300);
}
.kb-article td {
	color: var(--kb-slate-700);
	padding: 8px 8px 8px 0;
	border-bottom: 1px solid var(--kb-slate-200);
	vertical-align: top;
}

.kb-article img, .kb-article .wp-block-image {
	border: 1px solid var(--kb-slate-200);
	border-radius: 8px;
	margin: 24px 0;
}

.kb-article blockquote {
	margin: 20px 0;
	padding-left: 16px;
	border-left: 3px solid var(--kb-slate-300);
	color: var(--kb-slate-600);
	font-style: italic;
}

/* GitHub-style markdown alert callouts */
.kb-alert {
	background: var(--kb-slate-50);
	border-left: 3px solid var(--kb-slate-400);
	border-radius: var(--kb-radius);
	padding: 12px 16px;
	margin: 16px 0;
	font-size: 15px;
	color: var(--kb-slate-700);
}
.kb-alert__title {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	margin: 0 0 4px;
}
.kb-alert--note { border-left-color: var(--kb-note); }
.kb-alert--note .kb-alert__title { color: var(--kb-note); }
.kb-alert--tip { border-left-color: var(--kb-tip); }
.kb-alert--tip .kb-alert__title { color: var(--kb-tip); }
.kb-alert--warning { border-left-color: var(--kb-warning); }
.kb-alert--warning .kb-alert__title { color: var(--kb-warning); }
.kb-alert--important { border-left-color: var(--kb-important); }
.kb-alert--important .kb-alert__title { color: var(--kb-important); }

/* Inline glossary term reference ([kb_term] shortcode — see
   dmarc_kb_term_shortcode() in functions.php). Deliberately NOT styled like
   a link (no color change) so a paragraph with several of these doesn't
   read as a wall of blue underlines — the dotted underline alone signals
   "an explanation is available here", handled by assets/js/kb-term-tooltip.js. */
.kb-term-ref {
	border-bottom: 1px dotted var(--kb-slate-400);
	cursor: help;
	text-decoration: none;
}
.kb-term-ref:hover,
.kb-term-ref[aria-expanded="true"] {
	border-bottom-color: var(--kb-brand-600);
}

/* The popup card assets/js/kb-term-tooltip.js shows above/below a
   .kb-term-ref — one shared element, repositioned per term (see position()
   in that file), not one per reference in the DOM. */
.kb-term-popup {
	position: absolute;
	z-index: 60;
	width: 280px;
	max-width: calc(100vw - 24px);
	background: var(--kb-surface);
	border: 1px solid var(--kb-slate-200);
	border-radius: 8px;
	box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
	padding: 14px 16px;
	font-size: 13.5px;
	line-height: 20px;
	color: var(--kb-slate-700);
}
.kb-term-popup__title {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	color: var(--kb-slate-900);
}
.kb-term-popup__body p { margin: 0 0 8px; }
.kb-term-popup__body p:last-child { margin-bottom: 0; }
.kb-term-popup__body a { color: var(--kb-brand-600); }
.kb-term-popup__body a:hover { text-decoration: underline; }
.kb-term-popup__more {
	display: inline-block;
	margin-top: 8px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--kb-brand-600);
}
.kb-term-popup__more:hover { text-decoration: underline; }

/* Badges used inline (e.g. status words in draft copy) */
.kb-badge {
	display: inline-block;
	font-size: 12.5px;
	font-weight: 500;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--kb-slate-100);
	color: var(--kb-slate-700);
}

/* Prev / next article footer navigation */
.kb-pagenav {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 56px;
	padding-top: 24px;
	border-top: 1px solid var(--kb-slate-200);
}
.kb-pagenav__link {
	flex: 1;
	max-width: 48%;
	padding: 12px 16px;
	border: 1px solid var(--kb-slate-200);
	border-radius: 8px;
}
.kb-pagenav__link:hover { border-color: var(--kb-slate-300); background: var(--kb-slate-50); }
.kb-pagenav__link--next { text-align: right; margin-left: auto; }
.kb-pagenav__dir {
	display: block;
	font-size: 12px;
	color: var(--kb-slate-400);
	margin-bottom: 2px;
}
.kb-pagenav__title { font-size: 14px; font-weight: 500; color: var(--kb-slate-900); }

/* ==========================================================================
   Index / landing (archive of all sections)
   ========================================================================== */

.kb-index__intro h1 { font-size: 36px; font-weight: 600; color: var(--kb-slate-900); margin: 0 0 12px; }
.kb-index__intro p { font-size: 17px; color: var(--kb-slate-600); max-width: 640px; }

.kb-index__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	margin-top: 40px;
}
.kb-card {
	display: block;
	border: 1px solid var(--kb-slate-200);
	border-radius: 10px;
	padding: 20px;
	background: var(--kb-surface);
}
.kb-card:hover { border-color: var(--kb-brand-600); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.kb-card__title { display: block; font-size: 16px; font-weight: 600; color: var(--kb-slate-900); margin: 0 0 6px; }
/* Margin (not the space characters around the <span> in the markup) is
   what creates the gap either side of the pipe — see dmarc_kb_title_html()
   in functions.php for why. */
.kb-title-pipe { color: var(--kb-slate-300); font-weight: 400; margin: 0 0.35em; }
.kb-card__title:hover { color: var(--kb-brand-600); }
.kb-card__desc { font-size: 14px; color: var(--kb-slate-500); margin: 0 0 12px; }
.kb-card__list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.kb-card__list li { padding: 3px 0; color: var(--kb-slate-600); }
.kb-card__list a:hover { color: var(--kb-brand-600); }

/* Search results — one stacked result per match (title, section, snippet,
   then links to that article's own headings) instead of the boxed card
   grid above; see search.php. */
.kb-results {
	list-style: none;
	margin: 32px 0 0;
	padding: 0;
	max-width: 680px;
}
.kb-result { padding: 20px 0; }
.kb-result + .kb-result { border-top: 1px solid var(--kb-slate-200); }
.kb-result__title {
	display: inline-block;
	font-size: 19px;
	font-weight: 600;
	color: var(--kb-slate-900);
}
.kb-result__title:hover { color: var(--kb-brand-600); text-decoration: underline; }
.kb-result__breadcrumb {
	font-size: 12.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--kb-brand-600);
	margin: 4px 0 0;
}
.kb-result__desc { font-size: 15px; line-height: 24px; color: var(--kb-slate-600); margin: 8px 0 0; }
.kb-result__sections {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 20px;
}
.kb-result__sections a {
	font-size: 13.5px;
	color: var(--kb-brand-600);
}
.kb-result__sections a:hover { text-decoration: underline; }

/* "Popular" pills under a landing page's intro text (Home, "Using the
   platform", Guidelines) — see dmarc_kb_popular_pills() in functions.php. */
.kb-popular { margin: 28px 0 0; }
.kb-popular__label {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--kb-slate-400);
	margin: 0 0 10px;
}
.kb-popular__list { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-pill {
	display: inline-flex;
	align-items: center;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--kb-slate-100);
	border: 1px solid var(--kb-slate-200);
	color: var(--kb-slate-700);
	font-size: 13.5px;
	font-weight: 500;
}
.kb-pill:hover { background: var(--kb-brand-50); border-color: var(--kb-brand-100); color: var(--kb-brand-700); }

/* ==========================================================================
   Terminology (glossary index — archive-kb_term.php)
   ========================================================================== */

.kb-terms-list {
	list-style: none;
	margin: 40px 0 0;
	padding: 0;
	max-width: 720px;
	border-top: 1px solid var(--kb-slate-200);
}
.kb-term-entry {
	padding: 20px 0;
	border-bottom: 1px solid var(--kb-slate-200);
	scroll-margin-top: calc(var(--kb-header-h) + 16px);
}
.kb-term-entry__name {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 600;
	color: var(--kb-slate-900);
}
.kb-term-entry__def { font-size: 15px; line-height: 24px; color: var(--kb-slate-600); }
.kb-term-entry__def p { margin: 0 0 10px; }
.kb-term-entry__def p:last-child { margin-bottom: 0; }
.kb-term-entry__def a { color: var(--kb-brand-600); }
.kb-term-entry__def a:hover { text-decoration: underline; }

/* ==========================================================================
   Footer
   ========================================================================== */

.kb-footer {
	background: var(--kb-footer-bg);
	border-top: 1px solid var(--kb-slate-200);
	padding: 24px 40px;
	text-align: center;
	font-size: 13px;
	color: var(--kb-slate-500);
}
/* html carries the footer colour too: on a short page the space under the footer
   then continues the footer instead of showing the page colour again. (body keeps
   its own background, so the content area is unchanged.) */
html { background: var(--kb-footer-bg); }

/* build: 1790676371 */
/* retry-bust: 1790679441 */


/* Page version number: small and light at the bottom of an article */
.kb-article p.kb-version,
.kb-version {
	margin: 48px 0 0;
	font-size: 11px;
	line-height: 16px;
	color: var(--kb-faint); /* two steps lighter than slate-400: present, but not distracting */
	text-align: right;
}


/* Video chips ([kb_video]) and the modal window they open */
.kb-article p.kb-video-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 18px;
	line-height: 1;
}
.kb-video-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px 6px 10px;
	border: 1px solid var(--kb-slate-200);
	border-radius: 999px;
	background: var(--kb-surface);
	color: var(--kb-slate-700);
	font: 500 13px/1.2 var(--kb-font-sans);
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease;
}
.kb-video-btn:hover { background: var(--kb-brand-50); border-color: var(--kb-brand-100); color: var(--kb-slate-900); }
.kb-video-btn:focus-visible { outline: 2px solid var(--kb-brand-600); outline-offset: 2px; }
.kb-video-btn__icon { color: var(--kb-brand-600); flex-shrink: 0; }
.kb-video-btn__time { color: var(--kb-slate-400); font-variant-numeric: tabular-nums; font-weight: 400; }

html.kb-video-open { overflow: hidden; }
.kb-video-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}
.kb-video-modal[hidden] { display: none; }
.kb-video-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.72); }
.kb-video-modal__panel {
	position: relative;
	width: min(960px, 100%);
	background: var(--kb-surface);
	border-radius: 10px;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.45);
	overflow: hidden;
}
.kb-video-modal__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; }
.kb-video-modal__title { margin: 0; font-size: 14px; font-weight: 600; color: var(--kb-slate-800); line-height: 1.3; }
.kb-video-modal__close {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--kb-slate-600);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
.kb-video-modal__close:hover { background: var(--kb-slate-100); color: var(--kb-slate-900); }
.kb-video-modal__close:focus-visible, .kb-video-modal__yt:focus-visible { outline: 2px solid var(--kb-brand-600); outline-offset: 2px; }
.kb-video-modal__frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.kb-video-modal__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.kb-video-modal__foot { margin: 0; padding: 10px 18px 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--kb-slate-500); }
.kb-video-modal__note:empty { display: none; }
@media (max-width: 640px) { .kb-video-modal { padding: 8px; } }


/* ==========================================================================
   Dark theme
   Follows the visitor's system/browser setting (prefers-color-scheme), like the
   DMARC Manager app: neutral near-black instead of grey/slate. The slate scale
   is simply inverted, so every component that uses the tokens follows along.
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;

		--kb-slate-50: #0d0d0d;   /* page background */
		--kb-slate-100: #1a1a1a;  /* subtle fills */
		--kb-slate-200: #2a2a2a;  /* borders */
		--kb-slate-300: #3a3a3a;
		--kb-slate-400: #7d7d7d;
		--kb-slate-500: #9a9a9a;  /* muted text */
		--kb-slate-600: #b5b5b5;
		--kb-slate-700: #cfcfcf;
		--kb-slate-800: #e4e4e4;  /* body text */
		--kb-slate-900: #f5f5f5;  /* headings */

		/* Brand red: lighter for text and links, tool red for filled buttons */
		--kb-brand-50: rgba(240, 96, 96, 0.12);
		--kb-brand-100: rgba(240, 96, 96, 0.24);
		--kb-brand-600: #f07a7a;
		--kb-brand-700: #f7a3a3;
		--kb-btn-bg: #cc3333;
		--kb-btn-hover: #b82c2c;

		--kb-menu-tint: rgba(var(--kb-tool-red), 0.14);
		--kb-menu-line: rgba(var(--kb-tool-red), 0.32);
		--kb-menu-hover: rgba(var(--kb-tool-red), 0.2);
		--kb-menu-active: rgba(var(--kb-tool-red), 0.3);

		--kb-note: #60a5fa;
		--kb-tip: #4ade80;
		--kb-warning: #fbbf24;
		--kb-important: #f87171;

		--kb-surface: #161616;
	--kb-footer-bg: #0a0a0a;
		--kb-header-bg: rgba(13, 13, 13, 0.88);
		--kb-glass: rgba(255, 255, 255, 0.04);
		--kb-faint: #3d3d3d;
		--kb-code-bg: #050505;
	}

	/* Code blocks keep a border so they stand out against the black page */
	:root:not([data-theme="light"]) .kb-article pre { border: 1px solid var(--kb-slate-200); }

	/* Fallback only: the logo gets a proper dark variant (inc/dark-logo.php) */
	:root:not([data-theme="light"]) .kb-header__logo img.kb-logo-invert { filter: invert(1) hue-rotate(180deg); }

	/* Screenshots from the (light) app: slightly toned down so they don't glare */
	:root:not([data-theme="light"]) .kb-article img { filter: brightness(0.9) contrast(1.05); }

	:root:not([data-theme="light"]) ::selection { background: rgba(240, 96, 96, 0.35); }
}

/* Manual override (footer toggle, see assets/js/theme-toggle.js): same palette, forced on */
:root[data-theme="dark"] {
	color-scheme: dark;

	--kb-slate-50: #0d0d0d;   /* page background */
	--kb-slate-100: #1a1a1a;  /* subtle fills */
	--kb-slate-200: #2a2a2a;  /* borders */
	--kb-slate-300: #3a3a3a;
	--kb-slate-400: #7d7d7d;
	--kb-slate-500: #9a9a9a;  /* muted text */
	--kb-slate-600: #b5b5b5;
	--kb-slate-700: #cfcfcf;
	--kb-slate-800: #e4e4e4;  /* body text */
	--kb-slate-900: #f5f5f5;  /* headings */

	/* Brand red: lighter for text and links, tool red for filled buttons */
	--kb-brand-50: rgba(240, 96, 96, 0.12);
	--kb-brand-100: rgba(240, 96, 96, 0.24);
	--kb-brand-600: #f07a7a;
	--kb-brand-700: #f7a3a3;
	--kb-btn-bg: #cc3333;
	--kb-btn-hover: #b82c2c;

	--kb-menu-tint: rgba(var(--kb-tool-red), 0.14);
	--kb-menu-line: rgba(var(--kb-tool-red), 0.32);
	--kb-menu-hover: rgba(var(--kb-tool-red), 0.2);
	--kb-menu-active: rgba(var(--kb-tool-red), 0.3);

	--kb-note: #60a5fa;
	--kb-tip: #4ade80;
	--kb-warning: #fbbf24;
	--kb-important: #f87171;

	--kb-surface: #161616;
	--kb-footer-bg: #0a0a0a;
	--kb-header-bg: rgba(13, 13, 13, 0.88);
	--kb-glass: rgba(255, 255, 255, 0.04);
	--kb-faint: #3d3d3d;
	--kb-code-bg: #050505;
}

/* Code blocks keep a border so they stand out against the black page */
:root[data-theme="dark"] .kb-article pre { border: 1px solid var(--kb-slate-200); }

/* Fallback only: the logo gets a proper dark variant (inc/dark-logo.php) */
:root[data-theme="dark"] .kb-header__logo img.kb-logo-invert { filter: invert(1) hue-rotate(180deg); }

/* Screenshots from the (light) app: slightly toned down so they don't glare */
:root[data-theme="dark"] .kb-article img { filter: brightness(0.9) contrast(1.05); }

:root[data-theme="dark"] ::selection { background: rgba(240, 96, 96, 0.35); }

:root[data-theme="light"] { color-scheme: light; }

/* FAQ section (v1.8.0): one accordion item per question */
.kb-faq { margin-top: 8px; border-top: 1px solid var(--kb-slate-200); }
.kb-faq__item { border-bottom: 1px solid var(--kb-slate-200); }
.kb-faq__item > summary { cursor: pointer; list-style: none; padding: 16px 28px 16px 0; font-weight: 600; position: relative; }
.kb-faq__item > summary::-webkit-details-marker { display: none; }
.kb-faq__item > summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font-size: 20px; font-weight: 400; color: var(--kb-brand-600); }
.kb-faq__item[open] > summary::after { content: "\2212"; }
.kb-faq__answer { padding: 0 0 12px; }

/* Light/dark toggle in the footer: small and quiet on purpose */
.kb-footer__inner { display: inline-flex; align-items: center; gap: 10px; }
.kb-theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--kb-slate-400); cursor: pointer; opacity: 0.7; }
.kb-theme-toggle:hover, .kb-theme-toggle:focus-visible { opacity: 1; color: var(--kb-slate-600); }
.kb-theme-toggle svg { width: 15px; height: 15px; }

/* FAQ topics */
.kb-faq-group { margin-top: 32px; scroll-margin-top: calc(var(--kb-header-h) + 16px); }
.kb-faq-group > h2 { font-size: 20px; margin: 0 0 4px; }
.kb-faq-group .kb-faq { margin-top: 4px; }

/* Guide to full enforcement (roadmap) */
.kb-sidebar__list li.kb-sidebar__sub a { padding-left: 24px; }
.kb-roadmap { list-style: none; margin: 8px 0 0; padding: 0; }
.kb-roadmap li { margin: 0; }
.kb-roadmap a { display: block; padding: 8px 0; border-bottom: 1px solid var(--kb-slate-200); color: var(--kb-slate-700); }
.kb-roadmap a:hover { color: var(--kb-brand-600); }
.kb-roadmap__phase a { font-weight: 600; margin-top: 12px; color: var(--kb-slate-900); border-bottom-color: var(--kb-slate-300); }
.kb-roadmap__step a { padding-left: 20px; }

/* Stronger variant of the red "important" alert (pct notice) */
.kb-alert--strong { background: rgba(184, 44, 44, 0.08); border-left-width: 4px; padding: 14px 18px; margin: 0 0 24px; }
.kb-alert--strong p { margin: 0 0 8px; }
.kb-alert--strong p:last-child { margin-bottom: 0; }
.kb-alert--strong .kb-alert__title { font-size: 17px; }

/* Links in article text never break across two lines. Very long link texts
   (marked by assets/js/link-wrap.js) may still wrap, so they cannot push the
   page wider than a phone screen. */
.kb-article a,
.kb-term-entry__def a,
.kbe-root a {
	white-space: nowrap;
}
.kb-article a.kb-link-long,
.kb-term-entry__def a.kb-link-long,
.kbe-root a.kb-link-long {
	white-space: normal;
}

/* Edit pencil next to a glossary term (translators only). Light grey, gently pulsing. */
.kbe-edit-link { display: inline-flex; vertical-align: middle; margin-left: 8px; padding: 4px; line-height: 1; color: #c3c8cf; border-radius: 6px; text-decoration: none; animation: kbe-pencil-pulse 2.8s ease-in-out infinite; transition: color .15s ease, background-color .15s ease; }
.kbe-edit-link svg { display: block; }
.kbe-edit-link:hover, .kbe-edit-link:focus-visible { color: var(--kb-brand-700, #9a2424); background: var(--kb-brand-50, #fdf1f1); animation: none; opacity: 1; }
@keyframes kbe-pencil-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .kbe-edit-link { animation: none; opacity: .8; } }
