/*
 * Brikkipedia — Brikk design system (brikk-design-ab-test).
 * Cream surfaces, Cormorant Garamond display serif, Helvetica Neue body,
 * Brikk purple accents. Tokens mirror assets/css/landing.css in the A/B test.
 */

:root {
	--brikki-purple:         #6a2cdb;
	--brikki-purple-hover:   #5e25c9;
	--brikki-purple-soft:    #F0EDFB;
	--brikki-bg:             #f5f2ee;
	--brikki-sidebar-bg:     #efeae1;
	--brikki-main-bg:        #f7f4ee;
	--brikki-card-bg:        #ffffff;
	--brikki-hover:          rgba(26, 26, 26, 0.045);
	--brikki-bot-bubble:     #ffffff;
	--brikki-user-bubble:    var(--brikki-purple);
	--brikki-dark:           #1A1A1A;
	--brikki-dark-2:         #2B2B2B;
	--brikki-text:           var(--brikki-dark);
	--brikki-text-soft:      #4c4a45;
	--brikki-muted:          #6B6B6B;
	--brikki-border:         #E6E0D4;
	--brikki-border-soft:    #EFE9DD;
	--brikki-green:          #00B67A;
	--brikki-radius:         18px;
	--brikki-radius-sm:      10px;
	--brikki-shadow-soft:    0 10px 30px rgba(26, 26, 26, 0.06);
	--brikki-serif:          'Cormorant Garamond', 'Times New Roman', serif;
	--brikki-font:           'Helvetica Neue Local', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--brikki-sidebar-width:  236px;
}

/* Full-viewport lock for the Brikkipedia page template */
html.brikki-fullscreen,
body.brikki-fullscreen {
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	background: var(--brikki-bg);
	overscroll-behavior: none;
}

.brikki-app,
.brikki-app * {
	font-family: var(--brikki-font);
	box-sizing: border-box;
}

/*
 * Default (embedded) mode — the app is a normal in-flow element so it can sit
 * inside any theme page via the [brikki_chat] shortcode without covering the
 * theme's header/footer.
 */
.brikki-app {
	position: relative;
	display: grid;
	grid-template-columns: var(--brikki-sidebar-width) 1fr;
	height: 85vh;
	height: min(88dvh, 900px);
	min-height: 540px;
	border: 1px solid var(--brikki-border);
	border-radius: 22px;
	overflow: hidden;
	box-shadow: var(--brikki-shadow-soft);
	background: var(--brikki-bg);
	color: var(--brikki-text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	container: brikki / inline-size;
}

/*
 * Fullscreen mode — only on the dedicated Brikkipedia page template, which
 * adds .brikki-fullscreen to <html>/<body>. Pins the app to the viewport and
 * lifts it above theme chrome (but below the WP admin bar at z-index 99999).
 */
html.brikki-fullscreen .brikki-app,
body.brikki-fullscreen .brikki-app {
	position: fixed;
	inset: 0;
	z-index: 99980;
	height: auto;
	min-height: 0;
	border: none;
	border-radius: 0;
	box-shadow: none;
}

/* The admin bar is disabled on Brikki's fullscreen pages (show_admin_bar
   false), so no top offset is needed. Kill core's margin bump if another
   plugin re-enables the bar markup anyway. */
html.brikki-fullscreen {
	margin-top: 0 !important;
}

/* Another plugin's copy-toast (cdp-copy-alert-success) hides itself with only
   opacity: 0, so for logged-in users it invisibly overlaps the navigation and
   swallows clicks — remove it from the layout entirely on Brikki pages. */
#cdp-copy-alert-success,
.cdp-copy-alert-success {
	display: none !important;
}

/* Cookiebot's floating consent badge overlaps the fullscreen app chrome —
   hide it on the dedicated Brikki/FAQ pages only (Cookiebot itself still
   loads; consent stays manageable on regular theme pages). */
html.brikki-fullscreen #CookiebotWidget,
body.brikki-fullscreen #CookiebotWidget {
	display: none !important;
}

/* ---------- Mobile header + off-canvas chrome (desktop: hidden) ---------- */

.brikki-mobile-header,
.brikki-sidebar-overlay,
.brikki-sidebar-close {
	display: none;
}

/* ---------- Sidebar ---------- */

.brikki-sidebar {
	display: flex;
	flex-direction: column;
	background: var(--brikki-sidebar-bg);
	border-right: 1px solid var(--brikki-border);
	padding: 22px 14px 16px;
	height: 100%;
	min-height: 0;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(26, 26, 26, 0.18) transparent;
}

/* Slim cream-friendly scrollbar for Safari (Chrome/Firefox use the standard
   scrollbar-* properties above and ignore these). Only visible when the
   sidebar actually overflows. */
