/*!
 * Skull Composer 1.1.0 for SMF 2.1
 * (c) 2026 BoredSkull - https://boredskull.net - ISC License
 *
 * Colours are derived from the theme: borders and fills use translucent grey so
 * they sit on light and dark themes alike; popups take the background of the
 * nearest themed ancestor (set by the script as --skc-bg / --skc-fg).
 */

/* The composer frame takes the theme's own textarea border, radius,
   background, font and text colour (read at load time into --skc-* variables).
   The toolbar carries SCEditor's class names, so a theme's editor styling
   (jquery.sceditor.theme.css or its own rules) colours it. */
.skc {
	--skc-line: var(--skc-border-color, rgba(127, 127, 127, 0.4));
	--skc-soft: rgba(127, 127, 127, 0.12);
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	box-sizing: border-box;
	border: var(--skc-border-width, 1px) solid var(--skc-line);
	border-radius: var(--skc-radius, 4px);
	background: var(--skc-field-bg, transparent);
	color: var(--skc-field-fg, inherit);
	margin: 0 0 6px;
	text-align: left;
}
.skc *, .skc *::before, .skc *::after { box-sizing: border-box; }
.skc.is-drop { outline: 2px dashed var(--skc-accent, currentColor); outline-offset: -4px; }

/* Buttons inside the composer: undo theme-wide button styling (gradients,
   bevels, uppercase) so the editor controls look the same on every theme.
   Buttons with class "button" (Restore, Insert, Cancel...) keep the theme look. */
.skc button:not(.button),
.skc-dockbar button,
.skc-selquote {
	-webkit-appearance: none;
	appearance: none;
	background-image: none;
	box-shadow: none;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	min-height: 0;
	margin: 0;
	font-family: inherit;
}
.skc svg, .skc-dockbar svg, .skc-selquote svg, .skc-mq-toggle svg {
	fill: none !important;
	stroke: currentColor;
}
.skc svg .skc-fill { fill: currentColor !important; stroke: none; }

/* Toolbar: one tidy row; buttons that don't fit go into the "More" menu */
.skc-toolbar {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 2px;
	padding: 6px 8px;
	overflow: hidden;
	line-height: 1;
	background: transparent;
	border-bottom: 1px solid var(--skc-line);
	border-radius: var(--skc-radius, 4px) var(--skc-radius, 4px) 0 0;
}
.skc-group { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.skc-group.is-empty { display: none; }
.skc-group:not(.skc-group--end) + .skc-group:not(.skc-group--end)::before {
	content: "";
	flex: 0 0 1px;
	width: 1px;
	height: 20px;
	margin: 0 6px;
	background: var(--skc-line);
}
.skc-group--end { margin-left: auto; padding-left: 8px; gap: 4px; }
.skc .skc-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: auto;
	min-width: 32px;
	height: 32px;
	padding: 0 7px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font-size: 14px;
	line-height: 1;
	opacity: 0.72;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s, opacity 0.15s, transform 0.08s;
}
.skc .skc-btn.is-overflow, .skc .skc-btn[hidden] { display: none; }
.skc .skc-btn:hover {
	opacity: 1;
	color: var(--skc-accent, inherit);
	background: rgba(127, 127, 127, 0.14);
	background: color-mix(in srgb, var(--skc-accent, currentColor) 13%, transparent);
}
.skc .skc-btn:active { transform: scale(0.93); }
.skc .skc-btn:focus-visible { opacity: 1; outline: 2px solid var(--skc-accent, currentColor); outline-offset: 1px; }
.skc .skc-btn.is-on {
	opacity: 1;
	color: var(--skc-accent, inherit);
	background: rgba(127, 127, 127, 0.14);
	background: color-mix(in srgb, var(--skc-accent, currentColor) 16%, transparent);
}
.skc-btn img { display: block; max-width: 18px; max-height: 18px; }
.skc-btn svg { display: block; width: 18px; height: 18px; }
.skc-glyph { font-size: 16px; line-height: 1; }
.skc-glyph sup, .skc-glyph sub { font-size: 10px; line-height: 0; }
.skc-btn-text { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }
.skc .skc-chip {
	flex: 0 0 auto;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: var(--skc-accent, inherit);
	font-size: 12px;
	padding: 5px 11px;
	cursor: pointer;
	white-space: nowrap;
}
.skc .skc-chip:hover { background: color-mix(in srgb, var(--skc-accent, currentColor) 12%, transparent); }
.skc-chip[hidden] { display: none !important; }
.skc-more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; min-width: 300px; }
.skc .skc-more-item, .skc-pop .skc-more-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
}
.skc-more-item:hover { background: rgba(127, 127, 127, 0.12); color: var(--skc-accent, inherit); }
.skc-more-item svg, .skc-more-item img { width: 18px; height: 18px; flex: 0 0 18px; }
.skc-more-icon { display: inline-flex; width: 18px; justify-content: center; }

