/* Profile Query Filters v0.4.0 — "SØG PROFIL" (Figma) design.
   All theme decisions live in the variables below — tweak freely. */

/* Returning to the listing replays the load-more by scrolling the window in
   steps (listing-scroll.js). A smooth scroll-behaviour would turn each step
   into an animation, and the interaction observer would fire late or not at
   all — so the replay is pinned to instant jumps for as long as it runs. */
html.pqf-restoring,
html.pqf-restoring body {
	scroll-behavior: auto !important;
}

:root {
	/* Colors */
	--pqf-overlay: rgba(0, 0, 0, 0.6);
	--pqf-bg: var(--bg-base);                          /* card background */
	--pqf-card-border: rgba(255, 255, 255, 0.1);
	--pqf-border: rgba(255, 255, 255, 0.32);    /* input borders */
	--pqf-text: #ffffff;
	--pqf-text-dim: rgba(255, 255, 255, 0.7);
	--pqf-accent: #3d56e0;                      /* blue: button, slider fill, checks */
	--pqf-thumb: #ffffff;                       /* slider handles */
	--pqf-track: rgba(255, 255, 255, 0.28);     /* slider track */

	/* Shape */
	--pqf-radius: var(--radius-m);                          /* inputs + buttons */
	--pqf-radius-card: 20px;
	--pqf-check-radius: 5px;                    /* rounded-square checkboxes */

	/* Type — inherits the site font by default */
	--pqf-font: inherit;
	--pqf-fs-title: var(--font-focus);
	--pqf-fs-label: var(--font-caption);
	--pqf-fs-input: var(--font-caption);
	--pqf-fs-small: var(--font-detail);
}

body.pqf-modal-open {
	overflow: hidden;
}

/* --- Overlay + dialog ------------------------------------------------------ */

.pqf-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: clamp(1rem, 5vh, 3.5rem) 1rem;
	overflow-y: auto;
	background: var(--pqf-overlay);
	opacity: 0;
	transition: opacity 0.18s ease;
	font-family: var(--pqf-font);
}

.pqf-modal.pqf-open {
	opacity: 1;
}

.pqf-dialog {
	position: relative;
	width: 100%;
	max-width: 1010px;
	background: var(--pqf-bg);
	color: var(--pqf-text);
	border: 1px solid var(--pqf-card-border);
	border-radius: var(--pqf-radius-card);
	padding: clamp(1.75rem, 5vw, 4.25rem);
	transform: translateY(8px);
	transition: transform 0.18s ease;
}

.pqf-modal.pqf-open .pqf-dialog {
	transform: translateY(0);
}

.pqf-modal.pqf-loading .pqf-dialog {
	cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
	.pqf-modal,
	.pqf-dialog {
		transition: none;
		transform: none;
	}
}

/* --- Header ---------------------------------------------------------------- */

.pqf-close {
	position: absolute;
	top: 1.25rem;
	right: 1.25rem;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	background: transparent;
	border: 1px solid var(--pqf-card-border);
	border-radius: 50%;
	color: var(--pqf-text-dim);
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.pqf-close:hover {
	color: var(--pqf-text);
	border-color: var(--pqf-border);
}

.pqf-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1.5rem;
	margin-bottom: 2rem;
	padding-right: 2.5rem; /* clear the close button */
}

.pqf-title {
	margin: 0 0 0.75rem;
	font-size: var(--pqf-fs-title);
	font-weight: 300;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	line-height: 1.05;
	color: var(--pqf-text);
}

.pqf-subtitle {
	margin: 0;
	font-size: var(--pqf-fs-small);
	color: var(--pqf-text-dim);
}

