/*
 * Framtidsfylket search.
 *
 * Deliberately low-opinion: colours come from the theme through currentColor
 * and the palette custom properties, so the block follows global styles rather
 * than pinning its own values. Pagination mirrors arbeidsplassen-jobs so the
 * two listings read as one system.
 */

.ffsok {
	--ffsok-gap: 1.5rem;
	/* Space above and below the divider between two hits. Kept symmetric so the
	   rule sits centred in the gap. */
	--ffsok-row-gap: 2.5rem;
	--ffsok-radius: 5px;
	--ffsok-rule: color-mix(in srgb, currentColor 18%, transparent);
	--ffsok-muted: color-mix(in srgb, currentColor 70%, transparent);
	--ffsok-accent: var(--wp--preset--color--primary, currentColor);
}

/* Form --------------------------------------------------------------------- */

.ffsok-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-block-end: var(--ffsok-gap);
}

.ffsok-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: stretch;
}

.ffsok-form__query {
	flex: 1 1 16rem;
	min-width: 0;
}

/* Results ------------------------------------------------------------------ */

.ffsok--results {
	margin-block-start: var(--ffsok-gap);
}

.ffsok-count {
	margin-block: 0;
	color: var(--ffsok-muted);
	font-size: 0.875em;
}

.ffsok-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--ffsok-row-gap);
}

.ffsok-card {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding-block-end: var(--ffsok-row-gap);
	border-block-end: 1px solid var(--ffsok-rule);
}

@media (min-width: 600px) {

	.ffsok-card {
		flex-direction: row;
		align-items: flex-start;
		gap: 2rem;
	}
}

.ffsok-card:last-child {
	border-block-end: 0;
}

/* Matches the staging layout: 300px wide, 4/3, 40px radius. The link is hidden
   from assistive tech — the title right next to it goes to the same place. */
.ffsok-card__media {
	display: block;
	flex: 0 0 auto;
	inline-size: min(300px, 100%);
	border-radius: 40px;
	overflow: hidden;
	line-height: 0;
}

.ffsok-card__media img {
	inline-size: 100%;
	block-size: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.ffsok-card__body {
	flex: 1 1 auto;
	min-inline-size: 0;
}

/* Placeholder only earns its space once the card is a row. */
.ffsok-card__media--empty {
	display: none;
}

@media (min-width: 600px) {

	.ffsok-card__media--empty {
		display: block;
	}
}

/* Titles pick up the underline on hover rather than carrying it always. */
.ffsok-card__link {
	text-decoration: none;
}

.ffsok-card__link:hover,
.ffsok-card__link:focus-visible {
	text-decoration: underline;
}

.ffsok-card__title {
	margin: 0 0 0.25rem;
}

.ffsok-card__excerpt {
	margin: 0;
	color: var(--ffsok-muted);
}

/* Relevanssi wraps matched terms in this span. */
.ffsok-card__excerpt .relevanssi-query-term {
	background: color-mix(in srgb, var(--ffsok-accent) 18%, transparent);
	font-weight: 600;
}

.ffsok-empty {
	margin-block: 0 0.5rem;
}

/* Pagination — ported from arbeidsplassen-jobs so the two listings match. --- */

.ffsok-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	align-items: center;
	margin-block-start: var(--ffsok-gap);
}

.ffsok-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-inline-size: 2.25rem;
	padding: 0.375rem 0.625rem;
	border: 1px solid var(--ffsok-rule);
	border-radius: var(--ffsok-radius);
	text-decoration: none;
	font-size: 0.875em;
}

.ffsok-pagination a.page-numbers:hover {
	border-color: currentColor;
	background: color-mix(in srgb, currentColor 8%, transparent);
}

.ffsok-pagination a.page-numbers:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.ffsok-pagination .page-numbers.current {
	font-weight: 700;
	border-color: currentColor;
}

.ffsok-pagination .page-numbers.dots {
	border-color: transparent;
}
