/* HumanIS chat widget
 *
 * Palette is grounded in pounamu, New Zealand greenstone: a deep green that
 * reads as warm rather than corporate. The signature element is the zip
 * seam under the header, from the idea of retaining your individuality and
 * merging like a zip into a new country. Both sides keep their shape and
 * interlock.
 *
 * No web fonts are loaded. Pulling in Google Fonts would send every visitor's
 * IP address to Google on page load, which would contradict the privacy
 * notice. Personality comes from weight and spacing instead.
 *
 * Restyle by overriding these variables in Appearance, Customise, Additional CSS.
 */

.humanis {
	--humanis-ink: #16232e;
	--humanis-muted: #61707c;
	--humanis-line: #e2e6e4;
	--humanis-bg: #ffffff;
	--humanis-canvas: #f6f8f7;

	--humanis-pounamu: #1f6f5c;
	--humanis-pounamu-deep: #14503f;
	--humanis-pounamu-soft: #e8f1ee;

	--humanis-radius: 18px;
	--humanis-radius-sm: 12px;

	display: flex;
	flex-direction: column;
	background: var(--humanis-bg);
	border: 1px solid var(--humanis-line);
	border-radius: var(--humanis-radius);
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.55;
	color: var(--humanis-ink);
	max-width: 780px;
	margin: 0 auto;
	height: 640px;
	max-height: 82vh;
	box-shadow: 0 2px 4px rgba( 22, 35, 46, 0.04 ), 0 12px 32px rgba( 22, 35, 46, 0.07 );
}

.humanis * {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------- header */

.humanis__header {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px 22px;
	background: linear-gradient( 142deg, var(--humanis-pounamu) 0%, var(--humanis-pounamu-deep) 100% );
	color: #fff;
	flex: 0 0 auto;
}

.humanis__mark {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.16 );
	display: grid;
	place-items: center;
	font-size: 22px;
	line-height: 1;
	border: 1px solid rgba( 255, 255, 255, 0.28 );
}

.humanis__identity {
	flex: 1 1 auto;
	min-width: 0;
}

.humanis__title {
	font-weight: 700;
	font-size: 18px;
	letter-spacing: -0.01em;
	margin: 0;
	color: inherit;
	line-height: 1.2;
}

.humanis__subtitle {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	opacity: 0.88;
	margin: 3px 0 0;
	color: inherit;
	font-weight: 400;
}

.humanis__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #7fdcb4;
	flex: 0 0 auto;
}

.humanis__reset {
	flex: 0 0 auto;
	background: rgba( 255, 255, 255, 0.12 );
	border: 1px solid rgba( 255, 255, 255, 0.34 );
	color: inherit;
	border-radius: 999px;
	padding: 7px 15px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
}

.humanis__reset:hover {
	background: rgba( 255, 255, 255, 0.24 );
}

.humanis__reset:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* The zip seam. Interlocking teeth along the join. */
.humanis__zip {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 9px;
	background-image:
		linear-gradient( 135deg, var(--humanis-canvas) 25%, transparent 25% ),
		linear-gradient( 225deg, var(--humanis-canvas) 25%, transparent 25% );
	background-size: 14px 9px;
	background-position: 0 0, 7px 0;
	background-repeat: repeat-x;
}

/* ---------------------------------------------------------------- log */

.humanis__log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 22px 20px 12px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: var(--humanis-canvas);
	-webkit-overflow-scrolling: touch;
}

.humanis__row {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	animation: humanis-rise 0.28s ease both;
}

.humanis__row--you {
	flex-direction: row-reverse;
}

@keyframes humanis-rise {
	from { opacity: 0; transform: translateY( 8px ); }
	to   { opacity: 1; transform: none; }
}

.humanis__avatar {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--humanis-pounamu-soft);
	border: 1px solid #d3e4dd;
	display: grid;
	place-items: center;
	font-size: 15px;
	line-height: 1;
	margin-bottom: 2px;
}

.humanis__msg {
	max-width: 84%;
	padding: 12px 16px;
	border-radius: var(--humanis-radius-sm);
	overflow-wrap: anywhere;
}

.humanis__msg p {
	margin: 0 0 0.7em;
}

.humanis__msg p:last-child {
	margin-bottom: 0;
}

.humanis__msg ul {
	margin: 0 0 0.7em;
	padding-left: 1.15em;
}

.humanis__msg li {
	margin-bottom: 0.35em;
}

.humanis__msg a {
	color: var(--humanis-pounamu-deep);
	text-underline-offset: 2px;
}

.humanis__msg--them {
	background: var(--humanis-bg);
	border: 1px solid var(--humanis-line);
	border-bottom-left-radius: 4px;
	box-shadow: 0 1px 2px rgba( 22, 35, 46, 0.04 );
}

.humanis__msg--you {
	background: var(--humanis-pounamu);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.humanis__msg--you a {
	color: inherit;
}

.humanis__msg--error {
	background: #fdeeee;
	border: 1px solid #f3d2d2;
	color: #8a2020;
	font-size: 15px;
}

/* ---------------------------------------------------------------- chips */

.humanis__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 2px 0 6px 40px;
	animation: humanis-rise 0.4s 0.1s ease both;
}

