/* ==========================================================================
   Torn Webinar Viewer — Styles
   Colour scheme: The Torn Project
   ========================================================================== */

.twv-root {
	/* Brand palette */
	--twv-coral: #ff8d77;
	--twv-aubergine: #33233a;
	--twv-honey: #ffeb73;
	--twv-plum: #4b2e60;
	--twv-brown: #603526;
	--twv-off-white: #fffef0;
	--twv-white: #fff;

	/* Semantic mappings */
	--twv-bg: var(--twv-white);
	--twv-surface: var(--twv-aubergine);
	--twv-text: var(--twv-aubergine);
	--twv-text-muted: rgba(255, 254, 240, 0.55);
	--twv-accent: var(--twv-coral);
	--twv-chat-accent: var(--twv-brown);

	--twv-private-accent: rgb(96 53 38 / 0.79);
	--twv-private-bg: rgb(96 53 38 / 0.64);

	--twv-chat-bg: rgb(255 141 119 / 0.67);
	--twv-border: rgba(255, 254, 240, 0.52);
	--twv-timestamp: var(--twv-brown);
	--twv-dot-border: var(--twv-plum);

	/* Fonts — uses site fonts if available, falls back gracefully */
	--twv-font-display: var(--font-display, "Relative Torn", Georgia, serif);
	--twv-font-body: var(--font-base, "Relative Medium", system-ui, sans-serif);
	--twv-font-mono: var(--font-mono, "Relative Mono", ui-monospace, monospace);

	font-family: var(--twv-font-body);
	line-height: 1.6;
	color: var(--twv-text);
	background-color: var(--twv-bg);
	border-radius: 0.3rem;
}

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

.twv-header {
	text-align: center;
	padding: 2.5rem 1.5rem 1rem;
}

.twv-title {
	font-family: var(--twv-font-display);
	font-weight: 500;
	font-size: var(--size-lg);
	letter-spacing: -0.05ch;
	color: var(--twv-aubergine);
	margin: 0 0 0.5rem;
}

.twv-legend {
	display: flex;
	gap: 1.5rem;
	justify-content: center;
	flex-wrap: wrap;
	font-size: var(--size-xs);
}

