/* Site chat. Colors and type follow the child theme. */
:root {
	--aai-navy: #012754;
	--aai-blue: #26729c;
	--aai-red: #911c30;
	--aai-ink: #0a0a0a;
	--aai-muted: #5a5f66;
	--aai-line: #dcdfe3;
	--aai-soft: #f3f5f8;
	--aai-white: #fff;
	--aai-font: "CalibreWeb-Regular", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--aai-font-strong: "CalibreWeb-Semibold", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Header button: always visible, unlike search, which the theme hides in portrait. */
.chat-wrap {
	display: flex;
	align-items: center;
	margin-left: 1rem;
}

.aai-chat-open {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.75rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: 1rem/1 var(--aai-font-strong);
	cursor: pointer;
}

.aai-chat-open:hover,
.aai-chat-open:focus-visible {
	background: var(--aai-white);
	color: var(--aai-navy);
}

.aai-chat-open__icon {
	width: 1.05em;
	height: 1.05em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4A2.5 2.5 0 0 1 4 13.5z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4A2.5 2.5 0 0 1 4 13.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* In the main menu, just before "Find your advisor": an icon square the button's height. */
/* Paired tight with "Find your advisor": both get the reader to an advisor.
   That button has a transparent 1px border, so 5px here reads as a 6px gap.
   The id outranks the theme's item margin. */
.site-header #menu-primary > .menu-item--chat {
	display: flex;
	align-items: center;
	margin-right: 5px;
}
.site-header .menu-item--chat .chat-wrap {
	margin: 0;
}
/* Same blue as the "Find your advisor" button beside it; sized by the icon plus padding. */
.site-header .menu-item--chat .aai-chat-open {
	padding: 10px;
	justify-content: center;
	border: 0;
	border-radius: 0;
	background: #1779ba;
	color: var(--aai-white);
}
.site-header .menu-item--chat .aai-chat-open:hover,
.site-header .menu-item--chat .aai-chat-open:focus-visible {
	background: var(--aai-navy);
	color: var(--aai-white);
}
.site-header .menu-item--chat .aai-chat-open__icon {
	width: 32px;
	height: 32px;
}
.site-header .menu-item--chat .aai-chat-open__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

/* Phone menu: the desktop menus are shown here, and Subscribe is a button on
   desktop. On the phone it reads as an ordinary line, so the advisor pair is the
   one call to action. */
.off-canvas > ul.menu > li.button {
	margin: 0;
	padding: 0;
	background: none;
}
.off-canvas > ul.menu > li.button > a {
	padding: 0.7rem 1rem;
	background: none;
	color: #fff;
	font-size: 1.75rem;
}

/* Phone menu: the advisor pair at the end, in the desktop's order: the chat in
   words, then the filled Find your advisor button. */
.off-canvas > ul.menu > li.menu-item--advisor {
	margin-top: 0.5rem;
	border: 0; /* the desktop item's transparent border would inset it 1px from the chat button */
}
.off-canvas > ul.menu > li.menu-item--advisor > a {
	justify-content: center;
	padding: 0.85rem 1rem;
	background: #1779ba;
	font-family: var(--aai-font-strong);
	font-size: 1.375rem;
}
.off-canvas > ul.menu > li.menu-item--ask {
	margin-top: 1.5rem;
}
.off-canvas .aai-chat-open--text {
	display: flex;
	width: 100%;
	justify-content: center;
	gap: 0.6rem;
	padding: 0.85rem 1rem;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 0;
	color: #fff;
	font: 1.375rem/1.2 var(--aai-font-strong);
}
.off-canvas .aai-chat-open--text:hover,
.off-canvas .aai-chat-open--text:focus-visible {
	background: #fff;
	color: var(--aai-navy);
}
.off-canvas .aai-chat-open--text .aai-chat-open__icon {
	width: 1.3rem;
	height: 1.3rem;
}

/* Window: a panel under the header button on wide screens, full screen on phones. */
.aai-chat {
	position: fixed;
	inset: 5.5rem 1.5rem auto auto;
	width: min(26rem, calc(100vw - 2rem));
	height: min(38rem, calc(100vh - 7rem));
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0.5rem;
	background: var(--aai-white);
	color: var(--aai-ink);
	box-shadow: 0 1rem 3rem rgba(1, 39, 84, 0.28);
	font: 1.0625rem/1.45 var(--aai-font);
	overflow: hidden;
}

.aai-chat[open] {
	display: flex;
	flex-direction: column;
}

.aai-chat::backdrop {
	background: rgba(1, 39, 84, 0.25);
}

@media (max-width: 40em) {
	.aai-chat {
		inset: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
}

.aai-chat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: var(--aai-navy);
	color: var(--aai-white);
}

.aai-chat__title {
	margin: 0;
	color: inherit;
	font: 1.125rem/1.2 var(--aai-font-strong);
}

.aai-chat__close {
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.aai-chat__log {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	background: var(--aai-soft);
}

.aai-msg {
	max-width: 88%;
	margin: 0 0 0.75rem;
	padding: 0.6rem 0.85rem;
	border-radius: 0.75rem;
	background: var(--aai-white);
	border: 1px solid var(--aai-line);
}

.aai-msg p {
	margin: 0 0 0.5rem;
	font-size: inherit;
	line-height: inherit;
}

.aai-msg p:last-of-type {
	margin-bottom: 0;
}

.aai-msg--reader {
	margin-left: auto;
	background: var(--aai-blue);
	border-color: var(--aai-blue);
	color: var(--aai-white);
}

.aai-msg--agent {
	border-left: 3px solid var(--aai-red);
}

.aai-msg--thinking,
.aai-msg--typing {
	color: var(--aai-muted);
	font-style: italic;
}

.aai-sources {
	margin: 0.6rem 0 0;
	padding: 0.5rem 0 0;
	border-top: 1px solid var(--aai-line);
	list-style: none;
	font-size: 0.875rem;
	color: var(--aai-muted);
}

.aai-sources li {
	margin: 0.15rem 0;
}

.aai-sources a {
	color: var(--aai-blue);
}

.aai-chip {
	display: inline-block;
	margin: 0.6rem 0.4rem 0 0;
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--aai-blue);
	border-radius: 999px;
	background: var(--aai-white);
	color: var(--aai-blue);
	font: 0.9375rem/1.2 var(--aai-font-strong);
	cursor: pointer;
}

.aai-chip[aria-checked="true"],
.aai-chip--primary {
	background: var(--aai-blue);
	color: var(--aai-white);
}

.aai-chip:disabled {
	opacity: 0.6;
	cursor: default;
}

.aai-inline-form {
	margin-top: 0.5rem;
}

.aai-field {
	display: block;
	margin: 0.5rem 0 0;
	font-size: 0.875rem;
	color: var(--aai-muted);
}

.aai-field input {
	display: block;
	width: 100%;
	height: auto;
	margin: 0.2rem 0 0;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--aai-line);
	border-radius: 0.375rem;
	font: 1rem/1.3 var(--aai-font);
	box-shadow: none;
}

.aai-chat__form {
	display: flex;
	gap: 0.5rem;
	align-items: flex-end;
	margin: 0;
	padding: 0.75rem;
	border-top: 1px solid var(--aai-line);
	background: var(--aai-white);
}

.aai-chat__form textarea {
	flex: 1;
	min-height: 2.6rem;
	margin: 0;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--aai-line);
	border-radius: 0.375rem;
	font: 1rem/1.4 var(--aai-font);
	resize: none;
	box-shadow: none;
}

.aai-chat__send {
	height: 2.6rem;
	padding: 0 1rem;
	border: 0;
	border-radius: 0.375rem;
	background: var(--aai-navy);
	color: var(--aai-white);
	font: 1rem/1 var(--aai-font-strong);
	cursor: pointer;
}

.aai-chat__send:disabled {
	opacity: 0.6;
}

.aai-chat__note {
	margin: 0;
	padding: 0 0.75rem 0.6rem;
	background: var(--aai-white);
	font-size: 0.8125rem;
	color: var(--aai-muted);
}

.aai-chat__note a {
	color: var(--aai-blue);
}

.aai-chat :focus-visible {
	outline: 2px solid var(--aai-blue);
	outline-offset: 2px;
}
