/* 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. */
	--wcb-primary-dark: #1d4ed8;
	--wcb-primary-dark: color-mix( in srgb, var( --wcb-primary ) 85%, #000 );

	/* 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 );

	/* Avatar background — uses Reign's heading colour so initials read
	   correctly against the theme's preferred contrast tone. */
	--wcb-avatar-bg: var( --reign-site-headings-color, #1e293b );
}

/* Honour the Customizer primary colour on WCB interactive elements */
.wcb-btn-primary,
.wcb-apply-btn,
.wcb-save-btn {
	background-color: var( --wcb-primary );
	border-color: var( --wcb-primary );
}

.wcb-btn-primary:hover,
.wcb-apply-btn:hover,
.wcb-save-btn:hover {
	filter: brightness( 1.1 );
}

/* 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 );
	background: var( --wcb-primary );
	color: var( --reign-site-button-text-color, #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-cbtn--ghost 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. */

/* Reign uses box-shadows for card depth — match WCB job cards */
.wcb-job-card {
	box-shadow: var( --wcb-shadow-sm, 0 1px 3px rgba( 0, 0, 0, 0.08 ) );
	border-radius: var( --wcb-radius-sm, 6px );
}

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