.pqf-contact {
	flex-shrink: 0;
	margin-top: 0.375rem;
	font-size: var(--pqf-fs-small);
	color: var(--pqf-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.pqf-contact:hover {
	color: var(--pqf-text-dim);
}

/* --- Fields ----------------------------------------------------------------- */

.pqf-field {
	margin-bottom: 1.75rem;
	min-width: 0;
}

.pqf-fieldset {
	border: 0;
	padding: 0;
	margin: 0 0 1.75rem;
}

.pqf-label {
	display: block;
	margin-bottom: 0.875rem;
	font-size: var(--pqf-fs-label);
	color: var(--pqf-text);
	padding: 0;
}

.pqf-modal input[type="search"],
.pqf-modal select {
	width: 100%;
	padding: 0.8125rem 1rem;
	background: transparent;
	border: 1px solid var(--pqf-border);
	border-radius: var(--pqf-radius);
	color: var(--pqf-text);
	font-size: var(--pqf-fs-input);
	font-family: inherit;
	line-height: 1.4;
	appearance: none;
	-webkit-appearance: none;
}

.pqf-modal input::placeholder {
	color: var(--pqf-text-dim);
}

.pqf-modal input:focus-visible,
.pqf-modal select:focus-visible,
.pqf-modal button:focus-visible,
.pqf-modal a:focus-visible {
	outline: 2px solid var(--pqf-accent);
	outline-offset: 2px;
}

/* Search field with icon */
.pqf-field-search {
	position: relative;
	margin-bottom: 2rem;
}

.pqf-search-icon {
	position: absolute;
	top: 50%;
	left: 1rem;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	color: var(--pqf-text-dim);
	pointer-events: none;
}

.pqf-modal input.pqf-search {
	padding-left: 2.75rem;
}

/* Rows */
.pqf-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 2.5rem;
}

/*
 * A dimension the data has fewer than two values for cannot narrow anything,
 * so the modal hides it. The UA rule for [hidden] is display:none, which an
 * author display declaration outranks — .pqf-row sets grid — so say it here.
 */
.pqf-row[hidden],
.pqf-field[hidden],
.pqf-fieldset[hidden] {
	display: none;
}

.pqf-row--top {
	grid-template-columns: 1fr 1.25fr 1.25fr;
}

@media (max-width: 760px) {
	.pqf-row,
	.pqf-row--top {
		grid-template-columns: 1fr;
		gap: 0;
	}
}

/* --- Dual-handle sliders ------------------------------------------------------ */

.pqf-slider {
	position: relative;
	height: 1.5rem;
	margin-top: 0.5rem;
}

.pqf-slider-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	transform: translateY(-50%);
	background: var(--pqf-track);
	border-radius: 999px;
	overflow: hidden;
}

.pqf-slider-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--pqf-accent);
	border-radius: 999px;
}

.pqf-slider-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	background: transparent;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: none;
}

.pqf-slider-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 1.125rem;
	height: 1.125rem;
	border-radius: 50%;
	background: var(--pqf-thumb);
	border: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
	cursor: grab;
}

.pqf-slider-input::-moz-range-thumb {
	pointer-events: auto;
	width: 1.125rem;
	height: 1.125rem;
	border-radius: 50%;
	background: var(--pqf-thumb);
	border: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
	cursor: grab;
}

.pqf-slider-input::-moz-range-track {
	background: transparent;
}

.pqf-slider-input:active::-webkit-slider-thumb {
	cursor: grabbing;
}

.pqf-slider-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 0.625rem;
	font-size: var(--pqf-fs-small);
	color: var(--pqf-text-dim);
}

/* --- Checkbox groups (rounded squares, per design) ----------------------------- */

.pqf-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.75rem;
}

.pqf-check {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	cursor: pointer;
	font-size: var(--pqf-fs-input);
	color: var(--pqf-text);
	user-select: none;
}

