/* 3D Text Studio (extension package). The modal chrome (backdrop,
   frame, header, close, selects, chips, tiles, buttons, scrollbars)
   comes from the editor's own modal design (dsm family) - the dialog
   mounts inside #wpie-root exactly for that. Only studio-specific
   layout lives here (prefix wpie3dt- so the sibling 3D Mockup Studio
   never collides). */

.wpie3dt-dialog {
	display: flex;
	flex-direction: column;
	width: min( 1120px, 96vw );
	height: min( 760px, 92vh );
}

.wpie3dt-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

.wpie3dt-view {
	position: relative;
	display: grid;
	flex: 1;
	place-items: center;
	min-width: 0;

	/* Oversized scene canvases must scale down, never paint over the
	   dialog footer. */
	overflow: hidden;
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.07 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 22px 22px;
}

/* "Show document": the flattened document sits contain-fitted behind the
   transparent scene canvas (inline background-image, set by main.js). */
.wpie3dt-view.is-doc {
	background-color: #05060a;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

#wpie-root .wpie3dt-docbtn {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	padding: 4px 11px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	cursor: pointer;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 999px;
	opacity: 0.92;
}

#wpie-root .wpie3dt-docbtn:hover {
	color: var( --ed-text, #e6e9ee );
}

#wpie-root .wpie3dt-docbtn[aria-pressed='true'] {
	color: #fff;
	background: var( --ed-accent, #3b66ff );
	border-color: var( --ed-accent, #3b66ff );
}

.wpie3dt-docbtn svg {
	width: 13px;
	height: 13px;
}

.wpie3dt-view canvas {
	max-width: 100%;
	max-height: 100%;
	cursor: grab;
	border-radius: 4px;
}

.wpie3dt-view canvas:active {
	cursor: grabbing;
}

.wpie3dt-hint {
	position: absolute;
	bottom: 10px;
	left: 12px;
	padding: 3px 9px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	pointer-events: none;
	background: var( --ed-panel, #1d2126 );
	border-radius: 999px;
	opacity: 0.9;
}

.wpie3dt-side {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 320px;
	padding: 14px;
	overflow-y: auto;
	border-left: 1px solid var( --ed-border, #333a44 );
}

.wpie3dt-seg {
	display: flex;
}

.wpie3dt-seg button {
	flex: 1;
}

.wpie3dt-controls {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wpie3dt-row {
	display: grid;
	grid-template-columns: 94px 1fr;
	gap: 8px;
	align-items: center;
}

.wpie3dt-row.has-val {
	grid-template-columns: 94px 1fr 34px;
}

.wpie3dt-row .dsm-label {
	overflow: hidden;
	font-size: 10.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpie3dt-val {
	font-size: 10.5px;
	font-variant-numeric: tabular-nums;
	color: var( --ed-text-muted, #8b93a1 );
	text-align: right;
	white-space: nowrap;
}

/* Settings cards. */
.wpie3dt-card {
	overflow: hidden;
	background: var( --ed-panel-alt, rgba( 255, 255, 255, 0.03 ) );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 10px;
}

.wpie3dt-card-head {
	display: flex;
	gap: 9px;
	align-items: center;
	padding: 14px 16px 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var( --ed-text-dim, #b9c0cc );
	text-transform: uppercase;
}

.wpie3dt-card-head svg {
	flex: none;
	opacity: 0.85;
}

.wpie3dt-card-body {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 9px 16px 15px;
}

/* Model picker tiles. */
.wpie3dt-grid.wpie3dt-models {
	grid-template-columns: repeat( 3, 1fr );
	max-height: 276px;
}

.wpie3dt-models .dsm-tile {
	min-width: 0;
	padding: 5px 3px 4px;
}

.wpie3dt-models .wpie3dt-thumb {
	background: none;
}

.wpie3dt-models .wpie3dt-tile-label {
	font-size: 10px;
}

/* Body color presets. */
.wpie3dt-swatches {
	display: flex;
	gap: 7px;
	padding: 2px 0 2px 68px;
}

.wpie3dt-swatch {
	width: 18px;
	height: 18px;
	padding: 0;
	cursor: pointer;
	border: 1px solid rgba( 255, 255, 255, 0.35 );
	border-radius: 50%;
}

.wpie3dt-dialog .wpie3dt-colorhost input[type='color'] {
	width: 46px;
	height: 24px;
}

.wpie3dt-swatch:hover {
	transform: scale( 1.15 );
}

.wpie3dt-swatch.active {
	box-shadow: 0 0 0 2px var( --ed-bg, #14171c ),
		0 0 0 4px var( --accent, #3b66ff );
}

.wpie3dt-colorhost {
	display: flex;
	align-items: center;
}

.wpie3dt-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 88px, 1fr ) );
	gap: 8px;
	max-height: 320px;
	padding: 2px;
	overflow-y: auto;
}

.wpie3dt-tile {
	position: relative;
	gap: 4px;
	padding: 8px 6px 6px;
}

.wpie3dt-thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.08 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 12px 12px;
	border-radius: 4px;
}

.wpie3dt-tile-badge {
	position: absolute;
	top: 4px;
	right: 4px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	color: #fff;
	text-align: center;
	background: var( --accent, #3b66ff );
	border-radius: 999px;
}

.wpie3dt-tile-label {
	max-width: 100%;
	overflow: hidden;
	font-size: 10.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpie3dt-sect {
	margin-top: 4px;
	padding-top: 10px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var( --ed-text-dim, #b9c0cc );
	text-transform: uppercase;
	border-top: 1px solid var( --ed-border, #333a44 );
}

.wpie3dt-note {
	min-height: 14px;
	font-size: 11px;
	color: var( --ed-text-muted, #8b93a1 );
}

.wpie3dt-dialog input[type='color'] {
	width: 100%;
	height: 28px;
	padding: 2px;
	cursor: pointer;
	background: var( --ed-panel-alt, #262b33 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 6px;
}

/* The text input. */
.wpie3dt-dialog textarea.wpie3dt-text {
	min-height: 52px;
	font-size: 13px;
	line-height: 1.4;
	resize: vertical;
}

/* Transparent-background swatch. */
.wpie3dt-swatch.wpie3dt-checker {
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.45 ) 0 25%,
			rgba( 255, 255, 255, 0.14 ) 0 50%
		)
		0 0 / 8px 8px;
}

/* 360 spin export buttons. */
.wpie3dt-spinrow {
	display: flex;
	gap: 8px;
}

.wpie3dt-spinrow .ai-btn {
	flex: 1;
}

/* Text | Logo mode switch + logo controls. */
.wpie3dt-mode {
	margin-bottom: 2px;
}

.wpie3dt-checkbox {
	justify-self: start;
	width: 15px;
	height: 15px;
	accent-color: var( --accent, #3b66ff );
}

/* Checkbox rows: full-width label, control right-aligned. */
.wpie3dt-row.wpie3dt-wide {
	grid-template-columns: 1fr auto;
}

/* Per-letter color row. */
.wpie3dt-letterrow {
	grid-template-columns: 94px auto 1fr;
}

.wpie3dt-reset {
	justify-self: start;
	padding: 3px 9px;
	font-size: 11px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	background: var( --ed-panel-alt, #262b33 );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 6px;
}

.wpie3dt-letterpanel {
	padding: 8px 10px 10px;
	background: var( --ed-panel, rgba( 0, 0, 0, 0.18 ) );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 8px;
}

.wpie3dt-letterpanel .wpie3dt-sect {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

/* Text field + variable-picker button side by side (API 2.6+). */
.wpie3dt-textwrap {
	display: flex;
	gap: 6px;
	align-items: flex-start;
}

.wpie3dt-textwrap .wpie3dt-text {
	flex: 1;
	min-width: 0;
}

.wpie3dt-varhost {
	flex: 0 0 auto;
	display: flex;
}

/* The side column is a flex column with its own scroll area. Without
   this the cards keep the default flex-shrink and get SQUEEZED instead
   of overflowing, so overflow-y never triggers and the panel simply has
   no scrollbar - the content below the fold becomes unreachable.
   (Bug class from 2026-07-17, fixed in five studios then; swept across
   the family on 2026-08-01.) */
#wpie-root .wpie3dt-side > * {
	flex-shrink: 0;
}
