/*!
 * CSS Portal — Clip-path generator extras
 * Loaded after code-tool.css and generator-tool.css. Everything is scoped to .gt.
 */

.gt [hidden], .gt details[hidden] { display: none !important; }

/* ---------- editor ---------- */

.gt .cp-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
	padding: 28px;
	overflow: hidden;
	background-color: var(--ct-surface);
	background-image: linear-gradient(45deg, var(--ct-surface-2) 25%, transparent 25%, transparent 75%, var(--ct-surface-2) 75%),
		linear-gradient(45deg, var(--ct-surface-2) 25%, transparent 25%, transparent 75%, var(--ct-surface-2) 75%);
	background-size: 16px 16px;
	background-position: 0 0, 8px 8px;
}
.gt .cp-canvas {
	position: relative;
	flex: none;
	max-width: 100%;
	height: auto;
	box-shadow: 0 0 0 1px var(--ct-border-strong), 0 10px 30px rgba(15, 23, 42, .15);
	touch-action: none;
	user-select: none;
}
.gt .cp-layer { position: absolute; inset: 0; }
.gt .cp-canvas.has-grid::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image: linear-gradient(to right, rgba(255, 255, 255, .35) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .35) 1px, transparent 1px);
	background-size: var(--grid) var(--grid);
	mix-blend-mode: difference;
}
.gt .cp-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 1; }
.gt .cp-edge { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .7)); }
.gt .cp-edge-hit { fill: none; stroke: transparent; stroke-width: 16; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: copy; }
.gt:not(.cp-is-polygon) .cp-edge-hit { pointer-events: none; }

.gt .cp-handles { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.gt .cp-handle {
	--c: #ffffff;
	position: absolute;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	padding: 0;
	background: var(--c);
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(15, 23, 42, .5), 0 2px 6px rgba(0, 0, 0, .4);
	cursor: move;
	touch-action: none;
	pointer-events: auto;
	transition: transform .1s;
}
.gt .cp-handle::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; }   /* bigger touch target */
.gt .cp-handle--alt { --c: #1982c4; border-radius: 4px; }
.gt .cp-handle:hover { transform: scale(1.15); }
.gt .cp-handle.is-selected { transform: scale(1.25); box-shadow: 0 0 0 2px #0f172a, 0 0 0 5px #fff, 0 2px 8px rgba(0, 0, 0, .4); }
.gt .cp-handle:focus-visible { outline: none; box-shadow: 0 0 0 2px #0f172a, 0 0 0 5px var(--ct-accent); }

.gt .cp-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	padding: 10px 14px;
	border-top: 1px solid var(--ct-border);
	background: var(--ct-surface);
}
.gt .cp-images { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gt .cp-img {
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	background: center / cover no-repeat;
	border: 2px solid var(--ct-bg);
	border-radius: 8px;
	box-shadow: 0 0 0 1px var(--ct-border);
	cursor: pointer;
}
.gt .cp-img--gradient { background-image: linear-gradient(45deg, #3a86ff, #8338ec); }
.gt .cp-img[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ct-accent); }
.gt .cp-img:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ct-accent), 0 0 0 5px var(--ct-accent-soft); }

.gt .cp-nudge { display: flex; align-items: center; gap: 2px; }
.gt .cp-nudge .ct-tool { padding: 0 8px; }
.gt .cp-readout { margin-left: 6px; font-family: var(--ct-mono); font-size: 12px; color: var(--ct-muted); white-space: nowrap; }
.gt .cp-bar__end { margin-left: auto; }
.gt .cp-dims { font-family: var(--ct-mono); font-size: 12px; color: var(--ct-muted); }
.gt .cp-status { margin: 0; padding: 0 14px 10px; font-size: 13px; color: var(--ct-ok); }
.gt .cp-status.is-error { color: var(--ct-err); }
.gt .cp-status:empty { display: none; }
.gt .cp-hint { margin: 0; padding: 0 14px 12px; font-size: 12.5px; color: var(--ct-muted); }
.gt:not(.cp-is-polygon) [data-cp="add"],
.gt:not(.cp-is-polygon) [data-cp="remove"] { display: none; }
.gt .ct-tool:disabled { opacity: .4; pointer-events: none; }

/* ---------- panel extras ---------- */

.gt .cp-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.gt .cp-preset {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 0;
	margin: 0;
	padding: 8px 2px 6px;
	font: inherit;
	color: var(--ct-muted);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	cursor: pointer;
}
.gt .cp-preset__shape { display: block; width: 30px; height: 30px; padding: 0; background: linear-gradient(45deg, #3a86ff, #8338ec); }
.gt .cp-preset__name { display: block; max-width: 100%; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; line-height: 1.3; }
.gt .cp-preset:hover { color: var(--ct-text); border-color: var(--ct-border-strong); }
.gt .cp-preset:focus-visible { outline: none; border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }

.gt .cp-sizes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.gt .cp-size {
	height: 30px;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	color: var(--ct-text);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 6px;
	cursor: pointer;
}
.gt .cp-size:hover { border-color: var(--ct-border-strong); background: var(--ct-surface); }
.gt .cp-size:focus-visible { outline: none; border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }

.gt .cp-save { display: flex; gap: 6px; }
.gt .cp-save__name {
	flex: 1;
	min-width: 0;
	width: auto;
	height: 34px;
	margin: 0;
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
	color: var(--ct-text);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	outline: none;
}
.gt .cp-save__name:focus { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .cp-save .ct-btn { height: 34px; }
.gt .cp-saved { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.gt .cp-saved li { display: flex; align-items: center; gap: 2px; margin: 0; }
.gt .cp-saved__load {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex: 1;
	min-width: 0;
	height: 32px;
	margin: 0;
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
	text-align: left;
	color: var(--ct-text);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 6px;
	cursor: pointer;
}
.gt .cp-saved__load span { padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt .cp-saved__load small { padding: 0; font-size: 11px; color: var(--ct-muted); }
.gt .cp-saved__load:hover { border-color: var(--ct-border-strong); }
.gt .cp-saved__empty { font-size: 12.5px; color: var(--ct-muted); }

.gt [data-gt="code"].ce { height: clamp(160px, 22vh, 260px); }

@media (max-width: 575.98px) {
	.gt .cp-stage { padding: 18px; min-height: 0; }
	.gt .cp-sizes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.gt .cp-readout { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.gt .cp-handle { transition: none; }
}
