/* =================================================================
   CNC JAALI DESIGN STUDIO (cnc-designs.html only)
   Uses the tokens and components from /products/products.css. The stage
   is a scale elevation drawing; the panel on it is a stack of masked
   layers (shadow on the wall, edge layers for thickness, face on top),
   so the cut-outs show real depth and the backlight glows through them.
   ================================================================= */

.cnc-vh {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---- Studio layout: intro + gallery on the left, sticky preview on the right ---- */
.cnc-studio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-areas: "intro preview" "gallery preview";
    grid-template-rows: auto 1fr;
    column-gap: 56px;
    row-gap: 40px;
    align-items: start;
    padding-top: 44px;
}
.cnc-intro { grid-area: intro; min-width: 0; }
.cnc-gallery { grid-area: gallery; min-width: 0; }
/* cnc-designs.js adds .is-sticky only on wide screens where the whole preview,
   actions included, fits under the fixed header; otherwise it scrolls normally. */
.cnc-studio-panel { grid-area: preview; min-width: 0; position: relative; }
.cnc-studio-panel.is-sticky { position: sticky; top: calc(var(--header-h, 111px) + 16px); }
@media (max-width: 980px) {
    .cnc-studio {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "intro" "preview" "gallery";
        grid-template-rows: auto;
        row-gap: 28px;
    }
}

h1.pp-h1.cnc-h1 { font-size: clamp(2.3rem, 4.4vw, 3.7rem); margin-bottom: 18px; }
.cnc-lede {
    font-size: 1.08rem;
    line-height: 1.6;
    color: var(--pp-text-muted);
    max-width: 52ch;
    margin: 0;
}
.cnc-specs { margin: 26px 0 0; }
h2.pp-h2.cnc-h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: 18px; }

/* ---- Stage ---------------------------------------------------- */
.cnc-scene {
    position: relative;
    aspect-ratio: 3 / 2;
    border-radius: var(--pp-radius-lg);
    border: 1px solid var(--pp-rule-soft);
    background: #EEEAE4;
    box-shadow: var(--pp-shadow-4);
    overflow: hidden;
    isolation: isolate;
    /* Room tones behind the panel; light boards get a deeper wall (see finishes below). */
    --cnc-wall-top: #F4F0EA;
    --cnc-wall-bottom: #E6E0D7;
    --cnc-behind: #EDE6DB;
    /* Depth defaults ("near": panel 30-50 mm off the wall). */
    --sh-x: 4px;
    --sh-y: 5px;
    --sh-blur: 2px;
    --sh-a: 0.22;
    --standoff: 14px;
    --step-x: -0.5px;
    --step-y: -0.65px;
}
@media (max-width: 700px) { .cnc-scene { aspect-ratio: 4 / 5; } }
/* A partition stands far from the back wall: no cast pattern shadow, only the floor contact shadow. */
.cnc-scene[data-depth="far"] { --standoff: 26px; }
.cnc-scene[data-depth="far"] .cnc-shadow { display: none; }
.cnc-scene[data-depth="inset"] { --sh-x: 2px; --sh-y: 3px; --sh-blur: 1px; --sh-a: 0.26; --standoff: 6px; }
.cnc-scene[data-mat="mdf-white"],
.cnc-scene[data-mat="wpc"] { --cnc-wall-top: #E7DFD4; --cnc-wall-bottom: #D9CFC2; --cnc-behind: #8F8478; }

.cnc-backdrop,
.cnc-fore {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.cnc-backdrop { z-index: 0; }
.cnc-dim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(34, 26, 18, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-move) var(--ease-out);
}
.cnc-fore { z-index: 3; pointer-events: none; }
.cnc-scene.is-lit .cnc-dim { opacity: 1; }

/* The panel and its layers. data-tilt (script.js) rotates .cnc-panel on fine pointers. */
.cnc-scene .cnc-panel {
    position: absolute;
    z-index: 2;
    left: 35%;
    top: 10%;
    width: 30%;
    height: 80%;
    transform-style: preserve-3d;
}
.cnc-panel-body {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}
.cnc-l {
    position: absolute;
    inset: 0;
    display: block;
    -webkit-mask: var(--cnc-mask) 0 0 / 100% 100% no-repeat;
    mask: var(--cnc-mask) 0 0 / 100% 100% no-repeat;
}
.cnc-l[hidden] { display: none; }
.cnc-face { background: var(--face); }
.cnc-face::after,
.cnc-side::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--dur-move) var(--ease-out);
}
.cnc-face::after { background: rgba(26, 18, 10, 0.34); }
.cnc-side::after { background: rgba(255, 168, 80, 0.42); }
.cnc-scene.is-lit .cnc-face::after,
.cnc-scene.is-lit .cnc-side::after { opacity: 1; }

