/* ==========================================================================
   STC – Configurateur t-shirt
   Fond teinté (pas de blanc pur), accent turquoise de la marque.
   ========================================================================== */

.stc-tshirt {
	--stc-accent: #159a91;
	--stc-accent-strong: #0f7a73;
	--stc-accent-soft: #d7efec;
	--stc-bg: #eef5f4;
	--stc-surface: #f8fbfa;
	--stc-border: #cfdedc;
	--stc-text: #1f2d2c;
	--stc-muted: #5b6e6c;
	--stc-danger: #c0392b;
	--stc-warning: #9a6700;
	--stc-radius: 14px;
	--stc-radius-sm: 8px;
	--stc-shadow: 0 1px 2px rgb(15 40 38 / 0.06), 0 4px 16px rgb(15 40 38 / 0.06);
	--stc-shirt: #f4f4f2;

	max-width: 1180px;
	margin-inline: auto;
	color: var(--stc-text);
	font-size: 15px;
	line-height: 1.45;
	container-type: inline-size; /* la mise en page suit la place réelle, pas la largeur de l'écran */
}

.stc-tshirt__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
}

@container (min-width: 860px) {
	.stc-tshirt__layout {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		align-items: start;
	}

	.stc-tshirt__viewer {
		position: sticky;
		top: 1rem;
	}
}

.stc-tshirt *,
.stc-tshirt *::before,
.stc-tshirt *::after {
	box-sizing: border-box;
}

.stc-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.stc-tshirt :focus-visible {
	outline: 3px solid var(--stc-accent);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Aperçu 3D
   -------------------------------------------------------------------------- */

.stc-tshirt__viewer {
	position: relative;
	aspect-ratio: 1 / 1;
	background: radial-gradient(circle at 50% 40%, #f6faf9 0%, var(--stc-bg) 70%);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius);
	box-shadow: var(--stc-shadow);
	overflow: hidden;
}

.stc-tshirt__canvas {
	display: block;
	width: 100%;
	height: 100%;
	cursor: grab;
	touch-action: none; /* la rotation au doigt ne fait pas défiler la page */
}

.stc-tshirt__canvas:active {
	cursor: grabbing;
}

.stc-tshirt__status,
.stc-tshirt__hint-3d {
	position: absolute;
	left: 0;
	right: 0;
	margin: 0;
	text-align: center;
	pointer-events: none;
}

.stc-tshirt__status {
	top: 50%;
	transform: translateY(-50%);
	font-weight: 600;
}

.stc-tshirt__credit {
	position: absolute;
	top: 0.5rem;
	right: 0.75rem;
	margin: 0;
	font-size: 0.7rem;
	color: var(--stc-muted);
	pointer-events: none;
}

.stc-tshirt__status[hidden] {
	display: none;
}

.stc-tshirt__hint-3d {
	bottom: 0.75rem;
	width: fit-content;
	max-width: calc(100% - 2rem);
	margin-inline: auto;
	padding: 0.3rem 0.75rem;
	color: var(--stc-muted);
	font-size: 0.85rem;
	background: rgb(248 251 250 / 0.85);
	border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Studio (panneau de droite)
   -------------------------------------------------------------------------- */

.stc-tshirt__studio {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1rem;
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius);
	box-shadow: var(--stc-shadow);
}

.stc-heading {
	display: block;
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--stc-muted);
}

/* Onglets Devant / Dos */

/* Choix de la zone : 1 à 6 boutons, sur 2 ou 3 colonnes selon la place */
.stc-tshirt__tabs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
	gap: 4px;
	padding: 4px;
	background: var(--stc-bg);
	border-radius: 12px;
}

.stc-tshirt__tab {
	position: relative;
	padding: 0.5rem 0.75rem;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--stc-muted);
	background: transparent;
	border: 0;
	border-radius: 9px;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.stc-tshirt__tab[aria-selected="true"] {
	color: var(--stc-text);
	background: var(--stc-surface);
	box-shadow: 0 1px 3px rgb(15 40 38 / 0.15);
}

/* Pastille : cette zone contient déjà quelque chose (elle sera imprimée). */
.stc-tshirt__tab.has-print::after {
	content: "";
	position: absolute;
	top: 6px;
	right: 6px;
	width: 7px;
	height: 7px;
	background: var(--stc-accent);
	border-radius: 50%;
}

