/**
 * Front-end styles.
 *
 * Every value comes from a CSS custom property prefixed with `--wpo-`, printed
 * per observatory, so themes and observatories can override the look without
 * touching this file. Selectors are always scoped to `.wpo`.
 */

.wpo {
	--wpo-color-primary: #2b6cb0;
	--wpo-color-secondary: #4a5568;
	--wpo-color-background: #ffffff;
	--wpo-color-surface: #f7fafc;
	--wpo-color-text: #1a202c;
	--wpo-color-muted: #4a5568;
	--wpo-color-border: #cbd5e0;
	--wpo-color-success: #276749;
	--wpo-color-warning: #975a16;
	--wpo-color-error: #9b2c2c;
	--wpo-color-ribbon-free: #2e9e6b;
	--wpo-color-ribbon-premium: #f5821f;
	--wpo-font-size: 16px;
	--wpo-heading-size: 20px;
	--wpo-font-weight: 400;
	--wpo-heading-weight: 600;
	--wpo-radius: 6px;
	--wpo-spacing: 16px;
	--wpo-chart-height: 320px;

	color: var(--wpo-color-text);
	font-size: var(--wpo-font-size);
	font-weight: var(--wpo-font-weight);
}

.wpo *,
.wpo *::before,
.wpo *::after {
	box-sizing: border-box;
}

.wpo .wpo-title,
.wpo .wpo-chart__title,
.wpo .wpo-teaser__title,
.wpo .wpo-card__title {
	font-size: var(--wpo-heading-size);
	font-weight: var(--wpo-heading-weight);
	margin: 0 0 calc(var(--wpo-spacing) / 2);
}

.wpo .wpo-description {
	margin-bottom: var(--wpo-spacing);
}

.wpo .wpo-question {
	background: var(--wpo-color-surface);
	border: 1px solid var(--wpo-color-border);
	border-radius: var(--wpo-radius);
	margin: 0 0 var(--wpo-spacing);
	padding: var(--wpo-spacing);
}

.wpo .wpo-question[hidden] {
	display: none;
}

.wpo .wpo-question--error {
	border-color: var(--wpo-color-error);
}

/*
 * Progress bar. It sticks to the top of the viewport while the questionnaire
 * scrolls, so the count of answered questions stays in sight.
 */
.wpo .wpo-progress {
	align-items: center;
	background: var(--wpo-color-background);
	display: flex;
	gap: 12px;
	margin-bottom: var(--wpo-spacing);
	padding: 8px 0;
	position: sticky;
	top: 0;
	z-index: 5;
}

.wpo .wpo-progress__track {
	background: var(--wpo-color-border);
	border-radius: 999px;
	display: block;
	flex: 1 1 auto;
	height: 6px;
	overflow: hidden;
}

.wpo .wpo-progress__bar {
	background: var(--wpo-color-primary);
	border-radius: 999px;
	display: block;
	height: 100%;
	transition: width 0.2s ease-out;
}

.wpo .wpo-progress__label {
	color: var(--wpo-color-muted);
	flex: 0 0 auto;
	font-size: 0.9em;
}

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

/*
 * The questionnaire is a six column grid: a question takes 6, 3 or 2 columns,
 * so that 1/1, 1/2 and 1/3 cards line up. A card that does not fit in what is
 * left of the row starts the next one and leaves the gap behind it, which is
 * the requested behaviour. Below the desktop breakpoint every card is full
 * width, exactly as before.
 */
