/** Professional Standards — index. */

/* ---------- The room ---------- */

.ps-room {
	padding-block: var(--ps-space-2xl);
	background-color: var(--ps-bg);
}

.ps-room__inner {
	display: grid;
	gap: var(--ps-space-l);
	max-inline-size: 52rem;
}

.ps-room__missing {
	margin: 0;
	padding-block: var(--ps-space-s);
	padding-inline: var(--ps-space-m);
	border-inline-start: 4px solid #a95f06;
	border-radius: var(--ps-radius-m);
	background-color: #d8b169;
	color: #a95f06;
	font-weight: var(--ps-weight-bold);
}

.ps-room__form {
	display: grid;
	gap: var(--ps-space-xl);
}

.ps-room__form[hidden],
.ps-room__step[hidden],
.ps-room__thinking[hidden],
.ps-room__progress[hidden],
.ps-room__back[hidden] {
	display: none;
}

/* ---------- One question ---------- */

.ps-room__step {
	display: grid;
	gap: var(--ps-space-m);
	min-inline-size: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

/* A legend is not a grid item of its fieldset, so it keeps its own space below. */
.ps-room__question {
	display: grid;
	gap: var(--ps-space-2xs);
	margin-block-end: var(--ps-space-m);
	padding: 0;
}

.ps-room__count {
	font-size: var(--ps-step--1);
	font-weight: var(--ps-weight-bold);
	color: #174b35;
}

.ps-room__question-text {
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-3);
	font-weight: var(--ps-weight-bold);
	line-height: var(--ps-leading-heading);
}

.ps-room__options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: var(--ps-space-s);
}

.ps-room__options--many {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
}

.ps-room__option {
	position: relative;
	display: grid;
}

/* The radio stays in the page (keyboard, screen readers); the card is its label. */
.ps-room__radio {
	position: absolute;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
	z-index: 1; /* always above its card, even while the card moves on hover */
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.ps-room__choice {
	display: flex;
	align-items: center;
	gap: var(--ps-space-xs);
	min-block-size: 3.75rem;
	padding-block: var(--ps-space-s);
	padding-inline: var(--ps-space-m);
	border: 1.5px solid var(--ps-border);
	border-radius: var(--ps-radius-m);
	background-color: var(--ps-surface);
	font-weight: var(--ps-weight-bold);
	line-height: 1.45;
	cursor: pointer;
	transition:
		border-color var(--ps-duration-fast) linear,
		background-color var(--ps-duration-fast) linear,
		translate var(--ps-duration-fast) var(--ps-ease-out);
}

.ps-room__choice-dot {
	position: relative;
	flex: none;
	inline-size: 1.25rem;
	block-size: 1.25rem;
	border: 2px solid var(--ps-color-neutral-300);
	border-radius: 50%;
	background-color: var(--ps-bg);
	transition: border-color var(--ps-duration-fast) linear;
}

/* The chosen one: a seed inside the ring. */
.ps-room__choice-dot::after {
	content: "";
	position: absolute;
	inset: 0.2rem;
	border-radius: 50%;
	background-color: var(--ps-seed);
	scale: 0;
	transition: scale var(--ps-duration-fast) var(--ps-ease-out);
}

/* Hover on the option (not the radio): the card moving must not take the hover away (no flicker). */
.ps-room__option:hover > .ps-room__choice {
	border-color: var(--ps-color-turquoise-a60);
	translate: 0 -2px;
}

.ps-room__radio:focus-visible + .ps-room__choice {
	outline: 3px solid var(--ps-focus);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px var(--ps-focus-halo);
}

.ps-room__radio:checked + .ps-room__choice {
	border-color: var(--ps-color-navy);
	background-color: var(--ps-color-turquoise-a10);
}

.ps-room__radio:checked + .ps-room__choice .ps-room__choice-dot {
	border-color: var(--ps-color-navy);
}

.ps-room__radio:checked + .ps-room__choice .ps-room__choice-dot::after {
	scale: 1;
}

/* ---------- Back / show ---------- */

.ps-room__nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ps-space-s);
}

/* «التالي» pressed before choosing (room.js). */
.ps-room__choose {
	margin: 0;
	color: #B42318;
	font-weight: var(--ps-weight-bold);
}

.ps-room__choose[hidden] {
	display: none;
}

/* ---------- The progress: a short Growth Line, the seed on the current question ---------- */

.ps-room__progress {
	--ps-room-at: 0;
	--ps-room-last: 3;

	position: relative;
	block-size: 1.5rem;
	margin-inline: 0.75rem;
}