.brikki-sidebar::-webkit-scrollbar {
	width: 8px;
}

.brikki-sidebar::-webkit-scrollbar-track {
	background: transparent;
}

.brikki-sidebar::-webkit-scrollbar-thumb {
	background: rgba(26, 26, 26, 0.18);
	border-radius: 8px;
	border: 2px solid var(--brikki-sidebar-bg);
}

.brikki-sidebar::-webkit-scrollbar-thumb:hover {
	background: rgba(26, 26, 26, 0.32);
}

.brikki-sidebar-top {
	padding: 0 8px 20px;
}

.brikki-brand {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	width: fit-content;
}

.brikki-brand-logo {
	display: block;
	width: 104px;
	height: auto;
	flex-shrink: 0;
}

.brikki-sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.brikki-nav-item {
	display: flex;
	align-items: center;
	gap: 11px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--brikki-radius-sm);
	padding: 10px 12px;
	cursor: pointer;
	width: 100%;
	text-align: left;
	color: var(--brikki-text);
	font-size: 0.9rem;
	font-family: inherit;
	transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.brikki-nav-item:hover {
	background: var(--brikki-hover);
}

/* Category nav items are anchors (crawlable FAQ links). */
a.brikki-nav-item {
	text-decoration: none;
}

/* Identity block — informational, not a button: no hover or active chrome
   (the green status dot carries the "active" signal). */
.brikki-nav-chat {
	padding: 11px 12px;
	cursor: default;
}

.brikki-nav-chat:hover {
	background: transparent;
}

.brikki-nav-chat.is-active {
	background: transparent;
	border-color: transparent;
}

.brikki-nav-avatar {
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	border-radius: 50%;
	overflow: hidden;
	position: relative;
	background: var(--brikki-border-soft);
}

.brikki-nav-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 30%;
	display: block;
}

.brikki-nav-label {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.brikki-nav-title {
	font-weight: 700;
	font-size: 0.9rem;
	color: var(--brikki-dark);
	line-height: 1.2;
}

.brikki-nav-sub {
	font-size: 0.74rem;
	color: var(--brikki-muted);
	margin-top: 2px;
	line-height: 1.2;
}

/* Online status dot — always visible on the identity block (it signals that
   Brikki is available, not which view is active). */
.brikki-nav-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--brikki-green);
	flex-shrink: 0;
}

.brikki-new-chat-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	/* line-height 1 + block svg: keeps the "+" optically centered with the
	   label despite the bundled font's skewed vertical metrics. */
	line-height: 1;
	margin: 4px 0 18px;
	background: var(--brikki-card-bg);
	border: 1px solid var(--brikki-border);
	border-radius: var(--brikki-radius-sm);
	padding: 10px 12px;
	font-family: inherit;
	font-size: 0.86rem;
	font-weight: 500;
	color: var(--brikki-dark);
	cursor: pointer;
	transition: background 0.14s, border-color 0.14s;
}

.brikki-new-chat-btn:hover {
	border-color: #d4ccbc;
	background: #fdfcfa;
}

.brikki-new-chat-btn svg {
	width: 15px;
	height: 15px;
}

.brikki-sidebar-section-title {
	font-size: 0.66rem;
	font-weight: 500;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--brikki-muted);
	padding: 8px 8px 6px;
}

.brikki-sidebar-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.brikki-nav-cat {
	gap: 10px;
	color: var(--brikki-dark-2);
	font-weight: 400;
	font-size: 0.88rem;
}

.brikki-nav-cat.is-active {
	background: #e9e3d6;
	color: var(--brikki-dark);
}

.brikki-nav-icon {
	width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-top: -4px;
	color: var(--brikki-muted);
}

.brikki-nav-cat.is-active .brikki-nav-icon {
	color: var(--brikki-purple);
}

.brikki-nav-icon svg {
	width: 17px;
	height: 17px;
}

.brikki-nav-cat-label {
	flex: 1;
}

.brikki-sidebar-footer {
	margin-top: 18px;
	padding-top: 12px;
	border-top: 1px solid var(--brikki-border);
}

.brikki-brand-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--brikki-muted);
	font-size: 0.8rem;
	text-decoration: none;
	padding: 6px 8px;
	transition: color 0.14s;
}

.brikki-brand-link:hover {
	color: var(--brikki-dark);
}

.brikki-brand-link svg {
	width: 12px;
	height: 12px;
}

/* ---------- Main area ---------- */

.brikki-main {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	overflow: hidden;
	background: var(--brikki-main-bg);
}

/* ---------- Views ---------- */

.brikki-view {
	display: none;
	flex: 1;
	overflow-y: auto;
	padding: 28px 40px;
}

