/* ==========================================================================
   Toolbench Green – tokens, reset, base layout.
   Every reusable colour/size is a CSS custom property. The Customizer overrides the
   --tbg-* colour tokens, content width and article font size with an inline :root block.
   ========================================================================== */
:root {
	--tbg-primary: #16834a;
	--tbg-primary-dark: #11683b;
	--tbg-primary-light: #eaf7ef;
	--tbg-bg: #f6f8f6;
	--tbg-article-bg: #ffffff;
	--tbg-text: #202923;
	--tbg-muted: #5c685f;
	--tbg-border: #e1e8e2;
	--tbg-link: #11683b;
	--tbg-btn-bg: #16834a;
	--tbg-btn-text: #ffffff;
	--tbg-header-bg: #000000;
	--tbg-shell-bg: #eef4ef;
	--tbg-panel-border: #a9d8bc;
	--tbg-field-border: #d3dad4;

	--tbg-content-width: 760px;
	--tbg-article-size: 18px;
	--tbg-wide: 1240px;

	--tbg-radius-sm: 10px;
	--tbg-radius: 14px;
	--tbg-radius-lg: 20px;
	--tbg-radius-xl: 28px;

	--tbg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
	--tbg-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	--tbg-header-h: 72px;
}

@supports (color: color-mix(in srgb, red, blue)) {
	:root {
		--tbg-primary-light: color-mix(in srgb, var(--tbg-primary) 10%, #fff);
		--tbg-shell-bg: color-mix(in srgb, var(--tbg-primary) 7%, #fff);
		--tbg-panel-border: color-mix(in srgb, var(--tbg-primary) 38%, #fff);
	}
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--tbg-bg);
	color: var(--tbg-text);
	font-family: var(--tbg-font);
	font-size: 1rem;
	line-height: 1.6;
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
}

img, svg, video, canvas, iframe { max-width: 100%; }
img, video { height: auto; }
a { color: var(--tbg-link); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; }
p { margin: 0 0 1em; }

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

.tbg-main {
	flex: 1 0 auto;
	width: 100%;
	max-width: var(--tbg-wide);
	margin: 0 auto;
	padding: 1.75rem 1rem 2.5rem;
	background: var(--tbg-article-bg);
}

@media (min-width: 1024px) {
	.tbg-main { padding: 2.5rem 2.5rem 3rem; margin-top: 1.5rem; margin-bottom: 1.5rem; border-radius: var(--tbg-radius-lg); }
}

.tbg-layout { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
	.tbg-has-sidebar .tbg-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
/* Header */
.tbg-header { position: relative; z-index: 50; background: var(--tbg-header-bg); color: #fff; }

.tbg-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1480px;
	min-height: 56px;
	margin: 0 auto;
	padding: 0 1rem;
}

.tbg-brand { display: flex; flex-direction: column; justify-content: center; padding: 0.55rem 0; min-width: 0; }
.tbg-brand__title {
	color: #fff;
	font-size: clamp(1.35rem, 5vw, 2rem);
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.15;
	text-decoration: none;
}
.tbg-brand__tagline { display: none; margin: 0.15rem 0 0; color: rgba(255, 255, 255, 0.75); font-size: 0.85rem; line-height: 1.3; }
.tbg-brand .custom-logo-link { display: block; line-height: 0; }
.tbg-brand .custom-logo { display: block; width: auto; max-height: 44px; }

@media (min-width: 861px) {
	.tbg-header__inner { min-height: var(--tbg-header-h); padding: 0 clamp(1rem, 4vw, 5rem); }
	.tbg-brand__tagline { display: block; }
}
/* Navigation: mobile-first dropdown panel, desktop inline menu. */
.tbg-menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 44px;
	padding: 0 0.25rem;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.05rem;
	font-weight: 700;
	cursor: pointer;
}
.tbg-menu-toggle__open, .tbg-menu-toggle__close { display: inline-flex; }
.tbg-menu-toggle__close { display: none; }
.tbg-menu-toggle[aria-expanded="true"] .tbg-menu-toggle__open { display: none; }
.tbg-menu-toggle[aria-expanded="true"] .tbg-menu-toggle__close { display: inline-flex; }
.no-js .tbg-menu-toggle { display: none; }

.tbg-menu, .tbg-menu ul { list-style: none; margin: 0; padding: 0; }
.tbg-menu a { text-decoration: none; }

/* ---- Mobile / tablet ---- */
@media (max-width: 860px) {
	.tbg-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		max-height: calc(100vh - 60px);
		max-height: calc(100dvh - 60px);
		overflow-y: auto;
		background: var(--tbg-header-bg);
		box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.45);
	}
	.tbg-header.is-menu-open .tbg-nav { display: block; }
	.no-js .tbg-nav { display: block; position: static; max-height: none; }

	.tbg-menu > li { position: relative; }
	.tbg-menu a {
		display: block;
		min-height: 3.75rem;
		padding: 1.05rem 1.25rem;
		color: #fff;
		font-size: 1.15rem;
		font-weight: 700;
		line-height: 1.5;
	}
	.tbg-menu .current-menu-item > a,
	.tbg-menu .current-menu-ancestor > a,
	.tbg-menu .menu-item-has-children.is-open > a { background: var(--tbg-primary-dark); }
	.tbg-menu .menu-item-has-children > a { padding-right: 4.25rem; }

	.tbg-submenu-toggle {
		position: absolute;
		top: 0;
		right: 0;
		width: 4rem;
		height: 3.75rem;
		display: flex;
		align-items: center;
		justify-content: center;
		border: 0;
		background: transparent;
		color: #fff;
		cursor: pointer;
	}
	.tbg-submenu-toggle svg { transition: transform 0.2s ease; }
	.is-open > .tbg-submenu-toggle svg { transform: rotate(180deg); }

	.tbg-menu .sub-menu { display: none; background: var(--tbg-primary); }
	.tbg-menu .is-open > .sub-menu, .no-js .tbg-menu .sub-menu { display: block; }
	.tbg-menu .sub-menu a { min-height: 3.25rem; padding: 0.85rem 1.25rem; font-size: 1.05rem; }
	.tbg-menu .sub-menu .current-menu-item > a { background: var(--tbg-primary-dark); }
}

