/* Atelier Ursu - the v2 personalisation dialog ("studio"). Self-contained: the
   dialog lives on <body>, outside #product, so nothing of the page's option
   styling reaches it - the swatch look is restated here. */

/* The page button and badge (as in the v1 stylesheet, which v2 does not load). */
#product a.ursu-pp-personalize { cursor: pointer; text-decoration: none; }
#product a.ursu-pp-personalize em { font-size: 16px; line-height: 1; }
.product-labels .atelier-pp-badge { display: flex; justify-content: flex-end; }

.atelier-st {
	--st-accent: #1f4d3f;
	--st-accent-strong: #163a2f;
	--st-accent-soft: rgba(31, 77, 63, 0.08);
	--st-orange: #fc5f1a;
	--st-bd: #e6e8ec;
	--st-field: #d7dbe0;
	--st-text: #1f2733;
	--st-muted: #5f6672;
	--st-panel: #f5f6f8;
	--st-radius: 16px;
	--st-radius-sm: 8px;
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2vh 2vw;
	color: var(--st-text);
	font-size: 14px;
	line-height: 1.45;
}
.atelier-st[hidden] { display: none; }
.atelier-st *, .atelier-st *::before, .atelier-st *::after { box-sizing: border-box; }
body.atelier-st-open { overflow: hidden; }

.atelier-st__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, 0.55); }

.atelier-st__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1240px, 96vw);
	height: min(94vh, 1000px);
	background: #fff;
	border-radius: var(--st-radius);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	overflow: hidden;
}

.atelier-st__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--st-bd); }
.atelier-st__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.atelier-st__close {
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; margin: -6px -10px -6px 0;
	border: 0; border-radius: 50%; background: transparent; color: var(--st-text);
	font-size: 28px; line-height: 1; cursor: pointer;
}
.atelier-st__close:hover { background: var(--st-panel); }

.atelier-st__body { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr); min-height: 0; }