.ps-room__progress-line {
	position: absolute;
	inset-block-start: calc(50% - 1px);
	inset-inline: 0;
	block-size: 2px;
	background-color: var(--ps-border);
}

/* The grown part, from the first question to the current one. */
.ps-room__progress-line::after {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	inline-size: calc(var(--ps-room-at) / var(--ps-room-last) * 100%);
	background-color: var(--ps-primary);
	transition: inline-size var(--ps-duration-base) var(--ps-ease-out);
}

.ps-room__progress-node {
	position: absolute;
	inset-block-start: calc(50% - 0.375rem);
	inset-inline-start: calc(var(--i) / var(--ps-room-last) * 100% - 0.375rem);
	inline-size: 0.75rem;
	block-size: 0.75rem;
	border: 2px solid var(--ps-color-neutral-300);
	border-radius: 50%;
	background-color: var(--ps-bg);
	transition:
		border-color var(--ps-duration-base) linear,
		background-color var(--ps-duration-base) linear;
}

.ps-room__progress-node[data-ps-done] {
	border-color: var(--ps-primary);
	background-color: var(--ps-primary);
}

.ps-room__progress-seed {
	position: absolute;
	inset-block-start: calc(50% - 0.6rem);
	inset-inline-start: calc(var(--ps-room-at) / var(--ps-room-last) * 100% - 0.6rem);
	inline-size: 1.2rem;
	block-size: 1.2rem;
	border-radius: 50%;
	background-color: var(--ps-seed);
	box-shadow: 0 0 0 0.35rem var(--ps-color-seed-a35);
	transition: inset-inline-start var(--ps-duration-base) var(--ps-ease-out);
}

@media (prefers-reduced-motion: reduce) {
	.ps-room__progress-line::after,
	.ps-room__progress-seed {
		transition: none;
	}
}

/* A question arriving (room.js): a short rise. */
@media (prefers-reduced-motion: no-preference) {
	:root:not([data-ps-experience="STATIC_ACCESSIBLE"]) .ps-room__form[data-ps-room="steps"] .ps-room__step:not([hidden]) {
		animation: ps-room-in 0.4s var(--ps-ease-out) both;
	}
}

@keyframes ps-room-in {
	from {
		opacity: 0;
		translate: 0 0.75rem;
	}

	to {
		opacity: 1;
		translate: 0 0;
	}
}

/* ---------- «نرسم طريقك…» ---------- */

.ps-room__thinking {
	display: grid;
	justify-items: center;
	gap: var(--ps-space-s);
	padding-block: var(--ps-space-xl);
	text-align: center;
}

.ps-room__thinking p {
	margin: 0;
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-2);
	font-weight: var(--ps-weight-bold);
}

.ps-room__thinking-art {
	inline-size: 7rem;
	block-size: 7rem;
	overflow: visible;
}

.ps-room__thinking-ground {
	fill: none;
	stroke: var(--ps-color-neutral-300);
	stroke-width: 2;
	stroke-linecap: round;
}

.ps-room__thinking-stem {
	fill: none;
	stroke: var(--ps-mark-stroke, var(--ps-primary));
	stroke-width: 4;
	stroke-linecap: round;
}

.ps-room__thinking-head {
	fill: var(--ps-mark-stroke, var(--ps-primary));
}

.ps-room__thinking-seed {
	fill: var(--ps-seed);
}

/*
 * The stem grows from the seed, its arrow head opens, then the whole stem
 * sways back and forth around the seed while the path is drawn (owner 17:09:
 * «نخليها بتتحرك رايح جاي»). Stem and head turn together: same origin (the
 * seed, 60 94 in the drawing), same timing.
 */
.ps-room__thinking-stem,
.ps-room__thinking-head {
	transform-box: view-box;
	transform-origin: 60px 94px;
}

@media (prefers-reduced-motion: no-preference) {
	:root:not([data-ps-experience="STATIC_ACCESSIBLE"]) .ps-room__thinking:not([hidden]) .ps-room__thinking-stem {
		stroke-dasharray: 1;
		animation:
			ps-room-grow 0.6s var(--ps-ease-out) both,
			ps-room-sway 1.6s var(--ps-ease-in-out) 0.75s infinite;
	}

	:root:not([data-ps-experience="STATIC_ACCESSIBLE"]) .ps-room__thinking:not([hidden]) .ps-room__thinking-head {
		animation:
			ps-room-head 0.35s var(--ps-ease-out) 0.45s both,
			ps-room-sway 1.6s var(--ps-ease-in-out) 0.75s infinite;
	}

	:root:not([data-ps-experience="STATIC_ACCESSIBLE"]) .ps-room__thinking:not([hidden]) .ps-room__thinking-seed {
		transform-box: fill-box;
		transform-origin: center;
		animation: ps-room-pulse 0.8s var(--ps-ease-in-out) infinite alternate;
	}
}