/* Edge layers: each one sits a step further back, so cut-out walls show thickness. */
.cnc-side {
    background: var(--edge-a);
    transform: translate3d(calc(var(--i) * var(--step-x)), calc(var(--i) * var(--step-y)), calc(var(--i) * -1.6px));
}
.cnc-side:nth-child(even) { background: var(--edge-b); }
.cnc-shadow {
    background: rgba(20, 16, 12, var(--sh-a));
    filter: blur(var(--sh-blur));
    transform: translate3d(var(--sh-x), var(--sh-y), calc(var(--standoff) * -1));
    transition: opacity var(--dur-move) var(--ease-out);
}
.cnc-scene.is-lit .cnc-shadow { opacity: 0.35; }
.cnc-glow {
    inset: -16%;
    -webkit-mask: none;
    mask: none;
    background: radial-gradient(closest-side, rgba(255, 206, 128, 0.98), rgba(255, 176, 84, 0.62) 58%, rgba(255, 160, 70, 0));
    opacity: 0;
    transform: translateZ(calc(var(--standoff) * -1 - 2px));
    transition: opacity var(--dur-move) var(--ease-out);
}
.cnc-scene.is-lit .cnc-glow { opacity: 1; }
/* A door leaf sits inside its frame: light shows only through the cut-outs, never over the wall. */
.cnc-scene[data-depth="inset"] .cnc-glow { inset: 0; }

/* Two-tone PU: the solid border frame in the second colour, over the face. */
.cnc-frame {
    display: none;
    background: var(--frame-face);
    -webkit-mask: var(--cnc-frame-mask) 0 0 / 100% 100% no-repeat;
    mask: var(--cnc-frame-mask) 0 0 / 100% 100% no-repeat;
}
.cnc-scene[data-tone="frame"] .cnc-frame { display: block; }
.cnc-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(26, 18, 10, 0.34);
    transition: opacity var(--dur-move) var(--ease-out);
}
.cnc-scene.is-lit .cnc-frame::after { opacity: 1; }

/* script.js's tilt glare: keep it on the face and only on material. */
.cnc-scene .cnc-panel::after {
    -webkit-mask: var(--cnc-mask) 0 0 / 100% 100% no-repeat;
    mask: var(--cnc-mask) 0 0 / 100% 100% no-repeat;
    transform: translateZ(1px);
    border-radius: 0;
}