.brikki-view.is-active {
	display: block;
}

/* ---------- Welcome view ---------- */

.brikki-welcome {
	animation: brikki-fade-in 0.3s ease;
	max-width: 720px;
	margin: 6vh auto 0;
	text-align: center;
}

.brikki-welcome-avatar {
	position: relative;
	width: 76px;
	height: 76px;
	margin: 0 auto 26px;
	border-radius: 50%;
	overflow: hidden;
	box-shadow: 0 0 0 1px var(--brikki-border), 0 8px 20px rgba(26, 26, 26, 0.10);
}

.brikki-welcome-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 30%;
	display: block;
}

.brikki-welcome-title {
	font-family: var(--brikki-serif);
	font-size: clamp(2.1rem, 4.4vw, 2.9rem);
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1.05;
	margin: 0 0 18px;
	color: var(--brikki-dark);
	text-wrap: balance;
}

.brikki-welcome-text {
	color: var(--brikki-text-soft);
	max-width: 560px;
	margin: 0 auto;
	font-size: 0.98rem;
	font-weight: 400;
	line-height: 1.65;
}

.brikki-welcome-lede {
	font-family: var(--brikki-serif);
	font-style: italic;
	font-weight: 500;
	font-size: 1.12rem;
	color: var(--brikki-purple);
	letter-spacing: 0.005em;
}

/* Quick topics — plain text pills below the composer. */
.brikki-welcome-cards {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 12px;
	max-width: 640px;
	margin: 0 auto;
}

.brikki-welcome-card {
	display: inline-flex;
	align-items: center;
	background: var(--brikki-card-bg);
	border: 1px solid #e0d9ca;
	border-radius: 999px;
	padding: 10px 18px;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.88rem;
	font-weight: 400;
	color: var(--brikki-dark);
	transition: border-color 0.14s, box-shadow 0.14s, transform 0.08s;
}

.brikki-welcome-card:hover {
	border-color: rgba(106, 44, 219, 0.45);
	box-shadow: 0 4px 14px rgba(106, 44, 219, 0.08);
}

.brikki-welcome-card:active {
	transform: translateY(1px);
}

/* The new design uses text-only pills. */
.brikki-welcome-card-icon {
	display: none;
}

.brikki-welcome-card-label {
	font-weight: 400;
}

/* ---------- Chat view ---------- */

.brikki-view-chat {
	padding: 56px 40px 8px;
}

/* Recent conversations in the sidebar */
.brikki-chat-history {
	margin-top: 6px;
}

.brikki-chat-history-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Every conversation is a clearly separated bordered row — not just the
   active one. */
.brikki-chat-history-item {
	display: block;
	width: 100%;
	background: var(--brikki-card-bg);
	border: 1px solid var(--brikki-border);
	border-radius: 10px;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.83rem;
	color: var(--brikki-text-soft);
	text-align: left;
	padding: 9px 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: border-color 0.14s, background 0.14s, color 0.14s;
}

.brikki-chat-history-item:hover {
	border-color: rgba(106, 44, 219, 0.35);
	color: var(--brikki-dark);
}

.brikki-chat-history-item.is-active {
	background: rgba(106, 44, 219, 0.08);
	border-color: rgba(106, 44, 219, 0.4);
	color: var(--brikki-purple);
	font-weight: 500;
}

