/* Estudio de personalización en vivo (template-parts/product/studio.php + assets/js/30-studio.js). */

/* ---------- Lienzo en la galería ---------- */
.pd-gallery__slide.has-live { position: relative; }
.st-live { position: absolute; inset: 0; z-index: 1; background: var(--c-marfil); }
.st-live .st-canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-live__tag {
	position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 8px;
	padding: 6px 12px 6px 10px; border-radius: var(--radius-pill); background: rgba(var(--rgb-bg), .92);
	font-size: 12.5px; font-weight: 500; color: var(--c-tinta); letter-spacing: .02em; pointer-events: none;
	box-shadow: 0 1px 2px rgba(var(--rgb-cacao), .08);
}
.st-canvas { touch-action: auto; outline-offset: -3px; }
.st-canvas.is-interactive { touch-action: none; }
.st-canvas.is-dragging { cursor: grabbing !important; }
.st__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-vino); box-shadow: 0 0 0 3px rgba(var(--rgb-palo-rosa), .18); flex: none; }
.st.is-active .st__dot, .st-live .st__dot { animation: st-pulse 2.2s var(--ease) infinite; }
@keyframes st-pulse { 50% { box-shadow: 0 0 0 6px rgba(var(--rgb-palo-rosa), 0); } }

/* ---------- Panel ---------- */
.st { margin-top: 14px; }
.st [hidden] { display: none !important; }
/* Escritorio: la vista previa (galería) acompaña mientras editas. */
@media (min-width: 901px) {
	.pd__grid:has(.st.is-active) .pd__gallery { position: sticky; top: calc(var(--sticky-offset, 0px) + 24px); align-self: start; }
}
.st__launch { display: none; }
.st__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--c-line); }
.st__bar-title {
	display: inline-flex; align-items: center; gap: 9px; margin: 0;
	font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--c-oro);
}
.st__history { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.st__close { display: none; }
.st__stage { display: none; }
.st-icon-btn {
	display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 50%;
	background: transparent; color: var(--c-tinta); transition: background .2s, border-color .2s, opacity .2s;
}
.st-icon-btn:hover:not(:disabled) { background: var(--c-marfil); }
.st-icon-btn:disabled { opacity: .32; cursor: default; }
.st-text-btn {
	display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius-pill);
	background: transparent; color: var(--c-text-soft); font-size: 14px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--c-line-strong); text-underline-offset: 3px;
}
.st-text-btn:hover { color: var(--c-vino); text-decoration-color: currentColor; }

/* ---------- Zonas ---------- */
.st-zone { min-width: 0; margin: 14px 0 0; padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--c-line); }
.st-zone:last-child { border-bottom: 0; padding-bottom: 4px; }
.st-zone__label { display: flex; align-items: center; gap: 9px; width: 100%; padding: 0; margin-bottom: 10px; font-size: 16px; font-weight: 600; }
.st-zone__num {
	display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
	background: var(--c-rubor); color: var(--c-vino); font-size: 12.5px; font-weight: 600;
}
.st-zone__opt { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--c-muted); }
.st-zone__err { margin: 8px 0 0; font-size: 14px; color: var(--c-danger); line-height: 1.4; }
.st-zone.is-invalid .st-input, .st-zone.is-invalid .st-drop { border-color: var(--c-danger); }
.st-zone.is-loading .st-drop { opacity: .6; pointer-events: none; }

/* Subir foto */
.st-drop {
	position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
	padding: 14px 14px 14px 16px; border: 1.5px dashed var(--c-line-strong); border-radius: var(--radius); background: var(--c-bg);
	cursor: pointer; transition: border-color .2s, background .2s;
}
.st-drop:hover, .st-drop.is-dragover { border-color: var(--c-vino); background: var(--c-marfil); }
.st-drop:focus-within { outline: 2px solid var(--c-rosa); outline-offset: 3px; }
.st-drop__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.st-drop__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--c-rubor); color: var(--c-vino); }
.st-drop__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-drop__text strong { font-size: 15.5px; font-weight: 600; }
.st-drop__text small { font-size: 13.5px; color: var(--c-muted); line-height: 1.35; }
.st-drop__btn {
	display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: var(--radius-pill);
	background: var(--c-vino); color: var(--c-on-vino); font-size: 14px; font-weight: 600;
}

.st-photo__head { display: flex; align-items: center; gap: 12px; }
.st-photo__thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--c-marfil); border: 1px solid var(--c-line); }
.st-photo__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.st-photo__name { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-photo__up { font-size: 12.5px; color: var(--c-muted); }

.st-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-top: 12px; }
.st-zoom { display: flex; align-items: center; gap: 4px; flex: 1 1 200px; }
.st-range { flex: 1; min-width: 80px; height: 28px; accent-color: var(--c-vino); background: transparent; }
.st-seg { display: flex; gap: 6px; }
.st-chip {
	display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--c-line-strong); border-radius: var(--radius-pill);
	background: var(--c-surface); color: var(--c-tinta); font-size: 13.5px; font-weight: 500; transition: border-color .2s, background .2s;
}
.st-chip:hover { border-color: var(--c-vino); }
.st-chip[aria-pressed="true"] { background: var(--c-rubor); border-color: var(--c-vino); }
.st-hint { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 13px; color: var(--c-muted); line-height: 1.4; }
.st-hint .icon { flex: none; margin-top: 1px; }

