/* 3task Toolbar: settings page. Colors follow the admin color scheme of the user (--wp-admin-theme-color from
   wp-base-styles); text and lines in that color are darkened where needed so they stay readable on white. */
.threece-settings {
	--threece-a: var(--wp-admin-theme-color, #3858e9);
	--threece-a-ink: var(--threece-a);
	--threece-line: #dcdcde;
	--threece-mute: #50575e;
	max-width: 1240px;
}

@supports (color: oklch(from red l c h)) {
	.threece-settings {
		--threece-a-ink: oklch(from var(--threece-a) min(l, 0.54) c h);
	}
}

.threece-settings .threece-icon {
	flex: none;
	height: 1.25em;
	vertical-align: -0.25em;
	width: 1.25em;
}

/* Links of the page itself; the element buttons in the preview and WordPress buttons keep their own colors. */
.threece-settings a:not(.threece-button):not(.button) {
	color: var(--threece-a-ink);
}

.threece-settings a:not(.threece-button):not(.button):focus {
	box-shadow: none;
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 2px;
}

/* Head */
.threece-head {
	background: #fff;
	border: 1px solid var(--threece-line);
	border-radius: 8px;
	margin: 0 0 16px;
}

.threece-head__row {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	padding: 14px 20px 8px;
}

.threece-logo {
	background: var(--threece-a-ink);
	border-radius: 8px;
	color: #fff;
	display: grid;
	height: 36px;
	place-items: center;
	width: 36px;
}

.threece-logo .threece-icon {
	height: 22px;
	width: 22px;
}

.threece-settings .threece-head h1 {
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	padding: 0;
}

.threece-version {
	border: 1px solid var(--threece-line);
	border-radius: 10px;
	color: var(--threece-mute);
	font-size: 11px;
	padding: 1px 7px;
}

.threece-head__links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin-inline-start: auto;
}

.threece-head__links a {
	align-items: center;
	display: inline-flex;
	gap: 5px;
	text-decoration: none;
}

.threece-head__links a:hover {
	text-decoration: underline;
}

.threece-nav {
	display: flex;
	flex-wrap: nowrap;
	gap: 2px;
	overflow-x: auto;
	padding: 0 12px;
	scrollbar-width: thin;
}

.threece-settings .threece-nav a {
	align-items: center;
	border-bottom: 3px solid transparent;
	color: #1e1e1e;
	display: flex;
	gap: 7px;
	padding: 10px 12px 11px;
	text-decoration: none;
	white-space: nowrap;
}

.threece-nav a .threece-icon {
	color: var(--threece-mute);
}

.threece-settings .threece-nav a[aria-current="page"] {
	border-bottom-color: var(--threece-a-ink);
	font-weight: 600;
}

.threece-nav a[aria-current="page"] .threece-icon {
	color: var(--threece-a-ink);
}

.threece-settings .threece-nav a:focus {
	outline-offset: -2px;
}

/* Body: tab content and side column */
.threece-body {
	align-items: start;
	display: grid;
	gap: 16px;
	grid-template-columns: minmax(0, 1fr) 300px;
}

.threece-card {
	background: #fff;
	border: 1px solid var(--threece-line);
	border-radius: 8px;
	padding: 16px 18px;
}

/* The palette card waits for JavaScript; the hidden attribute must win over the card's display. */
.threece-card[hidden] {
	display: none;
}

.threece-card + .threece-card {
	margin-top: 16px;
}

.threece-settings .threece-card h2 {
	align-items: center;
	display: flex;
	font-size: 14px;
	font-weight: 600;
	gap: 8px;
	margin: 0 0 4px;
}

.threece-lead {
	color: var(--threece-mute);
	margin: 0 0 12px;
	max-width: 80ch;
}

.threece-muted {
	color: var(--threece-mute);
}

.threece-form .submit {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
	padding-top: 0;
}

.threece-settings .button-primary {
	background: var(--threece-a-ink);
	border-color: var(--threece-a-ink);
	color: #fff;
}

