/* Wallance studio: model rail, pattern-paper stage, colour + order panel.
   Scoped to .wst so the older design-studio.css only supplies canvas internals. */

.wst {
    --st-paper: #f7f4f0;
    --st-ink: #171411;
    --st-muted: #6b6259;
    --st-sand: #ebe4db;
    --st-line: rgba(23, 20, 17, .1);
    --st-ease: cubic-bezier(.22, 1, .36, 1);
    color: var(--st-ink);
}

.wst.ds-embed.ds-main {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) 316px;
    grid-template-areas: "models stage panel";
    grid-template-rows: none;
    gap: 20px;
    min-height: 0;
    max-width: 1480px;
    margin: 0 auto;
    padding: 0;
    align-items: start;
}

.wst.ds-embed--designer.ds-main {
    grid-template-columns: 220px minmax(0, 1fr) 280px;
}

/* Steps */
.wst-step {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--st-ink);
}

.wst-step span {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--st-ink);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.wst-note {
    margin: 8px 0 0;
    color: var(--st-muted);
    font-size: 12.5px;
    line-height: 1.5;
}

/* 1. Models */
.wst-models {
    grid-area: models;
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
    min-width: 0;
}

.wst-model-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px 2px 2px;
    scrollbar-width: thin;
}

.wst .ds-template-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-height: auto;
    margin: 0;
    padding: 6px 6px 8px;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    background: #fff;
    color: var(--st-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease-out, box-shadow .15s ease-out;
}

.wst .ds-template-item img {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.wst .ds-template-item span {
    flex: none;
    min-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--st-muted);
}

.wst .ds-template-item:hover {
    border-color: rgba(23, 20, 17, .35);
}

.wst .ds-template-item.active {
    border-color: var(--st-ink);
    box-shadow: 0 0 0 1px var(--st-ink);
}

.wst .ds-template-item.active span {
    color: var(--st-ink);
}

.wst .ds-template-blank-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    background:
        linear-gradient(var(--st-sand) 1px, transparent 1px) 0 0 / 12px 12px,
        linear-gradient(90deg, var(--st-sand) 1px, transparent 1px) 0 0 / 12px 12px,
        #fff;
    color: var(--st-muted);
    font-size: 12px;
    font-weight: 700;
}

.wst-upload {
    position: relative;
    display: block;
    margin: 10px 0 0;
    padding: 12px 14px;
    border: 1px dashed rgba(23, 20, 17, .25);
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}

.wst-upload span {
    display: block;
    font-size: 13px;
    font-weight: 700;
}

.wst-upload small {
    color: var(--st-muted);
    font-size: 11.5px;
}

.wst-upload input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.wst-upload:focus-within {
    outline: 2px solid var(--st-ink);
    outline-offset: 2px;
}

/* Stage */
.wst-stage.ds-workspace {
    grid-area: stage;
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.wst-stage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}

.wst-stage-name {
    margin: 0;
    color: var(--st-ink);
    font-family: var(--wp-serif, Georgia, serif);
    font-size: 22px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wst-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    background: #fff;
}

.wst-tool {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--st-ink);
    cursor: pointer;
    transition: background .15s ease-out;
}

.wst-tool svg {
    width: 18px;
    height: 18px;
}

.wst-tool:hover {
    background: var(--st-paper);
}

.wst-tool:disabled {
    opacity: .35;
    cursor: default;
}

.wst-tool--text {
    padding: 0 14px;
    background: var(--st-ink);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.wst-tool--text:hover {
    background: #000;
}

.wst-tools-sep {
    width: 1px;
    height: 20px;
    margin: 0 4px;
    background: var(--st-line);
}

/* Pattern paper: the drawing sits on a cutting-mat grid. */
.wst .wst-canvas.ds-mockup-container {
    position: relative;
    width: 100%;
    max-width: none;
    height: min(calc(100vh - 190px), 860px);
    min-height: 520px;
    aspect-ratio: auto;
    border: 1px solid var(--st-line);
    border-radius: 18px;
    background:
        linear-gradient(rgba(23, 20, 17, .045) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, rgba(23, 20, 17, .045) 1px, transparent 1px) 0 0 / 24px 24px,
        #fff;
    box-shadow: none;
    overflow: hidden;
}

.wst .ds-mockup-wrapper {
    position: absolute;
    inset: 24px;
    width: auto;
    height: auto;
    transition: transform .28s var(--st-ease);
}

.wst .ds-technical-mockup {
    background: transparent;
}

.wst .ds-template-lineart {
    object-position: center center;
}

.wst .ds-technical-mockup.is-entering {
    animation: wst-drawing-in .26s var(--st-ease);
}

@keyframes wst-drawing-in {
    from { opacity: 0; transform: scale(.985); }
}

.wst-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 6;
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--st-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
}

