/**
 * Think Above Resume System — front end.
 *
 * Every value here resolves from a --tars-* custom property set inline on .tars
 * by the shortcode, so the whole appearance is data. The fallbacks after each
 * var() exist so the form still looks deliberate if a token is ever missing —
 * an unstyled application form on a careers page is worse than a plain one.
 */

.tars {
	/* The container decides. Overridable per site, but never narrower by default. */
	max-width: var(--tars-max-width, 100%);
	margin: 0 auto;
	color: var(--tars-ink, #1f1d1a);
	font-family: var(--tars-font, inherit);
}

.tars-heading {
	margin: 0 0 18px;
	color: var(--tars-ink, #1f1d1a);
}

.tars-empty {
	color: var(--tars-muted, #6b6862);
}

/*
 * The wrapper owns no border, and now says so.
 *
 * A navy 3px box appeared around the whole listing on a live site, and nothing
 * in any stylesheet declared a 3px border or that colour — which is exactly why
 * it was so hard to find. Some reset stylesheets (Tailwind's preflight and
 * several theme resets) set `border-style: solid` on every element, expecting
 * `border-width: 0` to keep it invisible. When only the STYLE lands, the browser
 * fills in the initial width `medium` — which computes to 3px — and the initial
 * colour `currentColor`, which is whatever the text colour happens to be. A
 * border nobody wrote, in a colour nobody chose.
 *
 * Stating it explicitly costs one declaration and makes the plugin immune to
 * whatever reset the next theme ships. Scoped to our own wrappers, so a theme's
 * intended borders elsewhere are untouched.
 */
.tars {
	border: 0;
}

/* --- position cards ----------------------------------------------------- */

.tars-card {
	background: var(--tars-card-bg, #faf8f5);
	border: 1px solid var(--tars-card-border, #e4e0da);
	border-radius: var(--tars-card-radius, 14px);
	padding: 22px;
	margin: 0 0 16px;
}

.tars-card-title {
	margin: 0 0 8px;
	color: var(--tars-card-title, #1f1d1a);
	font-size: 1.25em;
	line-height: 1.25;
}

.tars-card-body {
	color: var(--tars-ink, #1f1d1a);
	margin-bottom: 16px;
}

.tars-card-body > *:last-child {
	margin-bottom: 0;
}

/* --- buttons ------------------------------------------------------------ */

/*
 * !important on the colours only.
 *
 * A page builder's global button styles are written to win — Breakdance emits
 * rules with higher specificity than a plugin stylesheet can reasonably reach,
 * and the result is a button whose background is ours and whose text is theirs,
 * which is how you get dark text on a dark fill.
 *
 * Scoped to colour so everything else stays overridable: a site that wants
 * different padding or a different radius can still set it without fighting.
 */
.tars-btn {
	display: inline-block;
	padding: 12px 20px;
	font: inherit;
	font-weight: var(--tars-btn-weight, 600);
	line-height: 1.2;
	color: var(--tars-btn-ink, #fff) !important;
	background: var(--tars-btn-bg, #bd5a3d) !important;
	border: 1px solid var(--tars-btn-border, transparent);
	border-radius: var(--tars-btn-radius, 10px);
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.tars-btn:hover,
.tars-btn:focus-visible,
.tars-btn:active {
	color: var(--tars-btn-ink-hover, #fff) !important;
	background: var(--tars-btn-bg-hover, #a44c32) !important;
}

/* An <a> styled as a button inherits link colour from the theme otherwise. */
.tars a.tars-btn,
.tars a.tars-btn:link,
.tars a.tars-btn:visited {
	color: var(--tars-btn-ink, #fff) !important;
}

.tars a.tars-btn:hover,
.tars a.tars-btn:focus {
	color: var(--tars-btn-ink-hover, #fff) !important;
}

.tars-submit {
	margin-top: 8px;
}

/* --- the form ----------------------------------------------------------- */

.tars-form-wrap {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid var(--tars-border, #e4e0da);
}

.tars-form-wrap[hidden] {
	display: none;
}

.tars-form {
	background: var(--tars-bg, #fff);
	border-radius: var(--tars-radius, 14px);
}

.tars-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

@media (max-width: 560px) {
	.tars-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.tars-field {
	margin-bottom: 14px;
}

.tars-grid .tars-field {
	margin-bottom: 0;
}

.tars-label {
	display: block;
	margin-bottom: 5px;
	font-size: 0.92em;
	font-weight: 500;
	color: var(--tars-label-ink, #3a3730);
}

.tars-required {
	color: var(--tars-field-border-focus, #bd5a3d);
}

.tars-optional {
	margin-left: 6px;
	font-weight: 400;
	font-size: 0.85em;
	color: var(--tars-muted, #6b6862);
}

.tars-input,
.tars-file {
	width: 100%;
	box-sizing: border-box;
	padding: var(--tars-field-padding, 1rem);
	font: inherit;
	font-size: 0.95em;
	color: var(--tars-field-ink, #1f1d1a);
	background: var(--tars-field-bg, #fff);
	border: 1px solid var(--tars-field-border, #d9d4cc);
	border-radius: var(--tars-field-radius, 10px);
}

.tars-textarea {
	resize: vertical;
	min-height: 140px;
}

.tars-input:focus,
.tars-file:focus {
	outline: 2px solid var(--tars-field-border-focus, #bd5a3d);
	outline-offset: 1px;
	border-color: var(--tars-field-border-focus, #bd5a3d);
}

/* ---- the error state --------------------------------------------------
 *
 * Every value is a token set from Settings → Design → Errors, with the old
 * hard-coded red as the fallback so a site that never touches them looks the
 * same as before.
 *
 * The colours were hard-coded and the message did not exist at all: a failing
 * field got a red border and silence. Colour alone is also not an answer for
 * anyone who cannot see it, which is why the text below carries role="alert"
 * rather than relying on the border to communicate.
 */

.tars-field.has-error .tars-input,
.tars-field.has-error .tars-file,
.tars-field.has-error select,
.tars-field.has-error textarea {
	border-color: var(--tars-error-border, #c0392b);
	border-width: var(--tars-error-border-width, 2px);
	background: var(--tars-error-bg, transparent);
}

/* The choice groups have no single input to outline, so the group is banded. */
.tars-field.has-error .tars-choices,
.tars-field.has-error .tars-scale {
	border-left: var(--tars-error-border-width, 2px) solid var(--tars-error-border, #c0392b);
	background: var(--tars-error-bg, transparent);
	padding-left: 10px;
	border-radius: var(--tars-field-radius, 10px);
}

.tars-field-error {
	margin: 6px 0 0;
	padding: 7px 10px;
	font-size: 0.85em;
	line-height: 1.4;
	color: var(--tars-error-ink, #b32d2e);
	background: var(--tars-error-bg, #fdf2f2);
	border: 1px solid var(--tars-error-border, #e5a5a5);
	border-left-width: var(--tars-error-border-width, 2px);
	border-radius: var(--tars-field-radius, 10px);
}

.tars-field-error[hidden] {
	display: none;
}

/* The one-line summary shown when send is pressed with something missing. */
.tars-form-error {
	margin: 0 0 14px;
	padding: 10px 12px;
	color: var(--tars-error-ink, #b32d2e);
	background: var(--tars-error-bg, #fdf2f2);
	border: 1px solid var(--tars-error-border, #e5a5a5);
	border-left-width: var(--tars-error-border-width, 2px);
	border-radius: var(--tars-field-radius, 10px);
}

.tars-hint {
	margin: 6px 0 0;
	font-size: 0.85em;
	color: var(--tars-muted, #6b6862);
}

.tars-error {
	margin: 6px 0 0;
	font-size: 0.85em;
	color: #a33224;
}

/* --- cover letter ------------------------------------------------------- */

.tars-fieldset {
	margin: 20px 0;
	padding: 16px;
	border: 1px solid var(--tars-border, #e4e0da);
	border-radius: var(--tars-radius, 14px);
}

.tars-fieldset legend {
	padding: 0 8px;
	font-weight: 600;
	color: var(--tars-label-ink, #3a3730);
}

.tars-toggle {
	display: inline-flex;
	margin-bottom: 12px;
	border: 1px solid var(--tars-alt-border, #ddd3c0);
	border-radius: var(--tars-btn-radius, 10px);
	overflow: hidden;
}

.tars-toggle-btn {
	padding: 9px 16px;
	font: inherit;
	font-size: 0.9em;
	color: var(--tars-alt-ink, #1f1d1a);
	background: transparent;
	border: 0;
	cursor: pointer;
}

.tars-toggle-btn.is-on {
	background: var(--tars-alt-bg, #f0e9da);
	font-weight: 600;
}

.tars-cover-upload[hidden],
.tars-cover-write[hidden] {
	display: none;
}

/* --- messages ----------------------------------------------------------- */

.tars-alert {
	padding: 12px 14px;
	margin-bottom: 16px;
	border-radius: var(--tars-field-radius, 10px);
	font-size: 0.95em;
}

.tars-alert-ok {
	color: #1c5b38;
	background: #e8f5ec;
	border: 1px solid #bcdfc9;
}

.tars-alert-error {
	color: #8a2b1e;
	background: #fdeeea;
	border: 1px solid #f2c4ba;
}

.tars-ref {
	display: inline-block;
	margin-left: 8px;
	font-weight: 600;
	letter-spacing: 0.06em;
}

/*
 * The honeypot. Off-screen rather than display:none — some bots skip anything
 * hidden that way, and a field they never see is only useful if they fill it.
 * aria-hidden and tabindex="-1" keep it away from assistive technology and the
 * keyboard, so no real applicant ever meets it.
 */
.tars-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* --- listing grid ------------------------------------------------------- */

.tars-cards {
	display: grid;
	grid-template-columns: repeat(var(--tars-columns, 3), minmax(0, 1fr));
	gap: 18px;
	align-items: start;
}

.tars-cards .tars-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 0;
}

.tars-card-summary {
	flex: 1;
	margin: 0 0 16px;
	color: var(--tars-muted, #6b6862);
	font-size: 0.95em;
	line-height: 1.5;
}

.tars-card-btn {
	align-self: flex-start;
	text-decoration: none;
}

/* --- detail: description beside the form -------------------------------- */

.tars-detail {
	/* Same rule as the listing: the container decides how wide this gets. */
	max-width: var(--tars-max-width, 100%);
}

.tars-back {
	margin: 0 0 10px;
	font-size: 0.9em;
}

.tars-back a {
	color: var(--tars-muted, #6b6862);
	text-decoration: none;
}

.tars-back a:hover {
	color: var(--tars-ink, #1f1d1a);
}

.tars-detail-title {
	margin: 0 0 20px;
	color: var(--tars-ink, #1f1d1a);
}

/*
 * The description and the form are separate pages now, so neither is a column.
 *
 * Side by side looked tidy and read badly: two independently scrolling stacks of
 * different heights, so answering question nine meant losing your place in the
 * description, and finding the description again meant losing your place in the
 * form. One thing at a time.
 */
.tars-detail-body {
	color: var(--tars-ink, #1f1d1a);
	line-height: 1.65;
	/* Prose only. Wide measure is what makes a long description unreadable. */
	max-width: 70ch;
}

.tars-detail-body > *:first-child {
	margin-top: 0;
}

.tars-apply-cta {
	margin: 24px 0;
}

.tars-apply-link {
	display: inline-block;
}

.tars-apply-panel {
	background: var(--tars-card-bg, #faf8f5);
	border: 1px solid var(--tars-card-border, #e4e0da);
	border-radius: var(--tars-card-radius, 14px);
	padding: 22px;
}

/* Offered before the form, so it is read before anything is retyped. */
.tars-resume {
	background: var(--tars-alt-bg, #f0e9da);
	border: 1px solid var(--tars-alt-border, #ddd3c0);
	border-radius: var(--tars-card-radius, 14px);
	padding: 16px 18px;
	margin: 0 0 20px;
}

.tars-resume-text {
	margin: 0 0 12px;
	color: var(--tars-alt-ink, #1f1d1a);
}

.tars-resume-actions {
	margin: 0;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.tars-form-title {
	margin: 0 0 16px;
	font-size: 1.1em;
	color: var(--tars-card-title, #1f1d1a);
}

/* The detail page shows the form outright — there is nothing to expand. */
.tars-detail .tars-form-wrap {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.tars-detail .tars-grid {
	grid-template-columns: minmax(0, 1fr);
}

@media (prefers-reduced-motion: no-preference) {
	.tars-card-btn {
		transition: background-color 0.15s ease;
	}
}

/* ── the stepped form ───────────────────────────────────────────────────────
 *
 * .tars-step is visible by default and hidden only once the script has taken
 * over. Written this way round on purpose: if the script never runs, every step
 * shows and the form still works. Hiding by default would leave a blank page.
 */
/* --- saving their progress ---------------------------------------------
 *
 * Presented as a service, because that is what it is. An applicant filling in a
 * job form wants to know their work is safe if the phone rings; the same fact
 * written as a compliance notice makes people close the tab.
 */

.tars-save-offer {
	margin: 16px 0 4px;
	padding: 14px 16px;
	background: var(--tars-alt-bg, #F0E9DA);
	border-radius: var(--tars-field-radius, 10px);
}

.tars-save-note {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin: 0;
	font-size: 0.88em;
	line-height: 1.5;
	color: var(--tars-alt-ink, #1F1D1A);
}

/* A tick in a circle, drawn in CSS — an icon font would be invisible to a
   logged-out visitor, which is exactly who this is for. */
.tars-save-icon {
	position: relative;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--tars-btn-bg, #BD5A3D);
}

.tars-save-icon::after {
	content: "";
	position: absolute;
	top: 4px;
	left: 6px;
	width: 4px;
	height: 8px;
	border: solid var(--tars-btn-ink, #fff);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.tars-save-consent {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin: 11px 0 0;
	font-size: 0.9em;
	line-height: 1.45;
	cursor: pointer;
}

.tars-save-consent input { flex: 0 0 auto; margin: 2px 0 0; }

.tars-save-fineprint {
	margin: 7px 0 0 27px;
	font-size: 0.8em;
	line-height: 1.45;
	color: var(--tars-muted, #6B6862);
}

/* The quiet confirmation that the promise above is real. */
.tars-saved {
	margin: -10px 0 16px;
	font-size: 0.78rem;
	color: var(--tars-muted, #6B6862);
	opacity: 0;
	transform: translateY(-2px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.tars-saved.is-on { opacity: 1; transform: none; }

/* Coming back from the reminder email. */
.tars-welcome-back {
	margin: 0 0 20px;
	padding: 15px 17px;
	background: var(--tars-alt-bg, #F0E9DA);
	border-left: 3px solid var(--tars-btn-bg, #BD5A3D);
	border-radius: var(--tars-field-radius, 10px);
}

.tars-welcome-title {
	margin: 0 0 5px;
	font-weight: 600;
	color: var(--tars-ink, #1F1D1A);
}

.tars-welcome-body {
	margin: 0;
	font-size: 0.9em;
	line-height: 1.55;
	color: var(--tars-alt-ink, #1F1D1A);
}

@media (prefers-reduced-motion: reduce) {
	.tars-saved { transition: none; }
}

/* The summary line — the same progress in words. */

.tars-steps-now {
	margin: 0 0 10px;
	font-size: 0.82rem;
	letter-spacing: 0.02em;
	color: var(--tars-muted, #6B6862);
}

.tars-steps-count {
	font-weight: 600;
	color: var(--tars-ink, #1F1D1A);
}

.tars-steps-sep { margin: 0 6px; opacity: 0.5; }

/*
 * The rail.
 *
 * Equal-width nodes on one connected line, so the eye reads distance travelled
 * rather than a list of labels. The line is drawn by each node's ::before and
 * sits BEHIND the node, which is why the node needs its own background — a
 * transparent circle would show the line running through the number.
 */
.tars-steps-nav {
	display: flex;
	align-items: flex-start;
	gap: 0;
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.tars-steps-dot {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	text-align: center;
	font-size: 0.76rem;
	line-height: 1.3;
	color: var(--tars-muted, #6B6862);
}

/* The connector, drawn leftwards from each node except the first. */
.tars-steps-dot::before {
	content: "";
	position: absolute;
	top: 13px;
	right: 50%;
	left: -50%;
	height: 2px;
	background: var(--tars-border, #E4E0DA);
}

.tars-steps-dot:first-child::before { display: none; }

/* Filled behind you — the line between two completed nodes is brand-coloured. */
.tars-steps-dot.is-done::before,
.tars-steps-dot.is-on::before {
	background: var(--tars-btn-bg, #BD5A3D);
}

.tars-steps-n {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 2px solid var(--tars-border, #E4E0DA);
	background: var(--tars-bg, #fff);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1;
	flex: 0 0 auto;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tars-steps-label {
	display: block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Where you are: filled, and the only label that is not muted. */
.tars-steps-dot.is-on {
	color: var(--tars-ink, #1F1D1A);
	font-weight: 600;
}

.tars-steps-dot.is-on .tars-steps-n {
	background: var(--tars-btn-bg, #BD5A3D);
	border-color: var(--tars-btn-bg, #BD5A3D);
	color: var(--tars-btn-ink, #fff) !important;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--tars-btn-bg, #BD5A3D) 16%, transparent);
}

/*
 * Done: a tick instead of the number.
 *
 * Drawn in CSS rather than with an icon font. Dashicons are enqueued for the
 * admin bar, so an icon that looks fine while signed in is invisible to a
 * logged-out applicant — which is exactly who fills in this form.
 */
.tars-steps-dot.is-done { color: var(--tars-ink, #1F1D1A); }

.tars-steps-dot.is-done .tars-steps-n {
	background: var(--tars-btn-bg, #BD5A3D);
	border-color: var(--tars-btn-bg, #BD5A3D);
	color: transparent !important;
}

.tars-steps-dot.is-done .tars-steps-n::after {
	content: "";
	position: absolute;
	top: 6px;
	left: 8px;
	width: 5px;
	height: 9px;
	border: solid var(--tars-btn-ink, #fff);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/*
 * Narrow screens: the rail keeps the nodes, drops the labels.
 *
 * Eight ellipsised labels at 60px wide say nothing, and the summary line above
 * already names the current step — which is the only label that matters when
 * there is no room for eight.
 */
@media (max-width: 640px) {
	.tars-steps-label { display: none; }
	.tars-steps-nav { margin-bottom: 20px; }
	.tars-steps-n { width: 22px; height: 22px; font-size: 0.7rem; }
	.tars-steps-dot::before { top: 11px; }
	.tars-steps-dot.is-done .tars-steps-n::after { top: 4px; left: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.tars-steps-n { transition: none; }
}

.tars-form.is-stepped .tars-step { display: none; }
.tars-form.is-stepped .tars-step.is-on { display: block; }

.tars-step-title {
	margin: 0 0 4px;
	font-family: var(--tars-font-serif, inherit);
	font-size: 1.15rem;
	color: var(--tars-ink, #1F1D1A);
}

.tars-step-desc {
	margin: 0 0 18px;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--tars-muted, #6B6862);
}

.tars-step-actions {
	display: flex;
	gap: 10px;
	margin-top: 22px;
}

/* ── the client's own questions ───────────────────────────────────────────── */

.tars-custom { margin-bottom: 20px; }

.tars-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 6px;
}

.tars-choice {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 0.94rem;
	line-height: 1.4;
	cursor: pointer;
}

.tars-choice input { flex: 0 0 auto; margin: 0; }

.tars-choice-other { flex-wrap: wrap; }
.tars-choice-other .tars-other-text {
	flex: 1 1 180px;
	min-width: 140px;
	padding: 6px 10px;
	font-size: 0.9rem;
}

/* A scale reads as one row of numbers between two labels. */
.tars-scale {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 8px;
}

.tars-scale-end {
	font-size: 0.82rem;
	color: var(--tars-muted, #6B6862);
}

.tars-scale-step {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	font-size: 0.86rem;
	cursor: pointer;
}

.tars-scale-step input { margin: 0; }

@media (max-width: 480px) {
	.tars-steps-label { display: none; }
	.tars-steps-nav { gap: 6px; }
}