/* Zone d'impression : couleur du t-shirt, cadre de la feuille */

.stc-tshirt__editor {
	padding: 1.25rem;
	background: var(--stc-bg);
	border-radius: var(--stc-radius-sm);
}

.stc-tshirt__area {
	position: relative;
	width: min(100%, 340px);
	max-height: 480px;
	aspect-ratio: 200 / 280;
	margin: 0 auto;
	background: var(--stc-shirt);
	border-radius: 2px;
	transition: background-color 0.2s;
}

/* Cadre de la feuille, par-dessus l'éditeur, contrasté selon le t-shirt. */
.stc-tshirt__area::before {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px dashed rgb(31 45 44 / 0.35);
	border-radius: 2px;
	pointer-events: none;
	z-index: 2;
}

.stc-tshirt[data-shirt-tone="dark"] .stc-tshirt__area::before {
	border-color: rgb(255 255 255 / 0.45);
}

.stc-tshirt__area::after {
	content: attr(data-label);
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 0.4rem;
	text-align: center;
	font-size: 0.75rem;
	color: var(--stc-muted);
}

.stc-tshirt__face[hidden] {
	display: none;
}

.stc-tshirt__empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	margin: 0;
	padding: 1rem;
	text-align: center;
	font-size: 0.9rem;
	color: rgb(31 45 44 / 0.55);
	pointer-events: none;
	z-index: 1;
}

.stc-tshirt[data-shirt-tone="dark"] .stc-tshirt__empty {
	color: rgb(255 255 255 / 0.65);
}

.stc-tshirt__empty[hidden] {
	display: none;
}

.stc-tshirt__editor .canvas-container {
	touch-action: none;
}

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */

.stc-icon {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex: none;
}

.stc-tshirt__add {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
}

.stc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.7rem 0.9rem;
	font: inherit;
	font-weight: 600;
	border: 1px solid transparent;
	border-radius: var(--stc-radius-sm);
	cursor: pointer;
	transition: background-color 0.15s, transform 0.1s;
}

.stc-btn:active {
	transform: translateY(1px);
}

.stc-btn--primary {
	color: #fff;
	background: var(--stc-accent);
}

.stc-btn--primary:hover {
	background: var(--stc-accent-strong);
}

.stc-btn:focus-within {
	outline: 3px solid var(--stc-accent);
	outline-offset: 2px;
}

.stc-tshirt__hint {
	margin: -0.5rem 0 0;
	font-size: 0.8rem;
	color: var(--stc-muted);
}

.stc-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
}

.stc-toolbar__sep {
	width: 1px;
	height: 24px;
	margin: 0 0.25rem;
	background: var(--stc-border);
}

.stc-icon-btn {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	font: inherit;
	font-size: 1rem;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius-sm);
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.stc-icon-btn:hover {
	background: var(--stc-accent-soft);
	border-color: var(--stc-accent);
}

.stc-icon-btn[aria-pressed="true"] {
	color: #fff;
	background: var(--stc-accent);
	border-color: var(--stc-accent);
}

.stc-icon-btn--bold {
	font-weight: 800;
}

.stc-icon-btn--italic {
	font-style: italic;
	font-family: Georgia, serif;
}

.stc-icon-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.stc-icon-btn--danger:hover {
	color: #fff;
	background: var(--stc-danger);
	border-color: var(--stc-danger);
}

/* --------------------------------------------------------------------------
   Sélection
   -------------------------------------------------------------------------- */

.stc-tshirt__selection {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 0.85rem;
	background: var(--stc-bg);
	border-radius: var(--stc-radius-sm);
}

.stc-tshirt__selection[hidden],
.stc-tshirt__text-tools[hidden] {
	display: none;
}

.stc-tshirt__text-tools {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.stc-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0;
}

.stc-field__label {
	font-size: 0.85rem;
	font-weight: 600;
}

.stc-select {
	width: 100%;
	padding: 0.55rem 0.7rem;
	font: inherit;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius-sm);
}

.stc-quality {
	margin-left: auto;
	padding: 0.25rem 0.6rem;
	font-size: 0.8rem;
	font-weight: 600;
	border-radius: 999px;
}

.stc-quality[hidden] {
	display: none;
}

