/**
 * WB Member Wiki - Frontend Styles
 *
 * @package WB_Member_Wiki
 * @since 1.0.0
 */

/* ─── Base ──────────────────────────────────────── */

/*
 * Design tokens. Every colour the wiki paints comes from here. Each one follows
 * the active theme, so the wiki looks native and flips with the theme's dark
 * mode: BuddyX (--bx-color-*), then Reign (--reign-*), then block themes
 * (--wp--preset--*), then a neutral fallback. Declared on body so themes that
 * switch dark mode on <body> are followed as well as those using <html>.
 */
body {
	--wbmw-accent: var(--bx-color-accent, var(--reign-site-button-bg-color, var(--color-theme-primary, var(--wp--preset--color--primary, #2563eb))));
	--wbmw-accent-hover: var(--bx-color-button-bg-hover, var(--reign-site-button-bg-hover-color, var(--wbmw-accent)));
	--wbmw-on-accent: var(--bx-color-accent-inverse, var(--reign-site-button-text-color, var(--button-text-color, #fff)));
	--wbmw-heading: var(--bx-color-heading, var(--bx-color-h2, var(--reign-site-headings-color, var(--wp--preset--color--contrast, #1d2327))));
	--wbmw-text: var(--bx-color-fg, var(--reign-site-body-text-color, var(--wp--preset--color--contrast, #2c3338)));
	--wbmw-text-muted: var(--bx-color-fg-muted, var(--reign-site-alternate-text-color, #646970));
	--wbmw-surface: var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, var(--wp--preset--color--base, #fff)));
	--wbmw-surface-subtle: var(--bx-color-bg-subtle, var(--reign-site-secondary-bg-color, #f6f7f7));
	--wbmw-input-bg: var(--bx-color-input-bg, var(--reign-form-background-color, var(--wbmw-surface)));
	--wbmw-border: var(--bx-color-border, var(--reign-site-border-color, #e2e4e7));
	--wbmw-border-strong: var(--bx-color-border-strong, var(--wbmw-border));
	--wbmw-success: var(--bx-color-success, var(--reign-color-success, #16a34a));
	--wbmw-warning: var(--bx-color-warning, #d97706);
	--wbmw-danger: var(--bx-color-error, var(--reign-color-error, #dc2626));
	--wbmw-info: var(--bx-color-info, var(--reign-color-info, var(--wbmw-accent)));
	--wbmw-on-danger: #fff;
	/* Text versions of the accent and danger colours. Brand fills stay as the
	   theme set them; text is nudged toward the heading colour so it passes AA
	   on light and dark surfaces alike. */
	--wbmw-link: var(--wbmw-accent);
	--wbmw-danger-text: var(--wbmw-danger);
	/* Tints fall back to the subtle surface; where color-mix() works they are
	   mixed from the live surface, so they stay soft on light themes and dark
	   on dark ones. */
	--wbmw-accent-soft: var(--wbmw-surface-subtle);
	--wbmw-success-soft: var(--wbmw-surface-subtle);
	--wbmw-warning-soft: var(--wbmw-surface-subtle);
	--wbmw-danger-soft: var(--wbmw-surface-subtle);
	--wbmw-info-soft: var(--wbmw-surface-subtle);
	--wbmw-danger-hover: var(--wbmw-danger);
	--wbmw-radius: 8px;
	--wbmw-radius-sm: 6px;
	--wbmw-shadow: var(--bx-shadow-card-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
	--wbmw-shadow-lg: 0 8px 24px var(--bx-color-shadow, rgba(0, 0, 0, 0.12));
	--wbmw-control-h: 40px;
	--wbmw-control-h-sm: 34px;
}
@supports (color: color-mix(in srgb, red, blue)) {
	body {
		--wbmw-accent-hover: var(--bx-color-button-bg-hover, var(--reign-site-button-bg-hover-color, color-mix(in srgb, var(--wbmw-accent) 85%, #000)));
		--wbmw-surface-subtle: var(--bx-color-bg-subtle, var(--reign-site-secondary-bg-color, color-mix(in srgb, var(--wbmw-text) 5%, var(--wbmw-surface))));
		--wbmw-danger-hover: color-mix(in srgb, var(--wbmw-danger) 85%, #000);
		--wbmw-link: color-mix(in srgb, var(--wbmw-accent) 78%, var(--wbmw-heading));
		--wbmw-danger-text: color-mix(in srgb, var(--wbmw-danger) 70%, var(--wbmw-heading));
		--wbmw-accent-soft: color-mix(in srgb, var(--wbmw-accent) 8%, var(--wbmw-surface));
		--wbmw-success-soft: color-mix(in srgb, var(--wbmw-success) 10%, var(--wbmw-surface));
		--wbmw-warning-soft: color-mix(in srgb, var(--wbmw-warning) 12%, var(--wbmw-surface));
		--wbmw-danger-soft: color-mix(in srgb, var(--wbmw-danger) 10%, var(--wbmw-surface));
		--wbmw-info-soft: color-mix(in srgb, var(--wbmw-info) 10%, var(--wbmw-surface));
	}
}

.wbmw-dashboard,
.wbmw-editor-wrap,
.wbmw-page-view,
.wbmw-history,
.wbmw-diff,
.wbmw-search-results,
.wbmw-contributions,
.wbmw-category-browse,
.wbmw-recent-changes,
.wbmw-watchlist,
.wbmw-pending-queue {
	max-width: 960px;
	margin: 0 auto;
	padding: 20px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--wbmw-text);
}

/* ─── Buttons ───────────────────────────────────── */

/*
 * One ladder for every wiki button: secondary (default and -outline), primary,
 * danger (quiet until hovered, so a list of rows is not a wall of red) and link.
 * Sizes: default 40px, -sm 34px for dense rows. Colours and text decoration are
 * set on every state so a theme's own button and link styles cannot leak in.
 * The .buddypress-wrap entries outrank BuddyPress's own button rules inside
 * group and profile tabs.
 */
.wbmw-btn,
a.wbmw-btn,
button.wbmw-btn,
.buddypress .buddypress-wrap .wbmw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	box-sizing: border-box;
	min-height: var(--wbmw-control-h);
	margin: 0;
	padding: 0 16px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	white-space: nowrap;
	border: 1px solid var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius-sm);
	background: var(--wbmw-surface);
	color: var(--wbmw-heading);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wbmw-btn:hover,
.wbmw-btn:focus,
.wbmw-btn-outline:hover,
.wbmw-btn-outline:focus,
.buddypress .buddypress-wrap .wbmw-btn:hover,
.buddypress .buddypress-wrap .wbmw-btn:focus {
	background: var(--wbmw-surface-subtle);
	border-color: var(--wbmw-accent);
	color: var(--wbmw-link);
	text-decoration: none;
}

.wbmw-btn.wbmw-btn-primary,
.wbmw-btn.wbmw-btn-primary:visited,
.buddypress .buddypress-wrap .wbmw-btn.wbmw-btn-primary {
	background: var(--wbmw-accent);
	border-color: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
}

.wbmw-btn.wbmw-btn-primary:hover,
.wbmw-btn.wbmw-btn-primary:focus,
.buddypress .buddypress-wrap .wbmw-btn.wbmw-btn-primary:hover,
.buddypress .buddypress-wrap .wbmw-btn.wbmw-btn-primary:focus {
	background: var(--wbmw-accent-hover);
	border-color: var(--wbmw-accent-hover);
	color: var(--wbmw-on-accent);
}

.wbmw-btn.wbmw-btn-danger {
	color: var(--wbmw-danger-text);
}

.wbmw-btn.wbmw-btn-danger:hover,
.wbmw-btn.wbmw-btn-danger:focus {
	background: var(--wbmw-danger-hover);
	border-color: var(--wbmw-danger-hover);
	color: var(--wbmw-on-danger);
}

.wbmw-btn.wbmw-btn-link {
	border-color: transparent;
	background: transparent;
	color: var(--wbmw-link);
}

.wbmw-btn.wbmw-btn-link:hover,
.wbmw-btn.wbmw-btn-link:focus {
	background: transparent;
	border-color: transparent;
	text-decoration: underline;
}

.wbmw-btn.wbmw-btn-sm {
	min-height: var(--wbmw-control-h-sm);
	padding: 0 12px;
	font-size: 13px;
}

.wbmw-btn[disabled],
.wbmw-btn[aria-disabled="true"] {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ─── Focus styles (WCAG 2.1 AA) ───────────────── */

.wbmw-btn:focus-visible,
.wbmw-badge:focus-visible,
.wbmw-category-card:focus-visible,
.wbmw-rc-history:focus-visible,
.wbmw-page-list-title a:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: 2px;
}

.wbmw-search-input:focus-visible,
.wbmw-field input:focus-visible,
.wbmw-field textarea:focus-visible,
.wbmw-field select:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: 1px;
	border-color: var(--wbmw-accent);
}

.wbmw-page-title a:focus-visible,
.wbmw-breadcrumb a:focus-visible,
.wbmw-toc a:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ─── Live search ───────────────────────────────── */

.wbmw-search-input-wrap {
	position: relative;
	flex: 1;
}

.wbmw-live-results {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	z-index: 100;
	margin: 2px 0 0;
	padding: 0;
	list-style: none;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: 4px;
	box-shadow: var(--wbmw-shadow-lg);
	max-height: 300px;
	overflow-y: auto;
}

.wbmw-live-results[hidden] {
	display: none;
}

.wbmw-live-result {
	padding: 10px 14px;
	cursor: pointer;
	border-bottom: 1px solid var(--wbmw-border);
	font-size: 14px;
}

.wbmw-live-result:last-child {
	border-bottom: none;
}

.wbmw-live-result:hover,
.wbmw-live-result[aria-selected="true"] {
	background: var(--wbmw-accent-soft);
	color: var(--wbmw-link);
}

.wbmw-live-result:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: -2px;
}

.wbmw-live-results-status {
	padding: 10px 14px;
	color: var(--wbmw-text-muted);
	font-style: italic;
	font-size: 13px;
}

/* ─── Dashboard Header ──────────────────────────── */

.wbmw-dashboard-header {
	display: flex;
	/* The action row wraps, but this header did not, and had no gap. Once the
	   buttons spilled onto a second line they were laid over the heading and the
	   title was squeezed to a few pixels wide. Let the header wrap too. */
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 2px solid var(--wbmw-border);
}

.wbmw-dashboard-header h2 {
	margin: 0;
	font-size: 24px;
	/* Never let the title be the thing that collapses. */
	flex: 0 0 auto;
}

.wbmw-dashboard-header .wbmw-dashboard-actions {
	flex: 1 1 auto;
	justify-content: flex-end;
}

/* Dashboard menu: destinations read left to right, the one action sits apart. */
.wbmw-dashboard-header .wbmw-dashboard-nav {
	justify-content: flex-start;
}

.wbmw-dashboard-nav .wbmw-btn-primary {
	margin-inline-start: auto;
}

/* ─── Dashboard action buttons ──────────────────── */

.wbmw-dashboard-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Icon inside buttons */
.wbmw-btn-icon {
	display: inline-block;
	width: 16px;
	height: 16px;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Buttons with icon: use flex for alignment */
.wbmw-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	position: relative;
}

/* ─── Filter Bar ────────────────────────────────── */

.wbmw-filter-bar {
	margin-bottom: 20px;
}

.wbmw-search-form {
	display: flex;
	gap: 8px;
	margin-bottom: 14px;
}

/* Every text control the wiki renders: one height, one border, one focus ring. */
.wbmw-search-input,
.wbmw-field input[type="text"],
.wbmw-field input[type="search"],
.wbmw-field input[type="url"],
.wbmw-field input[type="number"],
.wbmw-field select,
.wbmw-field textarea {
	flex: 1;
	/* Fill the wrapper so the live-results dropdown below lines up with the field. */
	width: 100%;
	box-sizing: border-box;
	min-height: var(--wbmw-control-h);
	margin: 0;
	padding: 8px 12px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	color: var(--wbmw-text);
	background: var(--wbmw-input-bg);
	border: 1px solid var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius-sm);
	box-shadow: none;
}

/* Single-line controls: exactly one height, whatever padding the theme adds. */
.wbmw-search-input,
.wbmw-field input[type="text"],
.wbmw-field input[type="search"],
.wbmw-field input[type="url"],
.wbmw-field input[type="number"],
.wbmw-field select:not([multiple]) {
	height: var(--wbmw-control-h);
	padding-block: 0;
}

.wbmw-search-form-large .wbmw-search-input {
	height: 48px;
}

.wbmw-search-form .wbmw-btn {
	height: var(--wbmw-control-h);
}

.wbmw-search-input::placeholder,
.wbmw-field input::placeholder,
.wbmw-field textarea::placeholder {
	color: var(--wbmw-text-muted);
	opacity: 1;
}

.wbmw-search-form-large .wbmw-search-input {
	min-height: 48px;
	font-size: 16px;
}

.wbmw-category-filter,
.wbmw-sort-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.wbmw-sort-bar {
	margin-top: 10px;
}

/* ─── Badges / chips ────────────────────────────── */

/* Filter chips (category, sort, period) and small status labels. */
.wbmw-badge,
a.wbmw-badge,
button.wbmw-badge {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 32px;
	margin: 0;
	padding: 0 12px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	border: 1px solid var(--wbmw-border);
	border-radius: 999px;
	background: var(--wbmw-surface);
	color: var(--wbmw-text);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.wbmw-badge:hover,
a.wbmw-badge:focus,
button.wbmw-badge:hover {
	border-color: var(--wbmw-accent);
	color: var(--wbmw-link);
	text-decoration: none;
}

.wbmw-badge.active,
a.wbmw-badge.active:hover {
	background: var(--wbmw-accent);
	border-color: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
}

.wbmw-badge-count {
	margin-inline-start: 6px;
	opacity: 0.7;
}

/* Static labels inside text (Draft, Creator, tags). */
.wbmw-badge-sm,
span.wbmw-badge {
	min-height: 0;
	padding: 2px 8px;
	font-size: 12px;
	background: var(--wbmw-surface-subtle);
	border-color: transparent;
}

.wbmw-badge-protected {
	background: var(--wbmw-warning-soft);
	color: var(--wbmw-text);
}

/* Label in front of a chip row ("Sort:"). */
.wbmw-sort-label {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	align-self: center;
	margin-inline-end: 4px;
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

/* ─── Page List ─────────────────────────────────── */

.wbmw-pages-list {
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	overflow: hidden;
	background: var(--wbmw-surface);
	box-shadow: var(--wbmw-shadow);
}

.wbmw-page-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--wbmw-border);
	transition: background-color 0.15s;
}

.wbmw-page-item:last-child {
	border-bottom: none;
}

.wbmw-page-item:hover {
	background: var(--wbmw-accent-soft);
}

.wbmw-page-item-main {
	flex: 1;
	min-width: 0;
}

.wbmw-page-title {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}

.wbmw-page-title a {
	color: var(--wbmw-heading);
	text-decoration: none;
}

.wbmw-page-title a:hover {
	color: var(--wbmw-link);
}

.wbmw-page-title .wbmw-badge-sm {
	vertical-align: 2px;
	margin-inline-start: 8px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: var(--wbmw-accent-soft);
	color: var(--wbmw-link);
	border-radius: 4px;
}

.wbmw-page-excerpt {
	margin: 4px 0 6px;
	color: var(--wbmw-text-muted);
	font-size: 14px;
	line-height: 1.5;
}

/* The separator trails each item, so a wrapped line never starts with a dot. */
.wbmw-page-meta {
	display: flex;
	flex-wrap: wrap;
	column-gap: 8px;
	row-gap: 2px;
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

.wbmw-page-meta .wbmw-meta-item {
	display: inline-flex;
	align-items: center;
}

.wbmw-page-meta .wbmw-meta-item:not(:last-child)::after {
	content: "\00b7";
	margin-inline-start: 8px;
	font-weight: 700;
}

.wbmw-page-item-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
	align-items: center;
}

.wbmw-lock-icon {
	font-size: 14px;
	margin-inline-end: 4px;
}

/* ─── Notices ───────────────────────────────────── */

/* Status is carried by the stripe and tint; text stays body colour for contrast. */
.wbmw-notice {
	padding: 12px 16px;
	margin-bottom: 16px;
	border: 1px solid var(--wbmw-border);
	border-inline-start: 4px solid var(--wbmw-info);
	border-radius: var(--wbmw-radius-sm);
	background: var(--wbmw-info-soft);
	color: var(--wbmw-text);
}

/* Access messages ("please log in", "not allowed") read as an info notice. */
.wbmw-no-permission,
.wbmw-login-required {
	padding: 12px 16px;
	margin: 0 0 16px;
	border: 1px solid var(--wbmw-border);
	border-inline-start: 4px solid var(--wbmw-warning);
	border-radius: var(--wbmw-radius-sm);
	background: var(--wbmw-warning-soft);
	color: var(--wbmw-text);
}

.wbmw-notice-success {
	border-inline-start-color: var(--wbmw-success);
	background: var(--wbmw-success-soft);
}

.wbmw-notice-error {
	border-inline-start-color: var(--wbmw-danger);
	background: var(--wbmw-danger-soft);
}

.wbmw-notice-warning {
	border-inline-start-color: var(--wbmw-warning);
	background: var(--wbmw-warning-soft);
}

/* ─── Editor Form ───────────────────────────────── */

.wbmw-editor-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.wbmw-autosave-status {
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

.wbmw-field {
	margin-bottom: 20px;
}

.wbmw-field label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 14px;
	color: var(--wbmw-heading);
}

.wbmw-field .description {
	margin-top: 4px;
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

.wbmw-checkbox-list label {
	display: block;
	font-weight: normal;
	margin-bottom: 4px;
}

.wbmw-editor-sidebar {
	margin-top: 24px;
	padding: 20px;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
}

.wbmw-editor-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--wbmw-border);
}

/* ─── Breadcrumb ────────────────────────────────── */

.wbmw-breadcrumb {
	margin-bottom: 16px;
	font-size: 14px;
	color: var(--wbmw-text-muted);
}

.wbmw-breadcrumb a {
	color: var(--wbmw-link);
	text-decoration: none;
}

.wbmw-breadcrumb a:hover {
	text-decoration: underline;
}

/* ─── Table of Contents ─────────────────────────── */

.wbmw-toc {
	float: inline-end;
	max-width: 300px;
	margin-block: 0 20px;
	margin-inline: 20px 0;
	padding: 16px;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	font-size: 14px;
}

.wbmw-toc-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}

.wbmw-toc-toggle,
.wbmw-toc-toggle:hover,
.wbmw-toc-toggle:focus {
	min-height: 32px;
	padding: 0 4px;
	background: none;
	border: none;
	color: var(--wbmw-link);
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
}

.wbmw-toc[aria-expanded="true"] .wbmw-toc-toggle-show {
	display: none;
}

.wbmw-toc[aria-expanded="false"] .wbmw-toc-toggle-hide {
	display: none;
}

.wbmw-toc[aria-expanded="false"] .wbmw-toc-list {
	display: none;
}

.wbmw-toc-list ol {
	margin: 0;
	padding-inline-start: 20px;
	list-style: decimal;
}

.wbmw-toc-list li {
	margin-bottom: 4px;
}

.wbmw-toc-list a {
	color: var(--wbmw-link);
	text-decoration: none;
}

.wbmw-toc-list a:hover {
	text-decoration: underline;
}

/* ─── Wiki Links ────────────────────────────────── */

.wbmw-wiki-link {
	color: var(--wbmw-link);
}

.wbmw-wiki-link-new {
	color: var(--wbmw-danger-text);
}

/* ─── Page View Title & Content ────────────────── */

.wbmw-page-title-main {
	margin: 0 0 20px;
	font-size: 32px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--wbmw-heading);
}

.wbmw-page-content {
	font-size: 16px;
	line-height: 1.75;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.wbmw-page-content h2,
.wbmw-page-content h3,
.wbmw-page-content h4 {
	margin-top: 1.5em;
	margin-bottom: 0.5em;
}

.wbmw-page-content p {
	margin-bottom: 1em;
}

.wbmw-page-content img {
	max-width: 100%;
	height: auto;
}

.wbmw-clearfix {
	clear: both;
}

/* ─── Page View Sidebar ─────────────────────────── */

.wbmw-page-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 1px solid var(--wbmw-border);
}

.wbmw-page-sidebar {
	float: inline-end;
	width: 250px;
	box-sizing: border-box;
	margin-block: 0 20px;
	margin-inline: 20px 0;
	padding: 16px;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	font-size: 14px;
}

.wbmw-sidebar-section {
	margin-bottom: 15px;
	padding-bottom: 15px;
	border-bottom: 1px solid var(--wbmw-border);
}

.wbmw-sidebar-section:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.wbmw-sidebar-section strong {
	display: block;
	margin-bottom: 6px;
	color: var(--wbmw-heading);
}

.wbmw-contributors-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wbmw-contributors-list li {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.wbmw-contributors-list img {
	border-radius: 50%;
}

.wbmw-tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

/* ─── Table Scroll Utility ──────────────────────── */

.wbmw-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ─── History / Revisions ───────────────────────── */

.wbmw-history-hint {
	margin: 0 0 8px;
	font-size: 0.875em;
	color: var(--wbmw-text-muted);
}

.wbmw-revisions-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
}

.wbmw-revisions-table th,
.wbmw-revisions-table td {
	padding: 10px 12px;
	text-align: start;
	border-bottom: 1px solid var(--wbmw-border);
	font-size: 14px;
}

.wbmw-revisions-table th {
	font-weight: 600;
	background: var(--wbmw-surface-subtle);
}

.wbmw-revision-current {
	background: var(--wbmw-accent-soft);
}

/* ─── Diff ──────────────────────────────────────── */

.wbmw-diff-meta {
	display: flex;
	gap: 30px;
	margin-bottom: 20px;
	padding: 15px;
	background: var(--wbmw-surface-subtle);
	border-radius: 6px;
}

.wbmw-diff-content {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.wbmw-diff-content table {
	width: 100%;
	border-collapse: collapse;
	min-width: 400px;
}

.wbmw-diff-content td {
	padding: 4px 8px;
	font-family: monospace;
	font-size: 13px;
	vertical-align: top;
}

.wbmw-diff-content .diff-deletedline,
.wbmw-diff-content del {
	background: var(--wbmw-danger-soft);
	color: var(--wbmw-text);
}

.wbmw-diff-content .diff-addedline,
.wbmw-diff-content ins {
	background: var(--wbmw-success-soft);
	color: var(--wbmw-text);
}

/* The changed words inside a line: bold with a coloured underline. */
.wbmw-diff-content .diff-addedline ins {
	font-weight: 700;
	text-decoration: none;
	box-shadow: inset 0 -2px var(--wbmw-success);
}

.wbmw-diff-content .diff-deletedline del {
	font-weight: 700;
	box-shadow: inset 0 -2px var(--wbmw-danger);
}

.wbmw-diff-actions {
	margin-top: 20px;
}

/* ─── Contributions ─────────────────────────────── */

.wbmw-contributions-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 24px;
	padding: 20px 24px;
	background: linear-gradient(135deg, var(--wbmw-accent-soft) 0%, var(--wbmw-accent-soft) 100%);
	border: 1px solid var(--wbmw-border);
	border-radius: 8px;
}

.wbmw-contributions-header h3 {
	margin: 0 0 12px;
	font-size: 20px;
	font-weight: 600;
	color: var(--wbmw-heading);
}

.wbmw-contributions-stats {
	display: flex;
	gap: 16px;
	margin-top: 4px;
}

.wbmw-stat {
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 6px 14px;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: 20px;
	font-size: 13px;
	color: var(--wbmw-text);
}

.wbmw-stat strong {
	font-size: 18px;
	font-weight: 700;
	color: var(--wbmw-link);
}

.wbmw-contributions-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
	align-self: center;
}

.wbmw-contributions-filters {
	display: flex;
	gap: 6px;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--wbmw-border);
}

.wbmw-contributions-filters .wbmw-badge {
	padding: 6px 16px;
	font-size: 13px;
	font-weight: 500;
	border: 1px solid var(--wbmw-border);
	border-radius: 20px;
	background: var(--wbmw-surface);
	color: var(--wbmw-text);
}

.wbmw-contributions-filters .wbmw-badge:hover {
	border-color: var(--wbmw-accent);
	color: var(--wbmw-link);
	background: var(--wbmw-accent-soft);
}

.wbmw-contributions-filters .wbmw-badge.active {
	background: var(--wbmw-accent);
	border-color: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
}

.wbmw-contributions-filters .wbmw-badge-count {
	display: inline-block;
	min-width: 20px;
	padding: 1px 6px;
	margin-inline-start: 6px;
	font-size: 11px;
	font-weight: 600;
	text-align: center;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.08);
	background: color-mix(in srgb, currentColor 14%, transparent);
}

/* Older browsers: the active badge is accent-filled, so lighten instead of darken. */
@supports not (color: color-mix(in srgb, red, blue)) {
	.wbmw-contributions-filters .wbmw-badge.active .wbmw-badge-count {
		background: rgba(255, 255, 255, 0.25);
	}
}

/* ─── Pagination ────────────────────────────────── */

.wbmw-pagination {
	margin-top: 20px;
	text-align: center;
}

.wbmw-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: var(--wbmw-control-h);
	min-height: var(--wbmw-control-h);
	padding: 0 12px;
	margin: 0 2px 4px;
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius-sm);
	background: var(--wbmw-surface);
	text-decoration: none;
	color: var(--wbmw-heading);
}

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

.wbmw-pagination .page-numbers.current {
	background: var(--wbmw-accent);
	border-color: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
}

/* ─── Empty State ───────────────────────────────── */

/* Rendered by wbmw_empty_state(); .wbmw-no-pages kept for template overrides. */
.wbmw-empty,
.wbmw-no-pages {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 48px 24px;
	text-align: center;
	color: var(--wbmw-text-muted);
	background: var(--wbmw-surface);
	border: 1px dashed var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius);
}

.wbmw-empty-icon {
	width: 32px;
	height: 32px;
	color: var(--wbmw-text-muted);
}

.wbmw-empty-message,
.wbmw-no-pages p {
	margin: 0;
	max-width: 420px;
	font-size: 16px;
	color: var(--wbmw-heading);
}

/* ─── Formatting Guide ─────────────────────────── */

.wbmw-formatting-guide {
	margin-top: 12px;
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	background: var(--wbmw-surface);
}

.wbmw-formatting-guide-toggle,
.wbmw-formatting-guide-toggle:hover,
.wbmw-formatting-guide-toggle:focus {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 44px;
	padding: 10px 16px;
	background: none;
	border: none;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--wbmw-text);
	cursor: pointer;
	transition: color 0.2s;
}

.wbmw-formatting-guide-toggle:hover {
	color: var(--wbmw-link);
}

.wbmw-toggle-icon {
	font-size: 10px;
	transition: transform 0.2s;
}

.wbmw-formatting-guide-toggle[aria-expanded="true"] .wbmw-toggle-icon {
	transform: rotate(180deg);
}

.wbmw-formatting-guide-content {
	padding: 0 16px 16px;
	border-top: 1px solid var(--wbmw-border);
}

.wbmw-guide-section {
	margin-top: 14px;
}

.wbmw-guide-section h4 {
	margin: 0 0 8px;
	font-size: 14px;
	color: var(--wbmw-text);
}

.wbmw-guide-section p {
	margin: 0 0 8px;
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

.wbmw-guide-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.wbmw-guide-table td {
	padding: 5px 10px;
	border-bottom: 1px solid var(--wbmw-border);
	vertical-align: top;
}

.wbmw-guide-table td:first-child {
	white-space: nowrap;
	width: 1%;
	color: var(--wbmw-text);
}

.wbmw-guide-table td:last-child {
	color: var(--wbmw-text-muted);
}

.wbmw-guide-table code {
	background: var(--wbmw-surface);
	padding: 2px 6px;
	border: 1px solid var(--wbmw-border);
	border-radius: 3px;
	font-size: 12px;
}

.wbmw-guide-section ul {
	margin: 0;
	padding-inline-start: 20px;
	font-size: 13px;
	color: var(--wbmw-text-muted);
}

.wbmw-guide-section ul li {
	margin-bottom: 4px;
}

/* ─── Editor chrome ─────────────────────────────── */

/* WordPress's editor ships light-only chrome; repaint it from the tokens so the
   editor sits in the page on any theme, light or dark. */
.wbmw-editor-wrap .wp-editor-container {
	border: 1px solid var(--wbmw-border-strong);
	border-radius: 0 0 var(--wbmw-radius-sm) var(--wbmw-radius-sm);
}

.wbmw-editor-wrap .wp-switch-editor {
	background: var(--wbmw-surface-subtle);
	border-color: var(--wbmw-border-strong);
	color: var(--wbmw-text-muted);
}

.wbmw-editor-wrap .tmce-active .switch-tmce,
.wbmw-editor-wrap .html-active .switch-html {
	background: var(--wbmw-surface);
	border-bottom-color: var(--wbmw-surface);
	color: var(--wbmw-heading);
}

.wbmw-editor-wrap .quicktags-toolbar,
.wbmw-editor-wrap div.mce-toolbar-grp,
.wbmw-editor-wrap .mce-panel {
	background: var(--wbmw-surface-subtle);
	border-color: var(--wbmw-border);
}

.wbmw-editor-wrap .quicktags-toolbar input.button,
.wbmw-editor-wrap .wp-media-buttons .button {
	min-height: 32px;
	background: var(--wbmw-surface);
	border-color: var(--wbmw-border-strong);
	color: var(--wbmw-heading);
}

.wbmw-editor-wrap .wp-media-buttons .button:hover,
.wbmw-editor-wrap .quicktags-toolbar input.button:hover {
	border-color: var(--wbmw-accent);
	color: var(--wbmw-link);
}

.wbmw-editor-wrap .mce-toolbar .mce-btn i,
.wbmw-editor-wrap .mce-toolbar .mce-btn button,
.wbmw-editor-wrap .mce-toolbar .mce-ico,
.wbmw-editor-wrap .wp-media-buttons .add_media span.wp-media-buttons-icon::before {
	color: var(--wbmw-heading);
}

.wbmw-editor-wrap .mce-btn.mce-listbox,
.wbmw-editor-wrap .mce-listbox button {
	background: var(--wbmw-input-bg);
	border-color: var(--wbmw-border-strong);
}

.wbmw-editor-wrap .mce-listbox .mce-txt,
.wbmw-editor-wrap .mce-listbox .mce-caret {
	color: var(--wbmw-text);
	border-top-color: var(--wbmw-text);
}

.wbmw-editor-wrap textarea.wp-editor-area {
	background: var(--wbmw-input-bg);
	color: var(--wbmw-text);
}

/* ─── Select2 Overrides ────────────────────────── */

.wbmw-editor-sidebar .select2-container {
	width: 100% !important;
}

.wbmw-editor-sidebar .select2-container--default .select2-selection--multiple {
	border: 1px solid var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius-sm);
	padding: 4px 8px;
	min-height: var(--wbmw-control-h);
	background: var(--wbmw-input-bg);
}

.wbmw-editor-sidebar .select2-container--default .select2-selection--multiple .select2-selection__choice {
	background: var(--wbmw-accent);
	border: none;
	border-radius: 12px;
	color: var(--wbmw-on-accent);
	padding: 2px 10px;
	font-size: 13px;
	margin-block: 2px;
	margin-inline: 0 4px;
}

.wbmw-editor-sidebar .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
	color: inherit;
	opacity: 0.75;
	margin-inline-end: 4px;
}

.wbmw-editor-sidebar .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
	color: inherit;
	opacity: 1;
	background: transparent;
}

.wbmw-editor-sidebar .select2-container--default .select2-search--inline .select2-search__field {
	font-size: 14px;
	margin-top: 2px;
}

.wbmw-editor-wrap .select2-container--default .select2-selection--single {
	min-height: var(--wbmw-control-h);
	display: flex;
	align-items: center;
	background: var(--wbmw-input-bg);
	border: 1px solid var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius-sm);
}

.wbmw-editor-wrap .select2-container--default .select2-selection--single .select2-selection__rendered,
.wbmw-editor-wrap .select2-container--default .select2-search--inline .select2-search__field {
	color: var(--wbmw-text);
}

.wbmw-editor-wrap .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 100%;
}

.select2-container--default .select2-dropdown {
	background: var(--wbmw-surface);
	border-color: var(--wbmw-border-strong);
	color: var(--wbmw-text);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
	background: var(--wbmw-input-bg);
	border-color: var(--wbmw-border-strong);
	color: var(--wbmw-text);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
	background-color: var(--wbmw-accent);
}

.select2-container--default .select2-results__option .select2-results__option--new-tag {
	font-style: italic;
	color: var(--wbmw-link);
}

/* ─── Responsive ────────────────────────────────── */

/* ─── Narrow screens (≤ 480px) ──────────────────── */

/* ─── Recent Changes ───────────────────────────── */

.wbmw-rc-date {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 24px 0 10px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--wbmw-text-muted);
}

.wbmw-rc-date::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--wbmw-surface-subtle);
}

.wbmw-rc-group {
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	overflow: hidden;
	margin-bottom: 24px;
	box-shadow: var(--wbmw-shadow);
}

.wbmw-rc-item {
	display: grid;
	grid-template-columns: 44px 1fr auto;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--wbmw-border);
	transition: background 0.12s;
}

.wbmw-rc-item:last-child {
	border-bottom: none;
}

.wbmw-rc-item:hover {
	background: var(--wbmw-accent-soft);
}

.wbmw-rc-time {
	font-size: 12px;
	font-weight: 600;
	color: var(--wbmw-text-muted);
	background: var(--wbmw-surface-subtle);
	border-radius: 4px;
	padding: 3px 5px;
	text-align: center;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.wbmw-rc-main {
	min-width: 0;
}

.wbmw-rc-title {
	font-weight: 600;
	font-size: 14px;
	color: var(--wbmw-heading);
	text-decoration: none;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.4;
}

.wbmw-rc-title:hover {
	color: var(--wbmw-link);
}

.wbmw-rc-sub {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 2px;
}

.wbmw-rc-editor {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: var(--wbmw-text-muted);
}

.wbmw-rc-editor img {
	border-radius: 50%;
	width: 14px !important;
	height: 14px !important;
}

.wbmw-rc-note {
	font-size: 12px;
	color: var(--wbmw-text-muted);
	font-style: italic;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 180px;
}

.wbmw-rc-actions {
	flex-shrink: 0;
}

.wbmw-rc-history {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 0 12px;
	font-size: 13px;
	font-weight: 500;
	color: var(--wbmw-heading);
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border-strong);
	border-radius: var(--wbmw-radius-sm);
	text-decoration: none;
	white-space: nowrap;
	transition: all 0.15s;
}

.wbmw-rc-history:hover {
	background: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
	border-color: var(--wbmw-accent);
	text-decoration: none;
}

/* Stub notice */
.wbmw-stub-notice { background: var(--wbmw-warning-soft); border: 1px solid var(--wbmw-border); border-inline-start: 4px solid var(--wbmw-warning); border-radius: var(--wbmw-radius-sm); padding: 10px 14px; margin: 12px 0; font-size: 0.9em; color: var(--wbmw-text); }
.wbmw-stub-notice a { margin-inline-start: 8px; }

/* Hatnote */
.wbmw-hatnote { font-style: italic; color: var(--wbmw-text); padding: 6px 0; margin-bottom: 12px; font-size: 0.9em; border-bottom: 1px solid var(--wbmw-border); }

/* ─── Category Browse ──────────────────────────── */

.wbmw-category-browse .wbmw-dashboard-header {
	margin-bottom: 24px;
}

.wbmw-category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 16px;
	margin-bottom: 28px;
}

.wbmw-category-card {
	display: flex;
	flex-direction: column;
	padding: 20px 20px 16px;
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	text-decoration: none;
	color: inherit;
	background: var(--wbmw-surface);
	box-shadow: var(--wbmw-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.12s;
}

.wbmw-category-card:hover,
.wbmw-category-card:focus {
	border-color: var(--wbmw-accent);
	box-shadow: var(--wbmw-shadow-lg);
	text-decoration: none;
	color: inherit;
}

.wbmw-category-card-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--wbmw-heading);
	line-height: 1.3;
	margin-bottom: 4px;
}

.wbmw-category-card-desc {
	font-size: 12px;
	color: var(--wbmw-text-muted);
	line-height: 1.4;
	flex: 1;
	margin-bottom: 12px;
}

.wbmw-category-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--wbmw-border);
}

.wbmw-category-card-count {
	font-size: 12px;
	font-weight: 600;
	color: var(--wbmw-text-muted);
	background: var(--wbmw-surface-subtle);
	padding: 2px 10px;
	border-radius: 20px;
}

.wbmw-category-card-arrow {
	font-size: 16px;
	color: var(--wbmw-text-muted);
	line-height: 1;
}

.wbmw-category-card:hover .wbmw-category-card-arrow {
	color: var(--wbmw-link);
}

.wbmw-category-desc {
	color: var(--wbmw-text);
	margin-bottom: 20px;
	padding: 12px 16px;
	background: var(--wbmw-accent-soft);
	border-inline-start: 3px solid var(--wbmw-accent);
	border-radius: var(--wbmw-radius-sm);
	font-size: 14px;
	line-height: 1.6;
}

/* ── Category filter: mobile scroll / desktop wrap+overflow ── */

/* Chips wrap; extra categories sit behind "+ N more" (8 chips on desktop,
   3 on phones; the phone-only entries are in the same menu). */
.wbmw-cat-phone-only,
.wbmw-cat-more-phone,
.wbmw-cat-more-wrap.wbmw-cat-more-wrap--phone-only {
	display: none;
}

.wbmw-cat-more-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

/* ── "+ N more" button ── */
.wbmw-cat-more-btn {
	cursor: pointer;
	font-family: inherit;
}

.wbmw-cat-more-btn--active {
	background: var(--wbmw-accent);
	color: var(--wbmw-on-accent);
}

.wbmw-cat-more-btn:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: 2px;
}

/* ── Dropdown listbox ── */
.wbmw-cat-more-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	inset-inline-start: 0;
	z-index: 200;
	min-width: 200px;
	max-height: 320px;
	overflow-y: auto;
	margin: 0;
	padding: 4px 0;
	list-style: none;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	box-shadow: var(--wbmw-shadow-lg);
}

.wbmw-cat-more-dropdown li {
	margin: 0;
	padding: 0;
}

.wbmw-cat-more-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 16px;
	font-size: 13px;
	color: var(--wbmw-text);
	text-decoration: none;
	transition: background 0.12s, color 0.12s;
	white-space: nowrap;
}

.wbmw-cat-more-item:hover,
.wbmw-cat-more-item:focus {
	background: var(--wbmw-accent-soft);
	color: var(--wbmw-link);
	outline: none;
}

.wbmw-cat-more-item.active {
	background: var(--wbmw-accent-soft);
	color: var(--wbmw-link);
	font-weight: 500;
}

.wbmw-cat-more-item:focus-visible {
	outline: 2px solid var(--wbmw-accent);
	outline-offset: -2px;
}

.wbmw-cat-more-item .wbmw-badge-count {
	margin-inline-start: 10px;
	font-size: 11px;
	opacity: 0.65;
}

/* Watch button */
.wbmw-watch-btn { cursor: pointer; }
.wbmw-btn.wbmw-watch-btn[data-watching="1"] { color: var(--wbmw-heading); border-color: var(--wbmw-warning); background: var(--wbmw-warning-soft); }

/* Pending Queue */
.wbmw-pending-queue .wbmw-page-item-actions { display: flex; gap: 6px; align-items: center; }

/* Print view */
.wbmw-print-view { max-width: 800px; margin: 0 auto; padding: 30px; font-family: Georgia, serif; }
.wbmw-print-view h1 { font-size: 1.6em; border-bottom: 1px solid #ccc; padding-bottom: 8px; }
.wbmw-print-view .wbmw-print-meta { color: #666; font-size: 0.85em; margin-bottom: 20px; }

/* ── 

/* View counter in sidebar */
.wbmw-view-count { color: var(--wbmw-text-muted); font-size: 0.9em; }

/* Helpfulness rating widget */
.wbmw-helpfulness-widget { margin-top: 32px; padding: 16px 20px; border-top: 1px solid var(--wbmw-border); text-align: center; }
.wbmw-helpfulness-question { margin: 0 0 10px; font-weight: 600; color: var(--wbmw-text); }
.wbmw-helpfulness-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
/* display:flex above would otherwise beat the [hidden] attribute set after a vote. */
.wbmw-helpfulness-buttons[hidden] { display: none; }
.wbmw-helpfulness-thanks { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; color: var(--wbmw-text); font-size: 14px; font-weight: 500; padding: 8px 0; }
.wbmw-helpfulness-thanks[hidden],
.wbmw-helpfulness-question[hidden] { display: none; }
.wbmw-helpfulness-login { margin: 0; font-size: 14px; }
.wbmw-helpfulness-login a { color: var(--wbmw-link); }
.wbmw-btn.wbmw-helpful-btn[aria-pressed="true"] { border-color: var(--wbmw-accent); background: var(--wbmw-accent-soft); color: var(--wbmw-link); }

/* ============================================================
   Social Sharing
   ============================================================ */
.wbmw-share {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin: 24px 0 16px;
	padding-top: 16px;
	border-top: 1px solid var(--wbmw-border);
}
.wbmw-share-label {
	font-size: 13px;
	color: var(--wbmw-text-muted);
	font-weight: 500;
}
.wbmw-share-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: var(--wbmw-control-h-sm);
	padding: 0 12px;
	border-radius: var(--wbmw-radius-sm);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	transition: opacity 0.15s;
	color: #fff;
	/* Neutral fallback. The platform list is filterable, so a site can add a
	   platform this stylesheet has never heard of; without a background here it
	   would render white text on nothing and be invisible. */
	background: var(--wbmw-text-muted);
}
.wbmw-share-btn:hover,
.wbmw-share-btn:focus { opacity: 0.85; color: #fff; text-decoration: none; }

/* Class is built from the platform key: wbmw-share-<key>. These must track the
   keys in the wbmw_social_sharing_platforms list — they previously read
   -fb / -li while the markup emitted -facebook / -linkedin, so Facebook and
   LinkedIn were rendered with no brand colour at all. */
.wbmw-share-x        { background: #000; }
.wbmw-share-facebook { background: #0866ff; } /* Facebook brand blue; white text passes AA (4.8:1). */
.wbmw-share-linkedin { background: #0a66c2; }

/* ============================================================
   Contribute CTA
   ============================================================ */
.wbmw-contribute-cta {
	margin: 16px 0;
	padding: 12px 16px;
	background: var(--wbmw-surface-subtle);
	border: 1px solid var(--wbmw-border);
	border-radius: 8px;
	font-size: 14px;
}
.wbmw-contribute-cta p { margin: 0; }
.wbmw-contribute-cta a { color: var(--wbmw-link); }

/* ============================================================
   Related Pages
   ============================================================ */
.wbmw-related-pages { margin: 24px 0; }
.wbmw-related-pages h3 {
	font-size: 15px;
	font-weight: 600;
	margin: 0 0 10px;
	color: var(--wbmw-heading);
}
.wbmw-related-pages ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.wbmw-related-pages li a {
	display: inline-block;
	padding: 4px 10px;
	background: var(--wbmw-surface);
	border: 1px solid var(--wbmw-border);
	border-radius: 999px;
	font-size: 13px;
	color: var(--wbmw-link);
	text-decoration: none;
	transition: background 0.15s;
}
.wbmw-related-pages li a:hover { background: var(--wbmw-accent-soft); }

/* ============================================================
   Trending Pages (Wiki List)
   ============================================================ */

/* ============================================================
   Inline Wiki Page Shortcode [wiki-page]
   ============================================================ */
.wbmw-inline-page {
	border: 1px solid var(--wbmw-border);
	border-radius: 8px;
	padding: 20px 24px;
	margin: 16px 0;
}
.wbmw-inline-page-title { margin: 0 0 12px; font-size: 18px; }
.wbmw-inline-page-title a {
	color: var(--wbmw-heading);
	text-decoration: none;
}
.wbmw-inline-page-title a:hover { color: var(--wbmw-link); }

/* ─── Section headings inside a screen ──────────── */

.wbmw-section-title {
	margin: 24px 0 4px;
	font-size: 17px;
	color: var(--wbmw-heading);
}

.wbmw-section-desc,
.wbmw-edit-review-legend {
	margin: 0 0 12px;
	font-size: 14px;
	color: var(--wbmw-text-muted);
}

.wbmw-pending-notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
}

/* ─── Confirm dialog ────────────────────────────── */

.wbmw-dialog {
	box-sizing: border-box;
	width: min(420px, calc(100vw - 32px));
	margin: auto;
	padding: 24px;
	border: 1px solid var(--wbmw-border);
	border-radius: var(--wbmw-radius);
	background: var(--wbmw-surface);
	color: var(--wbmw-text);
	box-shadow: var(--wbmw-shadow-lg);
}

.wbmw-dialog::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

.wbmw-dialog-message {
	margin: 0 0 20px;
	font-size: 16px;
	line-height: 1.5;
	color: var(--wbmw-heading);
}

.wbmw-dialog-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

/* The dialog's confirm button for destructive actions is filled. */
.wbmw-btn.wbmw-btn-danger-solid {
	background: var(--wbmw-danger-hover);
	border-color: var(--wbmw-danger-hover);
	color: var(--wbmw-on-danger);
}

/* ─── Wiki page shell (templates/page-wiki.php) ─── */

.wbmw-page-shell-header {
	max-width: 960px;
	margin: 0 auto;
	padding: 24px 20px 0;
}

.wbmw-page-shell-title {
	margin: 0;
	font-size: 32px;
	line-height: 1.2;
	color: var(--wbmw-heading);
}

/* ─── Shared header ─────────────────────────────── */

.wbmw-dashboard-header h2,
.wbmw-page-title-main {
	color: var(--wbmw-heading);
}

/* ─── Motion ────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.wbmw-btn,
	.wbmw-badge,
	.wbmw-page-item,
	.wbmw-category-card,
	.wbmw-rc-item,
	.wbmw-toggle-icon {
		transition: none;
	}
}

/* ─── Print: direct Ctrl+P on a wiki page ───────── */
@media print {
	/* Hide chrome */
	.wbmw-page-actions,
	.wbmw-page-sidebar,
	.wbmw-breadcrumb,
	.wbmw-child-pages,
	.wbmw-backlinks,
	.wbmw-stub-notice,
	.wbmw-helpfulness-widget,
	.wbmw-print-view .wbmw-print-actions { display: none !important; }

	/* Full-width content */
	.wbmw-page-view { display: block; }
	.wbmw-page-content { width: 100% !important; float: none !important; margin: 0 !important; }

	/* Page geometry */
	@page { size: A4; margin: 20mm; }
	body { font-size: 12pt; color: #000; }

	/* Headings: never orphan */
	h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
	p, ul, ol, blockquote, table { page-break-inside: avoid; }
	img { max-width: 100% !important; page-break-inside: avoid; }

	/* Print URLs after inline links (skip anchors and JS) */
	.wbmw-page-content a[href]:after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; word-break: break-all; }
	.wbmw-page-content a[href^="#"]:after,
	.wbmw-page-content a[href^="javascript"]:after { content: ""; }

	/* TOC: keep together */
	.wbmw-toc { page-break-inside: avoid; border: 1px solid #ccc; padding: 10px; margin-bottom: 20px; }
}

/* ─── Tablet (≤ 1024px) ─────────────────────────── */

@media (max-width: 1024px) {
	/* The info box and contents no longer float beside the article: at this
	   width they squeezed the text into a narrow column. */
	.wbmw-page-sidebar,
	.wbmw-toc {
		float: none;
		width: 100%;
		max-width: none;
		margin-inline: 0;
	}
}

/* ─── Mobile (≤ 640px) ──────────────────────────── */

/*
 * Mobile is laid out per screen, not shrunk: every action keeps its label,
 * every target is at least 40px, lists become cards and tables become rows a
 * thumb can read.
 */
@media (max-width: 640px) {
	/* The theme already pads the content area; don't add a second gutter. */
	.wbmw-dashboard,
	.wbmw-editor-wrap,
	.wbmw-page-view,
	.wbmw-history,
	.wbmw-diff,
	.wbmw-search-results,
	.wbmw-contributions,
	.wbmw-category-browse,
	.wbmw-recent-changes,
	.wbmw-watchlist,
	.wbmw-pending-queue {
		padding-inline: 0;
	}

	/* Screen header: title and its back button stay on one line. */
	.wbmw-dashboard-header {
		flex-wrap: wrap;
		align-items: center;
		gap: 10px;
		margin-bottom: 16px;
		padding-bottom: 12px;
	}

	.wbmw-dashboard-header h2 {
		flex: 1 1 auto;
		min-width: 0;
		font-size: 22px;
		line-height: 1.25;
	}

	.wbmw-dashboard-header .wbmw-dashboard-actions {
		flex: 0 1 auto;
		justify-content: flex-end;
	}

	/* Dashboard menu: the main action on top, the rest as a labelled grid so
	   every destination is visible without guessing at icons. */
	.wbmw-dashboard-header .wbmw-dashboard-nav {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		flex: 1 1 100%;
	}

	.wbmw-dashboard-nav .wbmw-btn {
		justify-content: flex-start;
		min-width: 0;
	}

	.wbmw-dashboard-nav .wbmw-btn-label {
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.wbmw-dashboard-nav .wbmw-btn-primary {
		grid-column: 1 / -1;
		order: -1;
		justify-content: center;
		min-height: 44px;
		margin-inline-start: 0;
	}

	/* Page actions: three labelled buttons per row. */
	.wbmw-page-actions {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}

	.wbmw-page-actions .wbmw-btn,
	.wbmw-page-actions > * {
		width: 100%;
		min-height: var(--wbmw-control-h);
		padding: 0 8px;
		min-width: 0;
	}

	.wbmw-page-actions .wbmw-btn-label {
		overflow: hidden;
		text-overflow: ellipsis;
	}

	/* Single page: the article comes first; page info follows it. */
	.wbmw-page-view {
		display: flex;
		flex-direction: column;
	}

	.wbmw-page-sidebar {
		order: 1;
		margin-top: 24px;
	}

	.wbmw-page-view > .wbmw-clearfix ~ * {
		order: 2;
	}

	.wbmw-page-title-main,
	.wbmw-page-shell-title {
		font-size: 26px;
	}

	.wbmw-page-shell-header {
		padding-inline: 0;
	}

	.wbmw-page-content {
		font-size: 17px;
	}

	/* Chips wrap; long category lists keep the "+ N more" menu, so nothing
	   hides behind a sideways scroll. */
	.wbmw-category-filter .wbmw-badge,
	.wbmw-sort-bar .wbmw-badge,
	.wbmw-recent-changes .wbmw-filter-bar .wbmw-badge,
	.wbmw-contributions-filters .wbmw-badge {
		min-height: 36px;
	}

	.wbmw-category-filter .wbmw-cat-desktop-only,
	.wbmw-cat-more-desktop {
		display: none;
	}

	.wbmw-cat-more-dropdown .wbmw-cat-phone-only {
		display: list-item;
	}

	.wbmw-cat-more-phone {
		display: inline;
	}

	.wbmw-category-filter .wbmw-cat-more-wrap.wbmw-cat-more-wrap--phone-only {
		display: inline-flex;
	}

	.wbmw-cat-more-btn--active-phone {
		background: var(--wbmw-accent);
		border-color: var(--wbmw-accent);
		color: var(--wbmw-on-accent);
	}

	/* List rows become cards: title and meta, then full-width actions. */
	.wbmw-page-item {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 16px;
	}

	.wbmw-page-item-actions {
		width: 100%;
	}

	.wbmw-page-item-actions .wbmw-btn {
		flex: 1 1 0;
		min-height: var(--wbmw-control-h);
		min-width: 0;
	}

	/* Revision history: one readable card per revision. */
	.wbmw-revisions-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}

	.wbmw-revisions-table,
	.wbmw-revisions-table tbody {
		display: block;
	}

	.wbmw-revisions-table tr {
		display: grid;
		grid-template-columns: 36px minmax(0, 1fr);
		column-gap: 8px;
		padding: 12px;
		border-bottom: 1px solid var(--wbmw-border);
	}

	.wbmw-revisions-table td {
		grid-column: 2;
		padding: 0;
		border: 0;
	}

	.wbmw-revisions-table td:first-child {
		grid-column: 1;
		grid-row: 1 / span 4;
		align-self: center;
	}

	.wbmw-revisions-table td:nth-child(2) {
		font-weight: 600;
		color: var(--wbmw-heading);
	}

	.wbmw-revisions-table td:nth-child(3) {
		font-size: 13px;
		color: var(--wbmw-text-muted);
	}

	.wbmw-revisions-table td:nth-child(n+4) {
		margin-top: 4px;
	}

	.wbmw-history .wbmw-btn,
	.wbmw-editor-actions .wbmw-btn {
		flex: 1 1 auto;
	}

	/* Compare: removed lines above added ones instead of two cut-off columns. */
	.wbmw-diff-content table {
		min-width: 0;
	}

	.wbmw-diff-content table,
	.wbmw-diff-content tbody,
	.wbmw-diff-content tr,
	.wbmw-diff-content td {
		display: block;
		width: auto;
	}

	.wbmw-diff-content colgroup {
		display: none;
	}

	.wbmw-diff-content td {
		white-space: pre-wrap;
		overflow-wrap: anywhere;
	}

	.wbmw-diff-meta {
		flex-direction: column;
		gap: 10px;
	}

	/* Recent changes. */
	.wbmw-rc-item {
		grid-template-columns: auto minmax(0, 1fr);
		gap: 6px 12px;
		padding: 12px;
	}

	.wbmw-rc-actions {
		grid-column: 2;
	}

	.wbmw-rc-sub {
		flex-wrap: wrap;
		gap: 4px 10px;
	}

	.wbmw-rc-note {
		max-width: 100%;
	}

	/* My Wiki. */
	.wbmw-contributions-header {
		flex-direction: column;
		gap: 12px;
		padding: 16px;
	}

	.wbmw-contributions-stats {
		flex-wrap: wrap;
		gap: 8px;
	}

	.wbmw-contributions-actions {
		width: 100%;
	}

	.wbmw-contributions-actions .wbmw-btn {
		flex: 1 1 0;
	}

	/* Editor. */
	.wbmw-editor-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}

	#wbmw-content_ifr {
		height: 320px !important;
	}

	/* Categories: two tiles per row. */
	.wbmw-category-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.wbmw-category-card {
		padding: 16px 14px 12px;
	}

	/* Feedback and sharing. */
	.wbmw-helpfulness-buttons .wbmw-btn {
		flex: 1 1 0;
	}

	.wbmw-share {
		gap: 6px;
	}

	.wbmw-share-btn .wbmw-btn-label {
		display: none;
	}

	.wbmw-share-btn {
		min-width: var(--wbmw-control-h);
		min-height: var(--wbmw-control-h);
		padding: 0 8px;
		justify-content: center;
	}
}