.wst-zoom button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--st-ink);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.wst-zoom button svg {
    width: 16px;
    height: 16px;
}

.wst-zoom button:hover {
    background: var(--st-paper);
}

.wst .wst-tip.ds-flow-hint {
    margin: 10px 0 0;
    padding: 0;
    background: none;
    border-radius: 0;
    color: var(--st-muted);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

/* Panel */
.wst-panel.ds-tools {
    grid-area: panel;
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 96px);
    min-width: 0;
    padding: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.wst-block {
    padding: 18px;
    border: 1px solid var(--st-line);
    border-radius: 18px;
    background: #fff;
}

.wst-swatches {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.wst .ds-color-swatch {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(23, 20, 17, .12);
    cursor: pointer;
    transition: transform .12s ease-out;
}

.wst .ds-color-swatch:hover {
    transform: scale(1.06);
}

.wst .ds-color-swatch.active {
    transform: none;
    box-shadow: inset 0 0 0 1px rgba(23, 20, 17, .12), 0 0 0 2px #fff, 0 0 0 4px var(--st-ink);
}

.wst .ds-color-swatch.active::after {
    content: none;
}

.wst-custom-color {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.wst-custom-color input {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--st-line);
    border-radius: 50%;
    background: none;
    cursor: pointer;
    overflow: hidden;
}

.wst-custom-color input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.wst-custom-color input::-webkit-color-swatch {
    border: 0;
    border-radius: 50%;
}

.wst-zones:empty {
    display: none;
}

.wst-zones {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
}

.wst-zones .ds-zone-empty {
    margin: 0;
    color: var(--st-muted);
    font-size: 12.5px;
}

.wst-more {
    margin: 16px 0 0;
    border-top: 1px solid var(--st-line);
}

.wst-more summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 2px;
    font-size: 13px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.wst-more summary::-webkit-details-marker {
    display: none;
}

.wst-more summary::after {
    content: "+";
    font-size: 18px;
    font-weight: 400;
    transition: transform .16s ease-out;
}

.wst-more[open] summary::after {
    transform: rotate(45deg);
}

.wst-more-body {
    display: grid;
    gap: 12px;
    padding: 12px 0 0;
}

.wst-seg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--st-paper);
}

.wst-seg button {
    flex: 1;
    min-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--st-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.wst-seg button.active {
    background: #fff;
    color: var(--st-ink);
    box-shadow: 0 1px 2px rgba(23, 20, 17, .12);
}

.wst .wst-dropzone.ds-upload-zone {
    margin: 0;
    padding: 18px 14px;
    border: 1px dashed rgba(23, 20, 17, .25);
    border-radius: 12px;
    background: var(--st-paper);
    text-align: center;
    cursor: pointer;
}

.wst .wst-dropzone p {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--st-ink);
}

.wst .wst-dropzone small {
    color: var(--st-muted);
    font-size: 11.5px;
}

.wst .wst-dropzone.dragover {
    border-color: var(--st-ink);
}

.wst-brush {
    display: grid;
    gap: 12px;
    margin: 0 0 16px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--st-line);
}

.wst-brush[hidden] {
    display: none;
}

.wst-range {
    display: grid;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
}

.wst input[type="range"] {
    accent-color: var(--st-ink);
}

.wst .ds-upload-adjust {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    background: #fff;
}

.wst .ds-adjust-head span {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--st-ink);
}