/* Semáforo de calidad */
.st-q { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-bg); --st-q: var(--c-muted); }
.st-q[data-level="excelente"] { --st-q: var(--c-success); }
.st-q[data-level="buena"] { --st-q: var(--c-warning); }
.st-q[data-level="baja"] { --st-q: var(--c-danger); border-color: color-mix(in srgb, var(--c-danger) 35%, var(--c-line)); background: color-mix(in srgb, var(--c-danger) 5%, var(--c-bg)); }
.st-q__head { display: flex; align-items: center; gap: 10px; }
.st-q__lights { display: inline-flex; gap: 4px; padding: 4px 6px; border-radius: var(--radius-pill); background: var(--c-surface); border: 1px solid var(--c-line); }
.st-q__lights i { width: 9px; height: 9px; border-radius: 50%; background: var(--c-line-strong); }
.st-q[data-level="baja"] .st-q__lights i:nth-child(1) { background: var(--c-danger); }
.st-q[data-level="buena"] .st-q__lights i:nth-child(2) { background: var(--c-warning); }
.st-q[data-level="excelente"] .st-q__lights i:nth-child(3) { background: var(--c-success); }
.st-q__label { margin: 0; font-size: 14.5px; }
.st-q__label strong { color: var(--st-q); font-weight: 600; }
.st-q__dpi { color: var(--c-muted); font-size: 13px; }
.st-q__text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--c-text-soft); }
.st-q__tips { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--c-text-soft); line-height: 1.45; }
.st-q__ack { margin-top: 10px; }

/* Casilla */
.st-check { position: relative; display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.st-check input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; }
.st-check__box {
	flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--c-line-strong); border-radius: 6px;
	background: var(--c-surface); color: transparent; transition: background .15s, border-color .15s;
}
.st-check input:checked + .st-check__box { background: var(--c-vino); border-color: var(--c-vino); color: var(--c-on-vino); }
.st-check input:focus-visible + .st-check__box { outline: 2px solid var(--c-rosa); outline-offset: 2px; }

/* Texto */
.st-text { position: relative; }
.st-input {
	width: 100%; min-height: 48px; padding: 12px 64px 12px 14px; border: 1px solid var(--c-line-strong); border-radius: 12px;
	background: var(--c-surface); color: var(--c-text); font: inherit; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
textarea.st-input { resize: vertical; min-height: 72px; }
select.st-input { padding-right: 36px; appearance: none; }
.st-input[type="date"] { padding-right: 14px; }
.st-input:focus { outline: none; border-color: var(--c-vino); box-shadow: 0 0 0 3px rgba(var(--rgb-palo-rosa), .15); }
.st-count { position: absolute; right: 14px; top: 14px; font-size: 13px; color: var(--c-muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.st-count.is-full { color: var(--c-vino); }
.st-sub { margin-top: 12px; }
.st-sub--row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.st-sub__label { margin: 0 0 8px; font-size: 13.5px; font-weight: 500; color: var(--c-text-soft); }
.st-sub__value { color: var(--c-muted); font-weight: 400; }

.st-fonts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.st-font {
	position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 74px; padding: 10px 6px 8px;
	border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.st-font:hover { border-color: var(--c-line-strong); }
.st-font__input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.st-font__sample { display: block; max-width: 100%; font-size: 21px; line-height: 1.25; color: var(--c-tinta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.st-font__name { font-size: 11.5px; color: var(--c-muted); letter-spacing: .02em; }
.st-font:has(.st-font__input:checked) { border-color: var(--c-vino); background: var(--c-marfil); box-shadow: inset 0 0 0 1px var(--c-vino); }
.st-font:has(.st-font__input:checked) .st-font__name { color: var(--c-vino); }
.st-font:has(.st-font__input:focus-visible) { outline: 2px solid var(--c-rosa); outline-offset: 2px; }

.st-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.st-color { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 1px solid transparent; }
.st-color__dot { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(var(--rgb-cacao), .18); }
.st-color:has(input:checked) { border-color: var(--c-vino); }
.st-color:has(input:focus-visible) { outline: 2px solid var(--c-rosa); outline-offset: 2px; }
.st-align { display: inline-flex; padding: 3px; border: 1px solid var(--c-line); border-radius: var(--radius-pill); background: var(--c-surface); }
.st-align__opt { position: relative; display: grid; place-items: center; width: 36px; height: 30px; border-radius: var(--radius-pill); cursor: pointer; color: var(--c-text-soft); }
.st-align__opt:has(input:checked) { background: var(--c-rubor); color: var(--c-vino); }
.st-align__opt:has(input:focus-visible) { outline: 2px solid var(--c-rosa); }
.st-warn {
	margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.4;
	background: color-mix(in srgb, var(--c-warning) 10%, var(--c-bg)); color: var(--c-tinta); border: 1px solid color-mix(in srgb, var(--c-warning) 30%, var(--c-line));
}

/* Pie */
.st__foot { margin-top: 16px; }
.st__msg { margin: 0 0 10px; font-size: 14px; color: var(--c-text-soft); text-align: center; }
.pd-perso__grid--after-studio { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--c-line); }

/* ---------- Prueba digital ---------- */
.st-proof .cv-dialog__panel { width: min(1040px, calc(100vw - 32px)); }
.st-proof__grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.st-proof__fig { margin: 0; }
.st-proof__img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--c-marfil); box-shadow: 0 0 0 1px var(--c-line); }
.st-proof__cap { margin-top: 10px; font-size: 13px; color: var(--c-muted); }
.st-proof__name { margin: 4px 0 14px; font-size: 22px; font-weight: 600; }
.st-proof__list { margin: 0 0 16px; display: grid; gap: 0; border-top: 1px solid var(--c-line); }
.st-proof__list > div { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--c-line); font-size: 14.5px; }
.st-proof__list dt { color: var(--c-muted); }
.st-proof__list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.st-proof__swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(var(--rgb-cacao), .2); }
.st-proof__warn { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: color-mix(in srgb, var(--c-danger) 7%, var(--c-bg)); color: var(--c-tinta); border: 1px solid color-mix(in srgb, var(--c-danger) 30%, var(--c-line)); }
.st-proof__check { padding: 12px 14px; border: 1px solid var(--c-line-strong); border-radius: 12px; background: var(--c-bg); font-weight: 500; }
.st-proof__actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 16px; }
.st-proof__actions .btn { padding: 0 1.2rem; }
.st-proof__actions .is-busy { opacity: .75; cursor: progress; }
.st-proof__note { display: flex; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--c-muted); line-height: 1.45; }
.st-proof__note .icon { flex: none; color: var(--c-success); }