/* Write / Preview tabs */
.skc-tabs { display: none; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--skc-line); }
.skc[data-preview="tab"] > .skc-tabs { display: flex; }
.skc[data-pvbtn="buttons"] > .skc-tabs,
.skc[data-pvbtn="buttons"] .skc-btn--preview { display: none; }
.skc .skc-tab {
	position: relative;
	height: auto;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font-size: 13px;
	font-weight: 500;
	padding: 9px 12px 8px;
	cursor: pointer;
	opacity: 0.6;
}
.skc .skc-tab::after {
	content: "";
	position: absolute;
	left: 8px;
	right: 8px;
	bottom: -1px;
	height: 2px;
	border-radius: 2px;
	background: transparent;
}
.skc .skc-tab:hover { opacity: 1; background: transparent; }
.skc .skc-tab.is-active { opacity: 1; font-weight: 600; color: var(--skc-accent, inherit); }
.skc .skc-tab.is-active::after { background: var(--skc-accent, currentColor); }
.skc-tabs--small { display: flex; gap: 4px; border-bottom: 1px solid var(--skc-line); padding: 0 0 2px; margin-bottom: 6px; }

/* Write + preview: the textarea keeps the theme's font */
.skc-body { display: flex; min-height: 0; border-top: 1px solid var(--skc-line); }
.skc[data-preview="tab"] > .skc-body { border-top: 0; }
.skc-write { flex: 1 1 50%; min-width: 0; display: flex; }
.skc textarea.skc-input {
	display: block;
	width: 100% !important;
	max-width: none;
	min-height: 120px;
	margin: 0;
	padding: 14px 18px;
	border: 0 !important;
	border-radius: 0;
	background: transparent !important;
	color: inherit;
	font-family: var(--skc-font, inherit);
	font-size: var(--skc-font-size, inherit);
	line-height: 1.6;
	resize: none;
	box-shadow: none !important;
	outline: none;
}
.skc textarea.skc-input::placeholder { opacity: 0.55; }
.skc-preview {
	flex: 1 1 50%;
	min-width: 0;
	display: none;
	position: relative;
	border-left: 1px solid var(--skc-line);
	padding: 14px 18px;
	overflow: auto;
	max-height: 70vh;
}
.skc-preview .post { padding: 0; margin: 0; width: auto; float: none; border: 0; background: none; box-shadow: none; }
.skc-preview .post > .inner { border: 0 !important; margin: 0 !important; padding: 0 !important; min-height: 0; overflow: visible; }
.skc-preview-inner { min-height: 2em; overflow-wrap: anywhere; }
.skc-preview-label {
	float: right;
	margin: -4px -6px 0 8px;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.45;
}
.skc-preview.is-loading .skc-preview-inner { opacity: 0.55; transition: opacity 0.2s 0.15s; }

.skc[data-preview="side"] .skc-preview { display: block; }
.skc[data-preview="tab"] .skc-preview { border-left: 0; flex-basis: 100%; min-height: 200px; }
.skc[data-preview="tab"][data-tab="preview"] .skc-preview { display: block; }
.skc[data-preview="tab"][data-tab="preview"] .skc-write { display: none; }
.skc[data-preview="tab"]:not([data-pvbtn="buttons"]) .skc-preview-label { display: none; }