.twv-legend span {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.twv-swatch {
	width: 10px;
	height: 10px;
	display: inline-block;
}

.twv-swatch--transcript {
	background: var(--twv-text);
	border-radius: 50%;
}
.twv-swatch--public {
	background: var(--twv-coral);
	border-radius: 2px;
}
.twv-swatch--private {
	background: var(--twv-private-accent);
	border-radius: 2px;
}

/* ---------- Controls ---------- */

.twv-controls {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6rem 1.2rem;
	padding: 0.7rem 1.5rem;
	border-top: 1px solid var(--twv-border);
	border-bottom: 1px solid var(--twv-border);
	border-radius: 1rem;
	background: var(--twv-surface);
	position: sticky;
	top: 0;
	z-index: 10;
}

.twv-controls label {
	/* font-size: 0.85rem; */
	font-size: var(--size-xs);
	color: var(--twv-text-muted);
	display: flex;
	align-items: center;
	gap: 0.35rem;
	cursor: pointer;
	user-select: none;
}

.twv-controls input[type="checkbox"] {
	accent-color: var(--twv-coral);
}

.twv-search-input {
	border: 1px solid rgba(255, 141, 119, 0.3);
	border-radius: 5rem;
	padding: 0.25rem 0.8rem;
	font-size: var(--size-xs);
	font-family: var(--twv-font-body);
	width: 14rem;
	max-width: 50vw;
	background: transparent;
	color: var(--twv-honey);
	transition: border-color 0.2s ease;
}

.twv-search-input::placeholder {
	color: var(--twv-text-muted);
}

.twv-search-input:focus {
	outline: none;
	border-color: var(--twv-coral);
}

/* ---------- Timeline ---------- */

.twv-viewer {
	max-width: 56rem;
	margin: 0 auto;
	padding: 2rem 1.5rem;
}

.twv-timeline {
	position: relative;
	padding-left: 5.5rem;
}

.twv-timeline::before {
	content: "";
	position: absolute;
	left: 4rem;
	top: 0;
	bottom: 0;
	width: 1px;
	background: var(--twv-border);
}

/* ---------- Entry (shared) ---------- */

.twv-entry {
	position: relative;
	margin-bottom: 1.4rem;
}

.twv-timestamp {
	position: absolute;
	left: -5.5rem;
	top: 0.15rem;
	width: 4.8rem;
	text-align: right;
	font-size: var(--size-xs);
	font-family: var(--twv-font-mono);
	font-variant-numeric: tabular-nums;
	color: var(--twv-timestamp);
	font-weight: 500;
	letter-spacing: 0.02em;
}

.twv-dot {
	position: absolute;
	top: 0.45rem;
	width: 8px;
	height: 8px;
	border: 2px solid var(--twv-dot-border);
}

/* ---------- Transcript entries ---------- */

.twv-entry--transcript .twv-dot {
	left: -1.55rem;
	border-radius: 50%;
	background: var(--twv-coral);
	display: none;
}

.twv-entry--transcript .twv-speaker {
	font-family: var(--twv-font-display);
	font-weight: 500;
	color: var(--twv-plum);
	margin-bottom: 0.15rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	font-size: var(--size-xs);
}

.twv-entry--transcript .twv-text {
	font-size: var(--size-sm);
	line-height: 1.7;
	color: var(--twv-text);
}

.twv-entry--transcript .twv-text p {
	margin: 0 0 0.6em;
}

.twv-entry--transcript .twv-text p:last-child {
	margin-bottom: 0;
}

.twv-entry--transcript .twv-text ol {
	margin: 0.4em 0 0.6em;
	padding-left: 1.5em;
}

.twv-entry--transcript .twv-text ol:last-child {
	margin-bottom: 0;
}

/* ---------- Heading entries ---------- */

.twv-entry--heading {
	margin-top: 2.5rem;
	margin-bottom: 1.2rem;
	padding-left: 0;
}

.twv-heading {
	font-family: var(--twv-font-display);
	font-weight: 500;
	color: var(--twv-plum);
	margin: 0;
	letter-spacing: -0.03ch;
}

h2.twv-heading { font-size: var(--size-md, 1.4rem); }
h3.twv-heading { font-size: var(--size-sm, 1.15rem); }

/* ---------- Inline markdown ---------- */

.twv-entry--transcript .twv-text em {
	font-style: italic;
}

.twv-entry--transcript .twv-text strong {
	font-weight: 600;
}

/* ---------- Chat entries ---------- */

.twv-entry--chat {
	padding-left: 0.8rem;
	border-left: 3px solid var(--twv-coral);
	margin-left: 0.5rem;
}

.twv-entry--chat .twv-dot {
	left: -2.05rem;
	border-radius: 2px;
	background: var(--twv-coral);
	display: none;
}

.twv-entry--chat .twv-speaker {
	font-weight: 600;
	color: var(--twv-coral);
	margin-bottom: 0.1rem;
	font-size: var(--size-xs);
}

.twv-entry--chat .twv-recipient {
	font-size: 0.72rem;
	color: var(--twv-text-muted);
	font-style: italic;
}

.twv-entry--chat .twv-text {
	font-size: var(--size-xs);
	line-height: 1.5;
	color: var(--twv-aubergine);
	background: var(--twv-chat-bg);
	padding: 0.45rem 0.7rem;
	border-radius: 0.3rem;
	display: inline-block;
	max-width: 38rem;
	margin-top: 0.2rem;
	word-break: break-word;
}

/* ---------- Private chat ---------- */

.twv-entry--private {
	border-left: 2px solid var(--twv-private-bg);
}
.twv-entry--private .twv-text {
	background: var(--twv-private-bg);
}

.twv-entry--private .twv-speaker {
	color: var(--twv-private-accent);
}

.twv-entry--private .twv-dot {
	background: var(--twv-private-accent);
	display: none;
}

.twv-entry--private .twv-text {
	color: var(--twv-off-white);
}

/* ---------- Bot messages ---------- */

.twv-entry--bot {
	opacity: 0.3;
}

.twv-entry--bot .twv-text {
	background: rgba(255, 254, 240, 0.04);
}

/* ---------- Search ---------- */

.twv-highlight {
	background: var(--twv-honey);
	color: var(--twv-aubergine);
	border-radius: 2px;
	padding: 0 2px;
}

.twv-entry--dimmed {
	opacity: 0.08;
}

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

@media (max-width: 640px) {
	.twv-timeline {
		padding-left: 3.8rem;
	}
	.twv-timeline::before {
		left: 2.5rem;
	}
	.twv-timestamp {
		left: -3.8rem;
		width: 3rem;
		font-size: 0.68rem;
	}
	.twv-title {
		font-size: 1.4rem;
	}
	.twv-search-input {
		width: 10rem;
	}
}

/* ==========================================================================
   Editor-only styles
   ========================================================================== */

.twv-editor-panel {
	border: 1px solid rgba(255, 141, 119, 0.2);
	border-radius: 0.3rem;
	background: var(--twv-plum, #4b2e60);
	color: var(--twv-off-white, #fffef0);
	overflow: hidden;
}

.twv-editor-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.7rem 1rem;
	background: var(--twv-aubergine, #33233a);
	border-bottom: 1px solid rgba(255, 254, 240, 0.1);
	font-size: 0.9rem;
	color: var(--twv-coral, #ff8d77);
}

.twv-editor-icon {
	color: var(--twv-coral, #ff8d77);
}

.twv-editor-title-badge {
	font-size: 0.8rem;
	color: var(--twv-honey, #ffeb73);
	font-style: italic;
}

.twv-editor-counts {
	font-size: 0.78rem;
	color: rgba(255, 254, 240, 0.45);
	margin-left: 0.5rem;
}

/* Override WP component styles within our block */
.twv-editor-panel .components-base-control {
	padding: 0 1rem;
}

.twv-editor-panel .components-base-control__label {
	color: var(--twv-coral, #ff8d77);
}

.twv-editor-panel .components-textarea-control textarea {
	font-family: var(--twv-font-mono, "Relative Mono", ui-monospace, monospace);
	font-size: 0.82rem;
	line-height: 1.5;
	background: var(--twv-aubergine, #33233a);
	color: var(--twv-off-white, #fffef0);
	border-color: rgba(255, 141, 119, 0.2);
}

.twv-editor-panel .components-text-control__input {
	background: var(--twv-aubergine, #33233a);
	color: var(--twv-off-white, #fffef0);
	border-color: rgba(255, 141, 119, 0.2);
}

.twv-editor-empty {
	padding: 2rem;
	text-align: center;
	color: var(--twv-text-muted, rgba(255, 254, 240, 0.55));
	font-style: italic;
}

.twv-editor-more {
	text-align: center;
	padding: 1rem;
	color: var(--twv-text-muted, rgba(255, 254, 240, 0.55));
	font-size: 0.85rem;
	font-style: italic;
	border-top: 1px dashed rgba(255, 254, 240, 0.12);
}

/* Preview within editor */
.twv-editor-panel .twv-preview {
	padding: 1.5rem;
	max-height: 500px;
	overflow-y: auto;
}

.twv-editor-panel .twv-preview .twv-timeline {
	padding-left: 4.5rem;
}

.twv-editor-panel .twv-preview .twv-timeline::before {
	left: 3.2rem;
}
