/* Ask YEEB. Mobile first: most of the young people this is for are on a phone
   with one thumb, so the phone layout is the default and the desktop card is
   the exception. */

.yeeb-ai {
	--ya-navy: #0b1636;
	--ya-lime: #a6ce39;
	--ya-cream: #f7f6f2;
	--ya-ink: #1b2440;
	--ya-line: #e7e5df;
	--ya-soft: #6d7488;
	--ya-vh: 100dvh;
	--ya-vtop: 0px;

	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 99998;
	font-family: inherit;
}

.yeeb-ai * { box-sizing: border-box; }

/* ---------------------------------------------------------------- Launcher */

.yeeb-ai__launch {
	display: inline-flex;
	gap: 9px;
	align-items: center;
	min-height: 48px;
	padding: 13px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--ya-navy);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(11, 22, 54, 0.28);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.yeeb-ai__launch:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(11, 22, 54, 0.34); }
.yeeb-ai__launch:focus-visible { outline: 3px solid var(--ya-lime); outline-offset: 3px; }
.yeeb-ai__launch-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ya-lime); }
.yeeb-ai.is-open .yeeb-ai__launch { display: none; }

/* ---------------------------------------------------------------- Panel */

.yeeb-ai__panel[hidden] { display: none; }

.yeeb-ai__panel {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	top: var(--ya-vtop);
	display: flex;
	flex-direction: column;
	width: 100%;
	height: var(--ya-vh);
	background: var(--ya-cream);
	border: 0;
	border-radius: 0;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(11, 22, 54, 0.32);
}

/* ---------------------------------------------------------------- Header */

.yeeb-ai__head {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 12px 14px;
	padding-top: calc(12px + env(safe-area-inset-top));
	background: var(--ya-navy);
	color: #fff;
}

.yeeb-ai__avatar {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--ya-lime);
}

.yeeb-ai__avatar--mark {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ya-navy);
	font-size: 18px;
	font-weight: 800;
}

