/*
 * The Three Expressions — shared design (every module).
 * Fondamento: titles, headings, labels, the Asks.
 * Source Sans 3: everything members type and everything else.
 * Indigo for buttons, selection and progress. Red only for errors.
 */

@font-face {
	font-family: "Fondamento";
	src: url("../fonts/fondamento-v22-latin-regular.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-400-italic.woff2") format("woff2");
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}
@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

.te-root {
	/* Colors */
	--te-indigo: #2F2A6E;
	--te-ink: #1E1A2E;
	--te-cream: #F5F0E6;
	--te-card: #FFFDF8;
	--te-paper: #FBF8F2;
	--te-white: #FFFFFF;
	--te-border: #D8CFBF;
	--te-border-soft: #E3DACB;
	--te-muted: #6B6358;
	--te-muted-2: #5A5347;
	--te-faint: #8A8176;
	--te-tint: #E9E6FF;
	--te-chip: #EDE8F7;
	--te-ask: #3D3866;
	--te-error: #A63A26;
	/* Expression colors */
	--te-soul: #2F2A6E;
	--te-mind: #A0527C;
	--te-brain: #8A5A12;
	--te-brain-line: #C79A4A;
	/* Type */
	--te-serif: "Fondamento", Georgia, serif;
	--te-sans: "Source Sans 3", "Source Sans Pro", "Segoe UI", sans-serif;

	font-family: var(--te-sans);
	font-size: 16px;
	line-height: 1.5;
	color: var(--te-ink);
	background: var(--te-cream);
	border-radius: 24px;
	padding: 28px;
	box-sizing: border-box;
	text-align: left;
}
.te-root *,
.te-root *::before,
.te-root *::after {
	box-sizing: border-box;
}
.te-root p {
	margin: 0;
	padding: 0;
}
.te-root a {
	color: var(--te-indigo);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.te-root a:hover {
	color: var(--te-ink);
}
.te-root a.te-btn {
	text-decoration: none;
}

/* Headings and labels */
.te-root .te-title {
	font-family: var(--te-serif);
	font-weight: 400;
	color: var(--te-ink);
	margin: 0;
	padding: 0;
	line-height: 1.2;
}
.te-root .te-label {
	font-family: var(--te-serif);
	font-size: 16px;
	color: var(--te-muted);
}

/* Cards */
.te-root .te-card {
	background: var(--te-card);
	border: 1px solid var(--te-border-soft);
	border-radius: 20px;
	padding: 24px 28px;
}

/* Buttons (reset first: Divi styles buttons and links globally) */
.te-root .te-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 0 18px;
	margin: 0;
	border: 1.5px solid var(--te-muted);
	border-radius: 999px;
	background: transparent;
	color: var(--te-ink);
	font-family: var(--te-sans);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
	white-space: nowrap;
}
.te-root .te-btn::after,
.te-root .te-btn::before {
	content: none !important;
	display: none !important;
}
.te-root .te-btn:hover {
	background: var(--te-paper);
	border-color: var(--te-ink);
	padding: 0 18px;
}
.te-root .te-btn-primary,
.te-root .te-btn-primary:hover {
	background: var(--te-indigo);
	border-color: var(--te-indigo);
	color: var(--te-cream);
}
.te-root .te-btn-primary:hover {
	background: var(--te-ink);
	border-color: var(--te-ink);
}
.te-root .te-btn-outline {
	border-color: var(--te-indigo);
	color: var(--te-indigo);
}
.te-root .te-btn-small,
.te-root .te-btn-small:hover {
	min-height: 40px;
	padding: 0 16px;
	font-size: 13px;
}
.te-root .te-btn[disabled],
.te-root .te-btn[disabled]:hover {
	opacity: 0.45;
	cursor: not-allowed;
}
.te-root .te-btn:focus-visible,
.te-root input:focus-visible,
.te-root textarea:focus-visible,
.te-root select:focus-visible {
	outline: 3px solid var(--te-tint);
	outline-offset: 2px;
	box-shadow: 0 0 0 1px var(--te-indigo);
}

