/* ProzessOS on top of va-cx (static/va-cx/va-cx.product.css, the vendored product context).
   Only what is specific to this application and not (yet) a va-cx component lives here, in
   `@layer app` so it always wins over the system without specificity fights; classes keep the
   plain names of the templates. Tokens come from the system (`--va-…`); no raw colours here. */

@layer app;

@layer app {
	/* AI interview, the facilitation team's introduction (interview-introduction): the chat's
	   first message, neither the AI's dashed gold frame nor the participant's solid one, so it
	   reads as a third voice; across the chat's width, quiet and sunken. */
	.va-turn--team {
		align-self: stretch;
		max-inline-size: none;
		border: var(--va-border) solid var(--va-line-strong);
		background: var(--va-surface-sunken);
	}

	/* Development only (dev.rs): a Fluent file on disk did not load. */
	#dev-text-problem {
		margin: 0;
		padding: var(--va-sp-3) var(--va-sp-4);
		background: var(--va-danger);
		color: var(--va-ink-on-danger);
		font: 600 var(--va-text-sm) / 1.4 var(--va-font-mono);
		white-space: pre-wrap;
		max-inline-size: none;
	}

	/* Systemic Consensing, participant rating (TASK-29): the improvement hint field shows from a
	   rating of 7 on; without JavaScript a <noscript> style in round.html shows every hint. */
	.hint-field.hint-hidden {
		display: none;
	}

	/* The bubble the interviewer's text streams into (TASK-25) is hidden from assistive
	   technology while it grows; nothing else about it is special. */
	.turn-live {
		min-inline-size: 12rem;
	}

	/* The AI conversation's forms sit inside the composer; they keep the composer's rhythm. */
	.turn-form {
		display: flex;
		flex-direction: column;
		gap: var(--va-sp-3);
	}
}

@layer app {
	/* The Build tab until the three-pane builder: the questions take the wide pane on the start
	   side, the key questions and the interview's settings the narrow one; below the desktop
	   width the side pane comes first, as the DOM has it. */
	@media (min-width: 75rem) {
		.va-panes--build {
			grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
		}

		.va-panes--build > .va-pane--side {
			order: 2;
		}
	}
}

@layer app {
	/* The one-time view's printable sheet of accesses (admin-workspace-redesign; spec:
	   participant-access "Individual capability links"): on screen a grid of QR cards below the
	   table; on paper the only thing printed, one card per access. */
	.links-print {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
		gap: var(--va-sp-3);
	}

	.links-print__card {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: var(--va-sp-1);
		padding: var(--va-sp-3);
		border: var(--va-border) solid var(--va-line);
		border-radius: var(--va-radius);
		background: var(--va-surface);
		text-align: center;
		break-inside: avoid;
	}

	.links-print__card svg {
		inline-size: 8rem;
		block-size: 8rem;
	}

	@media print {
		body:has(#links-print) > :not(main),
		body:has(#links-print) main > :not(#workspace),
		body:has(#links-print) #workspace > :not(.va-panes),
		body:has(#links-print) .va-panes > :not(:has(#links-print)),
		body:has(#links-print) .va-pane:has(#links-print) > :not(#links-print) {
			display: none !important;
		}

		body:has(#links-print) .links-print {
			grid-template-columns: repeat(3, 1fr);
		}

		/* The Results tab prints whole: the figures and themes without the tools and the chrome
		   (admin-workspace-redesign, spec "Results view of an activity"). */
		body:has(#scales-heading) > :not(main),
		body:has(#scales-heading) .va-statusbar__tabs,
		body:has(#scales-heading) #primary-action,
		body:has(#scales-heading) .results-tools {
			display: none !important;
		}

		body:has(#scales-heading) .va-panes {
			display: block;
		}

		body:has(#scales-heading) #opinions details {
			display: block;
		}

		body:has(#scales-heading) #opinions summary {
			display: none;
		}
	}
}

@layer app {
	/* The status bar's search field, actions menu and the command palette
	   (admin-workspace-redesign; spec: platform-foundation "Command palette"). */
	.ws-search .va-input {
		inline-size: 12rem;
	}

	.ws-menu {
		position: relative;
	}

	.ws-menu > summary {
		list-style: none;
		cursor: pointer;
	}

	.ws-menu > summary::-webkit-details-marker {
		display: none;
	}

	.ws-menu__list {
		position: absolute;
		inset-inline-end: 0;
		inset-block-start: 100%;
		z-index: 20;
		min-inline-size: 18rem;
		margin: var(--va-sp-1) 0 0;
		padding: var(--va-sp-2);
		list-style: none;
		border: var(--va-border) solid var(--va-line-strong);
		border-radius: var(--va-radius-md);
		background: var(--va-surface-raised);
		box-shadow: var(--va-shadow-raised);
	}

	.ws-menu__list a,
	.ws-menu__list button,
	.ws-menu__list span {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--va-sp-3);
		inline-size: 100%;
		padding: var(--va-sp-1) var(--va-sp-2);
		border: 0;
		border-radius: var(--va-radius-sm);
		background: none;
		color: var(--va-ink);
		font: inherit;
		text-align: start;
		text-decoration: none;
		white-space: nowrap;
	}

	.ws-menu__list a:hover,
	.ws-menu__list button:hover {
		background: var(--va-action-wash);
		cursor: pointer;
	}

	.ws-menu__list span {
		color: var(--va-ink-muted);
	}

	/* On a phone the menu opens below the status bar (sticky, so it is the containing block)
	   across the page's width within the gutter, wherever its button sits: anchored to the
	   button, its 18rem ran past the screen's start edge. */
	@media (max-width: 40rem) {
		.ws-menu {
			position: static;
		}

		.ws-menu__list {
			inset-inline: var(--va-gutter);
			min-inline-size: 0;
		}

		.ws-menu__list a,
		.ws-menu__list button,
		.ws-menu__list span {
			white-space: normal;
		}
	}

	.va-palette__item[hidden] {
		display: none;
	}

	/* An option is the control itself: a button gets the item's look. */
	button.va-palette__item {
		inline-size: 100%;
		border: 0;
		background: none;
		font: inherit;
		text-align: start;
	}

	@media print {
		.ws-search,
		.ws-menu,
		#palette {
			display: none !important;
		}
	}

	/* The built-in last question's on/off switch (closing-question): a segmented control whose
	   halves are two forms, so it works without JavaScript; the forms take no box of their own,
	   and the divider the system draws between adjacent buttons is drawn between the forms. */
	.closing-switch {
		align-self: flex-start;
	}

	.closing-switch > form {
		display: contents;
	}

	.closing-switch > form + form .va-button {
		border-inline-start: var(--va-border) solid var(--va-boundary);
	}
}

