/* Ask Meridian. Inherits the site's typefaces; colours are tokens so they can follow the Meridian palette. */
:root {
	--ma-ink: var(--mer-ink, #0A0A0A);
	--ma-muted: var(--mer-grey, #6B6B6B);
	--ma-rule: var(--mer-rule, #D4CFC9);
	--ma-paper: var(--mer-paper, #FAFAF9);
	--ma-tint: var(--mer-cream, #F5F1EC);
	--ma-accent: var(--mer-navy, #041D55);
	--ma-accent-ink: #ffffff;
	--ma-ai: var(--mer-gold-text, #7D6636);
	--ma-ai-bg: #FBF6EC;
	--ma-gold: var(--mer-gold, #C8A96E);
	--ma-serif: var(--mer-serif, 'Playfair Display', Georgia, serif);
	--ma-sans: var(--mer-sans, 'Inter', 'Helvetica Neue', Arial, sans-serif);
	--ma-radius: var(--mer-radius, 2px);
	--ma-shadow: 0 18px 50px rgba(3, 8, 30, .22);
}

.ma-shell, .ma-fab { font-family: var(--ma-sans); color: var(--ma-ink); box-sizing: border-box; }
.ma-shell *, .ma-shell *::before, .ma-shell *::after { box-sizing: border-box; }

/* Floating entry point */
.ma-fab {
	position: fixed; right: 20px; bottom: 20px; z-index: 99990;
	display: inline-flex; align-items: center; gap: 10px;
	padding: 10px 16px 10px 10px; border: 1px solid var(--ma-accent);
	background: var(--ma-accent); color: var(--ma-accent-ink);
	border-radius: 999px; font-size: 14px; font-weight: 600; letter-spacing: .01em;
	cursor: pointer; box-shadow: 0 6px 20px rgba(17, 20, 24, .18);
	transition: transform .15s ease, box-shadow .15s ease;
}
.ma-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(17, 20, 24, .24); }
.ma-fab:focus-visible { outline: 2px solid var(--ma-accent); outline-offset: 3px; }
.ma-fab-mark {
	display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
	background: var(--ma-accent-ink); color: var(--ma-accent); font-family: var(--ma-serif); font-size: 15px; font-weight: 700;
}
html.ma-lock { overflow: hidden; }
html.ma-lock .ma-fab { display: none; }

.ma-overlay { position: fixed; inset: 0; background: rgba(17, 20, 24, .35); z-index: 99991; }
.ma-overlay[hidden], .ma-drawer[hidden] { display: none !important; }
.ma-drawer {
	position: fixed; right: 0; top: 0; bottom: 0; z-index: 99992;
	width: min(520px, 100vw); background: var(--ma-paper); box-shadow: var(--ma-shadow);
	display: flex;
}
.ma-drawer .ma-shell { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 20px 22px 14px; }
.ma-drawer .ma-thread { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }

/* Shell */
.ma-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid var(--ma-accent); padding-bottom: 10px; }
.ma-kicker { margin: 0 0 2px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ma-ai); font-weight: 600; }
.ma-title { margin: 0; font-family: var(--ma-serif); font-size: 26px; line-height: 1.1; font-weight: 700; }
.ma-head-actions { display: flex; align-items: center; gap: 12px; }
.ma-expand { font-size: 13px; color: var(--ma-muted); }
.ma-close { background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; color: var(--ma-ink); padding: 0 4px; }
.ma-intro { font-size: 14px; line-height: 1.5; color: var(--ma-muted); margin: 10px 0 12px; }

.ma-thread { font-size: 15px; line-height: 1.55; }
.ma-turn { padding: 14px 0; border-bottom: 1px solid var(--ma-rule); }
.ma-q { margin: 0 0 8px; font-weight: 700; font-family: var(--ma-serif); font-size: 17px; }
.ma-a p { margin: 0 0 10px; }
.ma-body a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.ma-list { margin: 0 0 10px; padding-left: 20px; }
.ma-list li { margin: 0 0 8px; }
.ma-meta, .ma-src-meta { display: block; font-size: 12.5px; color: var(--ma-muted); }
.ma-quote { display: block; font-size: 13px; color: var(--ma-ink); border-left: 2px solid var(--ma-rule); padding-left: 8px; margin-top: 3px; }
.ma-note { font-size: 12.5px; color: var(--ma-muted); }
.ma-notice { font-size: 13px; background: var(--ma-tint); border-left: 3px solid var(--ma-muted); padding: 6px 10px; }

.ma-badge {
	display: inline-block; margin: 0 0 10px; padding: 2px 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
	border: 1px solid var(--ma-rule); color: var(--ma-muted); border-radius: var(--ma-radius);
}
.ma-badge-ai { color: var(--ma-ai); background: var(--ma-ai-bg); border-color: var(--ma-gold); }
.ma-badge-none { color: var(--ma-ink); }
.ma-analysis-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ma-ai); background: var(--ma-ai-bg); padding: 1px 6px; }

.ma-cite { font-size: .78em; vertical-align: super; line-height: 0; text-decoration: none !important; font-weight: 700; color: var(--ma-accent); padding: 0 1px; }
.ma-cite:hover { text-decoration: underline !important; }
.ma-cite-c { color: var(--ma-muted); cursor: help; }

.ma-table-wrap { overflow-x: auto; margin: 0 0 8px; }
.ma-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ma-table th, .ma-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--ma-rule); vertical-align: top; }
.ma-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ma-muted); font-weight: 600; }

