/* Studio Alpha × PrintSol: PrintSol's generator controls in our configurator look.
 * Builds on assets/configurator/configurator.css (loaded first: same tokens, stage, buttons,
 * swatches, sliders, buy row, sticky bar); this file maps PrintSol's markup onto it and
 * overrides PrintSol's own plugin CSS where it differs. */

/* ---------- Dutch overlay: the English stays in the page for PrintSol, the Dutch shows ---------- */
.sa-ps .sa-ps-tr::before { content: attr(data-nl); }
.sa-ps .sa-ps-en { display: none; }

/* Visually hidden but still laid out (PrintSol's preview skips fields without a box). */
.sa-ps .sa-ps-vh,
.sa-ps .ps-sw-select,
.sa-ps .ps-sw-select ~ input[type="color"],
.sa-ps .ps-swatch > .ps-custom { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.sa-ps [hidden] { display: none !important; }

/* ---------- Layout ---------- */
form.sa-ps-form { margin: 0; }
.sa-ps .sa-ps-fields { min-width: 0; }
.sa-ps.sa-ps .sa-ps-fields > div { display: flex; flex-direction: column; gap: 1.1rem; margin: 0; min-width: 0; }
/* Nested wrappers (name options, rings …): spacing by margin, never by display (PrintSol shows and hides them with display). */
.sa-ps.sa-ps .sa-ps-fields > div > div > * + * { margin-top: 1.1rem; }
.sa-ps.sa-ps fieldset, .sa-ps.sa-ps .ps-field, .sa-ps.sa-ps .ps-slider { border: 0; margin: 0; padding: 0; min-width: 0; max-width: 100%; background: none; }

/* Heads: label left, current value right. */
.sa-ps.sa-ps legend.sa-ps-legend { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%; float: none; margin: 0 0 0.55rem; padding: 0; font-weight: 700; font-size: var(--wp--preset--font-size--sm, 0.9375rem); color: var(--cfg-ink); }
.sa-ps.sa-ps legend.sa-ps-legend::after { content: attr(data-current); font-size: 0.875rem; font-weight: 600; color: var(--cfg-muted); text-align: right; }
.sa-ps.sa-ps .sa-cfg-head > label { display: block; margin: 0; padding: 0; font-weight: 700; font-size: var(--wp--preset--font-size--sm, 0.9375rem); color: var(--cfg-ink); }
.sa-ps .sa-cfg-head abbr.required { display: none; }
.sa-ps .sa-cfg-current { text-align: right; }
.sa-ps.sa-ps .sa-cfg-range .sa-cfg-head > label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%; }
.sa-ps .sa-cfg-range .sa-cfg-head output { font-size: 0.875rem; font-weight: 600; color: var(--cfg-muted); font-variant-numeric: tabular-nums; }
.sa-ps.sa-ps .sa-cfg-help, .sa-ps.sa-ps .ps-field small, .sa-ps.sa-ps .ps-hint { display: block; width: auto; margin: 0.45rem 0 0; font-size: 0.8125rem; color: var(--cfg-muted); opacity: 1; }

/* ---------- Choice buttons (radios and short lists) ---------- */
.sa-ps.sa-ps .sa-cfg-options > label.sa-cfg-choice { margin: 0; padding: 0; border: 0; background: none; font-weight: 400; }
.sa-ps .sa-cfg-choice > .sa-cfg-choice-box { flex: 1 1 auto; width: 100%; box-sizing: border-box; }
.sa-ps .sa-cfg-choice-label { overflow-wrap: anywhere; }
.sa-ps .sa-ps-opt { position: relative; flex: 1 1 auto; min-width: 4.5rem; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: center; }
.sa-ps .sa-ps-opt:hover .sa-cfg-choice-box { border-color: var(--cfg-ink); }
.sa-ps .sa-ps-opt[aria-pressed="true"] .sa-cfg-choice-box { border-color: var(--cfg-accent); box-shadow: inset 0 0 0 1.5px var(--cfg-accent); background: var(--cfg-sage); }
.sa-ps .sa-ps-opt:focus-visible { outline: none; }
.sa-ps .sa-ps-opt:focus-visible .sa-cfg-choice-box { outline: 2px solid var(--cfg-ink); outline-offset: 2px; }

