/**
 * WP Career Board — Editor.js surface styles
 *
 * Wraps Editor.js inside our token-based design system so the rich-text
 * field reads like every other `.wcb-field-input` — same border, same
 * focus ring, same radius. Editor.js's own CSS (loaded inline by the
 * library) handles the inline toolbar, block menu, and selection chrome.
 */

.wcb-editor {
	display: block;
	border: 1px solid var(--wcb-border);
	border-radius: var(--wcb-radius-md);
	background: var(--wcb-base);
	transition: border-color var(--wcb-transition-fast), box-shadow var(--wcb-transition-fast);
}

.wcb-editor:focus-within {
	border-color: var(--wcb-primary);
	box-shadow: var(--wcb-shadow-focus);
}

.wcb-editor-holder {
	min-height: 200px;
	padding: var(--wcb-space-md) var(--wcb-space-lg);
	font-family: inherit;
	font-size: var(--wcb-text-md);
	line-height: 1.6;
	color: var(--wcb-contrast);
}

/*
 * The hidden textarea preserves form-submission semantics and the
 * Interactivity API binding without showing visually. `hidden` plus
 * the SR-only fallback keeps it accessible to assistive tech as a
 * focus target if we ever need it.
 */
.wcb-editor-source {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Editor.js content typography — match the rest of the form. */

.wcb-editor-holder .ce-block__content,
.wcb-editor-holder .ce-toolbar__content {
	max-width: 100%;
}

.wcb-editor-holder h2,
.wcb-editor-holder h3,
.wcb-editor-holder h4 {
	margin: 0.75em 0 0.4em;
	color: var(--wcb-contrast);
}

.wcb-editor-holder h2 { font-size: 1.35em; font-weight: var(--wcb-font-bold); }
.wcb-editor-holder h3 { font-size: 1.15em; font-weight: var(--wcb-font-bold); }
.wcb-editor-holder h4 { font-size: 1em; font-weight: var(--wcb-font-semibold); }

.wcb-editor-holder p {
	margin: 0 0 0.5em;
}

.wcb-editor-holder ul,
.wcb-editor-holder ol {
	margin: 0 0 0.75em;
	padding-inline-start: 1.5em;
}

/* Markers back while editing: the block list reset in frontend-components.css
   (0,1,1) beats Editor.js's own .cdx-list--* (0,1,0), so lists showed bare
   lines here but bullets on the job page (Basecamp 10430753987). */
:is([class*="wp-block-wp-career-board"], [class*="wp-block-wcb-"]) .wcb-editor-holder ul {
	list-style: disc;
}

:is([class*="wp-block-wp-career-board"], [class*="wp-block-wcb-"]) .wcb-editor-holder ol {
	list-style: decimal;
}

.wcb-editor-holder li {
	margin-bottom: 0.25em;
}

.wcb-editor-holder a {
	color: var(--wcb-primary-text);
	text-decoration: underline;
}

.wcb-editor-holder blockquote,
.wcb-editor-holder .cdx-quote {
	margin: 0.75em 0;
	padding: 0.25em 0 0.25em 1em;
	border-inline-start: 3px solid var(--wcb-border);
	color: var(--wcb-text-secondary);
	font-style: italic;
}

.wcb-editor-holder mark,
.wcb-editor-holder .cdx-marker {
	background: rgba(255, 220, 0, 0.4);
	padding: 0 2px;
	border-radius: 2px;
}

.wcb-editor-holder code,
.wcb-editor-holder .cdx-inline-code {
	background: var(--wcb-bg-subtle, rgba(0, 0, 0, 0.05));
	border-radius: var(--wcb-radius-sm, 6px);
	padding: 0.125em 0.375em;
	font-size: 0.9em;
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.wcb-editor-holder hr,
.wcb-editor-holder .ce-delimiter {
	border: none;
	border-top: 1px solid var(--wcb-border);
	margin: 1.25em 0;
}

/* Editor.js block-options popovers / selection should win over our z-index stack. */
.ce-popover,
.ce-toolbar,
.ce-inline-toolbar {
	z-index: 5;
}

/* Editor.js popovers (block toolbox, block tunes, inline toolbar) paint from
   their own --color-* variables, fixed to light values. Map them to the board's
   tokens so they follow a dark scheme; on a dark Reign page the popover stayed
   white while its search text inherited white. Fallbacks are Editor.js's own. */
.wcb-editor .ce-popover {
	--color-background: var(--wcb-base, #fff);
	--color-text-primary: var(--wcb-contrast, #000);
	--color-text-secondary: var(--wcb-text-secondary, #707684);
	--color-border: var(--wcb-border, #eff0f1);
	--color-border-icon: var(--wcb-border, rgba(201, 201, 204, 0.48));
	--color-background-item-hover: var(--wcb-bg-hover, #f8f8f8);
	--color-background-item-focus: var(--wcb-primary-soft, rgba(34, 186, 255, 0.08));
	--color-background-icon-active: var(--wcb-primary-soft, rgba(56, 138, 229, 0.1));
	--color-text-icon-active: var(--wcb-primary, #388ae5);
	--color-background-item-confirm: var(--wcb-danger, #e24a4a);
	color: var(--color-text-primary);
}

.wcb-editor .ce-popover .cdx-search-field {
	border-color: var(--wcb-border, rgba(226, 226, 229, 0.2));
	background: var(--wcb-bg-subtle, #f8f8f8);
}

/* (0,3,1): a theme's input[type] rule (Reign sets height, border, padding and
   colour on every text input) cannot reach the popover search. */
.wcb-editor .ce-popover input.cdx-search-field__input {
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: var(--color-text-primary);
	font: inherit;
	font-size: var(--wcb-text-sm, 14px);
	line-height: 22px;
}

.wcb-editor .ce-popover input.cdx-search-field__input::placeholder {
	color: var(--color-text-secondary);
}

/* Editor.js paints "Nothing found" in its own fixed grey (3.6:1 on Reign dark);
   the secondary text token keeps it at AA on light and dark. */
.wcb-editor .ce-popover .ce-popover__nothing-found-message {
	color: var(--color-text-secondary);
}

/* Always-visible formatting toolbar (blocks/job-form/editor-toolbar.php). */
.wcb-editor-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wcb-space-xs);
	padding: var(--wcb-space-xs) var(--wcb-space-sm);
	border-bottom: 1px solid var(--wcb-border);
	border-start-start-radius: var(--wcb-radius-md);
	border-start-end-radius: var(--wcb-radius-md);
	background: var(--wcb-bg-subtle);
}

/* (0,2,0) plus the element, so a theme's bare button rule cannot restyle it. */
.wcb-editor .wcb-editor-toolbar button.wcb-editor-toolbar__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	margin: 0;
	padding: 0 var(--wcb-space-sm);
	border: 1px solid transparent;
	border-radius: var(--wcb-radius-sm, 6px);
	background: transparent;
	color: var(--wcb-contrast);
	font: inherit;
	font-size: var(--wcb-text-md);
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
}

.wcb-editor .wcb-editor-toolbar button.wcb-editor-toolbar__btn:hover {
	background: var(--wcb-base);
	border-color: var(--wcb-border);
	color: var(--wcb-contrast);
}

.wcb-editor .wcb-editor-toolbar button.wcb-editor-toolbar__btn:focus-visible {
	outline: 2px solid var(--wcb-primary);
	outline-offset: 1px;
}

.wcb-editor .wcb-editor-toolbar button.wcb-editor-toolbar__btn:is([aria-pressed="true"], [aria-expanded="true"]) {
	background: var(--wcb-primary-soft);
	border-color: var(--wcb-primary);
	color: var(--wcb-contrast);
}

.wcb-editor-toolbar__btn svg {
	width: 18px;
	height: 18px;
}

.wcb-editor-toolbar__btn b,
.wcb-editor-toolbar__btn i {
	font-family: Georgia, "Times New Roman", serif;
}

.wcb-editor-link {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wcb-space-sm);
	padding: var(--wcb-space-sm);
	border-bottom: 1px solid var(--wcb-border);
	background: var(--wcb-bg-subtle);
}

.wcb-editor-link[hidden] {
	display: none;
}

.wcb-editor-link__field {
	flex: 1 1 14rem;
	min-width: 0;
	margin: 0;
}

.wcb-editor .wcb-editor-link input.wcb-editor-link__input {
	box-sizing: border-box;
	width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 0 var(--wcb-space-md);
	border: 1px solid var(--wcb-border);
	border-radius: var(--wcb-radius-md);
	background: var(--wcb-base);
	color: var(--wcb-contrast);
	font: inherit;
	font-size: var(--wcb-text-base);
}

.wcb-editor .wcb-editor-link input.wcb-editor-link__input[aria-invalid="true"] {
	border-color: var(--wcb-danger-fg, #991b1b);
}

@media (max-width: 640px) {
	.wcb-editor-holder {
		padding: var(--wcb-space-md);
	}

	.wcb-editor-link .wcb-btn {
		flex: 1 1 auto;
	}
}