/* Fields */
.te-root input[type="text"],
.te-root input[type="email"],
.te-root textarea,
.te-root select {
	width: 100%;
	margin: 0;
	border: 1px solid var(--te-border);
	border-radius: 10px;
	background: var(--te-white);
	color: var(--te-ink);
	font-family: var(--te-sans);
	font-size: 16px; /* 16px stops phones zooming in on focus */
	line-height: 1.45;
	box-shadow: none;
}
.te-root input[type="text"],
.te-root input[type="email"] {
	min-height: 44px;
	padding: 0 12px;
}
.te-root textarea {
	padding: 10px 12px;
	resize: vertical;
}
.te-root select {
	min-height: 42px;
	padding: 0 10px;
	width: auto;
}
.te-root input[readonly],
.te-root textarea[readonly] {
	background: var(--te-paper);
}

/* Messages */
.te-root .te-note {
	font-size: 14px;
	line-height: 1.5;
	color: var(--te-muted-2);
}
.te-root .te-status {
	font-size: 13px;
	color: var(--te-muted-2);
}
.te-root .te-error,
.te-root .te-status.te-error {
	color: var(--te-error);
}
.te-root .te-alert:empty {
	display: none;
}
.te-root .te-alert {
	border: 1px solid var(--te-error);
	border-radius: 12px;
	padding: 10px 14px;
	background: var(--te-card);
	color: var(--te-error);
	font-size: 15px;
}

.te-root .te-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* =====================================================================
 * Bodhi, the AI coach: the chat (The Journal's and The Dig's window, phone sheets)
 * and the Privacy popup. Shared by every module.
 * ================================================================== */

.te-root .te-bodhi-win {
	position: fixed;
	width: 380px;
	height: min(620px, calc(100vh - 160px));
	min-height: 360px;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--te-border);
	border-radius: 22px;
	background: var(--te-card);
	box-shadow: 0 18px 50px rgba(30, 26, 46, 0.28);
	overflow: hidden;
	z-index: 100000;
}
.te-root .te-bodhi {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
.te-root .te-bodhi-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 10px 16px;
	background: var(--te-indigo);
	color: var(--te-cream);
	cursor: grab;
	touch-action: none;
	user-select: none;
}
.te-root .te-bodhi-win.is-sheet .te-bodhi-head {
	cursor: default;
}
.te-root .te-bodhi-avatar {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--te-cream);
	color: var(--te-indigo);
	font-family: var(--te-serif);
	font-size: 20px;
}
.te-root .te-bodhi-who {
	flex-grow: 1;
	min-width: 0;
}
.te-root .te-bodhi-title {
	font-size: 22px;
	line-height: 1.1;
	color: var(--te-cream);
}
.te-root .te-bodhi-sub {
	font-size: 13px;
	color: #CFCBEA;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.te-root .te-bodhi-close,
.te-root .te-bodhi-close:hover {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--te-cream);
	font-size: 16px;
	cursor: pointer;
}
.te-root .te-bodhi-close:hover {
	background: rgba(245, 240, 230, 0.15);
}
.te-root .te-bodhi-divider {
	align-self: center;
	margin: 10px 0 4px;
	padding: 2px 12px;
	border-radius: 999px;
	background: var(--te-chip);
	color: var(--te-indigo);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}
