/* Diafano — personalizador. Usa os tokens do tema quando existem. */
.dfn-product {
	--dfn-accent: var(--accent, #b8496f);
	--dfn-accent-2: var(--rose, #e0779a);
	--dfn-blush: var(--blush, #fde8ef);
	--dfn-ink: var(--ink, #2a2628);
	--dfn-muted: var(--muted, #6e6468);
	--dfn-line: var(--line, #efdfe5);
	--dfn-soft: var(--bg-soft, #fff7f9);
	--dfn-r: 14px;
}

/* ------------------------------------------------------------ palco */
.dfn-stage { position: sticky; top: 96px; align-self: start; }
.dfn-stage__canvas {
	position: relative; border-radius: 22px; overflow: hidden;
	background: radial-gradient(120% 80% at 50% 10%, #fff 0%, var(--dfn-blush) 100%);
	border: 1px solid var(--dfn-line); aspect-ratio: 600 / 660; touch-action: none;
}
.dfn-stage__canvas .canvas-container { margin: 0 auto; }
.dfn-stage.is-drop .dfn-stage__canvas { outline: 3px dashed var(--dfn-accent); outline-offset: -10px; }
.dfn-stage__loading {
	position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
	color: var(--dfn-muted); font-size: .9rem; background: var(--dfn-soft);
}
.dfn-stage__loading[hidden] { display: none; }
.dfn-stage__loading span {
	width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--dfn-line); border-top-color: var(--dfn-accent);
	animation: dfn-spin .8s linear infinite;
}
@keyframes dfn-spin { to { transform: rotate(360deg); } }

.dfn-toolbar {
	position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
	display: flex; align-items: center; gap: 2px; padding: 6px; max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center;
	background: rgba(255, 255, 255, .96); border: 1px solid var(--dfn-line); border-radius: 14px;
	box-shadow: 0 10px 30px rgba(90, 42, 58, .14); backdrop-filter: blur(8px);
}
.dfn-toolbar[hidden] { display: none; }
.dfn-toolbar button {
	all: unset; box-sizing: border-box; cursor: pointer; min-width: 34px; height: 34px; padding: 0 8px;
	display: inline-grid; place-items: center; border-radius: 9px; color: var(--dfn-ink); font-weight: 700; font-size: 1.05rem;
}
.dfn-toolbar button:hover, .dfn-toolbar button:focus-visible { background: var(--dfn-blush); }
.dfn-toolbar button:focus-visible { outline: 2px solid var(--dfn-accent); }
.dfn-toolbar button.is-danger { color: #b3261e; }
.dfn-toolbar button[hidden] { display: none; }
.dfn-toolbar .dfn-toolbar__nobg { font-size: .74rem; font-weight: 600; border: 1px solid var(--dfn-line); }
.dfn-toolbar .dfn-toolbar__nobg.is-on { background: var(--dfn-accent); border-color: var(--dfn-accent); color: #fff; }
.dfn-toolbar input[type=range] { width: 110px; accent-color: var(--dfn-accent); }
.dfn-toolbar__sep { width: 1px; height: 22px; background: var(--dfn-line); margin: 0 4px; }
.dfn-stage__size {
	position: absolute; top: 12px; left: 12px; margin: 0; padding: 5px 10px; border-radius: 99px;
	background: rgba(42, 38, 40, .82); color: #fff; font-size: .76rem; font-weight: 600; letter-spacing: .01em;
}
.dfn-stage__size[hidden] { display: none; }

.dfn-views { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.dfn-view {
	all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: grid; justify-items: center; gap: 4px;
	padding: 8px 6px; border-radius: 14px; border: 1.5px solid var(--dfn-line); background: #fff; transition: border-color .15s, box-shadow .15s;
}
.dfn-view:hover { border-color: var(--dfn-accent-2); }
.dfn-view:focus-visible { outline: 2px solid var(--dfn-accent); outline-offset: 2px; }
.dfn-view.is-active { border-color: var(--dfn-accent); box-shadow: 0 0 0 3px rgba(184, 73, 111, .12); }
.dfn-view__img { width: 100%; aspect-ratio: 600 / 660; display: block; }
.dfn-view__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dfn-view__label { font-size: .74rem; font-weight: 600; color: var(--dfn-ink); text-align: center; line-height: 1.2; }
.dfn-view__count {
	position: absolute; top: 6px; right: 6px; min-width: 20px; height: 20px; border-radius: 99px; padding: 0 6px;
	background: var(--dfn-accent); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}
.dfn-view__count[hidden] { display: none; }
.dfn-stage__hint { display: flex; gap: 8px; align-items: flex-start; margin: 12px 2px 0; font-size: .8rem; color: var(--dfn-muted); line-height: 1.45; }
.dfn-stage__hint .dfn-i { flex: none; width: 16px; height: 16px; margin-top: 1px; }

/* ------------------------------------------------------------ formulário */
.dfn-form { margin-top: 8px; display: grid; gap: 14px; }
.dfn-step { border: 1px solid var(--dfn-line); border-radius: var(--dfn-r); padding: 18px; background: #fff; }
.dfn-step h3 {
	display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 1rem; font-weight: 700; color: var(--dfn-ink); letter-spacing: 0;
}
.dfn-step h3 > span {
	width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
	background: var(--dfn-blush); color: var(--dfn-accent); font-size: .8rem; font-weight: 800;
}
.dfn-step h3 em { margin-left: auto; font-style: normal; font-weight: 500; font-size: .82rem; color: var(--dfn-muted); }

.dfn-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.dfn-swatch {
	all: unset; box-sizing: border-box; cursor: pointer; width: 36px; height: 36px; border-radius: 50%;
	background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); position: relative; transition: transform .12s;
}
.dfn-swatch:hover { transform: scale(1.08); }
.dfn-swatch:focus-visible { outline: 2px solid var(--dfn-accent); outline-offset: 3px; }
.dfn-swatch.is-active::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--dfn-accent); }

.dfn-tools { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.dfn-tool {
	all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px;
	border-radius: 12px; border: 1.5px solid var(--dfn-line); background: #fff; color: var(--dfn-ink); transition: border-color .15s, background .15s;
}
.dfn-tool:hover { border-color: var(--dfn-accent-2); background: var(--dfn-soft); }
.dfn-tool:focus-visible { outline: 2px solid var(--dfn-accent); outline-offset: 2px; }
.dfn-tool .dfn-i { flex: none; color: var(--dfn-accent); }
.dfn-tool span { display: grid; line-height: 1.2; }
.dfn-tool b { font-size: .88rem; }
.dfn-tool small { font-size: .72rem; color: var(--dfn-muted); }
.dfn-tool--primary { background: var(--dfn-accent); border-color: var(--dfn-accent); color: #fff; }
.dfn-tool--primary .dfn-i, .dfn-tool--primary small { color: rgba(255, 255, 255, .88); }
.dfn-tool--primary:hover { background: #a33d61; border-color: #a33d61; }

.dfn-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: .8rem; color: var(--dfn-muted); }
.dfn-presets[hidden] { display: none; }
.dfn-presets > div { display: contents; }
.dfn-presets button {
	all: unset; cursor: pointer; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--dfn-line); background: var(--dfn-soft);
	color: var(--dfn-ink); font-size: .78rem; font-weight: 600;
}
.dfn-presets button:hover, .dfn-presets button:focus-visible { border-color: var(--dfn-accent); color: var(--dfn-accent); }

.dfn-text-edit { display: grid; grid-template-columns: 1fr auto 44px; gap: 8px; margin-top: 12px; }
.dfn-text-edit[hidden] { display: none; }
.dfn-text-edit input[type=text], .dfn-text-edit select {
	height: 42px; border: 1.5px solid var(--dfn-line); border-radius: 10px; padding: 0 12px; font: inherit; font-size: .9rem; background: #fff; min-width: 0;
}
.dfn-text-edit input[type=color] { width: 44px; height: 42px; border: 1.5px solid var(--dfn-line); border-radius: 10px; padding: 4px; background: #fff; }

.dfn-placed { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.dfn-placed:empty { display: none; }
.dfn-placed li { display: flex; align-items: stretch; border: 1px solid var(--dfn-line); border-radius: 10px; overflow: hidden; }
.dfn-placed li.is-active { border-color: var(--dfn-accent); }
.dfn-placed__go { all: unset; cursor: pointer; flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; padding: 8px 12px; font-size: .82rem; }
.dfn-placed__go b { color: var(--dfn-accent); white-space: nowrap; }
.dfn-placed__go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dfn-ink); }
.dfn-placed__rm { all: unset; cursor: pointer; width: 38px; text-align: center; color: var(--dfn-muted); font-size: 1.2rem; }
.dfn-placed__rm:hover { background: #fdecec; color: #b3261e; }

.dfn-sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.dfn-size { display: grid; gap: 4px; text-align: center; }
.dfn-size span { font-size: .78rem; font-weight: 700; color: var(--dfn-muted); }
.dfn-size input {
	width: 100%; height: 44px; text-align: center; border: 1.5px solid var(--dfn-line); border-radius: 10px; font: inherit; font-weight: 700;
	font-size: 1rem; -moz-appearance: textfield; background: #fff;
}
.dfn-size input::-webkit-outer-spin-button, .dfn-size input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dfn-size input:focus { outline: none; border-color: var(--dfn-accent); box-shadow: 0 0 0 3px rgba(184, 73, 111, .14); }
.dfn-size.has-qty input { border-color: var(--dfn-accent); background: var(--dfn-soft); color: var(--dfn-accent); }
.dfn-note { margin: 10px 0 0; font-size: .8rem; color: var(--dfn-muted); }
.dfn-tiers { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dfn-tiers li { padding: 5px 10px; border-radius: 99px; background: var(--dfn-soft); border: 1px dashed var(--dfn-line); font-size: .76rem; color: var(--dfn-muted); }
.dfn-tiers li b { color: var(--dfn-accent); }
.dfn-tiers li.is-on { background: var(--dfn-accent); border-color: var(--dfn-accent); color: #fff; }
.dfn-tiers li.is-on b { color: #fff; }

.dfn-step textarea {
	width: 100%; border: 1.5px solid var(--dfn-line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .9rem; resize: vertical; box-sizing: border-box;
}
.dfn-step textarea:focus { outline: none; border-color: var(--dfn-accent); }
.dfn-attach {
	position: relative; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px; cursor: pointer;
	border: 1.5px dashed var(--dfn-line); border-radius: 12px; color: var(--dfn-ink);
}
.dfn-attach:hover, .dfn-attach:focus-within { border-color: var(--dfn-accent); background: var(--dfn-soft); }
.dfn-attach .dfn-i { color: var(--dfn-accent); flex: none; }
.dfn-attach span { display: grid; line-height: 1.25; }
.dfn-attach b { font-size: .85rem; }
.dfn-attach small { font-size: .72rem; color: var(--dfn-muted); }
.dfn-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dfn-attached { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: .8rem; }
.dfn-attached li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--dfn-soft); border-radius: 8px; }
.dfn-attached button { all: unset; cursor: pointer; color: var(--dfn-muted); }
.dfn-later { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .85rem; color: var(--dfn-ink); cursor: pointer; }
.dfn-later input { accent-color: var(--dfn-accent); width: 18px; height: 18px; }

/* ------------------------------------------------------------ resumo */
.dfn-summary { border-radius: var(--dfn-r); padding: 18px; background: var(--dfn-soft); border: 1px solid var(--dfn-line); }
.dfn-summary dl { margin: 0 0 14px; display: grid; gap: 8px; }
.dfn-summary dl > div { display: flex; justify-content: space-between; gap: 16px; font-size: .88rem; }
.dfn-summary dl > div[hidden] { display: none; }
.dfn-summary dt { color: var(--dfn-muted); }
.dfn-summary dd { margin: 0; font-weight: 600; color: var(--dfn-ink); text-align: right; }
.dfn-summary dd s { color: var(--dfn-muted); font-weight: 400; margin-right: 4px; }
.dfn-summary__disc dd { color: #1f7a45; }
.dfn-summary__total { padding-top: 10px; border-top: 1px solid var(--dfn-line); }
.dfn-summary__total dt { color: var(--dfn-ink); font-weight: 700; }
.dfn-summary__total dd { font-size: 1.35rem; font-weight: 800; color: var(--dfn-accent); }
.dfn-summary__fine { margin: 12px 0 0; font-size: .75rem; color: var(--dfn-muted); line-height: 1.5; }
.dfn-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fdecec; color: #8c1d18; font-size: .85rem; }
.dfn-error[hidden] { display: none; }
.dfn-form .dfn-submit { width: 100%; position: relative; }
.dfn-submit__busy { display: none; }
.dfn-submit.is-busy .dfn-submit__label { display: none; }
.dfn-submit.is-busy .dfn-submit__busy { display: inline; }
.dfn-submit.is-busy { opacity: .8; cursor: progress; }

/* ------------------------------------------------------------ preço / carrinho */
.dfn-from, .dfn-per { font-size: .62em; font-weight: 500; color: var(--muted, #6e6468); }
.dfn-cart-qty { font-weight: 600; white-space: nowrap; }
.dfn-cart-thumb { border-radius: 10px; background: var(--blush, #fde8ef); }

@media (max-width: 900px) {
	.dfn-stage { position: relative; top: 0; }
	.dfn-tools { grid-template-columns: 1fr 1fr; }
	.dfn-tool--primary { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
	.dfn-step { padding: 14px; }
	.dfn-views { gap: 6px; }
	.dfn-view__label { font-size: .68rem; }
	.dfn-toolbar input[type=range] { width: 70px; }
	.dfn-text-edit { grid-template-columns: 1fr 44px; }
	.dfn-text-edit select { grid-column: 1 / -1; grid-row: 2; }
}

/* ------------------------------------------------------------ atalhos do celular */
.dfn-empty-cta, .dfn-quick, .dfn-mbar { display: none; }

@media (max-width: 960px) {
	/* Ordem compacta: título e preço → peça → formulário → descrição. */
	.dfn-page .content-area > .wrap > .breadcrumb { display: none; }
	.dfn-page.single-product .content-area { padding-top: 14px; }
	.dfn-product .product-top { display: flex; flex-direction: column; gap: 0; }
	.dfn-product .summary { display: contents; }
	.dfn-product .summary .product-cats { display: none; }
	.dfn-product .summary .product_title { order: 1; font-size: 1.45rem; margin: 0 0 2px; }
	.dfn-product .summary > .price { order: 2; font-size: 1.15rem; margin: 0; line-height: 1.3; }
	.dfn-product .summary .installment-prices-for-woocommerce { order: 3; margin: 0 0 12px; }
	.dfn-product .summary .installment-prices-for-woocommerce .price { font-size: .85rem !important; font-weight: 500; color: var(--dfn-muted); margin: 0; }
	.dfn-product .dfn-stage { order: 4; align-self: stretch; width: 100%; min-width: 0; }
	.dfn-product .dfn-form { order: 5; margin-top: 18px; }
	.dfn-product .woocommerce-product-details__short-description { order: 6; margin-top: 20px; }
	.dfn-product .trust-list { order: 7; }
	.dfn-product .ask-quote { order: 8; }
	.dfn-stage__hint { display: none; }
	.dfn-views { margin-top: 10px; }
	.dfn-view { padding: 6px 4px; }

	/* 1. Botão sobre a área de estampa enquanto a vista está vazia. */
	.dfn-empty-cta:not([hidden]) {
		position: absolute; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 4px; padding: 8px;
		border: 2px dashed var(--dfn-accent); border-radius: 12px; background: rgba(255, 255, 255, .78); color: var(--dfn-accent);
		font: inherit; text-align: center; cursor: pointer; backdrop-filter: blur(2px); animation: dfn-pulse 2.2s ease-in-out infinite;
	}
	.dfn-empty-cta .dfn-i { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--dfn-accent); color: #fff; box-sizing: content-box; }
	.dfn-empty-cta b { font-size: .9rem; line-height: 1.2; }
	.dfn-empty-cta small { font-size: .72rem; color: var(--dfn-muted); }
	@keyframes dfn-pulse { 50% { box-shadow: 0 0 0 6px rgba(184, 73, 111, .14); } }

	/* 2. Barra rápida logo abaixo das vistas. */
	.dfn-quick { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin-top: 10px; }
	.dfn-product .summary .product_title { line-height: 1.15; }
	.dfn-quick button {
		all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; height: 48px; cursor: pointer;
		border-radius: 12px; border: 1.5px solid var(--dfn-line); background: #fff; color: var(--dfn-ink); font-weight: 600; font-size: .9rem;
	}
	.dfn-quick button .dfn-i { color: var(--dfn-accent); width: 18px; height: 18px; }
	.dfn-quick .dfn-quick__main { background: var(--dfn-accent); border-color: var(--dfn-accent); color: #fff; }
	.dfn-quick .dfn-quick__main .dfn-i { color: #fff; }
	.dfn-quick button:focus-visible { outline: 2px solid var(--dfn-accent); outline-offset: 2px; }

	/* 4. Barra fixa no rodapé. */
	.dfn-mbar {
		display: flex; align-items: center; gap: 12px; position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97);
		border-top: 1px solid var(--line, #efdfe5); box-shadow: 0 -8px 24px -14px rgba(90, 42, 58, .35);
		transform: translateY(110%); transition: transform .25s ease;
	}
	.dfn-mbar.is-on { transform: none; }
	.dfn-mbar__info { display: grid; line-height: 1.2; min-width: 0; }
	.dfn-mbar__info small { color: var(--muted, #6e6468); font-size: .74rem; }
	.dfn-mbar__info b { font-size: 1.05rem; color: var(--ink, #2a2628); white-space: nowrap; }
	.dfn-mbar__btn {
		all: unset; box-sizing: border-box; margin-left: auto; height: 48px; padding: 0 20px; border-radius: 999px; cursor: pointer;
		background: var(--accent, #b8496f); color: #fff; font-weight: 700; font-size: .92rem; white-space: nowrap;
	}
	.dfn-mbar__btn:focus-visible { outline: 2px solid var(--ink, #2a2628); outline-offset: 2px; }
	.dfn-page .site-footer { padding-bottom: 72px; }
}
@media (max-width: 960px) {
	.woocommerce .dfn-product .summary > p.price { margin: 6px 0 0; }
	.woocommerce .dfn-product .summary .installment-prices-for-woocommerce p.price { margin: 0; line-height: 1.4; }
	.woocommerce .dfn-product .summary .product_title { margin-bottom: 0; }
	/* Barra de ferramentas da arte em uma linha só, rolando de lado se precisar. */
	.dfn-toolbar { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 4px; }
	.dfn-toolbar::-webkit-scrollbar { display: none; }
	.dfn-toolbar button { flex: none; min-width: 38px; height: 38px; }
	.dfn-toolbar input[type=range], .dfn-toolbar__sep, .dfn-toolbar [data-act="front"] { display: none; }
	.dfn-toolbar .dfn-toolbar__nobg { margin-left: auto; padding: 0 10px; }
}
@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
	.dfn-empty-cta:not([hidden]) { animation: none; }
	.dfn-mbar { transition: none; }
}