.brikki-messages {
	max-width: 720px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.brikki-msg {
	display: flex;
	flex-direction: column;
	max-width: 82%;
	animation: brikki-fade-in 0.18s ease;
}

.brikki-msg.bot {
	align-self: flex-start;
}

.brikki-msg.user {
	align-self: flex-end;
}

.brikki-bubble {
	padding: 12px 16px;
	border-radius: 16px;
	font-size: 0.95rem;
	line-height: 1.6;
	white-space: pre-wrap;
	word-break: break-word;
}

.brikki-msg.bot .brikki-bubble {
	background: var(--brikki-bot-bubble);
	color: var(--brikki-dark-2);
	border: 1px solid var(--brikki-border-soft);
	border-bottom-left-radius: 5px;
	box-shadow: 0 2px 8px rgba(26, 26, 26, 0.04);
}

.brikki-msg.user .brikki-bubble {
	background: var(--brikki-user-bubble);
	color: #fff;
	border-bottom-right-radius: 5px;
}

.brikki-msg-time {
	font-size: 0.68rem;
	color: var(--brikki-muted);
	margin-top: 4px;
	padding: 0 2px;
}

.brikki-msg.user .brikki-msg-time {
	text-align: right;
}

.brikki-typing .brikki-bubble {
	display: flex;
	gap: 5px;
	align-items: center;
	padding: 15px 18px;
}

.brikki-dot {
	width: 7px;
	height: 7px;
	background: #c6bfb0;
	border-radius: 50%;
	animation: brikki-bounce 1.2s infinite;
}

.brikki-dot:nth-child(2) { animation-delay: 0.2s; }
.brikki-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes brikki-bounce {
	0%, 80%, 100% { transform: translateY(0); }
	40%           { transform: translateY(-6px); }
}

@keyframes brikki-fade-in {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.brikki-msg.error .brikki-bubble {
	background: #fdf1ee;
	color: #b03a2e;
	border: 1px solid #eccfc7;
}

/* ---------- FAQ view ---------- */

.brikki-faq-page {
	max-width: 720px;
	margin: 24px auto 0;
}

.brikki-faq-badge {
	display: inline-block;
	color: var(--brikki-purple);
	font-size: 0.68rem;
	font-weight: 500;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	margin-bottom: 16px;
}

.brikki-faq-title {
	font-family: var(--brikki-serif);
	font-size: clamp(1.9rem, 4vw, 2.6rem);
	font-weight: 500;
	margin: 0 0 12px;
	letter-spacing: -0.01em;
	line-height: 1.05;
	color: var(--brikki-dark);
}

.brikki-faq-subtitle {
	color: var(--brikki-muted);
	font-size: 0.95rem;
	max-width: 580px;
	margin: 0 0 28px;
	line-height: 1.65;
}

.brikki-faq-accordion {
	background: var(--brikki-card-bg);
	border: 1px solid var(--brikki-border);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 2px 10px rgba(26, 26, 26, 0.03);
}

.brikki-faq-acc-item {
	border-top: 1px solid var(--brikki-border-soft);
}

.brikki-faq-acc-item:first-child {
	border-top: none;
}

.brikki-faq-acc-item.is-open {
	background: #fbf9f5;
}

.brikki-faq-acc-header {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	background: none;
	border: none;
	cursor: pointer;
	padding: 18px 20px;
	font-family: inherit;
	text-align: left;
	color: var(--brikki-dark);
}

.brikki-faq-acc-num {
	font-family: var(--brikki-serif);
	font-size: 0.9rem;
	color: var(--brikki-muted);
	letter-spacing: 0.04em;
	flex-shrink: 0;
	min-width: 22px;
}

.brikki-faq-acc-q {
	flex: 1;
	font-weight: 500;
	font-size: 0.96rem;
	color: var(--brikki-dark);
}

.brikki-faq-acc-chev {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	color: var(--brikki-muted);
	transition: transform 0.18s;
}

.brikki-faq-acc-chev svg {
	width: 15px;
	height: 15px;
}

.brikki-faq-acc-item.is-open .brikki-faq-acc-chev {
	transform: rotate(90deg);
	color: var(--brikki-purple);
}

.brikki-faq-acc-body {
	display: none;
	padding: 0 20px 18px 56px;
	color: var(--brikki-text-soft);
	font-size: 0.93rem;
	line-height: 1.65;
	white-space: pre-wrap;
}

.brikki-faq-acc-item.is-open .brikki-faq-acc-body {
	display: block;
}

/* Category page: each question is a link to its own page. */
.brikki-faq-item-link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px;
	text-decoration: none;
	color: var(--brikki-dark);
	transition: background 0.15s;
}

.brikki-faq-item-link:hover {
	background: #fbf9f5;
}

.brikki-faq-item-link:hover .brikki-faq-acc-chev {
	color: var(--brikki-purple);
	transform: translateX(2px);
}

/* Single FAQ item page */
.brikki-faq-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 18px;
	font-size: 0.82rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-decoration: none;
	color: var(--brikki-muted);
	transition: color 0.15s;
}

.brikki-faq-back:hover {
	color: var(--brikki-purple);
}

.brikki-faq-back svg {
	width: 14px;
	height: 14px;
}

.brikki-faq-answer {
	background: var(--brikki-card-bg);
	border: 1px solid var(--brikki-border);
	border-radius: 16px;
	box-shadow: 0 2px 10px rgba(26, 26, 26, 0.03);
	padding: 24px 26px;
	color: var(--brikki-text-soft);
	font-size: 0.98rem;
	line-height: 1.75;
	max-width: 720px;
	margin: 6px 0 28px;
}

.brikki-faq-empty {
	padding: 28px 20px;
	text-align: center;
	color: var(--brikki-muted);
	font-style: italic;
}

.brikki-faq-cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	background: var(--brikki-card-bg);
	border: 1px solid var(--brikki-border);
	border-radius: 16px;
	padding: 20px 24px;
	margin-top: 24px;
}