/* ---------- Carrito / checkout ---------- */
.bl-studio-thumb { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Móvil: editor a pantalla completa ---------- */
@media (max-width: 900px) {
	.st__launch { display: block; margin-top: 10px; }
	.st__launch-text { margin: 0 0 12px; font-size: 15px; color: var(--c-text-soft); line-height: 1.45; }
	.st__launch-status { margin: -4px 0 12px; font-size: 14px; font-weight: 500; color: var(--c-success); }
	.st__panel { display: none; }
	.st-live__tag { left: auto; right: 12px; top: 12px; bottom: auto; font-size: 12px; }
	.st-live { cursor: pointer; }

	html.st-lock { overflow: hidden; }
	html.st-lock .pd-bar { display: none; }
	.st.is-open .st__panel {
		position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column;
		background: var(--c-bg); animation: st-in .28s var(--ease);
	}
	@keyframes st-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
	.st.is-open .st__bar { flex: none; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; background: var(--c-surface); }
	.st.is-open .st__bar-title { font-size: 11px; letter-spacing: .16em; }
	.st.is-open .st__history { gap: 0; }
	.st.is-open .st-text-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.st.is-open .st__close {
		display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border: 0; border-radius: var(--radius-pill);
		background: var(--c-tinta); color: var(--c-surface); font-size: 14.5px; font-weight: 600;
	}
	.st.is-open .st__stage {
		display: block; flex: none; height: min(46dvh, 100vw); background: var(--c-marfil); border-bottom: 1px solid var(--c-line);
	}
	.st.is-open .st__stage .st-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
	.st.is-open .st__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
	.st.is-open .st__foot { flex: none; margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--c-surface); border-top: 1px solid var(--c-line); }
	.st.is-open .st__proof-btn { background: var(--c-vino); color: var(--c-on-vino); border-color: transparent; }
	.st.is-open .st__msg { margin-bottom: 8px; }

	.st-fonts { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
	.st-fonts::-webkit-scrollbar { display: none; }
	.st-font { flex: 0 0 104px; scroll-snap-align: start; min-height: 70px; }
	.st-drop { grid-template-columns: auto 1fr; }
	.st-drop__btn { display: none; }

	.st-proof__grid { grid-template-columns: 1fr; gap: 16px; }
	.st-proof__name { font-size: 19px; margin-bottom: 10px; }
	.st-proof__list > div { grid-template-columns: 8em 1fr; font-size: 14px; padding: 7px 0; }
	.st-proof__actions { grid-template-columns: 1fr; }
	.st-proof__actions .btn--light { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
	.st.is-active .st__dot, .st-live .st__dot { animation: none; }
	.st.is-open .st__panel { animation: none; }
}