.ma-sources { margin: 8px 0 4px; background: var(--ma-tint); padding: 8px 10px; }
.ma-sources summary { cursor: pointer; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.ma-sources ol { list-style: none; margin: 8px 0 0; padding: 0; }
.ma-src { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--ma-rule); transition: background .3s; }
.ma-src-n { font-weight: 700; font-size: 12px; padding-top: 2px; }
.ma-src-title { font-size: 14px; font-weight: 600; color: var(--ma-ink); text-decoration: none; }
.ma-src-title:hover { text-decoration: underline; }
.ma-src:not(.ma-src-cited) { opacity: .85; }
.ma-flash { background: #fff3c4; }
.ma-more { font-size: 13px; margin: 6px 0 0; }
.ma-more a { color: var(--ma-muted); }
.ma-error { color: #8a1c1c; font-size: 14px; }

.ma-loading { color: var(--ma-muted); font-size: 14px; display: flex; align-items: center; gap: 4px; }
.ma-loading span { width: 6px; height: 6px; border-radius: 50%; background: var(--ma-muted); animation: ma-b 1s infinite ease-in-out; }
.ma-loading span:nth-child(2) { animation-delay: .15s; }
.ma-loading span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes ma-b { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.ma-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.ma-chip {
	font: inherit; font-size: 13px; text-align: left; line-height: 1.3; cursor: pointer;
	background: var(--ma-paper); color: var(--ma-ink); border: 1px solid var(--ma-rule); border-radius: 999px; padding: 6px 12px;
}
.ma-chip:hover { border-color: var(--ma-ink); }

.ma-form { display: flex; gap: 8px; align-items: stretch; border: 1px solid var(--ma-accent); padding: 6px; background: var(--ma-paper); }
.ma-input { flex: 1; border: 0; resize: none; font: inherit; font-size: 16px; line-height: 1.4; padding: 6px; color: var(--ma-ink); background: transparent; min-height: 44px; }
.ma-input:focus { outline: none; }
.ma-form:focus-within { box-shadow: 0 0 0 2px rgba(17, 20, 24, .15); }
.ma-send { border: 0; background: var(--ma-accent); color: var(--ma-accent-ink); font: inherit; font-weight: 700; padding: 0 18px; cursor: pointer; min-height: 44px; }
.ma-send[disabled] { opacity: .5; cursor: progress; }
.ma-foot { font-size: 11.5px; line-height: 1.45; color: var(--ma-muted); margin: 8px 0 0; }
.ma-foot a { color: inherit; }

/* Dedicated page */
.ma-page { max-width: 820px; margin: 0 auto; padding: 8px 0 40px; }
.ma-page .ma-title { font-size: 36px; }
.ma-page .ma-thread:empty { display: none; }

.screen-reader-text:not(:focus) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

@media (max-width: 640px) {
	.ma-fab { right: 14px; bottom: 14px; padding: 8px; }
	.ma-fab-label { display: none; }
	.ma-drawer { width: 100vw; }
	.ma-drawer .ma-shell { padding: 14px 16px 10px; }
	.ma-intro { display: none; }
	.ma-turn .ma-q { font-size: 16px; }
	.ma-page { padding: 0 16px 32px; }
	.ma-page .ma-title { font-size: 28px; }
}
@media print { .ma-fab, .ma-drawer, .ma-overlay { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .ma-fab, .ma-loading span { transition: none; animation: none; } }

/* Follow-up suggestions scroll sideways on small screens once a conversation has started. */
@media (max-width: 640px) {
	.ma-thread:not(:empty) ~ .ma-suggest { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
	.ma-thread:not(:empty) ~ .ma-suggest .ma-chip { flex: 0 0 auto; white-space: nowrap; }
}

/* Logged-in editors: keep the drawer below the WordPress admin bar. */
.admin-bar .ma-drawer { top: 32px; }
@media (max-width: 782px) { .admin-bar .ma-drawer { top: 46px; } }

/* Once a conversation starts, give the thread the space: hide the intro, one sideways row of follow-ups. */
.ma-v-drawer .ma-thread:not(:empty) ~ .ma-suggest,
.ma-thread:not(:empty) ~ .ma-suggest { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.ma-thread:not(:empty) ~ .ma-suggest .ma-chip { flex: 0 0 auto; white-space: nowrap; }
.ma-v-drawer:has(.ma-thread:not(:empty)) .ma-intro { display: none; }

.ma-tagonly { font-size: 11px; color: var(--ma-ai); white-space: nowrap; cursor: help; }

/* Transactions block on Search the Record */
.ma-sr { border-top: 2px solid var(--ma-accent); background: var(--ma-paper); padding: 14px 0 6px; margin: 0 0 24px; font-family: var(--ma-sans); }
.ma-sr-h { font-family: var(--ma-serif); font-size: 22px; margin: 0 0 8px; }
.ma-sr-h span { font-family: var(--ma-sans); font-size: 12px; color: var(--ma-ai); letter-spacing: .08em; margin-left: 6px; }
.ma-sr-list { list-style: none; margin: 0; padding: 0; }
.ma-sr-list li { padding: 9px 0; border-bottom: 1px solid var(--ma-rule); }
.ma-sr-t { font-weight: 600; color: var(--ma-ink); text-decoration: none; }
.ma-sr-t:hover { text-decoration: underline; }
.ma-sr-m { display: block; font-size: 13px; color: var(--ma-muted); margin-top: 2px; }
.ma-sr-more { font-size: 13px; margin: 8px 0 0; }