.brikki-faq-cta-text {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.brikki-faq-cta-line1 {
	color: var(--brikki-muted);
	font-size: 0.68rem;
	font-weight: 500;
	letter-spacing: 0.24em;
	text-transform: uppercase;
}

.brikki-faq-cta-line2 {
	font-family: var(--brikki-serif);
	color: var(--brikki-dark);
	font-size: 1.25rem;
	font-weight: 500;
}

.brikki-faq-cta-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--brikki-purple);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 13px 22px 10px 22px;
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.16s;
}

.brikki-faq-cta-btn:hover {
	background: var(--brikki-purple-hover);
}

.brikki-faq-cta-btn svg {
	width: 13px;
	height: 13px;
}

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

.brikki-composer {
	display: none;
	flex-shrink: 0;
	padding: 14px 40px 8px;
	background: transparent;
}

.brikki-app[data-active-view="welcome"] .brikki-composer,
.brikki-app[data-active-view="chat"]    .brikki-composer {
	display: block;
}

/* Composer inlined inside the welcome view, between intro text and pills. */
.brikki-composer.is-inline-welcome {
	margin: 34px 0 0;
	padding: 0;
	width: 100%;
}

.brikki-composer-inner {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 720px;
	margin: 0 auto;
	background: var(--brikki-card-bg);
	border: 1px solid rgba(26, 26, 26, 0.07);
	border-radius: var(--brikki-radius);
	padding: 14px 14px 10px 18px;
	box-shadow: var(--brikki-shadow-soft);
	transition: border-color 0.14s, box-shadow 0.14s;
	text-align: left;
}

.brikki-composer-inner:focus-within {
	border-color: rgba(106, 44, 219, 0.35);
	box-shadow: 0 10px 30px rgba(106, 44, 219, 0.08);
}

.brikki-input {
	width: 100%;
	border: none;
	background: none;
	outline: none;
	font-size: 0.96rem;
	font-family: inherit;
	color: var(--brikki-dark);
	resize: none;
	min-height: 26px;
	max-height: 140px;
	overflow-y: auto;
	line-height: 1.5;
	padding: 2px 0 6px;
}

.brikki-input::placeholder {
	color: #a39e93;
	/* A long placeholder truncates instead of wrapping into a clipped 2nd line. */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.brikki-composer-tools {
	display: flex;
	align-items: center;
	gap: 4px;
}

.brikki-composer-spacer {
	flex: 1;
}

.brikki-attach-btn,
.brikki-mic-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--brikki-muted);
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.14s, color 0.14s;
}

.brikki-attach-btn:hover,
.brikki-mic-btn:hover {
	background: rgba(106, 44, 219, 0.08);
	color: var(--brikki-purple);
}

.brikki-attach-btn svg,
.brikki-mic-btn svg {
	width: 17px;
	height: 17px;
}

.brikki-mic-btn.is-listening {
	background: var(--brikki-purple);
	color: #fff;
	animation: brikki-pulse 1.6s infinite;
}

@keyframes brikki-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(106, 44, 219, 0.35); }
	70%  { box-shadow: 0 0 0 9px rgba(106, 44, 219, 0); }
	100% { box-shadow: 0 0 0 0 rgba(106, 44, 219, 0); }
}

.brikki-send-btn {
	width: 40px;
	height: 40px;
	background: var(--brikki-purple);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #fff;
	transition: background 0.16s, opacity 0.16s;
}

.brikki-send-btn:hover:not(:disabled) {
	background: var(--brikki-purple-hover);
}

.brikki-send-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.brikki-send-btn svg {
	width: 17px;
	height: 17px;
}

/* ---------- Attachment chip ---------- */

.brikki-attachment-chip-slot {
	max-width: 720px;
	margin: 0 auto 8px;
	padding: 0;
}

.brikki-attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--brikki-purple-soft);
	color: var(--brikki-purple);
	border: 1px solid rgba(106, 44, 219, 0.18);
	border-radius: 999px;
	padding: 6px 6px 6px 12px;
	font-size: 0.85rem;
	max-width: 100%;
}

.brikki-attachment-chip-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.brikki-attachment-chip-icon svg {
	width: 16px;
	height: 16px;
}

.brikki-attachment-chip-name {
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 320px;
}

.brikki-attachment-chip-size {
	color: rgba(106, 44, 219, 0.65);
	font-size: 0.78rem;
	flex-shrink: 0;
}

.brikki-attachment-chip-remove {
	background: rgba(106, 44, 219, 0.12);
	border: none;
	color: var(--brikki-purple);
	width: 22px;
	height: 22px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.14s;
}

.brikki-attachment-chip-remove:hover {
	background: rgba(106, 44, 219, 0.22);
}

