/* GCHS Color Playground — floating toggle + side panel. */

.gchs-cp {
	/* Reset isolation: nothing should leak in from the page. */
	font-family: inherit;
}

/* ── Floating toggle ─────────────────────────────────────── */
.gchs-cp__toggle {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 99998;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--primary-dark, #34577c);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 120ms ease, box-shadow 120ms ease;
}

.gchs-cp__toggle:hover,
.gchs-cp__toggle:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
	outline: none;
}

.gchs-cp__toggle:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-warm, #e07c3a);
	outline-offset: 2px;
}

/* When panel is open, rotate the icon a touch as visual feedback. */
.gchs-cp__toggle[aria-expanded="true"] {
	transform: rotate(15deg);
}

/* ── Side panel ──────────────────────────────────────────── */
.gchs-cp__panel[hidden] {
	display: none;
}

.gchs-cp__panel {
	position: fixed;
	right: 0;
	top: 0;
	bottom: 0;
	width: 320px;
	max-width: 90vw;
	z-index: 99997;
	background: #ffffff;
	color: #1a1a1a;
	box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	padding: 1rem 1.25rem 1.25rem;
	gap: 1rem;
	font-size: 14px;
	line-height: 1.4;
	transform: translateX(0);
	animation: gchs-cp-slide-in 220ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
	.gchs-cp__panel { animation: none; }
}

@keyframes gchs-cp-slide-in {
	from { transform: translateX(100%); }
	to   { transform: translateX(0); }
}

/* ── Header ──────────────────────────────────────────────── */
.gchs-cp__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.gchs-cp__title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
}

.gchs-cp__close {
	width: 2rem;
	height: 2rem;
	border: 0;
	background: transparent;
	color: #555;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	border-radius: 4px;
}

.gchs-cp__close:hover,
.gchs-cp__close:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	color: #000;
	outline: none;
}

/* ── Color rows ──────────────────────────────────────────── */
.gchs-cp__rows {
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
}

.gchs-cp__row {
	display: grid;
	grid-template-columns: 36px 1fr auto;
	grid-template-rows: auto auto;
	gap: 4px 10px;
	align-items: center;
}

.gchs-cp__label {
	grid-column: 2 / 4;
	grid-row: 1;
	font-weight: 600;
	font-size: 0.85rem;
}

.gchs-cp__swatch {
	grid-column: 1;
	grid-row: 1 / span 2;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 6px;
	cursor: pointer;
	background: transparent;
}

/* Safari/Chrome paint a 2px inset on color inputs; suppress. */
.gchs-cp__swatch::-webkit-color-swatch-wrapper { padding: 0; }
.gchs-cp__swatch::-webkit-color-swatch         { border: 0; border-radius: 5px; }
.gchs-cp__swatch::-moz-color-swatch            { border: 0; border-radius: 5px; }

.gchs-cp__hex {
	grid-column: 2;
	grid-row: 2;
	width: 100%;
	padding: 0.35rem 0.5rem;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.85rem;
	text-transform: lowercase;
}

.gchs-cp__hex:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #709dcc);
	outline-offset: 1px;
}

.gchs-cp__row-default {
	grid-column: 3;
	grid-row: 2;
	background: transparent;
	border: 0;
	padding: 0.35rem 0.5rem;
	color: #555;
	font-size: 0.78rem;
	cursor: pointer;
	text-decoration: underline;
}

.gchs-cp__row-default:hover,
.gchs-cp__row-default:focus-visible {
	color: #000;
	outline: none;
}

/* ── Actions ─────────────────────────────────────────────── */
.gchs-cp__actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

.gchs-cp__btn {
	flex: 1 1 auto;
	padding: 0.55rem 0.75rem;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
	transition: background-color 120ms ease, color 120ms ease;
}

.gchs-cp__btn--ghost {
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.2);
	color: #333;
}

.gchs-cp__btn--ghost:hover,
.gchs-cp__btn--ghost:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	outline: none;
}

.gchs-cp__btn--primary {
	background: var(--wp--preset--color--primary-dark, #34577c);
	border: 1px solid transparent;
	color: #fff;
}

.gchs-cp__btn--primary:hover,
.gchs-cp__btn--primary:focus-visible {
	background: #000;
	outline: none;
}

/* ── Helper text ─────────────────────────────────────────── */
.gchs-cp__helper {
	margin: 0;
	font-size: 0.78rem;
	color: #555;
	line-height: 1.4;
}

/* ── Presets ─────────────────────────────────────────────── */
.gchs-cp__presets {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.gchs-cp__presets-header {
	font-size: 0.78rem;
	font-weight: 600;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.gchs-cp__presets-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.5rem;
}

.gchs-cp__preset {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	padding: 0;
	background: transparent;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 6px;
	cursor: pointer;
	overflow: hidden;
	transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.gchs-cp__preset:hover,
.gchs-cp__preset:focus-visible {
	transform: translateY(-1px);
	border-color: rgba(0, 0, 0, 0.35);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	outline: none;
}

.gchs-cp__preset-bars {
	display: flex;
	height: 36px;
}

.gchs-cp__preset-bar {
	flex: 1 1 0;
	display: block;
}

.gchs-cp__preset-name {
	display: block;
	padding: 4px 2px 5px;
	font-size: 0.7rem;
	font-weight: 600;
	color: #333;
	text-align: center;
	line-height: 1.1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 380px) {
	.gchs-cp__presets-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