/* ---------- Colour swatches ---------- */
/* Radios with a colour (Trophies, Letter maker). */
.sa-ps.sa-ps .sa-cfg-options > label.sa-cfg-swatch { margin: 0; padding: 0; border: 0; background: none; font-size: 0; color: transparent; }
.sa-ps .sa-cfg-swatch > .sa-cfg-swatch-dot { display: block; position: static; }
.sa-ps .sa-cfg-swatch.sa-ps-any .sa-cfg-swatch-dot { background: conic-gradient(#e5484d, #f5c542, #46a758, #00a2c7, #3e63dd, #8e4ec6, #e5484d); }
.sa-ps .sa-cfg-swatch.sa-ps-any input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; z-index: 1; }
/* Colour lists made into buttons by PrintSol's printsol-ui.js. */
.sa-ps .ps-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0; }
.sa-ps .ps-sw { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: transparent; box-shadow: none; cursor: pointer; }
.sa-ps .ps-sw::before { content: ""; width: 36px; height: 36px; border-radius: 999px; background: var(--sw, #fff); box-shadow: inset 0 0 0 1px rgba(31, 35, 40, 0.14); transition: transform 0.15s; }
.sa-ps .ps-sw:hover::before { transform: scale(1.06); }
.sa-ps .ps-sw[aria-checked="true"]::before { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cfg-ink); }
.sa-ps .ps-sw:focus-visible { outline: 2px solid var(--cfg-accent); outline-offset: 2px; }
.sa-ps .ps-sw-any::before { background: conic-gradient(#e5484d, #f5c542, #46a758, #00a2c7, #3e63dd, #8e4ec6, #e5484d); }
.sa-ps .ps-sw-any.ps-sw-set::before { background: var(--sw); }
.sa-ps .ps-sw.ps-sw-text { width: auto; min-height: 44px; height: auto; padding: 0 0.9rem; border: 1.5px solid var(--cfg-border); border-radius: var(--sa-radius-sm, 12px); background: #fff; font: inherit; font-size: 0.875rem; font-weight: 700; color: var(--cfg-ink); }
.sa-ps .ps-sw.ps-sw-text::before { display: none; }
.sa-ps .ps-sw.ps-sw-text[aria-checked="true"] { border-color: var(--cfg-accent); box-shadow: inset 0 0 0 1.5px var(--cfg-accent); background: var(--cfg-sage); outline: 0; }
.sa-ps .ps-sw-name, .sa-ps .ps-radio-swatches > .ps-sw-name { display: none; }

/* ---------- Inputs ---------- */
.sa-ps.sa-ps .sa-ps-fields input[type="text"],
.sa-ps.sa-ps .sa-ps-fields input[type="number"],
.sa-ps.sa-ps .sa-ps-fields input[type="search"],
.sa-ps.sa-ps .sa-ps-fields select.sa-ps-select { width: 100%; max-width: none; min-height: 52px; margin: 0; padding: 0 1rem; border: 1.5px solid var(--cfg-border); border-radius: var(--sa-radius-sm, 12px); background-color: #fff; box-sizing: border-box; box-shadow: none; font: inherit; font-size: 1rem; font-weight: 600; color: var(--cfg-ink); }
.sa-ps.sa-ps .sa-ps-fields select.sa-ps-select { appearance: none; -webkit-appearance: none; padding-right: 2.75rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231F2328' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 1rem center !important; cursor: pointer; }
.sa-ps.sa-ps .sa-ps-fields input:focus, .sa-ps.sa-ps .sa-ps-fields select.sa-ps-select:focus { border-color: var(--cfg-ink); outline: none; }
.sa-ps.sa-ps .sa-ps-fields input:focus-visible, .sa-ps.sa-ps .sa-ps-fields select.sa-ps-select:focus-visible { outline: 2px solid var(--cfg-ink); outline-offset: 2px; }
.sa-ps.sa-ps .sa-ps-fields input[type="text"]::placeholder { color: var(--cfg-muted); font-weight: 500; }
.sa-ps .sa-cfg-range input[type="range"] { display: block; }
.sa-ps .sa-ps-file input[type="file"] { display: block; width: 100%; padding: 0.9rem 1rem; border: 1.5px dashed var(--cfg-border); border-radius: var(--sa-radius-sm, 12px); background: #fff; font: inherit; box-sizing: border-box; }

/* Checkboxes as a row you can tap. */
.sa-ps.sa-ps .sa-ps-check > label, .sa-ps.sa-ps .ps-team-on { display: flex; align-items: center; gap: 0.7rem; min-height: 52px; margin: 0; padding: 0.6rem 1rem; border: 1.5px solid var(--cfg-border); border-radius: var(--sa-radius-sm, 12px); background: #fff; font-weight: 600; font-size: 0.9375rem; color: var(--cfg-ink); cursor: pointer; }
.sa-ps .sa-ps-check input[type="checkbox"], .sa-ps .ps-team-on input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--cfg-accent); }

/* Family: how many of each. */
.sa-ps.sa-ps .sa-ps-counts { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sa-ps.sa-ps .sa-ps-counts > legend { flex: 0 0 100%; }
.sa-ps.sa-ps .sa-ps-counts > label { flex: 1 1 calc(50% - 0.5rem); display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin: 0; padding: 0.3rem 0.3rem 0.3rem 0.9rem; border: 1.5px solid var(--cfg-border); border-radius: var(--sa-radius-sm, 12px); background: #fff; font-weight: 600; font-size: 0.9375rem; color: var(--cfg-ink); min-width: 0; }
.sa-ps.sa-ps .sa-ps-counts > label select.sa-ps-select { width: auto; min-width: 4.2rem; min-height: 42px; }
.sa-ps.sa-ps .sa-ps-counts > small { flex: 0 0 100%; }

/* Trophies: one title per player. */
.sa-ps .ps-team-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.sa-ps .ps-team-row { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.sa-ps .ps-team-n { flex: 0 0 1.5rem; font-weight: 700; color: var(--cfg-muted); text-align: center; }
.sa-ps .ps-team-del, .sa-ps .ps-team-add { min-height: 44px; min-width: 44px; padding: 0 1rem; border: 1.5px solid var(--cfg-border); border-radius: 999px; background: #fff; font: inherit; font-weight: 700; color: var(--cfg-ink); cursor: pointer; }
.sa-ps .ps-team-add { align-self: flex-start; }

/* Clickers' symbol maker: search and category side by side. */
.sa-ps.sa-ps p:has(> .ps-symbol-search) { display: flex; gap: 0.5rem; margin: 0; }
.sa-ps.sa-ps p:has(> .ps-symbol-search) > .ps-symbol-search { flex: 1 1 auto; min-width: 0; }
.sa-ps.sa-ps p:has(> .ps-symbol-search) > select.sa-ps-select { flex: 0 1 11rem; width: auto; min-width: 0; }

/* 2D sketches PrintSol shows when its 3D preview cannot load. */
.sa-ps canvas.ps-preview { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: var(--sa-radius, 20px); background: #fff; }
.sa-ps .ps-preview:not(canvas) { padding: 1rem; border-radius: var(--sa-radius, 20px); background: #fff; text-align: center; overflow-wrap: anywhere; }
.sa-ps .ps-svg-preview img { max-width: 100%; max-height: 220px; display: block; margin: 0 auto; }

/* PrintSol's own price line: the total shows on our button. */
.sa-ps .ps-price, .sa-ps .ps-what { display: none !important; }
.sa-ps.sa-ps .ps-summary { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--cfg-muted); }
.sa-ps.sa-ps .ps-summary:not(:has(.ps-length:not(:empty), .ps-status:not(:empty))) { display: none; }

.sa-ps-owner { margin: 0; padding: 0.8rem 1rem; border-radius: 14px; background: var(--cfg-clay-soft); font-size: 0.875rem; color: var(--cfg-ink); }
.sa-ps-owner a { color: var(--cfg-accent); font-weight: 700; }
.sa-ps .sa-cfg-errors:not([role]) { margin: 0; }

/* ---------- Viewer: PrintSol's live 3D frame in our stage ---------- */
.sa-ps-stage .sa-ps-live { position: absolute; inset: 0; visibility: hidden; }
.sa-ps-stage[data-mode="live"] .sa-ps-live { visibility: visible; }
.sa-ps-stage[data-mode="live"] .sa-cfg-poster { visibility: hidden; }
.sa-ps-stage[data-mode="live"] { background: radial-gradient(circle at 50% 38%, #fff 0, #FBFAF7 55%, var(--cfg-base) 100%); }
.sa-ps-stage[data-mode="live"] .sa-cfg-start { display: none; }
.sa-ps-stage.no-poster .sa-cfg-poster { display: none; }
.sa-ps-stage .sa-ps-live .ps-3d-wrap { width: 100%; height: 100%; margin: 0 !important; }
.sa-ps-stage .sa-ps-live iframe { display: block; width: 100% !important; max-width: none !important; height: 100% !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; }
/* Before PrintSol's frame says it is ready: no half-drawn frame. */
.sa-ps-stage:not(.is-ready) .sa-ps-live iframe { opacity: 0; }
.sa-ps-stage.is-ready .sa-ps-live iframe { opacity: 1; transition: opacity 0.3s; }
.sa-ps-stage .sa-cfg-tools { justify-content: flex-start; }

@media (max-width: 781px) {
	.sa-ps-stage .sa-cfg-start { white-space: nowrap; }
	.sa-ps.sa-ps .sa-ps-counts > label { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.sa-ps .ps-sw::before, .sa-ps-stage.is-ready .sa-ps-live iframe { transition: none; }
}
