/*
 * «نمو» — the button in the bottom corner and its window (Stage 9).
 *
 * The button: the brand's navy pill with Nomo's face (the logo's seed in the
 * growth ring) and «اسأل نمو»; a round face alone on narrow screens. It
 * sits at the reading end's corner (bottom-left in Arabic, bottom-right in
 * English) — logical properties do the mirroring; the face is not mirrored.
 *
 * The window: a card beside the page on wide screens (the page stays
 * usable); the whole screen on phones (the page behind does not scroll).
 * Navy head, light conversation, white answers, navy questions; the
 * buttons to the team in the brand's colours with one small orange touch
 * (the free consultation).
 */

.gb-nomo {
	--gb-nomo-gap: clamp(0.75rem, 0.5rem + 1vw, 1.5rem);
	--gb-nomo-width: 24rem;
	--gb-nomo-radius: 1.25rem;
	--gb-nomo-shadow: 0 1.25rem 3rem rgb(12 35 66 / 0.28), 0 0.25rem 0.75rem rgb(12 35 66 / 0.18);
}

/* Not during the intro (it has the whole screen). */
html[data-gb-intro="play"] .gb-nomo {
	display: none;
}

/* ---------------------------------------------------------------- The face */

.gb-nomo__face {
	inline-size: 2.5rem;
	block-size: 2.5rem;
	flex: none;
}

.gb-nomo__face-bg {
	fill: var(--gb-color-neutral-0);
}

.gb-nomo__face-ring {
	fill: none;
	stroke-width: 5;
}

.gb-nomo__face-seed {
	fill: var(--gb-color-logo-seed);
}

.gb-nomo__stop--frame {
	stop-color: var(--gb-color-turquoise);
}

.gb-nomo__stop--seed {
	stop-color: var(--gb-color-logo-seed);
}

.gb-nomo__stop--dash {
	stop-color: var(--gb-color-logo-navy);
}

/* ---------------------------------------------------------------- The button */

.gb-nomo__launcher {
	position: fixed;
	z-index: 90;
	inset-block-end: calc(var(--gb-nomo-gap) + env(safe-area-inset-bottom, 0px));
	inset-inline-end: var(--gb-nomo-gap);
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding-block: 0.375rem;
	padding-inline: 0.375rem 1.15rem;
	border: 0;
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
	font: inherit;
	font-weight: 700;
	font-size: var(--gb-step-0);
	line-height: 1;
	box-shadow: var(--gb-nomo-shadow);
	cursor: pointer;
	transition: transform var(--gb-duration-base) var(--gb-ease-out), box-shadow var(--gb-duration-base) var(--gb-ease-out);
}

.gb-nomo__launcher[hidden],
.gb-nomo.is-open .gb-nomo__launcher {
	display: none;
}

.gb-nomo__launcher:hover {
	transform: translateY(-2px);
}

/* The seed's little orange heartbeat ring on hover: the brand's small accent. */
.gb-nomo__launcher:hover .gb-nomo__face-bg,
.gb-nomo__launcher:focus-visible .gb-nomo__face-bg {
	fill: var(--gb-color-neutral-0);
	stroke: var(--gb-accent);
	stroke-width: 2;
}

.gb-nomo__launcher:focus-visible {
	outline: 3px solid var(--gb-focus-halo);
	outline-offset: 3px;
}

