/*
 * Baseline layout for the Elementor Job List widget - just enough for List, Cards and
 * Table to look like what they are before anyone touches a control.
 *
 * Every rule sits inside :where(), which has zero specificity, so any Elementor style
 * control (which Elementor scopes to .elementor-element-{id}) overrides it without a
 * fight, and so does a theme. Nothing here should ever need !important.
 *
 * Loaded only on pages containing the widget, via JobListWidget::get_style_depends().
 */

/* Shared ------------------------------------------------------------------- */

/* The reset is a class selector, not :where(): a theme's `ul { margin; list-style }`
   outranks zero specificity and put bullets and an indent on the list. */
.smjf-joblist {
	margin: 0;
	padding: 0;
	list-style: none;
}

.smjf-joblist > .smjf-archive__item {
	margin: 0;
}

:where(.smjf-joblist .smjf-archive__link) {
	display: inline-block;
	font-weight: 600;
	text-decoration: none;
}

:where(.smjf-joblist .smjf-archive__metas) {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 0.5em;
	margin-top: 0.25em;
}

:where(.smjf-joblist .smjf-archive__excerpt) {
	margin: 0.5em 0 0;
}

:where(.smjf-joblist .smjf-archive__actions) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
}

:where(.smjf-joblist--table .smjf-archive__actions) {
	display: table-cell;
}

:where(.smjf-joblist--table .smjf-archive__actions a + a) {
	margin-left: 0.5em;
}

:where(.smjf-joblist .smjf-archive__details),
:where(.smjf-joblist .smjf-archive__apply) {
	display: inline-block;
	padding: 0.5em 1.1em;
	text-decoration: none;
	white-space: nowrap;
}

:where(.smjf-joblist .smjf-archive__img) {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

/* List ---------------------------------------------------------------------- */

:where(.smjf-joblist--list > .smjf-archive__item) {
	display: flex;
	align-items: center;
	gap: 1em;
	padding: 1em 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

:where(.smjf-joblist--list .smjf-archive__body) {
	flex: 1 1 auto;
	min-width: 0;
}

:where(.smjf-joblist--list .smjf-archive__actions) {
	flex: 0 0 var(--smjf-apply-basis, auto);
}

:where(.smjf-joblist--list.smjf-joblist--image-left .smjf-archive__image),
:where(.smjf-joblist--list.smjf-joblist--image-top .smjf-archive__image) {
	flex: 0 0 96px;
}

/* Cards --------------------------------------------------------------------- */

:where(.smjf-joblist--cards) {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.5em;
}

:where(.smjf-joblist--cards > .smjf-archive__item) {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
}

:where(.smjf-joblist--cards .smjf-archive__body) {
	flex: 1 1 auto;
	padding: 1.25em 1.25em 0;
}

:where(.smjf-joblist--cards .smjf-archive__actions) {
	margin-top: auto;
	padding: 1.25em;
}

/* With no links the body is the last thing in the card and carries the bottom padding. */
:where(.smjf-joblist--cards .smjf-archive__body:last-child) {
	padding-bottom: 1.25em;
}

:where(.smjf-joblist--cards.smjf-joblist--image-left > .smjf-archive__item) {
	display: grid;
	grid-template-columns: 40% minmax(0, 1fr);
	grid-template-rows: 1fr auto;
}

:where(.smjf-joblist--cards.smjf-joblist--image-left .smjf-archive__image) {
	grid-row: 1 / span 2;
}

:where(.smjf-joblist--cards.smjf-joblist--image-left .smjf-archive__img) {
	height: 100%;
}

@media (max-width: 1024px) {
	:where(.smjf-joblist--cards) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	:where(.smjf-joblist--cards) {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Table --------------------------------------------------------------------- */

:where(.smjf-joblist--table) {
	width: 100%;
	border-collapse: collapse;
}

:where(.smjf-joblist--table th),
:where(.smjf-joblist--table td) {
	padding: 0.75em 1em 0.75em 0;
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

:where(.smjf-joblist--table .smjf-archive__actions) {
	text-align: right;
	padding-right: 0;
}

/* A table of four columns does not fit a phone; each row becomes a stacked block. */
@media (max-width: 767px) {
	:where(.smjf-joblist--table thead) {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	:where(.smjf-joblist--table tr),
	:where(.smjf-joblist--table td) {
		display: block;
	}

	:where(.smjf-joblist--table td) {
		border: 0;
		padding: 0.15em 0;
	}

	:where(.smjf-joblist--table tr) {
		padding: 0.75em 0;
		border-bottom: 1px solid rgba(0, 0, 0, 0.12);
	}

	:where(.smjf-joblist--table .smjf-archive__actions) {
		text-align: left;
		padding-top: 0.5em;
	}
}

/* Pagination ---------------------------------------------------------------- */

:where(.smjf-joblist ~ .smjf-archive__pagination) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.35em;
	margin-top: 1.5em;
}

:where(.smjf-joblist ~ .smjf-archive__pagination .page-numbers) {
	display: inline-block;
	padding: 0.4em 0.8em;
	border: 1px solid transparent;
	text-decoration: none;
}

:where(.smjf-joblist ~ .smjf-archive__pagination .page-numbers.current) {
	font-weight: 600;
}