.stc-quality[data-level="good"] {
	color: #0f6b4f;
	background: #d6f1e6;
}

.stc-quality[data-level="ok"] {
	color: var(--stc-warning);
	background: #fbefd2;
}

.stc-quality[data-level="low"] {
	color: var(--stc-danger);
	background: #f8dcd8;
}

/* --------------------------------------------------------------------------
   Pastilles de couleur
   -------------------------------------------------------------------------- */

.stc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.stc-swatch {
	position: relative;
	width: 34px;
	height: 34px;
	padding: 0;
	background: var(--swatch);
	border: 1px solid rgb(31 45 44 / 0.25);
	border-radius: 50%;
	cursor: pointer;
	transition: transform 0.1s;
}

.stc-swatches--small .stc-swatch {
	width: 28px;
	height: 28px;
}

.stc-swatch:hover {
	transform: scale(1.08);
}

.stc-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 2px var(--stc-surface), 0 0 0 4px var(--stc-accent);
}

.stc-swatch--custom {
	display: inline-grid;
	place-items: center;
	overflow: hidden;
	background: conic-gradient(#e63946, #ffd23f, #2a9d8f, #3a86ff, #8338ec, #e63946);
}

.stc-swatch--custom input {
	width: 150%;
	height: 150%;
	padding: 0;
	border: 0;
	opacity: 0;
	cursor: pointer;
}

.stc-tshirt__paper {
	margin: 0.5rem 0 0;
	font-size: 0.85rem;
	color: var(--stc-muted);
}

/* --------------------------------------------------------------------------
   Calques
   -------------------------------------------------------------------------- */

.stc-tshirt__layers {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.stc-layer--empty {
	font-size: 0.85rem;
	color: var(--stc-muted);
}

.stc-layer__btn {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	padding: 0.5rem 0.7rem;
	font: inherit;
	text-align: left;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius-sm);
	cursor: pointer;
}

.stc-layer__btn::before {
	content: "";
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 5px;
	background: var(--stc-accent-soft) center / 14px no-repeat;
}

.stc-layer__btn[data-kind="image"]::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f7a73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-5-5L5 21'/%3E%3C/svg%3E");
}

.stc-layer__btn[data-kind="text"]::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f7a73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7V4h16v3M9 20h6M12 4v16'/%3E%3C/svg%3E");
}

.stc-layer__btn:hover {
	border-color: var(--stc-accent);
}

.stc-layer__btn[aria-current="true"] {
	background: var(--stc-accent-soft);
	border-color: var(--stc-accent);
	font-weight: 600;
}

.stc-layer__label {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Votre t-shirt : modèle, couleur, tailles et quantités
   -------------------------------------------------------------------------- */

.stc-tshirt__product {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--stc-border);
}

.stc-tshirt__product .stc-heading {
	margin: 0;
}

.stc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.stc-chip {
	padding: 0.5rem 0.85rem;
	font: inherit;
	font-size: 0.9rem;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: 999px;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.stc-chip:hover {
	border-color: var(--stc-accent);
}

.stc-chip[aria-pressed="true"] {
	color: #fff;
	background: var(--stc-accent);
	border-color: var(--stc-accent);
	font-weight: 600;
}

.stc-tshirt__color-name {
	font-weight: 400;
	color: var(--stc-muted);
}

.stc-sizes {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
	gap: 0.5rem;
}

.stc-size {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	padding: 0.6rem 0.5rem;
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius-sm);
	transition: border-color 0.15s, background-color 0.15s;
}

.stc-size.is-active {
	background: var(--stc-accent-soft);
	border-color: var(--stc-accent);
}

.stc-size__label {
	font-weight: 700;
}

