/* WP Career Board — Reign Theme Compatibility
 *
 * Adjustments so WCB blocks sit correctly inside Reign's content canvas, plus
 * a token bridge that re-maps WCB's palette onto Reign 8.0+'s own `--reign-*`
 * CSS variables. Reading Reign's live variables means WCB follows the active
 * Color Palette / Site Skin — including custom schemes the owner builds — and
 * Reign's dark mode automatically, with no PHP colour snapshot to go stale.
 *
 * Reign 8.0 removed Kirki; the accent lives in `--reign-colors-theme` (driven
 * by the chosen scheme via reign_color_scheme_set()), NOT a theme_mod. The old
 * BuddyBoss `--bb-*` mapping never resolved on Reign 8.x and is replaced here.
 *
 * Loaded on any page rendering a WCB block or CPT.
 */

/*
 * Token bridge — WCB tokens read Reign's `--reign-*` variables first, then a
 * hex fallback (used only when Reign isn't the active theme). Reign flips its
 * `--reign-*` tokens under `[data-bx-mode="dark"]`, so the bridge re-colours in
 * dark mode for free.
 */
:root,
:root[data-bx-mode="dark"] {
	/* Brand — the scheme-driven accent. `--wcb-reign-primary` (WCB's own
	   optional override) wins first; otherwise adopt Reign's live accent. */
	--wcb-primary: var( --wcb-reign-primary, var( --reign-colors-theme, #2563eb ) );

	/* Theme-aware primary tints — older browsers fall back to the static
	   rgba on the first declaration; modern browsers use color-mix below. */
	--wcb-primary-soft: rgba( 37, 99, 235, 0.08 );
	--wcb-primary-ring: rgba( 37, 99, 235, 0.16 );
	--wcb-primary-soft: color-mix( in srgb, var( --wcb-primary ) 8%, transparent );
	--wcb-primary-ring: color-mix( in srgb, var( --wcb-primary ) 16%, transparent );

	/* Darker shade for hover/active — tracks whatever accent resolved. */

	/* Text — Reign's heading colour for strong titles, body colour for copy,
	   the lighter alternate colour for tertiary/meta. */
	--wcb-contrast:       var( --reign-site-headings-color, #0f172a );
	--wcb-text-secondary: var( --reign-site-body-text-color, #475569 );
	--wcb-text-tertiary:  var( --reign-site-alternate-text-color, #9ca3af );

	/* Surfaces — sections (cards) sit on the body canvas; secondary bands are
	   the subtle tint. */
	--wcb-base:      var( --reign-site-sections-bg-color, #ffffff );
	--wcb-surface:   var( --reign-site-body-bg-color, #f8fafc );
	--wcb-bg-subtle: var( --reign-site-secondary-bg-color, #f8fafc );
	--wcb-bg-hover:  color-mix( in srgb, var( --wcb-primary ) 6%, var( --wcb-base, #ffffff ) );

	/* Borders — Reign's content border colour. */
	--wcb-border: var( --reign-site-border-color, #e2e8f0 );

	/* Status — Reign exposes semantic colours that map cleanly to ours
	   (it has no dedicated warning token, so that keeps WCB's amber). */
	--wcb-success: var( --reign-color-success, #16a34a );
	--wcb-warning: #d97706;
	--wcb-danger:  var( --reign-color-error, #dc2626 );
	--wcb-info:    var( --reign-color-info, #2563eb );

	/* No --wcb-avatar-bg here: it is a surface, and Reign's heading colour is
	   text, which is light in dark mode (a white chip with white initials).
	   The plugin's own light and dark values apply. */
}

/* Strip double padding that Reign adds to .entry-content inside its content canvas */
.reign-content-area .wcb-job-single,
.reign-content-area .wcb-job-listings {
	padding: 0;
}

/* Align WCB search bar with Reign's content width */
.wcb-search-bar {
	max-width: 100%;
}

/* Restore left padding for the search icon — Reign resets input padding */
.wcb-listings-search {
	padding-inline-start: 2.25rem !important;
}

/* Filter chips and "Clear all" — survive Reign's link/button resets. */
.wcb-chip:hover {
	border-color: var( --wcb-primary );
	color: var( --wcb-primary );
}

.wcb-chip.wcb-chip-active {
	border-color: var(--wcb-primary-strong);
	background: var(--wcb-primary-strong);
	color: var( --wcb-on-primary, #ffffff );
}

.wcb-clear-all:hover {
	color: var( --wcb-contrast );
}

/* Featured job card — prevent Reign's global :focus-within outline from bleeding in */
.wcb-job-card.wcb-featured:focus-within {
	outline: 2px solid transparent;
}

/* Keep a clean focus ring on focusable elements inside featured cards */
.wcb-job-card.wcb-featured *:focus-visible {
	outline: 2px solid var( --wcb-primary );
	outline-offset: 2px;
	transition: outline-color var( --wcb-transition-snappy, 0.15s ease );
}

/* Load more button - retired in 1.2.x. The unified .wcb-btn--outline rule
   in assets/css/wcb-ui.css now scopes the Load more button alongside the
   in-card View Job / View Profile / View Company CTAs, so a Reign-specific
   override is no longer needed. */

/* Status badges inside Reign tables */
.wcb-status-badge {
	font-size: 0.78em;
}

/* Reign forces `.entry-content > * { margin-bottom: 1.375rem !important }` on
 * every direct child, which wins over a plugin block's own margin regardless
 * of specificity - measured 23.375px, an off-scale value, on job-search,
 * job-filters and job-listings (the plugin's own block-root margins never
 * applied on Reign at all). Only the plugin's own top-level block wrappers
 * are reset; anything else inside .entry-content keeps Reign's rhythm. */
[class*="wp-block-wp-career-board"],
[class*="wp-block-wcb-"] {
	margin-block-end: 0 !important;
}

/* One plugin gap between any two stacked plugin blocks (search + filters +
 * listings, resume search hero + archive), instead of a per-block list that
 * missed Find Candidates and left its seam at 0. */
.entry-content > :is([class*="wp-block-wp-career-board"], [class*="wp-block-wcb-"]) + :is([class*="wp-block-wp-career-board"], [class*="wp-block-wcb-"]) {
	margin-block-start: var(--wcb-space-lg) !important;
}

/* Reign 8.0.8 sets `textarea { border-radius: 6px !important }` on everything
 * outside its $plugin-ui exclusion list (which names only BuddyNext), so the
 * shared field radius can't win without !important. Same mirror-the-keyword
 * pattern as the block margin reset above. */
:is([class*="wp-block-wp-career-board"], [class*="wp-block-wcb-"]) textarea {
	border-radius: var(--wcb-radius-md) !important;
}