.humanis__chip {
	background: var(--humanis-bg);
	border: 1px solid #cfded8;
	color: var(--humanis-pounamu-deep);
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.humanis__chip:hover {
	background: var(--humanis-pounamu-soft);
	border-color: var(--humanis-pounamu);
	transform: translateY( -1px );
}

.humanis__chip:focus-visible {
	outline: 2px solid var(--humanis-pounamu);
	outline-offset: 2px;
}

.humanis__chip-emoji {
	margin-right: 6px;
}

/* ---------------------------------------------------------------- typing */

.humanis__typing {
	display: flex;
	gap: 5px;
	padding: 15px 18px;
	background: var(--humanis-bg);
	border: 1px solid var(--humanis-line);
	border-radius: var(--humanis-radius-sm);
	border-bottom-left-radius: 4px;
}

.humanis__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--humanis-pounamu);
	opacity: 0.35;
	animation: humanis-bounce 1.3s infinite;
}

.humanis__typing span:nth-child( 2 ) { animation-delay: 0.18s; }
.humanis__typing span:nth-child( 3 ) { animation-delay: 0.36s; }

@keyframes humanis-bounce {
	0%, 60%, 100% { opacity: 0.3; transform: translateY( 0 ); }
	30%           { opacity: 1;   transform: translateY( -4px ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.humanis__typing span,
	.humanis__row,
	.humanis__chips {
		animation: none;
	}
	.humanis__chip:hover { transform: none; }
}

/* ---------------------------------------------------------------- notice */

.humanis__notice {
	flex: 0 0 auto;
	display: flex;
	gap: 9px;
	align-items: flex-start;
	background: #fdf8ef;
	border-top: 1px solid #f0e3cc;
	padding: 11px 20px;
	font-size: 12.5px;
	line-height: 1.5;
	color: #6b5a3c;
}

.humanis__notice-icon {
	flex: 0 0 auto;
	line-height: 1.4;
}

.humanis__notice a {
	color: #8a6a24;
	font-weight: 500;
}

/* ---------------------------------------------------------------- input */

.humanis__form {
	flex: 0 0 auto;
	display: flex;
	gap: 10px;
	align-items: flex-end;
	padding: 14px 20px 18px;
	background: var(--humanis-bg);
	border-top: 1px solid var(--humanis-line);
}

.humanis__input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid #d5dcd9;
	border-radius: 14px;
	padding: 12px 15px;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming on focus */
	line-height: 1.45;
	max-height: 160px;
	color: var(--humanis-ink);
	background: var(--humanis-canvas);
	transition: border-color 0.15s ease, background 0.15s ease;
}

.humanis__input:focus {
	background: var(--humanis-bg);
	border-color: var(--humanis-pounamu);
	outline: 2px solid rgba( 31, 111, 92, 0.25 );
	outline-offset: 0;
}

.humanis__send {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 7px;
	background: var(--humanis-pounamu);
	color: #fff;
	border: 0;
	border-radius: 14px;
	padding: 12px 20px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.humanis__send:hover:not( :disabled ) {
	background: var(--humanis-pounamu-deep);
}

.humanis__send:focus-visible {
	outline: 2px solid var(--humanis-pounamu-deep);
	outline-offset: 2px;
}

.humanis__send:disabled {
	opacity: 0.45;
	cursor: default;
}

/* ---------------------------------------------------------------- bubble */

.humanis-launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99998;
	display: flex;
	align-items: center;
	gap: 9px;
	background: linear-gradient( 142deg, #1f6f5c 0%, #14503f 100% );
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 15px 24px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 8px 26px rgba( 20, 80, 63, 0.34 );
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.humanis-launcher:hover {
	transform: translateY( -2px );
	box-shadow: 0 12px 32px rgba( 20, 80, 63, 0.42 );
}

.humanis-launcher:focus-visible {
	outline: 3px solid #7fdcb4;
	outline-offset: 3px;
}

.humanis-panel {
	position: fixed;
	right: 22px;
	bottom: 92px;
	z-index: 99999;
	width: 420px;
	max-width: calc( 100vw - 32px );
	display: none;
}

.humanis-panel--open {
	display: block;
	animation: humanis-pop 0.22s ease both;
}

@keyframes humanis-pop {
	from { opacity: 0; transform: translateY( 14px ) scale( 0.98 ); }
	to   { opacity: 1; transform: none; }
}

.humanis-panel .humanis {
	height: 580px;
	max-height: calc( 100vh - 130px );
	margin: 0;
	box-shadow: 0 16px 48px rgba( 22, 35, 46, 0.28 );
}

@media ( prefers-reduced-motion: reduce ) {
	.humanis-panel--open { animation: none; }
	.humanis-launcher:hover { transform: none; }
}

@media ( max-width: 560px ) {
	.humanis-panel {
		right: 8px;
		left: 8px;
		bottom: 82px;
		width: auto;
	}

	.humanis-panel .humanis {
		height: calc( 100vh - 156px );
	}

	.humanis__msg { max-width: 92%; }
	.humanis__chips { padding-left: 0; }
	.humanis__send { padding: 12px 15px; }
	.humanis__send-label { display: none; }
}