/* Status bar */
.skc-status {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 14px;
	border-top: 1px solid var(--skc-line);
	font-size: 11px;
	min-height: 28px;
}
.skc-status-msg { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skc-status-msg.is-alert { opacity: 1; color: #c0392b; font-weight: 600; white-space: normal; }
.skc-spacer { flex: 1; }
.skc-count { opacity: 0.55; font-variant-numeric: tabular-nums; }
.skc-count.is-over { opacity: 1; color: #c0392b; font-weight: 700; }
.skc-linkbtn {
	border: 0;
	background: none;
	padding: 0;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
	opacity: 0.7;
}
.skc-linkbtn:hover { opacity: 1; }
.skc-try { margin: 4px 0; font-size: 11px; text-align: right; }
.skc-muted { opacity: 0.6; }

/* Banners */
.skc-banners:empty { display: none; }
.skc-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
	padding: 6px 10px;
	font-size: 0.9em;
	background: rgba(234, 179, 8, 0.16);
	border-bottom: 1px solid var(--skc-line);
}
.skc-banner--info { background: rgba(59, 130, 196, 0.14); }
.skc-banner-text { flex: 1 1 auto; }
.skc-banner .button { margin: 0; }

/* Popups use the editor's background */
.skc-pop {
	position: absolute;
	z-index: 1000;
	min-width: 180px;
	max-width: min(380px, 100%);
	max-height: 320px;
	overflow: auto;
	padding: 4px;
	border: 1px solid var(--skc-line);
	border-radius: var(--skc-radius, 6px);
	background: var(--skc-field-bg, var(--skc-bg, #fff));
	color: var(--skc-field-fg, var(--skc-fg, inherit));
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
	font-size: 13px;
}
.skc-pop[hidden] { display: none; }
.skc-menu-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.skc-menu-item.is-active { background: var(--skc-soft); }
.skc-menu-label { font-weight: 600; }
.skc-menu--list .skc-menu-label { font-weight: normal; }
.skc-menu-desc { opacity: 0.6; overflow: hidden; text-overflow: ellipsis; }
.skc-menu-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.skc-form { display: flex; flex-direction: column; gap: 8px; padding: 6px; min-width: 260px; }
.skc-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.skc-field input { width: 100%; }
.skc-form-actions { display: flex; gap: 6px; justify-content: flex-end; }
.skc-form-actions .button { margin: 0; }
.skc-colors { display: grid; grid-template-columns: repeat(5, 26px); gap: 5px; padding: 4px; }
.skc-swatch { width: 26px; height: 26px; border: 1px solid var(--skc-line); border-radius: 50%; cursor: pointer; padding: 0; }
.skc-swatch:hover { transform: scale(1.12); }
.skc-emoji { width: 300px; max-width: 100%; }
.skc-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.skc-emoji-grid[hidden] { display: none; }
.skc-emoji-btn { display: flex; align-items: center; justify-content: center; height: 32px; border: 0; border-radius: 4px; background: transparent; font-size: 19px; cursor: pointer; padding: 0; }
.skc-emoji-btn:hover { background: var(--skc-soft); }
.skc-emoji-btn img { max-width: 24px; max-height: 24px; }
.skc-replies { width: 340px; max-width: 100%; }
.skc-reply { padding: 6px 8px; border-bottom: 1px solid var(--skc-line); }
.skc-reply:last-child { border-bottom: 0; }
.skc-reply-head { font-size: 12px; margin-bottom: 2px; }
.skc-reply-body { font-size: 12px; opacity: 0.85; }
.skc-reply-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 4px; font-size: 12px; }
.skc-reply-actions .button { margin: 0; }

.skc--narrow .skc-btn { min-width: 36px; height: 36px; }
.skc--lite { margin-bottom: 4px; }
.skc--lite textarea.skc-input { min-height: 100px; }

/* ------------------------------------------------------------------
   Modern posting form (Admin > Skull Composer > Features).
   Layout and spacing only: colours, fonts and buttons stay the theme's.
   ------------------------------------------------------------------ */
.skc-modern #post_header {
	display: grid;
	grid-template-columns: minmax(110px, max-content) 1fr;
	gap: 10px 16px;
	align-items: center;
	margin: 4px 0 14px;
	padding: 0;
	overflow: visible;
}
.skc-modern #post_header::before, .skc-modern #post_header::after { content: none; }
.skc-modern #post_header dt,
.skc-modern #post_header dd { float: none; width: auto; margin: 0; padding: 0; clear: none; }
.skc-modern #post_header dt { font-weight: 600; }
.skc-modern #post_header dd input[type="text"],
.skc-modern #post_header dd input[type="email"] { width: 100%; max-width: none; box-sizing: border-box; padding: 7px 10px; font-size: 1.05em; }
.skc-modern #post_header select { padding: 4px 6px; }
.skc-modern #post_header dd img { vertical-align: middle; margin-left: 6px; }
.skc-modern .skc { margin-bottom: 14px; }
.skc-modern .skc textarea.skc-input { min-height: 240px; }

/* Attachments */
.skc-modern #post_attachments_area { margin: 0 0 14px; padding: 0; border: 0; background: none; box-shadow: none; }
.skc-modern #drop_zone_ui {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 64px;
	padding: 14px;
	border-radius: var(--skc-radius, 6px);
	cursor: pointer;
	opacity: 0.85;
}
.skc-modern #drop_zone_ui:hover { opacity: 1; }
.skc-modern #attachment_previews { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.skc-modern #attachment_previews .attachment_preview_wrapper { margin: 0; float: none; }
.skc-modern #max_files_progress { margin-top: 8px; border-radius: 4px; overflow: hidden; }

/* Other options */
.skc-modern #post_additional_options_header,
.skc-modern #post_draft_options_header { margin: 4px 0 6px; padding: 0; background: none; border: 0; box-shadow: none; }
.skc-modern #post_additional_options_header a,
.skc-modern #post_draft_options_header a { font-weight: 600; }
.skc-modern #post_additional_options ul.post_options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 6px 18px;
	margin: 6px 0 14px;
	padding: 0;
	list-style: none;
}
.skc-modern #post_additional_options ul.post_options li { float: none; width: auto; margin: 0; padding: 0; }
.skc-modern #post_settings { margin: 0 0 8px; }