.threece-settings .button-primary:hover,
.threece-settings .button-primary:focus {
	background: color-mix(in srgb, var(--threece-a-ink) 85%, #000);
	border-color: color-mix(in srgb, var(--threece-a-ink) 85%, #000);
	color: #fff;
}

/* Picture cards: real radio buttons inside a label */
.threece-choices,
.threece-styles {
	border: 0;
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
	min-width: 0;
	padding: 0;
}

.threece-styles {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.threece-choice {
	align-content: start;
	background: #fff;
	border: 1px solid var(--threece-line);
	border-radius: 8px;
	cursor: pointer;
	display: grid;
	gap: 6px;
	padding: 12px;
	position: relative;
}

.threece-choice--style {
	gap: 0;
	overflow: hidden;
	padding: 0;
}

.threece-settings .threece-choice__input,
.threece-settings .threece-swatch__input {
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
	position: absolute;
	width: 1px;
}

.threece-choice:has(.threece-choice__input:checked) {
	border-color: var(--threece-a-ink);
	box-shadow: 0 0 0 1px var(--threece-a-ink);
}

.threece-choice:has(.threece-choice__input:focus-visible) {
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 2px;
}

/* Without :has() (Safari before 15.4, Firefox before 121) the radio dot and a focus ring still show the choice. */
.threece-choice__input:focus-visible ~ .threece-choice__name {
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 2px;
}

.threece-choice__name {
	align-items: center;
	display: flex;
	font-weight: 600;
	gap: 8px;
}

.threece-choice__name::before {
	border: 1.5px solid #949494;
	border-radius: 50%;
	box-sizing: border-box;
	content: "";
	flex: none;
	height: 16px;
	width: 16px;
}

.threece-choice__input:checked ~ .threece-choice__name::before {
	border: 5px solid var(--threece-a-ink);
}

.threece-choice__name small {
	color: var(--threece-mute);
	font-weight: 400;
	margin-inline-start: auto;
}

.threece-choice--style .threece-choice__name {
	padding: 9px 12px;
}

.threece-ill {
	background: #f6f7f7;
	border: 1px solid var(--threece-line);
	border-radius: 5px;
	display: block;
	height: 86px;
	overflow: hidden;
}

.threece-ill span {
	display: block;
}

.threece-ill--classic span:first-child {
	background: #fff repeating-linear-gradient(90deg, #c9ccd1 0 12px, transparent 12px 15px) 6px 4px / calc(100% - 12px) 12px no-repeat;
	border-bottom: 1px solid var(--threece-line);
	height: 20px;
}

.threece-ill--classic span + span {
	background: #d5d8de;
	border-radius: 3px;
	height: 5px;
	margin: 9px 10px 0;
}

.threece-ill--block span {
	border: 1px dashed #b7bcc3;
	border-radius: 3px;
	height: 16px;
	margin: 8px 10px 0;
}

.threece-ill--block span:first-child {
	border: 1.5px solid var(--threece-a-ink);
}

.threece-ill span:nth-child(3) {
	width: 60%;
}

.threece-sample {
	border-bottom: 1px solid var(--threece-line);
	display: block;
	font-size: 11px;
	height: 150px;
	overflow: hidden;
	padding: 12px;
	pointer-events: none;
}

/* Accent swatches */
.threece-swatches {
	align-items: center;
	border: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
}

.threece-swatch {
	background: var(--threece-swatch);
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--threece-line);
	box-sizing: border-box;
	cursor: pointer;
	height: 30px;
	width: 30px;
}

.threece-swatch--theme {
	align-items: center;
	background: #fff;
	border: 1px solid var(--threece-line);
	border-radius: 15px;
	box-shadow: none;
	display: inline-flex;
	gap: 6px;
	padding: 0 12px;
	width: auto;
}

.threece-swatch__input:checked + .threece-swatch {
	box-shadow: 0 0 0 2px #1e1e1e;
}

.threece-swatch__input:checked + .threece-swatch--theme {
	border-color: #1e1e1e;
	box-shadow: 0 0 0 1px #1e1e1e;
}

.threece-swatch__input:focus-visible + .threece-swatch {
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 3px;
}

/* Switch: a real checkbox drawn as a switch */
.threece-toggle {
	align-items: flex-start;
	display: flex;
	gap: 12px;
	padding: 6px 0;
}

.threece-settings input.threece-toggle__input {
	-webkit-appearance: none;
	appearance: none;
	background: #949494;
	border: 0;
	border-radius: 10px;
	box-shadow: none;
	cursor: pointer;
	flex: none;
	height: 20px;
	margin: 1px 0 0;
	position: relative;
	width: 36px;
}

.threece-settings input.threece-toggle__input::before,
.threece-settings input.threece-toggle__input:checked::before {
	background: #fff;
	border-radius: 50%;
	content: "";
	float: none;
	height: 16px;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	margin: 0;
	position: absolute;
	transition: inset-inline-start 0.15s;
	width: 16px;
}

.threece-settings input.threece-toggle__input:checked {
	background: var(--threece-a-ink);
}

.threece-settings input.threece-toggle__input:checked::before {
	inset-inline-start: 18px;
}

.threece-settings input.threece-toggle__input:focus {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--threece-a-ink);
	outline: none;
}

.threece-toggle__text label {
	display: block;
	font-weight: 600;
}

.threece-toggle__text .threece-muted {
	display: block;
}

/* Side column */
.threece-glance {
	display: grid;
	gap: 6px;
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
}

.threece-glance li {
	align-items: flex-start;
	display: flex;
	gap: 8px;
	margin: 0;
}

.threece-glance .threece-icon {
	color: #007a3d;
	height: 16px;
	margin-top: 2px;
	width: 16px;
}

.threece-short {
	list-style: disc;
	margin: 8px 0;
	padding-inline-start: 18px;
}

.threece-live {
	font-size: 14px;
	margin-top: 8px;
}

.threece-live > * {
	margin-bottom: 1em;
}

/* Thank-you card on the Editor tab. */
.threece-thanks {
	border-inline-start: 4px solid var(--threece-a-ink);
	margin-bottom: 16px;
	padding-inline-end: 48px;
	position: relative;
}

.threece-thanks h2 {
	font-size: 1.1em;
	margin: 0 0 8px;
}

.threece-thanks p {
	font-size: 14px;
	line-height: 1.55;
	margin: 0 0 8px;
}

.threece-thanks__buttons {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.threece-settings .threece-thanks__close {
	background: none;
	border: 0;
	border-radius: 4px;
	color: var(--threece-mute);
	cursor: pointer;
	font-size: 22px;
	inset-inline-end: 8px;
	line-height: 1;
	padding: 6px 10px;
	position: absolute;
	top: 8px;
}

.threece-settings .threece-thanks__close:focus,
.threece-settings .threece-thanks .button-link:focus {
	box-shadow: none;
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 1px;
}

/* Toolbar tab: preview of the real toolbar. Icons come from the editor's own styles (editor-buttons, TinyMCE skin). */
.threece-tbp {
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	position: relative;
	user-select: none;
}

.threece-tbp__row {
	align-items: center;
	background: #f6f7f7;
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	min-height: 40px;
	padding: 4px 6px;
}

.threece-tbp__row + .threece-tbp__row {
	border-top: 1px solid #e2e4e7;
}

.threece-tbp__label {
	color: var(--threece-mute);
	flex: none;
	font-size: 12px;
	width: 52px;
}

.threece-settings .threece-tbp__btn {
	align-items: center;
	background: none;
	border: 1px solid transparent;
	border-radius: 3px;
	color: #1d2327;
	cursor: grab;
	display: inline-flex;
	height: 32px;
	justify-content: center;
	margin: 0;
	min-width: 32px;
	padding: 0 4px;
}

.threece-settings .threece-tbp__btn:hover,
.threece-settings .threece-tbp__btn[aria-expanded="true"] {
	background: #fff;
	border-color: #c3c4c7;
}

.threece-settings .threece-tbp__btn[aria-expanded="true"] {
	border-color: var(--threece-a-ink);
	box-shadow: 0 0 0 1px var(--threece-a-ink);
}

.threece-settings .threece-tbp__btn:focus {
	box-shadow: none;
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 1px;
}

/* Same glyph and font as in the editor, size and color for this page. */
.threece-tbp__btn .mce-ico,
.threece-tbp-chip .mce-ico {
	color: #3c434a;
	font-size: 20px;
	height: 20px;
	line-height: 1;
	text-align: center;
	width: 20px;
}

.threece-tbp__btn--ours .mce-ico,
.threece-tbp-chip .mce-ico.mce-i-dashicon {
	color: var(--threece-a-ink);
}

.threece-tbp__btn--text {
	font-size: 13px;
	gap: 6px;
	padding: 0 8px;
}

.threece-tbp__btn--text::after {
	border-inline: 4px solid transparent;
	border-top: 4px solid currentColor;
	content: "";
}

.threece-settings .threece-tbp__btn--sep {
	min-width: 24px;
	padding: 0;
	width: 24px;
}

.threece-tbp__btn--sep::before {
	background: #8c8f94;
	content: "";
	height: 20px;
	width: 1px;
}

.threece-tbp__drop {
	align-items: center;
	border: 1px dashed #8c8f94;
	border-radius: 3px;
	color: var(--threece-mute);
	display: flex;
	flex: 1 1 160px;
	font-size: 12px;
	justify-content: center;
	min-height: 30px;
	padding: 2px 8px;
	text-align: center;
}

.threece-tbp__marker {
	align-self: stretch;
	background: var(--threece-a-ink);
	border-radius: 1px;
	flex: none;
	width: 3px;
}

.threece-tbp.is-dragging,
.threece-tbp.is-dragging .threece-tbp__btn {
	cursor: grabbing;
}

.threece-settings .threece-tbp__btn.is-dragging,
.threece-tbp-chip.is-dragging {
	opacity: 0.4;
}

/* Actions of one button: a small dark bar below it, never wider than the preview. */
.threece-tbp__menu {
	background: #1e1e1e;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	max-width: 100%;
	padding: 3px;
	position: absolute;
	/* Own width first, then placed: otherwise the space right of the button decides and the bar wraps. */
	width: max-content;
	z-index: 5;
}

.threece-settings .threece-tbp__action {
	background: none;
	border: 0;
	border-radius: 3px;
	color: #fff;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.4;
	padding: 4px 8px;
	white-space: nowrap;
}

.threece-settings .threece-tbp__action:hover:not(:disabled) {
	background: #3c3c3c;
}

.threece-settings .threece-tbp__action:focus {
	box-shadow: none;
	outline: 2px solid #fff;
	outline-offset: -2px;
}

.threece-settings .threece-tbp__action:disabled {
	color: #8c8f94;
	cursor: default;
}

/* Palette */
.threece-tbp-target {
	align-items: center;
	color: var(--threece-mute);
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 12px;
}

.threece-tbp-target select {
	max-width: 100%;
	min-width: 0;
}

/* As many columns as fit a whole button name next to its state; never letter-wrapped at notebook widths. */
.threece-tbp-groups {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.threece-tbp-group h3 {
	color: var(--threece-mute);
	font-size: 11px;
	letter-spacing: 0.05em;
	margin: 0 0 6px;
	text-transform: uppercase;
}

.threece-settings .threece-tbp-chip {
	align-items: center;
	background: #fff;
	border: 1px solid var(--threece-line);
	border-radius: 4px;
	color: #1d2327;
	cursor: pointer;
	display: flex;
	font-size: 12px;
	gap: 6px;
	margin: 0 0 5px;
	min-height: 32px;
	padding: 3px 8px;
	text-align: start;
	width: 100%;
}

.threece-settings .threece-tbp-chip:hover {
	border-color: #8c8f94;
}

.threece-settings .threece-tbp-chip:focus {
	box-shadow: none;
	outline: 2px solid var(--threece-a-ink);
	outline-offset: 1px;
}

.threece-tbp-chip__ico {
	display: inline-flex;
	flex: none;
	justify-content: center;
	width: 20px;
}

.threece-tbp-chip--sep .threece-tbp-chip__ico::before {
	background: #8c8f94;
	content: "";
	height: 16px;
	width: 1px;
}

.threece-tbp-chip__name {
	min-width: 0;
	overflow-wrap: break-word;
}

.threece-tbp-chip__state {
	color: var(--threece-mute);
	flex: none;
	font-size: 11px;
	margin-inline-start: auto;
}

.threece-settings .threece-tbp-chip.is-added {
	background: #f6f7f7;
	color: #50575e;
}

.threece-tbp-chip.is-added .threece-tbp-chip__state {
	color: #1a6b35;
}

@media (prefers-reduced-motion: reduce) {
	.threece-settings input.threece-toggle__input::before {
		transition: none;
	}
}

@media (max-width: 960px) {
	.threece-body {
		grid-template-columns: minmax(0, 1fr);
	}

	.threece-styles {
		grid-template-columns: minmax(0, 1fr);
	}

}

@media (max-width: 782px) {
	.threece-choices {
		grid-template-columns: minmax(0, 1fr);
	}

	.threece-head__links {
		flex-basis: 100%;
		margin-inline-start: 0;
	}

	.threece-tbp__label {
		flex-basis: 100%;
		width: auto;
	}
}

/* Phones: one column, so button names stay whole next to their state; the tabs wrap instead of scrolling away. */
@media (max-width: 600px) {
	.threece-tbp-groups {
		grid-template-columns: minmax(0, 1fr);
	}

	.threece-nav {
		flex-wrap: wrap;
		overflow-x: visible;
	}
}