/* Phones: the face alone (its name is still read aloud). */
@media (max-width: 40rem) {
	.gb-nomo__launcher {
		padding: 0.3rem;
	}

	.gb-nomo__launcher .gb-nomo__face {
		inline-size: 2.9rem;
		block-size: 2.9rem;
	}

	.gb-nomo__launcher-text {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* An article's reading stem lives at the same edge: it stops above the button. */
body:has(.gb-nomo__launcher:not([hidden])) .gb-reading-stem {
	inset-block-end: 5.25rem;
}

/* ---------------------------------------------------------------- The window */

.gb-nomo__panel {
	position: fixed;
	z-index: 95;
	inset-block-end: calc(var(--gb-nomo-gap) + env(safe-area-inset-bottom, 0px));
	inset-inline-end: var(--gb-nomo-gap);
	display: flex;
	flex-direction: column;
	inline-size: min(var(--gb-nomo-width), calc(100vw - 2 * var(--gb-nomo-gap)));
	block-size: min(40rem, calc(100dvh - 2 * var(--gb-nomo-gap) - 5rem));
	border-radius: var(--gb-nomo-radius);
	background-color: var(--gb-surface);
	color: var(--gb-text);
	box-shadow: var(--gb-nomo-shadow);
	overflow: hidden;
	animation: gb-nomo-in var(--gb-duration-slow) var(--gb-ease-out);
	transform-origin: bottom var(--gb-nomo-origin, left);
}

[dir="ltr"] .gb-nomo__panel {
	--gb-nomo-origin: right;
}

.gb-nomo__panel[hidden] {
	display: none;
}

@keyframes gb-nomo-in {
	from {
		opacity: 0;
		transform: translateY(0.75rem) scale(0.97);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (max-width: 40rem) {
	/* The whole screen: above the sticky header too (the window's own head has the close button). */
	.gb-nomo__panel {
		z-index: calc(var(--gb-z-header) + 10);
		inset: 0;
		inline-size: 100%;
		block-size: 100dvh;
		border-radius: 0;
	}

	html.gb-nomo-open,
	html.gb-nomo-open body {
		overflow: hidden;
	}
}

/* The head. */
.gb-nomo__head {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.75rem 1rem;
	padding-block-start: calc(0.75rem + env(safe-area-inset-top, 0px));
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
}

.gb-nomo__who {
	flex: 1;
	min-inline-size: 0;
}

.gb-nomo__name {
	margin: 0;
	font-size: var(--gb-step-1);
	line-height: 1.2;
}

.gb-nomo__sub {
	margin: 0.15rem 0 0;
	color: var(--gb-scene-text-muted);
	font-size: var(--gb-step--1);
	line-height: 1.4;
}

.gb-nomo__tool {
	display: inline-grid;
	place-items: center;
	inline-size: 2.5rem;
	block-size: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.gb-nomo__tool .gb-icon {
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

.gb-nomo__tool:hover {
	background-color: rgb(255 255 255 / 0.12);
}

.gb-nomo__tool:focus-visible {
	outline: 2px solid var(--gb-focus-inverse);
	outline-offset: 2px;
}

/* The conversation. */
.gb-nomo__log {
	position: relative;
	flex: 1;
	min-block-size: 0;
	padding: 1rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scroll-padding-block-start: 0.75rem;
}

.gb-nomo__log:focus-visible {
	outline: 2px solid var(--gb-focus-halo);
	outline-offset: -2px;
}

.gb-nomo__turn {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-block-end: 0.9rem;
	animation: gb-nomo-turn var(--gb-duration-base) var(--gb-ease-out);
}

@keyframes gb-nomo-turn {
	from {
		opacity: 0;
		transform: translateY(0.35rem);
	}
}

.gb-nomo__bubble {
	max-inline-size: 92%;
	margin: 0;
	padding: 0.7rem 0.95rem;
	border-radius: 1rem;
	font-size: var(--gb-step-0);
	line-height: 1.75;
	overflow-wrap: anywhere;
}

.gb-nomo__turn--you {
	align-items: flex-end;
}

.gb-nomo__turn--you .gb-nomo__bubble {
	border-end-end-radius: 0.3rem;
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
	white-space: pre-wrap;
}

.gb-nomo__turn--nomo {
	align-items: flex-start;
}

.gb-nomo__turn--nomo .gb-nomo__bubble {
	border: 1px solid var(--gb-border);
	border-end-start-radius: 0.3rem;
	background-color: var(--gb-bg);
}

.gb-nomo__bubble p {
	margin: 0 0 0.55rem;
}

.gb-nomo__bubble > :last-child {
	margin-block-end: 0;
}

.gb-nomo__bubble .gb-nomo__lead {
	font-weight: 700;
}

.gb-nomo__bubble ul,
.gb-nomo__bubble ol {
	margin: 0 0 0.55rem;
	padding-inline-start: 1.2rem;
}

.gb-nomo__bubble li {
	margin-block-end: 0.3rem;
}

.gb-nomo__bubble li::marker {
	color: var(--gb-color-logo-seed);
}

.gb-nomo__link {
	color: var(--gb-link);
	font-weight: 700;
	text-decoration-color: var(--gb-link-decoration);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}

.gb-nomo__link:hover {
	text-decoration-color: var(--gb-accent);
}

/* «يكتب…»: three dots that breathe. */
.gb-nomo__dots {
	display: inline-flex;
	gap: 0.3rem;
	padding-block: 0.35rem;
}

.gb-nomo__dots::before,
.gb-nomo__dots::after,
.gb-nomo__turn--typing .gb-nomo__bubble::before {
	content: "";
	inline-size: 0.45rem;
	block-size: 0.45rem;
	border-radius: 50%;
	background-color: var(--gb-color-logo-seed);
	animation: gb-nomo-dot 1s var(--gb-ease-in-out) infinite;
}

.gb-nomo__turn--typing .gb-nomo__bubble {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.gb-nomo__dots::before {
	animation-delay: 0.15s;
}

.gb-nomo__dots::after {
	animation-delay: 0.3s;
}

@keyframes gb-nomo-dot {
	0%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}

	50% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* The buttons to the team. */
.gb-nomo__acts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
}

.gb-nomo__act {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-block-size: 2.5rem;
	padding: 0.45rem 0.9rem;
	border: 1.5px solid var(--gb-scene-bg);
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-bg);
	color: var(--gb-scene-bg);
	font-size: var(--gb-step--1);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

.gb-nomo__act .gb-icon {
	inline-size: 1.1rem;
	block-size: 1.1rem;
	flex: none;
}

.gb-nomo__act:hover {
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
}

/* The free consultation: the one orange touch (navy words on orange: 5.4:1). */
.gb-nomo__act--consult {
	border-color: var(--gb-accent);
	background-color: var(--gb-accent);
	color: var(--gb-color-navy);
}

.gb-nomo__act--consult:hover {
	border-color: var(--gb-scene-bg);
}

.gb-nomo__act:focus-visible,
.gb-nomo__chip:focus-visible,
.gb-nomo__social:focus-visible,
.gb-nomo__contact:focus-visible,
.gb-nomo__link:focus-visible,
.gb-nomo__send:focus-visible,
.gb-nomo__input:focus-visible {
	outline: 3px solid var(--gb-focus-halo);
	outline-offset: 2px;
}

/* The questions to tap. */
.gb-nomo__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	max-inline-size: 100%;
}

.gb-nomo__chips-title {
	flex-basis: 100%;
	margin: 0.2rem 0 0;
	color: var(--gb-text-muted);
	font-size: var(--gb-step--1);
	font-weight: 700;
}

.gb-nomo__chip {
	padding: 0.45rem 0.85rem;
	border: 1.5px solid var(--gb-color-turquoise-a60);
	border-radius: var(--gb-radius-pill);
	background-color: var(--gb-bg);
	color: var(--gb-text);
	font: inherit;
	font-size: var(--gb-step--1);
	line-height: 1.4;
	text-align: start;
	cursor: pointer;
	transition: background-color var(--gb-duration-fast), border-color var(--gb-duration-fast);
}

.gb-nomo__chip:hover {
	border-color: var(--gb-color-turquoise);
	background-color: var(--gb-color-turquoise-a10);
}

.gb-nomo__retry {
	align-self: flex-start;
}

/* The cards. */
.gb-nomo__card {
	inline-size: min(100%, 20rem);
	padding: 0.75rem 0.85rem;
	border-radius: 0.9rem;
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
}

.gb-nomo__card-title {
	margin: 0 0 0.45rem;
	font-size: var(--gb-step--1);
	font-weight: 700;
	color: var(--gb-scene-text-muted);
}

.gb-nomo__card-list {
	display: grid;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gb-nomo__card--social .gb-nomo__card-list {
	grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
}

.gb-nomo__contact,
.gb-nomo__social {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	column-gap: 0.55rem;
	padding: 0.35rem 0.4rem;
	border-radius: 0.6rem;
	color: inherit;
	text-decoration: none;
}

.gb-nomo__social {
	display: flex;
	gap: 0.45rem;
	font-size: var(--gb-step--1);
	font-weight: 700;
}

.gb-nomo__contact .gb-icon,
.gb-nomo__social .gb-icon {
	grid-row: span 2;
	inline-size: 1.25rem;
	block-size: 1.25rem;
	color: var(--gb-color-turquoise);
}

a.gb-nomo__contact:hover,
.gb-nomo__social:hover {
	background-color: rgb(255 255 255 / 0.1);
}

.gb-nomo__contact-label {
	font-size: 0.78rem;
	color: var(--gb-scene-text-muted);
	line-height: 1.3;
}

.gb-nomo__contact-value {
	font-weight: 700;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

/* The box. */
.gb-nomo__form {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	padding: 0.65rem 0.75rem 0.4rem;
	border-block-start: 1px solid var(--gb-border);
	background-color: var(--gb-bg);
}

.gb-nomo__input {
	flex: 1;
	min-block-size: 2.75rem;
	max-block-size: 7rem;
	padding: 0.6rem 0.85rem;
	border: 1.5px solid var(--gb-border);
	border-radius: 1.4rem;
	background-color: var(--gb-surface);
	color: var(--gb-text);
	font: inherit;
	font-size: max(16px, var(--gb-step-0)); /* 16px+: phones do not zoom into the box. */
	line-height: 1.5;
	resize: none;
}

.gb-nomo__input:focus {
	border-color: var(--gb-color-turquoise);
	background-color: var(--gb-bg);
}

.gb-nomo__send {
	display: inline-grid;
	place-items: center;
	flex: none;
	inline-size: 2.75rem;
	block-size: 2.75rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: var(--gb-scene-bg);
	color: var(--gb-scene-text);
	cursor: pointer;
}

.gb-nomo__send .gb-icon {
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

/* The send arrow points the way the text runs. */
[dir="rtl"] .gb-nomo__send .gb-icon {
	transform: scaleX(-1);
}

.gb-nomo__send:hover {
	background-color: var(--gb-color-logo-navy);
}

.gb-nomo__note {
	margin: 0;
	padding: 0 0.9rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
	background-color: var(--gb-bg);
	color: var(--gb-text-muted);
	font-size: 0.78rem;
	line-height: 1.5;
}

.gb-nomo__note a {
	color: var(--gb-text);
	font-weight: 700;
	text-decoration-color: var(--gb-link-decoration);
}

/* Reduced motion (or the footer's «إيقاف الحركة»): no movement at all. */
@media (prefers-reduced-motion: reduce) {
	.gb-nomo__panel,
	.gb-nomo__turn,
	.gb-nomo__dots::before,
	.gb-nomo__dots::after,
	.gb-nomo__turn--typing .gb-nomo__bubble::before {
		animation: none;
	}

	.gb-nomo__launcher:hover {
		transform: none;
	}
}

html[data-gb-motion="off"] .gb-nomo__panel,
html[data-gb-motion="off"] .gb-nomo__turn {
	animation: none;
}

/* Windows high-contrast: the bubbles keep their edges. */
@media (forced-colors: active) {
	.gb-nomo__bubble,
	.gb-nomo__card,
	.gb-nomo__launcher {
		border: 1px solid CanvasText;
	}
}

@media print {
	.gb-nomo {
		display: none;
	}
}
