/**
 * Custom Figurine Studio — live configurator styles.
 * Glass-card + synthwave tokens; mobile-first; reduced-motion aware.
 * Loads only on the figurine landing template (async). Pairs with custom-studio.css.
 *
 * @package 3DCentral
 * @since 1.11.0
 */

:root {
	--tdc-studio-accent: var(--color-accent, #ff5c5c);
	--tdc-studio-stage: #0d0d12;
	--tdc-studio-line: rgba(255, 255, 255, 0.12);
}

/* ---------- shell ---------- */
.tdc-studio {
	max-width: 1040px;
	margin-inline: auto;
}

.tdc-studio__step {
	margin-top: 1.25rem;
}

/* ---------- input step ---------- */
.tdc-studio__inputs {
	display: grid;
	gap: 1.1rem;
}

.tdc-upload {
	position: relative;
	border: 2px dashed var(--tdc-studio-line);
	border-radius: 16px;
	padding: 1.6rem 1.25rem;
	text-align: center;
	cursor: pointer;
	transition: border-color .2s ease, background-color .2s ease;
	background: rgba(255, 255, 255, 0.02);
}

.tdc-upload.is-dragover {
	border-color: var(--tdc-studio-accent);
	background: rgba(255, 92, 92, 0.06);
}

.tdc-upload input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.tdc-upload__cta {
	display: grid;
	gap: .35rem;
	justify-items: center;
	pointer-events: none;
}

.tdc-upload__primary {
	font-weight: 600;
}

.tdc-upload__hint {
	font-size: .82rem;
	opacity: .7;
}

.tdc-upload__preview {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	margin-top: .8rem;
	justify-content: center;
}

.tdc-upload__preview img {
	height: 92px;
	width: auto;
	border-radius: 10px;
	border: 1px solid var(--tdc-studio-line);
}

.tdc-or {
	text-align: center;
	font-size: .8rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: .55;
	position: relative;
}

.tdc-prompt {
	width: 100%;
	min-height: 64px;
	border-radius: 12px;
	border: 1px solid var(--tdc-studio-line);
	background: rgba(255, 255, 255, 0.03);
	color: inherit;
	padding: .75rem .9rem;
	font: inherit;
	resize: vertical;
}

.tdc-subjects {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}

.tdc-consent {
	display: flex;
	gap: .6rem;
	align-items: flex-start;
	font-size: .85rem;
	line-height: 1.5;
	opacity: .92;
}

.tdc-consent input {
	margin-top: .25rem;
	flex: 0 0 auto;
}

/* ---------- studio (stage + panel) ---------- */
.tdc-studio__stage-wrap {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: 1fr;
	align-items: start;
}

@media (min-width: 860px) {
	.tdc-studio__stage-wrap {
		grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	}
}

/* ---------- 3D viewer (from viewer dossier) ---------- */
.tdc-viewer {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	max-width: 640px;
	margin-inline: auto;
	background: var(--tdc-studio-stage);
	border-radius: 16px;
	overflow: hidden;
	contain: content;
}

.tdc-viewer model-viewer {
	width: 100%;
	height: 100%;
	--poster-color: transparent;
	--progress-bar-color: var(--tdc-studio-accent);
	--progress-mask: transparent;
}

.tdc-viewer__progress {
	position: absolute;
	inset: auto 0 0 0;
	height: 3px;
	background: var(--tdc-studio-accent);
	transform-origin: left;
	transform: scaleX(0);
	transition: transform .2s ease;
}

.tdc-viewer__err {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #cfd2e6;
	font: 500 .9rem/1.4 system-ui, sans-serif;
	padding: 1rem;
	text-align: center;
}

/* generation progress (our own bar, distinct from model-load bar) */
.tdc-progress {
	height: 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	overflow: hidden;
	margin-top: 1rem;
}

.tdc-progress__bar {
	height: 100%;
	width: 5%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--tdc-studio-accent), #ff8a6b);
	transition: width .4s ease;
}

.tdc-progress-label {
	margin-top: .6rem;
	font-weight: 600;
	text-align: center;
}

.tdc-regen {
	display: inline-block;
	margin-top: .5rem;
	font-size: .85rem;
	opacity: .8;
}

/* ---------- configure panel ---------- */
.tdc-configure {
	display: grid;
	gap: 1.1rem;
}

.tdc-configure__group legend,
.tdc-configure__group > .tdc-configure__label {
	font-weight: 600;
	margin-bottom: .5rem;
	display: block;
}

.tdc-options {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}

.tdc-option {
	position: relative;
	border: 1px solid var(--tdc-studio-line);
	border-radius: 12px;
	padding: .6rem .8rem;
	cursor: pointer;
	transition: border-color .2s ease, background-color .2s ease;
	flex: 1 1 auto;
	min-width: 96px;
}

.tdc-option input {
	position: absolute;
	opacity: 0;
	inset: 0;
	cursor: pointer;
}

.tdc-option__title {
	font-weight: 600;
	display: block;
}

.tdc-option__desc {
	font-size: .78rem;
	opacity: .72;
	display: block;
	margin-top: .15rem;
}

.tdc-option:has(input:checked) {
	border-color: var(--tdc-studio-accent);
	background: rgba(255, 92, 92, 0.08);
}

.tdc-option:has(input:focus-visible) {
	outline: 2px solid var(--tdc-studio-accent);
	outline-offset: 2px;
}

.tdc-checks {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem .9rem;
}

.tdc-check {
	display: flex;
	align-items: center;
	gap: .4rem;
	font-size: .9rem;
}

.tdc-qtyrow {
	display: flex;
	gap: 1rem;
	align-items: end;
	flex-wrap: wrap;
}

.tdc-qty {
	width: 84px;
	border-radius: 10px;
	border: 1px solid var(--tdc-studio-line);
	background: rgba(255, 255, 255, 0.03);
	color: inherit;
	padding: .5rem .6rem;
	font: inherit;
}

.tdc-cart-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	border-top: 1px solid var(--tdc-studio-line);
	padding-top: 1rem;
}

.tdc-estimate {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
}

.tdc-estimate__label {
	font-size: .72rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	opacity: .6;
}

.tdc-estimate__value {
	font-size: 1.6rem;
	font-weight: 700;
}

.tdc-estimate__note {
	font-size: .72rem;
	opacity: .6;
}

/* ---------- messages + fallback ---------- */
.tdc-msg {
	margin-top: .3rem;
	font-size: .9rem;
}

.tdc-msg--error {
	color: var(--tdc-studio-accent);
}

.tdc-msg--success {
	color: #7be08a;
}

.tdc-fallback-note {
	margin: 0 0 1rem;
	padding: .75rem 1rem;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.05);
	font-size: .9rem;
}

@media (prefers-reduced-motion: reduce) {
	.tdc-viewer__progress,
	.tdc-progress__bar,
	.tdc-option,
	.tdc-upload {
		transition: none;
	}
}