/* Buttons: shortcuts left, actions right */
.skc-modern #post_confirm_buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--skc-line, rgba(127, 127, 127, 0.3));
	float: none;
	width: 100%;
}
.skc-modern #post_confirm_buttons .smalltext { opacity: 0.6; margin: 0; }
.skc-modern .post_button_container { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 0 auto; float: none; }
.skc-modern .post_button_container .button { margin: 0; padding: 0 16px; min-height: 32px; }
.skc-modern .post_button_container [name="post"] { font-weight: 700; padding: 0 22px; }

@media (max-width: 720px) {
	.skc-modern #post_header { grid-template-columns: 1fr; gap: 4px; }
	.skc-modern #post_header dd { margin-bottom: 8px; }
	.skc-modern #post_confirm_buttons { flex-direction: column-reverse; align-items: stretch; }
	.skc-modern .post_button_container { margin: 0; }
	.skc-modern .post_button_container .button { flex: 1; }
}

/* Docked reply on topic pages */
.skc-docked {
	position: fixed !important;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	width: min(1100px, calc(100vw - 16px));
	height: var(--skc-dock-h, 50vh);
	max-height: calc(100vh - 40px);
	margin: 0 !important;
	z-index: 900;
	overflow: auto;
	background: var(--skc-bg, #fff);
	color: var(--skc-fg, inherit);
	border: 1px solid rgba(127, 127, 127, 0.35);
	border-bottom: 0;
	border-radius: 12px 12px 0 0;
	box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.22);
	padding: 0 10px 8px;
}
.skc-docked > .cat_bar, .skc-docked > h3.catbg { display: none; }
.skc-docked .roundframe { margin: 0; border: 0; padding: 4px 0 0; background: none; box-shadow: none; }
.skc-docked.skc-collapsed { height: auto; overflow: hidden; padding-bottom: 0; }
.skc-docked.skc-collapsed > :not(.skc-dockbar) { display: none !important; }
.skc-dockbar {
	position: sticky;
	top: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 -10px 4px;
	padding: 6px 10px 4px;
	background: var(--skc-bg, #fff);
	border-bottom: 1px solid rgba(127, 127, 127, 0.25);
	border-radius: 12px 12px 0 0;
}
.skc-collapsed .skc-dockbar { margin-bottom: 0; border-bottom: 0; }
.skc-dock-grip {
	position: absolute;
	top: 0;
	left: 50%;
	width: 48px;
	height: 10px;
	margin-left: -24px;
	cursor: ns-resize;
	touch-action: none;
}
.skc-dock-grip::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 8px;
	right: 8px;
	height: 4px;
	border-radius: 2px;
	background: rgba(127, 127, 127, 0.45);
}
.skc-collapsed .skc-dock-grip { display: none; }
.skc-dock-title {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	padding: 6px 2px;
	cursor: pointer;
}
.skc-dock-icon { display: inline-flex; opacity: 0.8; }
.skc-dock-snippet { font-weight: normal; opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skc-dock-toggle {
	border: 0;
	background: none;
	color: inherit;
	padding: 6px;
	border-radius: 6px;
	cursor: pointer;
	transition: transform 0.2s;
}
.skc-dock-toggle:hover { background: rgba(127, 127, 127, 0.12); }
.skc-docked:not(.skc-collapsed) .skc-dock-toggle { transform: rotate(180deg); }
.skc-dock-anchor { margin: 10px 0; font-size: 12px; text-align: center; opacity: 0.8; }
.skc-docked .skc-preview { max-height: none; }

/* Select-to-quote button */
.skc-selquote {
	position: fixed;
	z-index: 1001;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 0;
	border-radius: 999px;
	background: #222;
	color: #fff;
	font: inherit;
	font-size: 13px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
	cursor: pointer;
}
.skc-selquote[hidden] { display: none; }
.skc-selquote svg { width: 15px; height: 15px; }

/* Multi-quote toggle in the post quick buttons */
.skc-mq-toggle { display: inline-flex; align-items: center; gap: 4px; }
.skc-mq-icon { display: inline-flex; }
.skc-mq-icon svg { width: 14px; height: 14px; }
.skc-mq-toggle.is-on { font-weight: 600; color: var(--skc-accent, #3b82c4); }

/* Edit history page */
.skc-rev { margin: 6px 0; padding: 10px 14px; }
.skc-rev--current { border-left: 3px solid #3b82c4; }
.skc-rev-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.skc-rev-actions { margin-left: auto; }
.skc-rev-actions .button { margin: 0; }
.skc-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(127, 127, 127, 0.15); }
.skc-rev details { margin: 4px 0; }
.skc-rev summary { cursor: pointer; font-size: 12px; opacity: 0.8; padding: 2px 0; }
.skc-diff {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	line-height: 1.5;
	padding: 8px 10px;
	border-radius: 6px;
	background: rgba(127, 127, 127, 0.07);
	max-height: 480px;
	overflow: auto;
}
.skc-diff--subject { margin-bottom: 4px; font-weight: 600; }
.skc-diff ins { background: rgba(46, 160, 67, 0.25); text-decoration: none; border-radius: 2px; }
.skc-diff del { background: rgba(218, 54, 51, 0.22); text-decoration: line-through; border-radius: 2px; }
.skc-rendered { padding: 8px 10px; }

/* Admin */
.skc-boardlist { max-height: 340px; overflow: auto; padding: 4px; border: 1px solid rgba(127, 127, 127, 0.3); border-radius: 6px; }
.skc-boardlist fieldset { margin: 0 0 8px; padding: 4px 8px; border: 0; }
.skc-boardlist legend { font-weight: 600; padding: 0; }
.skc-boardlist label { display: inline-block; padding: 1px 0; }
.skc-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }

@media (max-width: 720px) {
	.skc-docked { width: 100vw; border-radius: 10px 10px 0 0; padding: 0 6px 6px; }
	.skc-dockbar { margin: 0 -6px 4px; }
	.skc-pop { max-width: calc(100vw - 24px); }
	.skc textarea.skc-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.skc-dock-toggle, .skc-swatch, .skc-preview.is-loading .skc-preview-inner { transition: none; }
}