/* Board finishes: face fill and two alternating edge tones (plies show on plywood). */
.cnc-scene[data-mat="mdf-white"] {
    --face: linear-gradient(140deg, #FDFCFA 0%, #F2EFEA 55%, #E6E1D9 100%);
    --edge-a: #D9D3C9; --edge-b: #D1CABF;
}
.cnc-scene[data-mat="mdf-pu"] {
    --face: repeating-linear-gradient(97deg, rgba(255, 236, 210, 0.07) 0 2px, rgba(0, 0, 0, 0) 2px 9px), linear-gradient(140deg, #9C6B44 0%, #7C5031 60%, #6A4429 100%);
    --edge-a: #5E3D25; --edge-b: #563721;
}
/* HDHMR is green right through, like the boards in the shop. */
.cnc-scene[data-mat="hdhmr"] {
    --face: radial-gradient(rgba(32, 52, 26, 0.22) 0.7px, rgba(0, 0, 0, 0) 1.3px) 0 0 / 5px 5px,
            radial-gradient(rgba(170, 196, 140, 0.2) 0.8px, rgba(0, 0, 0, 0) 1.5px) 2px 3px / 7px 7px,
            linear-gradient(140deg, #7E9B6B 0%, #758F62 55%, #6F8F5E 100%);
    --edge-a: #5F7A50; --edge-b: #577149;
}
.cnc-scene[data-mat="wpc"] {
    --face: linear-gradient(140deg, #FAFAF8 0%, #EDEBE6 60%, #E2E0DA 100%);
    --edge-a: #D6D4CD; --edge-b: #CCCAC2;
}
.cnc-scene[data-mat="ply-veneer"] {
    --face: repeating-linear-gradient(91deg, rgba(110, 62, 24, 0.12) 0 2px, rgba(0, 0, 0, 0) 2px 7px, rgba(255, 228, 186, 0.10) 7px 9px, rgba(0, 0, 0, 0) 9px 16px), linear-gradient(140deg, #CC965F 0%, #B37C47 60%, #A06C3C 100%);
    --edge-a: #E6CDA2; --edge-b: #9E7346;
}

/* Swap motion when a new design is chosen: a short settle into place. */
@keyframes cnc-swap {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
}
@keyframes cnc-swap-fade {
    from { opacity: 0; }
}
.cnc-panel-body.is-swapping { animation: cnc-swap 320ms var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
    .cnc-panel-body.is-swapping { animation: cnc-swap-fade 200ms ease-out both; }
    .cnc-dim, .cnc-glow, .cnc-shadow, .cnc-face::after, .cnc-side::after, .cnc-frame::after { transition-duration: 1ms; }
}

/* No JavaScript: explain instead of showing an empty stage and dead controls. */
.cnc-stage-msg {
    position: absolute;
    inset: auto 20px 20px 20px;
    z-index: 4;
    margin: 0;
    padding: 14px 16px;
    border-radius: var(--pp-radius-sm);
    background: var(--pp-bg);
    color: var(--pp-text-muted);
    font-size: 0.95rem;
    box-shadow: var(--pp-shadow-2);
}
.js .cnc-stage-msg { display: none; }
html:not(.js) .cnc-panel,
html:not(.js) .cnc-controls,
html:not(.js) .cnc-filters,
html:not(.js) .cnc-tile-art { display: none; }
/* Without JavaScript the gallery is a compact list of every design name. */
html:not(.js) .cnc-grid { display: block; columns: 3 200px; column-gap: 24px; }
html:not(.js) .cnc-tile { break-inside: avoid; }
html:not(.js) .cnc-tile-btn { padding: 3px 0; border: 0; background: none; box-shadow: none; cursor: default; }
html:not(.js) .cnc-tile-name { font-size: 0.95rem; font-weight: 500; }

/* ---- Controls under the stage --------------------------------- */
.cnc-controls { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cnc-head { display: grid; gap: 2px; }
.cnc-name {
    margin: 0;
    font-family: var(--pp-font-display);
    font-weight: 700;
    font-stretch: 90%;
    font-size: 1.45rem;
    line-height: 1.15;
    color: var(--pp-text);
}
.cnc-meta { margin: 0; font-size: 0.92rem; color: var(--pp-text-muted); }
.cnc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cnc-label { flex: 0 0 58px; font-size: 0.88rem; font-weight: 600; color: var(--pp-text-muted); }
.cnc-seg { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 0; }

.cnc-pill,
.cnc-chip,
.cnc-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--pp-rule);
    background: var(--pp-bg);
    color: var(--pp-text);
    font-family: var(--pp-font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--dur-hover) ease, border-color var(--dur-hover) ease, color var(--dur-hover) ease,
                transform var(--dur-press) var(--ease-out);
}
.cnc-pill:active, .cnc-chip:active, .cnc-switch:active { transform: scale(0.97); }
.cnc-pill[aria-pressed="true"],
.cnc-chip[aria-pressed="true"] {
    background: var(--pp-text);
    border-color: var(--pp-text);
    color: var(--pp-bg);
}
@media (hover: hover) and (pointer: fine) {
    .cnc-pill:hover, .cnc-chip:hover, .cnc-switch:hover { border-color: var(--pp-text); }
}
.cnc-pill:focus-visible, .cnc-chip:focus-visible, .cnc-switch:focus-visible,
.cnc-tile-btn:focus-visible, .cnc-field input:focus-visible, .cnc-search input:focus-visible,
.cnc-unit input:focus-visible + span {
    outline: 2.5px solid var(--pp-gold);
    outline-offset: 2px;
}
.cnc-swatch { padding: 0 12px 0 9px; gap: 6px; }
.cnc-swatch i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(20, 22, 26, 0.18);
    flex: none;
}
.cnc-swatch[data-mat="mdf-white"] i { background: #F4F1EC; }
.cnc-swatch[data-mat="mdf-pu"] i { background: conic-gradient(#2F6F6B, #B5613E, #C9A24D, #73303E, #283F66, #2F6F6B); }
.cnc-swatch[data-mat="hdhmr"] i { background: radial-gradient(rgba(32, 52, 26, 0.3) 0.6px, rgba(0, 0, 0, 0) 1.1px) 0 0 / 4px 4px, #76935F; }
.cnc-swatch[data-mat="wpc"] i { background: #E9E8E3; }
.cnc-swatch[data-mat="ply-veneer"] i { background: linear-gradient(90deg, #C38D57, #A9733F); }

/* Size fields */
.cnc-size { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cnc-field { position: relative; display: inline-flex; }
.cnc-field input {
    width: 92px;
    height: 42px;
    padding: 0 12px 0 30px;
    border-radius: 999px;
    border: 1.5px solid var(--pp-rule);
    background: var(--pp-bg);
    color: var(--pp-text);
    font: 600 1rem var(--pp-font-ui);
    font-variant-numeric: tabular-nums;
}
.cnc-field input[aria-invalid="true"] { border-color: #B3261E; }
.cnc-field-tag {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pp-text-faint);
    pointer-events: none;
}
.cnc-x { color: var(--pp-text-muted); font-weight: 600; }
.cnc-unit { display: inline-flex; border: 1.5px solid var(--pp-rule); border-radius: 999px; padding: 2px; margin-left: 4px; }
.cnc-unit label { position: relative; cursor: pointer; }
.cnc-unit input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cnc-unit span {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pp-text-muted);
    transition: background-color var(--dur-hover) ease, color var(--dur-hover) ease;
}
.cnc-unit input:checked + span { background: var(--pp-text); color: var(--pp-bg); }

/* Backlight switch */
.cnc-switch { gap: 10px; padding-left: 6px; }
.cnc-switch-knob {
    position: relative;
    width: 38px;
    height: 24px;
    border-radius: 999px;
    background: var(--pp-bg-sunk);
    box-shadow: inset 0 0 0 1px var(--pp-rule);
    transition: background-color var(--dur-hover) ease;
}
.cnc-switch-knob::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pp-bg);
    box-shadow: var(--pp-shadow-1);
    transition: transform var(--dur-ui) var(--ease-out);
}
.cnc-switch[aria-checked="true"] .cnc-switch-knob { background: var(--pp-accent-fill); }
.cnc-switch[aria-checked="true"] .cnc-switch-knob::after { transform: translateX(14px); }

.cnc-error { margin: -2px 0 0; font-size: 0.92rem; font-weight: 600; color: #B3261E; }
.cnc-note, .cnc-advice { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--pp-text-muted); }
.cnc-advice { color: var(--pp-text); }

.cnc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.cnc-actions .pp-btn { min-height: 46px; padding: 0 20px; }
.cnc-actions .pp-btn:disabled,
.cnc-actions .pp-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.cnc-btn-quiet { border-color: var(--pp-rule); }
.cnc-status { margin: 0; font-size: 0.9rem; color: var(--pp-text-muted); overflow-wrap: anywhere; }
.cnc-status:empty { display: none; }

/* ---- Filters and gallery -------------------------------------- */
.cnc-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.cnc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cnc-chip { min-height: 36px; padding: 0 13px; font-size: 0.88rem; }
.cnc-search input {
    width: 100%;
    height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1.5px solid var(--pp-rule);
    background: var(--pp-bg);
    color: var(--pp-text);
    font: 500 1rem var(--pp-font-ui);
}
.cnc-count { margin: 0; font-size: 0.88rem; color: var(--pp-text-muted); }

.cnc-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.cnc-tile[hidden] { display: none; }
.cnc-tile-btn {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 10px 12px;
    border: 1px solid var(--pp-rule-soft);
    border-radius: var(--pp-radius);
    background: var(--pp-bg-card);
    box-shadow: var(--pp-shadow-1);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow var(--dur-ui) var(--ease-out), border-color var(--dur-hover) ease, transform var(--dur-press) var(--ease-out);
}
.cnc-tile-btn:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
    .cnc-tile-btn:hover { box-shadow: var(--pp-shadow-3); border-color: var(--pp-rule); transform: translateY(-2px); }
    .cnc-tile-btn:hover:active { transform: translateY(-2px) scale(0.98); }
}
.cnc-tile-btn[aria-pressed="true"] {
    border-color: var(--pp-accent-fill);
    box-shadow: 0 0 0 2px var(--pp-accent-fill), var(--pp-shadow-2);
}
.cnc-tile-art {
    display: block;
    aspect-ratio: 3 / 4;
    margin-bottom: 6px;
    border-radius: var(--pp-radius-sm);
    background: var(--pp-bg-sunk);
    padding: 10%;
}
.cnc-tile-art svg { display: block; width: 100%; height: 100%; }
.cnc-thumb-board { fill: #2E2A26; }
.cnc-tile-btn[aria-pressed="true"] .cnc-thumb-board { fill: var(--pp-gold); }
.cnc-tile-name { font-family: var(--pp-font-display); font-weight: 600; font-size: 0.98rem; line-height: 1.2; color: var(--pp-text); }
.cnc-tile-meta { font-size: 0.8rem; line-height: 1.35; color: var(--pp-text-muted); }
.cnc-empty { margin: 16px 0 0; color: var(--pp-text-muted); }
.cnc-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--pp-gold);
    text-decoration: underline;
    cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
    .cnc-tile-btn, .cnc-tile-btn:hover { transform: none; }
}

/* ---- Board guide, FAQ ----------------------------------------- */
.cnc-answer {
    max-width: 62ch;
    margin: 0 0 8px;
    font-size: 1.06rem;
    line-height: 1.6;
    color: var(--pp-text-muted);
}
.cnc-matrix-wrap { overflow-x: auto; margin-top: 28px; -webkit-overflow-scrolling: touch; }
.cnc-matrix-wrap .pp-matrix { margin-top: 0; min-width: 520px; }
.cnc-updated { margin: 0 0 8px; font-size: 0.95rem; font-weight: 500; color: var(--pp-text-muted); }

/* ---- Phones --------------------------------------------------- */
@media (max-width: 700px) {
    .cnc-studio { padding-top: 24px; }
    .cnc-specs { grid-template-columns: repeat(3, 1fr); }
    .cnc-label { flex-basis: 100%; }
    .cnc-seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
    .cnc-seg::-webkit-scrollbar { display: none; }
    .cnc-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
    .cnc-chips::-webkit-scrollbar { display: none; }
    .cnc-size-row { align-items: flex-start; }
    .cnc-field input { width: 84px; }
    .cnc-actions .pp-btn { flex: 1 1 auto; }
    .cnc-actions .pp-btn-primary { flex-basis: 100%; }
    .cnc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    /* Three short columns fit a phone: keep Thickness on screen instead of behind a sideways scroll. */
    .cnc-matrix-wrap .pp-matrix { min-width: 0; }
    .cnc-tile-btn { padding: 8px 8px 10px; }
}

/* ---- Use, preset sizes and PU colours -------------------------- */
.cnc-select {
    min-height: 42px;
    max-width: 100%;
    padding: 0 38px 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--pp-rule);
    background: var(--pp-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2314161A' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: var(--pp-text);
    font: 600 0.95rem var(--pp-font-ui);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.cnc-select:focus-visible, .cnc-step:focus-visible, .cnc-pu-swatch:focus-visible, .cnc-pu-custom input:focus-visible + span,
.cnc-fix:focus-visible, .cnc-link:focus-visible { outline: 2.5px solid var(--pp-gold); outline-offset: 2px; }
.cnc-sizes { display: grid; gap: 8px; min-width: 0; flex: 1 1 260px; }
.cnc-presets:empty { display: none; }
.cnc-preset { min-height: 34px; padding: 0 12px; font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.cnc-pu {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: var(--pp-radius-sm);
    background: var(--pp-bg-sunk);
}
.cnc-pu[hidden] { display: none; }
.cnc-pu-swatches { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.cnc-pu-family { display: inline-flex; gap: 4px; }
.cnc-pu-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgba(20, 22, 26, 0.18);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur-press) var(--ease-out);
}
.cnc-pu-swatch:active { transform: scale(0.92); }
.cnc-pu-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--pp-bg), 0 0 0 4px var(--pp-text); }
.cnc-pu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cnc-pu-row[hidden] { display: none; }
.cnc-pu-custom { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.cnc-pu-custom input {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1.5px solid var(--pp-rule);
    border-radius: 50%;
    background: none;
    cursor: pointer;
}
.cnc-pu-custom input::-webkit-color-swatch-wrapper { padding: 2px; }
.cnc-pu-custom input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.cnc-pu-custom input::-moz-color-swatch { border: 0; border-radius: 50%; }
.cnc-small-label { font-size: 0.85rem; font-weight: 600; color: var(--pp-text-muted); }

/* ---- Cutting file ------------------------------------------------ */
.cnc-file {
    display: grid;
    gap: 10px;
    margin: 4px 0 0;
    padding: 14px;
    border: 1px solid var(--pp-rule);
    border-radius: var(--pp-radius);
    min-width: 0;
}
.cnc-file-title { padding: 0 6px; font-family: var(--pp-font-display); font-weight: 700; font-size: 1rem; color: var(--pp-text); }
.cnc-file-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
/* Grid, not flex: a long value wraps inside its own cell instead of pushing the plus button to a new line. */
.cnc-stepper { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 6px 8px; min-width: 0; }
.cnc-stepper > .cnc-small-label, .cnc-stepper > .cnc-link { grid-column: 1 / -1; justify-self: start; }
.cnc-file-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.cnc-file-field > .cnc-small-label { flex: 0 0 100%; }
.cnc-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--pp-rule);
    background: var(--pp-bg);
    color: var(--pp-text);
    font: 600 1.15rem/1 var(--pp-font-ui);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color var(--dur-hover) ease, transform var(--dur-press) var(--ease-out);
}
.cnc-step:active { transform: scale(0.94); }
.cnc-step:disabled { opacity: 0.4; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) { .cnc-step:hover:not(:disabled) { border-color: var(--pp-text); } }
.cnc-step-val { font-weight: 600; font-size: 0.92rem; text-align: center; font-variant-numeric: tabular-nums; }
.cnc-field-sm input { width: 92px; padding: 0 40px 0 14px; }
.cnc-field-unit {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--pp-text-faint);
    pointer-events: none;
}
.cnc-select-sm { min-height: 38px; font-size: 0.9rem; }
.cnc-row-tight { gap: 6px 10px; }
.cnc-row-tight > .cnc-small-label { flex: 0 0 76px; }
.cnc-check { display: grid; gap: 8px; }
.cnc-check:empty { display: none; }
/* A check that takes a while (big curved designs) dims the old result; quick ones never get that far. */
.cnc-check[aria-busy="true"] { opacity: 0.55; transition: opacity 0.2s ease 0.25s; }
.cnc-check-line { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--pp-text); }
.cnc-check-line.is-ok { padding: 8px 12px; border-radius: var(--pp-radius-sm); background: #EEF6EE; color: #1E5631; }
.cnc-check-line.is-warn { font-weight: 700; color: #8A3B12; }
.cnc-issues { margin: 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 0.9rem; line-height: 1.45; color: var(--pp-text); }
.cnc-fixes { display: flex; flex-wrap: wrap; gap: 8px; }
.cnc-fix { background: var(--pp-accent-fill); border-color: var(--pp-accent-fill); color: var(--pp-on-accent); }
@media (hover: hover) and (pointer: fine) { .cnc-fix:hover { background: var(--pp-accent-fill-hover); border-color: var(--pp-accent-fill-hover); } }

/* ---- Gallery: show more ------------------------------------------ */
.cnc-more { display: flex; margin: 18px auto 0; min-height: 46px; padding: 0 22px; }
.cnc-more[hidden] { display: none; }

@media (max-width: 700px) {
    .cnc-file { padding: 12px; }
    .cnc-file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Each stepper gets a full row so minus, value and plus have room. */
    .cnc-file-grid > .cnc-stepper { grid-column: 1 / -1; }
    .cnc-row-tight > .cnc-small-label { flex-basis: 100%; }
    .cnc-select { width: 100%; }
    .cnc-pu-swatch { width: 30px; height: 30px; }
}