/* ---- Desktop ---- */
@media (min-width: 861px) {
	.tbg-menu-toggle { display: none; }
	.tbg-nav { display: block; }
	.tbg-menu { display: flex; align-items: stretch; height: var(--tbg-header-h); }
	.tbg-menu > li { position: relative; display: flex; align-items: stretch; }
	.tbg-menu > li > a {
		display: flex;
		align-items: center;
		padding: 0 1.4rem;
		color: #fff;
		font-size: 1.05rem;
		font-weight: 700;
	}
	.tbg-menu > li > a:hover { background: rgba(255, 255, 255, 0.14); }
	.tbg-menu > .current-menu-item > a,
	.tbg-menu > .current-menu-ancestor > a { background: var(--tbg-primary-dark); }
	.tbg-menu > .menu-item-has-children > a { padding-right: 0.3rem; }

	.tbg-submenu-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 2.4rem;
		border: 0;
		background: transparent;
		color: #fff;
		cursor: pointer;
	}
	.tbg-submenu-toggle:hover { background: rgba(255, 255, 255, 0.14); }
	.tbg-submenu-toggle svg { width: 18px; height: 18px; }

	.tbg-menu .sub-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 60;
		min-width: 250px;
		background: var(--tbg-header-bg);
		border-top: 3px solid var(--tbg-primary);
		box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.5);
	}
	.tbg-menu > li:last-child > .sub-menu { left: auto; right: 0; }
	.tbg-menu .menu-item-has-children:hover > .sub-menu,
	.tbg-menu .menu-item-has-children:focus-within > .sub-menu,
	.tbg-menu .menu-item-has-children.is-open > .sub-menu { display: block; }
	.tbg-menu .sub-menu a { display: block; padding: 0.9rem 1.25rem; color: #fff; font-weight: 600; }
	.tbg-menu .sub-menu a:hover { background: var(--tbg-primary); }
	.tbg-menu .sub-menu .current-menu-item > a { background: var(--tbg-primary-dark); }
}
/* Footer */
.tbg-footer { background: var(--tbg-header-bg); color: #fff; text-align: center; }
.tbg-footer__inner { max-width: var(--tbg-wide); margin: 0 auto; padding: 1.4rem 1rem 1.5rem; }
.tbg-footer a { color: #fff; }
.tbg-footer__text { margin: 0.5rem 0 0; font-size: 1rem; font-weight: 600; }
.tbg-footer__top { margin: 0.6rem 0 0; font-size: 0.9rem; }
.tbg-footer-nav { margin: 0 0 0.75rem; }
.tbg-footer-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1.5rem; list-style: none; margin: 0; padding: 0; }
.tbg-footer-menu a { display: inline-block; padding: 0.4rem 0; font-weight: 600; }
/* Long-form reading: articles, pages, archive headers, widgets, comments. White surface, dark text. */
.tbg-layout__main > .tbg-article,
.tbg-layout__main > .tbg-comments { max-width: var(--tbg-content-width); margin-left: auto; margin-right: auto; }
.tbg-has-sidebar .tbg-layout__main > .tbg-article { margin-left: 0; margin-right: 0; }

.tbg-article .entry-header { margin-bottom: 1.5rem; }
.entry-title { margin: 0 0 0.6rem; font-size: clamp(1.9rem, 6vw, 2.75rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.entry-meta, .tbg-result__meta { color: var(--tbg-muted); font-size: 0.92rem; margin: 0; }
.entry-thumbnail { margin: 0 0 1.75rem; }
.entry-thumbnail img { width: 100%; border-radius: var(--tbg-radius); }

.entry-content {
	color: var(--tbg-text);
	font-size: clamp(17px, 4.6vw, var(--tbg-article-size));
	line-height: 1.7;
	overflow-wrap: anywhere;
}
.entry-content > *:first-child { margin-top: 0; }
.entry-content p, .entry-content ul, .entry-content ol, .entry-content blockquote, .entry-content pre, .entry-content figure, .entry-content table { margin-top: 0; margin-bottom: 1.25em; }
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 { margin: 1.8em 0 0.6em; font-weight: 800; letter-spacing: -0.01em; }
.entry-content h2 { font-size: 1.55em; }
.entry-content h3 { font-size: 1.28em; }
.entry-content h4 { font-size: 1.1em; }
.entry-content a { color: var(--tbg-link); text-decoration: underline; text-underline-offset: 0.15em; }
.entry-content a:hover { text-decoration-thickness: 2px; }
.entry-content ul, .entry-content ol { padding-left: 1.5em; }
.entry-content li { margin-bottom: 0.45em; }
.entry-content li::marker { color: var(--tbg-primary); font-weight: 700; }
.entry-content blockquote { margin-left: 0; margin-right: 0; padding: 0.4em 0 0.4em 1.2em; border-left: 4px solid var(--tbg-primary); color: var(--tbg-muted); font-style: italic; }
.entry-content blockquote cite { display: block; margin-top: 0.5em; font-size: 0.9em; font-style: normal; }
.entry-content code, .entry-content kbd { padding: 0.15em 0.4em; border-radius: 6px; background: #f0f4f0; font-family: var(--tbg-mono); font-size: 0.9em; }
.entry-content pre { overflow-x: auto; padding: 1em 1.2em; border-radius: var(--tbg-radius-sm); background: #f0f4f0; line-height: 1.5; }
.entry-content pre code { padding: 0; background: none; }
.entry-content table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.entry-content th, .entry-content td { padding: 0.65em 0.9em; border: 1px solid var(--tbg-border); text-align: left; }
.entry-content th { background: var(--tbg-primary-light); }
.entry-content img { border-radius: var(--tbg-radius-sm); }
.entry-content figcaption, .wp-caption-text, .wp-element-caption { margin-top: 0.5em; color: var(--tbg-muted); font-size: 0.88em; text-align: center; }
.entry-content hr { border: 0; border-top: 1px solid var(--tbg-border); margin: 2em 0; }
.entry-content iframe, .entry-content video, .entry-content embed { max-width: 100%; }
.wp-block-embed__wrapper iframe { max-width: 100%; }
.alignleft { float: left; margin: 0.3em 1.2em 1em 0; }
.alignright { float: right; margin: 0.3em 0 1em 1.2em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.gallery { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
@media (max-width: 600px) { .alignleft, .alignright { float: none; margin: 0 auto 1em; display: block; } }

.entry-footer { margin-top: 2rem; }
.tbg-tags { margin: 0; }
.tbg-tags a { display: inline-block; margin: 0 0.35rem 0.5rem 0; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--tbg-primary-light); color: var(--tbg-primary-dark); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.page-links { margin: 1.5rem 0; font-weight: 600; }

/* Breadcrumbs */
.tbg-breadcrumbs { margin: 0 0 1.25rem; font-size: 0.9rem; color: var(--tbg-muted); }
.tbg-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; }
.tbg-breadcrumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--tbg-border); }
.tbg-breadcrumbs a { color: var(--tbg-link); }

/* Archive header, search, none */
.tbg-archive-header { margin-bottom: 1.75rem; }
.tbg-archive-header h1 { margin: 0 0 0.5rem; font-size: clamp(1.8rem, 5.5vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; }
.tbg-archive-description { color: var(--tbg-muted); max-width: 60ch; }
.search-form { display: flex; gap: 0.5rem; max-width: 520px; margin: 1rem 0; }
.search-form label { flex: 1; }
.search-field { width: 100%; min-height: 48px; padding: 0.6rem 0.9rem; border: 2px solid var(--tbg-field-border); border-radius: var(--tbg-radius-sm); background: #fff; }
.search-submit { min-height: 48px; padding: 0 1.2rem; border: 0; border-radius: var(--tbg-radius-sm); background: var(--tbg-btn-bg); color: var(--tbg-btn-text); font-weight: 700; cursor: pointer; }
.tbg-results { display: grid; gap: 1.25rem; }
.tbg-result { padding-bottom: 1.25rem; border-bottom: 1px solid var(--tbg-border); }
.tbg-result__title { margin: 0 0 0.3rem; font-size: 1.3rem; }
.tbg-none { max-width: 620px; }

/* Pagination & post navigation */
.pagination .nav-links, .comments-pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 2rem; }
.page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 0.9rem; border: 2px solid var(--tbg-field-border); border-radius: 12px; color: var(--tbg-text); font-weight: 700; text-decoration: none; }
.page-numbers.current { background: var(--tbg-primary); border-color: var(--tbg-primary); color: #fff; }
.post-navigation .nav-links { display: grid; gap: 1rem; margin: 2.5rem auto 0; max-width: var(--tbg-content-width); }
@media (min-width: 640px) { .post-navigation .nav-links { grid-template-columns: 1fr 1fr; } }
.post-navigation a { display: block; padding: 1rem; border: 1px solid var(--tbg-border); border-radius: var(--tbg-radius); text-decoration: none; color: var(--tbg-text); }
.post-navigation .nav-next { text-align: right; }
.nav-subtitle { display: block; color: var(--tbg-muted); font-size: 0.85rem; }
.nav-title { font-weight: 700; }

/* Sidebar & widgets */
.tbg-sidebar .widget { margin-bottom: 1.75rem; padding: 1.1rem; border: 1px solid var(--tbg-border); border-radius: var(--tbg-radius); background: #fff; }
.widget-title { margin: 0 0 0.75rem; font-size: 1.1rem; }
.tbg-sidebar ul { margin: 0; padding-left: 1.2rem; }

/* Comments */
.tbg-comments { margin-top: 3rem; }
.comments-title { font-size: 1.4rem; }
.comment-list, .comment-list ol { list-style: none; padding: 0; }
.comment-list .children { padding-left: 1.25rem; }
.comment-body { margin-bottom: 1.25rem; padding: 1rem; border: 1px solid var(--tbg-border); border-radius: var(--tbg-radius); }
.comment-author .avatar { float: left; margin-right: 0.75rem; border-radius: 50%; }
.comment-metadata, .comment-metadata a { color: var(--tbg-muted); font-size: 0.85rem; }
.comment-form label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; padding: 0.7rem 0.9rem; border: 2px solid var(--tbg-field-border); border-radius: var(--tbg-radius-sm); }
.comment-form .submit { min-height: 48px; padding: 0 1.4rem; border: 0; border-radius: var(--tbg-radius-sm); background: var(--tbg-btn-bg); color: var(--tbg-btn-text); font-weight: 700; cursor: pointer; }

.tbg-admin-hint { padding: 0.75rem 1rem; border: 1px dashed var(--tbg-panel-border); border-radius: var(--tbg-radius-sm); background: var(--tbg-primary-light); font-size: 0.9rem; text-align: center; }
/* Accessibility helpers */
.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;
	width: 1px;
	word-wrap: normal !important;
}
.screen-reader-text:focus, .skip-link:focus {
	clip: auto;
	clip-path: none;
	background: #fff;
	color: #111;
	display: block;
	font-weight: 700;
	height: auto;
	left: 0.5rem;
	top: 0.5rem;
	padding: 0.9rem 1.2rem;
	width: auto;
	z-index: 100000;
	border-radius: var(--tbg-radius-sm);
	box-shadow: 0 0 0 3px var(--tbg-primary-dark);
	text-decoration: none;
}

/* Visible keyboard focus everywhere (dark green on light surfaces, white on dark/green surfaces). */
:focus-visible { outline: 3px solid var(--tbg-primary-dark); outline-offset: 2px; }
.tbg-header :focus-visible,
.tbg-footer :focus-visible,
.tbg-tool-content details[open] > summary:focus-visible,
.tbg-btn--primary:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px var(--tbg-primary-dark); }
.tbg-header :focus-visible, .tbg-footer :focus-visible { box-shadow: none; outline-offset: -3px; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

@media (forced-colors: active) {
	.tbg-chip[aria-pressed="true"], .tbg-check:has(input:checked) { outline: 2px solid Highlight; }
	.tbg-meter span { forced-color-adjust: none; }
}