.stc-stepper {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.stc-stepper__btn {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	padding: 0;
	font: inherit;
	font-size: 1.1rem;
	line-height: 1;
	color: var(--stc-text);
	background: var(--stc-bg);
	border: 1px solid var(--stc-border);
	border-radius: 50%;
	cursor: pointer;
}

.stc-stepper__btn:hover:not(:disabled) {
	border-color: var(--stc-accent);
}

.stc-stepper__btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.stc-stepper__input {
	width: 3rem;
	padding: 0.25rem;
	font: inherit;
	font-weight: 600;
	text-align: center;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: 6px;
	-moz-appearance: textfield;
	appearance: textfield;
}

.stc-stepper__input::-webkit-outer-spin-button,
.stc-stepper__input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.stc-total {
	margin: 0.25rem 0 0;
	font-weight: 700;
}

.stc-total[data-empty="true"] {
	font-weight: 400;
	color: var(--stc-muted);
}

.stc-range {
	width: 100%;
	accent-color: var(--stc-accent);
}

.stc-curve__value {
	font-weight: 400;
	color: var(--stc-muted);
}

/* Prix indicatif */
.stc-price {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin-top: 0.5rem;
	padding: 0.85rem 1rem;
	background: var(--stc-bg);
	border-radius: var(--stc-radius-sm);
}

.stc-price[hidden] {
	display: none;
}

.stc-price__row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	font-size: 0.92rem;
}

.stc-price__row strong {
	font-weight: 600;
	text-align: right;
}

.stc-price__row.is-total {
	margin-top: 0.25rem;
	padding-top: 0.5rem;
	font-size: 1.1rem;
	border-top: 1px solid var(--stc-border);
}

.stc-price__row.is-total strong {
	font-weight: 800;
	color: var(--stc-accent-strong);
}

.stc-price__hint {
	font-weight: 400;
	color: var(--stc-muted);
}

.stc-price__note {
	margin: 0.35rem 0 0;
	font-size: 0.8rem;
	color: var(--stc-muted);
}

/* --------------------------------------------------------------------------
   Demande de devis
   -------------------------------------------------------------------------- */

.stc-tshirt__quote {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	padding-top: 1rem;
	border-top: 1px solid var(--stc-border);
}

.stc-tshirt__quote[hidden],
.stc-tshirt__done[hidden],
.stc-progress[hidden] {
	display: none;
}

.stc-tshirt__quote .stc-heading {
	margin: 0;
}

.stc-form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.85rem;
}

.stc-input {
	width: 100%;
	padding: 0.6rem 0.7rem;
	font: inherit;
	color: var(--stc-text);
	background: var(--stc-surface);
	border: 1px solid var(--stc-border);
	border-radius: var(--stc-radius-sm);
}

.stc-input:focus {
	border-color: var(--stc-accent);
}

textarea.stc-input {
	resize: vertical;
}

.stc-optional {
	font-weight: 400;
	color: var(--stc-muted);
}

/* Pot de miel : hors écran, pas « display:none » (certains robots l'ignorent). */
.stc-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.stc-check {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	font-size: 0.9rem;
}

.stc-check input {
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 0.15rem;
	accent-color: var(--stc-accent);
}

.stc-check a {
	color: var(--stc-accent-strong);
}

.stc-btn--block {
	width: 100%;
	padding: 0.85rem 1rem;
	font-size: 1rem;
}

.stc-btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.stc-btn--ghost {
	color: var(--stc-accent-strong);
	background: transparent;
	border-color: var(--stc-accent);
}

.stc-progress {
	height: 6px;
	overflow: hidden;
	background: var(--stc-bg);
	border-radius: 999px;
}

.stc-progress__bar {
	height: 100%;
	background: var(--stc-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.25s;
}

.stc-quote__status {
	margin: 0;
	font-size: 0.9rem;
	color: var(--stc-muted);
}

.stc-quote__status:empty {
	display: none;
}

.stc-quote__status[data-type="error"] {
	padding: 0.7rem 0.9rem;
	color: var(--stc-danger);
	background: #f8dcd8;
	border-radius: var(--stc-radius-sm);
}

.stc-tshirt__done {
	padding: 1.25rem;
	text-align: center;
	background: #d6f1e6;
	border-radius: var(--stc-radius-sm);
}

.stc-tshirt__done p {
	margin: 0 0 0.75rem;
}

.stc-tshirt__done-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: #0f6b4f;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.stc-tshirt__message {
	margin: 0;
	padding: 0.7rem 0.9rem;
	font-size: 0.9rem;
	border-radius: var(--stc-radius-sm);
	color: var(--stc-warning);
	background: #fbefd2;
}

.stc-tshirt__message[data-type="error"] {
	color: var(--stc-danger);
	background: #f8dcd8;
}

.stc-tshirt__message[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.stc-tshirt * {
		transition: none !important;
	}
}
