.estampados-designer {
    border: 1px solid #c3c6cc;
    border-radius: 12px;
    margin-block: 1rem;
    padding: 1rem;
    min-inline-size: 0;
    width: 100%;
    box-sizing: border-box;
}

.estampados-designer legend {
    font-weight: 700;
    padding-inline: .4rem;
}

.estampados-designer [hidden] {
    display: none !important;
}

.estampados-designer label {
    display: grid;
    gap: .3rem;
    margin-block: .5rem;
}

.estampados-designer select,
.estampados-designer input {
    max-width: 100%;
}

.estampados-stage {
    position: relative;
    aspect-ratio: 1 / 1;
    max-width: 480px;
    margin: 1rem auto;
    background: #eef0f3;
    overflow: hidden;
    border-radius: 8px;
}

.estampados-mockup {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.estampados-silhouette {
    position: absolute;
    inset: 7%;
    background: #fff;
    filter: drop-shadow(0 2px 4px #2222);
    clip-path: polygon(31% 4%, 42% 0, 46% 7%, 54% 7%, 58% 0, 69% 4%, 96% 23%, 83% 44%, 71% 37%, 71% 98%, 29% 98%, 29% 37%, 17% 44%, 4% 23%);
}

.estampados-dark .estampados-silhouette {
    background: #28292b;
}

.estampados-area {
    position: absolute;
    width: 30%;
    height: 36%;
    left: 35%;
    top: 24%;
}

.estampados-zone[data-zone="left"] .estampados-area,
.estampados-zone[data-zone="right"] .estampados-area {
    top: 25%;
    width: 11%;
    height: 10%;
}

.estampados-zone[data-zone="left"] .estampados-area {
    left: 15%;
}

.estampados-zone[data-zone="right"] .estampados-area {
    left: 74%;
}

.estampados-stage img.estampados-artwork {
    display: block;
    position: absolute;
    height: auto;
    max-width: none;
    transform: translate(-50%, -50%);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.estampados-artwork:active {
    cursor: grabbing;
}

.estampados-error {
    color: #9d1c22;
}

.estampados-stage:has(.estampados-color-mockup) {
    aspect-ratio: 2 / 3;
    max-width: 340px;
}

.estampados-stage:has(.estampados-color-mockup) .estampados-area {
    top: 21%;
    height: 33%;
    width: 41%;
    left: 29.5%;
}

.estampados-resize {
    position: absolute;
    transform: translate(-50%, -50%);
    outline: 1px solid var(--estampados-focus, #805c00);
    pointer-events: none;
}

.estampados-resize [data-corner] {
    position: absolute;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    pointer-events: auto;
    touch-action: none;
    transform: translate(-50%, -50%);
}

.estampados-resize [data-corner]::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid var(--estampados-focus, #805c00);
    background: #fff;
    border-radius: 2px;
}

.estampados-resize [data-corner="nw"],
.estampados-resize [data-corner="se"] {
    cursor: nwse-resize;
}

.estampados-resize [data-corner="ne"],
.estampados-resize [data-corner="sw"] {
    cursor: nesw-resize;
}

.estampados-resize [data-corner^="s"] {
    top: 100%;
}

.estampados-resize [data-corner$="e"] {
    left: 100%;
}

.estampados-resize [data-corner^="n"] {
    top: 0;
}

.estampados-resize [data-corner$="w"] {
    left: 0;
}

.woocommerce-product-gallery.estampados-gallery-with-swatches .flex-control-thumbs {
    display: none !important;
}

.estampados-swatches {
    clear: both;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    min-inline-size: 0;
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
}

.estampados-swatches legend {
    margin-block-end: .5rem;
    padding: 0;
    font-size: .875rem;
}

.estampados-swatches label {
    display: inline-flex;
}

.estampados-swatches input[type="radio"] {
    appearance: none;
    width: 34px;
    height: 34px;
    margin: 0;
    border: 1px solid #777;
    border-radius: 50%;
    background: var(--estampados-swatch);
    cursor: pointer;
}

.estampados-swatches input[type="radio"]:checked {
    outline: 2px solid #1d262e;
    outline-offset: 2px;
}

.estampados-swatches input[type="radio"]:focus-visible {
    outline: 3px solid var(--estampados-focus, #805c00);
    outline-offset: 2px;
}

.estampados-swatches input[type="radio"]:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.estampados-open-editor,
.estampados-dialog button:is(.estampados-dialog-done, .estampados-dialog-buy, .estampados-dialog-close) {
    min-height: 44px;
    border: 1px solid var(--estampados-accent, #ffbf18);
    border-radius: 10px;
    padding: .5rem .9rem;
    background: var(--estampados-surface, #fffdfa);
    color: var(--estampados-accent-text, #624800);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.estampados-open-editor {
    width: 100%;
    margin-block: .25rem .85rem;
}

.estampados-dialog {
    width: calc(100% - 2rem);
    max-width: none;
    height: calc(100dvh - 2rem);
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 1px solid var(--estampados-line, #ded6ce);
    border-radius: var(--estampados-radius, 18px);
    background: var(--estampados-surface, #fffdfa);
    color: var(--estampados-ink, #24201e);
    font: .9375rem/1.45 var(--estampados-font, system-ui, sans-serif);
    box-shadow: 0 22px 65px #17161533;
    overflow: hidden;
}

.estampados-dialog[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.estampados-dialog::backdrop {
    background: #17161599;
}

html:has(.estampados-dialog[open]) {
    overflow: hidden;
}

.estampados-dialog-header,
.estampados-dialog-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem .8rem;
    padding: .65rem 1rem;
}

.estampados-dialog-header {
    border-bottom: 1px solid var(--estampados-line, #ded6ce);
}

.estampados-dialog-header h2 {
    margin: 0;
    font: inherit;
    font-size: clamp(1.15rem, 3vw, 1.5rem);
    font-weight: 750;
}

.estampados-dialog button.estampados-dialog-close {
    width: 44px;
    padding: 0;
    border-color: transparent;
    font-size: 1.45rem;
}

.estampados-dialog-body {
    overflow: auto;
    overscroll-behavior: contain;
    padding: .75rem 1rem;
}

.estampados-dialog-variants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .75rem;
    margin-bottom: .55rem;
}

.estampados-dialog-variants[hidden],
.estampados-dialog:not([open]) {
    display: none !important;
}

.estampados-dialog-variants label {
    display: grid;
    gap: .2rem;
    font-weight: 650;
}

.estampados-dialog .estampados-designer {
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
}

.estampados-dialog .estampados-designer legend {
    position: absolute;
    clip-path: inset(50%);
}

.estampados-dialog .estampados-stage:has(.estampados-color-mockup) {
    max-width: 240px;
}

.estampados-dialog-footer {
    border-top: 1px solid var(--estampados-line, #ded6ce);
}

.estampados-dialog-footer p {
    margin: 0;
    font-size: .875rem;
}

.estampados-dialog .estampados-dialog-actions {
    display: flex;
    gap: .8rem;
    margin-inline-start: auto;
}

.estampados-dialog button.estampados-dialog-buy {
    background: var(--estampados-accent, #ffbf18);
    color: var(--estampados-on-accent, #171615);
}

.estampados-dialog-status {
    position: absolute;
    inset-inline-end: 1rem;
    inset-block-end: 4.75rem;
    z-index: 1;
    max-width: min(24rem, calc(100% - 2rem));
    padding: .7rem .9rem;
    border-radius: 10px;
    background: var(--estampados-accent-soft, #fff0bc);
    color: var(--estampados-on-accent, #171615);
    box-shadow: 0 8px 24px #17161533;
    font-weight: 650;
}

.estampados-dialog-status:empty {
    padding: 0;
    box-shadow: none;
}

@media (min-width: 640px) {
    .estampados-dialog-body {
        display: grid;
        grid-template-columns: minmax(230px, 32%) minmax(0, 1fr);
        grid-template-rows: repeat(5, auto) 1fr;
        align-items: start;
        gap: .55rem clamp(1rem, 3vw, 2.5rem);
        padding: 1rem 1.25rem;
    }

    .estampados-dialog .estampados-designer,
    .estampados-dialog .estampados-zone:not([hidden]) {
        display: contents;
    }

    .estampados-dialog-variants,
    .estampados-dialog .estampados-designer > label,
    .estampados-dialog .estampados-zone > .estampados-source,
    .estampados-dialog .estampados-adjustments,
    .estampados-dialog .estampados-error {
        grid-column: 1;
        min-width: 0;
    }

    .estampados-dialog-variants { grid-row: 1; }
    .estampados-dialog .estampados-designer > label { grid-row: 2; }
    .estampados-dialog[open] .estampados-zone > .estampados-source { grid-area: 3 / 1; }
    .estampados-dialog[open] .estampados-adjustments { grid-area: 4 / 1; }
    .estampados-dialog[open] .estampados-error { grid-area: 5 / 1; }

    .estampados-dialog[open] .estampados-zone > .estampados-stage {
        grid-column: 2;
        grid-row: 1 / -1;
        width: 100%;
        max-width: min(560px, max(230px, calc((100dvh - 12.5rem) * 2 / 3)));
        margin: 0 auto;
    }
}

@media (max-width: 639px) {
    .estampados-dialog {
        width: calc(100% - 1rem);
        height: calc(100dvh - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .estampados-dialog[open] .estampados-stage:has(.estampados-color-mockup) {
        max-width: min(245px, 43dvh);
    }
}

.estampados-dialog-variants select {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    border: 1px solid var(--estampados-line, #ded6ce);
    border-radius: 10px;
    background: var(--estampados-surface, #fffdfa);
    color: inherit;
    font: inherit;
    line-height: 1.25;
    padding: .45rem .65rem;
}

.estampados-dialog :is(.estampados-dialog-variants, .estampados-designer) > label {
    position: relative;
}

.estampados-dialog :is(.estampados-dialog-variants, .estampados-designer) > label::after {
    content: '';
    position: absolute;
    inset-inline-end: 1rem;
    bottom: 20px;
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    pointer-events: none;
}

.estampados-dialog[open] :is(.estampados-dialog-variants select, .estampados-zone-select) {
    appearance: none;
    background-image: none;
    padding-inline-end: 2.5rem;
}

.estampados-order-preview {
    width: min(100%, 180px);
    margin: 1rem 0 .5rem;
}

.estampados-order-preview figcaption {
    font-weight: 600;
    margin-block-end: .35rem;
}

.estampados-order-preview .estampados-stage {
    margin: 0;
}

.estampados-order-preview .estampados-artwork {
    cursor: default;
}

.estampados-designer input[data-control="scale"] {
    box-sizing: border-box;
    width: 8rem;
    min-height: 40px;
    padding: .4rem .65rem;
    border: 1px solid var(--estampados-line, #ded6ce);
    border-radius: 8px;
    background: var(--estampados-surface, #fffdfa);
    color: inherit;
    font: inherit;
}

.estampados-samples {
    margin-block: .65rem .35rem;
}

.estampados-samples summary {
    width: fit-content;
    border: 1px solid var(--estampados-accent, #ffbf18);
    border-radius: 8px;
    padding: .5rem .65rem;
    color: var(--estampados-accent-text, #624800);
    font-weight: 700;
    cursor: pointer;
}

.estampados-samples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: .4rem;
    max-height: 230px;
    margin-block-start: .55rem;
    padding: .2rem;
    overflow: auto;
}

.estampados-sample {
    display: grid;
    gap: .25rem;
    justify-items: center;
    padding: .3rem;
    border: 1px solid var(--estampados-line, #ded6ce);
    border-radius: 8px;
    background: var(--estampados-surface, #fffdfa);
    color: var(--estampados-ink, #24201e);
    font: inherit;
    font-size: .72rem;
    line-height: 1.2;
    cursor: pointer;
}

.estampados-sample img {
    display: block;
    width: 100%;
    height: 55px;
    object-fit: contain;
    background: #d9d4d2;
    border-radius: 4px;
}

.estampados-sample:is([aria-pressed="true"], :focus-visible) {
    outline: 2px solid var(--estampados-accent, #ffbf18);
    outline-offset: 1px;
}
