/* The desktop artwork and controls follow the proportions of the TIDI reference. */
.rl-dialog.tidi-editor {
    --studio-unit: min(0.10101vh, 0.082vw, 1.35px);
    --studio-red: #ef3036;
    height: 100vh;
    height: 100dvh;
    background: #a9abae;
    color: #373435;
    font-family: Arial, Helvetica, sans-serif;
}
.tidi-editor .rl-dialog-layout {
    display: grid;
    position: relative;
    left: 0;
    grid-template-columns: minmax(0, 778fr) minmax(0, 326fr);
    grid-template-areas: "garment actions" "feedback feedback" "order order";
    grid-template-rows: auto auto auto;
    align-items: start;
    align-content: start;
    column-gap: calc(56 * var(--studio-unit));
    row-gap: 0;
    width: calc(1160 * var(--studio-unit));
    max-width: calc(100% - 40px);
    min-height: 0;
    margin: 0 auto;
    padding: max(48px, calc((100vh - 796 * var(--studio-unit)) / 2)) 0 max(48px, calc(50 * var(--studio-unit)));
}
.tidi-editor .rl-dialog-meta {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.tidi-editor .rl-dialog-meta > :not(h2),
.tidi-editor .rl-dialog-hook,
.tidi-editor .rl-dialog-hint { display: none; }
.tidi-editor .rl-close {
    top: 6px;
    right: 12px;
    background: transparent;
    color: #373435;
}
.tidi-editor .rl-dialog-art {
    grid-area: garment;
    position: relative;
    width: 100%;
    height: calc(778 * var(--studio-unit));
    justify-self: center;
    min-width: 0;
    background: radial-gradient(ellipse at 45% 35%, #8a8a8c, #808082);
}
.tidi-editor .tidi-frame {
    position: relative;
    width: 100%;
    height: 100%;
    touch-action: pan-y;
}
.tidi-editor .tidi-frame > img,
.tidi-editor .tidi-frame > canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    object-fit: contain;
    filter: none;
}
.tidi-frame canvas { pointer-events: none; }
.tidi-frame:has(canvas:not([hidden])) > img { opacity: 0; }
.tidi-editor .rl-faces {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 50%;
    transform: translate(-50%, -38%);
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 3px;
    border: 1px solid #dedce0;
    border-radius: 30px;
    background: #fff;
}
.tidi-editor .rl-faces button {
    padding: 0 max(10px, calc(16.5 * var(--studio-unit)));
    min-height: max(30px, calc(38 * var(--studio-unit)));
    border: 0;
    border-radius: 24px;
    color: #242126;
    font-size: clamp(12px, calc(13 * var(--studio-unit)), 17px);
    opacity: 1;
}
.tidi-editor .rl-faces button[aria-pressed=true] { background: #eae8ef; }
.tidi-editor .rl-image-warning {
    position: absolute;
    inset: 0 0 auto;
    margin: 0;
}
.tidi-editor .tidi-toolbar {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    text-align: center;
}
.tidi-editor .tidi-steps-title,
.tidi-editor .tidi-toolbar h4 {
    margin: 0; font-family: inherit; font-weight: 700; line-height: 1.15;
    text-transform: uppercase; letter-spacing: 0;
}
.tidi-editor .tidi-steps-title {
    margin: -2px 0 max(4px, calc(5 * var(--studio-unit)));
    font-size: max(17px, calc(22 * var(--studio-unit))); color: var(--studio-red);
}
.tidi-editor .tidi-toolbar h4 { font-size: max(13px, calc(16 * var(--studio-unit))); color: #727478; }
.tidi-editor .tidi-picker,
.tidi-editor .tidi-instructions,
.tidi-editor .tidi-realism {
    box-sizing: border-box; min-width: 0; background: white; border-radius: max(14px, calc(20 * var(--studio-unit)));
}
.tidi-editor .tidi-picker {
    display: grid; grid-template-columns: minmax(0, 1fr);
    padding: calc(12 * var(--studio-unit)) calc(22 * var(--studio-unit)) calc(15 * var(--studio-unit));
}
.tidi-editor .tidi-picker p {
    margin: calc(11 * var(--studio-unit)) 0 calc(12 * var(--studio-unit));
    color: #727478; font-size: max(12px, calc(16 * var(--studio-unit))); font-weight: 600; line-height: 1.25;
}
.tidi-editor .tidi-palette {
    position: relative;
    height: max(94px, calc(137 * var(--studio-unit)));
    margin-top: calc(23 * var(--studio-unit));
    border: 1px solid #737476;
    border-radius: max(10px, calc(17 * var(--studio-unit)));
    background: linear-gradient(to top, black, transparent), linear-gradient(to right, white, hsl(var(--tidi-hue, 240), 100%, 50%));
    cursor: crosshair;
    touch-action: none;
    overflow: hidden;
}
.tidi-palette span {
    position: absolute;
    left: var(--tidi-x);
    top: var(--tidi-y);
    width: max(17px, calc(21 * var(--studio-unit)));
    height: max(17px, calc(21 * var(--studio-unit)));
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #2229;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.tidi-editor .tidi-hue {
    display: block;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: max(14px, calc(16 * var(--studio-unit)));
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);
    cursor: ew-resize;
}
.tidi-hue::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 21px; height: 21px;
    border: 2px solid white; border-radius: 50%;
    background: var(--tidi-thumb, blue); box-shadow: 0 0 0 1px #4445;
}
.tidi-hue::-moz-range-thumb {
    width: 18px; height: 18px;
    border: 2px solid white; border-radius: 50%;
    background: var(--tidi-thumb, blue); box-shadow: 0 0 0 1px #4445;
}
.tidi-editor .tidi-uploads {
    position: absolute; z-index: 2; top: calc(100% - 13 * var(--studio-unit));
    left: 2%; right: 2%; display: flex; justify-content: space-between;
    pointer-events: none;
}
.tidi-editor .tidi-upload {
    position: relative; display: grid; place-items: center; box-sizing: border-box;
    width: 38%; min-height: max(44px, calc(52 * var(--studio-unit))); padding: 6px;
    border: 0; border-radius: max(7px, calc(10 * var(--studio-unit)));
    background: var(--studio-red); color: white; cursor: pointer; pointer-events: auto;
    text-align: center; text-transform: uppercase; font-weight: 600;
    font-size: max(13px, calc(19 * var(--studio-unit))); line-height: 1.12;
}
.tidi-editor .tidi-upload input[type="file"] {
    position: absolute; top: 0; left: 0; z-index: 1;
    display: block; width: 100%; height: 100%; min-width: 0;
    margin: 0; padding: 0; border: 0;
    opacity: 0; cursor: pointer;
}
.tidi-editor .tidi-upload:focus-within { outline: 2px solid #25213b; outline-offset: 3px; }
.tidi-upload strong { font-weight: 900; }
.tidi-editor [data-assistance] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(15 * var(--studio-unit));
    margin-top: calc(3 * var(--studio-unit));
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #00894f;
    font-weight: 700;
    font-size: clamp(18px, calc(26 * var(--studio-unit)), 34px);
    text-transform: uppercase;
}
.tidi-editor [data-assistance] svg {
    width: max(32px, calc(49 * var(--studio-unit)));
    height: auto;
}
.tidi-editor .tidi-instructions,
.tidi-editor .tidi-realism { margin-top: calc(17 * var(--studio-unit)); }
.tidi-editor .tidi-instructions {
    padding: calc(12 * var(--studio-unit)) calc(17 * var(--studio-unit)) calc(8 * var(--studio-unit));
}
.tidi-editor .tidi-instructions h4 { color: var(--studio-red); }
.tidi-editor .tidi-instructions p {
    margin: calc(5 * var(--studio-unit)) 0 calc(8 * var(--studio-unit));
    font-size: max(10px, calc(10 * var(--studio-unit))); line-height: 1.2; color: #403c3d;
}
.tidi-editor [data-download], .tidi-editor .tidi-realism button {
    position: relative; display: inline-block; box-sizing: border-box;
    width: 100%; min-height: max(23px, calc(26 * var(--studio-unit))); margin: 0; padding: 3px 12px;
    border: 0; border-radius: 5px; background: #373435; color: white; text-transform: uppercase;
    font-size: max(10px, calc(12 * var(--studio-unit))); font-weight: 750; line-height: 1.15;
}
.tidi-editor [data-download] { width: 48%; background: var(--studio-red); }
.tidi-editor [data-download] span, .tidi-realism button span:last-child {
    position: absolute; right: 6%; top: 50%; transform: translateY(-50%);
}
.tidi-editor .tidi-realism { padding: calc(14 * var(--studio-unit)) calc(16 * var(--studio-unit)) calc(8 * var(--studio-unit)); }
.tidi-editor .tidi-results {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: calc(10 * var(--studio-unit));
    margin-top: calc(10 * var(--studio-unit));
}
.tidi-editor .tidi-result { display: grid; gap: calc(7 * var(--studio-unit)); min-width: 0; }
.tidi-editor .tidi-preview {
    position: relative; height: 0; padding-top: 100%; overflow: hidden;
    background: #848587;
}
.tidi-preview canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
.tidi-preview .tidi-view-error { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: grid; place-items: center; color: white; font-size: 12px; }
.tidi-editor .tidi-realism button:disabled { opacity: 1; cursor: default; }
.tidi-editor .tidi-realism .tidi-plasmar { margin-top: calc(4 * var(--studio-unit)); background: #e7e6e8; color: #373435; }
.tidi-plasmar span:first-child { position: absolute; left: 4%; }
.tidi-plasmar span:last-child { background: #373435; color: white; padding: 0 2px; border-radius: 3px; }
.tidi-editor .tidi-realism .tidi-video { width: 48%; margin-top: calc(12 * var(--studio-unit)); }
.tidi-feedback { grid-area: feedback; margin: 12px 0 0; font-size: 14px; }
.tidi-editor .tidi-order {
    grid-area: order;
    margin-top: 15px;
    padding: 16px; border-radius: 14px; background: #fff;
}
.tidi-order p { margin: 5px 0 10px; font-size: 14px; }
.tidi-order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tidi-editor .tidi-order-actions button {
    min-height: 42px; padding: 8px 12px;
    border-radius: 10px; border: 1px solid #c3c1c4; background: white;
}
.tidi-editor .tidi-order-actions [type=submit] { background: #373435; color: white; }
.tidi-quantities { display: grid; grid-template-columns: repeat(auto-fit, minmax(45px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tidi-quantities label { display: grid; gap: 4px; font-size: 13px; }
.tidi-quantities input { width: 100%; min-width: 0; min-height: 40px; padding: 6px; border-radius: 8px; border: 1px solid #aaa; }
.tidi-editor :is(input, textarea, [tabindex]):focus-visible { outline: 2px solid #25213b; outline-offset: 3px; }
.tidi-editor button:disabled { opacity: .65; cursor: default; }
.tidi-editor .tidi-frame > img { cursor: crosshair; }
.tidi-fabric-hint {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    margin-top: calc(13 * var(--studio-unit));
    color: #48474a; font: max(10px, calc(10 * var(--studio-unit)))/1.2 Arial, sans-serif;
}
.tidi-fabric-hint i { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1px solid white; box-shadow: 0 0 0 1px #666; }
@media (max-width: 760px) {
    .rl-dialog.tidi-editor { --studio-unit: 1px; }
    .tidi-editor .rl-dialog-layout {
        left: 0; width: 100%; max-width: 540px; box-sizing: border-box;
        grid-template-columns: minmax(0, 1fr); grid-template-areas: "garment" "actions" "feedback" "order";
        grid-template-rows: auto; gap: 0; padding: 54px 12px max(20px, env(safe-area-inset-bottom));
    }
    .tidi-editor .rl-dialog-art { width: min(100%, 52vh); height: auto; }
    .tidi-editor .rl-dialog-art::before { content: ""; display: block; padding-top: 100%; }
    .tidi-editor .tidi-frame { position: absolute; top: 0; left: 0; }
    .tidi-editor .rl-faces button { min-height: 36px; }
    .tidi-editor .tidi-uploads { left: 0; right: 0; }
    .tidi-editor .tidi-upload { width: 49%; min-height: 44px; font-size: 13px; }
    .tidi-editor .tidi-toolbar { width: 100%; max-width: 400px; justify-self: center; margin-top: 49px; }
    .tidi-editor .tidi-picker { padding: 12px 18px 15px; }
    .tidi-editor .tidi-palette { height: 130px; margin-top: 18px; }
    .tidi-editor .tidi-realism, .tidi-editor .tidi-instructions { margin-top: 12px; }
    .tidi-editor [data-download] { min-height: 44px; font-size: 13px; }
    .tidi-editor [data-assistance] { margin-top: 6px; font-size: 20px; }
    .tidi-editor [data-assistance] svg { width: 36px; }
    .tidi-editor .rl-close { top: 3px; }
}

/* The overlay has exactly the same contained bounds as the garment photograph. */
.tidi-editor .tidi-art-surface {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    pointer-events: none;
}
.tidi-editor .tidi-art-box {
    position: absolute; box-sizing: border-box; border: 0; padding: 0;
    pointer-events: auto; touch-action: none; user-select: none; cursor: move;
    -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.tidi-editor .tidi-art-box > img {
    display: block; width: 100%; height: 100%; max-width: none; max-height: none;
    object-fit: fill; pointer-events: none; border: 0; border-radius: 0;
}
.tidi-editor .tidi-art-box[data-selected="true"]::before {
    content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none;
    outline: 1px solid #5141ce; box-shadow: inset 0 0 0 1px #ffffffe8;
}
.tidi-editor .tidi-art-box > .tidi-art-grip {
    position: absolute; z-index: 1; box-sizing: border-box; transform: translate(-50%, -50%);
    width: min(26px, 36%); height: min(26px, 36%); min-width: 0; min-height: 0;
    padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent;
    box-shadow: none; appearance: none; touch-action: none;
}
.tidi-art-box[data-selected="false"] .tidi-art-grip { display: none; }
.tidi-art-grip::after {
    content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 9px; height: 9px; box-sizing: border-box; border: 1.5px solid #5141ce;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #19142f40;
}
.tidi-art-grip:focus-visible::after { outline: 2px solid #19142f; outline-offset: 2px; }
.tidi-art-grip[data-grip="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.tidi-art-grip[data-grip="n"]  { left: 50%; top: 0; cursor: ns-resize; }
.tidi-art-grip[data-grip="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.tidi-art-grip[data-grip="e"]  { left: 100%; top: 50%; cursor: ew-resize; }
.tidi-art-grip[data-grip="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.tidi-art-grip[data-grip="s"]  { left: 50%; top: 100%; cursor: ns-resize; }
.tidi-art-grip[data-grip="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.tidi-art-grip[data-grip="w"]  { left: 0; top: 50%; cursor: ew-resize; }
@media (pointer: coarse) {
    .tidi-editor .tidi-art-box > .tidi-art-grip { width: min(34px, 40%); height: min(34px, 40%); }
    .tidi-art-grip::after { width: 12px; height: 12px; }
}
