/**
 * Emoji rendering + picker styles.
 *
 * .cw-emoji is applied to every emoji in forum content so it always gets a
 * font that can actually draw it, instead of a tofu box.
 */
.cw-emoji {
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "Twemoji Mozilla", "EmojiOne Color", "Android Emoji", sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 1.15em;
	line-height: 1;
	vertical-align: -0.12em;
}

/*
 * Imported IPB emoticons. The selectors are deliberately more specific than
 * the image-upload rule that makes content images block level, so a smiley
 * stays on the line it was typed on.
 */
.cw-emoticon,
.bbp-topic-content img.cw-emoticon,
.bbp-reply-content img.cw-emoticon {
	display: inline-block;
	width: auto;
	max-width: none;
	height: 1.35em;
	margin: 0 0.1em;
	vertical-align: -0.28em;
}

/* Attachments recovered from the old forum. */
.cw-bbp-attachments {
	margin-top: 1em;
	padding-top: 0.6em;
	border-top: 1px solid rgba( 0, 0, 0, 0.1 );
}

.cw-bbp-attachment {
	margin: 0.6em 0;
}

.bbp-topic-content img.cw-bbp-attachment-img,
.bbp-reply-content img.cw-bbp-attachment-img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* ------------------------------------------------------------------ picker */

/*
 * Themes style every <button> on the page -- background, min-width, uppercase,
 * shadows -- which turns the picker into a grid of large coloured blocks. Strip
 * all of it first, then apply our own. Everything below is scoped under
 * .cw-emoji-panel so it outranks this reset.
 */
.cw-emoji-bar .cw-emoji-toggle,
.cw-emoji-panel button,
.cw-emoji-panel input {
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	position: static;
	float: none;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	transition: none;
	cursor: pointer;
}

.cw-emoji-bar {
	margin: 4px 0 10px;
}

.cw-emoji-bar .cw-emoji-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	border-radius: 4px;
	background: rgba( 0, 0, 0, 0.04 );
	font-size: 13px;
	line-height: 1.4;
}

.cw-emoji-bar .cw-emoji-toggle:hover,
.cw-emoji-bar .cw-emoji-toggle[aria-expanded="true"] {
	background: rgba( 0, 0, 0, 0.09 );
}

.cw-emoji-bar .cw-emoji-toggle-icon {
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	font-size: 15px;
	line-height: 1;
}

.cw-emoji-panel {
	position: absolute;
	z-index: 100000;
	box-sizing: border-box;
	width: 316px;
	max-width: calc( 100vw - 16px );
	padding: 8px;
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.18 );
	color: #23282d;
	font-size: 13px;
	text-align: left;
}

.cw-emoji-panel[hidden] {
	display: none;
}

.cw-emoji-panel * {
	box-sizing: border-box;
}

.cw-emoji-panel .cw-emoji-search {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 0 6px;
	padding: 6px 8px;
	border: 1px solid rgba( 0, 0, 0, 0.2 );
	border-radius: 4px;
	background: #fff;
	color: inherit;
	font-size: 13px;
	line-height: 1.4;
}

.cw-emoji-panel .cw-emoji-tabs {
	display: flex;
	gap: 2px;
	margin-bottom: 6px;
	padding-bottom: 5px;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.12 );
}

.cw-emoji-panel .cw-emoji-tab {
	flex: 1 1 0;
	padding: 3px 0;
	border-bottom: 2px solid transparent;
	border-radius: 3px 3px 0 0;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	font-size: 15px;
	line-height: 1.3;
	text-align: center;
	opacity: 0.55;
}

.cw-emoji-panel .cw-emoji-tab:hover {
	opacity: 1;
}

.cw-emoji-panel .cw-emoji-tab.is-active {
	border-bottom-color: currentColor;
	opacity: 1;
}

.cw-emoji-panel .cw-emoji-grid {
	display: grid;
	grid-template-columns: repeat( 8, 1fr );
	gap: 1px;
	height: 216px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.cw-emoji-panel .cw-emoji-item {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 34px;
	border-radius: 4px;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	font-size: 20px;
	line-height: 1;
	text-align: center;
}

.cw-emoji-panel .cw-emoji-item:hover,
.cw-emoji-panel .cw-emoji-item:focus {
	background: rgba( 0, 0, 0, 0.09 );
	outline: none;
}

.cw-emoji-panel .cw-emoji-img {
	display: block;
	width: auto;
	max-width: 24px;
	max-height: 24px;
	margin: 0 auto;
}

.cw-emoji-panel .cw-emoji-empty {
	grid-column: 1 / -1;
	margin: 12px 0;
	font-size: 13px;
	text-align: center;
	opacity: 0.6;
}

.cw-emoji-panel .cw-emoji-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 24px;
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px solid rgba( 0, 0, 0, 0.12 );
	font-size: 12px;
}

.cw-emoji-panel .cw-emoji-preview-char {
	flex: 0 0 auto;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
	font-size: 18px;
	line-height: 1;
}

.cw-emoji-panel .cw-emoji-preview-name {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: 0.7;
}

@media ( prefers-color-scheme: dark ) {
	.cw-emoji-panel {
		border-color: rgba( 255, 255, 255, 0.2 );
		background: #23282d;
		color: #f0f0f1;
	}

	.cw-emoji-panel .cw-emoji-search {
		border-color: rgba( 255, 255, 255, 0.25 );
		background: #1d2327;
	}

	.cw-emoji-panel .cw-emoji-tabs,
	.cw-emoji-panel .cw-emoji-preview {
		border-color: rgba( 255, 255, 255, 0.18 );
	}

	.cw-emoji-panel .cw-emoji-item:hover,
	.cw-emoji-panel .cw-emoji-item:focus {
		background: rgba( 255, 255, 255, 0.14 );
	}
}