/* ---- Stage: the views, front above back ---- */
.atelier-st__stage { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 0; padding: 16px; background: var(--st-panel); overflow: auto; }
.atelier-st__views { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; margin: auto; }
.atelier-st__views.is-2 { max-width: min(440px, calc((94vh - 220px) / 2)); }
.atelier-st__view { position: relative; width: 100%; }
.atelier-st__view-frame { position: relative; width: 100%; padding-bottom: 100%; border-radius: 12px; overflow: hidden; background: #fff; }
.atelier-st__view-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.atelier-st__view.is-missing .atelier-st__view-frame { background: repeating-linear-gradient(45deg, #eef0f3, #eef0f3 10px, #f6f7f9 10px, #f6f7f9 20px); }
.atelier-st__view-label { position: absolute; top: 8px; left: 8px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.atelier-st__layer { position: absolute; inset: 0; }
.atelier-st__layer.is-dim .atelier-st__zone { display: none; }
.atelier-st__zone {
	position: absolute; padding: 0; margin: 0;
	border: 1px dashed rgba(31, 77, 63, 0.35); border-radius: 6px;
	background: transparent; cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, opacity 0.15s, visibility 0.15s;
}
.atelier-st__zone:hover, .atelier-st__zone:focus-visible, .atelier-st__zone.is-peek { background: var(--st-accent-soft); border-color: var(--st-accent); outline: none; }
.atelier-st__zone.is-active { border: 2px dashed var(--st-orange); }
.atelier-st__zone.is-taken { display: none; }
/* "Show all print areas" off: only the chosen area and the hovered/focused pill's area. */
.atelier-st__layer.is-quiet .atelier-st__zone:not(.is-active):not(.is-peek) { opacity: 0; visibility: hidden; pointer-events: none; }
.atelier-st__layer.is-dim .atelier-st__zone.is-peek:not(.is-taken) { display: block; }
.atelier-st__art { position: absolute; pointer-events: none; }
.atelier-st__art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.atelier-st__views[hidden] { display: none; }

.atelier-st__viewtabs { display: none; }

.atelier-st__result { position: relative; width: 100%; max-width: 640px; margin: auto; }
.atelier-st__result[hidden] { display: none; }
.atelier-st__result-img { display: block; width: 100%; max-height: calc(94vh - 200px); object-fit: contain; border-radius: 12px; background: #fff; cursor: zoom-in; }
.atelier-st__result-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.atelier-st__tool {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 40px; height: 40px; padding: 0 10px;
	border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.94); color: var(--st-text);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); cursor: pointer; text-decoration: none;
}
.atelier-st__tool--text { font-weight: 600; font-size: 13px; }

.atelier-st__busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: rgba(245, 246, 248, 0.86); text-align: center; z-index: 2; }
.atelier-st__busy[hidden] { display: none; }
.atelier-st__spin { width: 36px; height: 36px; border: 3px solid var(--st-bd); border-top-color: var(--st-accent); border-radius: 50%; animation: atelier-st-spin 0.9s linear infinite; }
@keyframes atelier-st-spin { to { transform: rotate(360deg); } }
.atelier-st__stage-note { margin: 10px 0 0; max-width: 560px; color: var(--st-muted); font-size: 12.5px; text-align: center; }
.atelier-st__stage-note:empty { display: none; }

/* ---- Panel ---- */
.atelier-st__panel { min-height: 0; overflow-y: auto; padding: 16px 20px 24px; }
.atelier-st__card { padding: 14px 0 16px; border-bottom: 1px solid var(--st-bd); }
.atelier-st__card[hidden] { display: none; }
.atelier-st__card:first-child { padding-top: 0; }
.atelier-st__card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.atelier-st__card-title { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.atelier-st__card-head .atelier-st__card-title { margin: 0; }
.atelier-st__counter { color: var(--st-muted); font-weight: 400; font-size: 13px; }
.atelier-st__field { margin-top: 10px; }
.atelier-st__label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--st-text); }
.atelier-st__sublabel { margin: 4px 0 4px; font-size: 12px; color: var(--st-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.atelier-st__help { margin: 4px 0 0; color: var(--st-muted); font-size: 12.5px; }
.atelier-st__help:empty { display: none; }
.atelier-st__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Garment swatches, restated from the page's circle look. */
.atelier-st__swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.atelier-st__swatch {
	position: relative; display: inline-flex; align-items: center; justify-content: center;
	min-width: 44px; height: 44px; padding: 0;
	border: 2px solid transparent; border-radius: 999px; background: #fff;
	box-shadow: 0 0 0 1px var(--st-field); cursor: pointer; overflow: hidden;
}
.atelier-st__swatch.is-colour { width: 44px; }
.atelier-st__swatch.is-colour img, .atelier-st__swatch.is-colour .ursu-pp-solid, .atelier-st__swatch-blank {
	display: block; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background-size: cover; background-position: center;
}
.atelier-st__swatch.is-text { padding: 0 14px; font-weight: 600; font-size: 13px; }
.atelier-st__swatch.is-on { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); }
.atelier-st__swatch.is-off { opacity: 0.45; }
.atelier-st__swatch.is-off::after { content: ''; position: absolute; left: 10%; right: 10%; top: 50%; border-top: 2px solid rgba(0, 0, 0, 0.5); transform: rotate(-35deg); }
.atelier-st__swatch[hidden] { display: none; }
.atelier-st__select { max-width: 280px; height: 44px; }

.atelier-st__qty { display: inline-flex; align-items: stretch; border: 1px solid var(--st-field); border-radius: 999px; overflow: hidden; }
.atelier-st__qty-btn { width: 44px; height: 44px; border: 0; background: #fff; font-size: 20px; cursor: pointer; }
.atelier-st__qty-btn:hover { background: var(--st-panel); }
.atelier-st__qty-input { width: 72px; height: 44px; border: 0; border-left: 1px solid var(--st-field); border-right: 1px solid var(--st-field); text-align: center; font-weight: 600; -moz-appearance: textfield; }
.atelier-st__qty-input::-webkit-inner-spin-button, .atelier-st__qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Elements */
.atelier-st__adds { display: flex; gap: 8px; }
.atelier-st__add {
	display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
	border: 1px solid var(--st-accent); border-radius: 999px; background: #fff; color: var(--st-accent);
	font-weight: 600; cursor: pointer;
}
.atelier-st__add:hover { background: var(--st-accent-soft); }
.atelier-st__add[disabled] { opacity: 0.4; cursor: not-allowed; }
.atelier-st__elements { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.atelier-st__el { border: 1px solid var(--st-bd); border-radius: 12px; background: #fff; }
.atelier-st__el.is-active { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); }
.atelier-st__el-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; }
.atelier-st__el-title { flex: 0 0 auto; padding: 8px 0; border: 0; background: none; font-weight: 600; cursor: pointer; color: var(--st-text); }
.atelier-st__el-sum { flex: 1 1 auto; min-width: 0; color: var(--st-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atelier-st__el-remove { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; color: var(--st-muted); cursor: pointer; }
.atelier-st__el-remove:hover { background: var(--st-panel); color: #b42318; }
/* Open / close an element's card (the title does the same) */
.atelier-st__el-toggle { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--st-muted); cursor: pointer; }
.atelier-st__el-toggle:hover { background: var(--st-panel); color: var(--st-text); }
.atelier-st__el-toggle svg { width: 18px; height: 18px; transition: transform 0.15s ease; }
.atelier-st__el-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.atelier-st__el-body { padding: 0 14px 14px; }
.atelier-st__warn { margin-top: 8px; color: #b45309; font-size: 12.5px; }
.atelier-st__warn:empty { display: none; }

.atelier-st__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.atelier-st__chip {
	min-height: 40px; padding: 6px 12px;
	border: 1px solid var(--st-field); border-radius: 999px; background: #fff; color: var(--st-text);
	font-size: 13px; cursor: pointer; text-align: left;
}
.atelier-st__chip:hover { border-color: var(--st-accent); }
.atelier-st__chip.is-on { border-color: var(--st-accent); background: var(--st-accent); color: #fff; }
.atelier-st__chip[disabled] { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.atelier-st__posgroup + .atelier-st__posgroup { margin-top: 6px; }

.atelier-st__upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.atelier-st__upload {
	display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
	border: 1px dashed var(--st-accent); border-radius: 10px; color: var(--st-accent); font-weight: 600; cursor: pointer; margin: 0;
}
.atelier-st__upload:hover, .atelier-st__upload:focus-visible { background: var(--st-accent-soft); outline: none; }
.atelier-st__logo-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 12px 12px; }
.atelier-st__logo-name { flex: 1 1 120px; min-width: 0; font-size: 12.5px; color: var(--st-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.atelier-st__textarea { resize: vertical; min-height: 44px; font-size: 15px; }
.atelier-st__text-count { text-align: right; }

.atelier-st__font { position: relative; display: flex; gap: 6px; }
.atelier-st__font-btn {
	flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
	height: 44px; padding: 0 14px; border: 1px solid var(--st-field); border-radius: 10px; background: #fff;
	font-size: 17px; cursor: pointer; color: var(--st-text);
}
.atelier-st__font-btn em { font-size: 12px; color: var(--st-muted); }
.atelier-st__font-list {
	position: absolute; z-index: 5; top: 48px; left: 0; right: 0; max-height: 300px; overflow-y: auto;
	margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--st-field); border-radius: 10px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.atelier-st__font-list[hidden] { display: none; }
.atelier-st__font-list:focus { outline: 2px solid var(--st-accent); outline-offset: 1px; }
.atelier-st__font-opt { padding: 9px 12px; border-radius: 8px; font-size: 18px; cursor: pointer; }
.atelier-st__font-opt small { font-family: inherit; font-size: 11px; color: var(--st-muted); }
.atelier-st__font-opt.is-focus, .atelier-st__font-opt:hover { background: var(--st-accent-soft); }
.atelier-st__font-opt.is-on { font-weight: 600; box-shadow: inset 3px 0 0 var(--st-accent); }
.atelier-st__font-opt.is-off { opacity: 0.45; cursor: not-allowed; }
.atelier-st__bold { flex: 0 0 44px; height: 44px; border: 1px solid var(--st-field); border-radius: 10px; background: #fff; cursor: pointer; font-size: 16px; }
.atelier-st__bold.is-on { background: var(--st-accent); border-color: var(--st-accent); color: #fff; }

.atelier-st__colours { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.atelier-st__colour {
	position: relative; width: 36px; height: 36px; margin: 0; padding: 0;
	border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--st-field); cursor: pointer;
}
.atelier-st__colour.is-on { box-shadow: 0 0 0 2px var(--st-accent); }
.atelier-st__colour--custom { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); overflow: hidden; }
.atelier-st__colour--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.atelier-st__hex { width: 96px; height: 36px; font-family: monospace; text-transform: uppercase; }

.atelier-st__methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.atelier-st__method {
	display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; padding: 8px 12px;
	border: 1px solid var(--st-field); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; color: var(--st-text);
}
.atelier-st__method:hover { border-color: var(--st-accent); }
.atelier-st__method.is-on { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); background: var(--st-accent-soft); }
.atelier-st__method-name { font-weight: 600; font-size: 13.5px; }
.atelier-st__method-price { font-size: 12px; color: var(--st-muted); }
.atelier-st__method.is-quote .atelier-st__method-price { color: var(--st-orange); }

.atelier-st__price-rows { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.atelier-st__price-rows dt { font-weight: 400; color: var(--st-muted); }
.atelier-st__price-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.atelier-st__price-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--st-bd); font-size: 15px; }
.atelier-st__price-total.is-sum { border-top: 0; margin-top: 0; padding-top: 2px; font-size: 14px; color: var(--st-muted); }
.atelier-st__quote-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff4ed; color: #9a3412; font-size: 13px; }
.atelier-st__quote-phone { margin: 6px 0 0; font-weight: 600; }
.atelier-st__disclaimer { margin: 14px 0 0; color: var(--st-muted); font-size: 12px; }

/* ---- Footer ---- */
.atelier-st__head, .atelier-st__foot { flex: 0 0 auto; }
.atelier-st__foot { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--st-bd); background: #fff; flex-wrap: wrap; }
.atelier-st__msg:empty { display: none; }
.atelier-st__foot-price { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.atelier-st__msg { flex: 1 1 200px; min-width: 0; font-size: 13px; }
.atelier-st__msg.is-error { color: #b42318; }
.atelier-st__msg.is-success { color: #067647; }
.atelier-st__msg.is-info { color: var(--st-muted); }
.atelier-st__actions { display: flex; gap: 8px; margin-left: auto; }
.atelier-st__btn { min-height: 46px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 14.5px; }
.atelier-st__btn[hidden] { display: none; }
.atelier-st__btn--primary { background: var(--st-accent) !important; border: 1px solid var(--st-accent) !important; color: #fff !important; }
.atelier-st__btn--primary:hover { background: var(--st-accent-strong) !important; }
.atelier-st__btn--ghost { background: #fff !important; border: 1px solid var(--st-accent) !important; color: var(--st-accent) !important; }
.atelier-st__btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Above every layer inside the dialog (font list 5, sticky stage, view tabs). */
.atelier-st__zoom { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; background: rgba(17, 24, 39, 0.92); cursor: zoom-out; }
.atelier-st__zoom[hidden] { display: none; }
.atelier-st__zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.atelier-st__zoom-close { position: absolute; top: 12px; right: 18px; color: #fff; }

.atelier-st button:focus-visible, .atelier-st a:focus-visible, .atelier-st input:focus-visible, .atelier-st textarea:focus-visible, .atelier-st select:focus-visible {
	outline: 2px solid var(--st-orange); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.atelier-st__spin { animation-duration: 2.5s; }
	.atelier-st__zone { transition: none; }
	.atelier-st__el-toggle svg { transition: none; }
}

/* ---- Phones: a full-screen sheet, the picture sticky on top ---- */
@media (max-width: 768px) {
	.atelier-st { padding: 0; }
	.atelier-st__dialog { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
	.atelier-st__head { padding: 8px 12px 8px 16px; }
	.atelier-st__body { display: block; overflow-y: auto; }
	.atelier-st__stage { position: sticky; top: 0; z-index: 2; height: 40vh; height: 40dvh; padding: 8px; overflow: hidden; }
	.atelier-st__views, .atelier-st__views.is-2 { height: 100%; max-width: none; align-items: center; }
	.atelier-st__view { height: 100%; width: auto; aspect-ratio: 1 / 1; }
	.atelier-st__view-frame { height: 100%; padding-bottom: 0 !important; }
	.atelier-st__views.is-2.show-front .atelier-st__view[data-view="back"],
	.atelier-st__views.is-2.show-back .atelier-st__view[data-view="front"] { display: none; }
	.atelier-st__viewtabs:not([hidden]) { display: flex; gap: 4px; position: absolute; top: 10px; right: 10px; z-index: 3; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); }
	.atelier-st__viewtab { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; font-size: 12px; font-weight: 600; }
	.atelier-st__viewtab.is-active { background: var(--st-accent); color: #fff; }
	.atelier-st__result-img { max-height: calc(40dvh - 24px); }
	.atelier-st__stage-note { display: none; }
	.atelier-st__panel { overflow: visible; padding: 12px 16px 24px; }
	.atelier-st__foot { position: sticky; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
	.atelier-st__actions { width: 100%; }
	.atelier-st__btn { flex: 1 1 0; padding: 0 12px; }
	.atelier-st__font-list { position: fixed; top: auto; bottom: 0; left: 0; right: 0; max-height: 55vh; border-radius: 16px 16px 0 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
