/* Workspaces: Atelier/Live studio, Darkroom, Booth. */

.studio { display: grid; grid-template-columns: 52px 300px minmax(0, 1fr) 288px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.rail { background: var(--studio-1); border-right: 1px solid var(--studio-line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; overflow-y: auto; scrollbar-width: none; }
.rail hr { width: 24px; border: 0; border-top: 1px solid var(--studio-line); margin: 6px 0; }
.rail .ibtn { width: 40px; height: 40px; position: relative; }
.rail .ibtn[aria-pressed='true']::before { content: ''; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 2px; background: var(--rouge-lit); }

/* Stage */
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background:
  radial-gradient(ellipse at 50% 40%, #1b1715 0%, var(--studio-0) 70%); touch-action: none; }
.stage__viewport { position: absolute; inset: 0; overflow: hidden; }
.stage__canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.stage__canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage__canvas video { display: none; }
.stage[data-tool='hand'] .stage__viewport { cursor: grab; }
.stage[data-tool='hand'].is-panning .stage__viewport { cursor: grabbing; }
.stage.has-brush .stage__viewport { cursor: none; }
.brush-cursor { position: absolute; left: 0; top: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.45); pointer-events: none; transform: translate(-50%, -50%); display: none; z-index: 4; }
.stage.has-brush .brush-cursor.is-on { display: block; }
.brush-cursor::after { content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 2px; margin: -1px; background: #fff; }

.split-handle { position: absolute; top: 0; bottom: 0; width: 40px; margin-left: -20px; cursor: ew-resize; z-index: 5; display: none; touch-action: none; }
.split-handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--vellum); box-shadow: 0 0 10px rgba(0,0,0,.5); }
.split-handle span { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; background: var(--vellum); box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.split-handle span::before, .split-handle span::after { content: ''; position: absolute; top: 50%; width: 5px; height: 5px; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.split-handle span::before { left: 9px; transform: translateY(-50%) rotate(-45deg); }
.split-handle span::after { right: 9px; transform: translateY(-50%) rotate(135deg); }
.stage.is-comparing .split-handle { display: block; }
.split-tags { position: absolute; top: 12px; left: 12px; right: 12px; display: none; justify-content: space-between; pointer-events: none; z-index: 4; }
.stage.is-comparing .split-tags { display: flex; }
.split-tags span { font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: var(--track-caps); text-transform: uppercase; background: rgba(13,11,10,.7); padding: 4px 8px; }

.stage__top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; z-index: 3; }
.stage__top > * { pointer-events: auto; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; background: rgba(21,18,17,.82); border: 1px solid var(--studio-line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: var(--t-micro); letter-spacing: 0.04em; color: var(--studio-text); }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--studio-faint); }
.chip.is-ok i { background: #8fc493; }
.chip.is-warn i { background: #e0b25b; }
.chip.is-bad i { background: var(--rouge-lit); }
.stage__bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; background: rgba(21,18,17,.88); border: 1px solid var(--studio-line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 3; max-width: calc(100% - 24px); }
.stage__bar .zoom-val { font-family: var(--font-mono); font-size: var(--t-micro); min-width: 46px; text-align: center; color: var(--studio-muted); }
.stage__bar .sep { width: 1px; height: 20px; background: var(--studio-line); margin: 0 4px; }
.stage__actions { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px; z-index: 3; }

.shutter { width: 68px; height: 68px; border-radius: 50%; border: 2px solid var(--vellum); display: grid; place-items: center; transition: transform var(--d-fast) var(--ease-out); }
.shutter::after { content: ''; width: 54px; height: 54px; border-radius: 50%; background: var(--vellum); transition: transform var(--d-fast), background var(--d-fast); }
.shutter:hover::after { background: #fff; }
.shutter:active::after { transform: scale(0.88); }
.shutter.is-busy::after { background: var(--rouge-lit); transform: scale(0.6); border-radius: 4px; }
.live-controls { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; align-items: center; gap: 18px; z-index: 3; pointer-events: none; }
.live-controls > * { pointer-events: auto; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 6; font-family: var(--font-display); font-size: clamp(6rem, 18vw, 14rem); color: var(--vellum); text-shadow: 0 10px 40px rgba(0,0,0,.5); }
.countdown span { animation: count 1000ms var(--ease-out) forwards; }
.flash { position: absolute; inset: 0; background: #fff; pointer-events: none; z-index: 7; animation: flash 600ms var(--ease-out) forwards; }
.scan-line { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.scan-line::after { content: ''; position: absolute; left: 0; right: 0; height: 30%; background: linear-gradient(to bottom, transparent, rgba(231,195,180,.14), transparent); animation: scan 1.6s var(--ease-in-out) infinite; }

.cam-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; z-index: 2; }
.cam-state .empty__card { gap: 16px; }

/* Product controls block */
.pcontrols { display: grid; gap: 14px; }
.pcontrols__head { display: grid; gap: 4px; }
.pcontrols__head h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.45rem; line-height: 1.1; }
.pcontrols__head p { color: var(--studio-muted); font-size: var(--t-small); }

/* Darkroom */
.darkroom { display: grid; grid-template-columns: 132px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.filmstrip { background: var(--studio-1); border-right: 1px solid var(--studio-line); overflow-y: auto; padding: 10px; display: grid; gap: 10px; align-content: start; scrollbar-width: thin; }
.film { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; background: var(--studio-2); border: 1px solid var(--studio-line); overflow: hidden; }
.film canvas, .film img { width: 100%; height: 100%; object-fit: cover; }
.film[aria-selected='true'] { border-color: var(--vellum); box-shadow: 0 0 0 1px var(--vellum); }
.film__del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; background: rgba(13,11,10,.75); color: var(--studio-text); opacity: 0; transition: opacity var(--d-fast); }
.film:hover .film__del, .film:focus-within .film__del { opacity: 1; }
.film__del .i { width: 13px; height: 13px; }
.film__n { position: absolute; left: 6px; bottom: 4px; font-family: var(--font-mono); font-size: 10px; color: rgba(255,255,255,.8); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.filmstrip .add { aspect-ratio: 4 / 5; border: 1px dashed var(--studio-line-2); display: grid; place-items: center; color: var(--studio-muted); gap: 6px; font-size: var(--t-micro); text-align: center; padding: 6px; }
.dr-stage { position: relative; display: grid; place-items: center; padding: 28px; min-width: 0; min-height: 0; background: radial-gradient(ellipse at 50% 40%, #1b1715 0%, var(--studio-0) 70%); }
.dr-stage canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter { display: grid; gap: 6px; text-align: left; font-size: var(--t-micro); color: var(--studio-muted); }
.filter canvas { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--studio-line); background: var(--studio-2); transition: border-color var(--d-fast); }
.filter[aria-pressed='true'] { color: var(--studio-text); }
.filter[aria-pressed='true'] canvas { border-color: var(--vellum); box-shadow: 0 0 0 1px var(--vellum); }

/* Booth */
.booth { display: grid; grid-template-columns: 320px minmax(0, 1fr) 200px; grid-template-rows: minmax(0, 1fr); height: 100%; }
.layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.layout-btn { display: grid; gap: 6px; justify-items: center; font-size: 10px; color: var(--studio-muted); padding: 8px 2px; border: 1px solid var(--studio-line); text-align: center; line-height: 1.2; }
.layout-btn svg { width: 34px; height: 40px; }
.layout-btn[aria-pressed='true'] { border-color: var(--vellum); color: var(--studio-text); background: var(--studio-2); }
.bg-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.bg-swatches button { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); position: relative; }
.bg-swatches button[aria-pressed='true']::after { content: ''; position: absolute; inset: -4px; border: 1.5px solid var(--studio-text); border-radius: 50%; }
.field { display: grid; gap: 6px; }
.field label { color: var(--studio-muted); }
.field input[type='text'] { height: 36px; background: var(--studio-0); border: 1px solid var(--studio-line-2); padding: 0 10px; color: var(--studio-text); width: 100%; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--studio-text); }
.check input { width: 16px; height: 16px; accent-color: var(--rouge-lit); }
.booth-stage { position: relative; display: grid; place-items: center; padding: 28px; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #1b1715 0%, var(--studio-0) 70%); }
.booth-stage canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: pointer; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.tray { background: var(--studio-1); border-left: 1px solid var(--studio-line); overflow-y: auto; padding: 10px; display: grid; gap: 10px; align-content: start; }
.tray .film { cursor: grab; }
.slot-hint { font-size: var(--t-micro); color: var(--studio-faint); line-height: 1.5; }

/* Shape handles (optional point editing) */
.handles { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.handle { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: auto; cursor: grab; touch-action: none; display: grid; place-items: center; }
.handle::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--vellum); box-shadow: 0 0 0 1.5px var(--rouge-lit), 0 2px 6px rgba(0,0,0,.5); transition: transform var(--d-fast); }
.handle:hover::before, .handle.is-dragging::before { transform: scale(1.4); }
.handle.is-dragging { cursor: grabbing; }
.handle--center { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.handle--center::before { width: 14px; height: 14px; background: transparent; border: 1.5px solid var(--vellum); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.handle--center::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--rouge-lit); }
@media (pointer: coarse) { .handle { width: 34px; height: 34px; margin: -17px 0 0 -17px; } }
.dr-stage, .booth-stage { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.dr-stage > canvas, .booth-stage > canvas { justify-self: center; align-self: center; }
.film > canvas, .film > img { position: absolute; inset: 0; }
.stage[data-mode='live'] .stage__bar:not(.live-controls .stage__bar) { bottom: auto; top: 12px; left: 50%; }
.stage[data-mode='live'] .stage__top { top: 58px; }
@media (max-width: 900px) { .stage[data-mode='live'] .stage__top { top: 54px; } }