.brikki-attachment-error {
	display: inline-block;
	background: #fdf1ee;
	color: #b03a2e;
	border: 1px solid #eccfc7;
	border-radius: 10px;
	padding: 6px 12px;
	font-size: 0.82rem;
}

/* ---------- Disclaimer ---------- */

.brikki-disclaimer {
	display: none;
	flex-shrink: 0;
	margin: 0;
	padding: 8px 40px 16px;
	text-align: center;
	font-size: 0.76rem;
	line-height: 1.6;
	color: #8f8a7e;
	max-width: 720px;
	margin-left: auto;
	margin-right: auto;
}

.brikki-app[data-active-view="welcome"] .brikki-disclaimer,
.brikki-app[data-active-view="chat"]    .brikki-disclaimer {
	display: block;
}

/* Disclaimer inlined in the welcome view, between composer and pills. */
.brikki-disclaimer.is-inline-welcome {
	padding: 12px 0 26px;
}

/* ---------- Contact card ---------- */

.brikki-contact-card {
	align-self: flex-start;
	max-width: 82%;
	background: var(--brikki-card-bg);
	border: 1.5px solid var(--brikki-purple);
	border-radius: 16px;
	padding: 18px 20px;
	margin-top: 4px;
	animation: brikki-fade-in 0.18s ease;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.brikki-contact-heading {
	font-family: var(--brikki-serif);
	font-weight: 500;
	font-size: 1.2rem;
	color: var(--brikki-dark);
}

.brikki-contact-phone {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 1.02rem;
	font-weight: 700;
}

.brikki-contact-phone svg {
	width: 18px;
	height: 18px;
	fill: var(--brikki-purple);
	flex-shrink: 0;
}

.brikki-contact-phone a {
	color: var(--brikki-purple);
	text-decoration: none;
}

.brikki-contact-phone a:hover {
	text-decoration: underline;
}

.brikki-contact-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.brikki-cf-name,
.brikki-cf-email,
.brikki-cf-phone,
.brikki-cf-message {
	border: 1px solid var(--brikki-border);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 0.875rem;
	font-family: inherit;
	color: var(--brikki-dark);
	background: #faf8f4;
	outline: none;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.brikki-cf-name:focus,
.brikki-cf-email:focus,
.brikki-cf-phone:focus,
.brikki-cf-message:focus {
	border-color: var(--brikki-purple);
}

.brikki-cf-message {
	resize: vertical;
	min-height: 68px;
}

.brikki-cf-submit {
	background: var(--brikki-purple);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0 20px;
	min-height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* line-height 1 + flex centering: the bundled display font has skewed
	   vertical metrics that push text off-center in plain buttons. */
	line-height: 1;
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.18em;
	/* Compensate the trailing letter-space after the last glyph. */
	text-indent: 0.18em;
	text-transform: uppercase;
	font-family: inherit;
	cursor: pointer;
	align-self: flex-start;
	transition: background 0.16s;
}

.brikki-cf-submit:hover:not(:disabled) {
	background: var(--brikki-purple-hover);
}

.brikki-cf-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.brikki-cf-status {
	font-size: 0.8rem;
	min-height: 1.2em;
}

.brikki-cf-status--success {
	color: var(--brikki-green);
}

.brikki-cf-status--error {
	color: #b03a2e;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
	.brikki-app {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.brikki-main {
		min-height: 0;
	}

	/* Mobile header: brand left, menu button right. */
	.brikki-mobile-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 12px 16px;
		background: var(--brikki-sidebar-bg);
		border-bottom: 1px solid var(--brikki-border);
	}

	/* Same identity block as the desktop sidebar: avatar + name + subtitle. */
	.brikki-mobile-brand {
		display: flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		background: none;
		border: none;
		padding: 0;
		font-family: inherit;
		text-align: left;
		cursor: pointer;
	}

	.brikki-mobile-avatar {
		width: 34px;
		height: 34px;
		flex-shrink: 0;
		border-radius: 50%;
		overflow: hidden;
		background: var(--brikki-border-soft);
	}

	.brikki-mobile-avatar img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}

	.brikki-mobile-label {
		display: flex;
		flex-direction: column;
		gap: 1px;
		min-width: 0;
	}

	.brikki-mobile-title {
		font-size: 14px;
		font-weight: 600;
		line-height: 1.2;
		color: var(--brikki-dark);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.brikki-mobile-sub {
		font-size: 11px;
		line-height: 1.2;
		color: var(--brikki-muted);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.brikki-menu-btn {
		display: inline-flex;
		align-items: center;
		gap: 7px;
		padding: 9px 14px;
		border: 1px solid var(--brikki-border);
		border-radius: 999px;
		background: var(--brikki-card-bg);
		color: var(--brikki-dark);
		font-family: inherit;
		font-size: 12px;
		font-weight: 500;
		line-height: 1;
		cursor: pointer;
		flex-shrink: 0;
	}

	.brikki-menu-btn svg {
		width: 14px;
		height: 14px;
		display: block;
	}

	/* The sidebar becomes an off-canvas drawer sliding in from the right.
	   (position: fixed resolves against .brikki-app — it declares a container,
	   which makes it the containing block. Fullscreen = viewport anyway.) */
	.brikki-sidebar {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: auto;
		width: min(320px, 86vw);
		height: auto;
		max-height: none;
		border-right: none;
		border-left: 1px solid var(--brikki-border);
		padding: 46px 14px 16px;
		overflow-y: auto;
		transform: translateX(105%);
		transition: transform 0.24s ease;
		z-index: 99995;
		box-shadow: -14px 0 40px rgba(26, 26, 26, 0.12);
	}

	.brikki-app.menu-open .brikki-sidebar {
		transform: translateX(0);
	}

	.brikki-sidebar-overlay {
		position: fixed;
		inset: 0;
		background: rgba(26, 26, 26, 0.35);
		z-index: 99990;
	}

	.brikki-app.menu-open .brikki-sidebar-overlay {
		display: block;
	}

	.brikki-sidebar-close {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 14px;
		right: 12px;
		width: 32px;
		height: 32px;
		border: 1px solid var(--brikki-border);
		border-radius: 50%;
		background: var(--brikki-card-bg);
		color: var(--brikki-dark);
		font-size: 18px;
		line-height: 1;
		cursor: pointer;
	}

	.brikki-sidebar-nav {
		gap: 4px;
	}

	/* No quick-topic pills in the stacked/mobile layout. */
	.brikki-welcome-cards {
		display: none;
	}

	.brikki-view {
		padding: 22px 18px;
	}

	.brikki-view-chat {
		padding: 18px 18px 8px;
	}

	.brikki-composer {
		padding: 12px 18px 8px;
	}

	.brikki-faq-title {
		font-size: 1.6rem;
	}

	.brikki-faq-cta {
		flex-direction: column;
		align-items: flex-start;
	}

	.brikki-faq-acc-body {
		padding-left: 20px;
	}
}

/*
 * Container-based responsiveness — when the app is embedded in a narrow theme
 * column, collapse to the stacked layout regardless of viewport width.
 */
@container brikki (max-width: 820px) {
	.brikki-app {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.brikki-main {
		min-height: 0;
	}

	.brikki-mobile-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 12px 16px;
		background: var(--brikki-sidebar-bg);
		border-bottom: 1px solid var(--brikki-border);
	}

	/* Same identity block as the desktop sidebar: avatar + name + subtitle. */
	.brikki-mobile-brand {
		display: flex;
		align-items: center;
		gap: 10px;
		min-width: 0;
		background: none;
		border: none;
		padding: 0;
		font-family: inherit;
		text-align: left;
		cursor: pointer;
	}

	.brikki-mobile-avatar {
		width: 34px;
		height: 34px;
		flex-shrink: 0;
		border-radius: 50%;
		overflow: hidden;
		background: var(--brikki-border-soft);
	}

	.brikki-mobile-avatar img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}

	.brikki-mobile-label {
		display: flex;
		flex-direction: column;
		gap: 1px;
		min-width: 0;
	}

	.brikki-mobile-title {
		font-size: 14px;
		font-weight: 600;
		line-height: 1.2;
		color: var(--brikki-dark);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.brikki-mobile-sub {
		font-size: 11px;
		line-height: 1.2;
		color: var(--brikki-muted);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.brikki-menu-btn {
		display: inline-flex;
		align-items: center;
		gap: 7px;
		padding: 9px 14px;
		border: 1px solid var(--brikki-border);
		border-radius: 999px;
		background: var(--brikki-card-bg);
		color: var(--brikki-dark);
		font-family: inherit;
		font-size: 12px;
		font-weight: 500;
		line-height: 1;
		cursor: pointer;
		flex-shrink: 0;
	}

	.brikki-menu-btn svg {
		width: 14px;
		height: 14px;
		display: block;
	}

	.brikki-sidebar {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: auto;
		width: min(320px, 86vw);
		height: auto;
		max-height: none;
		border-right: none;
		border-left: 1px solid var(--brikki-border);
		padding: 46px 14px 16px;
		overflow-y: auto;
		transform: translateX(105%);
		transition: transform 0.24s ease;
		z-index: 99995;
		box-shadow: -14px 0 40px rgba(26, 26, 26, 0.12);
	}

	.brikki-app.menu-open .brikki-sidebar {
		transform: translateX(0);
	}

	.brikki-sidebar-overlay {
		position: fixed;
		inset: 0;
		background: rgba(26, 26, 26, 0.35);
		z-index: 99990;
	}

	.brikki-app.menu-open .brikki-sidebar-overlay {
		display: block;
	}

	.brikki-sidebar-close {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 14px;
		right: 12px;
		width: 32px;
		height: 32px;
		border: 1px solid var(--brikki-border);
		border-radius: 50%;
		background: var(--brikki-card-bg);
		color: var(--brikki-dark);
		font-size: 18px;
		line-height: 1;
		cursor: pointer;
	}

	.brikki-welcome-cards {
		display: none;
	}

	.brikki-view {
		padding: 22px 18px;
	}

	.brikki-view-chat {
		padding: 18px 18px 8px;
	}

	.brikki-composer {
		padding: 12px 18px 8px;
	}

	.brikki-faq-title {
		font-size: 1.6rem;
	}

	.brikki-faq-cta {
		flex-direction: column;
		align-items: flex-start;
	}

	.brikki-faq-acc-body {
		padding-left: 20px;
	}
}

/* ---------- Mobile overhaul ---------- */

.brikki-new-chat-btn svg {
	display: block;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	margin-top: -2px;
}

@media (max-width: 900px) {
	/*
	 * Welcome + FAQ views flow like a normal page on mobile — nothing pinned,
	 * the body scrolls. Only the active chat view keeps the app-like layout.
	 */
	html.brikki-fullscreen:has(.brikki-app[data-active-view="welcome"]),
	body.brikki-fullscreen:has(.brikki-app[data-active-view="welcome"]),
	html.brikki-fullscreen:has(.brikki-app[data-active-view="faq"]),
	body.brikki-fullscreen:has(.brikki-app[data-active-view="faq"]) {
		overflow: auto !important;
		height: auto;
	}

	html.brikki-fullscreen .brikki-app[data-active-view="welcome"],
	body.brikki-fullscreen .brikki-app[data-active-view="welcome"],
	html.brikki-fullscreen .brikki-app[data-active-view="faq"],
	body.brikki-fullscreen .brikki-app[data-active-view="faq"] {
		position: static;
		height: auto;
		min-height: 100dvh;
	}

	.brikki-app[data-active-view="welcome"] .brikki-view,
	.brikki-app[data-active-view="faq"] .brikki-view {
		overflow: visible;
	}


}

/*
 * Deterministic type sizes on phones. The app inherits the theme's root
 * font-size through rem units, which inflates everything on mobile — pixel
 * values keep the UI compact regardless of theme. The input stays at 16px:
 * anything smaller makes iOS Safari zoom in on focus.
 */
@media (max-width: 640px) {
	.brikki-bubble {
		font-size: 15px;
		line-height: 1.55;
		padding: 10px 14px;
	}

	.brikki-msg {
		max-width: 90%;
	}

	.brikki-msg-time {
		font-size: 11px;
	}

	.brikki-view-chat {
		padding: 20px 14px 8px;
	}

	.brikki-view {
		padding: 18px 14px;
	}

	.brikki-composer {
		padding: 10px 14px 6px;
	}

	.brikki-composer-inner {
		padding: 10px 12px 8px 14px;
	}

	.brikki-input {
		font-size: 16px;
		min-height: 24px;
		max-height: 110px;
	}

	.brikki-input::placeholder {
		font-size: 13px;
	}

	.brikki-welcome-title {
		font-size: 26px;
	}

	.brikki-welcome-text {
		font-size: 15px;
		line-height: 1.6;
	}

	.brikki-welcome-card-label {
		font-size: 13px;
	}

	.brikki-disclaimer {
		font-size: 11px;
	}

	.brikki-sidebar {
		padding: 10px 12px;
	}

	.brikki-faq-title {
		font-size: 24px;
	}

	.brikki-faq-subtitle {
		font-size: 14px;
	}

	.brikki-faq-acc-q {
		font-size: 14px;
	}

	.brikki-faq-item-link {
		padding: 14px 14px;
	}

	.brikki-faq-answer {
		padding: 18px;
		font-size: 15px;
	}

	.brikki-contact-card {
		max-width: 100%;
	}
}

/* ---------- Accessibility ---------- */

.brikki-app button:focus-visible,
.brikki-app a:focus-visible,
.brikki-app textarea:focus-visible,
.brikki-app input:focus-visible {
	outline: 2px solid var(--brikki-purple);
	outline-offset: 2px;
}

/* The composer card already highlights via :focus-within. */
.brikki-app .brikki-input:focus-visible {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.brikki-app,
	.brikki-app * {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