.pqf-check input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.pqf-check-box {
	flex-shrink: 0;
	width: 1.375rem;
	height: 1.375rem;
	border: 1px solid var(--pqf-border);
	border-radius: var(--pqf-check-radius);
	background-position: center;
	background-repeat: no-repeat;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pqf-check input:checked + .pqf-check-box {
	background-color: var(--pqf-accent);
	border-color: var(--pqf-accent);
	background-image: url("data:image/svg+xml,%3Csvg width='11' height='9' viewBox='0 0 11 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4.5l3 3L10 1.5' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.pqf-check input:focus-visible + .pqf-check-box {
	outline: 2px solid var(--pqf-accent);
	outline-offset: 2px;
}

.pqf-check-disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* --- Selects -------------------------------------------------------------------- */

.pqf-modal select {
	background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1.125rem center;
	padding-right: 2.75rem;
	cursor: pointer;
}

.pqf-modal select option {
	background: var(--pqf-bg);
	color: var(--pqf-text);
}

.pqf-modal select option:disabled {
	color: rgba(255, 255, 255, 0.3);
}

/* --- Footer ----------------------------------------------------------------------- */

.pqf-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 0.5rem;
	flex-wrap: wrap;
}

.pqf-footer-left {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.pqf-count {
	font-size: var(--pqf-fs-small);
	color: var(--pqf-text-dim);
}

.pqf-reset {
	padding: 0;
	background: transparent;
	border: 0;
	color: var(--pqf-text-dim);
	font-size: var(--pqf-fs-small);
	font-family: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.pqf-reset:hover {
	color: var(--pqf-text);
}

.pqf-actions {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	margin-left: auto;
}

.pqf-save-search .pqf-check-text {
	color: var(--pqf-text);
}

.pqf-submit {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.8125rem 1.5rem;
	background: var(--pqf-accent);
	border: 1px solid var(--pqf-accent);
	border-radius: var(--pqf-radius);
	color: #ffffff;
	font-size: var(--pqf-fs-input);
	font-family: inherit;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.pqf-submit:hover {
	filter: brightness(1.15);
}

.pqf-submit svg {
	width: 0.875rem;
	height: 0.875rem;
}

/* --- Submit / loading state ------------------------------------------------- */

/*
 * Everything the dialog was showing is replaced rather than overlaid: the
 * filters are no longer editable once the navigation is under way, and leaving
 * them visible behind a scrim invites a second click on a button that can no
 * longer do anything.
 */
.pqf-modal.pqf-submitting .pqf-dialog > *:not(.pqf-progress) {
	display: none;
}

.pqf-progress {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	/* Roughly the height the filter panel had, so committing to a search does
	   not collapse the dialog to a strip and shift the page under the cursor. */
	min-height: min(42vh, 320px);
	text-align: center;
}

.pqf-progress[hidden] {
	display: none;
}

.pqf-progress-title {
	margin: 0;
	font-size: var(--pqf-fs-title);
	color: var(--pqf-text);
}

.pqf-progress-track {
	position: relative;
	width: min(100%, 460px);
	height: 6px;
	border-radius: 999px;
	background: var(--pqf-track);
	overflow: hidden;
}

.pqf-progress-fill {
	position: relative;
	width: 0;
	height: 100%;
	border-radius: inherit;
	/* Clips the sheen below to the filled part — without a containing block of
	   its own it would position against the track and sweep the empty half too. */
	overflow: hidden;
	background: linear-gradient(90deg, var(--pqf-accent), #6f83ff);
	/* The width is set every frame from JS, so it must not also be animated
	   here — two easings on the same value fight and the bar visibly lags. */
	transition: none;
}

/*
 * A sheen travelling across the filled part. It is the only thing on this
 * screen that keeps moving while the server is quiet, which is what separates
 * "still working" from "stopped".
 */
.pqf-progress-fill::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 0.45) 50%,
		rgba(255, 255, 255, 0) 100%
	);
	transform: translateX(-100%);
	animation: pqf-sheen 1.15s ease-in-out infinite;
}

@keyframes pqf-sheen {
	to {
		transform: translateX(100%);
	}
}

.pqf-progress-pct {
	margin: 0;
	font-size: var(--pqf-fs-small);
	color: var(--pqf-text-dim);
	font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
	.pqf-progress-fill::after {
		animation: none;
	}
}