.te-root .te-bodhi-list > .te-bodhi-divider:first-child {
	margin-top: 0;
}
.te-root .te-bodhi-about {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
	font-size: 13px;
	color: var(--te-muted-2);
}
.te-root .te-bodhi-about label {
	white-space: nowrap;
}
.te-root .te-bodhi-pick {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	min-height: 34px;
	font-size: 14px;
}
.te-root .te-bodhi-list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 12px;
	background: var(--te-cream);
}
.te-root .te-bodhi-msg {
	max-width: 80%;
	padding: 8px 13px;
	border-radius: 18px;
	line-height: 1.4;
}
.te-root .te-bodhi-msg.is-bodhi {
	align-self: flex-start;
	background: var(--te-white);
	border: 1px solid var(--te-border-soft);
	border-bottom-left-radius: 6px;
}
.te-root .te-bodhi-msg.is-member {
	align-self: flex-end;
	background: var(--te-indigo);
	color: var(--te-cream);
	border-bottom-right-radius: 6px;
	margin-top: 6px;
}
.te-root .te-bodhi-text {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.te-root .te-bodhi-time {
	margin-top: 2px;
	font-size: 11px;
	text-align: right;
	color: #CFCBEA;
}
.te-root .te-bodhi-dots {
	display: inline-flex;
	gap: 4px;
	padding: 4px 0;
}
.te-root .te-bodhi-dots i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--te-faint);
	animation: te-bodhi-pulse 1.2s ease-in-out infinite;
}
.te-root .te-bodhi-dots i:nth-child(2) {
	animation-delay: 0.2s;
}
.te-root .te-bodhi-dots i:nth-child(3) {
	animation-delay: 0.4s;
}
@keyframes te-bodhi-pulse {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.te-root .te-bodhi-dots i {
		animation: none;
	}
}
.te-root .te-bodhi-compose {
	padding: 10px 12px 4px;
	border-top: 1px solid var(--te-border-soft);
	background: var(--te-card);
}
.te-root .te-bodhi-bar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}
.te-root .te-bodhi-input {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 140px;
	padding: 9px 14px;
	border-radius: 20px;
	resize: none;
	overflow-y: auto;
}
.te-root .te-bodhi-sendbtn,
.te-root .te-bodhi-sendbtn:hover {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: 50%;
	background: var(--te-indigo);
	color: var(--te-cream);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.te-root .te-bodhi-sendbtn:hover {
	background: var(--te-ink);
}
.te-root .te-bodhi-sendbtn:disabled {
	opacity: 0.45;
	cursor: default;
}
.te-root .te-bodhi-count {
	display: block;
	font-size: 12px;
	color: var(--te-muted-2);
	text-align: right;
}
.te-root .te-bodhi-count:empty {
	display: none;
}
.te-root .te-bodhi-locked {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	margin: 10px 12px 0;
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--te-paper);
	border: 1px solid var(--te-border-soft);
	font-size: 15px;
}
.te-root .te-bodhi-error {
	margin: 8px 12px 0;
	font-size: 14px;
}
.te-root .te-bodhi-foot {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 6px 14px 12px;
	background: var(--te-card);
}
.te-root .te-bodhi-note {
	font-size: 12px;
	color: var(--te-muted-2);
}
.te-root .te-bodhi-center {
	text-align: center;
}
.te-root .te-bodhi-links {
	display: flex;
	gap: 16px;
}
.te-root .te-bodhi-link,
.te-root .te-bodhi-link:hover {
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	color: var(--te-indigo);
	font-family: var(--te-sans);
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}
.te-root .te-bodhi-confirm {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 14px;
}

/* Phones: a bottom sheet instead of a window */
.te-root .te-bodhi-win.is-sheet {
	left: 0 !important;
	right: 0;
	top: auto !important;
	bottom: 0;
	width: auto;
	height: 88vh;
	min-height: 0;
	border-radius: 20px 20px 0 0;
	padding-bottom: env(safe-area-inset-bottom);
}

/* The Privacy popup */
.te-root .te-bodhi-privacy {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(30, 26, 46, 0.55);
	z-index: 100001;
}
.te-root .te-bodhi-privacy-box {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 560px;
	max-height: 85vh;
	overflow-y: auto;
	padding: 24px;
	border-radius: 18px;
	background: var(--te-card);
	color: var(--te-ink);
	font-size: 15px;
}
.te-root .te-bodhi-privacy-box .te-title {
	font-size: 24px;
}

/* The free member's notice (The Journal and The Dig): read-only, with the
   7-day free trial (never had a subscription) or Rejoin (it ended). */
.te-root .te-free-notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	background: var(--te-chip);
	border: 0;
}
.te-root .te-free-notice-text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1 1 420px;
	min-width: 0;
}
.te-root .te-free-notice-title {
	font-size: 24px;
}
.te-root .te-free-notice p {
	max-width: 70ch;
}
