/* =====================================================================================================
   Editor v3 — the WORKSPACE (C03). Loaded after editor.css; every rule is anchored on #nb.nb-v3 so it
   wins over the embedded-page layout that editor.css still carries for the sheet contents.
   Phone first: a top bar, a full-bleed canvas and a bottom sheet with three snap states (peek · half ·
   full). Wide screens: the canvas takes ≥ 70 % and the tools become a side panel.
   ===================================================================================================== */
body.nb-workspace{overflow:hidden}
body.nb-workspace .site-header,body.nb-workspace .site-footer,body.nb-workspace .announce,body.nb-workspace .crumbs{display:none}
body.nb-workspace.has-sticky,body.nb-workspace.nb-open{padding-bottom:0}
#nb.nb-v3{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;height:100dvh;padding:0;background:var(--bg);--nb-top:56px;--nb-peek:0px}
#nb.nb-v3 .wrap{width:auto;margin:0}

/* top bar */
#nb.nb-v3 .nb-topbar{flex:0 0 auto;display:flex;align-items:center;gap:2px;min-height:var(--nb-top);padding:4px 6px calc(4px);background:rgba(247,240,230,.92);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);z-index:3}
#nb.nb-v3 .nb-topbar .group{display:flex;align-items:center;gap:0}
#nb.nb-v3 .nb-topbar .nb-ib{min-width:48px;min-height:48px;border-radius:12px}
#nb.nb-v3 .nb-title{flex:1 1 auto;min-width:0;display:grid;line-height:1.05;padding-inline:4px}
#nb.nb-v3 .nb-title .eyebrow{display:none;font-size:.66rem;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
#nb.nb-v3 .nb-title h1{font-size:1rem;font-family:var(--font-body);font-weight:700;color:var(--burg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html[dir=rtl] #nb.nb-v3 .nb-title h1{font-family:var(--font-arabic)}
#nb.nb-v3 .nb-surfaces{display:flex;gap:2px;margin:0 2px;padding:3px;background:var(--card);border:1px solid var(--line);border-radius:999px;width:max-content}
#nb.nb-v3 .nb-surfaces button{min-height:40px;min-width:48px;padding:0 12px;gap:6px;border-radius:999px;font-size:.82rem}
#nb.nb-v3 .nb-surfaces button svg{width:18px;height:18px}
#nb.nb-v3 .nb-save{min-height:48px;min-width:48px;padding-inline:12px;gap:8px;border-radius:12px}
#nb.nb-v3 .nb-actions .nb-ib{min-width:48px}
@media (max-width:599px){#nb.nb-v3 .nb-surfaces button span,#nb.nb-v3 .nb-save span{display:none}#nb.nb-v3 .nb-surfaces button{padding:0 10px}}
@media (max-width:429px){#nb.nb-v3 .nb-surfaces button{min-width:44px;padding:0 8px}#nb.nb-v3 .nb-topbar{gap:0;padding-inline:4px}#nb.nb-v3 .nb-title{min-width:40px}}
#nb.nb-v3 .nb-surfaces,#nb.nb-v3 .nb-actions{flex:0 0 auto}
/* the history buttons never shrink under the surface toggle (a phone with Shuffle in the bar had redo covered) */
#nb.nb-v3 .nb-history{flex:0 0 auto;display:flex}
#nb.nb-v3 .nb-shuffle{position:static;min-height:48px;padding:0 10px;border-radius:12px}
#nb.nb-v3 .nb-shuffle span{display:none}
@media (min-width:900px){#nb.nb-v3 .nb-shuffle span{display:inline}}

/* the canvas: full-bleed, everything else floats over it */
#nb.nb-v3 .nb-layout{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:0}
#nb.nb-v3 .nb-canvas{flex:1 1 auto;min-height:0;position:relative;display:flex}
#nb.nb-v3 .nb-design-col,#nb.nb-v3 .nb-preview-col{flex:1 1 0;min-width:0;min-height:0;position:relative;display:flex;flex-direction:column}
#nb.nb-v3 .nb-scene{flex:1 1 auto;min-height:0;height:auto;position:relative;overflow:hidden;border-radius:0;border:0;box-shadow:none;background:linear-gradient(180deg,#FBF7F1 0%,#F5EEE3 60%,#E7DAC6 100%);transition:none}
#nb.nb-v3.no-photo .nb-fit::before{background:radial-gradient(ellipse at 50% 55%,rgba(255,255,255,.5),transparent 62%)}
#nb.nb-v3 .nb-modes{position:absolute;top:10px;inset-inline-end:10px;margin:0;width:max-content;max-width:calc(100% - 20px);z-index:4;overflow-x:auto;scrollbar-width:none}
@media (max-width:599px){#nb.nb-v3 .nb-modes{top:auto;bottom:12px;inset-inline:10px;margin-inline:auto;max-width:calc(100% - 96px)}#nb.nb-v3 .nb-scene-note{bottom:72px}}
#nb.nb-v3 .nb-modes[hidden]{display:none}
#nb.nb-v3 .nb-modes button{min-height:40px;padding:0 12px;font-size:.82rem;flex:0 0 auto}
#nb.nb-v3 .nb-dims{position:absolute;top:10px;inset-inline-start:10px;z-index:4;margin:0;padding:6px 10px;background:rgba(246,240,230,.92);border:1px solid var(--line);border-radius:12px}
#nb.nb-v3 .nb-dims[hidden],#nb.nb-v3 .nb-dims:empty{display:none}
#nb.nb-v3 .nb-scene-note{top:auto;bottom:72px;inset-inline:12px;z-index:2}
#nb.nb-v3 .nb-selbar{flex-direction:column;align-items:center;gap:0;padding:2px 6px;border-radius:22px;bottom:12px;z-index:5}
#nb.nb-v3 .nb-selbar .nb-ib{min-width:48px;min-height:48px}
#nb.nb-v3 .nb-stage-host.nb-drop-over{outline:3px dashed rgba(31,94,91,.6);outline-offset:-3px;border-radius:12px}
#nb.nb-v3 .nb-mini{position:absolute;inset-inline-end:12px;bottom:12px;width:72px;height:72px;z-index:4;border-radius:16px}
#nb.nb-v3 .nb-mini[hidden]{display:none}
#nb.nb-v3[data-coming-soon="uv"] .nb-scene-note{background:var(--gold);color:var(--ink);border-color:var(--gold)}

/* the chooser fills the canvas and scrolls inside it (the page itself never scrolls in the workspace) */
#nb.nb-v3 .nb-chooser{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;place-content:start center;padding:20px 16px calc(24px + env(safe-area-inset-bottom));background:var(--bg);backdrop-filter:none;-webkit-backdrop-filter:none}
#nb.nb-v3 .nb-chooser[hidden]{display:none}
#nb.nb-v3 .nb-chooser-grid.many{max-height:none;overflow:visible}
#nb.nb-v3.nb-empty .nb-tools,#nb.nb-v3.nb-empty .nb-selbar,#nb.nb-v3.nb-empty .nb-mini,#nb.nb-v3.nb-empty .nb-dims,#nb.nb-v3.nb-empty .nb-scene-note,#nb.nb-v3.nb-empty .nb-history,#nb.nb-v3.nb-empty .nb-surfaces{display:none}
#nb.nb-v3.nb-empty .nb-fit{visibility:hidden}

/* live preview */
#nb.nb-v3 .nb-preview-box{flex:1 1 auto;min-height:0;aspect-ratio:auto;max-height:none;border-radius:0;border:0;box-shadow:none;touch-action:none}
#nb.nb-v3 .nb-preview-bar{position:absolute;top:8px;inset-inline-end:8px;z-index:4;min-height:0;gap:2px;padding:2px;background:rgba(246,240,230,.92);border:1px solid var(--line);border-radius:14px}
#nb.nb-v3 .nb-preview-bar .nb-preview-title{display:none}
#nb.nb-v3 .nb-preview-hint{position:absolute;bottom:10px;inset-inline:12px;z-index:2;margin:0;padding:6px 10px;font-size:.74rem;background:rgba(246,240,230,.85);border-radius:10px}
#nb.nb-v3 .nb-preview-empty{display:none}
#nb.nb-v3.nb-empty .nb-preview-empty{display:grid}
#nb.nb-v3.nb-empty .nb-preview-host{visibility:hidden}

/* the tools: a bottom sheet with three snap states */
#nb.nb-v3 .nb-tools{flex:0 0 auto;display:flex;flex-direction:column;position:relative;z-index:6;background:var(--card);border-top:1px solid var(--line);border-radius:22px 22px 0 0;box-shadow:0 -12px 34px rgba(34,28,24,.16);margin:0;height:var(--nb-sheet-drag,auto);max-height:92dvh;transition:height .22s cubic-bezier(.2,.8,.2,1)}
#nb.nb-v3.sheet-dragging .nb-tools{transition:none}
#nb.nb-v3 .nb-tools[hidden]{display:none}
#nb.nb-v3 .nb-sheet-head{flex:0 0 auto;touch-action:none;user-select:none;-webkit-user-select:none}
#nb.nb-v3 .nb-sheet-handle{display:grid;place-items:center;width:100%;min-height:22px;padding:6px 0 2px;background:transparent}
#nb.nb-v3 .nb-sheet-handle i{display:block;width:44px;height:5px;border-radius:99px;background:var(--line)}
#nb.nb-v3 .nb-toolbar{display:flex;gap:6px;overflow-x:auto;padding:4px 10px 8px;scrollbar-width:none;background:transparent;border:0;border-radius:0}
#nb.nb-v3 .nb-toolbar::-webkit-scrollbar{display:none}
#nb.nb-v3 .nb-tool{flex:0 0 auto;min-width:64px;min-height:56px;padding:6px 8px;gap:4px;font-size:.72rem;border-radius:14px;background:var(--bg)}
#nb.nb-v3 .nb-tool svg{width:24px;height:24px}
#nb.nb-v3 .nb-dock{padding:0 10px}
#nb.nb-v3 .nb-dock:empty{display:none}
#nb.nb-v3 .nb-dock .nb-buy{margin:0 0 6px;padding:6px 10px;gap:8px 10px;border-radius:14px}
#nb.nb-v3 .nb-dock .nb-price b{font-size:1.15rem}
#nb.nb-v3 .nb-dock .nb-buy .btn{min-height:44px}
#nb.nb-v3 .nb-sheet{flex:1 1 auto;min-height:0;display:none;flex-direction:column;border:0;border-radius:0;background:transparent}
#nb.nb-v3 .nb-sheet header{padding:0 8px 4px 16px;border-bottom:1px solid var(--line)}
#nb.nb-v3 .nb-sheet .body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:12px 16px calc(16px + env(safe-area-inset-bottom));touch-action:pan-y}
#nb.nb-v3 .nb-sheet-foot{display:none;padding:8px 16px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line)}
#nb.nb-v3 .nb-hint,#nb.nb-v3 .nb-note{margin:0;font-size:.74rem;text-align:start}
#nb.nb-v3 .nb-note{margin-top:4px}
@media (max-width:899px){
  #nb.nb-v3[data-sheet=peek] .nb-tools{height:var(--nb-sheet-drag,auto)}
  #nb.nb-v3[data-sheet=half] .nb-tools{height:var(--nb-sheet-drag,46dvh)}
  #nb.nb-v3[data-sheet=full] .nb-tools{height:var(--nb-sheet-drag,92dvh)}
  #nb.nb-v3[data-sheet=full] .nb-canvas{min-height:0}
  #nb.nb-v3[data-sheet=half] .nb-sheet,#nb.nb-v3[data-sheet=full] .nb-sheet{display:flex}
  #nb.nb-v3[data-sheet=full] .nb-sheet-foot{display:block}
  #nb.nb-v3 .nb-sheet[aria-hidden=true]{display:none}
  #nb.nb-v3 .nb-toolbar{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  #nb.nb-v3[data-sheet=half] .nb-toolbar,#nb.nb-v3[data-sheet=full] .nb-toolbar{padding-bottom:8px}
  /* one surface at a time */
  #nb.nb-v3[data-surface=design] .nb-preview-col{display:none}
  #nb.nb-v3[data-surface=preview] .nb-design-col{display:none}
  #nb.nb-v3[data-surface=preview] .nb-mini{display:none}
  /* the icon tray reads as a strip in the half state: swipe sideways, drag onto the piece */
  #nb.nb-v3[data-sheet=half] .nb-tray-grid{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:2px 2px 8px}
  #nb.nb-v3[data-sheet=half] .nb-tray-grid .nb-asset{flex:0 0 76px}
  #nb.nb-v3[data-sheet=half] .nb-tray .hint{display:none}
}
/* wide: the canvas keeps ≥ 70 %, the tools are a side panel that is always open */
@media (min-width:900px){
  #nb.nb-v3 .nb-topbar{padding-inline:12px}
  #nb.nb-v3 .nb-title{display:grid}
  #nb.nb-v3 .nb-title .eyebrow{display:block}
  #nb.nb-v3 .nb-title h1{font-size:1.15rem}
  #nb.nb-v3 .nb-layout{flex-direction:row}
  #nb.nb-v3 .nb-canvas{flex:1 1 70%;min-width:70%}
  #nb.nb-v3 .nb-tools{flex:0 0 min(30%,380px);width:min(30%,380px);max-height:none;height:auto;border-top:0;border-inline-start:1px solid var(--line);border-radius:0;box-shadow:none;transition:none}
  #nb.nb-v3 .nb-sheet-handle{display:none}
  #nb.nb-v3 .nb-sheet-head{touch-action:auto}
  #nb.nb-v3 .nb-toolbar{flex-wrap:wrap;overflow:visible;padding:10px 12px 6px;gap:6px}
  #nb.nb-v3 .nb-tool{flex:1 1 72px;min-height:60px}
  #nb.nb-v3 .nb-dock{order:3;padding:8px 12px 10px;border-top:1px solid var(--line)}
  #nb.nb-v3 .nb-sheet-head{display:flex;flex-direction:column}
  #nb.nb-v3 .nb-sheet{display:flex}
  #nb.nb-v3 .nb-sheet[aria-hidden=true] header,#nb.nb-v3 .nb-sheet[aria-hidden=true] .body{visibility:hidden}
  #nb.nb-v3 .nb-sheet header .nb-ib{display:none}
  #nb.nb-v3 .nb-sheet .body{padding:12px 16px 16px}
  #nb.nb-v3 .nb-sheet-foot{display:block}
  #nb.nb-v3 .nb-mini{display:none}
  /* both surfaces side by side on the design surface; the 3D preview alone on the preview surface */
  #nb.nb-v3.has-preview[data-surface=design] .nb-design-col{flex:1.25 1 0}
  #nb.nb-v3.has-preview[data-surface=design] .nb-preview-col{flex:.85 1 0;border-inline-start:1px solid var(--line)}
  #nb.nb-v3.has-preview[data-surface=preview] .nb-design-col{display:none}
  #nb.nb-v3 .nb-preview-bar .nb-preview-title{display:inline-flex;padding-inline:8px}
}

/* neutralise the embedded-page mechanics editor.css still applies (sticky scene, fixed toolbar and sheet) */
#nb.nb-v3 .nb-scene{top:auto;z-index:auto}
#nb.nb-v3 .nb-layout{align-items:stretch}
#nb.nb-v3 .nb-tools{top:auto;bottom:auto}
#nb.nb-v3 .nb-toolbar{position:static;bottom:auto;box-shadow:none;border-width:0}
#nb.nb-v3 .nb-sheet{position:static;bottom:auto;transform:none;visibility:visible;max-height:none;min-height:0;box-shadow:none;transition:none}
#nb.nb-v3 .nb-tool[aria-pressed=true]{background:var(--burg);color:var(--color-on-primary);box-shadow:0 8px 18px rgba(107,29,47,.28)}
/* while choosing how to start, the top bar keeps only back + title (the chooser lists the modes) */
#nb.nb-v3.nb-empty .nb-modes,#nb.nb-v3.nb-empty .nb-save,#nb.nb-v3.nb-empty .nb-shuffle{display:none}

/* ---- C04: parts of the piece, material photos, the focus card ---- */
.nb-parts{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:2px 2px 6px}
.nb-parts::-webkit-scrollbar{display:none}
.nb-parts{min-height:128px;align-items:stretch}
.nb-part{flex:0 0 100px;height:116px;display:grid;grid-template-rows:56px auto auto;align-content:start;justify-items:center;gap:4px;padding:8px 6px;border:1.5px solid var(--line);border-radius:14px;background:#fff;font-size:.7rem;line-height:1.15;text-align:center;color:var(--ink)}
.nb-part i{width:56px;height:56px;border-radius:12px;background:var(--sw) center/cover no-repeat;box-shadow:inset 0 0 0 1px rgba(0,0,0,.08),0 3px 8px rgba(34,28,24,.12)}
.nb-part.mirror i,.nb-part.metal i{background:linear-gradient(135deg,color-mix(in srgb,var(--sw) 55%,#fff),var(--sw) 45%,color-mix(in srgb,var(--sw) 70%,#fff) 55%,color-mix(in srgb,var(--sw) 72%,#000))}
.nb-part i[style]{background:var(--sw) center/cover no-repeat}
.nb-part b{font-size:.74rem;color:var(--burg)}
.nb-part small{color:var(--muted)}
.nb-part[aria-pressed=true]{border-color:var(--burg);box-shadow:inset 0 0 0 1px var(--burg);background:var(--bg)}
.nb-mat.has-photo i{background:var(--sw) center/cover no-repeat}
.nb-mat-focus{display:grid;grid-template-columns:96px minmax(0,1fr);gap:12px;align-items:center;padding:10px;border:1.5px solid var(--line);border-radius:16px;background:#fff}
.nb-mat-focus img,.nb-mat-focus i{width:96px;height:96px;border-radius:12px;object-fit:cover;display:block;background:var(--sw)}
.nb-mat-focus b{display:block;color:var(--burg);font-size:.95rem}
.nb-mat-focus small{display:block;color:var(--muted);font-size:.76rem;margin-bottom:8px}
.nb-mat-focus .btn{min-height:40px;gap:6px;font-size:.82rem;padding-inline:12px}
.nb-mat-focus .btn svg{width:18px;height:18px}
/* with the sheet fully open the canvas is out of sight: nothing floats over it */
@media (max-width:899px){#nb.nb-v3[data-sheet=full] .nb-modes,#nb.nb-v3[data-sheet=full] .nb-dims,#nb.nb-v3[data-sheet=full] .nb-selbar,#nb.nb-v3[data-sheet=full] .nb-mini,#nb.nb-v3[data-sheet=full] .nb-scene-note{display:none}}

/* ---- C05: colour swatches that are real PLA spools; the piece fills the canvas ---- */
.nb-swatch.spool{background:var(--sw) center/cover no-repeat;border-width:2px}
.nb-swatches.spools .nb-swatch{width:58px;height:58px;border-radius:14px}
.nb-selcolors .nb-swatch.spool{width:38px;height:38px;border-radius:10px}

/* ---- C08: the jewellery workspace — the piece unrolled on the design surface ---- */
#nb.nb-v3.jw .nb-scene{background:linear-gradient(180deg,#FBF7F1 0%,#F3ECE2 100%)}
#nb.nb-v3.jw .nb-fit{visibility:hidden}
.jw-unrolled{position:absolute;inset:0;display:grid;place-items:center;padding:56px 14px 24px;visibility:visible}
.jw-unrolled svg.jw-flat{width:100%;height:100%;max-width:820px;overflow:visible}
.jw-strip{cursor:pointer}
.jw-strip .jw-metal > *{fill:url(#jw-m);stroke:rgba(40,30,20,.35);stroke-width:.15}
.jw-strip[aria-selected=true] .jw-metal > *{stroke:#6B1D2F;stroke-width:.45}
.jw-strip-label{font-family:var(--font-body);fill:#6B5F55;letter-spacing:.02em}
html[dir=rtl] .jw-strip-label{font-family:var(--font-arabic)}
.jw-icons .nb-asset svg{width:34px;height:34px}
#nb.nb-v3.jw .nb-preview-box{background:radial-gradient(ellipse at 50% 42%,#FBF7F2 0%,#EDE3D7 55%,#CDBFAF 100%)}
#nb.nb-v3[data-coming-soon="f1"] .nb-scene-note{background:var(--gold);color:var(--ink);border-color:var(--gold)}

/* ---- C10: the price breakdown (a model with placeholders reads "on request") ---- */
.pb{margin-top:12px;padding:12px 14px;border:1.5px solid var(--line);border-radius:14px;background:#fff}
.pb h3{margin:0 0 8px}
.pb-rows{margin:0;display:grid;gap:6px}
.pb-row{display:flex;justify-content:space-between;gap:10px;font-size:.86rem}
.pb-row dt{color:var(--ink)} .pb-row dd{margin:0;color:var(--burg);font-weight:600;text-align:end}
.pb-row.ph dd{color:var(--muted);font-weight:400;font-style:italic}
.pb-total{display:flex;justify-content:space-between;align-items:baseline;gap:10px;margin:10px 0 4px;padding-top:8px;border-top:1px solid var(--line);font-size:.95rem}
.pb-total strong{color:var(--burg)} .pb-total small{display:block;color:var(--muted);font-weight:400;font-size:.74rem}

/* Designer look: a text colour too close to the piece is greyed out and cannot be picked */
#nb.nb-v3 .nb-swatch.blocked{opacity:.28;cursor:not-allowed;position:relative;filter:grayscale(.4)}
#nb.nb-v3 .nb-swatch.blocked::after{content:"";position:absolute;inset:18% 48%;background:#4A1120;transform:rotate(45deg);border-radius:2px}

/* Designer §7: relief icons (images) in the tray; the icon-colour switch */
#nb.nb-v3 .nb-asset.art img{width:100%;aspect-ratio:1;object-fit:contain;display:block;pointer-events:none}
#nb.nb-v3 .nb-iconmode{margin-bottom:10px}
/* phones: a narrower Shuffle leaves the title room beside undo / redo / the surface toggle */
@media (max-width:429px){#nb.nb-v3 .nb-shuffle{min-height:44px;min-width:40px;padding:0 6px}#nb.nb-v3 .nb-shuffle svg{width:20px;height:20px}#nb.nb-v3 .nb-title{min-width:0}}