.yeeb-ai__ident { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.25; }
.yeeb-ai__ident strong { font-size: 16px; }
.yeeb-ai__note { color: #c9d0e4; font-size: 12px; }

.yeeb-ai__restart,
.yeeb-ai__close {
	min-width: 44px;
	min-height: 44px;
	padding: 0 8px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: #fff;
	font: inherit;
	cursor: pointer;
}

.yeeb-ai__restart { font-size: 13px; text-decoration: underline; }
.yeeb-ai__close { font-size: 26px; line-height: 1; }
.yeeb-ai__restart:hover,
.yeeb-ai__close:hover { background: rgba(255, 255, 255, 0.12); }
.yeeb-ai__restart:focus-visible,
.yeeb-ai__close:focus-visible { outline: 3px solid var(--ya-lime); outline-offset: 2px; }

/* ---------------------------------------------------------------- Log */

.yeeb-ai__log {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.yeeb-ai__row { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.yeeb-ai__row--bot { align-self: flex-start; }
.yeeb-ai__row--me { align-self: flex-end; }

.yeeb-ai__bubble-avatar {
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--ya-lime);
}

.yeeb-ai__bubble-avatar--mark {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ya-navy);
	font-size: 14px;
	font-weight: 800;
}

.yeeb-ai__msg {
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.yeeb-ai__msg--bot { background: #fff; color: var(--ya-ink); border: 1px solid var(--ya-line); border-bottom-left-radius: 4px; }
.yeeb-ai__msg--me { background: var(--ya-navy); color: #fff; border-bottom-right-radius: 4px; }
.yeeb-ai__row--typing .yeeb-ai__msg { color: var(--ya-soft); }

.yeeb-ai__who { display: block; margin-bottom: 2px; color: var(--ya-soft); font-size: 12px; font-weight: 700; }
.yeeb-ai__msg a { color: inherit; text-underline-offset: 2px; }
.yeeb-ai__msg--bot a { color: #12306f; }

/* ---------------------------------------------------------------- Pills */

.yeeb-ai__picks { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; background: var(--ya-cream); }
.yeeb-ai__picks[hidden] { display: none; }

.yeeb-ai__pick {
	min-height: 44px;
	padding: 10px 15px;
	border: 1px solid var(--ya-navy);
	border-radius: 999px;
	background: #fff;
	color: var(--ya-navy);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.yeeb-ai__pick:hover { background: var(--ya-lime); border-color: var(--ya-lime); }
.yeeb-ai__pick:focus-visible { outline: 3px solid var(--ya-navy); outline-offset: 2px; }

/* ---------------------------------------------------------------- Composer */

.yeeb-ai__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	background: #fff;
	border-top: 1px solid var(--ya-line);
}

.yeeb-ai__form input {
	flex: 1;
	min-height: 44px;
	padding: 11px 15px;
	border: 1px solid var(--ya-line);
	border-radius: 999px;
	font-family: inherit;
	font-size: 16px; /* 16px stops iOS zooming the page on focus. */
	outline: none;
}

.yeeb-ai__form input:focus { border-color: var(--ya-navy); box-shadow: 0 0 0 3px rgba(11, 22, 54, 0.12); }

.yeeb-ai__send {
	min-width: 64px;
	min-height: 44px;
	padding: 11px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--ya-navy);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

.yeeb-ai__send:hover { background: #13224e; }
.yeeb-ai__send:focus-visible { outline: 3px solid var(--ya-lime); outline-offset: 2px; }

/* One action row, under the composer, updated in place. */
.yeeb-ai__actions { padding: 0 12px 4px; background: #fff; }
.yeeb-ai__actions[hidden] { display: none; }

.yeeb-ai__route {
	display: inline-block;
	min-height: 44px;
	padding: 11px 16px;
	border-radius: 999px;
	background: var(--ya-lime);
	color: var(--ya-navy);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.yeeb-ai__route:hover { filter: brightness(0.96); }
.yeeb-ai__route:focus-visible { outline: 3px solid var(--ya-navy); outline-offset: 2px; }

.yeeb-ai__foot {
	margin: 0;
	padding: 8px 12px;
	padding-bottom: calc(10px + env(safe-area-inset-bottom));
	background: #fff;
	color: var(--ya-soft);
	font-size: 11.5px;
	text-align: center;
}

.yeeb-ai__foot a { color: var(--ya-soft); }

/* Honeypot. Off screen rather than display none, so a bot that checks for
   visibility still fills it in. Never focusable, never announced. */
.yeeb-ai__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* ---------------------------------------------------------------- Desktop */

@media (min-width: 521px) {
	.yeeb-ai { right: 20px; bottom: 20px; }

	.yeeb-ai__panel {
		top: auto;
		right: 20px;
		bottom: 20px;
		left: auto;
		width: min(392px, calc(100vw - 40px));
		height: min(600px, calc(100vh - 40px));
		border: 1px solid var(--ya-line);
		border-radius: 18px;
	}

	.yeeb-ai__head { padding-top: 12px; }
	.yeeb-ai__foot { padding-bottom: 12px; }
}

/* ---------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: reduce) {
	.yeeb-ai *,
	.yeeb-ai *::before,
	.yeeb-ai *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	.yeeb-ai__launch:hover { transform: none; }
	.yeeb-ai__log { scroll-behavior: auto; }
}

/* The page behind a full screen sheet should not scroll under it. */
body.yeeb-ai-open { overflow: hidden; }

@media (min-width: 521px) {
	body.yeeb-ai-open { overflow: auto; }
}

/* 1.7.0: the next step link inside a reply. */
.yeeb-ai__msglink {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ya-lime, #a6ce39);
  color: var(--ya-navy, #0b1636) !important;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.yeeb-ai__msglink:hover { filter: brightness(0.96); }

.yeeb-ai__msglink { display: flex; width: max-content; max-width: 100%; align-items: center; gap: 8px; }
.yeeb-ai__arrow { flex: none; transition: transform .2s ease; }
.yeeb-ai__route:hover .yeeb-ai__arrow, .yeeb-ai__msglink:hover .yeeb-ai__arrow { transform: translateX(3px); }

/* 1.7.0: the assistant on its own page, and the footer pill as a link. */
.yeeb-ai--pill .yeeb-ai__launch { text-decoration: none; }
.yeeb-ai--pill .yeeb-ai__arrow { margin-left: 2px; }
.yeeb-ai--inline { position: static; right: auto; bottom: auto; z-index: auto; }
.yeeb-ai--inline .yeeb-ai__panel,
.yeeb-ai--inline .yeeb-ai__panel[hidden] { display: flex; }
.yeeb-ai--inline .yeeb-ai__panel {
	position: relative;
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;
	width: 100%;
	height: clamp(640px, 84vh, 960px);
	border: 1px solid var(--ya-line);
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(11, 22, 54, 0.12);
}
@media (min-width: 521px) {
	.yeeb-ai--inline .yeeb-ai__panel { width: 100%; height: clamp(640px, 84vh, 960px); right: auto; bottom: auto; }
}
/* The theme measures paragraphs at 68ch; inside the panel the panel is the measure. */
.yeeb-ai--inline p, .yeeb-ai--inline .yeeb-ai__foot { max-width: none; }

/* 1.8.0: service area icon on a quick pick, when the theme supplies it. */
.yeeb-ai__pick { display: inline-flex; align-items: center; gap: 8px; }
.yeeb-ai__pick .yeeb-ai__pick-ico { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-block; }

/* 1.8.0: "Was this helpful?" under a bot answer. Two small text buttons,
   then a thank you in the same place. */
.yeeb-ai__rate { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--ya-muted, #5c6270); }
.yeeb-ai__rate button { appearance: none; border: 1px solid rgba(13,27,61,.18); background: #fff; color: var(--ya-navy, #0d1b3d); border-radius: 999px; padding: 4px 11px; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; min-height: 28px; }
.yeeb-ai__rate button:hover { border-color: var(--ya-navy, #0d1b3d); }
.yeeb-ai__rate button[aria-pressed="true"] { background: var(--ya-navy, #0d1b3d); color: #fff; border-color: var(--ya-navy, #0d1b3d); }
.yeeb-ai__rate--done { color: var(--ya-muted, #5c6270); }