.wst .ds-adjust-head button {
    border: 0;
    background: none;
    color: var(--st-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.wst .ds-print-zone-item {
    font: inherit;
}

.wst-ghost-btn {
    min-height: 40px;
    border: 1px solid var(--st-ink);
    border-radius: 999px;
    background: #fff;
    color: var(--st-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* 3. Order */
.wst-product {
    position: relative;
}

.wst-product-current {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--st-line);
    border-radius: 14px;
    background: #fff;
    color: var(--st-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wst-product-current img {
    width: 48px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    object-position: center top;
    background: var(--st-sand);
}

.wst-product-current strong {
    display: block;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wst-product-current small {
    color: var(--st-muted);
    font-size: 12.5px;
}

.wst-product-current em {
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wst .wst-product-list.ds-product-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    display: none;
    max-height: 320px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--st-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 36px rgba(30, 24, 18, .16);
}

.wst .wst-product-list.open {
    display: grid;
    gap: 2px;
    animation: wst-pop .16s ease-out;
}

@keyframes wst-pop {
    from { opacity: 0; transform: translateY(-4px); }
}

.wst .ds-product-option {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--st-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wst .ds-product-option img {
    width: 36px;
    height: 46px;
    border-radius: 6px;
    object-fit: cover;
    object-position: center top;
}

.wst .ds-product-option span {
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wst .ds-product-option b {
    font-size: 12.5px;
}

.wst .ds-product-option:hover,
.wst .ds-product-option[aria-selected="true"] {
    background: var(--st-paper);
}

.wst .ds-product-option:not(.is-match) {
    color: var(--st-muted);
}

.wst .ds-product-option.is-match + .ds-product-option:not(.is-match) {
    margin-top: 6px;
    border-top: 1px solid var(--st-line);
    border-radius: 0 0 10px 10px;
}

.wst-cart {
    display: grid;
    gap: 14px;
    margin: 14px 0 0;
}

.wst-size {
    display: grid;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.wst-size[hidden] {
    display: none;
}

.wst-size select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    background: #fff;
    color: var(--st-ink);
    font: inherit;
    font-size: 14px;
}

.wst-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 12px 0 0;
    border-top: 1px solid var(--st-line);
    font-size: 13px;
    color: var(--st-muted);
}

.wst-total strong {
    color: var(--st-ink);
    font-size: 22px;
    font-weight: 700;
}

.wst-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    border: 0;
    border-radius: 999px;
    background: var(--st-ink);
    color: #fff !important;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .12s ease-out, background .15s ease-out;
}

.wst-cta:hover {
    background: #000;
}

.wst-cta:active {
    transform: scale(.98);
}

.wst-cta:disabled {
    opacity: .6;
    cursor: progress;
}

.wst-order > .wst-total {
    margin: 14px 0;
}

.wst button:focus:not(:focus-visible) {
    outline: none;
}

.wst button:focus-visible,
.wst summary:focus-visible,
.wst [tabindex]:focus-visible,
.wst select:focus-visible {
    outline: 2px solid var(--st-ink);
    outline-offset: 2px;
}

/* Tablet and phone: models become a strip, stage then panel. */
@media (max-width: 1100px) {
    .wst.ds-embed.ds-main,
    .wst.ds-embed--designer.ds-main {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "models" "stage" "panel";
        gap: 18px;
    }

    .wst-models,
    .wst-stage.ds-workspace,
    .wst-panel.ds-tools {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .wst-model-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        padding-bottom: 6px;
    }

    .wst .ds-template-item {
        flex: 0 0 104px;
        scroll-snap-align: start;
    }

    .wst .wst-canvas.ds-mockup-container {
        height: auto;
        min-height: 0;
        aspect-ratio: 3 / 4;
        max-height: 72vh;
    }

    .wst .ds-mockup-wrapper {
        inset: 12px;
    }

    /* One scrolling row keeps colours a thumb away from the drawing. */
    .wst-swatches {
        display: flex;
        gap: 10px;
        margin: 0 -18px;
        padding: 4px 18px 6px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .wst-swatches::-webkit-scrollbar {
        display: none;
    }

    .wst .wst-swatches .ds-color-swatch {
        flex: 0 0 40px;
        width: 40px;
        scroll-snap-align: start;
    }

    .wst-panel.ds-tools {
        gap: 12px;
    }

    .wst .wst-tip.ds-flow-hint {
        margin-top: 8px;
    }
}

@media (max-width: 560px) {
    .wst-stage-name {
        font-size: 18px;
    }

    .wst-tool {
        min-width: 34px;
        height: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wst *,
    .wst *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Page head, kept short so the stage fits the first screen. */
.wp-page--studio {
    padding-top: 22px;
}

.wst-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    margin: 0 0 18px;
}

.wst-head h1 {
    margin: 0;
    font-family: var(--wp-serif, Georgia, serif);
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.1;
}

.wst-head p {
    margin: 0;
    color: var(--wp-muted, #6b6259);
    font-size: 14px;
}

/* Model switch confirm, shown over the stage instead of a browser dialog. */
.wst-confirm {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 14px;
    z-index: 8;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--st-ink, #171411);
    color: #fff;
    box-shadow: 0 12px 28px rgba(30, 24, 18, .2);
    animation: wst-pop .18s ease-out;
}

.wst-confirm p {
    flex: 1 1 220px;
    margin: 0;
    color: #fff;
    font-size: 13.5px;
    line-height: 1.4;
}

.wst-confirm button {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.wst-confirm-go {
    background: #fff;
    color: var(--st-ink, #171411);
}

.wst-confirm-stay {
    background: transparent;
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}