/* Back and forth around the seed, starting and ending upright. */
@keyframes ps-room-sway {
	0%,
	100% {
		rotate: 0deg;
	}

	25% {
		rotate: -10deg;
	}

	75% {
		rotate: 10deg;
	}
}

@keyframes ps-room-grow {
	from {
		stroke-dashoffset: 1;
	}

	to {
		stroke-dashoffset: 0;
	}
}

@keyframes ps-room-head {
	from {
		opacity: 0;
		scale: 0.3;
	}

	to {
		opacity: 1;
		scale: 1;
	}
}

@keyframes ps-room-pulse {
	to {
		scale: 1.35;
	}
}

/* ---------- The path ---------- */

.ps-room-result {
	padding-block: var(--ps-space-2xl);
	background-color: var(--ps-bg);
	scroll-margin-block-start: 5rem;
}

.ps-room-result:focus {
	outline: none;
}

.ps-room-result__inner {
	display: grid;
	gap: var(--ps-space-xl);
	max-inline-size: 56rem;
}

.ps-room-result__head {
	display: grid;
	gap: var(--ps-space-xs);
}

.ps-room-result__head .ps-section-head__eyebrow {
	margin: 0;
}

.ps-room-result__title {
	margin: 0;
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-4);
	line-height: var(--ps-leading-heading);
}

.ps-room-result__answers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ps-space-2xs);
	margin: var(--ps-space-2xs) 0 0;
	padding: 0;
	list-style: none;
}

.ps-room-result__answers li {
	padding-block: 0.3em;
	padding-inline: 0.9em;
	border: 1px solid var(--ps-border);
	border-radius: var(--ps-radius-pill);
	background-color: var(--ps-surface);
	font-size: var(--ps-step--1);
	font-weight: var(--ps-weight-bold);
}

/* The vertical Growth Line through the three stages. */
.ps-room-path {
	--ps-room-node: 1.1rem;
	--ps-room-rail: 2.4rem;

	position: relative;
	display: grid;
	gap: var(--ps-space-xl);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The line from one stage's node to the next (it stops at the fruit). */
.ps-room-path__stage:not(:last-child)::after {
	content: "";
	position: absolute;
	inset-block-start: calc(0.45rem + var(--ps-room-node));
	inset-inline-start: calc(var(--ps-room-node) / 2 - 1.5px);
	inline-size: 3px;
	block-size: calc(100% + var(--ps-space-xl) - var(--ps-room-node));
	border-radius: 2px;
	background-image: linear-gradient(to bottom, var(--ps-color-navy), var(--ps-primary));
}

.ps-room-path__stage--stem::after {
	background-image: linear-gradient(to bottom, var(--ps-primary), var(--ps-seed));
}

.ps-room-path__stage {
	position: relative;
	display: grid;
	gap: var(--ps-space-2xs);
	padding-inline-start: var(--ps-room-rail);
}

.ps-room-path__node {
	position: absolute;
	inset-block-start: 0.45rem;
	inset-inline-start: 0;
	inline-size: var(--ps-room-node);
	block-size: var(--ps-room-node);
	border: 3px solid var(--ps-primary);
	border-radius: 50%;
	background-color: var(--ps-bg);
}

/* الجذور: a navy ring with two rootlets under it. */
.ps-room-path__stage--roots .ps-room-path__node {
	border-color: var(--ps-color-navy);
}

.ps-room-path__stage--roots .ps-room-path__node::before,
.ps-room-path__stage--roots .ps-room-path__node::after {
	content: "";
	position: absolute;
	inset-block-start: 100%;
	inline-size: 2px;
	block-size: 0.55rem;
	border-radius: 1px;
	background-color: var(--ps-color-navy-a60, rgb(23 75 53 / 0.6));
	transform-origin: top center;
}

.ps-room-path__stage--roots .ps-room-path__node::before {
	inset-inline-start: 0.05rem;
	rotate: 35deg;
}

.ps-room-path__stage--roots .ps-room-path__node::after {
	inset-inline-end: 0.05rem;
	rotate: -35deg;
}

/* الساق: filled turquoise. */
.ps-room-path__stage--stem .ps-room-path__node {
	background-color: var(--ps-primary);
}

/* الثمرة: the seed's colour, the largest node, a soft glow. */
.ps-room-path__stage--fruit .ps-room-path__node {
	inset-block-start: 0.3rem;
	inset-inline-start: calc(var(--ps-room-node) / 2 - 0.85rem);
	inline-size: 1.7rem;
	block-size: 1.7rem;
	border-color: var(--ps-seed);
	background-color: var(--ps-seed);
	box-shadow: 0 0 0 0.45rem var(--ps-color-seed-a35);
}

.ps-room-path__title {
	margin: 0;
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-2);
	line-height: 1.5;
}