.wpo .wpo-questions {
	display: grid;
	gap: var(--wpo-spacing);
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

.wpo .wpo-questions > .wpo-question {
	grid-column: span 6;
	margin: 0;
}

@media (min-width: 783px) {
	.wpo .wpo-questions > .wpo-question--w-half {
		grid-column: span 3;
	}

	.wpo .wpo-questions > .wpo-question--w-third {
		grid-column: span 2;
	}
}

.wpo .wpo-questions--flat > .wpo-question {
	background: none;
	border: 0;
	padding: 0;
}

.wpo .wpo-questions--flat > .wpo-question--error {
	border-left: 3px solid var(--wpo-color-error);
	padding-left: 12px;
}

.wpo .wpo-question__label {
	font-weight: 600;
	padding: 0;
}

.wpo .wpo-required {
	color: var(--wpo-color-error);
}

.wpo .wpo-optional {
	color: var(--wpo-color-muted);
	font-size: 0.8em;
	font-weight: 400;
	margin-left: 4px;
}

.wpo .wpo-question__help {
	color: var(--wpo-color-muted);
	margin: 4px 0 8px;
}

.wpo .wpo-question__error {
	color: var(--wpo-color-error);
	margin: 4px 0 8px;
}

.wpo .wpo-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpo .wpo-options__item {
	align-items: baseline;
	display: flex;
	gap: 8px;
	margin-bottom: 6px;
}

.wpo .wpo-options__item--other {
	flex-wrap: wrap;
}

/*
 * Clickable rectangles. The real radio or checkbox stays in the markup, only
 * moved out of sight, so the questionnaire keeps working without JavaScript
 * and stays reachable from the keyboard. Every rectangle takes the same share
 * of the row and the row fills the card.
 */
.wpo .wpo-options--buttons {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.wpo .wpo-options--buttons .wpo-options__item {
	display: block;
	margin: 0;
}

.wpo .wpo-options--buttons input[type="radio"],
.wpo .wpo-options--buttons input[type="checkbox"] {
	height: 1px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

.wpo .wpo-options--buttons label {
	align-items: center;
	background: var(--wpo-color-background);
	border: 1px solid var(--wpo-color-border);
	border-radius: var(--wpo-radius);
	cursor: pointer;
	display: flex;
	gap: 8px;
	height: 100%;
	justify-content: center;
	padding: 10px 14px;
	text-align: center;
}

.wpo .wpo-options--buttons input:checked + label {
	background: var(--wpo-color-primary);
	border-color: var(--wpo-color-primary);
	color: #fff;
}

.wpo .wpo-options--buttons input:focus-visible + label {
	outline: 2px solid var(--wpo-color-primary);
	outline-offset: 2px;
}

.wpo .wpo-options--buttons input:disabled + label {
	cursor: default;
	opacity: 0.7;
}

/* The tick replaces the icon when the option has none. */
.wpo .wpo-options--buttons .wpo-options__item:not(.wpo-options__item--icon) input:checked + label::before {
	content: "\2713";
	font-weight: 700;
}

.wpo .wpo-options--buttons .wpo-options__item--other {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	grid-column: 1 / -1;
}

.wpo .wpo-options__icon {
	display: inline-flex;
	flex: 0 0 auto;
}

.wpo .wpo-options__icon svg,
.wpo .wpo-options__icon img {
	display: block;
	height: 1.25em;
	max-width: 2em;
	width: auto;
}

.wpo .wpo-input,
.wpo .wpo-textarea {
	background: var(--wpo-color-background);
	border: 1px solid var(--wpo-color-border);
	border-radius: var(--wpo-radius);
	color: var(--wpo-color-text);
	font: inherit;
	max-width: 100%;
	padding: 8px 10px;
	width: 100%;
}

.wpo .wpo-input--number {
	max-width: 200px;
}

.wpo .wpo-scale {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.wpo .wpo-scale__items {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpo .wpo-scale__items li {
	align-items: center;
	display: flex;
	flex-direction: column;
}

.wpo .wpo-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: var(--wpo-spacing);
}

.wpo .wpo-status {
	color: var(--wpo-color-muted);
	font-size: 0.9em;
}

.wpo .wpo-button {
	border: 1px solid var(--wpo-color-primary);
	border-radius: var(--wpo-radius);
	cursor: pointer;
	display: inline-block;
	font: inherit;
	padding: 10px 16px;
	text-decoration: none;
}

.wpo .wpo-button--primary {
	background: var(--wpo-color-primary);
	color: #fff;
}

.wpo .wpo-button--secondary {
	background: transparent;
	border-color: var(--wpo-color-secondary);
	color: var(--wpo-color-secondary);
}

.wpo .wpo-button:focus-visible,
.wpo .wpo-input:focus-visible,
.wpo input:focus-visible,
.wpo textarea:focus-visible {
	outline: 2px solid var(--wpo-color-primary);
	outline-offset: 2px;
}

.wpo .wpo-notice,
.wpo .wpo-card {
	background: var(--wpo-color-surface);
	border: 1px solid var(--wpo-color-border);
	border-left-width: 4px;
	border-radius: var(--wpo-radius);
	margin-bottom: var(--wpo-spacing);
	padding: var(--wpo-spacing);
}

.wpo .wpo-notice--success {
	border-left-color: var(--wpo-color-success);
}

.wpo .wpo-notice--error {
	border-left-color: var(--wpo-color-error);
}

.wpo .wpo-card--auth,
.wpo .wpo-card--threshold {
	border-left-color: var(--wpo-color-primary);
}

.wpo .wpo-card--closed {
	border-left-color: var(--wpo-color-warning);
}

.wpo .wpo-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 0;
}

.wpo .wpo-results__section + .wpo-results__section {
	margin-top: calc(var(--wpo-spacing) * 2);
}

.wpo .wpo-results__head {
	align-items: center;
	border-bottom: 1px solid var(--wpo-color-border);
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: space-between;
	margin-bottom: var(--wpo-spacing);
	padding-bottom: 8px;
}

.wpo .wpo-results__section-title {
	font-size: var(--wpo-heading-size);
	font-weight: var(--wpo-heading-weight);
	margin: 0;
}

.wpo .wpo-chip {
	border-radius: 5px;
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.03em;
	padding: 5px 11px;
	text-transform: uppercase;
}

.wpo .wpo-chip--free {
	background: var(--wpo-color-ribbon-free);
	color: #fff;
}

.wpo .wpo-chip--premium {
	background: var(--wpo-color-ribbon-premium);
	color: #fff;
}

.wpo .wpo-results__grid {
	display: grid;
	gap: var(--wpo-spacing);
	grid-template-columns: repeat(var(--wpo-results-columns, 3), minmax(0, 1fr));
}

/* Reserved area: blurred placeholders under a static lock panel. */
.wpo .wpo-lock {
	position: relative;
}

.wpo .wpo-lock__content {
	filter: blur(5px);
	pointer-events: none;
	user-select: none;
}

.wpo .wpo-lock__overlay {
	align-items: center;
	border-radius: calc(var(--wpo-radius) * 2);
	display: flex;
	inset: -10px;
	justify-content: center;
	padding: 20px;
	position: absolute;
}

.wpo .wpo-lock__overlay::before {
	background: var(--wpo-color-background);
	border-radius: inherit;
	content: "";
	inset: 0;
	opacity: 0.72;
	position: absolute;
}

.wpo .wpo-lock__panel {
	background: var(--wpo-color-background);
	border: 1px solid var(--wpo-color-border);
	border-radius: calc(var(--wpo-radius) * 2);
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.08);
	max-width: 460px;
	padding: calc(var(--wpo-spacing) * 2);
	position: relative;
	text-align: center;
}

.wpo .wpo-lock__icon {
	align-items: center;
	background: var(--wpo-color-ribbon-premium);
	border-radius: 50%;
	color: #fff;
	display: flex;
	height: 46px;
	justify-content: center;
	margin: 0 auto 16px;
	width: 46px;
}

.wpo .wpo-lock__title {
	font-size: var(--wpo-heading-size);
	font-weight: var(--wpo-heading-weight);
	margin: 0 0 8px;
}

.wpo .wpo-lock__text {
	color: var(--wpo-color-muted);
	margin-bottom: 16px;
}

.wpo .wpo-lock__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin: 0;
}

.wpo .wpo-lock__note {
	color: var(--wpo-color-muted);
	font-size: 0.82em;
	margin: 12px 0 0;
}

/* Decorative placeholders: no data, no labels. */
.wpo .wpo-skeleton {
	background: var(--wpo-color-border);
	border-radius: 4px;
	height: 12px;
	margin: 0 0 10px;
	opacity: 0.7;
}

.wpo .wpo-skeleton--title {
	height: 15px;
	width: 70%;
}

.wpo .wpo-skeleton--meta {
	width: 40%;
}

.wpo .wpo-skeleton--line {
	height: 11px;
	width: 85%;
}

.wpo .wpo-skeleton--line:nth-child(3) {
	width: 65%;
}

.wpo .wpo-skeleton--line:last-child {
	margin-bottom: 0;
	width: 74%;
}

.wpo .wpo-skeleton--row {
	height: 34px;
	width: 100%;
}

.wpo .wpo-skeleton--label {
	height: 16px;
	margin: 0;
	width: 70px;
}

.wpo .wpo-skeleton--ring {
	border-radius: 50%;
	height: var(--wpo-gauge-size, 120px);
	margin: 0;
	width: var(--wpo-gauge-size, 120px);
}

.wpo .wpo-gauge--placeholder {
	align-items: center;
	display: inline-flex;
	gap: 14px;
}

.wpo .wpo-question--placeholder {
	padding: var(--wpo-spacing);
}

.wpo .wpo-locked {
	margin-bottom: var(--wpo-spacing);
}

.wpo .wpo-form__locked {
	margin-top: var(--wpo-spacing);
}

.wpo .wpo-chart__placeholder {
	align-items: flex-end;
	display: flex;
	gap: 8px;
	height: calc(var(--wpo-chart-height) * 0.6);
}

.wpo .wpo-chart__placeholder-bar {
	background: var(--wpo-color-border);
	border-radius: 4px 4px 0 0;
	flex: 1;
	opacity: 0.8;
}

.wpo .wpo-chart,
.wpo-chart {
	background: var(--wpo-color-background);
	border: 1px solid var(--wpo-color-border);
	border-radius: var(--wpo-radius);
	padding: var(--wpo-spacing);
}

.wpo-chart__canvas {
	height: var(--wpo-chart-height);
	position: relative;
	width: 100%;
}

.wpo-ribbon {
	border-radius: 4px;
	color: #fff;
	display: inline-block;
	font-size: 0.68em;
	font-weight: 800;
	letter-spacing: 0.04em;
	margin: 0 0 10px;
	padding: 4px 9px;
	text-transform: uppercase;
}

.wpo-ribbon--free {
	background: var(--wpo-color-ribbon-free);
}

.wpo-ribbon--premium {
	background: var(--wpo-color-ribbon-premium);
}

.wpo-chart__base,
.wpo-chart__stats {
	color: var(--wpo-color-muted);
	font-size: 0.9em;
}

/* Single option gauge. */
.wpo.wpo-gauge {
	align-items: center;
	display: inline-flex;
	gap: 14px;
	vertical-align: middle;
}

.wpo .wpo-gauge__label {
	color: var(--wpo-gauge-color);
	font-size: 1.1em;
	font-weight: 700;
}

.wpo .wpo-gauge__ring {
	display: block;
	height: var(--wpo-gauge-size, 120px);
	width: var(--wpo-gauge-size, 120px);
}

.wpo .wpo-gauge__track {
	stroke: var(--wpo-color-border);
}

.wpo .wpo-gauge__value {
	stroke: var(--wpo-gauge-color);
}

.wpo .wpo-gauge__number {
	fill: var(--wpo-color-text);
	font-size: 9px;
	font-weight: 700;
}

.wpo .wpo-gauge__unit {
	font-size: 5.5px;
	font-weight: 600;
}

.wpo-chart__details {
	margin-top: 8px;
}

.wpo-chart__details > summary {
	color: var(--wpo-color-primary);
	cursor: pointer;
	display: inline-block;
	font-size: 0.9em;
	padding: 4px 0;
}

.wpo-chart__details > summary:focus-visible {
	outline: 2px solid var(--wpo-color-primary);
	outline-offset: 2px;
}

.wpo-chart__details[open] > summary {
	margin-bottom: 6px;
}

.wpo-chart__table,
.wpo .wpo-table {
	border-collapse: collapse;
	width: 100%;
}

.wpo-chart__table th,
.wpo-chart__table td,
.wpo .wpo-table th,
.wpo .wpo-table td {
	border-bottom: 1px solid var(--wpo-color-border);
	padding: 6px 8px;
	text-align: left;
}

.wpo .wpo-badge {
	border: 1px solid var(--wpo-color-border);
	border-radius: 999px;
	display: inline-block;
	font-size: 0.85em;
	padding: 2px 10px;
}

.wpo .wpo-badge--open {
	border-color: var(--wpo-color-success);
	color: var(--wpo-color-success);
}

.wpo .wpo-badge--closed,
.wpo .wpo-badge--archived {
	border-color: var(--wpo-color-warning);
	color: var(--wpo-color-warning);
}

/* Badge of the observatory: the edition or any other short kicker. */
.wpo .wpo-badge--brand {
	background: var(--wpo-color-primary);
	border-color: var(--wpo-color-primary);
	color: #fff;
	font-weight: 600;
}

.wpo p.wpo-badge--brand {
	margin: 0 0 calc(var(--wpo-spacing) / 2);
}

.wpo .wpo-link {
	margin-right: 12px;
}

.wpo .wpo-muted {
	color: var(--wpo-color-muted);
}

.wpo .screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

@media (max-width: 980px) {
	.wpo .wpo-results__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.wpo .wpo-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.wpo .wpo-button {
		text-align: center;
	}

	.wpo .wpo-results__grid {
		grid-template-columns: 1fr;
	}

	.wpo .wpo-lock__panel {
		padding: var(--wpo-spacing);
	}
}