.ps-room-path__text {
	margin: 0;
	color: var(--ps-text-muted);
}

.ps-room-path__text--fruit {
	color: var(--ps-text);
	font-size: var(--ps-step-1);
	font-weight: var(--ps-weight-bold);
}

.ps-room-path__note {
	margin: var(--ps-space-3xs) 0 0;
	padding-block: var(--ps-space-xs);
	padding-inline: var(--ps-space-s);
	border-inline-start: 3px solid var(--ps-color-navy);
	border-radius: var(--ps-radius-s);
	background-color: var(--ps-surface);
}

/* The services, in order. */
.ps-room-path__services {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr));
	gap: var(--ps-space-s);
	margin: var(--ps-space-xs) 0 0;
	padding: 0;
	list-style: none;
}

.ps-room-service {
	position: relative;
	display: grid;
	grid-template-rows: auto auto 1fr auto;
	gap: var(--ps-space-2xs);
	padding: var(--ps-space-m);
	border: 1px solid var(--ps-border);
	border-radius: var(--ps-radius-l);
	background-color: var(--ps-surface);
}

.ps-room-service__n {
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-2);
	font-weight: var(--ps-weight-bold);
	line-height: 1;
	color: #174b35;
}

.ps-room-service__name {
	margin: 0;
	font-size: var(--ps-step-1);
	line-height: 1.45;
}

.ps-room-service__text {
	margin: 0;
	font-size: var(--ps-step--1);
	color: var(--ps-text-muted);
}

.ps-room-service__link {
	justify-self: start;
	color: var(--ps-color-navy);
	font-weight: var(--ps-weight-bold);
	text-decoration: underline;
	text-decoration-color: var(--ps-primary);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.3em;
}

/* The whole card is the link's target. */
.ps-room-service__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--ps-radius-l);
}

.ps-room-service:has(.ps-room-service__link:hover) {
	border-color: var(--ps-color-turquoise-a60);
}

.ps-room-service__link:focus-visible {
	outline: none;
	box-shadow: none;
}

.ps-room-service__link:focus-visible::after {
	outline: 3px solid var(--ps-focus);
	outline-offset: 3px;
}

/* ---------- The ways on ---------- */

.ps-room-result__next {
	display: grid;
	gap: var(--ps-space-m);
	padding: var(--ps-space-l);
	border-radius: var(--ps-radius-l);
	background-color: var(--ps-scene-bg);
	background-image: radial-gradient(70% 90% at 90% 0%, var(--ps-color-turquoise-a20), transparent 70%);
	color: var(--ps-scene-text);
}

.ps-room-result__when {
	margin: 0;
	font-size: var(--ps-step-1);
	line-height: 1.6;
}

.ps-room-result__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ps-space-s) var(--ps-space-m);
}

.ps-room-result__actions .ps-button--outline {
	color: var(--ps-scene-text);
}

.ps-room-result__actions .ps-button--outline:hover {
	background-color: rgb(255 255 255 / 0.1);
}

.ps-room-result__actions :focus-visible {
	outline-color: var(--ps-focus-inverse);
}

.ps-room-result__again {
	color: var(--ps-scene-text-muted);
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

.ps-room-result__again:hover {
	color: var(--ps-scene-text);
}

/* ---------- A story close to theirs ---------- */

.ps-room-result__case {
	display: grid;
	gap: var(--ps-space-s);
}

.ps-room-result__case-title {
	margin: 0;
	font-family: var(--ps-font-display);
	font-size: var(--ps-step-2);
}

/* The story: picture beside the text on wide screens (as on the home page), never a tall poster. */
@media (min-width: 48rem) {
	.ps-room-result__case .ps-work-card--large {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		grid-template-rows: none;
	}

	.ps-room-result__case .ps-work-card--large .ps-work-card__visual {
		aspect-ratio: auto;
		min-block-size: 18rem;
	}

	.ps-room-result__case .ps-work-card--large .ps-work-card__body {
		align-content: center;
		padding: var(--ps-space-l);
	}
}

/* ---------- Anything the owner writes in the page's editor ---------- */

.ps-room-more {
	padding-block: 0 var(--ps-space-2xl);
	background-color: var(--ps-bg);
}
